🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@devframes/json-render

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devframes/json-render - npm Package Compare versions

Comparing version
0.7.8
to
0.7.9
+80
dist/types-Di-9QrXX.d.mts
import { Spec } from "@json-render/core";
//#region src/view-ref.d.ts
/**
* The `@json-render/core` / `@json-render/vue` version this build of
* `@devframes/json-render` is written and tested against. It is the sole
* compatibility signal carried across the wire — there is no separate
* Devframes protocol/catalog version stamp. A renderer compares its own
* upstream version against a view's {@link JsonRenderViewRef.upstreamVersion}
* and warns (rather than blocking) on a mismatch.
*
* Kept paired with the caret range on `@json-render/core` /
* `@json-render/vue` in this package's manifest; the committed lockfile is
* the guard against a breaking upstream upgrade.
*/
declare const JSON_RENDER_UPSTREAM_VERSION = "0.19.0";
/**
* The serializable reference to a JSON-render view that crosses process /
* static boundaries — e.g. projected onto a hub dock entry. It carries **no
* functions** and no Devframes catalog version: just the shared-state key the
* client subscribes to for the live spec + state, and the upstream version
* the view was authored against.
*
* This is the corrected projection contract: the previous hub implementation
* leaked an accidental `_stateKey` field and a non-serializable renderer
* handle; a `JsonRenderViewRef` is a plain, fully-serializable object.
*/
interface JsonRenderViewRef {
/** Shared-state key the client subscribes to for the live spec + state. */
stateKey: string;
/** Upstream `@json-render/*` version the view was authored against. */
upstreamVersion: string;
}
//#endregion
//#region src/types.d.ts
/**
* A Devframes JSON-render spec **is** an `@json-render/core` `Spec`: a flat
* `root` key, an `elements` map, and optional initial `state`. This alias is
* the Devframes-facing name; it does not add or remove fields.
*/
type DevframeJsonRenderSpec = Spec;
/**
* A single JSON-Pointer patch to a view's `state` model. `path` is an
* RFC 6901 JSON Pointer relative to the state root (e.g. `/count`,
* `/user/name`). Structural spec changes replace the whole spec via
* `update` instead.
*/
interface JsonRenderStatePatch {
op: 'add' | 'remove' | 'replace';
/** JSON Pointer relative to the state root, e.g. `/count`. */
path: string;
value?: unknown;
}
/**
* A JSON-render view handle, returned by `createJsonRenderView`. Owns a
* server-side shared state carrying the live spec + state, and exposes the
* serializable {@link JsonRenderViewRef} that a hub dock (or any client
* transport) uses to locate it.
*/
interface JsonRenderView {
/** Author-supplied stable id, unique within the view's scope. */
readonly id: string;
/** Human-facing label published in the view index (defaults to `id`). */
readonly title: string;
/** The serializable reference clients subscribe through. */
readonly ref: JsonRenderViewRef;
/** Replace the entire spec (a structural change replaces the whole spec). */
update: (spec: DevframeJsonRenderSpec) => void;
/**
* Apply JSON-Pointer patches to the view's `state`. Travels as a
* shared-state patch (not a whole-spec snapshot), so only the changed
* paths cross the wire.
*/
patchState: (patches: JsonRenderStatePatch[]) => void;
/** Read the current spec (immutable). */
value: () => DevframeJsonRenderSpec;
/** Unregister the shared state and its listeners. */
dispose: () => void;
}
//#endregion
export { JsonRenderViewRef as i, JsonRenderView as n, JSON_RENDER_UPSTREAM_VERSION as r, DevframeJsonRenderSpec as t };
import { z } from "zod";
//#region src/prop-schemas.ts
/**
* Devframes-authored per-component prop schemas for the base catalog.
*
* Upstream `defineCatalog` collapses a multi-component `propsOf` to
* `Record<string, unknown>`, so it validates component *names* but not
* per-component *props*. These schemas are the one validation Devframes
* adds: element props are parsed against the matching schema at both trust
* boundaries — spec ingress (server) and render time (client).
*
* Each schema validates the types of the documented props and tolerates
* extra keys (upstream directives like `$bindState` resolve to values at
* render time), so validation catches genuine authoring mistakes without
* rejecting valid dynamic expressions.
*/
const dynamic = z.looseObject({}).and(z.record(z.string(), z.unknown()));
function scalar(schema) {
return z.union([schema, dynamic]);
}
const str = scalar(z.string());
const num = scalar(z.number());
const bool = scalar(z.boolean());
const StackPropsSchema = z.object({
direction: z.enum(["row", "column"]).optional(),
gap: num.optional(),
padding: num.optional(),
align: z.enum([
"start",
"center",
"end",
"stretch"
]).optional(),
justify: z.enum([
"start",
"center",
"end",
"between",
"around"
]).optional(),
wrap: bool.optional(),
flex: scalar(z.union([z.number(), z.string()])).optional()
});
const CardPropsSchema = z.object({
title: str.optional(),
border: bool.optional(),
collapsible: bool.optional(),
defaultCollapsed: bool.optional(),
loading: bool.optional()
});
const TextPropsSchema = z.object({
text: str.optional(),
variant: z.enum([
"heading",
"subheading",
"body",
"caption",
"code"
]).optional(),
weight: z.enum([
"normal",
"medium",
"bold"
]).optional(),
color: z.enum([
"base",
"muted",
"faint",
"primary",
"success",
"warning",
"danger"
]).optional()
});
const BadgePropsSchema = z.object({
text: str.optional(),
variant: z.enum([
"default",
"success",
"warning",
"danger",
"info"
]).optional(),
minWidth: num.optional()
});
const ButtonPropsSchema = z.object({
label: str.optional(),
variant: z.enum([
"primary",
"secondary",
"ghost",
"danger"
]).optional(),
icon: str.optional(),
disabled: bool.optional(),
loading: bool.optional()
});
const IconPropsSchema = z.object({
name: str.optional(),
size: num.optional()
});
const DividerPropsSchema = z.object({ label: str.optional() });
const TextInputPropsSchema = z.object({
value: str.optional(),
placeholder: str.optional(),
label: str.optional(),
disabled: bool.optional(),
type: z.enum([
"text",
"number",
"password",
"email",
"search"
]).optional(),
loading: bool.optional()
});
const SwitchPropsSchema = z.object({
value: bool.optional(),
label: str.optional(),
disabled: bool.optional()
});
const KeyValueTablePropsSchema = z.object({
data: z.union([z.record(z.string(), z.unknown()), dynamic]).optional(),
loading: bool.optional()
});
const DataTablePropsSchema = z.object({
columns: scalar(z.array(z.union([z.string(), z.looseObject({
key: z.string(),
label: z.string().optional()
})]))).optional(),
rows: scalar(z.array(z.unknown())).optional(),
height: num.optional(),
loading: bool.optional()
});
const CodeBlockPropsSchema = z.object({
code: str.optional(),
language: str.optional(),
filename: str.optional(),
height: num.optional()
});
const ProgressPropsSchema = z.object({
value: num.optional(),
max: num.optional(),
label: str.optional()
});
const TreePropsSchema = z.object({
data: z.unknown().optional(),
defaultExpanded: bool.optional()
});
/**
* Map of base-catalog component name → Zod prop schema. The keys are the
* canonical component set (catalog v1).
*/
const basePropSchemas = {
Stack: StackPropsSchema,
Card: CardPropsSchema,
Text: TextPropsSchema,
Badge: BadgePropsSchema,
Button: ButtonPropsSchema,
Icon: IconPropsSchema,
Divider: DividerPropsSchema,
TextInput: TextInputPropsSchema,
Switch: SwitchPropsSchema,
KeyValueTable: KeyValueTablePropsSchema,
DataTable: DataTablePropsSchema,
CodeBlock: CodeBlockPropsSchema,
Progress: ProgressPropsSchema,
Tree: TreePropsSchema
};
/** The ordered list of base-catalog component names (catalog v1). */
const baseComponentNames = Object.keys(basePropSchemas);
//#endregion
//#region src/view-index.ts
/**
* Well-known shared-state key carrying the **view index**: a map of every
* live JSON-render view registered on a context, keyed by its `stateKey`.
*
* A frontend that does not know view ids ahead of time (e.g. the prebuilt
* standalone SPA in `@devframes/json-render-ui`) subscribes to this one key to
* discover which views exist, then subscribes to each view's own state. A hub
* dock, by contrast, is handed a specific {@link JsonRenderViewRef} and needs
* no index.
*/
const JSON_RENDER_INDEX_KEY = "devframe:json-render:index";
//#endregion
//#region src/view-ref.ts
/**
* The `@json-render/core` / `@json-render/vue` version this build of
* `@devframes/json-render` is written and tested against. It is the sole
* compatibility signal carried across the wire — there is no separate
* Devframes protocol/catalog version stamp. A renderer compares its own
* upstream version against a view's {@link JsonRenderViewRef.upstreamVersion}
* and warns (rather than blocking) on a mismatch.
*
* Kept paired with the caret range on `@json-render/core` /
* `@json-render/vue` in this package's manifest; the committed lockfile is
* the guard against a breaking upstream upgrade.
*/
const JSON_RENDER_UPSTREAM_VERSION = "0.19.0";
//#endregion
export { baseComponentNames as _, CardPropsSchema as a, DividerPropsSchema as c, ProgressPropsSchema as d, StackPropsSchema as f, TreePropsSchema as g, TextPropsSchema as h, ButtonPropsSchema as i, IconPropsSchema as l, TextInputPropsSchema as m, JSON_RENDER_INDEX_KEY as n, CodeBlockPropsSchema as o, SwitchPropsSchema as p, BadgePropsSchema as r, DataTablePropsSchema as s, JSON_RENDER_UPSTREAM_VERSION as t, KeyValueTablePropsSchema as u, basePropSchemas as v };
+1
-1

@@ -1,2 +0,2 @@

import { i as JsonRenderViewRef, n as JsonRenderView } from "./types-DafC9dUn.mjs";
import { i as JsonRenderViewRef, n as JsonRenderView } from "./types-Di-9QrXX.mjs";
import { DevframeDockEntryBase } from "@devframes/hub/types";

@@ -3,0 +3,0 @@ //#region src/hub.d.ts

import { Catalog, InferComponentProps, Spec, StateModel, StateStore, UIElement } from "./core.mjs";
import { i as JsonRenderViewRef, n as JsonRenderView, r as JSON_RENDER_UPSTREAM_VERSION, t as DevframeJsonRenderSpec } from "./types-DafC9dUn.mjs";
import { i as JsonRenderViewRef, n as JsonRenderView, r as JSON_RENDER_UPSTREAM_VERSION, t as DevframeJsonRenderSpec } from "./types-Di-9QrXX.mjs";
import { z } from "zod";

@@ -337,2 +337,34 @@ //#region src/prop-schemas.d.ts

//#endregion
export { BadgePropsSchema, type BaseComponentName, ButtonPropsSchema, CardPropsSchema, type Catalog, CodeBlockPropsSchema, DataTablePropsSchema, type DevframeJsonRenderSpec, DividerPropsSchema, IconPropsSchema, type InferComponentProps, JSON_RENDER_UPSTREAM_VERSION, type JsonRenderView, type JsonRenderViewRef, KeyValueTablePropsSchema, ProgressPropsSchema, type Spec, StackPropsSchema, type StateModel, type StateStore, SwitchPropsSchema, TextInputPropsSchema, TextPropsSchema, TreePropsSchema, type UIElement, baseCatalog, baseComponentNames, basePropSchemas, baseSchema };
//#region src/view-index.d.ts
/**
* Well-known shared-state key carrying the **view index**: a map of every
* live JSON-render view registered on a context, keyed by its `stateKey`.
*
* A frontend that does not know view ids ahead of time (e.g. the prebuilt
* standalone SPA in `@devframes/json-render-ui`) subscribes to this one key to
* discover which views exist, then subscribes to each view's own state. A hub
* dock, by contrast, is handed a specific {@link JsonRenderViewRef} and needs
* no index.
*/
declare const JSON_RENDER_INDEX_KEY = "devframe:json-render:index";
/**
* One entry in the {@link JSON_RENDER_INDEX_KEY view index}. Fully
* serializable: it locates a view's live state and carries the display title a
* multi-view frontend uses to label it.
*/
interface JsonRenderIndexEntry {
/** Author-supplied stable id, unique within the view's scope. */
id: string;
/** The view's scope segment (e.g. `global` or a context namespace). */
scope: string;
/** Shared-state key the client subscribes to for the live spec + state. */
stateKey: string;
/** Human-facing label for the view (defaults to `id`). */
title: string;
/** Upstream `@json-render/*` version the view was authored against. */
upstreamVersion: string;
}
/** The shape of the view-index shared state: entries keyed by `stateKey`. */
type JsonRenderIndex = Record<string, JsonRenderIndexEntry>;
//#endregion
export { BadgePropsSchema, type BaseComponentName, ButtonPropsSchema, CardPropsSchema, type Catalog, CodeBlockPropsSchema, DataTablePropsSchema, type DevframeJsonRenderSpec, DividerPropsSchema, IconPropsSchema, type InferComponentProps, JSON_RENDER_INDEX_KEY, JSON_RENDER_UPSTREAM_VERSION, type JsonRenderIndex, type JsonRenderIndexEntry, type JsonRenderView, type JsonRenderViewRef, KeyValueTablePropsSchema, ProgressPropsSchema, type Spec, StackPropsSchema, type StateModel, type StateStore, SwitchPropsSchema, TextInputPropsSchema, TextPropsSchema, TreePropsSchema, type UIElement, baseCatalog, baseComponentNames, basePropSchemas, baseSchema };

@@ -1,2 +0,2 @@

import { _ as basePropSchemas, a as CodeBlockPropsSchema, c as IconPropsSchema, d as StackPropsSchema, f as SwitchPropsSchema, g as baseComponentNames, h as TreePropsSchema, i as CardPropsSchema, l as KeyValueTablePropsSchema, m as TextPropsSchema, n as BadgePropsSchema, o as DataTablePropsSchema, p as TextInputPropsSchema, r as ButtonPropsSchema, s as DividerPropsSchema, t as JSON_RENDER_UPSTREAM_VERSION, u as ProgressPropsSchema } from "./view-ref-70LHsEHb.mjs";
import { _ as baseComponentNames, a as CardPropsSchema, c as DividerPropsSchema, d as ProgressPropsSchema, f as StackPropsSchema, g as TreePropsSchema, h as TextPropsSchema, i as ButtonPropsSchema, l as IconPropsSchema, m as TextInputPropsSchema, n as JSON_RENDER_INDEX_KEY, o as CodeBlockPropsSchema, p as SwitchPropsSchema, r as BadgePropsSchema, s as DataTablePropsSchema, t as JSON_RENDER_UPSTREAM_VERSION, u as KeyValueTablePropsSchema, v as basePropSchemas } from "./view-ref-B_nBPfeR.mjs";
import { defineCatalog, defineSchema } from "@json-render/core";

@@ -58,2 +58,2 @@ //#region src/catalog.ts

//#endregion
export { BadgePropsSchema, ButtonPropsSchema, CardPropsSchema, CodeBlockPropsSchema, DataTablePropsSchema, DividerPropsSchema, IconPropsSchema, JSON_RENDER_UPSTREAM_VERSION, KeyValueTablePropsSchema, ProgressPropsSchema, StackPropsSchema, SwitchPropsSchema, TextInputPropsSchema, TextPropsSchema, TreePropsSchema, baseCatalog, baseComponentNames, basePropSchemas, baseSchema };
export { BadgePropsSchema, ButtonPropsSchema, CardPropsSchema, CodeBlockPropsSchema, DataTablePropsSchema, DividerPropsSchema, IconPropsSchema, JSON_RENDER_INDEX_KEY, JSON_RENDER_UPSTREAM_VERSION, KeyValueTablePropsSchema, ProgressPropsSchema, StackPropsSchema, SwitchPropsSchema, TextInputPropsSchema, TextPropsSchema, TreePropsSchema, baseCatalog, baseComponentNames, basePropSchemas, baseSchema };

@@ -1,2 +0,2 @@

import { n as JsonRenderView, t as DevframeJsonRenderSpec } from "../types-DafC9dUn.mjs";
import { n as JsonRenderView, t as DevframeJsonRenderSpec } from "../types-Di-9QrXX.mjs";
import { Diagnostic } from "nostics";

@@ -21,2 +21,8 @@ import { DevframeNodeContext, DevframeScopedNodeContext } from "devframe/types";

scope?: string;
/**
* Human-facing label published in the view index and used by a multi-view
* frontend (e.g. the standalone SPA's view switcher) to name this view.
* Defaults to {@link CreateJsonRenderViewOptions.id}.
*/
title?: string;
}

@@ -23,0 +29,0 @@ type AnyContext = DevframeNodeContext | DevframeScopedNodeContext<string>;

@@ -1,2 +0,2 @@

import { _ as basePropSchemas, t as JSON_RENDER_UPSTREAM_VERSION } from "../view-ref-70LHsEHb.mjs";
import { n as JSON_RENDER_INDEX_KEY, t as JSON_RENDER_UPSTREAM_VERSION, v as basePropSchemas } from "../view-ref-B_nBPfeR.mjs";
import { createSharedState } from "devframe/utils/shared-state";

@@ -47,2 +47,12 @@ import { colors } from "devframe/utils/colors";

}
const indexStates = /* @__PURE__ */ new WeakMap();
function indexStateFor(ctx) {
let state = indexStates.get(ctx);
if (!state) {
state = createSharedState({ initialValue: {} });
indexStates.set(ctx, state);
ctx.rpc.sharedState.get(JSON_RENDER_INDEX_KEY, { sharedState: state });
}
return state;
}
/** Parse an RFC 6901 JSON Pointer into path segments. */

@@ -104,2 +114,3 @@ function parsePointer(pointer) {

const { id } = options;
const title = options.title ?? id;
const stateKey = `devframe:json-render:${scope}:${id}`;

@@ -120,2 +131,12 @@ const registry = registryFor(baseCtx);

baseCtx.rpc.sharedState.get(stateKey, { sharedState: state });
const index = indexStateFor(baseCtx);
index.mutate((idx) => {
idx[stateKey] = {
id,
scope,
stateKey,
title,
upstreamVersion: JSON_RENDER_UPSTREAM_VERSION
};
});
let disposed = false;

@@ -127,2 +148,3 @@ function assertLive() {

id,
title,
ref: {

@@ -153,2 +175,5 @@ stateKey,

registry.delete(stateKey);
index.mutate((idx) => {
delete idx[stateKey];
});
baseCtx.rpc.sharedState.delete(stateKey);

@@ -155,0 +180,0 @@ }

{
"name": "@devframes/json-render",
"type": "module",
"version": "0.7.8",
"version": "0.7.9",
"description": "Opt-in, framework-neutral JSON-render protocol layer for devframe — spec/catalog types, base catalog, and the node runtime factory.",

@@ -33,4 +33,4 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>",

"peerDependencies": {
"@devframes/hub": "0.7.8",
"devframe": "0.7.8"
"devframe": "0.7.9",
"@devframes/hub": "0.7.9"
},

@@ -50,4 +50,4 @@ "peerDependenciesMeta": {

"tsdown": "^0.22.12",
"@devframes/hub": "0.7.8",
"devframe": "0.7.8"
"@devframes/hub": "0.7.9",
"devframe": "0.7.9"
},

@@ -54,0 +54,0 @@ "scripts": {

import { Spec } from "@json-render/core";
//#region src/view-ref.d.ts
/**
* The `@json-render/core` / `@json-render/vue` version this build of
* `@devframes/json-render` is written and tested against. It is the sole
* compatibility signal carried across the wire — there is no separate
* Devframes protocol/catalog version stamp. A renderer compares its own
* upstream version against a view's {@link JsonRenderViewRef.upstreamVersion}
* and warns (rather than blocking) on a mismatch.
*
* Kept paired with the caret range on `@json-render/core` /
* `@json-render/vue` in this package's manifest; the committed lockfile is
* the guard against a breaking upstream upgrade.
*/
declare const JSON_RENDER_UPSTREAM_VERSION = "0.19.0";
/**
* The serializable reference to a JSON-render view that crosses process /
* static boundaries — e.g. projected onto a hub dock entry. It carries **no
* functions** and no Devframes catalog version: just the shared-state key the
* client subscribes to for the live spec + state, and the upstream version
* the view was authored against.
*
* This is the corrected projection contract: the previous hub implementation
* leaked an accidental `_stateKey` field and a non-serializable renderer
* handle; a `JsonRenderViewRef` is a plain, fully-serializable object.
*/
interface JsonRenderViewRef {
/** Shared-state key the client subscribes to for the live spec + state. */
stateKey: string;
/** Upstream `@json-render/*` version the view was authored against. */
upstreamVersion: string;
}
//#endregion
//#region src/types.d.ts
/**
* A Devframes JSON-render spec **is** an `@json-render/core` `Spec`: a flat
* `root` key, an `elements` map, and optional initial `state`. This alias is
* the Devframes-facing name; it does not add or remove fields.
*/
type DevframeJsonRenderSpec = Spec;
/**
* A single JSON-Pointer patch to a view's `state` model. `path` is an
* RFC 6901 JSON Pointer relative to the state root (e.g. `/count`,
* `/user/name`). Structural spec changes replace the whole spec via
* `update` instead.
*/
interface JsonRenderStatePatch {
op: 'add' | 'remove' | 'replace';
/** JSON Pointer relative to the state root, e.g. `/count`. */
path: string;
value?: unknown;
}
/**
* A JSON-render view handle, returned by `createJsonRenderView`. Owns a
* server-side shared state carrying the live spec + state, and exposes the
* serializable {@link JsonRenderViewRef} that a hub dock (or any client
* transport) uses to locate it.
*/
interface JsonRenderView {
/** Author-supplied stable id, unique within the view's scope. */
readonly id: string;
/** The serializable reference clients subscribe through. */
readonly ref: JsonRenderViewRef;
/** Replace the entire spec (a structural change replaces the whole spec). */
update: (spec: DevframeJsonRenderSpec) => void;
/**
* Apply JSON-Pointer patches to the view's `state`. Travels as a
* shared-state patch (not a whole-spec snapshot), so only the changed
* paths cross the wire.
*/
patchState: (patches: JsonRenderStatePatch[]) => void;
/** Read the current spec (immutable). */
value: () => DevframeJsonRenderSpec;
/** Unregister the shared state and its listeners. */
dispose: () => void;
}
//#endregion
export { JsonRenderViewRef as i, JsonRenderView as n, JSON_RENDER_UPSTREAM_VERSION as r, DevframeJsonRenderSpec as t };
import { z } from "zod";
//#region src/prop-schemas.ts
/**
* Devframes-authored per-component prop schemas for the base catalog.
*
* Upstream `defineCatalog` collapses a multi-component `propsOf` to
* `Record<string, unknown>`, so it validates component *names* but not
* per-component *props*. These schemas are the one validation Devframes
* adds: element props are parsed against the matching schema at both trust
* boundaries — spec ingress (server) and render time (client).
*
* Each schema validates the types of the documented props and tolerates
* extra keys (upstream directives like `$bindState` resolve to values at
* render time), so validation catches genuine authoring mistakes without
* rejecting valid dynamic expressions.
*/
const dynamic = z.looseObject({}).and(z.record(z.string(), z.unknown()));
function scalar(schema) {
return z.union([schema, dynamic]);
}
const str = scalar(z.string());
const num = scalar(z.number());
const bool = scalar(z.boolean());
const StackPropsSchema = z.object({
direction: z.enum(["row", "column"]).optional(),
gap: num.optional(),
padding: num.optional(),
align: z.enum([
"start",
"center",
"end",
"stretch"
]).optional(),
justify: z.enum([
"start",
"center",
"end",
"between",
"around"
]).optional(),
wrap: bool.optional(),
flex: scalar(z.union([z.number(), z.string()])).optional()
});
const CardPropsSchema = z.object({
title: str.optional(),
border: bool.optional(),
collapsible: bool.optional(),
defaultCollapsed: bool.optional(),
loading: bool.optional()
});
const TextPropsSchema = z.object({
text: str.optional(),
variant: z.enum([
"heading",
"subheading",
"body",
"caption",
"code"
]).optional(),
weight: z.enum([
"normal",
"medium",
"bold"
]).optional(),
color: z.enum([
"base",
"muted",
"faint",
"primary",
"success",
"warning",
"danger"
]).optional()
});
const BadgePropsSchema = z.object({
text: str.optional(),
variant: z.enum([
"default",
"success",
"warning",
"danger",
"info"
]).optional(),
minWidth: num.optional()
});
const ButtonPropsSchema = z.object({
label: str.optional(),
variant: z.enum([
"primary",
"secondary",
"ghost",
"danger"
]).optional(),
icon: str.optional(),
disabled: bool.optional(),
loading: bool.optional()
});
const IconPropsSchema = z.object({
name: str.optional(),
size: num.optional()
});
const DividerPropsSchema = z.object({ label: str.optional() });
const TextInputPropsSchema = z.object({
value: str.optional(),
placeholder: str.optional(),
label: str.optional(),
disabled: bool.optional(),
type: z.enum([
"text",
"number",
"password",
"email",
"search"
]).optional(),
loading: bool.optional()
});
const SwitchPropsSchema = z.object({
value: bool.optional(),
label: str.optional(),
disabled: bool.optional()
});
const KeyValueTablePropsSchema = z.object({
data: z.union([z.record(z.string(), z.unknown()), dynamic]).optional(),
loading: bool.optional()
});
const DataTablePropsSchema = z.object({
columns: scalar(z.array(z.union([z.string(), z.looseObject({
key: z.string(),
label: z.string().optional()
})]))).optional(),
rows: scalar(z.array(z.unknown())).optional(),
height: num.optional(),
loading: bool.optional()
});
const CodeBlockPropsSchema = z.object({
code: str.optional(),
language: str.optional(),
filename: str.optional(),
height: num.optional()
});
const ProgressPropsSchema = z.object({
value: num.optional(),
max: num.optional(),
label: str.optional()
});
const TreePropsSchema = z.object({
data: z.unknown().optional(),
defaultExpanded: bool.optional()
});
/**
* Map of base-catalog component name → Zod prop schema. The keys are the
* canonical component set (catalog v1).
*/
const basePropSchemas = {
Stack: StackPropsSchema,
Card: CardPropsSchema,
Text: TextPropsSchema,
Badge: BadgePropsSchema,
Button: ButtonPropsSchema,
Icon: IconPropsSchema,
Divider: DividerPropsSchema,
TextInput: TextInputPropsSchema,
Switch: SwitchPropsSchema,
KeyValueTable: KeyValueTablePropsSchema,
DataTable: DataTablePropsSchema,
CodeBlock: CodeBlockPropsSchema,
Progress: ProgressPropsSchema,
Tree: TreePropsSchema
};
/** The ordered list of base-catalog component names (catalog v1). */
const baseComponentNames = Object.keys(basePropSchemas);
//#endregion
//#region src/view-ref.ts
/**
* The `@json-render/core` / `@json-render/vue` version this build of
* `@devframes/json-render` is written and tested against. It is the sole
* compatibility signal carried across the wire — there is no separate
* Devframes protocol/catalog version stamp. A renderer compares its own
* upstream version against a view's {@link JsonRenderViewRef.upstreamVersion}
* and warns (rather than blocking) on a mismatch.
*
* Kept paired with the caret range on `@json-render/core` /
* `@json-render/vue` in this package's manifest; the committed lockfile is
* the guard against a breaking upstream upgrade.
*/
const JSON_RENDER_UPSTREAM_VERSION = "0.19.0";
//#endregion
export { basePropSchemas as _, CodeBlockPropsSchema as a, IconPropsSchema as c, StackPropsSchema as d, SwitchPropsSchema as f, baseComponentNames as g, TreePropsSchema as h, CardPropsSchema as i, KeyValueTablePropsSchema as l, TextPropsSchema as m, BadgePropsSchema as n, DataTablePropsSchema as o, TextInputPropsSchema as p, ButtonPropsSchema as r, DividerPropsSchema as s, JSON_RENDER_UPSTREAM_VERSION as t, ProgressPropsSchema as u };