Skip to content

feat(kit): adopt @devframes/json-render (devframe v0.7.9)#454

Merged
antfu merged 3 commits into
mainfrom
frank-peaches-unite
Jul 22, 2026
Merged

feat(kit): adopt @devframes/json-render (devframe v0.7.9)#454
antfu merged 3 commits into
mainfrom
frank-peaches-unite

Conversation

@antfubot

@antfubot antfubot commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Description

devframe 0.7.6 extracted the json-render layer out of @devframes/hub into the opt-in @devframes/json-render package. This PR rewires Vite DevTools onto the new package (now upgraded through 0.7.9) while keeping the kit's public API stable and without pulling in @devframes/json-render-ui — the in-house webcomponents registry stays.

Kit (node/types)

  • ctx.createJsonRenderer(spec) is now backed by createJsonRenderView from @devframes/json-render/node. The returned handle keeps updateSpec / updateState / _stateKey, and its methods are defined non-enumerably so the handle stays fully serializable when carried on a json-render dock entry's ui field.
  • JsonRenderSpec / JsonRenderElement re-map onto @devframes/json-render; defineJsonRenderSpec becomes a kit-local identity helper (the hub dropped it).
  • The kit contributes its json-render dock entry into the hub's open dock registry.
  • 0.7.9 adaptation: hub 0.7.9 re-added its own deprecated createJsonRenderer/JsonRenderSpec/JsonRenderer on DevframeHubContext as a back-compat shim for pre-0.7 call sites ("kept working... will be removed in 0.8"), typed against a looser (optional props) spec shape than ours. KitNodeContext now extends Omit<DevframeHubContext, 'createJsonRenderer'> before redeclaring its own (stricter, non-deprecated) factory, and createPluginFromDevframe casts through DevframeHubContext at the mountDevframe call site (which never calls createJsonRenderer) instead of widening the kit's own type. No other functional change was needed between hub/devframe 0.7.6 and 0.7.9 — verified by diffing the published dist/ of both.

Core (client)

  • Provide the client-side dock-renderer registry now required by the hub 0.7.6+ DocksContext.
  • The hand-rolled webcomponents registry is retained, but its components now speak the @devframes/json-render base-catalog vocabularycreateJsonRenderView validates element props against that catalog at ingress, so specs must use the base prop names (e.g. Stack direction: 'row' | 'column', Text text, Badge variant: 'danger', KeyValueTable data, DataTable/CodeBlock height, Tree defaultExpanded).
  • New: an element type with no entry in the registry (a spec authored against a newer base-catalog version than this client implements, a third-party catalog extension, or a typo) previously rendered nothing — @json-render/vue's <Renderer> only logs a console warning and returns null. Added UnsupportedComponent, wired as <Renderer>'s upstream fallback prop, so an unrenderable element now degrades to a visible, inspectable placeholder instead of silently disappearing. Includes a dedicated Storybook story and a docs note.
  • The now-unused in-house catalog.ts / index.ts are removed.

Example / docs / stories updated to the base-catalog prop names.

Verified with pnpm typecheck && pnpm test && pnpm lint && pnpm build (export API snapshots for @vitejs/devtools-kit refreshed to match the new surface).

Linked Issues

Additional context

Reviewers may want to focus on: the serializability of the JsonRenderer handle on dock entries (non-enumerable methods), the base-catalog vocabulary alignment of the in-house components, and the Omit<DevframeHubContext, 'createJsonRenderer'> type fix for hub 0.7.9's back-compat shim.

This PR was created with the help of an agent.

@pkg-pr-new

pkg-pr-new Bot commented Jul 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@454

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@454

@vitejs/devtools-oxc

npm i https://pkg.pr.new/@vitejs/devtools-oxc@454

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@454

@vitejs/devtools-vite

npm i https://pkg.pr.new/@vitejs/devtools-vite@454

@vitejs/devtools-vitest

npm i https://pkg.pr.new/@vitejs/devtools-vitest@454

commit: 199bbef

antfubot added 3 commits July 22, 2026 07:46
devframe 0.7.6 extracts json-render out of @devframes/hub into the opt-in
@devframes/json-render package, so the hub no longer ships createJsonRenderer,
defineJsonRenderSpec, or the JsonRender* types. Rewire the kit onto the new
package while preserving the kit's public API:

- ctx.createJsonRenderer(spec) is now backed by createJsonRenderView; the
  returned handle keeps updateSpec/updateState/_stateKey and defines its
  methods non-enumerably so it stays serializable on a json-render dock entry.
- Re-map the JsonRenderSpec/JsonRenderElement types onto @devframes/json-render
  and register the kit's json-render dock entry into the hub dock registry.
- Provide the client-side dock-renderer registry now required by the hub 0.7.6
  DocksContext.

The in-house webcomponents registry stays (no @devframes/json-render-ui), but
its components now speak the @devframes/json-render base-catalog vocabulary,
since createJsonRenderView validates element props against that catalog at
ingress. Update the git-ui example, docs, and stories to the base prop names.

Created with the help of an agent.
Bump devframe, @devframes/hub, @devframes/json-render, and the built-in
@devframes/plugin-* integrations to 0.7.9.

devframe/hub 0.7.6 → 0.7.9 has no functional change to the public API we
consume — the dist output is otherwise identical (the zod → valibot
migration mentioned in devframe's own dependency list is an internal
implementation detail that doesn't cross the public surface). The one
adaptation required: hub 0.7.9 re-added its own deprecated `createJsonRenderer`
/ `JsonRenderSpec` / `JsonRenderer` on `DevframeHubContext` as a back-compat
shim for pre-0.7 call sites ("kept working... will be removed in 0.8"), typed
against the hub's own looser (optional `props`) spec shape. That collides with
the kit's `createJsonRenderer`, which is intentionally typed against
`@devframes/json-render`'s stricter `Spec` (the non-deprecated, recommended
surface we already adopted):

- `KitNodeContext` now extends `Omit<DevframeHubContext, 'createJsonRenderer'>`
  before redeclaring its own factory, since the hub's deprecated property
  makes the plain `extends` an invalid override.
- `createPluginFromDevframe` casts through `DevframeHubContext` at the
  `mountDevframe` call site (which never calls `createJsonRenderer`) rather
  than widening the kit's own factory's type.

`@devframes/json-render` itself only gained an optional per-view `title`
(published to a new opt-in shared-state "view index" for multi-view
frontends) — additive and irrelevant to the kit's single-ref-per-dock usage.
An element whose `type` has no entry in the in-house registry — a spec
authored against a newer base-catalog version than this client implements, a
third-party catalog extension, or a plain typo — silently rendered nothing:
upstream `@json-render/vue` only logs a console warning and returns `null`
when `registry[type]` is missing.

Add `UnsupportedComponent`, wired as `<Renderer>`'s upstream `fallback` prop
(already supported by `@json-render/vue`, just previously unused here) in
both `ViewJsonRender.vue` and the Storybook gallery. An unrenderable element
now degrades to a visible, inspectable placeholder — the element's `type`
name in a dashed warning-colored box — instead of disappearing.

Also adds a dedicated `UnsupportedComponentFallback` story and a short note
in the json-render docs.
@antfubot
antfubot force-pushed the frank-peaches-unite branch from 9708c33 to 199bbef Compare July 22, 2026 08:03
@antfubot antfubot changed the title feat(kit): adopt @devframes/json-render for the json-render layer feat(kit): adopt @devframes/json-render (devframe v0.7.9) Jul 22, 2026
@antfu
antfu merged commit 89b16f8 into main Jul 22, 2026
10 checks passed
@antfu
antfu deleted the frank-peaches-unite branch July 22, 2026 08:51
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