@devframes/json-render 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/dist/core.d.mts +2 -0
- package/dist/core.mjs +2 -0
- package/dist/hub.d.mts +27 -0
- package/dist/hub.mjs +15 -0
- package/dist/index.d.mts +337 -0
- package/dist/index.mjs +58 -0
- package/dist/node/index.d.mts +76 -0
- package/dist/node/index.mjs +154 -0
- package/dist/types-DafC9dUn.d.mts +78 -0
- package/dist/view-ref-70LHsEHb.mjs +188 -0
- package/package.json +57 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-PRESENT Anthony Fu <https://github.com/antfu>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/core.d.mts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Catalog, InferActionParams, InferCatalogActions, InferCatalogComponents, InferCatalogInput, InferComponentProps, InferSpec, Schema, SchemaBuilder, SchemaDefinition, SchemaOptions, SchemaType, Spec, StateModel, StateStore, UIElement, createStateStore, defineCatalog, defineSchema } from "@json-render/core";
|
|
2
|
+
export { type Catalog, type InferActionParams, type InferCatalogActions, type InferCatalogComponents, type InferCatalogInput, type InferComponentProps, type InferSpec, type Schema, type SchemaBuilder, type SchemaDefinition, type SchemaOptions, type SchemaType, type Spec, type StateModel, type StateStore, type UIElement, createStateStore, defineCatalog, defineSchema };
|
package/dist/core.mjs
ADDED
package/dist/hub.d.mts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { i as JsonRenderViewRef, n as JsonRenderView } from "./types-DafC9dUn.mjs";
|
|
2
|
+
import { DevframeDockEntryBase } from "@devframes/hub/types";
|
|
3
|
+
//#region src/hub.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A `json-render` dock entry. Contributed to the hub's **open** dock union
|
|
6
|
+
* (`DevframeDockEntryRegistry`) by this opt-in integration — the hub itself
|
|
7
|
+
* hard-codes no json-render variant. Carries only the serializable
|
|
8
|
+
* {@link JsonRenderViewRef}; no functions cross the wire.
|
|
9
|
+
*/
|
|
10
|
+
interface DevframeJsonRenderDockEntry extends DevframeDockEntryBase {
|
|
11
|
+
type: 'json-render';
|
|
12
|
+
/** Serializable reference the client subscribes through. */
|
|
13
|
+
view: JsonRenderViewRef;
|
|
14
|
+
}
|
|
15
|
+
declare module '@devframes/hub/types' {
|
|
16
|
+
interface DevframeDockEntryRegistry {
|
|
17
|
+
'json-render': DevframeJsonRenderDockEntry;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Build a `json-render` dock entry from a {@link JsonRenderView} and the dock
|
|
22
|
+
* metadata (id, title, icon, …). Projects the view down to its serializable
|
|
23
|
+
* {@link JsonRenderViewRef} so it survives dock projection into shared state.
|
|
24
|
+
*/
|
|
25
|
+
declare function toJsonRenderDockEntry(view: JsonRenderView, meta: Omit<DevframeJsonRenderDockEntry, 'type' | 'view'>): DevframeJsonRenderDockEntry;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { DevframeJsonRenderDockEntry, toJsonRenderDockEntry };
|
package/dist/hub.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/hub.ts
|
|
2
|
+
/**
|
|
3
|
+
* Build a `json-render` dock entry from a {@link JsonRenderView} and the dock
|
|
4
|
+
* metadata (id, title, icon, …). Projects the view down to its serializable
|
|
5
|
+
* {@link JsonRenderViewRef} so it survives dock projection into shared state.
|
|
6
|
+
*/
|
|
7
|
+
function toJsonRenderDockEntry(view, meta) {
|
|
8
|
+
return {
|
|
9
|
+
...meta,
|
|
10
|
+
type: "json-render",
|
|
11
|
+
view: view.ref
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { toJsonRenderDockEntry };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { Catalog, InferComponentProps, Spec, StateModel, StateStore, UIElement } from "./core.mjs";
|
|
2
|
+
import { i as JsonRenderViewRef, n as JsonRenderView, r as JSON_RENDER_UPSTREAM_VERSION, t as DevframeJsonRenderSpec } from "./types-DafC9dUn.mjs";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/prop-schemas.d.ts
|
|
5
|
+
declare const StackPropsSchema: z.ZodObject<{
|
|
6
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
7
|
+
row: "row";
|
|
8
|
+
column: "column";
|
|
9
|
+
}>>;
|
|
10
|
+
gap: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
11
|
+
padding: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
12
|
+
align: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
start: "start";
|
|
14
|
+
center: "center";
|
|
15
|
+
end: "end";
|
|
16
|
+
stretch: "stretch";
|
|
17
|
+
}>>;
|
|
18
|
+
justify: z.ZodOptional<z.ZodEnum<{
|
|
19
|
+
start: "start";
|
|
20
|
+
center: "center";
|
|
21
|
+
end: "end";
|
|
22
|
+
between: "between";
|
|
23
|
+
around: "around";
|
|
24
|
+
}>>;
|
|
25
|
+
wrap: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
26
|
+
flex: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
declare const CardPropsSchema: z.ZodObject<{
|
|
29
|
+
title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
30
|
+
border: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
31
|
+
collapsible: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
32
|
+
defaultCollapsed: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
33
|
+
loading: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
declare const TextPropsSchema: z.ZodObject<{
|
|
36
|
+
text: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
37
|
+
variant: z.ZodOptional<z.ZodEnum<{
|
|
38
|
+
code: "code";
|
|
39
|
+
heading: "heading";
|
|
40
|
+
subheading: "subheading";
|
|
41
|
+
body: "body";
|
|
42
|
+
caption: "caption";
|
|
43
|
+
}>>;
|
|
44
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
45
|
+
bold: "bold";
|
|
46
|
+
normal: "normal";
|
|
47
|
+
medium: "medium";
|
|
48
|
+
}>>;
|
|
49
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
50
|
+
success: "success";
|
|
51
|
+
base: "base";
|
|
52
|
+
muted: "muted";
|
|
53
|
+
faint: "faint";
|
|
54
|
+
primary: "primary";
|
|
55
|
+
warning: "warning";
|
|
56
|
+
danger: "danger";
|
|
57
|
+
}>>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
declare const BadgePropsSchema: z.ZodObject<{
|
|
60
|
+
text: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
61
|
+
variant: z.ZodOptional<z.ZodEnum<{
|
|
62
|
+
success: "success";
|
|
63
|
+
default: "default";
|
|
64
|
+
warning: "warning";
|
|
65
|
+
danger: "danger";
|
|
66
|
+
info: "info";
|
|
67
|
+
}>>;
|
|
68
|
+
minWidth: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
declare const ButtonPropsSchema: z.ZodObject<{
|
|
71
|
+
label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
72
|
+
variant: z.ZodOptional<z.ZodEnum<{
|
|
73
|
+
primary: "primary";
|
|
74
|
+
danger: "danger";
|
|
75
|
+
secondary: "secondary";
|
|
76
|
+
ghost: "ghost";
|
|
77
|
+
}>>;
|
|
78
|
+
icon: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
79
|
+
disabled: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
80
|
+
loading: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
declare const IconPropsSchema: z.ZodObject<{
|
|
83
|
+
name: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
84
|
+
size: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
declare const DividerPropsSchema: z.ZodObject<{
|
|
87
|
+
label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
declare const TextInputPropsSchema: z.ZodObject<{
|
|
90
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
91
|
+
placeholder: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
92
|
+
label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
93
|
+
disabled: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
94
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
95
|
+
number: "number";
|
|
96
|
+
search: "search";
|
|
97
|
+
text: "text";
|
|
98
|
+
password: "password";
|
|
99
|
+
email: "email";
|
|
100
|
+
}>>;
|
|
101
|
+
loading: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
declare const SwitchPropsSchema: z.ZodObject<{
|
|
104
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
105
|
+
label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
106
|
+
disabled: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
declare const KeyValueTablePropsSchema: z.ZodObject<{
|
|
109
|
+
data: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
110
|
+
loading: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
declare const DataTablePropsSchema: z.ZodObject<{
|
|
113
|
+
columns: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
114
|
+
key: z.ZodString;
|
|
115
|
+
label: z.ZodOptional<z.ZodString>;
|
|
116
|
+
}, z.core.$loose>]>>, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
117
|
+
rows: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodUnknown>, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
118
|
+
height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
119
|
+
loading: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
declare const CodeBlockPropsSchema: z.ZodObject<{
|
|
122
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
123
|
+
language: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
124
|
+
filename: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
125
|
+
height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
declare const ProgressPropsSchema: z.ZodObject<{
|
|
128
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
129
|
+
max: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
130
|
+
label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
131
|
+
}, z.core.$strip>;
|
|
132
|
+
declare const TreePropsSchema: z.ZodObject<{
|
|
133
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
134
|
+
defaultExpanded: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
/**
|
|
137
|
+
* Map of base-catalog component name → Zod prop schema. The keys are the
|
|
138
|
+
* canonical component set (catalog v1).
|
|
139
|
+
*/
|
|
140
|
+
declare const basePropSchemas: {
|
|
141
|
+
readonly Stack: z.ZodObject<{
|
|
142
|
+
direction: z.ZodOptional<z.ZodEnum<{
|
|
143
|
+
row: "row";
|
|
144
|
+
column: "column";
|
|
145
|
+
}>>;
|
|
146
|
+
gap: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
147
|
+
padding: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
148
|
+
align: z.ZodOptional<z.ZodEnum<{
|
|
149
|
+
start: "start";
|
|
150
|
+
center: "center";
|
|
151
|
+
end: "end";
|
|
152
|
+
stretch: "stretch";
|
|
153
|
+
}>>;
|
|
154
|
+
justify: z.ZodOptional<z.ZodEnum<{
|
|
155
|
+
start: "start";
|
|
156
|
+
center: "center";
|
|
157
|
+
end: "end";
|
|
158
|
+
between: "between";
|
|
159
|
+
around: "around";
|
|
160
|
+
}>>;
|
|
161
|
+
wrap: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
162
|
+
flex: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
readonly Card: z.ZodObject<{
|
|
165
|
+
title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
166
|
+
border: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
167
|
+
collapsible: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
168
|
+
defaultCollapsed: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
169
|
+
loading: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
readonly Text: z.ZodObject<{
|
|
172
|
+
text: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
173
|
+
variant: z.ZodOptional<z.ZodEnum<{
|
|
174
|
+
code: "code";
|
|
175
|
+
heading: "heading";
|
|
176
|
+
subheading: "subheading";
|
|
177
|
+
body: "body";
|
|
178
|
+
caption: "caption";
|
|
179
|
+
}>>;
|
|
180
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
181
|
+
bold: "bold";
|
|
182
|
+
normal: "normal";
|
|
183
|
+
medium: "medium";
|
|
184
|
+
}>>;
|
|
185
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
186
|
+
success: "success";
|
|
187
|
+
base: "base";
|
|
188
|
+
muted: "muted";
|
|
189
|
+
faint: "faint";
|
|
190
|
+
primary: "primary";
|
|
191
|
+
warning: "warning";
|
|
192
|
+
danger: "danger";
|
|
193
|
+
}>>;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
readonly Badge: z.ZodObject<{
|
|
196
|
+
text: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
197
|
+
variant: z.ZodOptional<z.ZodEnum<{
|
|
198
|
+
success: "success";
|
|
199
|
+
default: "default";
|
|
200
|
+
warning: "warning";
|
|
201
|
+
danger: "danger";
|
|
202
|
+
info: "info";
|
|
203
|
+
}>>;
|
|
204
|
+
minWidth: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
readonly Button: z.ZodObject<{
|
|
207
|
+
label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
208
|
+
variant: z.ZodOptional<z.ZodEnum<{
|
|
209
|
+
primary: "primary";
|
|
210
|
+
danger: "danger";
|
|
211
|
+
secondary: "secondary";
|
|
212
|
+
ghost: "ghost";
|
|
213
|
+
}>>;
|
|
214
|
+
icon: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
215
|
+
disabled: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
216
|
+
loading: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
217
|
+
}, z.core.$strip>;
|
|
218
|
+
readonly Icon: z.ZodObject<{
|
|
219
|
+
name: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
220
|
+
size: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
221
|
+
}, z.core.$strip>;
|
|
222
|
+
readonly Divider: z.ZodObject<{
|
|
223
|
+
label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
224
|
+
}, z.core.$strip>;
|
|
225
|
+
readonly TextInput: z.ZodObject<{
|
|
226
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
227
|
+
placeholder: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
228
|
+
label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
229
|
+
disabled: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
230
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
231
|
+
number: "number";
|
|
232
|
+
search: "search";
|
|
233
|
+
text: "text";
|
|
234
|
+
password: "password";
|
|
235
|
+
email: "email";
|
|
236
|
+
}>>;
|
|
237
|
+
loading: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
238
|
+
}, z.core.$strip>;
|
|
239
|
+
readonly Switch: z.ZodObject<{
|
|
240
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
241
|
+
label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
242
|
+
disabled: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
243
|
+
}, z.core.$strip>;
|
|
244
|
+
readonly KeyValueTable: z.ZodObject<{
|
|
245
|
+
data: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
246
|
+
loading: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
247
|
+
}, z.core.$strip>;
|
|
248
|
+
readonly DataTable: z.ZodObject<{
|
|
249
|
+
columns: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
250
|
+
key: z.ZodString;
|
|
251
|
+
label: z.ZodOptional<z.ZodString>;
|
|
252
|
+
}, z.core.$loose>]>>, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
253
|
+
rows: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodUnknown>, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
254
|
+
height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
255
|
+
loading: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
256
|
+
}, z.core.$strip>;
|
|
257
|
+
readonly CodeBlock: z.ZodObject<{
|
|
258
|
+
code: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
259
|
+
language: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
260
|
+
filename: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
261
|
+
height: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
262
|
+
}, z.core.$strip>;
|
|
263
|
+
readonly Progress: z.ZodObject<{
|
|
264
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
265
|
+
max: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
266
|
+
label: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
267
|
+
}, z.core.$strip>;
|
|
268
|
+
readonly Tree: z.ZodObject<{
|
|
269
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
270
|
+
defaultExpanded: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodIntersection<z.ZodObject<{}, z.core.$loose>, z.ZodRecord<z.ZodString, z.ZodUnknown>>]>>;
|
|
271
|
+
}, z.core.$strip>;
|
|
272
|
+
};
|
|
273
|
+
/** Canonical base-catalog component name. */
|
|
274
|
+
type BaseComponentName = keyof typeof basePropSchemas;
|
|
275
|
+
/** The ordered list of base-catalog component names (catalog v1). */
|
|
276
|
+
declare const baseComponentNames: BaseComponentName[];
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/catalog.d.ts
|
|
279
|
+
/**
|
|
280
|
+
* The Devframes base-catalog schema. A Devframes spec is an
|
|
281
|
+
* `@json-render/core` `Spec` (flat `root` + `elements` map); the structural
|
|
282
|
+
* fields upstream's Vue schema omits (`state`, `on`, `repeat`, `watch`) pass
|
|
283
|
+
* through unchecked. The one validation Devframes adds is per-component prop
|
|
284
|
+
* validation (see {@link basePropSchemas}).
|
|
285
|
+
*/
|
|
286
|
+
declare const baseSchema: import("@json-render/core").Schema<{
|
|
287
|
+
spec: import("@json-render/core").SchemaType<"object", {
|
|
288
|
+
root: import("@json-render/core").SchemaType<"string", unknown>;
|
|
289
|
+
elements: import("@json-render/core").SchemaType<"record", import("@json-render/core").SchemaType<"object", {
|
|
290
|
+
type: import("@json-render/core").SchemaType<"ref", string>;
|
|
291
|
+
props: import("@json-render/core").SchemaType<"propsOf", string>;
|
|
292
|
+
children: import("@json-render/core").SchemaType<"array", import("@json-render/core").SchemaType<"string", unknown>>;
|
|
293
|
+
}>>;
|
|
294
|
+
}>;
|
|
295
|
+
catalog: import("@json-render/core").SchemaType<"object", {
|
|
296
|
+
components: import("@json-render/core").SchemaType<"map", {
|
|
297
|
+
props: import("@json-render/core").SchemaType<"zod", unknown>;
|
|
298
|
+
description: import("@json-render/core").SchemaType<"string", unknown>;
|
|
299
|
+
}>;
|
|
300
|
+
actions: import("@json-render/core").SchemaType<"map", {
|
|
301
|
+
description: import("@json-render/core").SchemaType<"string", unknown>;
|
|
302
|
+
}>;
|
|
303
|
+
}>;
|
|
304
|
+
}>;
|
|
305
|
+
/**
|
|
306
|
+
* The Devframes base catalog (catalog v1): the fourteen canonical components
|
|
307
|
+
* with their Devframes-authored Zod prop schemas and descriptions, and an
|
|
308
|
+
* empty action set (actions are dispatched dynamically via the bridge, they
|
|
309
|
+
* are not declared here). Reference frontend libraries implement this set.
|
|
310
|
+
*/
|
|
311
|
+
declare const baseCatalog: import("@json-render/core").Catalog<{
|
|
312
|
+
spec: import("@json-render/core").SchemaType<"object", {
|
|
313
|
+
root: import("@json-render/core").SchemaType<"string", unknown>;
|
|
314
|
+
elements: import("@json-render/core").SchemaType<"record", import("@json-render/core").SchemaType<"object", {
|
|
315
|
+
type: import("@json-render/core").SchemaType<"ref", string>;
|
|
316
|
+
props: import("@json-render/core").SchemaType<"propsOf", string>;
|
|
317
|
+
children: import("@json-render/core").SchemaType<"array", import("@json-render/core").SchemaType<"string", unknown>>;
|
|
318
|
+
}>>;
|
|
319
|
+
}>;
|
|
320
|
+
catalog: import("@json-render/core").SchemaType<"object", {
|
|
321
|
+
components: import("@json-render/core").SchemaType<"map", {
|
|
322
|
+
props: import("@json-render/core").SchemaType<"zod", unknown>;
|
|
323
|
+
description: import("@json-render/core").SchemaType<"string", unknown>;
|
|
324
|
+
}>;
|
|
325
|
+
actions: import("@json-render/core").SchemaType<"map", {
|
|
326
|
+
description: import("@json-render/core").SchemaType<"string", unknown>;
|
|
327
|
+
}>;
|
|
328
|
+
}>;
|
|
329
|
+
}, {
|
|
330
|
+
components: { [K in keyof typeof basePropSchemas]: {
|
|
331
|
+
props: (typeof basePropSchemas)[K];
|
|
332
|
+
description: string;
|
|
333
|
+
}; };
|
|
334
|
+
actions: {};
|
|
335
|
+
}>;
|
|
336
|
+
//#endregion
|
|
337
|
+
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 };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
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";
|
|
2
|
+
import { defineCatalog, defineSchema } from "@json-render/core";
|
|
3
|
+
//#region src/catalog.ts
|
|
4
|
+
/**
|
|
5
|
+
* The Devframes base-catalog schema. A Devframes spec is an
|
|
6
|
+
* `@json-render/core` `Spec` (flat `root` + `elements` map); the structural
|
|
7
|
+
* fields upstream's Vue schema omits (`state`, `on`, `repeat`, `watch`) pass
|
|
8
|
+
* through unchecked. The one validation Devframes adds is per-component prop
|
|
9
|
+
* validation (see {@link basePropSchemas}).
|
|
10
|
+
*/
|
|
11
|
+
const baseSchema = defineSchema((s) => ({
|
|
12
|
+
spec: s.object({
|
|
13
|
+
root: s.string(),
|
|
14
|
+
elements: s.record(s.object({
|
|
15
|
+
type: s.ref("catalog.components"),
|
|
16
|
+
props: s.propsOf("catalog.components"),
|
|
17
|
+
children: s.array(s.string())
|
|
18
|
+
}))
|
|
19
|
+
}),
|
|
20
|
+
catalog: s.object({
|
|
21
|
+
components: s.map({
|
|
22
|
+
props: s.zod(),
|
|
23
|
+
description: s.string()
|
|
24
|
+
}),
|
|
25
|
+
actions: s.map({ description: s.string() })
|
|
26
|
+
})
|
|
27
|
+
}));
|
|
28
|
+
const componentDescriptions = {
|
|
29
|
+
Stack: "Flex row/column container with gap, padding, alignment and justification.",
|
|
30
|
+
Card: "Bordered container with an optional title and collapsible body.",
|
|
31
|
+
Text: "Typographic text — heading, subheading, body, caption or inline code.",
|
|
32
|
+
Badge: "Small status pill with a semantic variant.",
|
|
33
|
+
Button: "Clickable button with a variant, optional icon and loading state.",
|
|
34
|
+
Icon: "Renders an icon resolved by name at runtime.",
|
|
35
|
+
Divider: "Horizontal rule with an optional centered label.",
|
|
36
|
+
TextInput: "Single-line text input with two-way state binding.",
|
|
37
|
+
Switch: "Accessible on/off toggle bound to a boolean state value.",
|
|
38
|
+
KeyValueTable: "Two-column table of key/value pairs.",
|
|
39
|
+
DataTable: "Tabular data with columns, rows and optional scroll height.",
|
|
40
|
+
CodeBlock: "Preformatted code block with a filename and language label.",
|
|
41
|
+
Progress: "Determinate progress bar.",
|
|
42
|
+
Tree: "Recursive object/array viewer with expandable nodes."
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The Devframes base catalog (catalog v1): the fourteen canonical components
|
|
46
|
+
* with their Devframes-authored Zod prop schemas and descriptions, and an
|
|
47
|
+
* empty action set (actions are dispatched dynamically via the bridge, they
|
|
48
|
+
* are not declared here). Reference frontend libraries implement this set.
|
|
49
|
+
*/
|
|
50
|
+
const baseCatalog = defineCatalog(baseSchema, {
|
|
51
|
+
components: Object.fromEntries(Object.keys(basePropSchemas).map((name) => [name, {
|
|
52
|
+
props: basePropSchemas[name],
|
|
53
|
+
description: componentDescriptions[name]
|
|
54
|
+
}])),
|
|
55
|
+
actions: {}
|
|
56
|
+
});
|
|
57
|
+
//#endregion
|
|
58
|
+
export { BadgePropsSchema, ButtonPropsSchema, CardPropsSchema, CodeBlockPropsSchema, DataTablePropsSchema, DividerPropsSchema, IconPropsSchema, JSON_RENDER_UPSTREAM_VERSION, KeyValueTablePropsSchema, ProgressPropsSchema, StackPropsSchema, SwitchPropsSchema, TextInputPropsSchema, TextPropsSchema, TreePropsSchema, baseCatalog, baseComponentNames, basePropSchemas, baseSchema };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { n as JsonRenderView, t as DevframeJsonRenderSpec } from "../types-DafC9dUn.mjs";
|
|
2
|
+
import { Diagnostic } from "nostics";
|
|
3
|
+
import { DevframeNodeContext, DevframeScopedNodeContext } from "devframe/types";
|
|
4
|
+
//#region src/node/create-view.d.ts
|
|
5
|
+
/** Options for {@link createJsonRenderView}. */
|
|
6
|
+
interface CreateJsonRenderViewOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Stable, author-supplied id, unique within the view's scope. Forms the
|
|
9
|
+
* shared-state key `devframe:json-render:<scope>:<id>` and never changes
|
|
10
|
+
* across updates, so a client keeps its subscription across reconnects.
|
|
11
|
+
*/
|
|
12
|
+
id: string;
|
|
13
|
+
/** The initial spec. */
|
|
14
|
+
spec: DevframeJsonRenderSpec;
|
|
15
|
+
/**
|
|
16
|
+
* Override the scope segment of the view's stable id. Defaults to the
|
|
17
|
+
* context's namespace when created from a scoped context, otherwise
|
|
18
|
+
* `'global'`.
|
|
19
|
+
*/
|
|
20
|
+
scope?: string;
|
|
21
|
+
}
|
|
22
|
+
type AnyContext = DevframeNodeContext | DevframeScopedNodeContext<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Create a JSON-render view bound to a devframe context. Registers a
|
|
25
|
+
* server-side shared state (patches enabled) carrying the live spec + state,
|
|
26
|
+
* validates element props at ingress against the base catalog, and returns a
|
|
27
|
+
* handle plus the serializable {@link JsonRenderView.ref} a client subscribes
|
|
28
|
+
* through.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const view = createJsonRenderView(ctx, { id: 'metrics', spec })
|
|
33
|
+
* view.update(nextSpec)
|
|
34
|
+
* view.patchState([{ op: 'replace', path: '/count', value: 3 }])
|
|
35
|
+
* view.dispose()
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare function createJsonRenderView(ctx: AnyContext, options: CreateJsonRenderViewOptions): JsonRenderView;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/node/diagnostics.d.ts
|
|
41
|
+
interface ReporterOptions {
|
|
42
|
+
method?: 'log' | 'warn' | 'error';
|
|
43
|
+
}
|
|
44
|
+
declare function jsonRenderReporter(d: Diagnostic, { method }?: ReporterOptions): void;
|
|
45
|
+
declare const diagnostics: import("nostics").Diagnostics<{
|
|
46
|
+
readonly DF0038: {
|
|
47
|
+
readonly why: (p: {
|
|
48
|
+
id: string;
|
|
49
|
+
key: string;
|
|
50
|
+
issues: string;
|
|
51
|
+
}) => string;
|
|
52
|
+
readonly fix: "Match the element props to the base catalog's prop schema for that component. See the component reference for the expected shape.";
|
|
53
|
+
};
|
|
54
|
+
readonly DF0039: {
|
|
55
|
+
readonly why: (p: {
|
|
56
|
+
id: string;
|
|
57
|
+
scope: string;
|
|
58
|
+
}) => string;
|
|
59
|
+
readonly fix: "Give each view a stable id unique within its scope, or dispose the previous view before recreating it.";
|
|
60
|
+
};
|
|
61
|
+
readonly DF0040: {
|
|
62
|
+
readonly why: (p: {
|
|
63
|
+
id: string;
|
|
64
|
+
}) => string;
|
|
65
|
+
readonly fix: "Create a fresh view with `createJsonRenderView` instead of reusing a disposed handle.";
|
|
66
|
+
};
|
|
67
|
+
readonly DF0041: {
|
|
68
|
+
readonly why: (p: {
|
|
69
|
+
id: string;
|
|
70
|
+
reason: string;
|
|
71
|
+
}) => string;
|
|
72
|
+
readonly fix: "Specs and state travel as strict JSON — remove functions, symbols, class instances, Map/Set, or circular references.";
|
|
73
|
+
};
|
|
74
|
+
}, readonly [typeof jsonRenderReporter]>;
|
|
75
|
+
//#endregion
|
|
76
|
+
export { type CreateJsonRenderViewOptions, createJsonRenderView, diagnostics as jsonRenderDiagnostics };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { _ as basePropSchemas, t as JSON_RENDER_UPSTREAM_VERSION } from "../view-ref-70LHsEHb.mjs";
|
|
2
|
+
import { createSharedState } from "devframe/utils/shared-state";
|
|
3
|
+
import { colors } from "devframe/utils/colors";
|
|
4
|
+
import { defineDiagnostics } from "nostics";
|
|
5
|
+
import { ansiFormatter } from "nostics/formatters/ansi";
|
|
6
|
+
//#region src/node/diagnostics.ts
|
|
7
|
+
const formatAnsi = ansiFormatter(colors);
|
|
8
|
+
function jsonRenderReporter(d, { method = "warn" } = {}) {
|
|
9
|
+
console[method](formatAnsi(d));
|
|
10
|
+
}
|
|
11
|
+
const diagnostics = defineDiagnostics({
|
|
12
|
+
docsBase: "https://devfra.me/errors",
|
|
13
|
+
reporters: [jsonRenderReporter],
|
|
14
|
+
codes: {
|
|
15
|
+
DF0038: {
|
|
16
|
+
why: (p) => `JSON-render view "${p.id}" received invalid props on element "${p.key}": ${p.issues}`,
|
|
17
|
+
fix: "Match the element props to the base catalog's prop schema for that component. See the component reference for the expected shape."
|
|
18
|
+
},
|
|
19
|
+
DF0039: {
|
|
20
|
+
why: (p) => `A JSON-render view with id "${p.id}" already exists in scope "${p.scope}".`,
|
|
21
|
+
fix: "Give each view a stable id unique within its scope, or dispose the previous view before recreating it."
|
|
22
|
+
},
|
|
23
|
+
DF0040: {
|
|
24
|
+
why: (p) => `JSON-render view "${p.id}" was used after it was disposed.`,
|
|
25
|
+
fix: "Create a fresh view with `createJsonRenderView` instead of reusing a disposed handle."
|
|
26
|
+
},
|
|
27
|
+
DF0041: {
|
|
28
|
+
why: (p) => `JSON-render view "${p.id}" spec is not JSON-serializable: ${p.reason}`,
|
|
29
|
+
fix: "Specs and state travel as strict JSON — remove functions, symbols, class instances, Map/Set, or circular references."
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/node/create-view.ts
|
|
35
|
+
function isScoped(ctx) {
|
|
36
|
+
return "base" in ctx && "namespace" in ctx;
|
|
37
|
+
}
|
|
38
|
+
const registries = /* @__PURE__ */ new WeakMap();
|
|
39
|
+
function registryFor(ctx) {
|
|
40
|
+
let set = registries.get(ctx);
|
|
41
|
+
if (!set) {
|
|
42
|
+
set = /* @__PURE__ */ new Set();
|
|
43
|
+
registries.set(ctx, set);
|
|
44
|
+
}
|
|
45
|
+
return set;
|
|
46
|
+
}
|
|
47
|
+
/** Parse an RFC 6901 JSON Pointer into path segments. */
|
|
48
|
+
function parsePointer(pointer) {
|
|
49
|
+
if (pointer === "" || pointer === "/") return [];
|
|
50
|
+
return pointer.replace(/^\//, "").split("/").map((seg) => seg.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
51
|
+
}
|
|
52
|
+
function assertJsonSerializable(id, spec) {
|
|
53
|
+
try {
|
|
54
|
+
JSON.stringify(spec);
|
|
55
|
+
} catch (error) {
|
|
56
|
+
throw diagnostics.DF0041({
|
|
57
|
+
id,
|
|
58
|
+
reason: error.message
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function validateElementProps(id, spec) {
|
|
63
|
+
for (const [key, element] of Object.entries(spec.elements ?? {})) {
|
|
64
|
+
const schema = basePropSchemas[element.type];
|
|
65
|
+
if (!schema) continue;
|
|
66
|
+
const result = schema.safeParse(element.props ?? {});
|
|
67
|
+
if (!result.success) {
|
|
68
|
+
const issues = result.error.issues.map((i) => `${i.path.join(".") || "(root)"}: ${i.message}`).join("; ");
|
|
69
|
+
throw diagnostics.DF0038({
|
|
70
|
+
id,
|
|
71
|
+
key,
|
|
72
|
+
issues
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function normalizeSpec(spec) {
|
|
78
|
+
return spec.state ? spec : {
|
|
79
|
+
...spec,
|
|
80
|
+
state: {}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Create a JSON-render view bound to a devframe context. Registers a
|
|
85
|
+
* server-side shared state (patches enabled) carrying the live spec + state,
|
|
86
|
+
* validates element props at ingress against the base catalog, and returns a
|
|
87
|
+
* handle plus the serializable {@link JsonRenderView.ref} a client subscribes
|
|
88
|
+
* through.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const view = createJsonRenderView(ctx, { id: 'metrics', spec })
|
|
93
|
+
* view.update(nextSpec)
|
|
94
|
+
* view.patchState([{ op: 'replace', path: '/count', value: 3 }])
|
|
95
|
+
* view.dispose()
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
function createJsonRenderView(ctx, options) {
|
|
99
|
+
const scoped = isScoped(ctx);
|
|
100
|
+
const baseCtx = scoped ? ctx.base : ctx;
|
|
101
|
+
const scope = options.scope ?? (scoped ? ctx.namespace : "global");
|
|
102
|
+
const { id } = options;
|
|
103
|
+
const stateKey = `devframe:json-render:${scope}:${id}`;
|
|
104
|
+
const registry = registryFor(baseCtx);
|
|
105
|
+
if (registry.has(stateKey)) throw diagnostics.DF0039({
|
|
106
|
+
id,
|
|
107
|
+
scope
|
|
108
|
+
});
|
|
109
|
+
const initial = normalizeSpec(options.spec);
|
|
110
|
+
validateElementProps(id, initial);
|
|
111
|
+
assertJsonSerializable(id, initial);
|
|
112
|
+
const state = createSharedState({
|
|
113
|
+
initialValue: initial,
|
|
114
|
+
enablePatches: true
|
|
115
|
+
});
|
|
116
|
+
registry.add(stateKey);
|
|
117
|
+
baseCtx.rpc.sharedState.get(stateKey, { sharedState: state });
|
|
118
|
+
let disposed = false;
|
|
119
|
+
function assertLive() {
|
|
120
|
+
if (disposed) throw diagnostics.DF0040({ id });
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
id,
|
|
124
|
+
ref: {
|
|
125
|
+
stateKey,
|
|
126
|
+
upstreamVersion: JSON_RENDER_UPSTREAM_VERSION
|
|
127
|
+
},
|
|
128
|
+
value: () => state.value(),
|
|
129
|
+
update(spec) {
|
|
130
|
+
assertLive();
|
|
131
|
+
const next = normalizeSpec(spec);
|
|
132
|
+
validateElementProps(id, next);
|
|
133
|
+
assertJsonSerializable(id, next);
|
|
134
|
+
state.mutate(() => next);
|
|
135
|
+
},
|
|
136
|
+
patchState(patches) {
|
|
137
|
+
assertLive();
|
|
138
|
+
const prefixed = patches.map((p) => ({
|
|
139
|
+
op: p.op,
|
|
140
|
+
path: ["state", ...parsePointer(p.path)],
|
|
141
|
+
value: p.value
|
|
142
|
+
}));
|
|
143
|
+
state.patch(prefixed);
|
|
144
|
+
},
|
|
145
|
+
dispose() {
|
|
146
|
+
if (disposed) return;
|
|
147
|
+
disposed = true;
|
|
148
|
+
registry.delete(stateKey);
|
|
149
|
+
baseCtx.rpc.sharedState.delete(stateKey);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
export { createJsonRenderView, diagnostics as jsonRenderDiagnostics };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Spec } from "@json-render/core";
|
|
2
|
+
//#region src/view-ref.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The `@json-render/core` / `@json-render/vue` version this build of
|
|
5
|
+
* `@devframes/json-render` is written and tested against. It is the sole
|
|
6
|
+
* compatibility signal carried across the wire — there is no separate
|
|
7
|
+
* Devframes protocol/catalog version stamp. A renderer compares its own
|
|
8
|
+
* upstream version against a view's {@link JsonRenderViewRef.upstreamVersion}
|
|
9
|
+
* and warns (rather than blocking) on a mismatch.
|
|
10
|
+
*
|
|
11
|
+
* Kept paired with the caret range on `@json-render/core` /
|
|
12
|
+
* `@json-render/vue` in this package's manifest; the committed lockfile is
|
|
13
|
+
* the guard against a breaking upstream upgrade.
|
|
14
|
+
*/
|
|
15
|
+
declare const JSON_RENDER_UPSTREAM_VERSION = "0.19.0";
|
|
16
|
+
/**
|
|
17
|
+
* The serializable reference to a JSON-render view that crosses process /
|
|
18
|
+
* static boundaries — e.g. projected onto a hub dock entry. It carries **no
|
|
19
|
+
* functions** and no Devframes catalog version: just the shared-state key the
|
|
20
|
+
* client subscribes to for the live spec + state, and the upstream version
|
|
21
|
+
* the view was authored against.
|
|
22
|
+
*
|
|
23
|
+
* This is the corrected projection contract: the previous hub implementation
|
|
24
|
+
* leaked an accidental `_stateKey` field and a non-serializable renderer
|
|
25
|
+
* handle; a `JsonRenderViewRef` is a plain, fully-serializable object.
|
|
26
|
+
*/
|
|
27
|
+
interface JsonRenderViewRef {
|
|
28
|
+
/** Shared-state key the client subscribes to for the live spec + state. */
|
|
29
|
+
stateKey: string;
|
|
30
|
+
/** Upstream `@json-render/*` version the view was authored against. */
|
|
31
|
+
upstreamVersion: string;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/types.d.ts
|
|
35
|
+
/**
|
|
36
|
+
* A Devframes JSON-render spec **is** an `@json-render/core` `Spec`: a flat
|
|
37
|
+
* `root` key, an `elements` map, and optional initial `state`. This alias is
|
|
38
|
+
* the Devframes-facing name; it does not add or remove fields.
|
|
39
|
+
*/
|
|
40
|
+
type DevframeJsonRenderSpec = Spec;
|
|
41
|
+
/**
|
|
42
|
+
* A single JSON-Pointer patch to a view's `state` model. `path` is an
|
|
43
|
+
* RFC 6901 JSON Pointer relative to the state root (e.g. `/count`,
|
|
44
|
+
* `/user/name`). Structural spec changes replace the whole spec via
|
|
45
|
+
* `update` instead.
|
|
46
|
+
*/
|
|
47
|
+
interface JsonRenderStatePatch {
|
|
48
|
+
op: 'add' | 'remove' | 'replace';
|
|
49
|
+
/** JSON Pointer relative to the state root, e.g. `/count`. */
|
|
50
|
+
path: string;
|
|
51
|
+
value?: unknown;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A JSON-render view handle, returned by `createJsonRenderView`. Owns a
|
|
55
|
+
* server-side shared state carrying the live spec + state, and exposes the
|
|
56
|
+
* serializable {@link JsonRenderViewRef} that a hub dock (or any client
|
|
57
|
+
* transport) uses to locate it.
|
|
58
|
+
*/
|
|
59
|
+
interface JsonRenderView {
|
|
60
|
+
/** Author-supplied stable id, unique within the view's scope. */
|
|
61
|
+
readonly id: string;
|
|
62
|
+
/** The serializable reference clients subscribe through. */
|
|
63
|
+
readonly ref: JsonRenderViewRef;
|
|
64
|
+
/** Replace the entire spec (a structural change replaces the whole spec). */
|
|
65
|
+
update: (spec: DevframeJsonRenderSpec) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Apply JSON-Pointer patches to the view's `state`. Travels as a
|
|
68
|
+
* shared-state patch (not a whole-spec snapshot), so only the changed
|
|
69
|
+
* paths cross the wire.
|
|
70
|
+
*/
|
|
71
|
+
patchState: (patches: JsonRenderStatePatch[]) => void;
|
|
72
|
+
/** Read the current spec (immutable). */
|
|
73
|
+
value: () => DevframeJsonRenderSpec;
|
|
74
|
+
/** Unregister the shared state and its listeners. */
|
|
75
|
+
dispose: () => void;
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { JsonRenderViewRef as i, JsonRenderView as n, JSON_RENDER_UPSTREAM_VERSION as r, DevframeJsonRenderSpec as t };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/prop-schemas.ts
|
|
3
|
+
/**
|
|
4
|
+
* Devframes-authored per-component prop schemas for the base catalog.
|
|
5
|
+
*
|
|
6
|
+
* Upstream `defineCatalog` collapses a multi-component `propsOf` to
|
|
7
|
+
* `Record<string, unknown>`, so it validates component *names* but not
|
|
8
|
+
* per-component *props*. These schemas are the one validation Devframes
|
|
9
|
+
* adds: element props are parsed against the matching schema at both trust
|
|
10
|
+
* boundaries — spec ingress (server) and render time (client).
|
|
11
|
+
*
|
|
12
|
+
* Each schema validates the types of the documented props and tolerates
|
|
13
|
+
* extra keys (upstream directives like `$bindState` resolve to values at
|
|
14
|
+
* render time), so validation catches genuine authoring mistakes without
|
|
15
|
+
* rejecting valid dynamic expressions.
|
|
16
|
+
*/
|
|
17
|
+
const dynamic = z.looseObject({}).and(z.record(z.string(), z.unknown()));
|
|
18
|
+
function scalar(schema) {
|
|
19
|
+
return z.union([schema, dynamic]);
|
|
20
|
+
}
|
|
21
|
+
const str = scalar(z.string());
|
|
22
|
+
const num = scalar(z.number());
|
|
23
|
+
const bool = scalar(z.boolean());
|
|
24
|
+
const StackPropsSchema = z.object({
|
|
25
|
+
direction: z.enum(["row", "column"]).optional(),
|
|
26
|
+
gap: num.optional(),
|
|
27
|
+
padding: num.optional(),
|
|
28
|
+
align: z.enum([
|
|
29
|
+
"start",
|
|
30
|
+
"center",
|
|
31
|
+
"end",
|
|
32
|
+
"stretch"
|
|
33
|
+
]).optional(),
|
|
34
|
+
justify: z.enum([
|
|
35
|
+
"start",
|
|
36
|
+
"center",
|
|
37
|
+
"end",
|
|
38
|
+
"between",
|
|
39
|
+
"around"
|
|
40
|
+
]).optional(),
|
|
41
|
+
wrap: bool.optional(),
|
|
42
|
+
flex: scalar(z.union([z.number(), z.string()])).optional()
|
|
43
|
+
});
|
|
44
|
+
const CardPropsSchema = z.object({
|
|
45
|
+
title: str.optional(),
|
|
46
|
+
border: bool.optional(),
|
|
47
|
+
collapsible: bool.optional(),
|
|
48
|
+
defaultCollapsed: bool.optional(),
|
|
49
|
+
loading: bool.optional()
|
|
50
|
+
});
|
|
51
|
+
const TextPropsSchema = z.object({
|
|
52
|
+
text: str.optional(),
|
|
53
|
+
variant: z.enum([
|
|
54
|
+
"heading",
|
|
55
|
+
"subheading",
|
|
56
|
+
"body",
|
|
57
|
+
"caption",
|
|
58
|
+
"code"
|
|
59
|
+
]).optional(),
|
|
60
|
+
weight: z.enum([
|
|
61
|
+
"normal",
|
|
62
|
+
"medium",
|
|
63
|
+
"bold"
|
|
64
|
+
]).optional(),
|
|
65
|
+
color: z.enum([
|
|
66
|
+
"base",
|
|
67
|
+
"muted",
|
|
68
|
+
"faint",
|
|
69
|
+
"primary",
|
|
70
|
+
"success",
|
|
71
|
+
"warning",
|
|
72
|
+
"danger"
|
|
73
|
+
]).optional()
|
|
74
|
+
});
|
|
75
|
+
const BadgePropsSchema = z.object({
|
|
76
|
+
text: str.optional(),
|
|
77
|
+
variant: z.enum([
|
|
78
|
+
"default",
|
|
79
|
+
"success",
|
|
80
|
+
"warning",
|
|
81
|
+
"danger",
|
|
82
|
+
"info"
|
|
83
|
+
]).optional(),
|
|
84
|
+
minWidth: num.optional()
|
|
85
|
+
});
|
|
86
|
+
const ButtonPropsSchema = z.object({
|
|
87
|
+
label: str.optional(),
|
|
88
|
+
variant: z.enum([
|
|
89
|
+
"primary",
|
|
90
|
+
"secondary",
|
|
91
|
+
"ghost",
|
|
92
|
+
"danger"
|
|
93
|
+
]).optional(),
|
|
94
|
+
icon: str.optional(),
|
|
95
|
+
disabled: bool.optional(),
|
|
96
|
+
loading: bool.optional()
|
|
97
|
+
});
|
|
98
|
+
const IconPropsSchema = z.object({
|
|
99
|
+
name: str.optional(),
|
|
100
|
+
size: num.optional()
|
|
101
|
+
});
|
|
102
|
+
const DividerPropsSchema = z.object({ label: str.optional() });
|
|
103
|
+
const TextInputPropsSchema = z.object({
|
|
104
|
+
value: str.optional(),
|
|
105
|
+
placeholder: str.optional(),
|
|
106
|
+
label: str.optional(),
|
|
107
|
+
disabled: bool.optional(),
|
|
108
|
+
type: z.enum([
|
|
109
|
+
"text",
|
|
110
|
+
"number",
|
|
111
|
+
"password",
|
|
112
|
+
"email",
|
|
113
|
+
"search"
|
|
114
|
+
]).optional(),
|
|
115
|
+
loading: bool.optional()
|
|
116
|
+
});
|
|
117
|
+
const SwitchPropsSchema = z.object({
|
|
118
|
+
value: bool.optional(),
|
|
119
|
+
label: str.optional(),
|
|
120
|
+
disabled: bool.optional()
|
|
121
|
+
});
|
|
122
|
+
const KeyValueTablePropsSchema = z.object({
|
|
123
|
+
data: z.union([z.record(z.string(), z.unknown()), dynamic]).optional(),
|
|
124
|
+
loading: bool.optional()
|
|
125
|
+
});
|
|
126
|
+
const DataTablePropsSchema = z.object({
|
|
127
|
+
columns: scalar(z.array(z.union([z.string(), z.looseObject({
|
|
128
|
+
key: z.string(),
|
|
129
|
+
label: z.string().optional()
|
|
130
|
+
})]))).optional(),
|
|
131
|
+
rows: scalar(z.array(z.unknown())).optional(),
|
|
132
|
+
height: num.optional(),
|
|
133
|
+
loading: bool.optional()
|
|
134
|
+
});
|
|
135
|
+
const CodeBlockPropsSchema = z.object({
|
|
136
|
+
code: str.optional(),
|
|
137
|
+
language: str.optional(),
|
|
138
|
+
filename: str.optional(),
|
|
139
|
+
height: num.optional()
|
|
140
|
+
});
|
|
141
|
+
const ProgressPropsSchema = z.object({
|
|
142
|
+
value: num.optional(),
|
|
143
|
+
max: num.optional(),
|
|
144
|
+
label: str.optional()
|
|
145
|
+
});
|
|
146
|
+
const TreePropsSchema = z.object({
|
|
147
|
+
data: z.unknown().optional(),
|
|
148
|
+
defaultExpanded: bool.optional()
|
|
149
|
+
});
|
|
150
|
+
/**
|
|
151
|
+
* Map of base-catalog component name → Zod prop schema. The keys are the
|
|
152
|
+
* canonical component set (catalog v1).
|
|
153
|
+
*/
|
|
154
|
+
const basePropSchemas = {
|
|
155
|
+
Stack: StackPropsSchema,
|
|
156
|
+
Card: CardPropsSchema,
|
|
157
|
+
Text: TextPropsSchema,
|
|
158
|
+
Badge: BadgePropsSchema,
|
|
159
|
+
Button: ButtonPropsSchema,
|
|
160
|
+
Icon: IconPropsSchema,
|
|
161
|
+
Divider: DividerPropsSchema,
|
|
162
|
+
TextInput: TextInputPropsSchema,
|
|
163
|
+
Switch: SwitchPropsSchema,
|
|
164
|
+
KeyValueTable: KeyValueTablePropsSchema,
|
|
165
|
+
DataTable: DataTablePropsSchema,
|
|
166
|
+
CodeBlock: CodeBlockPropsSchema,
|
|
167
|
+
Progress: ProgressPropsSchema,
|
|
168
|
+
Tree: TreePropsSchema
|
|
169
|
+
};
|
|
170
|
+
/** The ordered list of base-catalog component names (catalog v1). */
|
|
171
|
+
const baseComponentNames = Object.keys(basePropSchemas);
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/view-ref.ts
|
|
174
|
+
/**
|
|
175
|
+
* The `@json-render/core` / `@json-render/vue` version this build of
|
|
176
|
+
* `@devframes/json-render` is written and tested against. It is the sole
|
|
177
|
+
* compatibility signal carried across the wire — there is no separate
|
|
178
|
+
* Devframes protocol/catalog version stamp. A renderer compares its own
|
|
179
|
+
* upstream version against a view's {@link JsonRenderViewRef.upstreamVersion}
|
|
180
|
+
* and warns (rather than blocking) on a mismatch.
|
|
181
|
+
*
|
|
182
|
+
* Kept paired with the caret range on `@json-render/core` /
|
|
183
|
+
* `@json-render/vue` in this package's manifest; the committed lockfile is
|
|
184
|
+
* the guard against a breaking upstream upgrade.
|
|
185
|
+
*/
|
|
186
|
+
const JSON_RENDER_UPSTREAM_VERSION = "0.19.0";
|
|
187
|
+
//#endregion
|
|
188
|
+
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 };
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@devframes/json-render",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.7.5",
|
|
5
|
+
"description": "Opt-in, framework-neutral JSON-render protocol layer for devframe — spec/catalog types, base catalog, and the node runtime factory.",
|
|
6
|
+
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"homepage": "https://github.com/devframes/devframe#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"directory": "packages/json-render",
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/devframes/devframe.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": "https://github.com/devframes/devframe/issues",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"devtools",
|
|
17
|
+
"devframe",
|
|
18
|
+
"json-render"
|
|
19
|
+
],
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"exports": {
|
|
22
|
+
".": "./dist/index.mjs",
|
|
23
|
+
"./core": "./dist/core.mjs",
|
|
24
|
+
"./hub": "./dist/hub.mjs",
|
|
25
|
+
"./node": "./dist/node/index.mjs",
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"types": "./dist/index.d.mts",
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@devframes/hub": "0.7.5",
|
|
34
|
+
"devframe": "0.7.5"
|
|
35
|
+
},
|
|
36
|
+
"peerDependenciesMeta": {
|
|
37
|
+
"@devframes/hub": {
|
|
38
|
+
"optional": true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@json-render/core": "^0.19.0",
|
|
43
|
+
"nostics": "^1.2.0",
|
|
44
|
+
"zod": "^4.3.6"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "^26.1.1",
|
|
48
|
+
"tsdown": "^0.22.12",
|
|
49
|
+
"@devframes/hub": "0.7.5",
|
|
50
|
+
"devframe": "0.7.5"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsdown",
|
|
54
|
+
"watch": "tsdown --watch",
|
|
55
|
+
"typecheck": "tsc --noEmit"
|
|
56
|
+
}
|
|
57
|
+
}
|