Skip to content

Commit e8ca1d6

Browse files
committed
Add a mermaid diagram for the new layout.
1 parent b020899 commit e8ca1d6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

browser-extension/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,32 @@ This is a [WXT](https://wxt.dev/)-based browser extension that
3434
### Entry points
3535

3636
- `src/entrypoints/content.ts` - injected into every webpage
37+
- `src/entrypoints/background.ts` - service worker that manages state and handles messages
3738
- `src/entrypoints/popup` - html/css/ts which opens when the extension's button gets clicked
3839

40+
```mermaid
41+
graph TD
42+
Content[Content Script<br/>content.ts]
43+
Background[Background Script<br/>background.ts]
44+
Popup[Popup Script<br/>popup/main.ts]
45+
46+
Content -->|ENHANCED/DESTROYED<br/>CommentEvent| Background
47+
Popup -->|GET_OPEN_SPOTS<br/>SWITCH_TO_TAB| Background
48+
Background -->|GetOpenSpotsResponse<br/>spots array| Popup
49+
50+
Background -.->|manages| Storage[Comment State Storage<br/>openSpots JsonMap]
51+
Content -.->|enhances| TextArea[textarea elements<br/>on web pages]
52+
Popup -.->|displays| UI[Extension UI<br/>list of comment spots]
53+
54+
classDef entrypoint fill:#e1f5fe
55+
classDef storage fill:#f3e5f5
56+
classDef ui fill:#e8f5e8
57+
58+
class Content,Background,Popup entrypoint
59+
class Storage storage
60+
class TextArea,UI ui
61+
```
62+
3963
### Architecture
4064

4165
Every time a `textarea` shows up on a page, on initial load or later on, it gets passed to a list of `CommentEnhancer`s. Each one gets a turn to say "I can enhance this box!". They show that they can enhance it by returning a [`CommentSpot`, `Overtype`].

0 commit comments

Comments
 (0)