|
1 | | -# Design: Shared-iframe docks with soft navigation |
| 1 | +# Shared-iframe docks with soft navigation |
2 | 2 |
|
3 | | -**Status:** Hub side implemented — hand-off spec for the Vite DevTools UI |
4 | | -**Audience:** Vite DevTools (`@vitejs/devtools-kit`) UI implementers + `@devframes/hub` maintainers |
5 | 3 | **Driving use case:** hosting a foreign multi-tab devtool (e.g. **Nuxt DevTools**) as a set of first-class hub docks that all share **one** live iframe and switch between views via **client-side (soft) navigation**, for a unified experience. |
6 | 4 |
|
7 | | -> **Landed foundations.** [#129](https://github.com/devframes/devframe/pull/129) shipped client-only `docks.register()`/`docks.update()`; [#130](https://github.com/devframes/devframe/pull/130) reinterpreted a grouped entry's `category` as an in-group sub-category (outer bucket = the group's category) and made `framework` sort first. This spec and the hub-side implementation (types + the frame-nav adapter) build directly on both. |
| 5 | +**Status — the hub side is shipped and documented.** This doc is the design record, plus the hand-off spec for the parts that live in other repos: the viewer UI contract (§6) and the embedded-app nav shim (§10). |
| 6 | + |
| 7 | +Shipped in `@devframes/hub`: |
| 8 | + |
| 9 | +- **Data model** — `frameId` + `navTarget` + `subTabs` on `DevframeViewIframe` ([`packages/hub/src/types/docks.ts`](../packages/hub/src/types/docks.ts)). |
| 10 | +- **Client-only docks** — `docks.register()` / `update()` on the client context ([#129](https://github.com/devframes/devframe/pull/129)). |
| 11 | +- **Frame-nav adapter** — `attachFrameNavClient`, auto-attached by `createDevframeClientHost` ([`packages/hub/src/client/frame-nav.ts`](../packages/hub/src/client/frame-nav.ts)). |
| 12 | +- **Docs** — [Shared-iframe soft navigation](../docs/guide/client-context.md#shared-iframe-soft-navigation). |
| 13 | +- **Examples** — the "Tabbed Tool" in both `examples/minimal-{vite,next}-devframe-hub`. |
| 14 | +- **Tests** — [`packages/hub/src/client/__tests__/frame-nav.test.ts`](../packages/hub/src/client/__tests__/frame-nav.test.ts). |
| 15 | + |
| 16 | +Remaining work lives downstream (§11): the Vite DevTools UI contract and the Nuxt DevTools shim. |
8 | 17 |
|
9 | 18 | --- |
10 | 19 |
|
@@ -424,24 +433,16 @@ onTabsChanged(() => post({ type: 'manifest', tabs: tabsSnapshot(), current: curr |
424 | 433 |
|
425 | 434 | --- |
426 | 435 |
|
427 | | -## 11. Implementation checklist |
| 436 | +## 11. Remaining work (downstream repos) |
428 | 437 |
|
429 | | -**`@devframes/hub` (data model + adapter):** |
430 | | -- [x] Client-only `docks.register()`/`update()` on the client `DocksEntriesContext` — **#129**. |
431 | | -- [x] Add `navTarget` + `subTabs` to `DevframeViewIframe`; add `NavTarget`, `FrameSubTabsConfig` ([`packages/hub/src/types/docks.ts`](../packages/hub/src/types/docks.ts)). |
432 | | -- [x] Ship the frame-nav adapter (`attachFrameNavClient`, [`packages/hub/src/client/frame-nav.ts`](../packages/hub/src/client/frame-nav.ts)); auto-attach on `dom:iframe:mounted` for `subTabs` anchors ([`host.ts`](../packages/hub/src/client/host.ts)). |
433 | | -- [x] Tests: handshake, manifest reconcile add/remove, echo-guard, internal-nav highlight, origin-lock, timeout→no-shim, active-removed→null ([`frame-nav.test.ts`](../packages/hub/src/client/__tests__/frame-nav.test.ts)). |
434 | | -- [x] Worked examples: a `subTabs` "Tabbed Tool" anchor + a postMessage shim SPA, with keep-alive iframe pooling and `dom:iframe:mounted`, in both `examples/minimal-vite-devframe-hub` and `examples/minimal-next-devframe-hub`. |
435 | | -- [ ] Follow-up: a Client Context guide section. |
| 438 | +The `@devframes/hub` side is complete (see the status list at the top). What's left lives in other repos: |
436 | 439 |
|
437 | | -**Vite DevTools (UI contract):** |
438 | | -- [ ] One kept-alive iframe per `frameId`; hide/show, never re-`src`. |
439 | | -- [ ] Populate `domElements.iframe` + emit `dom:iframe:mounted` on the anchor entry. |
440 | | -- [ ] Render member docks (grouped or not) through the normal selection path. |
| 440 | +**Vite DevTools — the UI contract (§6):** |
| 441 | +- One kept-alive iframe per `frameId`; hide/show, never re-`src`. |
| 442 | +- Populate `domElements.iframe` + emit `dom:iframe:mounted` on the anchor entry. |
| 443 | +- Render member docks (grouped or not) through the normal selection path. |
441 | 444 |
|
442 | | -**Embedded app (Nuxt DevTools):** |
443 | | -- [ ] Ship the `postMessage` nav shim (§10). |
444 | | - |
445 | | ---- |
| 445 | +**Nuxt DevTools — the embedded app:** |
| 446 | +- Ship the `postMessage` nav shim (§10). |
446 | 447 |
|
447 | | -*This design was produced with the help of an agent, from a structured requirements interview.* |
| 448 | +Both minimal hub examples already implement the viewer contract in miniature (vanilla DOM and React), so they double as a reference for the Vite DevTools port. |
0 commit comments