Skip to content

feat(hub): generic view-provider mechanism - #186

Closed
antfubot wants to merge 1 commit into
feat/json-render-ui-provider-spafrom
feat/hub-view-providers
Closed

feat(hub): generic view-provider mechanism#186
antfubot wants to merge 1 commit into
feat/json-render-ui-provider-spafrom
feat/hub-view-providers

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

PR C of the json-render view-provider stack (plan: plans/json-render-ui-packaging.md). Stacked on #185.

Adds the generic mechanism that lets a dock view type resolve to a swappable iframe provider SPA — decoupling renderers from the hub UI's framework.

  • initHub({ viewProviders: { <type>: DevframeDefinition } }) — mounts each provider's SPA at <base><id>/ (serving its connection meta + statics) without a dock of its own, and publishes <type> → { base } to a read-only devframe:view-providers shared state a UI reads to resolve the iframe URL and to detect "no provider".
  • mountViewProvider(ctx, type, def, { base }) — the reusable primitive (used by initHub; callable directly on the manual createHubContext + mountDevframe path). mountDevframe gains registerDock?: boolean.
  • Headless core ships no provider; the reference json-render provider comes from @devframes/json-render-ui (jsonRenderProvider(), feat(json-render-ui): provider SPA (single-view + theming + provider factory) #185). The in-process renderers seam is untouched (kept for custom in-process types).

Adds VIEW_PROVIDERS_STATE_KEY (@devframes/hub/constants) + DevframeViewProviders types (@devframes/hub/types).

Verified: workspace typecheck (26 pkgs), eslint, build, a new mountViewProvider test (no dock + shared-state entry), additive API snapshots.

Created with the help of an agent.

…hared state)

A dock view *type* can resolve to a swappable iframe provider SPA:

- initHub({ viewProviders: { <type>: DevframeDefinition } }) mounts each
  provider's SPA at <base><id>/ (serving its connection meta + statics) and
  publishes <type> -> { base } to the read-only devframe:view-providers shared
  state a UI reads to resolve the iframe URL (and to detect 'no provider').
- mountDevframe gains registerDock?: boolean; mountViewProvider(ctx, type, def)
  is the reusable primitive (used by initHub, callable on the manual
  createHubContext path). The headless core ships no provider — the reference
  json-render provider comes from @devframes/json-render-ui.
- Keeps the in-process renderers seam untouched.

Adds VIEW_PROVIDERS_STATE_KEY + DevframeViewProviders types.
@antfu
antfu force-pushed the feat/hub-view-providers branch from 95e077b to 7f6fbee Compare August 10, 2026 04:55
@antfu antfu closed this Aug 10, 2026
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