@extension.dev/skill 0.5.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +2 -2
- package/CHANGELOG.md +131 -2
- package/LICENSE +201 -21
- package/README.md +52 -16
- package/package.json +15 -7
- package/skills/extension-dev/SKILL.md +111 -29
- package/skills/extension-dev/references/cross-browser.md +49 -33
- package/skills/extension-dev/references/debugging.md +149 -48
- package/skills/extension-dev/references/migrating.md +72 -0
- package/skills/extension-dev/references/project-structure.md +42 -6
- package/skills/extension-dev/references/publishing.md +186 -26
- package/skills/extension-dev/references/store-md.md +19 -5
- package/skills/extension-dev/references/surface-content.md +54 -0
- package/skills/extension-dev/references/surface-devtools.md +49 -0
- package/skills/extension-dev/references/surface-newtab.md +44 -0
- package/skills/extension-dev/references/surface-options.md +41 -0
- package/skills/extension-dev/references/surface-popup.md +44 -0
- package/skills/extension-dev/references/surface-sidepanel.md +52 -0
- package/skills/extension-dev/references/templates.md +8 -5
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Surface: side panel
|
|
2
|
+
|
|
3
|
+
The side panel is a page docked beside the tab strip that stays open while
|
|
4
|
+
the person switches tabs. Read this when the extension's main surface is a
|
|
5
|
+
`side_panel` (Chromium) or `sidebar_action` (Firefox).
|
|
6
|
+
|
|
7
|
+
## Manifest
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
"chromium:side_panel": { "default_path": "sidebar/index.html" },
|
|
11
|
+
"firefox:sidebar_action": { "default_panel": "sidebar/index.html" },
|
|
12
|
+
"chromium:permissions": ["sidePanel"],
|
|
13
|
+
"chromium:action": { "default_icon": { "16": "images/icon.png" }, "default_title": "Open side panel" },
|
|
14
|
+
"firefox:browser_action": { "default_icon": { "16": "images/icon.png" } }
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The `action` has no `default_popup` on purpose: it is the panel's opener.
|
|
18
|
+
Removing it leaves a panel nobody can open from the toolbar.
|
|
19
|
+
|
|
20
|
+
## Files the starter lays out
|
|
21
|
+
|
|
22
|
+
- `sidebar/index.html`, `sidebar/scripts.js`, `sidebar/SidebarApp.js`,
|
|
23
|
+
`sidebar/styles.css`: the panel document, its script, its UI and styles.
|
|
24
|
+
- `background.js`: the worker. At its top level it calls
|
|
25
|
+
`chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: true })`, and
|
|
26
|
+
on Firefox it opens the sidebar from `browserAction.onClicked`.
|
|
27
|
+
- `content/scripts.js`, `content/ContentApp.js`: a content script whose UI
|
|
28
|
+
sends `openSidebar` to the worker; the worker calls
|
|
29
|
+
`chrome.sidePanel.open({ tabId })` synchronously inside that gesture.
|
|
30
|
+
|
|
31
|
+
## What bites
|
|
32
|
+
|
|
33
|
+
- `sidePanel.open()` only works inside a user gesture, and the gesture is
|
|
34
|
+
gone after any `await`. Call it synchronously from the message handler.
|
|
35
|
+
- `setPanelBehavior` affects future action clicks only; registering it inside
|
|
36
|
+
`onClicked` swallows the first click, so it stays at the worker's top level.
|
|
37
|
+
- The panel has no tab of its own. To read the page it sits beside, query
|
|
38
|
+
`chrome.tabs.query({ active: true, currentWindow: true })` and message the
|
|
39
|
+
content script in that tab, or use `chrome.scripting.executeScript` with
|
|
40
|
+
the `scripting` permission and host access.
|
|
41
|
+
- The panel outlives tab switches. Listen to `chrome.tabs.onActivated` and
|
|
42
|
+
`chrome.tabs.onUpdated` and refresh what it shows.
|
|
43
|
+
- Firefox needs no `sidePanel` permission and opens the sidebar from
|
|
44
|
+
`browser.sidebarAction.open()`, also gesture-bound.
|
|
45
|
+
|
|
46
|
+
## What proves it works
|
|
47
|
+
|
|
48
|
+
- Clicking the toolbar icon opens the panel and it paints without errors.
|
|
49
|
+
- What the panel lists matches the page beside it, and changes when the
|
|
50
|
+
active tab changes.
|
|
51
|
+
- The worker's log shows the open request when the content script's UI asks
|
|
52
|
+
for it.
|
|
@@ -14,8 +14,8 @@ reference for the pattern.
|
|
|
14
14
|
|
|
15
15
|
## Discovering templates
|
|
16
16
|
|
|
17
|
-
Use the MCP
|
|
18
|
-
framework, tags, or free text, and `
|
|
17
|
+
Use the MCP tool `extension_templates`: `action: "list"` filters the catalog by
|
|
18
|
+
surface, framework, tags, or free text, and `action: "source"` reads a
|
|
19
19
|
template's files without cloning. These cover discovery end to end.
|
|
20
20
|
|
|
21
21
|
The underlying registry is `templates-meta.json`, a static JSON asset
|
|
@@ -39,9 +39,12 @@ the SPA HTML. Use the GitHub release asset or raw.githubusercontent.com.
|
|
|
39
39
|
| Content script | `content` | `content-react` | `content-vue` | `content-svelte` | |
|
|
40
40
|
| Sidebar | `sidebar` | `sidebar-shadcn` | | | `ai-claude` |
|
|
41
41
|
| Action popup | `action` | | | | `ai-chatgpt` |
|
|
42
|
-
| New tab | `
|
|
42
|
+
| New tab | `newtab` | `newtab-react` | `newtab-vue` | `newtab-svelte` | |
|
|
43
43
|
| Full framework | `javascript` | `react` | `vue` | `svelte` | |
|
|
44
44
|
|
|
45
|
+
`newtab-preact` and `newtab-typescript` cover Preact and plain TypeScript
|
|
46
|
+
for the new tab surface.
|
|
47
|
+
|
|
45
48
|
For complex content script patterns (multi-level imports, main-world
|
|
46
49
|
isolation), read `content-multi-one-entry`, `content-multi-three-entries`,
|
|
47
50
|
and `content-main-world`.
|
|
@@ -67,8 +70,8 @@ and zip URLs also work as `--template` values.
|
|
|
67
70
|
|
|
68
71
|
When building an unfamiliar feature, read the actual source of the closest
|
|
69
72
|
template instead of recalling API shapes from memory. The MCP tool
|
|
70
|
-
`
|
|
71
|
-
browsing by hand, each template lives at:
|
|
73
|
+
`extension_templates` with `action: "source"` returns a template's files
|
|
74
|
+
directly. For browsing by hand, each template lives at:
|
|
72
75
|
|
|
73
76
|
```
|
|
74
77
|
https://github.com/extension-js/examples/tree/main/examples/<slug>/src
|