Skip to content

feat(devframe,hub,hub-ui): static connection-meta configs + plugin-declared dock layout - #227

Merged
antfu merged 10 commits into
mainfrom
feat/connection-meta-configs-dock-branding
Aug 14, 2026
Merged

feat(devframe,hub,hub-ui): static connection-meta configs + plugin-declared dock layout#227
antfu merged 10 commits into
mainfrom
feat/connection-meta-configs-dock-branding

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

Summary

Adds ConnectionMeta.configs — an augmentable, boot-time, read-only-from-the-browser config channel delivered once through the connection handshake every devframe already performs. Contrast with ctx.settings/devframe:user-settings, which are mutable and synced bidirectionally over shared-state RPC: configs is one-way and fixed for the life of the server, contributed via declaration merging against DevframeConnectionConfigsRegistry.

On top of it, ports vitejs/devtools#515 (plugin-declared dock ordering, layout, and window defaults):

  • DevframeDockDefaults gains categoryOrder, maxVisibleItems, defaultMode, defaultPosition — a devframe's opinion about the hub-wide dock bar, not attributes of its own synthesized entry.
  • The hub aggregates these across every installed devframe (last-installed wins per scalar key, categoryOrder shallow-merged) into ConnectionMeta.configs.dock, computed once after every devframe has installed.
  • The client folds the aggregate into the dock-bar category sort (fixing a previously dead createDevframeClientHost({ categoryOrder }) host option along the way — it was typed and documented but never wired into the actual grouping), the floating dock's inline-item capacity, and a first-run visitor's mode/position localStorage seed.

Also moves @devframes/hub-ui's branding off the ad-hoc branding.json asset route onto configs.ui.branding, delivered through the one connection handshake the dock already performs instead of a separate fetch. createUi({ branding }) keeps its existing signature — only the delivery mechanism changed. The hub stays policy-free about what "ui" means: DevframeHubUi gains a settings producer parallel to assets, embedded verbatim under configs.ui.

Notes

  • Pre-1.0 beta, so branding.json is removed outright rather than kept as a compat shim.
  • No new diagnostics — maxVisibleItems reuses the existing silent clamp in resolveDockLayout.
  • pnpm lint && pnpm knip && pnpm test && pnpm typecheck && pnpm build all pass; tsnapi snapshots updated for the new public API surface.

Built with the help of an agent.

…clared dock layout

Add ConnectionMeta.configs — an augmentable, boot-time, read-only-from-the-
browser config channel, distinct from the mutable/shared-state-synced
ctx.settings and devframe:user-settings. Each key is contributed via
declaration merging against DevframeConnectionConfigsRegistry.

Ports vitejs/devtools#515 (plugin-declared dock ordering, layout, and
window defaults) on top of it: DevframeDockDefaults gains categoryOrder,
maxVisibleItems, defaultMode, and defaultPosition. The hub aggregates them
across every installed devframe (last-installed wins per scalar,
categoryOrder shallow-merged) into ConnectionMeta.configs.dock, folded
into the dock bar's category sort, the floating dock's inline-item
capacity, and a first-run visitor's mode/position seed.

hub-ui's branding moves off the ad-hoc branding.json asset route onto
configs.ui.branding, delivered through the one connection handshake the
dock already performs instead of a separate fetch. createUi({ branding })
keeps its existing signature.

Built with the help of an agent.
@netlify

netlify Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit cf03518
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a7ee3e342ee140009cfad5a
😎 Deploy Preview https://deploy-preview-227--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

antfu and others added 9 commits August 14, 2026 16:42
…e branding channels

Follows up on review feedback:

- Adds ctx.configs (DevframeConfigsHost) as a core devframe context
  primitive — the generic API for contributing to a context's own
  ConnectionMeta.configs, resolved once (instance-shell) after every
  contributor has run and baked into the served meta for every host
  adapter, not just the hub. Contributors own their own merge semantics
  via an (current) => next updater.
- installDevframe now calls ctx.configs.contribute('dock', ...) instead
  of a docks-specific contributeDockConfig; dockConfig/contributeDockConfig
  are removed from DevframeDocksHost — dock-bar config aggregation isn't
  a docks-registry concern.
- DevframeHubUi.settings renamed to configs, matching the
  ConnectionMeta.configs.ui wire shape it feeds.
- hub-ui's resolveBranding drops the host-page override channels
  (window.__DEVFRAME_BRANDING__, <script data-*>, ?query params) —
  ConnectionMeta already has its own cross-realm propagation, so
  branding needs no globals or query params of its own.

Built with the help of an agent.
Ports vitejs/devtools#465 (passive/hidden overlay) to the reference UI,
but as one config field instead of the upstream three-client-entries
approach. `createUi({ embeddedVisibility })` publishes
`ConnectionMeta.configs.ui.embeddedVisibility`:

- `normal` (default) — the floating dock shows immediately.
- `passive` — starts hidden with a console hint; Shift+Alt+D reveals it,
  and the reveal persists per-origin so later sessions start shown.
- `hidden` — starts hidden; Shift+Alt+D reveals it for the session only.

Like the float/edge dock mode, it seeds a user-overridable preference:
the config sets the default, the visitor's own reveal/hide wins from then
on. The "Hide" command now conceals (toggleable back via the shortcut)
rather than tearing the dock down for the session.

Built with the help of an agent.
…eferences

Applies review feedback:

- `ctx.configs` (the `DevframeConfigsHost` with `contribute`/`resolve`) is
  now `ctx.staticConfig` — a plain, non-reactive `Partial<DevframeConnectionConfigsRegistry>`
  object mutated at setup time. Drops the host class and its test; the
  instance shell serializes the object straight into `ConnectionMeta.configs`.
- The hub-wide dock-bar preferences (`categoryOrder` / `maxVisibleItems` /
  `defaultMode` / `defaultPosition`) move off the per-entry `DevframeDockDefaults`
  into a dedicated `DevframeDockPreferences` type, declared on the new
  `DevframeDefinition.dockPreferences`. `installDevframe` aggregates it into
  `ctx.staticConfig.dock`; the hub's `configs.dock` registry key now points at
  `DevframeDockPreferences` (the `DevframeDockConfig` alias is gone).

Built with the help of an agent.
…eHubUi.setup(ctx)

Dock-bar preferences (categoryOrder / maxVisibleItems / defaultMode /
defaultPosition) are reference-UI rendering concerns, not per-devframe
declarations — move them off `DevframeDefinition.dockPreferences` (removed
from core, along with the `DevframeDockPreferences` type and the hub's
`configs.dock` aggregation) into `createUi({ dockPreferences })`, published
under `ConnectionMeta.configs.ui.dockPreferences` alongside `branding` and
`embeddedVisibility`.

Also replace the `DevframeHubUi.configs` producer with a `setup(ctx)` hook:
the UI slot now publishes its config through the generic `ctx.staticConfig`
(`createUi()`'s setup writes `ctx.staticConfig.ui = { branding, ... }`), so
the hub's mount handler no longer special-cases a `ui` merge.

Built with the help of an agent.
…table

The reference-viewer toggles baked into the hub's `DevframeDocksUserSettings`
move to `@devframes/hub-ui` via declaration merging, mirroring the pattern
used for branding / embeddedVisibility / dockPreferences:

- `@devframes/hub` keeps only the generic dock-registry + command model
  every viewer shares: `docksHidden`, `docksCategoriesHidden`, `docksPinned`,
  `docksCustomOrder`, `commandShortcuts` (the last read by the
  framework-neutral `createDevframeClientHost`). `DEFAULT_STATE_USER_SETTINGS`
  drops the UI toggles.
- `@devframes/hub-ui` augments `DevframeDocksUserSettings` with its own
  reference-viewer toggles — `showIframeAddressBar`, `closeOnOutsideClick`,
  `autoCollapseEdgeToolbar`, `showDevframeInspector` (all optional). The old
  `HubDocksUserSettings extends …` type is gone; hub-ui now consumes the
  augmented base directly.

Built with the help of an agent.
The API-snapshot suite auto-discovers workspace packages, but depending on
the installed layout (pnpm `shamefullyHoist`) that discovery can walk into
`node_modules` and try to snapshot dependencies like `@babel/runtime`,
crashing on their directory-valued `exports` (`EISDIR`). Skip any discovered
package under `node_modules` so only first-party workspace packages are
snapshotted — fixing the intermittent CI failure.

Built with the help of an agent.
@antfu
antfu merged commit 4e08b14 into main Aug 14, 2026
12 checks passed
@antfu
antfu deleted the feat/connection-meta-configs-dock-branding branch August 14, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants