@xmachines/play-vue 1.0.0-beta.31 → 1.0.0-beta.32
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/dist/define-registry.d.ts.map +1 -1
- package/dist/define-registry.js +1 -1
- package/dist/define-registry.js.map +1 -1
- package/dist/node_modules/@json-render/core/dist/index.js +134 -81
- package/dist/node_modules/@json-render/core/dist/index.js.map +1 -1
- package/dist/node_modules/@json-render/vue/dist/index.js +255 -218
- package/dist/node_modules/@json-render/vue/dist/index.js.map +1 -1
- package/dist/node_modules/zod/v4/core/util.js +1 -1
- package/dist/node_modules/zod/v4/core/util.js.map +1 -1
- package/dist/useActor.d.ts.map +1 -1
- package/dist/useActor.js +7 -8
- package/dist/useActor.js.map +1 -1
- package/package.json +19 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-registry.d.ts","sourceRoot":"","sources":["../src/define-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,EAAK,KAAK,SAAS,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EACN,cAAc,IAAI,kBAAkB,EAEpC,KAAK,WAAW,EAEhB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"define-registry.d.ts","sourceRoot":"","sources":["../src/define-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,EAAK,KAAK,SAAS,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EACN,cAAc,IAAI,kBAAkB,EAEpC,KAAK,WAAW,EAEhB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AA+BzE,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,MAAM,sBAAsB,CAAC,CAAC,CAAC,IACpF,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,GACjB,SAAS,CAAC;AAEb,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,OAAO,IAAI;KAC7C,CAAC,IAAI,MAAM,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;CAC7D,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,OAAO,IAAI,IAAI,CAC1D,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC3C,YAAY,CACZ,GAAG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,OAAO,EAC/C,OAAO,EAAE,CAAC,EACV,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAC/B,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAa1C"}
|
package/dist/define-registry.js
CHANGED
|
@@ -2,7 +2,7 @@ import { defineRegistry as e } from "./node_modules/@json-render/vue/dist/index.
|
|
|
2
2
|
import { h as t } from "vue";
|
|
3
3
|
//#region src/define-registry.ts
|
|
4
4
|
function n(e) {
|
|
5
|
-
return typeof e
|
|
5
|
+
return typeof e != "object" || !e ? !1 : "__vccOpts" in e ? !0 : typeof e != "function" && ("setup" in e || "render" in e);
|
|
6
6
|
}
|
|
7
7
|
function r(e) {
|
|
8
8
|
return (n) => t(e, n);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-registry.js","names":[],"sources":["../src/define-registry.ts"],"sourcesContent":["/**\n * `defineRegistry` wrapper for @xmachines/play-vue.\n *\n * Wraps `defineRegistry` from `@json-render/vue` with automatic SFC support.\n *\n * ## Vue-specific — React and Solid do not need this\n *\n * In React, `useContext()` works anywhere inside the component call tree.\n * In Solid, `useContext()` works inside reactive computations and component renders.\n * Neither has the strict \"synchronous setup() only\" constraint that Vue's `inject()`\n * imposes — so their `defineRegistry` implementations call `componentFn(ctx)` directly\n * with no wrapping needed.\n *\n * For the DOM renderer, there is no component system at all — just render functions\n * returning `HTMLElement` — so injection context is not applicable.\n *\n * Only Vue requires this adapter.\n *\n * ## Why this wrapper exists\n *\n * `@json-render/vue`'s `defineRegistry` calls each registered component as a plain\n * function: `componentFn(ctx)`. A `.vue` SFC (output of `defineComponent` or\n * `<script setup>`) is an **object**, not a function — calling it throws.\n *\n * More fundamentally, `defineRegistry` calls components inside its own render\n * function (the return value of `setup()`). Vue's `inject()` — and composables built\n * on it: `useStateBinding`, `useStateStore` — only work during synchronous `setup()`\n * execution, not inside render functions. Plain `.ts` `ComponentFn` files cannot\n * call any Vue composable for this reason.\n *\n * This wrapper auto-detects Vue SFCs in the `components` map and wraps them via\n * `h(SFC, ctx)`. The SFC renders as a child component with its own `setup()`,\n * giving full access to composables inside `<script setup>`.\n *\n * ## Usage\n *\n * Import `defineRegistry` from `@xmachines/play-vue` instead of `@json-render/vue`:\n *\n * ```ts\n * import { defineRegistry } from \"@xmachines/play-vue\";\n * // not: import { defineRegistry } from \"@json-render/vue\";\n *\n * import LoginSFC from \"./views/Login.vue\";\n * import DashboardSFC from \"./views/Dashboard.vue\";\n *\n * const { registry } = defineRegistry(catalog, {\n * components: {\n * Login: LoginSFC, // .vue SFC — auto-wrapped\n * Dashboard: DashboardSFC, // .vue SFC — auto-wrapped\n * },\n * });\n * ```\n *\n * Plain `ComponentFn` functions still work and are passed through unchanged.\n * Mixing SFCs and plain functions in the same registry is supported.\n */\n\nimport { h, type Component } from \"vue\";\nimport {\n\tdefineRegistry as defineRegistryBase,\n\ttype ComponentContext,\n\ttype ComponentFn,\n\ttype Components,\n} from \"@json-render/vue\";\nimport type { Catalog, InferCatalogComponents } from \"@json-render/core\";\n\n/**\n * Detect whether a value is a Vue component object (SFC) rather than a plain\n * `ComponentFn` function.\n *\n * Vue SFCs produced by `defineComponent` or `<script setup>` compilation are\n * plain objects (not callable). A `ComponentFn` is always a plain function.\n */\nfunction isVueSFC(value: unknown): value is Component {\n\
|
|
1
|
+
{"version":3,"file":"define-registry.js","names":[],"sources":["../src/define-registry.ts"],"sourcesContent":["/**\n * `defineRegistry` wrapper for @xmachines/play-vue.\n *\n * Wraps `defineRegistry` from `@json-render/vue` with automatic SFC support.\n *\n * ## Vue-specific — React and Solid do not need this\n *\n * In React, `useContext()` works anywhere inside the component call tree.\n * In Solid, `useContext()` works inside reactive computations and component renders.\n * Neither has the strict \"synchronous setup() only\" constraint that Vue's `inject()`\n * imposes — so their `defineRegistry` implementations call `componentFn(ctx)` directly\n * with no wrapping needed.\n *\n * For the DOM renderer, there is no component system at all — just render functions\n * returning `HTMLElement` — so injection context is not applicable.\n *\n * Only Vue requires this adapter.\n *\n * ## Why this wrapper exists\n *\n * `@json-render/vue`'s `defineRegistry` calls each registered component as a plain\n * function: `componentFn(ctx)`. A `.vue` SFC (output of `defineComponent` or\n * `<script setup>`) is an **object**, not a function — calling it throws.\n *\n * More fundamentally, `defineRegistry` calls components inside its own render\n * function (the return value of `setup()`). Vue's `inject()` — and composables built\n * on it: `useStateBinding`, `useStateStore` — only work during synchronous `setup()`\n * execution, not inside render functions. Plain `.ts` `ComponentFn` files cannot\n * call any Vue composable for this reason.\n *\n * This wrapper auto-detects Vue SFCs in the `components` map and wraps them via\n * `h(SFC, ctx)`. The SFC renders as a child component with its own `setup()`,\n * giving full access to composables inside `<script setup>`.\n *\n * ## Usage\n *\n * Import `defineRegistry` from `@xmachines/play-vue` instead of `@json-render/vue`:\n *\n * ```ts\n * import { defineRegistry } from \"@xmachines/play-vue\";\n * // not: import { defineRegistry } from \"@json-render/vue\";\n *\n * import LoginSFC from \"./views/Login.vue\";\n * import DashboardSFC from \"./views/Dashboard.vue\";\n *\n * const { registry } = defineRegistry(catalog, {\n * components: {\n * Login: LoginSFC, // .vue SFC — auto-wrapped\n * Dashboard: DashboardSFC, // .vue SFC — auto-wrapped\n * },\n * });\n * ```\n *\n * Plain `ComponentFn` functions still work and are passed through unchanged.\n * Mixing SFCs and plain functions in the same registry is supported.\n */\n\nimport { h, type Component } from \"vue\";\nimport {\n\tdefineRegistry as defineRegistryBase,\n\ttype ComponentContext,\n\ttype ComponentFn,\n\ttype Components,\n} from \"@json-render/vue\";\nimport type { Catalog, InferCatalogComponents } from \"@json-render/core\";\n\n/**\n * Detect whether a value is a Vue component object (SFC) rather than a plain\n * `ComponentFn` function.\n *\n * Vue SFCs produced by `defineComponent` or `<script setup>` compilation are\n * plain objects (not callable). A `ComponentFn` is always a plain function.\n */\nfunction isVueSFC(value: unknown): value is Component {\n\tif (typeof value !== \"object\" || value === null) return false;\n\t// __vccOpts is set by vite-plugin-vue / vue-loader on every <script setup> SFC.\n\tif (\"__vccOpts\" in value) return true;\n\t// defineComponent() output has setup or render, but plain POJOs with those\n\t// keys should not be treated as components. Require the value to not be a function\n\t// (ComponentFn is a function, Vue SFCs are objects).\n\treturn typeof value !== \"function\" && (\"setup\" in value || \"render\" in value);\n}\n\n/**\n * Wrap a Vue SFC as a `ComponentFn` by rendering it via `h()`.\n *\n * The SFC receives the full `ComponentContext` as its props and renders in its\n * own child component `setup()`, where Vue composables work correctly.\n */\nfunction wrapSFC<C extends Catalog, K extends keyof InferCatalogComponents<C>>(\n\tcomponent: Component,\n): ComponentFn<C, K> {\n\treturn (ctx: ComponentContext<C, K>) => h(component, ctx);\n}\n\nexport type ComponentEntry<C extends Catalog, K extends keyof InferCatalogComponents<C>> =\n\t| ComponentFn<C, K>\n\t| Component;\n\nexport type ComponentsMap<C extends Catalog> = {\n\t[K in keyof InferCatalogComponents<C>]?: ComponentEntry<C, K>;\n};\n\nexport type DefineRegistryOptions<C extends Catalog> = Omit<\n\tParameters<typeof defineRegistryBase<C>>[1],\n\t\"components\"\n> & {\n\tcomponents?: ComponentsMap<C>;\n};\n\n/**\n * Create a component registry, automatically wrapping `.vue` SFCs so they work\n * correctly with `@json-render/vue`'s rendering pipeline.\n *\n * Drop-in replacement for `defineRegistry` from `@json-render/vue`. Import from\n * `@xmachines/play-vue` to get SFC support for free.\n *\n * @param catalog - The json-render catalog defining component prop shapes.\n * @param options - Registry options. `components` entries may be `.vue` SFCs\n * (objects) or plain `ComponentFn` functions — both are handled automatically.\n */\nexport function defineRegistry<C extends Catalog>(\n\tcatalog: C,\n\toptions: DefineRegistryOptions<C>,\n): ReturnType<typeof defineRegistryBase<C>> {\n\tconst wrappedComponents = {} as Components<C>;\n\n\tfor (const [key, component] of Object.entries(options.components ?? {})) {\n\t\tif (component === undefined) continue;\n\t\tconst k = key as keyof InferCatalogComponents<C>;\n\t\twrappedComponents[k] = isVueSFC(component)\n\t\t\t? wrapSFC(component as Component)\n\t\t\t: (component as ComponentFn<C, typeof k>);\n\t}\n\n\tconst baseOptions = options as Parameters<typeof defineRegistryBase<C>>[1];\n\treturn defineRegistryBase(catalog, { ...baseOptions, components: wrappedComponents });\n}\n"],"mappings":";;;AAyEA,SAAS,EAAS,GAAoC;AAOrD,QANI,OAAO,KAAU,aAAY,IAAuB,KAEpD,eAAe,IAAc,KAI1B,OAAO,KAAU,eAAe,WAAW,KAAS,YAAY;;AASxE,SAAS,EACR,GACoB;AACpB,SAAQ,MAAgC,EAAE,GAAW,EAAI;;AA6B1D,SAAgB,EACf,GACA,GAC2C;CAC3C,IAAM,IAAoB,EAAE;AAE5B,MAAK,IAAM,CAAC,GAAK,MAAc,OAAO,QAAQ,EAAQ,cAAc,EAAE,CAAC,EAAE;AACxE,MAAI,MAAc,KAAA,EAAW;EAC7B,IAAM,IAAI;AACV,IAAkB,KAAK,EAAS,EAAU,GACvC,EAAQ,EAAuB,GAC9B;;AAIL,QAAO,EAAmB,GAAS;EAAE,GADjB;EACiC,YAAY;EAAmB,CAAC"}
|
|
@@ -84,102 +84,142 @@ function k(e) {
|
|
|
84
84
|
function A(e) {
|
|
85
85
|
return typeof e == "object" && !!e && "$bindItem" in e && typeof e.$bindItem == "string";
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function te(e) {
|
|
88
88
|
return typeof e == "object" && !!e && "$cond" in e && "$then" in e && "$else" in e;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function ne(e) {
|
|
91
91
|
return typeof e == "object" && !!e && "$computed" in e && typeof e.$computed == "string";
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function re(e) {
|
|
94
94
|
return typeof e == "object" && !!e && "$template" in e && typeof e.$template == "string";
|
|
95
95
|
}
|
|
96
|
-
var
|
|
97
|
-
function
|
|
96
|
+
var ie = 100, j = /* @__PURE__ */ new Set();
|
|
97
|
+
function M(e, t) {
|
|
98
98
|
if (t.repeatBasePath == null) {
|
|
99
99
|
console.warn(`$bindItem used outside repeat scope: "${e}"`);
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
return e === "" ? t.repeatBasePath : t.repeatBasePath + "/" + e;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function N(e, t) {
|
|
105
105
|
if (e == null) return e;
|
|
106
106
|
if (ee(e)) return p(t.stateModel, e.$state);
|
|
107
107
|
if (D(e)) return t.repeatItem === void 0 ? void 0 : e.$item === "" ? t.repeatItem : p(t.repeatItem, e.$item);
|
|
108
108
|
if (O(e)) return t.repeatIndex;
|
|
109
109
|
if (k(e)) return p(t.stateModel, e.$bindState);
|
|
110
110
|
if (A(e)) {
|
|
111
|
-
let n =
|
|
111
|
+
let n = M(e.$bindItem, t);
|
|
112
112
|
return n === void 0 ? void 0 : p(t.stateModel, n);
|
|
113
113
|
}
|
|
114
|
-
if (
|
|
115
|
-
if (
|
|
114
|
+
if (te(e)) return N(E(e.$cond, t) ? e.$then : e.$else, t);
|
|
115
|
+
if (ne(e)) {
|
|
116
116
|
let n = t.functions?.[e.$computed];
|
|
117
117
|
if (!n) {
|
|
118
|
-
|
|
118
|
+
j.has(e.$computed) || (j.size < ie && j.add(e.$computed), console.warn(`Unknown $computed function: "${e.$computed}"`));
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
let r = {};
|
|
122
|
-
if (e.args) for (let [n, i] of Object.entries(e.args)) r[n] =
|
|
122
|
+
if (e.args) for (let [n, i] of Object.entries(e.args)) r[n] = N(i, t);
|
|
123
123
|
return n(r);
|
|
124
124
|
}
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
if (re(e)) return e.$template.replace(/\$\{([^}]+)\}/g, (e, n) => {
|
|
126
|
+
if (n.startsWith("/")) {
|
|
127
|
+
let e = p(t.stateModel, n);
|
|
128
|
+
return e == null ? "" : String(e);
|
|
129
|
+
}
|
|
130
|
+
if (t.repeatItem !== void 0) {
|
|
131
|
+
let e = p(t.repeatItem, n);
|
|
132
|
+
if (e != null) return String(e);
|
|
133
|
+
}
|
|
134
|
+
let r = p(t.stateModel, "/" + n);
|
|
135
|
+
return r == null ? "" : String(r);
|
|
130
136
|
});
|
|
131
|
-
if (Array.isArray(e)) return e.map((e) =>
|
|
137
|
+
if (Array.isArray(e)) return e.map((e) => N(e, t));
|
|
132
138
|
if (typeof e == "object") {
|
|
133
139
|
let n = {};
|
|
134
|
-
for (let [r, i] of Object.entries(e)) n[r] =
|
|
140
|
+
for (let [r, i] of Object.entries(e)) n[r] = N(i, t);
|
|
135
141
|
return n;
|
|
136
142
|
}
|
|
137
143
|
return e;
|
|
138
144
|
}
|
|
139
|
-
function
|
|
145
|
+
function ae(e, t) {
|
|
140
146
|
let n = {};
|
|
141
|
-
for (let [r, i] of Object.entries(e)) n[r] =
|
|
147
|
+
for (let [r, i] of Object.entries(e)) n[r] = N(i, t);
|
|
142
148
|
return n;
|
|
143
149
|
}
|
|
144
|
-
function
|
|
150
|
+
function oe(e, t) {
|
|
145
151
|
let n;
|
|
146
152
|
for (let [r, i] of Object.entries(e)) if (k(i)) n ||= {}, n[r] = i.$bindState;
|
|
147
153
|
else if (A(i)) {
|
|
148
|
-
let e =
|
|
154
|
+
let e = M(i.$bindItem, t);
|
|
149
155
|
e !== void 0 && (n ||= {}, n[r] = e);
|
|
150
156
|
}
|
|
151
157
|
return n;
|
|
152
158
|
}
|
|
153
|
-
function
|
|
154
|
-
return D(e) ?
|
|
159
|
+
function se(e, t) {
|
|
160
|
+
return D(e) ? M(e.$item, t) : O(e) ? t.repeatIndex : N(e, t);
|
|
161
|
+
}
|
|
162
|
+
var P = /* @__PURE__ */ new Set();
|
|
163
|
+
function ce(e) {
|
|
164
|
+
for (let t of P) {
|
|
165
|
+
let n = t.onDispatch;
|
|
166
|
+
if (n) try {
|
|
167
|
+
n(e);
|
|
168
|
+
} catch (e) {
|
|
169
|
+
process.env.NODE_ENV !== "production" && console.error("[json-render] action observer threw in onDispatch:", e);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function le(e) {
|
|
174
|
+
for (let t of P) {
|
|
175
|
+
let n = t.onSettle;
|
|
176
|
+
if (n) try {
|
|
177
|
+
n(e);
|
|
178
|
+
} catch (e) {
|
|
179
|
+
process.env.NODE_ENV !== "production" && console.error("[json-render] action observer threw in onSettle:", e);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
var F = 0;
|
|
184
|
+
function ue() {
|
|
185
|
+
return F += 1, `${Date.now()}-${F}`;
|
|
186
|
+
}
|
|
187
|
+
var de = 0, I = /* @__PURE__ */ new Set();
|
|
188
|
+
function fe() {
|
|
189
|
+
return de > 0;
|
|
190
|
+
}
|
|
191
|
+
function L(e) {
|
|
192
|
+
return I.add(e), () => {
|
|
193
|
+
I.delete(e);
|
|
194
|
+
};
|
|
155
195
|
}
|
|
156
|
-
var
|
|
196
|
+
var R = s({
|
|
157
197
|
title: l(),
|
|
158
198
|
message: l(),
|
|
159
199
|
confirmLabel: l().optional(),
|
|
160
200
|
cancelLabel: l().optional(),
|
|
161
201
|
variant: e(["default", "danger"]).optional()
|
|
162
|
-
}),
|
|
202
|
+
}), z = u([
|
|
163
203
|
s({ navigate: l() }),
|
|
164
204
|
s({ set: c(l(), d()) }),
|
|
165
205
|
s({ action: l() })
|
|
166
|
-
]),
|
|
206
|
+
]), B = u([s({ set: c(l(), d()) }), s({ action: l() })]);
|
|
167
207
|
s({
|
|
168
208
|
action: l(),
|
|
169
209
|
params: c(l(), f).optional(),
|
|
170
|
-
confirm:
|
|
171
|
-
onSuccess:
|
|
172
|
-
onError:
|
|
210
|
+
confirm: R.optional(),
|
|
211
|
+
onSuccess: z.optional(),
|
|
212
|
+
onError: B.optional(),
|
|
173
213
|
preventDefault: r().optional()
|
|
174
214
|
});
|
|
175
|
-
function
|
|
215
|
+
function V(e, t) {
|
|
176
216
|
let n = {};
|
|
177
217
|
if (e.params) for (let [r, i] of Object.entries(e.params)) n[r] = m(i, t);
|
|
178
218
|
let r = e.confirm;
|
|
179
219
|
return r &&= {
|
|
180
220
|
...r,
|
|
181
|
-
message:
|
|
182
|
-
title:
|
|
221
|
+
message: H(r.message, t),
|
|
222
|
+
title: H(r.title, t)
|
|
183
223
|
}, {
|
|
184
224
|
action: e.action,
|
|
185
225
|
params: n,
|
|
@@ -188,13 +228,13 @@ function ue(e, t) {
|
|
|
188
228
|
onError: e.onError
|
|
189
229
|
};
|
|
190
230
|
}
|
|
191
|
-
function
|
|
231
|
+
function H(e, t) {
|
|
192
232
|
return e.replace(/\$\{([^}]+)\}/g, (e, n) => {
|
|
193
233
|
let r = m({ $state: n }, t);
|
|
194
234
|
return String(r ?? "");
|
|
195
235
|
});
|
|
196
236
|
}
|
|
197
|
-
async function
|
|
237
|
+
async function pe(e) {
|
|
198
238
|
let { action: t, handler: n, setState: r, navigate: i, executeAction: a } = e;
|
|
199
239
|
try {
|
|
200
240
|
if (await n(t.params), t.onSuccess) if ("navigate" in t.onSuccess && i) i(t.onSuccess.navigate);
|
|
@@ -219,7 +259,7 @@ s({
|
|
|
219
259
|
]).optional(),
|
|
220
260
|
enabled: v.optional()
|
|
221
261
|
});
|
|
222
|
-
var
|
|
262
|
+
var U = (e, t) => e === t?.other, me = {
|
|
223
263
|
required: (e) => e == null ? !1 : typeof e == "string" ? e.trim().length > 0 : Array.isArray(e) ? e.length > 0 : !0,
|
|
224
264
|
email: (e) => typeof e == "string" ? /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e) : !1,
|
|
225
265
|
minLength: (e, t) => {
|
|
@@ -261,8 +301,8 @@ var z = (e, t) => e === t?.other, B = {
|
|
|
261
301
|
return !1;
|
|
262
302
|
}
|
|
263
303
|
},
|
|
264
|
-
matches:
|
|
265
|
-
equalTo:
|
|
304
|
+
matches: U,
|
|
305
|
+
equalTo: U,
|
|
266
306
|
lessThan: (e, t) => {
|
|
267
307
|
let n = t?.other;
|
|
268
308
|
if (e == null || n == null || e === "" || n === "") return !1;
|
|
@@ -279,10 +319,10 @@ var z = (e, t) => e === t?.other, B = {
|
|
|
279
319
|
},
|
|
280
320
|
requiredIf: (e, t) => t?.field ? e == null ? !1 : typeof e == "string" ? e.trim().length > 0 : Array.isArray(e) ? e.length > 0 : !0 : !0
|
|
281
321
|
};
|
|
282
|
-
function
|
|
322
|
+
function he(e, t) {
|
|
283
323
|
let { value: n, stateModel: r, customFunctions: i } = t, a = {};
|
|
284
|
-
if (e.args) for (let [t, n] of Object.entries(e.args)) a[t] =
|
|
285
|
-
let o =
|
|
324
|
+
if (e.args) for (let [t, n] of Object.entries(e.args)) a[t] = N(n, { stateModel: r });
|
|
325
|
+
let o = me[e.type] ?? i?.[e.type];
|
|
286
326
|
if (!o) return console.warn(`Unknown validation function: ${e.type}`), {
|
|
287
327
|
type: e.type,
|
|
288
328
|
valid: !0,
|
|
@@ -295,7 +335,7 @@ function V(e, t) {
|
|
|
295
335
|
message: e.message
|
|
296
336
|
};
|
|
297
337
|
}
|
|
298
|
-
function
|
|
338
|
+
function ge(e, t) {
|
|
299
339
|
let n = [], r = [];
|
|
300
340
|
if (e.enabled && !E(e.enabled, { stateModel: t.stateModel })) return {
|
|
301
341
|
valid: !0,
|
|
@@ -303,7 +343,7 @@ function H(e, t) {
|
|
|
303
343
|
checks: []
|
|
304
344
|
};
|
|
305
345
|
if (e.checks) for (let i of e.checks) {
|
|
306
|
-
let e =
|
|
346
|
+
let e = he(i, t);
|
|
307
347
|
n.push(e), e.valid || r.push(e.message);
|
|
308
348
|
}
|
|
309
349
|
return {
|
|
@@ -312,11 +352,11 @@ function H(e, t) {
|
|
|
312
352
|
checks: n
|
|
313
353
|
};
|
|
314
354
|
}
|
|
315
|
-
var
|
|
316
|
-
function
|
|
317
|
-
return e?.modes?.length ? e.modes :
|
|
355
|
+
var _e = ["patch"];
|
|
356
|
+
function ve(e) {
|
|
357
|
+
return e?.modes?.length ? e.modes : _e;
|
|
318
358
|
}
|
|
319
|
-
function
|
|
359
|
+
function ye() {
|
|
320
360
|
return [
|
|
321
361
|
"PATCH MODE (RFC 6902 JSON Patch):",
|
|
322
362
|
"Output one JSON object per line. Each line is a patch operation.",
|
|
@@ -326,7 +366,7 @@ function fe() {
|
|
|
326
366
|
"Only output patches for what needs to change."
|
|
327
367
|
].join("\n");
|
|
328
368
|
}
|
|
329
|
-
function
|
|
369
|
+
function be() {
|
|
330
370
|
return [
|
|
331
371
|
"MERGE MODE (RFC 7396 JSON Merge Patch):",
|
|
332
372
|
"Output a single JSON object on one line with __json_edit set to true.",
|
|
@@ -340,7 +380,7 @@ function pe() {
|
|
|
340
380
|
"{\"__json_edit\":true,\"elements\":{\"old-widget\":null}}"
|
|
341
381
|
].join("\n");
|
|
342
382
|
}
|
|
343
|
-
function
|
|
383
|
+
function xe() {
|
|
344
384
|
return [
|
|
345
385
|
"DIFF MODE (unified diff):",
|
|
346
386
|
"Output a unified diff inside a ```diff code fence.",
|
|
@@ -356,7 +396,7 @@ function me() {
|
|
|
356
396
|
"```"
|
|
357
397
|
].join("\n");
|
|
358
398
|
}
|
|
359
|
-
function
|
|
399
|
+
function Se() {
|
|
360
400
|
return [
|
|
361
401
|
"PATCH MODE (RFC 6902 JSON Patch):",
|
|
362
402
|
"Output RFC 6902 JSON Patch lines inside a ```yaml-patch code fence.",
|
|
@@ -369,7 +409,7 @@ function he() {
|
|
|
369
409
|
"```"
|
|
370
410
|
].join("\n");
|
|
371
411
|
}
|
|
372
|
-
function
|
|
412
|
+
function Ce() {
|
|
373
413
|
return [
|
|
374
414
|
"MERGE MODE (RFC 7396 JSON Merge Patch):",
|
|
375
415
|
"Output only the changed parts in a ```yaml-edit code fence.",
|
|
@@ -395,7 +435,7 @@ function ge() {
|
|
|
395
435
|
"```"
|
|
396
436
|
].join("\n");
|
|
397
437
|
}
|
|
398
|
-
function
|
|
438
|
+
function we() {
|
|
399
439
|
return [
|
|
400
440
|
"DIFF MODE (unified diff):",
|
|
401
441
|
"Output a unified diff inside a ```diff code fence.",
|
|
@@ -411,44 +451,44 @@ function _e() {
|
|
|
411
451
|
"```"
|
|
412
452
|
].join("\n");
|
|
413
453
|
}
|
|
414
|
-
function
|
|
454
|
+
function Te(e) {
|
|
415
455
|
if (e.length === 1) return "";
|
|
416
456
|
let t = ["Choose the best edit strategy for the requested change:"];
|
|
417
457
|
return e.includes("patch") && t.push("- PATCH: best for precise, targeted single-field updates"), e.includes("merge") && t.push("- MERGE: best for structural changes (add/remove elements, reparent children, update multiple props at once)"), e.includes("diff") && t.push("- DIFF: best for small text-level changes when you can see the exact lines to change"), t.join("\n");
|
|
418
458
|
}
|
|
419
|
-
function
|
|
420
|
-
let n =
|
|
459
|
+
function Ee(e, t) {
|
|
460
|
+
let n = ve(e), r = [];
|
|
421
461
|
r.push("EDITING EXISTING SPECS:"), r.push("");
|
|
422
|
-
let i =
|
|
462
|
+
let i = Te(n);
|
|
423
463
|
i && (r.push(i), r.push(""));
|
|
424
464
|
for (let e of n) {
|
|
425
465
|
if (t === "json") switch (e) {
|
|
426
466
|
case "patch":
|
|
427
|
-
r.push(
|
|
467
|
+
r.push(ye());
|
|
428
468
|
break;
|
|
429
469
|
case "merge":
|
|
430
|
-
r.push(
|
|
470
|
+
r.push(be());
|
|
431
471
|
break;
|
|
432
472
|
case "diff":
|
|
433
|
-
r.push(
|
|
473
|
+
r.push(xe());
|
|
434
474
|
break;
|
|
435
475
|
}
|
|
436
476
|
else switch (e) {
|
|
437
477
|
case "patch":
|
|
438
|
-
r.push(
|
|
478
|
+
r.push(Se());
|
|
439
479
|
break;
|
|
440
480
|
case "merge":
|
|
441
|
-
r.push(
|
|
481
|
+
r.push(Ce());
|
|
442
482
|
break;
|
|
443
483
|
case "diff":
|
|
444
|
-
r.push(
|
|
484
|
+
r.push(we());
|
|
445
485
|
break;
|
|
446
486
|
}
|
|
447
487
|
r.push("");
|
|
448
488
|
}
|
|
449
489
|
return r.join("\n");
|
|
450
490
|
}
|
|
451
|
-
function
|
|
491
|
+
function De() {
|
|
452
492
|
return {
|
|
453
493
|
string: () => ({ kind: "string" }),
|
|
454
494
|
number: () => ({ kind: "number" }),
|
|
@@ -482,26 +522,26 @@ function be() {
|
|
|
482
522
|
optional: () => ({ optional: !0 })
|
|
483
523
|
};
|
|
484
524
|
}
|
|
485
|
-
function
|
|
525
|
+
function Oe(e, t) {
|
|
486
526
|
return {
|
|
487
|
-
definition: e(
|
|
527
|
+
definition: e(De()),
|
|
488
528
|
promptTemplate: t?.promptTemplate,
|
|
489
529
|
defaultRules: t?.defaultRules,
|
|
490
530
|
builtInActions: t?.builtInActions,
|
|
491
531
|
createCatalog(e) {
|
|
492
|
-
return
|
|
532
|
+
return ke(this, e);
|
|
493
533
|
}
|
|
494
534
|
};
|
|
495
535
|
}
|
|
496
|
-
function
|
|
497
|
-
let n = t.components, r = t.actions, i = n ? Object.keys(n) : [], a = r ? Object.keys(r) : [], o =
|
|
536
|
+
function ke(e, t) {
|
|
537
|
+
let n = t.components, r = t.actions, i = n ? Object.keys(n) : [], a = r ? Object.keys(r) : [], o = Ae(e.definition, t);
|
|
498
538
|
return {
|
|
499
539
|
schema: e,
|
|
500
540
|
data: t,
|
|
501
541
|
componentNames: i,
|
|
502
542
|
actionNames: a,
|
|
503
543
|
prompt(e = {}) {
|
|
504
|
-
return
|
|
544
|
+
return Me(this, e);
|
|
505
545
|
},
|
|
506
546
|
jsonSchema(e = {}) {
|
|
507
547
|
return $(o, e.strict ?? !1);
|
|
@@ -524,7 +564,7 @@ function Se(e, t) {
|
|
|
524
564
|
}
|
|
525
565
|
};
|
|
526
566
|
}
|
|
527
|
-
function
|
|
567
|
+
function Ae(e, t) {
|
|
528
568
|
return W(e.spec, t);
|
|
529
569
|
}
|
|
530
570
|
function W(i, u) {
|
|
@@ -547,29 +587,29 @@ function W(i, u) {
|
|
|
547
587
|
return c(l(), e);
|
|
548
588
|
}
|
|
549
589
|
case "ref": {
|
|
550
|
-
let t = i.inner, n =
|
|
590
|
+
let t = i.inner, n = je(t, u);
|
|
551
591
|
return n.length === 0 ? l() : n.length === 1 ? a(n[0]) : e(n);
|
|
552
592
|
}
|
|
553
593
|
case "propsOf": {
|
|
554
|
-
let e = i.inner, t =
|
|
594
|
+
let e = i.inner, t = G(e, u);
|
|
555
595
|
return t.length === 0 ? c(l(), d()) : t.length === 1 ? t[0] : c(l(), d());
|
|
556
596
|
}
|
|
557
597
|
default: return d();
|
|
558
598
|
}
|
|
559
599
|
}
|
|
560
|
-
function
|
|
600
|
+
function je(e, t) {
|
|
561
601
|
let n = e.split("."), r = { catalog: t };
|
|
562
602
|
for (let e of n) if (r && typeof r == "object") r = r[e];
|
|
563
603
|
else return [];
|
|
564
604
|
return r && typeof r == "object" ? Object.keys(r) : [];
|
|
565
605
|
}
|
|
566
|
-
function
|
|
606
|
+
function G(e, t) {
|
|
567
607
|
let n = e.split("."), r = { catalog: t };
|
|
568
608
|
for (let e of n) if (r && typeof r == "object") r = r[e];
|
|
569
609
|
else return [];
|
|
570
610
|
return r && typeof r == "object" ? Object.values(r).map((e) => e.props).filter((e) => e !== void 0) : [];
|
|
571
611
|
}
|
|
572
|
-
function
|
|
612
|
+
function Me(e, t) {
|
|
573
613
|
if (e.schema.promptTemplate) {
|
|
574
614
|
let n = {
|
|
575
615
|
catalog: e.data,
|
|
@@ -582,7 +622,7 @@ function G(e, t) {
|
|
|
582
622
|
}
|
|
583
623
|
let { system: n = "You are a UI generator that outputs JSON.", customRules: r = [], mode: i = "standalone" } = t, a = i === "chat" ? (console.warn("[json-render] mode \"chat\" is deprecated, use \"inline\" instead"), "inline") : i === "generate" ? (console.warn("[json-render] mode \"generate\" is deprecated, use \"standalone\" instead"), "standalone") : i, o = [];
|
|
584
624
|
o.push(n), o.push(""), a === "inline" ? (o.push("OUTPUT FORMAT (text + JSONL, RFC 6902 JSON Patch):"), o.push("You respond conversationally. When generating UI, first write a brief explanation (1-3 sentences), then output JSONL patch lines wrapped in a ```spec code fence."), o.push("The JSONL lines use RFC 6902 JSON Patch operations to build a UI tree. Always wrap them in a ```spec fence block:"), o.push(" ```spec"), o.push(" {\"op\":\"add\",\"path\":\"/root\",\"value\":\"main\"}"), o.push(" {\"op\":\"add\",\"path\":\"/elements/main\",\"value\":{\"type\":\"Card\",\"props\":{\"title\":\"Hello\"},\"children\":[]}}"), o.push(" ```"), o.push("If the user's message does not require a UI (e.g. a greeting or clarifying question), respond with text only — no JSONL.")) : (o.push("OUTPUT FORMAT (JSONL, RFC 6902 JSON Patch):"), o.push("Output JSONL (one JSON object per line) using RFC 6902 JSON Patch operations to build a UI tree.")), o.push("Each line is a JSON patch operation (add, remove, replace). Start with /root, then stream /elements and /state patches interleaved so the UI fills in progressively as it streams."), o.push(""), o.push("Example output (each line is a separate JSON object):"), o.push("");
|
|
585
|
-
let s = e.data.components, c = e.componentNames, l = c[0] || "Component", u = c.length > 1 ? c[1] : l, d = s?.[l], f = s?.[u], p = d ? K(d) : {}, m = f ? K(f) : {}, h = f?.props ?
|
|
625
|
+
let s = e.data.components, c = e.componentNames, l = c[0] || "Component", u = c.length > 1 ? c[1] : l, d = s?.[l], f = s?.[u], p = d ? K(d) : {}, m = f ? K(f) : {}, h = f?.props ? Ne(f.props) : null, g = h ? {
|
|
586
626
|
...m,
|
|
587
627
|
[h]: { $item: "title" }
|
|
588
628
|
} : m, _ = [
|
|
@@ -699,7 +739,7 @@ Note: state patches appear right after the elements that use them, so the UI fil
|
|
|
699
739
|
eq: "home"
|
|
700
740
|
},
|
|
701
741
|
children: ["..."]
|
|
702
|
-
})}`), o.push("- `{ \"$state\": \"/path\" }` - visible when state at path is truthy"), o.push("- `{ \"$state\": \"/path\", \"not\": true }` - visible when state at path is falsy"), o.push("- `{ \"$state\": \"/path\", \"eq\": \"value\" }` - visible when state equals value"), o.push("- `{ \"$state\": \"/path\", \"neq\": \"value\" }` - visible when state does not equal value"), o.push("- `{ \"$state\": \"/path\", \"gt\": N }` / `gte` / `lt` / `lte` - numeric comparisons"), o.push("- Use ONE operator per condition (eq, neq, gt, gte, lt, lte). Do not combine multiple operators."), o.push("- Any condition can add `\"not\": true` to invert its result"), o.push("- `[condition, condition]` - all conditions must be true (implicit AND)"), o.push("- `{ \"$and\": [condition, condition] }` - explicit AND (use when nesting inside $or)"), o.push("- `{ \"$or\": [condition, condition] }` - at least one must be true (OR)"), o.push("- `true` / `false` - always visible/hidden"), o.push(""), o.push("Use a component with on.press bound to setState to update state and drive visibility."), o.push(`Example: A ${l} with on: { "press": { "action": "setState", "params": { "statePath": "/activeTab", "value": "home" } } } sets state, then a container with visible: { "$state": "/activeTab", "eq": "home" } shows only when that tab is active.`), o.push(""), o.push("For tab patterns where the first/default tab should be visible when no tab is selected yet, use $or to handle both cases: visible: { \"$or\": [{ \"$state\": \"/activeTab\", \"eq\": \"home\" }, { \"$state\": \"/activeTab\", \"not\": true }] }. This ensures the first tab is visible both when explicitly selected AND when /activeTab is not yet set."), o.push(""), o.push("DYNAMIC PROPS:"), o.push("Any prop value can be a dynamic expression that resolves based on state. Three forms are supported:"), o.push(""), o.push("1. Read-only state: `{ \"$state\": \"/statePath\" }` - resolves to the value at that state path (one-way read)."), o.push(" Example: `\"color\": { \"$state\": \"/theme/primary\" }` reads the color from state."), o.push(""), o.push("2. Two-way binding: `{ \"$bindState\": \"/statePath\" }` - resolves to the value at the state path AND enables write-back. Use on form input props (value, checked, pressed, etc.)."), o.push(" Example: `\"value\": { \"$bindState\": \"/form/email\" }` binds the input value to /form/email."), o.push(" Inside repeat scopes: `\"checked\": { \"$bindItem\": \"completed\" }` binds to the current item's completed field."), o.push(""), o.push("3. Conditional: `{ \"$cond\": <condition>, \"$then\": <value>, \"$else\": <value> }` - evaluates the condition (same syntax as visibility conditions) and picks the matching value."), o.push(" Example: `\"color\": { \"$cond\": { \"$state\": \"/activeTab\", \"eq\": \"home\" }, \"$then\": \"#007AFF\", \"$else\": \"#8E8E93\" }`"), o.push(""), o.push("Use $bindState for form inputs (text fields, checkboxes, selects, sliders, etc.) and $state for read-only data display. Inside repeat scopes, use $bindItem for form inputs bound to the current item. Use dynamic props instead of duplicating elements with opposing visible conditions when only prop values differ."), o.push(""), o.push("4. Template: `{ \"$template\": \"Hello, ${/name}!\" }` - interpolates `${/path}`
|
|
742
|
+
})}`), o.push("- `{ \"$state\": \"/path\" }` - visible when state at path is truthy"), o.push("- `{ \"$state\": \"/path\", \"not\": true }` - visible when state at path is falsy"), o.push("- `{ \"$state\": \"/path\", \"eq\": \"value\" }` - visible when state equals value"), o.push("- `{ \"$state\": \"/path\", \"neq\": \"value\" }` - visible when state does not equal value"), o.push("- `{ \"$state\": \"/path\", \"gt\": N }` / `gte` / `lt` / `lte` - numeric comparisons"), o.push("- Use ONE operator per condition (eq, neq, gt, gte, lt, lte). Do not combine multiple operators."), o.push("- Any condition can add `\"not\": true` to invert its result"), o.push("- `[condition, condition]` - all conditions must be true (implicit AND)"), o.push("- `{ \"$and\": [condition, condition] }` - explicit AND (use when nesting inside $or)"), o.push("- `{ \"$or\": [condition, condition] }` - at least one must be true (OR)"), o.push("- `true` / `false` - always visible/hidden"), o.push(""), o.push("Use a component with on.press bound to setState to update state and drive visibility."), o.push(`Example: A ${l} with on: { "press": { "action": "setState", "params": { "statePath": "/activeTab", "value": "home" } } } sets state, then a container with visible: { "$state": "/activeTab", "eq": "home" } shows only when that tab is active.`), o.push(""), o.push("For tab patterns where the first/default tab should be visible when no tab is selected yet, use $or to handle both cases: visible: { \"$or\": [{ \"$state\": \"/activeTab\", \"eq\": \"home\" }, { \"$state\": \"/activeTab\", \"not\": true }] }. This ensures the first tab is visible both when explicitly selected AND when /activeTab is not yet set."), o.push(""), o.push("DYNAMIC PROPS:"), o.push("Any prop value can be a dynamic expression that resolves based on state. Three forms are supported:"), o.push(""), o.push("1. Read-only state: `{ \"$state\": \"/statePath\" }` - resolves to the value at that state path (one-way read)."), o.push(" Example: `\"color\": { \"$state\": \"/theme/primary\" }` reads the color from state."), o.push(""), o.push("2. Two-way binding: `{ \"$bindState\": \"/statePath\" }` - resolves to the value at the state path AND enables write-back. Use on form input props (value, checked, pressed, etc.)."), o.push(" Example: `\"value\": { \"$bindState\": \"/form/email\" }` binds the input value to /form/email."), o.push(" Inside repeat scopes: `\"checked\": { \"$bindItem\": \"completed\" }` binds to the current item's completed field."), o.push(""), o.push("3. Conditional: `{ \"$cond\": <condition>, \"$then\": <value>, \"$else\": <value> }` - evaluates the condition (same syntax as visibility conditions) and picks the matching value."), o.push(" Example: `\"color\": { \"$cond\": { \"$state\": \"/activeTab\", \"eq\": \"home\" }, \"$then\": \"#007AFF\", \"$else\": \"#8E8E93\" }`"), o.push(""), o.push("Use $bindState for form inputs (text fields, checkboxes, selects, sliders, etc.) and $state for read-only data display. Inside repeat scopes, use $bindItem for form inputs bound to the current item. Use dynamic props instead of duplicating elements with opposing visible conditions when only prop values differ."), o.push(""), o.push("4. Template: `{ \"$template\": \"Hello, ${/name}!\" }` - interpolates references in the string. Absolute paths like `${/path}` resolve against the state model. Bare names like `${field}` resolve against the current repeat item first, then fall back to the state model at `/<field>`."), o.push(" Example: `\"label\": { \"$template\": \"Items: ${/cart/count} | Total: ${/cart/total}\" }` renders \"Items: 3 | Total: 42.00\" when /cart/count is 3 and /cart/total is 42.00. Inside a repeat, `{ \"$template\": \"${name} - ${email}\" }` reads name and email from each item."), o.push("");
|
|
703
743
|
let C = e.data.functions;
|
|
704
744
|
if (C && Object.keys(C).length > 0) {
|
|
705
745
|
o.push("5. Computed: `{ \"$computed\": \"<functionName>\", \"args\": { \"key\": <expression> } }` - calls a registered function with resolved args and returns the result."), o.push(" Example: `\"value\": { \"$computed\": \"fullName\", \"args\": { \"first\": { \"$state\": \"/form/firstName\" }, \"last\": { \"$state\": \"/form/lastName\" } } }`"), o.push(" Available functions:");
|
|
@@ -723,7 +763,7 @@ Note: state patches appear right after the elements that use them, so the UI fil
|
|
|
723
763
|
children: []
|
|
724
764
|
})}`), o.push(""), o.push("Use `watch` for cascading dependencies where changing one field should trigger side effects (loading data, resetting dependent fields, computing derived values)."), o.push("IMPORTANT: `watch` is a top-level field on the element (sibling of type/props/children), NOT inside props. Watchers only fire when the value changes, not on initial render."), o.push(""));
|
|
725
765
|
let w = t.editModes;
|
|
726
|
-
w && w.length > 0 && o.push(
|
|
766
|
+
w && w.length > 0 && o.push(Ee({ modes: w }, "json")), o.push("RULES:");
|
|
727
767
|
let T = a === "inline" ? [
|
|
728
768
|
"When generating UI, wrap all JSONL patches in a ```spec code fence - one JSON object per line inside the fence",
|
|
729
769
|
"Write a brief conversational response before any JSONL output",
|
|
@@ -807,7 +847,7 @@ function J(e) {
|
|
|
807
847
|
default: return "...";
|
|
808
848
|
}
|
|
809
849
|
}
|
|
810
|
-
function
|
|
850
|
+
function Ne(e) {
|
|
811
851
|
if (!e || !e._def) return null;
|
|
812
852
|
let t = e._def, n = Y(e);
|
|
813
853
|
if (n !== "ZodObject" && n !== "object") return null;
|
|
@@ -835,7 +875,10 @@ function X(e) {
|
|
|
835
875
|
case "ZodBoolean":
|
|
836
876
|
case "boolean": return "boolean";
|
|
837
877
|
case "ZodLiteral":
|
|
838
|
-
case "literal":
|
|
878
|
+
case "literal": {
|
|
879
|
+
let e = t.values?.[0] ?? t.value;
|
|
880
|
+
return JSON.stringify(e);
|
|
881
|
+
}
|
|
839
882
|
case "ZodEnum":
|
|
840
883
|
case "enum": {
|
|
841
884
|
let e;
|
|
@@ -869,6 +912,16 @@ function X(e) {
|
|
|
869
912
|
let e = t.options;
|
|
870
913
|
return e ? e.map((e) => X(e)).join(" | ") : "unknown";
|
|
871
914
|
}
|
|
915
|
+
case "ZodRecord":
|
|
916
|
+
case "record": {
|
|
917
|
+
let e = t.keyType ?? void 0, n = t.valueType ?? t.element ?? void 0;
|
|
918
|
+
return `Record<${e ? X(e) : "string"}, ${n ? X(n) : "unknown"}>`;
|
|
919
|
+
}
|
|
920
|
+
case "ZodDefault":
|
|
921
|
+
case "default": {
|
|
922
|
+
let e = t.innerType ?? t.wrapped;
|
|
923
|
+
return e ? X(e) : "unknown";
|
|
924
|
+
}
|
|
872
925
|
default: return "unknown";
|
|
873
926
|
}
|
|
874
927
|
}
|
|
@@ -951,6 +1004,6 @@ function $(e, t = !1) {
|
|
|
951
1004
|
}
|
|
952
1005
|
}
|
|
953
1006
|
//#endregion
|
|
954
|
-
export {
|
|
1007
|
+
export { Oe as defineSchema, E as evaluateVisibility, pe as executeAction, fe as isDevtoolsActive, ue as nextActionDispatchId, ce as notifyActionDispatch, le as notifyActionSettle, V as resolveAction, se as resolveActionParam, oe as resolveBindings, ae as resolveElementProps, ge as runValidation, L as subscribeDevtoolsActive };
|
|
955
1008
|
|
|
956
1009
|
//# sourceMappingURL=index.js.map
|