Skip to content

feat(json-render): out-of-box SPA and unsupported-component placeholder#126

Merged
antfu merged 4 commits into
mainfrom
chilly-toys-speak
Jul 22, 2026
Merged

feat(json-render): out-of-box SPA and unsupported-component placeholder#126
antfu merged 4 commits into
mainfrom
chilly-toys-speak

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

What & why

Two gaps in the JSON-render packages, from a design interview:

1. Out-of-box standalone SPA (no client build)

@devframes/json-render-ui now ships a prebuilt SPA (dist/spa), exposed
through a new node-safe ./spa entry that pulls in no Vue:

  • jsonRenderSpaDir — path to the shipped assets, for cli.distDir.
  • createJsonRenderDevframe(definition) — wraps a definition to serve that SPA
    (spa.loader: 'none', cli.distDir defaulted).

An app publishes a view and it renders — no client to author or build. The SPA
discovers views from a new view index shared state
(JSON_RENDER_INDEX_KEY) that createJsonRenderView maintains, rendering one
view full-bleed or several under the shared segmented switcher, each labelled by
an optional per-view title.

In a hub, requirement is unchanged: the host still contributes a json-render
dock entry (toJsonRenderDockEntry) and the hub renders the schema through its
registered renderer — the SPA is only for the standalone path.

2. Unsupported-component placeholder

Any frontend can render a spec even when it doesn't implement every component.
The renderer isolates an element whose type is absent from the active
registry
behind a placeholder — Unsupported component, the type, and a gist
of its prop keys ({ label, onPress }) — and emits a console.warn, while the
rest of the view renders. This is distinct from the existing invalid-props error
component.

Example migration

examples/minimal-json-render drops its hand-authored client and Vue/Vite build
and runs entirely off the prebuilt SPA.

Verification

pnpm lint && pnpm test && pnpm typecheck && pnpm build all pass; tsnapi
snapshots + exports tests updated (new ./spa subpath, view-index/title, the
placeholder constant); the standalone example's live dev server and static build
both serve the prebuilt SPA and dump the view index.

This PR was created with the help of an agent.

…eholder

Serve a JSON-render UI with no client build: `@devframes/json-render-ui`
now ships a prebuilt standalone SPA under `dist/spa`, exposed through a
node-safe `./spa` entry (`jsonRenderSpaDir` + `createJsonRenderDevframe`).
The SPA discovers views from a new view index the node factory maintains
(`JSON_RENDER_INDEX_KEY`), so an app publishes a view and it renders —
one view full-bleed, several under the shared segmented switcher, each
labelled by an optional per-view `title`.

Let any frontend render a spec even when it doesn't implement every
component: the renderer isolates an element whose type is absent from the
active registry behind a placeholder (showing the type and a gist of its
prop keys) and warns, while the rest of the view renders.

Migrate `examples/minimal-json-render` onto the prebuilt SPA, dropping its
hand-authored client and Vue/Vite build.

Co-authored-by: an agent
@netlify

netlify Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

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

antfubot and others added 3 commits July 22, 2026 07:11
A lone JSON-render view renders on its own — the top bar (brand + view
switcher) only appears once more than one view is registered.
… placeholder

Add stories covering the new placeholder path — an unknown component type,
and a subset registry missing a base component — and document that the SPA
hides its nav for a single view.
@antfu
antfu merged commit f5d72e7 into main Jul 22, 2026
11 of 12 checks passed
@antfu
antfu deleted the chilly-toys-speak branch July 22, 2026 07:36
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