Skip to content

feat(json-render): client-only json-render docks via an inline view spec#131

Merged
antfu merged 4 commits into
mainfrom
feat/hub-client-json-render-dock
Jul 23, 2026
Merged

feat(json-render): client-only json-render docks via an inline view spec#131
antfu merged 4 commits into
mainfrom
feat/hub-client-json-render-dock

Conversation

@antfubot

@antfubot antfubot commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

What

Lets a client host register a client-only json-render dock whose view is authored entirely in the browser, and reshapes the json-render view contract to make that ergonomic.

Builds on #129 (client-only docks.register()).

Changes

Library (@devframes/json-render, @devframes/json-render-ui)

  • JsonRenderViewRef is now a union: { stateKey } (subscribe to a live shared state — what createJsonRenderView produces) or { spec } (an inline spec rendered directly, no shared-state round-trip). New JsonRenderViewStateRef / JsonRenderViewInlineRef types are exported.
  • Both dock renderers (the Vue createJsonRenderDockRenderer, and the example's mini React registry) render the inline spec statically and keep subscribing for the shared-state variant.
  • Removed the upstreamVersion field, the JSON_RENDER_UPSTREAM_VERSION export, and the renderer's version-mismatch warning / upstreamVersion prop — simplifying the serializable view contract.

Examples

  • Both hub shells (minimal-vite-devframe-hub, minimal-next-devframe-hub) register a client-only json-render dock ("Client Metrics") whose spec is carried inline (view: { spec }) — no shared state, never syncing to the hub or other viewers — alongside the client-only iframe dock.

Docs / tests

  • Client Context guide, JSON-render guide, and both example pages updated.
  • create-view and client-host renderer tests updated; tsnapi API snapshots regenerated.

Verification

pnpm typecheck, pnpm lint, pnpm build, and the full vitest suite (852 tests) all pass; both example apps build.

BREAKING CHANGE: JsonRenderViewRef no longer carries upstreamVersion; JSON_RENDER_UPSTREAM_VERSION and the JsonRenderView upstreamVersion prop are removed.

This PR was created with the help of an agent.

@netlify

netlify Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit 35e9f3c
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a619a2475f3840007c05a3c
😎 Deploy Preview https://deploy-preview-131--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.

…eamVersion

The `json-render` dock's `view` field now accepts either `{ stateKey }`
(subscribe to a live shared state) or `{ spec }` (an inline spec rendered
directly), so a client host can synthesize a view entirely in the browser
with no shared-state round-trip. Both dock renderers (Vue + the example's
React registry) render the inline spec statically and keep subscribing for
the shared-state variant.

Removes the `upstreamVersion` field and the `JSON_RENDER_UPSTREAM_VERSION`
export along with the renderer's version-mismatch warning, simplifying the
serializable view contract.

BREAKING CHANGE: `JsonRenderViewRef` no longer carries `upstreamVersion`;
`JSON_RENDER_UPSTREAM_VERSION` and the `JsonRenderView` `upstreamVersion`
prop are removed.
@antfubot antfubot changed the title docs(examples): register a client-only json-render dock in the hub examples feat(json-render): client-only json-render docks via an inline view spec Jul 23, 2026
antfu and others added 2 commits July 23, 2026 13:24
Turns the inline client-authored view into a small interactive playground:
`$bindState` text/switch inputs write into the view's own state, `$state`
reads mirror them live, and Add / Clear buttons drive the built-in
`pushState` / `setState` actions to mutate a notes list that re-renders — all
client-side, with no server and no shared state. Applied to both the Vite
(Vue) and Next (React) hub shells.
@antfu
antfu merged commit 1a6834c into main Jul 23, 2026
11 of 12 checks passed
@antfu
antfu deleted the feat/hub-client-json-render-dock branch July 23, 2026 04:38
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