You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 85aa249
Browse filesBrowse the repository at this point in the historyBrowse files
feat(hub): add toggle dock actions and entry descriptions
A `toggle: true` action is an on/off tool, such as an in-page element
picker. It never takes the selection: it hides an open panel while on,
restores it when off, and its dock button renders as active. A click,
`docks.setActionActive(id, false)`, or Escape in hub-ui turns it off.
Dock entries also get an optional `description`, shown under the title
in the dock button tooltip.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-**`messages`**: an entry-scoped messages client (`category` defaults to the entry id; `info`/`warn`/`error`/`success`/`debug` shortcuts for `add()`).
78
78
79
-
Failed setup retries on the next activation, or on a dock update for eager scripts. Setup is cached per RPC connection, dock and import descriptor. Action clicks always execute again.
79
+
Failed setup retries on the next activation, or on a dock update for eager scripts. Setup is cached per RPC connection, dock and import descriptor. Action clicks always execute again, except for a [toggle action](#toggle-actions).
80
+
81
+
### Toggle actions
82
+
83
+
Set `toggle: true` on an `action` entry to make it an on/off tool, such as an in-page element picker. A click turns it on and a second click turns it off. While it is on:
84
+
85
+
- the dock button shows as active (`current.isActive` is `true`);
86
+
- the selected dock stays selected, and an open panel is hidden until the tool turns off;
87
+
-`Escape` turns it off in the reference hub UI.
88
+
89
+
The script sets up once and drives the tool from `entry:activated` / `entry:deactivated`. Call `docks.setActionActive(id, false)` when the tool is done, which brings the hidden panel back. Selecting another dock, or `switchEntry(null)`, also turns the tool off, and then the panel stays as the new selection leaves it.
|`docks`|`entries`, `selected`, `groupedEntries`, `switchEntry()`, `toggleEntry()`, `setActionActive(id, active)` for [toggle actions](/guide/client-context#toggle-actions), `getStateById()`, `register()` / `update()` for [client-only docks](/guide/client-context#client-only-docks). |
152
152
|`panel`| Current `state`, local `events`, session, position, size, and drag/resize state for the dock panel. |
153
153
|`commands`| Command palette: `register()`, `execute()`, `getKeybindings()`, `paletteOpen`, `paletteScopeId`, `openPalette(atCommandId?)`. Passing an id opens the palette drilled into that command's children ([Activating a group](/guide/hub#activating-a-group)). |
154
154
|`renderers`| Dock-renderer registry: `register()`, `get()`, `has()`, `mount(entry, container)`. Routes a dock `type` to a renderer (local boot or the hub's [manifest](/guide/hub-initiate#renderer-modules); local wins). `mount()` resolves a `status`: `mounted` (with `dispose`), `missing-renderer`, or `load-error` (with `error`). |
@@ -161,11 +161,11 @@ Which `ClientScriptEntry` field carries an entry's client script, and when it ru
161
161
162
162
| Entry kind | Field | Runs |
163
163
|---|---|---|
164
-
|`action`|`action`|when the dock button is activated|
164
+
|`action`|`action`|on each click; once for a `toggle: true` action|
165
165
|`custom-render`|`renderer`| to render the entry's panel |
166
166
|`iframe`|`clientScript` (optional) | inside the host page on first activation |
167
167
168
-
`ClientScriptEntry.eager` defaults to `false`. Set it to `true` on an `iframe``clientScript` or an `action` to initialize it after RPC trust, before dock activation. A `custom-render``renderer` needs its mounted panel, so it always initializes on activation regardless of `eager`. Setup is cached per RPC connection and dock; action clicks execute on every activation.
168
+
`ClientScriptEntry.eager` defaults to `false`. Set it to `true` on an `iframe``clientScript` or an `action` to initialize it after RPC trust, before dock activation. A `custom-render``renderer` needs its mounted panel, so it always initializes on activation regardless of `eager`. Setup is cached per RPC connection and dock; action clicks execute on every activation, except a `toggle: true` action, which sets up once.
169
169
170
170
## Frame-nav messages
171
171
@@ -179,12 +179,12 @@ The origin-locked `postMessage` protocol on `devframe:frame-nav`: [Shared-iframe
179
179
180
180
## Dock entry types
181
181
182
-
The built-in variants of the open dock union (`DevframeDockEntryRegistry`, `@devframes/hub/types`) a hub UI provider renders: [Build Your Own Hub UI](/guide/build-your-own-hub-ui). Each entry's `icon` takes any of the [icon values](/references/node-api#icon-values). Each entry's `title` has an optional `titleLocales` map of translations, resolved with `resolveTitle(entry, locale)` from `@devframes/hub/client`; commands and launchers carry the same pair.
182
+
The built-in variants of the open dock union (`DevframeDockEntryRegistry`, `@devframes/hub/types`) a hub UI provider renders: [Build Your Own Hub UI](/guide/build-your-own-hub-ui). Each entry's `icon` takes any of the [icon values](/references/node-api#icon-values). Each entry's `title` has an optional `titleLocales` map of translations, resolved with `resolveTitle(entry, locale)` from `@devframes/hub/client`; commands and launchers carry the same pair. An optional one-line `description` explains the entry; the reference hub UI shows it under the title in the dock button tooltip.
183
183
184
184
| Type | The hub UI provider renders |
185
185
|---|---|
186
186
|`iframe`| the entry's `url` in a kept-alive iframe (per `frameId` when shared); honor `subTabs` soft nav; show the existing address bar with `addressBar: true`, or configure Back, Reload, and Open externally by passing an `addressBar` object |
187
-
|`action`| a dock-rail button; activating runs its client script |
187
+
|`action`| a dock-rail button; activating runs its client script. With `toggle: true`, render it as active while `getStateById(id).isActive` is `true`|
188
188
|`custom-render`| a container its client script mounts into |
189
189
|`launcher`| a launch call-to-action reflecting `launcher.status`|
190
190
|`group`| one dock-rail button collapsing its member entries |
0 commit comments