feat(json-render): out-of-box SPA and unsupported-component placeholder#126
Merged
Conversation
…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
✅ Deploy Preview for devfra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-uinow ships a prebuilt SPA (dist/spa), exposedthrough a new node-safe
./spaentry that pulls in no Vue:jsonRenderSpaDir— path to the shipped assets, forcli.distDir.createJsonRenderDevframe(definition)— wraps a definition to serve that SPA(
spa.loader: 'none',cli.distDirdefaulted).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) thatcreateJsonRenderViewmaintains, rendering oneview 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-renderdock entry (
toJsonRenderDockEntry) and the hub renders the schema through itsregistered 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
typeis absent from the activeregistry behind a placeholder —
Unsupported component, the type, and a gistof its prop keys (
{ label, onPress }) — and emits aconsole.warn, while therest of the view renders. This is distinct from the existing invalid-props error
component.
Example migration
examples/minimal-json-renderdrops its hand-authored client and Vue/Vite buildand runs entirely off the prebuilt SPA.
Verification
pnpm lint && pnpm test && pnpm typecheck && pnpm buildall pass; tsnapisnapshots + exports tests updated (new
./spasubpath, view-index/title, theplaceholder 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.