feat(skin): dock recovery as host-owned toolbar buttons

Add chrome.json slot mode "toolbar" with grouped and per-action recovery buttons, page-specific anchor candidates and sanitized toolbar style tokens. Keep the floating capsule as the bad-anchor fallback, hide the duplicate plugin launcher, and preserve legacy capsule slots. Document the full contract, add a minimal toolbar example package, and cover the new behavior in unit and browser tests.
This commit is contained in:
OddTurtleHead committed 2026-11-26 23:06:43 +08:00
1 parent 9a12e2ee7b
commit 881354e283
33 files changed
+2016 -113

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
# Host chrome toolbar example
A minimal schema v3 open skin that docks the trusted recovery entry into the page header as host-owned buttons instead of the floating capsule shell. It is the smallest reference for `chrome.json` `mode: "toolbar"`, page-specific anchor candidates, toolbar style tokens, application-library de-duplication and the floating-capsule fallback.
- Source: [host-chrome-toolbar](./host-chrome-toolbar/)
- Importable package: [host-chrome-toolbar.wskin](./host-chrome-toolbar.wskin)
- Shared component and permission rules: [skin development guide](../SKIN_DEVELOPMENT.md)
- Host chrome and toolbar contract: [skin development guide](../SKIN_DEVELOPMENT.md) (see the `chrome.json#slots` and toolbar-mode sections)
## Package layout
```text
host-chrome-toolbar/
manifest.json # schema v3, author WebSpeak Community
chrome.json # one grouped toolbar slot with a home/voice anchor list
skin.css # page theme, toolbar tokens and header space reservation
```
`skin.css` uses only public `data-ws-part` hooks and sets `--skin-host-toolbar-*` / `--skin-recovery-toolbar-*` variables. It never targets the host toolbar DOM, the recovery capsule, the authorization dialog or the load-failure banner.
## What the declaration does
```json
{
"schemaVersion": 1,
"slots": {
"host.recovery": {
"mode": "toolbar",
"anchor": ["home.header", "voice.header"],
"align": "end"
}
}
}
```
- `mode: "toolbar"` asks the host to render two plain host buttons (use built-in skin, application library) without the capsule shell.
- The anchor list covers both pages; the host picks the first visible one and re-resolves it after a page switch. A missing or hidden anchor returns the complete, visible floating capsule.
- While the library is available, the host hides the ordinary application-library launcher so the page keeps exactly one library entry. The fallback capsule keeps that entry when the anchor fails.
- The host owns the labels, click handlers, focus behaviour, minimum hit target and shortcut handling. The skin only supplies anchor and token values.
- Old slots without `mode` keep the capsule presentation; this example opts in explicitly.
## Trying it
1. Build or import [host-chrome-toolbar.wskin](./host-chrome-toolbar.wskin) in a local WebSpeak instance.
2. Allow the third-party skin when the host asks.
3. Connect to **Demo Server**, join **Demo Lobby**, and check the header as **Demo User**.
4. Confirm the two host buttons appear at the end of the home and voice headers, use the dark toolbar palette, and open the built-in-skin and application-library actions.
5. Remove or hide the anchor in the page inspector; the complete floating capsule should appear at a corner. Restore the anchor; the toolbar should re-dock after the anti-flap check.
6. Press `Ctrl+Alt+Shift+R` (`⌘+⌥+⇧+R` on macOS); the toolbar hides, the complete capsule appears and focuses its first button. Press Escape to return to the toolbar.
The example contains no server addresses, member names, chat contents or other real instance data. Public descriptions use only the Demo Server / Demo Lobby / Demo User placeholders.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,10 @@
{
"schemaVersion": 1,
"slots": {
"host.recovery": {
"mode": "toolbar",
"anchor": ["home.header", "voice.header"],
"align": "end"
}
}
}
@@ -0,0 +1,13 @@
{
"schemaVersion": 3,
"packageType": "open-skin",
"id": "community.host-chrome-toolbar",
"name": "Host Chrome Toolbar",
"version": "1.0.0",
"author": "WebSpeak Community",
"license": "AGPL-3.0-only",
"description": "Minimal open skin that docks the trusted recovery actions as host-owned toolbar buttons.",
"entry": "skin.css",
"chrome": "chrome.json",
"minAppVersion": "0.3.2"
}
@@ -0,0 +1,96 @@
/* Host chrome toolbar demo — v3 open skin (schemaVersion 3).
The only host integration is chrome.json: the trusted recovery entry is
declared as `mode: "toolbar"` and docked into the page header. The skin
supplies anchors and tokens; the host still owns the buttons and handlers.
Selectors stay inside :root, [data-ws-page] and [data-ws-part]. */
:root {
--skin-demo-surface: #13263d;
--skin-demo-foreground: #eef7ff;
--skin-demo-border: #3a628c;
--skin-demo-accent: #47dcc4;
/* Host-owned recovery buttons (toolbar mode). Every value is validated by
the host; invalid or unreadable values fall back to a visible button. */
--skin-host-toolbar-background: #13263d;
--skin-host-toolbar-foreground: #eef7ff;
--skin-host-toolbar-border: #3a628c;
--skin-host-toolbar-radius: 8px;
--skin-host-toolbar-font: Tahoma, "Segoe UI", sans-serif;
--skin-host-toolbar-font-size: 12px;
--skin-host-toolbar-padding: 7px 14px;
--skin-host-toolbar-height: 34px;
--skin-host-toolbar-shadow: none;
/* The floating capsule is the fallback when an anchor disappears. Keep the
same palette so a failed toolbar does not turn into a white popup. */
--skin-recovery-background: #13263d;
--skin-recovery-foreground: #eef7ff;
--skin-recovery-border: #3a628c;
--skin-recovery-accent: #47dcc4;
}
[data-ws-page] {
color-scheme: dark;
color: #e8f0f8;
background: #09131f;
font-family: Tahoma, "Segoe UI", "Microsoft YaHei", sans-serif;
}
[data-ws-part="home.header"],
[data-ws-part="voice.header"] {
background: linear-gradient(180deg, #12253c, #0d1a2b);
border-bottom: 1px solid #2a4a6a;
color: #e8f0f8;
}
/* Voice page can carry a slightly darker value on its own anchor; the host
reads tokens from the anchor that actually docked the button. */
[data-ws-part="voice.header"] {
--skin-recovery-toolbar-background: #0e2236;
--skin-recovery-toolbar-foreground: #f4fbff;
--skin-recovery-toolbar-border: #4f7fb0;
}
/* Reserve the right edge of the top bar for the host-owned toolbar. Without
this the docked buttons would sit on top of the header actions. */
@media (min-width: 900px) {
[data-ws-part="home.header"],
[data-ws-part="voice.header"] {
padding-right: 320px;
}
}
[data-ws-part="home.join-card"],
[data-ws-part="home.content"] {
color: #e8f0f8;
}
[data-ws-part="home.join-card"] {
background: #0f1f33;
border: 1px solid #2a4a6a;
border-radius: 16px;
box-shadow: 0 24px 60px #0008;
}
[data-ws-part="voice.workspace"] {
background: #09131f;
}
[data-ws-part="voice.content"] {
color: #e8f0f8;
}
[data-ws-part="voice.audio-dock"] {
background: #0f1f33;
border-top: 1px solid #2a4a6a;
}
[data-ws-part="home.footer"] {
color: #9db5c8;
}
[data-ws-part="home.footer.clear"] {
color: var(--skin-demo-accent);
}