@xmachines/play-vue 1.0.0-beta.2 → 1.0.0-beta.21
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/README.md +214 -84
- package/dist/PlayRenderer.js +7 -0
- package/dist/PlayRenderer.js.map +1 -0
- package/dist/PlayRenderer.vue_vue_type_script_lang.js +57 -0
- package/dist/PlayRenderer.vue_vue_type_script_lang.js.map +1 -0
- package/dist/define-registry.d.ts +79 -0
- package/dist/define-registry.d.ts.map +1 -0
- package/dist/define-registry.js +21 -0
- package/dist/define-registry.js.map +1 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/node_modules/@json-render/core/dist/chunk-AFLK3Q4T.js +111 -0
- package/dist/node_modules/@json-render/core/dist/chunk-AFLK3Q4T.js.map +1 -0
- package/dist/node_modules/@json-render/core/dist/index.js +956 -0
- package/dist/node_modules/@json-render/core/dist/index.js.map +1 -0
- package/dist/node_modules/@json-render/core/dist/store-utils.js +1 -0
- package/dist/node_modules/@json-render/vue/dist/chunk-WIPZLAF7.js +57 -0
- package/dist/node_modules/@json-render/vue/dist/chunk-WIPZLAF7.js.map +1 -0
- package/dist/node_modules/@json-render/vue/dist/index.js +796 -0
- package/dist/node_modules/@json-render/vue/dist/index.js.map +1 -0
- package/dist/node_modules/@json-render/xstate/dist/index.js +20 -0
- package/dist/node_modules/@json-render/xstate/dist/index.js.map +1 -0
- package/dist/node_modules/@xstate/store/dist/store-69e7e2d5.esm.js +227 -0
- package/dist/node_modules/@xstate/store/dist/store-69e7e2d5.esm.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/errors.js +25 -0
- package/dist/node_modules/zod/v4/classic/errors.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/iso.js +33 -0
- package/dist/node_modules/zod/v4/classic/iso.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/parse.js +8 -0
- package/dist/node_modules/zod/v4/classic/parse.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/schemas.js +362 -0
- package/dist/node_modules/zod/v4/classic/schemas.js.map +1 -0
- package/dist/node_modules/zod/v4/core/api.js +530 -0
- package/dist/node_modules/zod/v4/core/api.js.map +1 -0
- package/dist/node_modules/zod/v4/core/checks.js +285 -0
- package/dist/node_modules/zod/v4/core/checks.js.map +1 -0
- package/dist/node_modules/zod/v4/core/core.js +46 -0
- package/dist/node_modules/zod/v4/core/core.js.map +1 -0
- package/dist/node_modules/zod/v4/core/doc.js +25 -0
- package/dist/node_modules/zod/v4/core/doc.js.map +1 -0
- package/dist/node_modules/zod/v4/core/errors.js +43 -0
- package/dist/node_modules/zod/v4/core/errors.js.map +1 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +183 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +1 -0
- package/dist/node_modules/zod/v4/core/parse.js +70 -0
- package/dist/node_modules/zod/v4/core/parse.js.map +1 -0
- package/dist/node_modules/zod/v4/core/regexes.js +27 -0
- package/dist/node_modules/zod/v4/core/regexes.js.map +1 -0
- package/dist/node_modules/zod/v4/core/registries.js +42 -0
- package/dist/node_modules/zod/v4/core/registries.js.map +1 -0
- package/dist/node_modules/zod/v4/core/schemas.js +823 -0
- package/dist/node_modules/zod/v4/core/schemas.js.map +1 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.js +224 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.js.map +1 -0
- package/dist/node_modules/zod/v4/core/util.js +268 -0
- package/dist/node_modules/zod/v4/core/util.js.map +1 -0
- package/dist/node_modules/zod/v4/core/versions.js +10 -0
- package/dist/node_modules/zod/v4/core/versions.js.map +1 -0
- package/dist/types.d.ts +31 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/useActor.d.ts +35 -0
- package/dist/useActor.d.ts.map +1 -0
- package/dist/useActor.js +15 -0
- package/dist/useActor.js.map +1 -0
- package/package.json +31 -23
- package/dist/PlayRenderer.vue.js +0 -8
- package/dist/PlayRenderer.vue.js.map +0 -1
- package/dist/PlayRenderer.vue2.js +0 -48
- package/dist/PlayRenderer.vue2.js.map +0 -1
- package/dist/_virtual/_plugin-vue_export-helper.js +0 -10
- package/dist/_virtual/_plugin-vue_export-helper.js.map +0 -1
- package/dist/index.css +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["z.union","z.number","z.object","z.string","z.unknown","z.literal","z.lazy","z.boolean","z.array","z2.object","z2.string","z2.enum","z2.union","z2.record","z2.unknown","z2.boolean","z3.object","z3.string","z3.record","z3.array","z3.enum","z4.string","z4.number","z4.boolean","z4.any","z4.array","z4.object","z4.record","z4.literal","z4.enum","z4.unknown"],"sources":["../../../../../../../node_modules/@json-render/core/dist/index.mjs"],"sourcesContent":["import {\n DynamicBooleanSchema,\n DynamicNumberSchema,\n DynamicStringSchema,\n DynamicValueSchema,\n SPEC_DATA_PART,\n SPEC_DATA_PART_TYPE,\n addByPath,\n applySpecPatch,\n applySpecStreamPatch,\n compileSpecStream,\n createJsonRenderTransform,\n createMixedStreamParser,\n createSpecStreamCompiler,\n createStateStore,\n findFormValue,\n getByPath,\n nestedToFlat,\n parseSpecStreamLine,\n pipeJsonRender,\n removeByPath,\n resolveDynamicValue,\n setByPath\n} from \"./chunk-AFLK3Q4T.mjs\";\n\n// src/visibility.ts\nimport { z } from \"zod\";\nvar numericOrStateRef = z.union([\n z.number(),\n z.object({ $state: z.string() })\n]);\nvar comparisonOps = {\n eq: z.unknown().optional(),\n neq: z.unknown().optional(),\n gt: numericOrStateRef.optional(),\n gte: numericOrStateRef.optional(),\n lt: numericOrStateRef.optional(),\n lte: numericOrStateRef.optional(),\n not: z.literal(true).optional()\n};\nvar StateConditionSchema = z.object({\n $state: z.string(),\n ...comparisonOps\n});\nvar ItemConditionSchema = z.object({\n $item: z.string(),\n ...comparisonOps\n});\nvar IndexConditionSchema = z.object({\n $index: z.literal(true),\n ...comparisonOps\n});\nvar SingleConditionSchema = z.union([\n StateConditionSchema,\n ItemConditionSchema,\n IndexConditionSchema\n]);\nvar VisibilityConditionSchema = z.lazy(\n () => z.union([\n z.boolean(),\n SingleConditionSchema,\n z.array(SingleConditionSchema),\n z.object({ $and: z.array(VisibilityConditionSchema) }),\n z.object({ $or: z.array(VisibilityConditionSchema) })\n ])\n);\nfunction resolveComparisonValue(value, ctx) {\n if (typeof value === \"object\" && value !== null) {\n if (\"$state\" in value && typeof value.$state === \"string\") {\n return getByPath(ctx.stateModel, value.$state);\n }\n }\n return value;\n}\nfunction isItemCondition(cond) {\n return \"$item\" in cond;\n}\nfunction isIndexCondition(cond) {\n return \"$index\" in cond;\n}\nfunction resolveConditionValue(cond, ctx) {\n if (isIndexCondition(cond)) {\n return ctx.repeatIndex;\n }\n if (isItemCondition(cond)) {\n if (ctx.repeatItem === void 0) return void 0;\n return cond.$item === \"\" ? ctx.repeatItem : getByPath(ctx.repeatItem, cond.$item);\n }\n return getByPath(ctx.stateModel, cond.$state);\n}\nfunction evaluateCondition(cond, ctx) {\n const value = resolveConditionValue(cond, ctx);\n let result;\n if (cond.eq !== void 0) {\n const rhs = resolveComparisonValue(cond.eq, ctx);\n result = value === rhs;\n } else if (cond.neq !== void 0) {\n const rhs = resolveComparisonValue(cond.neq, ctx);\n result = value !== rhs;\n } else if (cond.gt !== void 0) {\n const rhs = resolveComparisonValue(cond.gt, ctx);\n result = typeof value === \"number\" && typeof rhs === \"number\" ? value > rhs : false;\n } else if (cond.gte !== void 0) {\n const rhs = resolveComparisonValue(cond.gte, ctx);\n result = typeof value === \"number\" && typeof rhs === \"number\" ? value >= rhs : false;\n } else if (cond.lt !== void 0) {\n const rhs = resolveComparisonValue(cond.lt, ctx);\n result = typeof value === \"number\" && typeof rhs === \"number\" ? value < rhs : false;\n } else if (cond.lte !== void 0) {\n const rhs = resolveComparisonValue(cond.lte, ctx);\n result = typeof value === \"number\" && typeof rhs === \"number\" ? value <= rhs : false;\n } else {\n result = Boolean(value);\n }\n return cond.not === true ? !result : result;\n}\nfunction isAndCondition(condition) {\n return typeof condition === \"object\" && condition !== null && !Array.isArray(condition) && \"$and\" in condition;\n}\nfunction isOrCondition(condition) {\n return typeof condition === \"object\" && condition !== null && !Array.isArray(condition) && \"$or\" in condition;\n}\nfunction evaluateVisibility(condition, ctx) {\n if (condition === void 0) {\n return true;\n }\n if (typeof condition === \"boolean\") {\n return condition;\n }\n if (Array.isArray(condition)) {\n return condition.every((c) => evaluateCondition(c, ctx));\n }\n if (isAndCondition(condition)) {\n return condition.$and.every((child) => evaluateVisibility(child, ctx));\n }\n if (isOrCondition(condition)) {\n return condition.$or.some((child) => evaluateVisibility(child, ctx));\n }\n return evaluateCondition(condition, ctx);\n}\nvar visibility = {\n /** Always visible */\n always: true,\n /** Never visible */\n never: false,\n /** Visible when state path is truthy */\n when: (path) => ({ $state: path }),\n /** Visible when state path is falsy */\n unless: (path) => ({ $state: path, not: true }),\n /** Equality check */\n eq: (path, value) => ({\n $state: path,\n eq: value\n }),\n /** Not equal check */\n neq: (path, value) => ({\n $state: path,\n neq: value\n }),\n /** Greater than */\n gt: (path, value) => ({\n $state: path,\n gt: value\n }),\n /** Greater than or equal */\n gte: (path, value) => ({\n $state: path,\n gte: value\n }),\n /** Less than */\n lt: (path, value) => ({\n $state: path,\n lt: value\n }),\n /** Less than or equal */\n lte: (path, value) => ({\n $state: path,\n lte: value\n }),\n /** AND multiple conditions */\n and: (...conditions) => ({\n $and: conditions\n }),\n /** OR multiple conditions */\n or: (...conditions) => ({\n $or: conditions\n })\n};\n\n// src/props.ts\nfunction isStateExpression(value) {\n return typeof value === \"object\" && value !== null && \"$state\" in value && typeof value.$state === \"string\";\n}\nfunction isItemExpression(value) {\n return typeof value === \"object\" && value !== null && \"$item\" in value && typeof value.$item === \"string\";\n}\nfunction isIndexExpression(value) {\n return typeof value === \"object\" && value !== null && \"$index\" in value && value.$index === true;\n}\nfunction isBindStateExpression(value) {\n return typeof value === \"object\" && value !== null && \"$bindState\" in value && typeof value.$bindState === \"string\";\n}\nfunction isBindItemExpression(value) {\n return typeof value === \"object\" && value !== null && \"$bindItem\" in value && typeof value.$bindItem === \"string\";\n}\nfunction isCondExpression(value) {\n return typeof value === \"object\" && value !== null && \"$cond\" in value && \"$then\" in value && \"$else\" in value;\n}\nfunction isComputedExpression(value) {\n return typeof value === \"object\" && value !== null && \"$computed\" in value && typeof value.$computed === \"string\";\n}\nfunction isTemplateExpression(value) {\n return typeof value === \"object\" && value !== null && \"$template\" in value && typeof value.$template === \"string\";\n}\nvar WARNED_COMPUTED_MAX = 100;\nvar warnedComputedFns = /* @__PURE__ */ new Set();\nvar WARNED_TEMPLATE_MAX = 100;\nvar warnedTemplatePaths = /* @__PURE__ */ new Set();\nfunction resolveBindItemPath(itemPath, ctx) {\n if (ctx.repeatBasePath == null) {\n console.warn(`$bindItem used outside repeat scope: \"${itemPath}\"`);\n return void 0;\n }\n if (itemPath === \"\") return ctx.repeatBasePath;\n return ctx.repeatBasePath + \"/\" + itemPath;\n}\nfunction resolvePropValue(value, ctx) {\n if (value === null || value === void 0) {\n return value;\n }\n if (isStateExpression(value)) {\n return getByPath(ctx.stateModel, value.$state);\n }\n if (isItemExpression(value)) {\n if (ctx.repeatItem === void 0) return void 0;\n return value.$item === \"\" ? ctx.repeatItem : getByPath(ctx.repeatItem, value.$item);\n }\n if (isIndexExpression(value)) {\n return ctx.repeatIndex;\n }\n if (isBindStateExpression(value)) {\n return getByPath(ctx.stateModel, value.$bindState);\n }\n if (isBindItemExpression(value)) {\n const resolvedPath = resolveBindItemPath(value.$bindItem, ctx);\n if (resolvedPath === void 0) return void 0;\n return getByPath(ctx.stateModel, resolvedPath);\n }\n if (isCondExpression(value)) {\n const result = evaluateVisibility(value.$cond, ctx);\n return resolvePropValue(result ? value.$then : value.$else, ctx);\n }\n if (isComputedExpression(value)) {\n const fn = ctx.functions?.[value.$computed];\n if (!fn) {\n if (!warnedComputedFns.has(value.$computed)) {\n if (warnedComputedFns.size < WARNED_COMPUTED_MAX) {\n warnedComputedFns.add(value.$computed);\n }\n console.warn(`Unknown $computed function: \"${value.$computed}\"`);\n }\n return void 0;\n }\n const resolvedArgs = {};\n if (value.args) {\n for (const [key, arg] of Object.entries(value.args)) {\n resolvedArgs[key] = resolvePropValue(arg, ctx);\n }\n }\n return fn(resolvedArgs);\n }\n if (isTemplateExpression(value)) {\n return value.$template.replace(\n /\\$\\{([^}]+)\\}/g,\n (_match, rawPath) => {\n let path = rawPath;\n if (!path.startsWith(\"/\")) {\n if (!warnedTemplatePaths.has(path)) {\n if (warnedTemplatePaths.size < WARNED_TEMPLATE_MAX) {\n warnedTemplatePaths.add(path);\n }\n console.warn(\n `$template path \"${path}\" should be a JSON Pointer starting with \"/\". Automatically resolving as \"/${path}\".`\n );\n }\n path = \"/\" + path;\n }\n const resolved = getByPath(ctx.stateModel, path);\n return resolved != null ? String(resolved) : \"\";\n }\n );\n }\n if (Array.isArray(value)) {\n return value.map((item) => resolvePropValue(item, ctx));\n }\n if (typeof value === \"object\") {\n const resolved = {};\n for (const [key, val] of Object.entries(value)) {\n resolved[key] = resolvePropValue(val, ctx);\n }\n return resolved;\n }\n return value;\n}\nfunction resolveElementProps(props, ctx) {\n const resolved = {};\n for (const [key, value] of Object.entries(props)) {\n resolved[key] = resolvePropValue(value, ctx);\n }\n return resolved;\n}\nfunction resolveBindings(props, ctx) {\n let bindings;\n for (const [key, value] of Object.entries(props)) {\n if (isBindStateExpression(value)) {\n if (!bindings) bindings = {};\n bindings[key] = value.$bindState;\n } else if (isBindItemExpression(value)) {\n const resolved = resolveBindItemPath(value.$bindItem, ctx);\n if (resolved !== void 0) {\n if (!bindings) bindings = {};\n bindings[key] = resolved;\n }\n }\n }\n return bindings;\n}\nfunction resolveActionParam(value, ctx) {\n if (isItemExpression(value)) {\n return resolveBindItemPath(value.$item, ctx);\n }\n if (isIndexExpression(value)) {\n return ctx.repeatIndex;\n }\n return resolvePropValue(value, ctx);\n}\n\n// src/actions.ts\nimport { z as z2 } from \"zod\";\nvar ActionConfirmSchema = z2.object({\n title: z2.string(),\n message: z2.string(),\n confirmLabel: z2.string().optional(),\n cancelLabel: z2.string().optional(),\n variant: z2.enum([\"default\", \"danger\"]).optional()\n});\nvar ActionOnSuccessSchema = z2.union([\n z2.object({ navigate: z2.string() }),\n z2.object({ set: z2.record(z2.string(), z2.unknown()) }),\n z2.object({ action: z2.string() })\n]);\nvar ActionOnErrorSchema = z2.union([\n z2.object({ set: z2.record(z2.string(), z2.unknown()) }),\n z2.object({ action: z2.string() })\n]);\nvar ActionBindingSchema = z2.object({\n action: z2.string(),\n params: z2.record(z2.string(), DynamicValueSchema).optional(),\n confirm: ActionConfirmSchema.optional(),\n onSuccess: ActionOnSuccessSchema.optional(),\n onError: ActionOnErrorSchema.optional(),\n preventDefault: z2.boolean().optional()\n});\nvar ActionSchema = ActionBindingSchema;\nfunction resolveAction(binding, stateModel) {\n const resolvedParams = {};\n if (binding.params) {\n for (const [key, value] of Object.entries(binding.params)) {\n resolvedParams[key] = resolveDynamicValue(value, stateModel);\n }\n }\n let confirm = binding.confirm;\n if (confirm) {\n confirm = {\n ...confirm,\n message: interpolateString(confirm.message, stateModel),\n title: interpolateString(confirm.title, stateModel)\n };\n }\n return {\n action: binding.action,\n params: resolvedParams,\n confirm,\n onSuccess: binding.onSuccess,\n onError: binding.onError\n };\n}\nfunction interpolateString(template, stateModel) {\n return template.replace(/\\$\\{([^}]+)\\}/g, (_, path) => {\n const value = resolveDynamicValue({ $state: path }, stateModel);\n return String(value ?? \"\");\n });\n}\nasync function executeAction(ctx) {\n const { action: action2, handler, setState, navigate, executeAction: executeAction2 } = ctx;\n try {\n await handler(action2.params);\n if (action2.onSuccess) {\n if (\"navigate\" in action2.onSuccess && navigate) {\n navigate(action2.onSuccess.navigate);\n } else if (\"set\" in action2.onSuccess) {\n for (const [path, value] of Object.entries(action2.onSuccess.set)) {\n setState(path, value);\n }\n } else if (\"action\" in action2.onSuccess && executeAction2) {\n await executeAction2(action2.onSuccess.action);\n }\n }\n } catch (error) {\n if (action2.onError) {\n if (\"set\" in action2.onError) {\n for (const [path, value] of Object.entries(action2.onError.set)) {\n const resolvedValue = typeof value === \"string\" && value === \"$error.message\" ? error.message : value;\n setState(path, resolvedValue);\n }\n } else if (\"action\" in action2.onError && executeAction2) {\n await executeAction2(action2.onError.action);\n }\n } else {\n throw error;\n }\n }\n}\nvar actionBinding = {\n /** Create a simple action binding */\n simple: (actionName, params) => ({\n action: actionName,\n params\n }),\n /** Create an action binding with confirmation */\n withConfirm: (actionName, confirm, params) => ({\n action: actionName,\n params,\n confirm\n }),\n /** Create an action binding with success handler */\n withSuccess: (actionName, onSuccess, params) => ({\n action: actionName,\n params,\n onSuccess\n })\n};\nvar action = actionBinding;\n\n// src/validation.ts\nimport { z as z3 } from \"zod\";\nvar ValidationCheckSchema = z3.object({\n type: z3.string(),\n args: z3.record(z3.string(), DynamicValueSchema).optional(),\n message: z3.string()\n});\nvar ValidationConfigSchema = z3.object({\n checks: z3.array(ValidationCheckSchema).optional(),\n validateOn: z3.enum([\"change\", \"blur\", \"submit\"]).optional(),\n enabled: VisibilityConditionSchema.optional()\n});\nvar matchesImpl = (value, args) => {\n const other = args?.other;\n return value === other;\n};\nvar builtInValidationFunctions = {\n /**\n * Check if value is not null, undefined, or empty string\n */\n required: (value) => {\n if (value === null || value === void 0) return false;\n if (typeof value === \"string\") return value.trim().length > 0;\n if (Array.isArray(value)) return value.length > 0;\n return true;\n },\n /**\n * Check if value is a valid email address\n */\n email: (value) => {\n if (typeof value !== \"string\") return false;\n return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value);\n },\n /**\n * Check minimum string length\n */\n minLength: (value, args) => {\n if (typeof value !== \"string\") return false;\n const min = args?.min;\n if (typeof min !== \"number\") return false;\n return value.length >= min;\n },\n /**\n * Check maximum string length\n */\n maxLength: (value, args) => {\n if (typeof value !== \"string\") return false;\n const max = args?.max;\n if (typeof max !== \"number\") return false;\n return value.length <= max;\n },\n /**\n * Check if string matches a regex pattern\n */\n pattern: (value, args) => {\n if (typeof value !== \"string\") return false;\n const pattern = args?.pattern;\n if (typeof pattern !== \"string\") return false;\n try {\n return new RegExp(pattern).test(value);\n } catch {\n return false;\n }\n },\n /**\n * Check minimum numeric value\n */\n min: (value, args) => {\n if (typeof value !== \"number\") return false;\n const min = args?.min;\n if (typeof min !== \"number\") return false;\n return value >= min;\n },\n /**\n * Check maximum numeric value\n */\n max: (value, args) => {\n if (typeof value !== \"number\") return false;\n const max = args?.max;\n if (typeof max !== \"number\") return false;\n return value <= max;\n },\n /**\n * Check if value is a number\n */\n numeric: (value) => {\n if (typeof value === \"number\") return !isNaN(value);\n if (typeof value === \"string\") return !isNaN(parseFloat(value));\n return false;\n },\n /**\n * Check if value is a valid URL\n */\n url: (value) => {\n if (typeof value !== \"string\") return false;\n try {\n new URL(value);\n return true;\n } catch {\n return false;\n }\n },\n /**\n * Check if value matches another field\n */\n matches: matchesImpl,\n /**\n * Alias for matches with a more descriptive name for cross-field equality\n */\n equalTo: matchesImpl,\n /**\n * Check if value is less than another field's value.\n * Supports numbers, strings (useful for ISO date comparison), and\n * cross-type numeric coercion (e.g. string \"3\" vs number 5).\n */\n lessThan: (value, args) => {\n const other = args?.other;\n if (value == null || other == null || value === \"\" || other === \"\")\n return false;\n if (typeof value === \"number\" && typeof other === \"number\")\n return value < other;\n if (typeof value === \"string\" && typeof other === \"string\")\n return value < other;\n const numVal = Number(value);\n const numOther = Number(other);\n if (!isNaN(numVal) && !isNaN(numOther)) return numVal < numOther;\n return false;\n },\n /**\n * Check if value is greater than another field's value.\n * Supports numbers, strings (useful for ISO date comparison), and\n * cross-type numeric coercion (e.g. string \"7\" vs number 5).\n */\n greaterThan: (value, args) => {\n const other = args?.other;\n if (value == null || other == null || value === \"\" || other === \"\")\n return false;\n if (typeof value === \"number\" && typeof other === \"number\")\n return value > other;\n if (typeof value === \"string\" && typeof other === \"string\")\n return value > other;\n const numVal = Number(value);\n const numOther = Number(other);\n if (!isNaN(numVal) && !isNaN(numOther)) return numVal > numOther;\n return false;\n },\n /**\n * Required only when a condition is met.\n * Uses JS truthiness: 0, false, \"\", null, and undefined are all\n * treated as \"condition not met\" (field not required), matching\n * the visibility system's bare-condition semantics.\n */\n requiredIf: (value, args) => {\n const condition = args?.field;\n if (!condition) return true;\n if (value === null || value === void 0) return false;\n if (typeof value === \"string\") return value.trim().length > 0;\n if (Array.isArray(value)) return value.length > 0;\n return true;\n }\n};\nfunction runValidationCheck(check2, ctx) {\n const { value, stateModel, customFunctions } = ctx;\n const resolvedArgs = {};\n if (check2.args) {\n for (const [key, argValue] of Object.entries(check2.args)) {\n resolvedArgs[key] = resolvePropValue(argValue, { stateModel });\n }\n }\n const validationFn = builtInValidationFunctions[check2.type] ?? customFunctions?.[check2.type];\n if (!validationFn) {\n console.warn(`Unknown validation function: ${check2.type}`);\n return {\n type: check2.type,\n valid: true,\n // Don't fail on unknown functions\n message: check2.message\n };\n }\n const valid = validationFn(value, resolvedArgs);\n return {\n type: check2.type,\n valid,\n message: check2.message\n };\n}\nfunction runValidation(config, ctx) {\n const checks = [];\n const errors = [];\n if (config.enabled) {\n const enabled = evaluateVisibility(config.enabled, {\n stateModel: ctx.stateModel\n });\n if (!enabled) {\n return { valid: true, errors: [], checks: [] };\n }\n }\n if (config.checks) {\n for (const check2 of config.checks) {\n const result = runValidationCheck(check2, ctx);\n checks.push(result);\n if (!result.valid) {\n errors.push(result.message);\n }\n }\n }\n return {\n valid: errors.length === 0,\n errors,\n checks\n };\n}\nvar check = {\n required: (message = \"This field is required\") => ({\n type: \"required\",\n message\n }),\n email: (message = \"Invalid email address\") => ({\n type: \"email\",\n message\n }),\n minLength: (min, message) => ({\n type: \"minLength\",\n args: { min },\n message: message ?? `Must be at least ${min} characters`\n }),\n maxLength: (max, message) => ({\n type: \"maxLength\",\n args: { max },\n message: message ?? `Must be at most ${max} characters`\n }),\n pattern: (pattern, message = \"Invalid format\") => ({\n type: \"pattern\",\n args: { pattern },\n message\n }),\n min: (min, message) => ({\n type: \"min\",\n args: { min },\n message: message ?? `Must be at least ${min}`\n }),\n max: (max, message) => ({\n type: \"max\",\n args: { max },\n message: message ?? `Must be at most ${max}`\n }),\n url: (message = \"Invalid URL\") => ({\n type: \"url\",\n message\n }),\n numeric: (message = \"Must be a number\") => ({\n type: \"numeric\",\n message\n }),\n matches: (otherPath, message = \"Fields must match\") => ({\n type: \"matches\",\n args: { other: { $state: otherPath } },\n message\n }),\n equalTo: (otherPath, message = \"Fields must match\") => ({\n type: \"equalTo\",\n args: { other: { $state: otherPath } },\n message\n }),\n lessThan: (otherPath, message) => ({\n type: \"lessThan\",\n args: { other: { $state: otherPath } },\n message: message ?? \"Must be less than the compared field\"\n }),\n greaterThan: (otherPath, message) => ({\n type: \"greaterThan\",\n args: { other: { $state: otherPath } },\n message: message ?? \"Must be greater than the compared field\"\n }),\n requiredIf: (fieldPath, message = \"This field is required\") => ({\n type: \"requiredIf\",\n args: { field: { $state: fieldPath } },\n message\n })\n};\n\n// src/spec-validator.ts\nfunction validateSpec(spec, options = {}) {\n const { checkOrphans = false } = options;\n const issues = [];\n if (!spec.root) {\n issues.push({\n severity: \"error\",\n message: \"Spec has no root element defined.\",\n code: \"missing_root\"\n });\n return { valid: false, issues };\n }\n if (!spec.elements[spec.root]) {\n issues.push({\n severity: \"error\",\n message: `Root element \"${spec.root}\" not found in elements map.`,\n code: \"root_not_found\"\n });\n }\n if (Object.keys(spec.elements).length === 0) {\n issues.push({\n severity: \"error\",\n message: \"Spec has no elements.\",\n code: \"empty_spec\"\n });\n return { valid: false, issues };\n }\n for (const [key, element] of Object.entries(spec.elements)) {\n if (element.children) {\n for (const childKey of element.children) {\n if (!spec.elements[childKey]) {\n issues.push({\n severity: \"error\",\n message: `Element \"${key}\" references child \"${childKey}\" which does not exist in the elements map.`,\n elementKey: key,\n code: \"missing_child\"\n });\n }\n }\n }\n const props = element.props;\n if (props && \"visible\" in props && props.visible !== void 0) {\n issues.push({\n severity: \"error\",\n message: `Element \"${key}\" has \"visible\" inside \"props\". It should be a top-level field on the element (sibling of type/props/children).`,\n elementKey: key,\n code: \"visible_in_props\"\n });\n }\n if (props && \"on\" in props && props.on !== void 0) {\n issues.push({\n severity: \"error\",\n message: `Element \"${key}\" has \"on\" inside \"props\". It should be a top-level field on the element (sibling of type/props/children).`,\n elementKey: key,\n code: \"on_in_props\"\n });\n }\n if (props && \"repeat\" in props && props.repeat !== void 0) {\n issues.push({\n severity: \"error\",\n message: `Element \"${key}\" has \"repeat\" inside \"props\". It should be a top-level field on the element (sibling of type/props/children).`,\n elementKey: key,\n code: \"repeat_in_props\"\n });\n }\n if (props && \"watch\" in props && props.watch !== void 0) {\n issues.push({\n severity: \"error\",\n message: `Element \"${key}\" has \"watch\" inside \"props\". It should be a top-level field on the element (sibling of type/props/children).`,\n elementKey: key,\n code: \"watch_in_props\"\n });\n }\n }\n if (checkOrphans) {\n const reachable = /* @__PURE__ */ new Set();\n const walk = (key) => {\n if (reachable.has(key)) return;\n reachable.add(key);\n const el = spec.elements[key];\n if (el?.children) {\n for (const childKey of el.children) {\n if (spec.elements[childKey]) {\n walk(childKey);\n }\n }\n }\n };\n if (spec.elements[spec.root]) {\n walk(spec.root);\n }\n for (const key of Object.keys(spec.elements)) {\n if (!reachable.has(key)) {\n issues.push({\n severity: \"warning\",\n message: `Element \"${key}\" is not reachable from root \"${spec.root}\".`,\n elementKey: key,\n code: \"orphaned_element\"\n });\n }\n }\n }\n const hasErrors = issues.some((i) => i.severity === \"error\");\n return { valid: !hasErrors, issues };\n}\nfunction autoFixSpec(spec) {\n const fixes = [];\n const fixedElements = {};\n for (const [key, element] of Object.entries(spec.elements)) {\n const props = element.props;\n let fixed = element;\n if (props && \"visible\" in props && props.visible !== void 0) {\n const { visible, ...restProps } = fixed.props;\n fixed = {\n ...fixed,\n props: restProps,\n visible\n };\n fixes.push(`Moved \"visible\" from props to element level on \"${key}\".`);\n }\n let currentProps = fixed.props;\n if (currentProps && \"on\" in currentProps && currentProps.on !== void 0) {\n const { on, ...restProps } = currentProps;\n fixed = {\n ...fixed,\n props: restProps,\n on\n };\n fixes.push(`Moved \"on\" from props to element level on \"${key}\".`);\n }\n currentProps = fixed.props;\n if (currentProps && \"repeat\" in currentProps && currentProps.repeat !== void 0) {\n const { repeat, ...restProps } = currentProps;\n fixed = {\n ...fixed,\n props: restProps,\n repeat\n };\n fixes.push(`Moved \"repeat\" from props to element level on \"${key}\".`);\n }\n currentProps = fixed.props;\n if (currentProps && \"watch\" in currentProps && currentProps.watch !== void 0) {\n const { watch, ...restProps } = currentProps;\n fixed = {\n ...fixed,\n props: restProps,\n watch\n };\n fixes.push(`Moved \"watch\" from props to element level on \"${key}\".`);\n }\n fixedElements[key] = fixed;\n }\n return {\n spec: { root: spec.root, elements: fixedElements, state: spec.state },\n fixes\n };\n}\nfunction formatSpecIssues(issues) {\n const errors = issues.filter((i) => i.severity === \"error\");\n if (errors.length === 0) return \"\";\n const lines = [\"The generated UI spec has the following errors:\"];\n for (const issue of errors) {\n lines.push(`- ${issue.message}`);\n }\n return lines.join(\"\\n\");\n}\n\n// src/schema.ts\nimport { z as z4 } from \"zod\";\n\n// src/edit-modes.ts\nvar DEFAULT_MODES = [\"patch\"];\nfunction normalizeModes(config) {\n if (!config?.modes?.length) return DEFAULT_MODES;\n return config.modes;\n}\nfunction jsonPatchInstructions() {\n return [\n \"PATCH MODE (RFC 6902 JSON Patch):\",\n \"Output one JSON object per line. Each line is a patch operation.\",\n '- Add: {\"op\":\"add\",\"path\":\"/elements/new-key\",\"value\":{...}}',\n '- Replace: {\"op\":\"replace\",\"path\":\"/elements/existing-key\",\"value\":{...}}',\n '- Remove: {\"op\":\"remove\",\"path\":\"/elements/old-key\"}',\n \"Only output patches for what needs to change.\"\n ].join(\"\\n\");\n}\nfunction jsonMergeInstructions() {\n return [\n \"MERGE MODE (RFC 7396 JSON Merge Patch):\",\n \"Output a single JSON object on one line with __json_edit set to true.\",\n \"Include only the keys that changed. Unmentioned keys are preserved.\",\n \"Set a key to null to delete it.\",\n \"\",\n \"Example (update a title and add an element):\",\n '{\"__json_edit\":true,\"elements\":{\"main\":{\"props\":{\"title\":\"New Title\"}},\"new-el\":{\"type\":\"Card\",\"props\":{},\"children\":[]}}}',\n \"\",\n \"Example (delete an element):\",\n '{\"__json_edit\":true,\"elements\":{\"old-widget\":null}}'\n ].join(\"\\n\");\n}\nfunction jsonDiffInstructions() {\n return [\n \"DIFF MODE (unified diff):\",\n \"Output a unified diff inside a ```diff code fence.\",\n \"The diff applies against the JSON-serialized current spec.\",\n \"\",\n \"Example:\",\n \"```diff\",\n \"--- a/spec.json\",\n \"+++ b/spec.json\",\n \"@@ -3,1 +3,1 @@\",\n '- \"title\": \"Login\"',\n '+ \"title\": \"Welcome Back\"',\n \"```\"\n ].join(\"\\n\");\n}\nfunction yamlPatchInstructions() {\n return [\n \"PATCH MODE (RFC 6902 JSON Patch):\",\n \"Output RFC 6902 JSON Patch lines inside a ```yaml-patch code fence.\",\n \"Each line is one JSON patch operation.\",\n \"\",\n \"Example:\",\n \"```yaml-patch\",\n '{\"op\":\"replace\",\"path\":\"/elements/main/props/title\",\"value\":\"New Title\"}',\n '{\"op\":\"add\",\"path\":\"/elements/new-el\",\"value\":{\"type\":\"Card\",\"props\":{},\"children\":[]}}',\n \"```\"\n ].join(\"\\n\");\n}\nfunction yamlMergeInstructions() {\n return [\n \"MERGE MODE (RFC 7396 JSON Merge Patch):\",\n \"Output only the changed parts in a ```yaml-edit code fence.\",\n \"Uses deep merge semantics: only keys you include are updated. Unmentioned elements and props are preserved.\",\n \"Set a key to null to delete it.\",\n \"\",\n \"Example edit (update title, add a new element):\",\n \"```yaml-edit\",\n \"elements:\",\n \" main:\",\n \" props:\",\n \" title: Updated Title\",\n \" new-chart:\",\n \" type: Card\",\n \" props: {}\",\n \" children: []\",\n \"```\",\n \"\",\n \"Example deletion:\",\n \"```yaml-edit\",\n \"elements:\",\n \" old-widget: null\",\n \"```\"\n ].join(\"\\n\");\n}\nfunction yamlDiffInstructions() {\n return [\n \"DIFF MODE (unified diff):\",\n \"Output a unified diff inside a ```diff code fence.\",\n \"The diff applies against the YAML-serialized current spec.\",\n \"\",\n \"Example:\",\n \"```diff\",\n \"--- a/spec.yaml\",\n \"+++ b/spec.yaml\",\n \"@@ -6,1 +6,1 @@\",\n \"- title: Login\",\n \"+ title: Welcome Back\",\n \"```\"\n ].join(\"\\n\");\n}\nfunction modeSelectionGuidance(modes) {\n if (modes.length === 1) return \"\";\n const parts = [\"Choose the best edit strategy for the requested change:\"];\n if (modes.includes(\"patch\")) {\n parts.push(\"- PATCH: best for precise, targeted single-field updates\");\n }\n if (modes.includes(\"merge\")) {\n parts.push(\n \"- MERGE: best for structural changes (add/remove elements, reparent children, update multiple props at once)\"\n );\n }\n if (modes.includes(\"diff\")) {\n parts.push(\n \"- DIFF: best for small text-level changes when you can see the exact lines to change\"\n );\n }\n return parts.join(\"\\n\");\n}\nfunction buildEditInstructions(config, format) {\n const modes = normalizeModes(config);\n const sections = [];\n sections.push(\"EDITING EXISTING SPECS:\");\n sections.push(\"\");\n const guidance = modeSelectionGuidance(modes);\n if (guidance) {\n sections.push(guidance);\n sections.push(\"\");\n }\n for (const mode of modes) {\n if (format === \"json\") {\n switch (mode) {\n case \"patch\":\n sections.push(jsonPatchInstructions());\n break;\n case \"merge\":\n sections.push(jsonMergeInstructions());\n break;\n case \"diff\":\n sections.push(jsonDiffInstructions());\n break;\n }\n } else {\n switch (mode) {\n case \"patch\":\n sections.push(yamlPatchInstructions());\n break;\n case \"merge\":\n sections.push(yamlMergeInstructions());\n break;\n case \"diff\":\n sections.push(yamlDiffInstructions());\n break;\n }\n }\n sections.push(\"\");\n }\n return sections.join(\"\\n\");\n}\nfunction addLineNumbers(text) {\n const lines = text.split(\"\\n\");\n const width = String(lines.length).length;\n return lines.map((line, i) => `${String(i + 1).padStart(width)}| ${line}`).join(\"\\n\");\n}\nfunction isNonEmptySpec(spec) {\n if (!spec || typeof spec !== \"object\") return false;\n const s = spec;\n return typeof s.root === \"string\" && typeof s.elements === \"object\" && s.elements !== null && Object.keys(s.elements).length > 0;\n}\nfunction buildEditUserPrompt(options) {\n const { prompt, currentSpec, config, format, maxPromptLength, serializer } = options;\n let userText = String(prompt || \"\");\n if (maxPromptLength !== void 0 && maxPromptLength > 0) {\n userText = userText.slice(0, maxPromptLength);\n }\n if (!isNonEmptySpec(currentSpec)) {\n return userText;\n }\n const modes = normalizeModes(config);\n const showLineNumbers = modes.includes(\"diff\");\n const serialize = serializer ?? ((s) => JSON.stringify(s, null, 2));\n const specText = serialize(currentSpec);\n const parts = [];\n if (showLineNumbers) {\n parts.push(\"CURRENT UI STATE (line numbers for reference):\");\n parts.push(\"```\");\n parts.push(addLineNumbers(specText));\n parts.push(\"```\");\n } else {\n parts.push(\n \"CURRENT UI STATE (already loaded, DO NOT recreate existing elements):\"\n );\n parts.push(\"```\");\n parts.push(specText);\n parts.push(\"```\");\n }\n parts.push(\"\");\n parts.push(`USER REQUEST: ${userText}`);\n parts.push(\"\");\n if (modes.length === 1) {\n const mode = modes[0];\n switch (mode) {\n case \"patch\":\n parts.push(\n format === \"yaml\" ? \"Output ONLY the patches in a ```yaml-patch fence.\" : \"Output ONLY the JSON Patch lines needed for the change.\"\n );\n break;\n case \"merge\":\n parts.push(\n format === \"yaml\" ? \"Output ONLY the changes in a ```yaml-edit fence. Include only keys that need to change.\" : \"Output ONLY a single JSON merge line with __json_edit set to true. Include only keys that need to change.\"\n );\n break;\n case \"diff\":\n parts.push(\"Output ONLY the unified diff in a ```diff fence.\");\n break;\n }\n } else {\n const modeNames = modes.map((m) => {\n switch (m) {\n case \"patch\":\n return format === \"yaml\" ? \"```yaml-patch fence\" : \"JSON Patch lines\";\n case \"merge\":\n return format === \"yaml\" ? \"```yaml-edit fence\" : \"JSON merge line (__json_edit)\";\n case \"diff\":\n return \"```diff fence\";\n }\n });\n parts.push(\n `Choose the best edit strategy and output using one of: ${modeNames.join(\", \")}`\n );\n }\n return parts.join(\"\\n\");\n}\n\n// src/schema.ts\nfunction createBuilder() {\n return {\n string: () => ({ kind: \"string\" }),\n number: () => ({ kind: \"number\" }),\n boolean: () => ({ kind: \"boolean\" }),\n array: (item) => ({ kind: \"array\", inner: item }),\n object: (shape) => ({ kind: \"object\", inner: shape }),\n record: (value) => ({ kind: \"record\", inner: value }),\n any: () => ({ kind: \"any\" }),\n zod: () => ({ kind: \"zod\" }),\n ref: (path) => ({ kind: \"ref\", inner: path }),\n propsOf: (path) => ({ kind: \"propsOf\", inner: path }),\n map: (entryShape) => ({ kind: \"map\", inner: entryShape }),\n optional: () => ({ optional: true })\n };\n}\nfunction defineSchema(builder, options) {\n const s = createBuilder();\n const definition = builder(s);\n return {\n definition,\n promptTemplate: options?.promptTemplate,\n defaultRules: options?.defaultRules,\n builtInActions: options?.builtInActions,\n createCatalog(catalog) {\n return createCatalogFromSchema(this, catalog);\n }\n };\n}\nfunction createCatalogFromSchema(schema, catalogData) {\n const components = catalogData.components;\n const actions = catalogData.actions;\n const componentNames = components ? Object.keys(components) : [];\n const actionNames = actions ? Object.keys(actions) : [];\n const zodSchema = buildZodSchemaFromDefinition(\n schema.definition,\n catalogData\n );\n return {\n schema,\n data: catalogData,\n componentNames,\n actionNames,\n prompt(options = {}) {\n return generatePrompt(this, options);\n },\n jsonSchema(options = {}) {\n return zodToJsonSchema(zodSchema, options.strict ?? false);\n },\n validate(spec) {\n const result = zodSchema.safeParse(spec);\n if (result.success) {\n return {\n success: true,\n data: result.data\n };\n }\n return { success: false, error: result.error };\n },\n zodSchema() {\n return zodSchema;\n },\n get _specType() {\n throw new Error(\"_specType is only for type inference\");\n }\n };\n}\nfunction buildZodSchemaFromDefinition(definition, catalogData) {\n return buildZodType(definition.spec, catalogData);\n}\nfunction buildZodType(schemaType, catalogData) {\n switch (schemaType.kind) {\n case \"string\":\n return z4.string();\n case \"number\":\n return z4.number();\n case \"boolean\":\n return z4.boolean();\n case \"any\":\n return z4.any();\n case \"array\": {\n const inner = buildZodType(schemaType.inner, catalogData);\n return z4.array(inner);\n }\n case \"object\": {\n const shape = schemaType.inner;\n const zodShape = {};\n for (const [key, value] of Object.entries(shape)) {\n let zodType = buildZodType(value, catalogData);\n if (value.optional) {\n zodType = zodType.optional();\n }\n zodShape[key] = zodType;\n }\n return z4.object(zodShape);\n }\n case \"record\": {\n const inner = buildZodType(schemaType.inner, catalogData);\n return z4.record(z4.string(), inner);\n }\n case \"ref\": {\n const path = schemaType.inner;\n const keys = getKeysFromPath(path, catalogData);\n if (keys.length === 0) {\n return z4.string();\n }\n if (keys.length === 1) {\n return z4.literal(keys[0]);\n }\n return z4.enum(keys);\n }\n case \"propsOf\": {\n const path = schemaType.inner;\n const propsSchemas = getPropsFromPath(path, catalogData);\n if (propsSchemas.length === 0) {\n return z4.record(z4.string(), z4.unknown());\n }\n if (propsSchemas.length === 1) {\n return propsSchemas[0];\n }\n return z4.record(z4.string(), z4.unknown());\n }\n default:\n return z4.unknown();\n }\n}\nfunction getKeysFromPath(path, catalogData) {\n const parts = path.split(\".\");\n let current = { catalog: catalogData };\n for (const part of parts) {\n if (current && typeof current === \"object\") {\n current = current[part];\n } else {\n return [];\n }\n }\n if (current && typeof current === \"object\") {\n return Object.keys(current);\n }\n return [];\n}\nfunction getPropsFromPath(path, catalogData) {\n const parts = path.split(\".\");\n let current = { catalog: catalogData };\n for (const part of parts) {\n if (current && typeof current === \"object\") {\n current = current[part];\n } else {\n return [];\n }\n }\n if (current && typeof current === \"object\") {\n return Object.values(current).map((entry) => entry.props).filter((props) => props !== void 0);\n }\n return [];\n}\nfunction generatePrompt(catalog, options) {\n if (catalog.schema.promptTemplate) {\n const context = {\n catalog: catalog.data,\n componentNames: catalog.componentNames,\n actionNames: catalog.actionNames,\n options,\n formatZodType\n };\n return catalog.schema.promptTemplate(context);\n }\n const {\n system = \"You are a UI generator that outputs JSON.\",\n customRules = [],\n mode: rawMode = \"standalone\"\n } = options;\n const mode = rawMode === \"chat\" ? (console.warn(\n '[json-render] mode \"chat\" is deprecated, use \"inline\" instead'\n ), \"inline\") : rawMode === \"generate\" ? (console.warn(\n '[json-render] mode \"generate\" is deprecated, use \"standalone\" instead'\n ), \"standalone\") : rawMode;\n const lines = [];\n lines.push(system);\n lines.push(\"\");\n if (mode === \"inline\") {\n lines.push(\"OUTPUT FORMAT (text + JSONL, RFC 6902 JSON Patch):\");\n lines.push(\n \"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.\"\n );\n lines.push(\n \"The JSONL lines use RFC 6902 JSON Patch operations to build a UI tree. Always wrap them in a ```spec fence block:\"\n );\n lines.push(\" ```spec\");\n lines.push(' {\"op\":\"add\",\"path\":\"/root\",\"value\":\"main\"}');\n lines.push(\n ' {\"op\":\"add\",\"path\":\"/elements/main\",\"value\":{\"type\":\"Card\",\"props\":{\"title\":\"Hello\"},\"children\":[]}}'\n );\n lines.push(\" ```\");\n lines.push(\n \"If the user's message does not require a UI (e.g. a greeting or clarifying question), respond with text only \\u2014 no JSONL.\"\n );\n } else {\n lines.push(\"OUTPUT FORMAT (JSONL, RFC 6902 JSON Patch):\");\n lines.push(\n \"Output JSONL (one JSON object per line) using RFC 6902 JSON Patch operations to build a UI tree.\"\n );\n }\n lines.push(\n \"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.\"\n );\n lines.push(\"\");\n lines.push(\"Example output (each line is a separate JSON object):\");\n lines.push(\"\");\n const allComponents = catalog.data.components;\n const cn = catalog.componentNames;\n const comp1 = cn[0] || \"Component\";\n const comp2 = cn.length > 1 ? cn[1] : comp1;\n const comp1Def = allComponents?.[comp1];\n const comp2Def = allComponents?.[comp2];\n const comp1Props = comp1Def ? getExampleProps(comp1Def) : {};\n const comp2Props = comp2Def ? getExampleProps(comp2Def) : {};\n const dynamicPropName = comp2Def?.props ? findFirstStringProp(comp2Def.props) : null;\n const dynamicProps = dynamicPropName ? { ...comp2Props, [dynamicPropName]: { $item: \"title\" } } : comp2Props;\n const exampleOutput = [\n JSON.stringify({ op: \"add\", path: \"/root\", value: \"main\" }),\n JSON.stringify({\n op: \"add\",\n path: \"/elements/main\",\n value: {\n type: comp1,\n props: comp1Props,\n children: [\"child-1\", \"list\"]\n }\n }),\n JSON.stringify({\n op: \"add\",\n path: \"/elements/child-1\",\n value: { type: comp2, props: comp2Props, children: [] }\n }),\n JSON.stringify({\n op: \"add\",\n path: \"/elements/list\",\n value: {\n type: comp1,\n props: comp1Props,\n repeat: { statePath: \"/items\", key: \"id\" },\n children: [\"item\"]\n }\n }),\n JSON.stringify({\n op: \"add\",\n path: \"/elements/item\",\n value: { type: comp2, props: dynamicProps, children: [] }\n }),\n JSON.stringify({ op: \"add\", path: \"/state/items\", value: [] }),\n JSON.stringify({\n op: \"add\",\n path: \"/state/items/0\",\n value: { id: \"1\", title: \"First Item\" }\n }),\n JSON.stringify({\n op: \"add\",\n path: \"/state/items/1\",\n value: { id: \"2\", title: \"Second Item\" }\n })\n ].join(\"\\n\");\n lines.push(`${exampleOutput}\n\nNote: state patches appear right after the elements that use them, so the UI fills in as it streams. ONLY use component types from the AVAILABLE COMPONENTS list below.`);\n lines.push(\"\");\n lines.push(\"INITIAL STATE:\");\n lines.push(\n \"Specs include a /state field to seed the state model. Components with { $bindState } or { $bindItem } read from and write to this state, and $state expressions read from it.\"\n );\n lines.push(\n \"CRITICAL: You MUST include state patches whenever your UI displays data via $state, $bindState, $bindItem, $item, or $index expressions, or uses repeat to iterate over arrays. Without state, these references resolve to nothing and repeat lists render zero items.\"\n );\n lines.push(\n \"Output state patches right after the elements that reference them, so the UI fills in progressively as it streams.\"\n );\n lines.push(\n \"Stream state progressively - output one patch per array item instead of one giant blob:\"\n );\n lines.push(\n ' For arrays: {\"op\":\"add\",\"path\":\"/state/posts/0\",\"value\":{\"id\":\"1\",\"title\":\"First Post\",...}} then /state/posts/1, /state/posts/2, etc.'\n );\n lines.push(\n ' For scalars: {\"op\":\"add\",\"path\":\"/state/newTodoText\",\"value\":\"\"}'\n );\n lines.push(\n ' Initialize the array first if needed: {\"op\":\"add\",\"path\":\"/state/posts\",\"value\":[]}'\n );\n lines.push(\n 'When content comes from the state model, use { \"$state\": \"/some/path\" } dynamic props to display it instead of hardcoding the same value in both state and props. The state model is the single source of truth.'\n );\n lines.push(\n \"Include realistic sample data in state. For blogs: 3-4 posts with titles, excerpts, authors, dates. For product lists: 3-5 items with names, prices, descriptions. Never leave arrays empty.\"\n );\n lines.push(\"\");\n lines.push(\"DYNAMIC LISTS (repeat field):\");\n lines.push(\n 'Any element can have a top-level \"repeat\" field to render its children once per item in a state array: { \"repeat\": { \"statePath\": \"/arrayPath\", \"key\": \"id\" } }.'\n );\n lines.push(\n 'The element itself renders once (as the container), and its children are expanded once per array item. \"statePath\" is the state array path. \"key\" is an optional field name on each item for stable React keys.'\n );\n lines.push(\n `Example: ${JSON.stringify({ type: comp1, props: comp1Props, repeat: { statePath: \"/todos\", key: \"id\" }, children: [\"todo-item\"] })}`\n );\n lines.push(\n 'Inside children of a repeated element, use { \"$item\": \"field\" } to read a field from the current item, and { \"$index\": true } to get the current array index. For two-way binding to an item field use { \"$bindItem\": \"completed\" } on the appropriate prop.'\n );\n lines.push(\n \"ALWAYS use the repeat field for lists backed by state arrays. NEVER hardcode individual elements for each array item.\"\n );\n lines.push(\n 'IMPORTANT: \"repeat\" is a top-level field on the element (sibling of type/props/children), NOT inside props.'\n );\n lines.push(\"\");\n lines.push(\"ARRAY STATE ACTIONS:\");\n lines.push(\n 'Use action \"pushState\" to append items to arrays. Params: { statePath: \"/arrayPath\", value: { ...item }, clearStatePath: \"/inputPath\" }.'\n );\n lines.push(\n 'Values inside pushState can contain { \"$state\": \"/statePath\" } references to read current state (e.g. the text from an input field).'\n );\n lines.push(\n 'Use \"$id\" inside a pushState value to auto-generate a unique ID.'\n );\n lines.push(\n 'Example: on: { \"press\": { \"action\": \"pushState\", \"params\": { \"statePath\": \"/todos\", \"value\": { \"id\": \"$id\", \"title\": { \"$state\": \"/newTodoText\" }, \"completed\": false }, \"clearStatePath\": \"/newTodoText\" } } }'\n );\n lines.push(\n `Use action \"removeState\" to remove items from arrays by index. Params: { statePath: \"/arrayPath\", index: N }. Inside a repeated element's children, use { \"$index\": true } for the current item index. Action params support the same expressions as props: { \"$item\": \"field\" } resolves to the absolute state path, { \"$index\": true } resolves to the index number, and { \"$state\": \"/path\" } reads a value from state.`\n );\n lines.push(\n \"For lists where users can add/remove items (todos, carts, etc.), use pushState and removeState instead of hardcoding with setState.\"\n );\n lines.push(\"\");\n lines.push(\n 'IMPORTANT: State paths use RFC 6901 JSON Pointer syntax (e.g. \"/todos/0/title\"). Do NOT use JavaScript-style dot notation (e.g. \"/todos.length\" is WRONG). To generate unique IDs for new items, use \"$id\" instead of trying to read array length.'\n );\n lines.push(\"\");\n const components = allComponents;\n if (components) {\n lines.push(`AVAILABLE COMPONENTS (${catalog.componentNames.length}):`);\n lines.push(\"\");\n for (const [name, def] of Object.entries(components)) {\n const propsStr = def.props ? formatZodType(def.props) : \"{}\";\n const hasChildren = def.slots && def.slots.length > 0;\n const childrenStr = hasChildren ? \" [accepts children]\" : \"\";\n const eventsStr = def.events && def.events.length > 0 ? ` [events: ${def.events.join(\", \")}]` : \"\";\n const descStr = def.description ? ` - ${def.description}` : \"\";\n lines.push(`- ${name}: ${propsStr}${descStr}${childrenStr}${eventsStr}`);\n }\n lines.push(\"\");\n }\n const actions = catalog.data.actions;\n const builtInActions = catalog.schema.builtInActions ?? [];\n const hasCustomActions = actions && catalog.actionNames.length > 0;\n const hasBuiltInActions = builtInActions.length > 0;\n if (hasCustomActions || hasBuiltInActions) {\n lines.push(\"AVAILABLE ACTIONS:\");\n lines.push(\"\");\n for (const action2 of builtInActions) {\n lines.push(`- ${action2.name}: ${action2.description} [built-in]`);\n }\n if (hasCustomActions) {\n for (const [name, def] of Object.entries(actions)) {\n lines.push(`- ${name}${def.description ? `: ${def.description}` : \"\"}`);\n }\n }\n lines.push(\"\");\n }\n lines.push(\"EVENTS (the `on` field):\");\n lines.push(\n \"Elements can have an optional `on` field to bind events to actions. The `on` field is a top-level field on the element (sibling of type/props/children), NOT inside props.\"\n );\n lines.push(\n 'Each key in `on` is an event name (from the component\\'s supported events), and the value is an action binding: `{ \"action\": \"<actionName>\", \"params\": { ... } }`.'\n );\n lines.push(\"\");\n lines.push(\"Example:\");\n lines.push(\n ` ${JSON.stringify({ type: comp1, props: comp1Props, on: { press: { action: \"setState\", params: { statePath: \"/saved\", value: true } } }, children: [] })}`\n );\n lines.push(\"\");\n lines.push(\n 'Action params can use dynamic references to read from state: { \"$state\": \"/statePath\" }.'\n );\n lines.push(\n \"IMPORTANT: Do NOT put action/actionParams inside props. Always use the `on` field for event bindings.\"\n );\n lines.push(\"\");\n lines.push(\"VISIBILITY CONDITIONS:\");\n lines.push(\n \"Elements can have an optional `visible` field to conditionally show/hide based on state. IMPORTANT: `visible` is a top-level field on the element object (sibling of type/props/children), NOT inside props.\"\n );\n lines.push(\n `Correct: ${JSON.stringify({ type: comp1, props: comp1Props, visible: { $state: \"/activeTab\", eq: \"home\" }, children: [\"...\"] })}`\n );\n lines.push(\n '- `{ \"$state\": \"/path\" }` - visible when state at path is truthy'\n );\n lines.push(\n '- `{ \"$state\": \"/path\", \"not\": true }` - visible when state at path is falsy'\n );\n lines.push(\n '- `{ \"$state\": \"/path\", \"eq\": \"value\" }` - visible when state equals value'\n );\n lines.push(\n '- `{ \"$state\": \"/path\", \"neq\": \"value\" }` - visible when state does not equal value'\n );\n lines.push(\n '- `{ \"$state\": \"/path\", \"gt\": N }` / `gte` / `lt` / `lte` - numeric comparisons'\n );\n lines.push(\n \"- Use ONE operator per condition (eq, neq, gt, gte, lt, lte). Do not combine multiple operators.\"\n );\n lines.push('- Any condition can add `\"not\": true` to invert its result');\n lines.push(\n \"- `[condition, condition]` - all conditions must be true (implicit AND)\"\n );\n lines.push(\n '- `{ \"$and\": [condition, condition] }` - explicit AND (use when nesting inside $or)'\n );\n lines.push(\n '- `{ \"$or\": [condition, condition] }` - at least one must be true (OR)'\n );\n lines.push(\"- `true` / `false` - always visible/hidden\");\n lines.push(\"\");\n lines.push(\n \"Use a component with on.press bound to setState to update state and drive visibility.\"\n );\n lines.push(\n `Example: A ${comp1} 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.`\n );\n lines.push(\"\");\n lines.push(\n '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.'\n );\n lines.push(\"\");\n lines.push(\"DYNAMIC PROPS:\");\n lines.push(\n \"Any prop value can be a dynamic expression that resolves based on state. Three forms are supported:\"\n );\n lines.push(\"\");\n lines.push(\n '1. Read-only state: `{ \"$state\": \"/statePath\" }` - resolves to the value at that state path (one-way read).'\n );\n lines.push(\n ' Example: `\"color\": { \"$state\": \"/theme/primary\" }` reads the color from state.'\n );\n lines.push(\"\");\n lines.push(\n '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.).'\n );\n lines.push(\n ' Example: `\"value\": { \"$bindState\": \"/form/email\" }` binds the input value to /form/email.'\n );\n lines.push(\n ' Inside repeat scopes: `\"checked\": { \"$bindItem\": \"completed\" }` binds to the current item\\'s completed field.'\n );\n lines.push(\"\");\n lines.push(\n '3. Conditional: `{ \"$cond\": <condition>, \"$then\": <value>, \"$else\": <value> }` - evaluates the condition (same syntax as visibility conditions) and picks the matching value.'\n );\n lines.push(\n ' Example: `\"color\": { \"$cond\": { \"$state\": \"/activeTab\", \"eq\": \"home\" }, \"$then\": \"#007AFF\", \"$else\": \"#8E8E93\" }`'\n );\n lines.push(\"\");\n lines.push(\n \"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.\"\n );\n lines.push(\"\");\n lines.push(\n '4. Template: `{ \"$template\": \"Hello, ${/name}!\" }` - interpolates `${/path}` references in the string with values from the state model.'\n );\n lines.push(\n ' 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.'\n );\n lines.push(\"\");\n const catalogFunctions = catalog.data.functions;\n if (catalogFunctions && Object.keys(catalogFunctions).length > 0) {\n lines.push(\n '5. Computed: `{ \"$computed\": \"<functionName>\", \"args\": { \"key\": <expression> } }` - calls a registered function with resolved args and returns the result.'\n );\n lines.push(\n ' Example: `\"value\": { \"$computed\": \"fullName\", \"args\": { \"first\": { \"$state\": \"/form/firstName\" }, \"last\": { \"$state\": \"/form/lastName\" } } }`'\n );\n lines.push(\" Available functions:\");\n for (const name of Object.keys(\n catalogFunctions\n )) {\n lines.push(` - ${name}`);\n }\n lines.push(\"\");\n }\n const hasChecksComponents = allComponents ? Object.entries(allComponents).some(([, def]) => {\n if (!def.props) return false;\n const formatted = formatZodType(def.props);\n return formatted.includes(\"checks\");\n }) : false;\n if (hasChecksComponents) {\n lines.push(\"VALIDATION:\");\n lines.push(\n \"Form components that accept a `checks` prop support client-side validation.\"\n );\n lines.push(\n 'Each check is an object: { \"type\": \"<name>\", \"message\": \"...\", \"args\": { ... } }'\n );\n lines.push(\"\");\n lines.push(\"Built-in validation types:\");\n lines.push(\" - required \\u2014 value must be non-empty\");\n lines.push(\" - email \\u2014 valid email format\");\n lines.push(' - minLength \\u2014 minimum string length (args: { \"min\": N })');\n lines.push(' - maxLength \\u2014 maximum string length (args: { \"max\": N })');\n lines.push(' - pattern \\u2014 match a regex (args: { \"pattern\": \"regex\" })');\n lines.push(' - min \\u2014 minimum numeric value (args: { \"min\": N })');\n lines.push(' - max \\u2014 maximum numeric value (args: { \"max\": N })');\n lines.push(\" - numeric \\u2014 value must be a number\");\n lines.push(\" - url \\u2014 valid URL format\");\n lines.push(\n ' - matches \\u2014 must equal another field (args: { \"other\": { \"$state\": \"/path\" } })'\n );\n lines.push(\n ' - equalTo \\u2014 alias for matches (args: { \"other\": { \"$state\": \"/path\" } })'\n );\n lines.push(\n ' - lessThan \\u2014 value must be less than another field (args: { \"other\": { \"$state\": \"/path\" } })'\n );\n lines.push(\n ' - greaterThan \\u2014 value must be greater than another field (args: { \"other\": { \"$state\": \"/path\" } })'\n );\n lines.push(\n ' - requiredIf \\u2014 required only when another field is truthy (args: { \"field\": { \"$state\": \"/path\" } })'\n );\n lines.push(\"\");\n lines.push(\"Example:\");\n lines.push(\n ' \"checks\": [{ \"type\": \"required\", \"message\": \"Email is required\" }, { \"type\": \"email\", \"message\": \"Invalid email\" }]'\n );\n lines.push(\"\");\n lines.push(\n \"IMPORTANT: When using checks, the component must also have a { $bindState } or { $bindItem } on its value/checked prop for two-way binding.\"\n );\n lines.push(\n \"Always include validation checks on form inputs for a good user experience (e.g. required, email, minLength).\"\n );\n lines.push(\"\");\n }\n if (hasCustomActions || hasBuiltInActions) {\n lines.push(\"STATE WATCHERS:\");\n lines.push(\n \"Elements can have an optional `watch` field to react to state changes and trigger actions. The `watch` field is a top-level field on the element (sibling of type/props/children), NOT inside props.\"\n );\n lines.push(\n \"Maps state paths (JSON Pointers) to action bindings. When the value at a watched path changes, the bound actions fire automatically.\"\n );\n lines.push(\"\");\n lines.push(\n \"Example (cascading select \\u2014 country changes trigger city loading):\"\n );\n lines.push(\n ` ${JSON.stringify({ type: \"Select\", props: { value: { $bindState: \"/form/country\" }, options: [\"US\", \"Canada\", \"UK\"] }, watch: { \"/form/country\": { action: \"loadCities\", params: { country: { $state: \"/form/country\" } } } }, children: [] })}`\n );\n lines.push(\"\");\n lines.push(\n \"Use `watch` for cascading dependencies where changing one field should trigger side effects (loading data, resetting dependent fields, computing derived values).\"\n );\n lines.push(\n \"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.\"\n );\n lines.push(\"\");\n }\n const editModes = options.editModes;\n if (editModes && editModes.length > 0) {\n lines.push(buildEditInstructions({ modes: editModes }, \"json\"));\n }\n lines.push(\"RULES:\");\n const baseRules = mode === \"inline\" ? [\n \"When generating UI, wrap all JSONL patches in a ```spec code fence - one JSON object per line inside the fence\",\n \"Write a brief conversational response before any JSONL output\",\n 'First set root: {\"op\":\"add\",\"path\":\"/root\",\"value\":\"<root-key>\"}',\n 'Then add each element: {\"op\":\"add\",\"path\":\"/elements/<key>\",\"value\":{...}}',\n \"Output /state patches right after the elements that use them, one per array item for progressive loading. REQUIRED whenever using $state, $bindState, $bindItem, $item, $index, or repeat.\",\n \"ONLY use components listed above\",\n \"Each element value needs: type, props, children (array of child keys)\",\n \"Use unique keys for the element map entries (e.g., 'header', 'metric-1', 'chart-revenue')\"\n ] : [\n \"Output ONLY JSONL patches - one JSON object per line, no markdown, no code fences\",\n 'First set root: {\"op\":\"add\",\"path\":\"/root\",\"value\":\"<root-key>\"}',\n 'Then add each element: {\"op\":\"add\",\"path\":\"/elements/<key>\",\"value\":{...}}',\n \"Output /state patches right after the elements that use them, one per array item for progressive loading. REQUIRED whenever using $state, $bindState, $bindItem, $item, $index, or repeat.\",\n \"ONLY use components listed above\",\n \"Each element value needs: type, props, children (array of child keys)\",\n \"Use unique keys for the element map entries (e.g., 'header', 'metric-1', 'chart-revenue')\"\n ];\n const schemaRules = catalog.schema.defaultRules ?? [];\n const allRules = [...baseRules, ...schemaRules, ...customRules];\n allRules.forEach((rule, i) => {\n lines.push(`${i + 1}. ${rule}`);\n });\n return lines.join(\"\\n\");\n}\nfunction getExampleProps(def) {\n if (def.example && Object.keys(def.example).length > 0) {\n return def.example;\n }\n if (def.props) {\n return generateExamplePropsFromZod(def.props);\n }\n return {};\n}\nfunction generateExamplePropsFromZod(schema) {\n if (!schema || !schema._def) return {};\n const def = schema._def;\n const typeName = getZodTypeName(schema);\n if (typeName !== \"ZodObject\" && typeName !== \"object\") return {};\n const shape = typeof def.shape === \"function\" ? def.shape() : def.shape;\n if (!shape) return {};\n const result = {};\n for (const [key, value] of Object.entries(shape)) {\n const innerTypeName = getZodTypeName(value);\n if (innerTypeName === \"ZodOptional\" || innerTypeName === \"optional\" || innerTypeName === \"ZodNullable\" || innerTypeName === \"nullable\") {\n continue;\n }\n result[key] = generateExampleValue(value);\n }\n return result;\n}\nfunction generateExampleValue(schema) {\n if (!schema || !schema._def) return \"...\";\n const def = schema._def;\n const typeName = getZodTypeName(schema);\n switch (typeName) {\n case \"ZodString\":\n case \"string\":\n return \"example\";\n case \"ZodNumber\":\n case \"number\":\n return 0;\n case \"ZodBoolean\":\n case \"boolean\":\n return true;\n case \"ZodLiteral\":\n case \"literal\":\n return def.value;\n case \"ZodEnum\":\n case \"enum\": {\n if (Array.isArray(def.values) && def.values.length > 0)\n return def.values[0];\n if (def.entries && typeof def.entries === \"object\") {\n const values = Object.values(def.entries);\n return values.length > 0 ? values[0] : \"example\";\n }\n return \"example\";\n }\n case \"ZodOptional\":\n case \"optional\":\n case \"ZodNullable\":\n case \"nullable\":\n case \"ZodDefault\":\n case \"default\": {\n const inner = def.innerType ?? def.wrapped;\n return inner ? generateExampleValue(inner) : null;\n }\n case \"ZodArray\":\n case \"array\":\n return [];\n case \"ZodObject\":\n case \"object\":\n return generateExamplePropsFromZod(schema);\n case \"ZodUnion\":\n case \"union\": {\n const options = def.options;\n return options && options.length > 0 ? generateExampleValue(options[0]) : \"...\";\n }\n default:\n return \"...\";\n }\n}\nfunction findFirstStringProp(schema) {\n if (!schema || !schema._def) return null;\n const def = schema._def;\n const typeName = getZodTypeName(schema);\n if (typeName !== \"ZodObject\" && typeName !== \"object\") return null;\n const shape = typeof def.shape === \"function\" ? def.shape() : def.shape;\n if (!shape) return null;\n for (const [key, value] of Object.entries(shape)) {\n const innerTypeName = getZodTypeName(value);\n if (innerTypeName === \"ZodOptional\" || innerTypeName === \"optional\" || innerTypeName === \"ZodNullable\" || innerTypeName === \"nullable\") {\n continue;\n }\n if (innerTypeName === \"ZodString\" || innerTypeName === \"string\") {\n return key;\n }\n }\n return null;\n}\nfunction getZodTypeName(schema) {\n if (!schema || !schema._def) return \"\";\n const def = schema._def;\n return def.typeName ?? def.type ?? \"\";\n}\nfunction formatZodType(schema) {\n if (!schema || !schema._def) return \"unknown\";\n const def = schema._def;\n const typeName = getZodTypeName(schema);\n switch (typeName) {\n case \"ZodString\":\n case \"string\":\n return \"string\";\n case \"ZodNumber\":\n case \"number\":\n return \"number\";\n case \"ZodBoolean\":\n case \"boolean\":\n return \"boolean\";\n case \"ZodLiteral\":\n case \"literal\":\n return JSON.stringify(def.value);\n case \"ZodEnum\":\n case \"enum\": {\n let values;\n if (Array.isArray(def.values)) {\n values = def.values;\n } else if (def.entries && typeof def.entries === \"object\") {\n values = Object.values(def.entries);\n } else {\n return \"enum\";\n }\n return values.map((v) => `\"${v}\"`).join(\" | \");\n }\n case \"ZodArray\":\n case \"array\": {\n const inner = typeof def.element === \"object\" ? def.element : typeof def.type === \"object\" ? def.type : void 0;\n return inner ? `Array<${formatZodType(inner)}>` : \"Array<unknown>\";\n }\n case \"ZodObject\":\n case \"object\": {\n const shape = typeof def.shape === \"function\" ? def.shape() : def.shape;\n if (!shape) return \"object\";\n const props = Object.entries(shape).map(([key, value]) => {\n const innerTypeName = getZodTypeName(value);\n const isOptional = innerTypeName === \"ZodOptional\" || innerTypeName === \"ZodNullable\" || innerTypeName === \"optional\" || innerTypeName === \"nullable\";\n return `${key}${isOptional ? \"?\" : \"\"}: ${formatZodType(value)}`;\n }).join(\", \");\n return `{ ${props} }`;\n }\n case \"ZodOptional\":\n case \"optional\":\n case \"ZodNullable\":\n case \"nullable\": {\n const inner = def.innerType ?? def.wrapped;\n return inner ? formatZodType(inner) : \"unknown\";\n }\n case \"ZodUnion\":\n case \"union\": {\n const options = def.options;\n return options ? options.map((opt) => formatZodType(opt)).join(\" | \") : \"unknown\";\n }\n default:\n return \"unknown\";\n }\n}\nfunction zodTypeName(def) {\n if (typeof def.type === \"string\") return def.type;\n if (typeof def.typeName === \"string\") return def.typeName;\n return \"\";\n}\nfunction normalizeTypeName(raw) {\n if (raw.startsWith(\"Zod\")) {\n return raw.slice(3).toLowerCase();\n }\n return raw.toLowerCase();\n}\nfunction zodToJsonSchema(schema, strict = false) {\n const def = schema._def;\n const kind = normalizeTypeName(zodTypeName(def));\n switch (kind) {\n case \"string\":\n return { type: \"string\" };\n case \"number\":\n return { type: \"number\" };\n case \"boolean\":\n return { type: \"boolean\" };\n case \"literal\": {\n const values = def.values;\n const value = values ? values[0] : def.value;\n return { const: value };\n }\n case \"enum\": {\n const entries = def.entries;\n const values = entries ? Object.values(entries) : def.values;\n return { enum: values ?? [] };\n }\n case \"array\": {\n const inner = def.element ?? def.type;\n return {\n type: \"array\",\n items: inner ? zodToJsonSchema(inner, strict) : {}\n };\n }\n case \"object\": {\n const rawShape = def.shape;\n const shape = typeof rawShape === \"function\" ? rawShape() : rawShape;\n if (!shape) {\n if (strict) {\n return {\n type: \"object\",\n properties: {},\n required: [],\n additionalProperties: false\n };\n }\n return { type: \"object\" };\n }\n const properties = {};\n const required = [];\n for (const [key, value] of Object.entries(shape)) {\n const innerDef = value._def;\n const innerKind = normalizeTypeName(zodTypeName(innerDef));\n const isOptional = innerKind === \"optional\" || innerKind === \"nullable\";\n if (strict) {\n required.push(key);\n if (isOptional) {\n const unwrapped = zodToJsonSchema(value, strict);\n properties[key] = { anyOf: [unwrapped, { type: \"null\" }] };\n } else {\n properties[key] = zodToJsonSchema(value, strict);\n }\n } else {\n properties[key] = zodToJsonSchema(value);\n if (!isOptional) {\n required.push(key);\n }\n }\n }\n return {\n type: \"object\",\n properties,\n required: required.length > 0 ? required : void 0,\n additionalProperties: false\n };\n }\n case \"record\": {\n const valueType = def.valueType;\n if (strict) {\n return {\n type: \"object\",\n properties: {},\n required: [],\n additionalProperties: false\n };\n }\n return {\n type: \"object\",\n additionalProperties: valueType ? zodToJsonSchema(valueType) : true\n };\n }\n case \"optional\":\n case \"nullable\": {\n const inner = def.innerType;\n return inner ? zodToJsonSchema(inner, strict) : {};\n }\n case \"union\": {\n const options = def.options;\n return options ? { anyOf: options.map((o) => zodToJsonSchema(o, strict)) } : {};\n }\n case \"any\":\n case \"unknown\":\n if (strict) {\n return {\n type: \"object\",\n properties: {},\n required: [],\n additionalProperties: false\n };\n }\n return {};\n default:\n return {};\n }\n}\nfunction defineCatalog(schema, catalog) {\n return schema.createCatalog(catalog);\n}\n\n// src/prompt.ts\nfunction buildUserPrompt(options) {\n const {\n prompt,\n currentSpec,\n state,\n maxPromptLength,\n editModes,\n format,\n serializer\n } = options;\n let userText = String(prompt || \"\");\n if (maxPromptLength !== void 0 && maxPromptLength > 0) {\n userText = userText.slice(0, maxPromptLength);\n }\n if (isNonEmptySpec(currentSpec)) {\n const editPrompt = buildEditUserPrompt({\n prompt: userText,\n currentSpec,\n config: { modes: editModes ?? [\"patch\"] },\n format: format ?? \"json\",\n serializer\n });\n if (state && Object.keys(state).length > 0) {\n return `${editPrompt}\n\nAVAILABLE STATE:\n${JSON.stringify(state, null, 2)}`;\n }\n return editPrompt;\n }\n const parts = [userText];\n if (state && Object.keys(state).length > 0) {\n parts.push(`\nAVAILABLE STATE:\n${JSON.stringify(state, null, 2)}`);\n }\n if (format === \"yaml\") {\n parts.push(\n `\nOutput the full spec in a \\`\\`\\`yaml-spec fence. Stream progressively \\u2014 output elements one at a time.`\n );\n } else {\n parts.push(\n `\nRemember: Output /root first, then interleave /elements and /state patches so the UI fills in progressively as it streams. Output each state patch right after the elements that use it, one per array item.`\n );\n }\n return parts.join(\"\\n\");\n}\n\n// src/merge.ts\nfunction isPlainObject(value) {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction deepMergeSpec(base, patch) {\n const result = { ...base };\n for (const key of Object.keys(patch)) {\n const patchVal = patch[key];\n if (patchVal === null) {\n delete result[key];\n continue;\n }\n const baseVal = result[key];\n if (isPlainObject(patchVal) && isPlainObject(baseVal)) {\n result[key] = deepMergeSpec(baseVal, patchVal);\n } else {\n result[key] = patchVal;\n }\n }\n return result;\n}\n\n// src/diff.ts\nfunction escapeToken(token) {\n return token.replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\n}\nfunction buildPath(basePath, key) {\n return `${basePath}/${escapeToken(key)}`;\n}\nfunction isPlainObject2(value) {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction arraysEqual(a, b) {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\nfunction diffToPatches(oldObj, newObj, basePath = \"\") {\n const patches = [];\n for (const key of Object.keys(newObj)) {\n const path = buildPath(basePath, key);\n const oldVal = oldObj[key];\n const newVal = newObj[key];\n if (!(key in oldObj)) {\n patches.push({ op: \"add\", path, value: newVal });\n continue;\n }\n if (isPlainObject2(oldVal) && isPlainObject2(newVal)) {\n patches.push(...diffToPatches(oldVal, newVal, path));\n } else if (Array.isArray(oldVal) && Array.isArray(newVal)) {\n if (!arraysEqual(oldVal, newVal)) {\n patches.push({ op: \"replace\", path, value: newVal });\n }\n } else if (oldVal !== newVal) {\n patches.push({ op: \"replace\", path, value: newVal });\n }\n }\n for (const key of Object.keys(oldObj)) {\n if (!(key in newObj)) {\n patches.push({ op: \"remove\", path: buildPath(basePath, key) });\n }\n }\n return patches;\n}\nexport {\n ActionBindingSchema,\n ActionConfirmSchema,\n ActionOnErrorSchema,\n ActionOnSuccessSchema,\n ActionSchema,\n DynamicBooleanSchema,\n DynamicNumberSchema,\n DynamicStringSchema,\n DynamicValueSchema,\n SPEC_DATA_PART,\n SPEC_DATA_PART_TYPE,\n ValidationCheckSchema,\n ValidationConfigSchema,\n VisibilityConditionSchema,\n action,\n actionBinding,\n addByPath,\n applySpecPatch,\n applySpecStreamPatch,\n autoFixSpec,\n buildEditInstructions,\n buildEditUserPrompt,\n buildUserPrompt,\n builtInValidationFunctions,\n check,\n compileSpecStream,\n createJsonRenderTransform,\n createMixedStreamParser,\n createSpecStreamCompiler,\n createStateStore,\n deepMergeSpec,\n defineCatalog,\n defineSchema,\n diffToPatches,\n evaluateVisibility,\n executeAction,\n findFormValue,\n formatSpecIssues,\n getByPath,\n interpolateString,\n isNonEmptySpec,\n nestedToFlat,\n parseSpecStreamLine,\n pipeJsonRender,\n removeByPath,\n resolveAction,\n resolveActionParam,\n resolveBindings,\n resolveDynamicValue,\n resolveElementProps,\n resolvePropValue,\n runValidation,\n runValidationCheck,\n setByPath,\n validateSpec,\n visibility\n};\n//# sourceMappingURL=index.mjs.map"],"x_google_ignoreList":[0],"mappings":";;;AA2BA,IAAI,IAAoBA,EAAQ,CAC9BC,GAAU,EACVC,EAAS,EAAE,QAAQC,GAAU,EAAE,CAAC,CACjC,CAAC,EACE,IAAgB;CAClB,IAAIC,GAAW,CAAC,UAAU;CAC1B,KAAKA,GAAW,CAAC,UAAU;CAC3B,IAAI,EAAkB,UAAU;CAChC,KAAK,EAAkB,UAAU;CACjC,IAAI,EAAkB,UAAU;CAChC,KAAK,EAAkB,UAAU;CACjC,KAAKC,EAAU,GAAK,CAAC,UAAU;CAChC,EAaG,IAAwBL,EAAQ;CAZTE,EAAS;EAClC,QAAQC,GAAU;EAClB,GAAG;EACJ,CAAC;CACwBD,EAAS;EACjC,OAAOC,GAAU;EACjB,GAAG;EACJ,CAAC;CACyBD,EAAS;EAClC,QAAQG,EAAU,GAAK;EACvB,GAAG;EACJ,CAAC;CAKD,CAAC,EACE,IAA4BC,QACxBN,EAAQ;CACZO,GAAW;CACX;CACAC,EAAQ,EAAsB;CAC9BN,EAAS,EAAE,MAAMM,EAAQ,EAA0B,EAAE,CAAC;CACtDN,EAAS,EAAE,KAAKM,EAAQ,EAA0B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AkB,EAAY,EAAS,CAAC,EACpD,IAAa,MAAc,cAAc,MAAc;AAC7D,IAAI,KACF,EAAS,KAAK,EAAI,EACd,IAEF,EAAW,KAAO,EAAE,OAAO,CADT,EAAgB,GAAO,EAAO,EACT,EAAE,MAAM,QAAQ,CAAC,EAAE,GAE1D,EAAW,KAAO,EAAgB,GAAO,EAAO,KAGlD,EAAW,KAAO,EAAgB,EAAM,EACnC,KACH,EAAS,KAAK,EAAI;;AAIxB,UAAO;IACL,MAAM;IACN;IACA,UAAU,EAAS,SAAS,IAAI,IAAW,KAAK;IAChD,sBAAsB;IACvB;;EAEH,KAAK,UAAU;GACb,IAAM,IAAY,EAAI;AAStB,UARI,IACK;IACL,MAAM;IACN,YAAY,EAAE;IACd,UAAU,EAAE;IACZ,sBAAsB;IACvB,GAEI;IACL,MAAM;IACN,sBAAsB,IAAY,EAAgB,EAAU,GAAG;IAChE;;EAEH,KAAK;EACL,KAAK,YAAY;GACf,IAAM,IAAQ,EAAI;AAClB,UAAO,IAAQ,EAAgB,GAAO,EAAO,GAAG,EAAE;;EAEpD,KAAK,SAAS;GACZ,IAAM,IAAU,EAAI;AACpB,UAAO,IAAU,EAAE,OAAO,EAAQ,KAAK,MAAM,EAAgB,GAAG,EAAO,CAAC,EAAE,GAAG,EAAE;;EAEjF,KAAK;EACL,KAAK,UASH,QARI,IACK;GACL,MAAM;GACN,YAAY,EAAE;GACd,UAAU,EAAE;GACZ,sBAAsB;GACvB,GAEI,EAAE;EACX,QACE,QAAO,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./chunk-AFLK3Q4T.js";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { defineSchema as e } from "../../core/dist/index.js";
|
|
2
|
+
e((e) => ({
|
|
3
|
+
spec: e.object({
|
|
4
|
+
root: e.string(),
|
|
5
|
+
elements: e.record(e.object({
|
|
6
|
+
type: e.ref("catalog.components"),
|
|
7
|
+
props: e.propsOf("catalog.components"),
|
|
8
|
+
children: e.array(e.string()),
|
|
9
|
+
visible: e.any()
|
|
10
|
+
}))
|
|
11
|
+
}),
|
|
12
|
+
catalog: e.object({
|
|
13
|
+
components: e.map({
|
|
14
|
+
props: e.zod(),
|
|
15
|
+
slots: e.array(e.string()),
|
|
16
|
+
description: e.string(),
|
|
17
|
+
example: e.any()
|
|
18
|
+
}),
|
|
19
|
+
actions: e.map({
|
|
20
|
+
params: e.zod(),
|
|
21
|
+
description: e.string()
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
}), {
|
|
25
|
+
builtInActions: [
|
|
26
|
+
{
|
|
27
|
+
name: "setState",
|
|
28
|
+
description: "Update a value in the state model at the given statePath. Params: { statePath: string, value: any }"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "pushState",
|
|
32
|
+
description: "Append an item to an array in state. Params: { statePath: string, value: any, clearStatePath?: string }. Value can contain {\"$state\":\"/path\"} refs and \"$id\" for auto IDs."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "removeState",
|
|
36
|
+
description: "Remove an item from an array in state by index. Params: { statePath: string, index: number }"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "validateForm",
|
|
40
|
+
description: "Validate all registered form fields and write the result to state. Params: { statePath?: string }. Defaults to /formValidation. Result: { valid: boolean, errors: Record<string, string[]> }."
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
defaultRules: [
|
|
44
|
+
"CRITICAL INTEGRITY CHECK: Before outputting ANY element that references children, you MUST have already output (or will output) each child as its own element. If an element has children: ['a', 'b'], then elements 'a' and 'b' MUST exist. A missing child element causes that entire branch of the UI to be invisible.",
|
|
45
|
+
"SELF-CHECK: After generating all elements, mentally walk the tree from root. Every key in every children array must resolve to a defined element. If you find a gap, output the missing element immediately.",
|
|
46
|
+
"CRITICAL: The \"visible\" field goes on the ELEMENT object, NOT inside \"props\". Correct: {\"type\":\"<ComponentName>\",\"props\":{},\"visible\":{\"$state\":\"/tab\",\"eq\":\"home\"},\"children\":[...]}.",
|
|
47
|
+
"CRITICAL: The \"on\" field goes on the ELEMENT object, NOT inside \"props\". Use on.press, on.change, on.submit etc. NEVER put action/actionParams inside props.",
|
|
48
|
+
"When the user asks for a UI that displays data (e.g. blog posts, products, users), ALWAYS include a state field with realistic sample data. The state field is a top-level field on the spec (sibling of root/elements).",
|
|
49
|
+
"When building repeating content backed by a state array (e.g. posts, products, items), use the \"repeat\" field on a container element. Example: { \"type\": \"<ContainerComponent>\", \"props\": {}, \"repeat\": { \"statePath\": \"/posts\", \"key\": \"id\" }, \"children\": [\"post-card\"] }. Replace <ContainerComponent> with an appropriate component from the AVAILABLE COMPONENTS list. Inside repeated children, use { \"$item\": \"field\" } to read a field from the current item, and { \"$index\": true } for the current array index. For two-way binding to an item field use { \"$bindItem\": \"completed\" }. Do NOT hardcode individual elements for each array item.",
|
|
50
|
+
"Design with visual hierarchy: use container components to group content, heading components for section titles, proper spacing, and status indicators. ONLY use components from the AVAILABLE COMPONENTS list.",
|
|
51
|
+
"For data-rich UIs, use multi-column layout components if available. For forms and single-column content, use vertical layout components. ONLY use components from the AVAILABLE COMPONENTS list.",
|
|
52
|
+
"Always include realistic, professional-looking sample data. For blogs include 3-4 posts with varied titles, authors, dates, categories. For products include names, prices, images. Never leave data empty."
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
//#endregion
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=chunk-WIPZLAF7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-WIPZLAF7.js","names":[],"sources":["../../../../../../../node_modules/@json-render/vue/dist/chunk-WIPZLAF7.mjs"],"sourcesContent":["// src/schema.ts\nimport { defineSchema } from \"@json-render/core\";\nvar schema = defineSchema(\n (s) => ({\n // What the AI-generated SPEC looks like\n spec: s.object({\n /** Root element key */\n root: s.string(),\n /** Flat map of elements by key */\n elements: s.record(\n s.object({\n /** Component type from catalog */\n type: s.ref(\"catalog.components\"),\n /** Component props */\n props: s.propsOf(\"catalog.components\"),\n /** Child element keys (flat reference) */\n children: s.array(s.string()),\n /** Visibility condition */\n visible: s.any()\n })\n )\n }),\n // What the CATALOG must provide\n catalog: s.object({\n /** Component definitions */\n components: s.map({\n /** Zod schema for component props */\n props: s.zod(),\n /** Slots for this component. Use ['default'] for children, or named slots like ['header', 'footer'] */\n slots: s.array(s.string()),\n /** Description for AI generation hints */\n description: s.string(),\n /** Example prop values used in prompt examples (auto-generated from Zod schema if omitted) */\n example: s.any()\n }),\n /** Action definitions (optional) */\n actions: s.map({\n /** Zod schema for action params */\n params: s.zod(),\n /** Description for AI generation hints */\n description: s.string()\n })\n })\n }),\n {\n builtInActions: [\n {\n name: \"setState\",\n description: \"Update a value in the state model at the given statePath. Params: { statePath: string, value: any }\"\n },\n {\n name: \"pushState\",\n description: 'Append an item to an array in state. Params: { statePath: string, value: any, clearStatePath?: string }. Value can contain {\"$state\":\"/path\"} refs and \"$id\" for auto IDs.'\n },\n {\n name: \"removeState\",\n description: \"Remove an item from an array in state by index. Params: { statePath: string, index: number }\"\n },\n {\n name: \"validateForm\",\n description: \"Validate all registered form fields and write the result to state. Params: { statePath?: string }. Defaults to /formValidation. Result: { valid: boolean, errors: Record<string, string[]> }.\"\n }\n ],\n defaultRules: [\n // Element integrity\n \"CRITICAL INTEGRITY CHECK: Before outputting ANY element that references children, you MUST have already output (or will output) each child as its own element. If an element has children: ['a', 'b'], then elements 'a' and 'b' MUST exist. A missing child element causes that entire branch of the UI to be invisible.\",\n \"SELF-CHECK: After generating all elements, mentally walk the tree from root. Every key in every children array must resolve to a defined element. If you find a gap, output the missing element immediately.\",\n // Field placement\n 'CRITICAL: The \"visible\" field goes on the ELEMENT object, NOT inside \"props\". Correct: {\"type\":\"<ComponentName>\",\"props\":{},\"visible\":{\"$state\":\"/tab\",\"eq\":\"home\"},\"children\":[...]}.',\n 'CRITICAL: The \"on\" field goes on the ELEMENT object, NOT inside \"props\". Use on.press, on.change, on.submit etc. NEVER put action/actionParams inside props.',\n // State and data\n \"When the user asks for a UI that displays data (e.g. blog posts, products, users), ALWAYS include a state field with realistic sample data. The state field is a top-level field on the spec (sibling of root/elements).\",\n 'When building repeating content backed by a state array (e.g. posts, products, items), use the \"repeat\" field on a container element. Example: { \"type\": \"<ContainerComponent>\", \"props\": {}, \"repeat\": { \"statePath\": \"/posts\", \"key\": \"id\" }, \"children\": [\"post-card\"] }. Replace <ContainerComponent> with an appropriate component from the AVAILABLE COMPONENTS list. Inside repeated children, use { \"$item\": \"field\" } to read a field from the current item, and { \"$index\": true } for the current array index. For two-way binding to an item field use { \"$bindItem\": \"completed\" }. Do NOT hardcode individual elements for each array item.',\n // Design quality\n \"Design with visual hierarchy: use container components to group content, heading components for section titles, proper spacing, and status indicators. ONLY use components from the AVAILABLE COMPONENTS list.\",\n \"For data-rich UIs, use multi-column layout components if available. For forms and single-column content, use vertical layout components. ONLY use components from the AVAILABLE COMPONENTS list.\",\n \"Always include realistic, professional-looking sample data. For blogs include 3-4 posts with varied titles, authors, dates, categories. For products include names, prices, images. Never leave data empty.\"\n ]\n }\n);\n\nexport {\n schema\n};\n//# sourceMappingURL=chunk-WIPZLAF7.mjs.map"],"x_google_ignoreList":[0],"mappings":";AAEa,GACV,OAAO;CAEN,MAAM,EAAE,OAAO;EAEb,MAAM,EAAE,QAAQ;EAEhB,UAAU,EAAE,OACV,EAAE,OAAO;GAEP,MAAM,EAAE,IAAI,qBAAqB;GAEjC,OAAO,EAAE,QAAQ,qBAAqB;GAEtC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC;GAE7B,SAAS,EAAE,KAAK;GACjB,CAAC,CACH;EACF,CAAC;CAEF,SAAS,EAAE,OAAO;EAEhB,YAAY,EAAE,IAAI;GAEhB,OAAO,EAAE,KAAK;GAEd,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC;GAE1B,aAAa,EAAE,QAAQ;GAEvB,SAAS,EAAE,KAAK;GACjB,CAAC;EAEF,SAAS,EAAE,IAAI;GAEb,QAAQ,EAAE,KAAK;GAEf,aAAa,EAAE,QAAQ;GACxB,CAAC;EACH,CAAC;CACH,GACD;CACE,gBAAgB;EACd;GACE,MAAM;GACN,aAAa;GACd;EACD;GACE,MAAM;GACN,aAAa;GACd;EACD;GACE,MAAM;GACN,aAAa;GACd;EACD;GACE,MAAM;GACN,aAAa;GACd;EACF;CACD,cAAc;EAEZ;EACA;EAEA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACD;CACF,CACF"}
|