@jxsuite/schema 0.23.2 → 0.24.0

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.
@@ -0,0 +1,30 @@
1
+ export const cemParameterSchema = {
2
+ description:
3
+ "A CEM-compatible parameter definition for a function. " +
4
+ "Follows the Custom Elements Manifest Parameter shape.",
5
+ type: "object",
6
+ required: ["name"],
7
+ properties: {
8
+ name: { description: "Parameter name.", type: "string" },
9
+ type: { description: "Parameter type (JSON Schema or CEM { text } format)." },
10
+ description: { description: "Parameter documentation.", type: "string" },
11
+ optional: { description: "Whether the parameter is optional.", type: "boolean" },
12
+ default: { description: "Default value for the parameter." },
13
+ },
14
+ } as const;
15
+
16
+ export const cemEventSchema = {
17
+ description:
18
+ "A CEM-compatible event definition. " + "Describes a CustomEvent the function dispatches.",
19
+ type: "object",
20
+ required: ["name"],
21
+ properties: {
22
+ name: { description: "Event name (e.g. 'task-toggled').", type: "string" },
23
+ type: { description: "Event type (e.g. { text: 'CustomEvent' })." },
24
+ description: { description: "Event documentation.", type: "string" },
25
+ deprecated: {
26
+ description: "Deprecation notice.",
27
+ oneOf: [{ type: "boolean" }, { type: "string" }],
28
+ },
29
+ },
30
+ } as const;
@@ -0,0 +1,28 @@
1
+ export const arrayNamespaceSchema = {
2
+ description: "Dynamic mapped list. Re-renders when the items state entry changes.",
3
+ type: "object",
4
+ required: ["$prototype", "items", "map"],
5
+ properties: {
6
+ $prototype: { type: "string", const: "Array" },
7
+ items: {
8
+ oneOf: [{ $ref: "#/$defs/RefObject" }, { type: "array" }],
9
+ },
10
+ map: { $ref: "#/$defs/ElementDef" },
11
+ filter: { $ref: "#/$defs/RefObject" },
12
+ sort: { $ref: "#/$defs/RefObject" },
13
+ },
14
+ additionalProperties: false,
15
+ } as const;
16
+
17
+ export const childrenValueSchema = {
18
+ description: "Static array of child definitions, or an Array namespace for dynamic lists.",
19
+ oneOf: [
20
+ {
21
+ type: "array",
22
+ items: {
23
+ oneOf: [{ $ref: "#/$defs/ElementDef" }, { type: "string" }, { type: "number" }],
24
+ },
25
+ },
26
+ { $ref: "#/$defs/ArrayNamespace" },
27
+ ],
28
+ } as const;
@@ -0,0 +1,169 @@
1
+ export const classParameterDefSchema = {
2
+ description: "A typed parameter definition for a class.",
3
+ type: "object",
4
+ required: ["identifier"],
5
+ properties: {
6
+ identifier: { type: "string" },
7
+ type: {},
8
+ format: {
9
+ description: 'When "json-schema", this parameter\'s value is itself a JSON Schema.',
10
+ type: "string",
11
+ },
12
+ description: { type: "string" },
13
+ default: {},
14
+ examples: { type: "array" },
15
+ },
16
+ } as const;
17
+
18
+ export const classFieldDefSchema = {
19
+ description: "A class field definition with access control and scope.",
20
+ type: "object",
21
+ properties: {
22
+ role: { type: "string", const: "field" },
23
+ access: { type: "string", enum: ["public", "private", "protected"] },
24
+ scope: { type: "string", enum: ["instance", "static"] },
25
+ identifier: { type: "string" },
26
+ type: {},
27
+ $prototype: {
28
+ description: 'Data source prototype for this field (e.g., "Request").',
29
+ type: "string",
30
+ },
31
+ initializer: {},
32
+ default: {},
33
+ description: { type: "string" },
34
+ examples: { type: "array" },
35
+ },
36
+ } as const;
37
+
38
+ export const classConstructorDefSchema = {
39
+ description: "Class constructor definition.",
40
+ type: "object",
41
+ properties: {
42
+ role: { type: "string", const: "constructor" },
43
+ $prototype: { type: "string", const: "Function" },
44
+ parameters: {
45
+ type: "array",
46
+ items: {
47
+ oneOf: [
48
+ {
49
+ type: "object",
50
+ required: ["$ref"],
51
+ properties: { $ref: { type: "string" } },
52
+ additionalProperties: false,
53
+ },
54
+ { $ref: "#/$defs/ClassParameterDef" },
55
+ ],
56
+ },
57
+ },
58
+ superCall: {
59
+ type: "object",
60
+ properties: {
61
+ arguments: { type: "array", items: { type: "string" } },
62
+ },
63
+ },
64
+ body: {
65
+ oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }],
66
+ },
67
+ description: { type: "string" },
68
+ },
69
+ } as const;
70
+
71
+ export const classMethodDefSchema = {
72
+ description: "A class method or accessor definition.",
73
+ type: "object",
74
+ properties: {
75
+ role: { type: "string", enum: ["method", "accessor"] },
76
+ $prototype: { type: "string", const: "Function" },
77
+ access: { type: "string", enum: ["public", "private", "protected"] },
78
+ scope: { type: "string", enum: ["instance", "static"] },
79
+ identifier: { type: "string" },
80
+ parameters: {
81
+ type: "array",
82
+ items: {
83
+ oneOf: [
84
+ {
85
+ type: "object",
86
+ required: ["$ref"],
87
+ properties: { $ref: { type: "string" } },
88
+ additionalProperties: false,
89
+ },
90
+ { $ref: "#/$defs/ClassParameterDef" },
91
+ ],
92
+ },
93
+ },
94
+ returnType: {},
95
+ body: {
96
+ oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }],
97
+ },
98
+ getter: {
99
+ type: "object",
100
+ properties: { body: { type: "string" } },
101
+ },
102
+ setter: {
103
+ type: "object",
104
+ properties: {
105
+ parameters: { type: "array" },
106
+ body: { type: "string" },
107
+ },
108
+ },
109
+ description: { type: "string" },
110
+ },
111
+ } as const;
112
+
113
+ export const classDefSchema = {
114
+ description:
115
+ 'A .class.json schema-defined class. $prototype must be "Class". ' +
116
+ "Defines fields, constructor, methods, and type parameters via $defs. " +
117
+ "Optionally points to a JS module via $implementation for hybrid execution.",
118
+ type: "object",
119
+ required: ["$prototype", "title"],
120
+ properties: {
121
+ $schema: { type: "string" },
122
+ $id: { type: "string" },
123
+ $prototype: { type: "string", const: "Class" },
124
+ title: {
125
+ description: "PascalCase class name, used as the export name.",
126
+ type: "string",
127
+ },
128
+ description: { type: "string" },
129
+ extends: {
130
+ description: "Base class — string name or $ref to another .class.json.",
131
+ oneOf: [
132
+ { type: "string" },
133
+ { type: "object", required: ["$ref"], properties: { $ref: { type: "string" } } },
134
+ ],
135
+ },
136
+ $implementation: {
137
+ description: "Relative path to a JS module containing the actual class implementation.",
138
+ type: "string",
139
+ },
140
+ $defs: {
141
+ description: "Class members: parameters, returnTypes, fields, constructor, methods.",
142
+ type: "object",
143
+ properties: {
144
+ parameters: {
145
+ description: "Reusable typed parameter schemas, keyed by name.",
146
+ type: "object",
147
+ additionalProperties: { $ref: "#/$defs/ClassParameterDef" },
148
+ },
149
+ returnTypes: {
150
+ description: "Output type schemas, keyed by name.",
151
+ type: "object",
152
+ additionalProperties: { type: "object" },
153
+ },
154
+ fields: {
155
+ description: "Class fields with role, access, scope, and type information.",
156
+ type: "object",
157
+ additionalProperties: { $ref: "#/$defs/ClassFieldDef" },
158
+ },
159
+ constructor: { $ref: "#/$defs/ClassConstructorDef" },
160
+ methods: {
161
+ description: "Class methods and accessors.",
162
+ type: "object",
163
+ additionalProperties: { $ref: "#/$defs/ClassMethodDef" },
164
+ },
165
+ },
166
+ },
167
+ },
168
+ additionalProperties: false,
169
+ } as const;
@@ -0,0 +1,34 @@
1
+ export const contentTypeDefSchema = {
2
+ description:
3
+ "Content type definition. Defines the source directory, frontmatter schema, and element dependencies.",
4
+ type: "object",
5
+ properties: {
6
+ source: {
7
+ description: "Path to the content directory relative to the project root.",
8
+ type: "string",
9
+ examples: ["./content/blog/", "./content/docs/"],
10
+ },
11
+ format: {
12
+ type: "string",
13
+ enum: ["md", "json", "csv", "yaml"],
14
+ },
15
+ schema: {
16
+ description: "JSON Schema for validating frontmatter of content type entries.",
17
+ type: "object",
18
+ },
19
+ $elements: {
20
+ description: "Custom elements available in markdown directives for this content type.",
21
+ type: "array",
22
+ items: {
23
+ oneOf: [
24
+ {
25
+ type: "object",
26
+ required: ["$ref"],
27
+ properties: { $ref: { type: "string" } },
28
+ },
29
+ { type: "string" },
30
+ ],
31
+ },
32
+ },
33
+ },
34
+ } as const;
@@ -0,0 +1,98 @@
1
+ export const attributesObjectSchema = {
2
+ description: "HTML attributes and ARIA attributes set via element.setAttribute().",
3
+ type: "object",
4
+ additionalProperties: {
5
+ oneOf: [
6
+ { type: "string" },
7
+ { type: "number" },
8
+ { type: "boolean" },
9
+ { $ref: "#/$defs/RefObject" },
10
+ ],
11
+ },
12
+ } as const;
13
+
14
+ export const propsObjectSchema = {
15
+ description: "Explicit prop passing at a component boundary.",
16
+ type: "object",
17
+ additionalProperties: {
18
+ oneOf: [
19
+ { type: "string" },
20
+ { type: "number" },
21
+ { type: "boolean" },
22
+ { type: "array" },
23
+ { type: "object" },
24
+ { $ref: "#/$defs/RefObject" },
25
+ ],
26
+ },
27
+ } as const;
28
+
29
+ export const elementPropertyValueSchema = {
30
+ oneOf: [
31
+ { type: "string" },
32
+ { type: "number" },
33
+ { type: "boolean" },
34
+ { type: "null" },
35
+ { $ref: "#/$defs/RefObject" },
36
+ ],
37
+ } as const;
38
+
39
+ export const switchDefSchema = {
40
+ description: "Reactive $ref that drives which case to render.",
41
+ type: "object",
42
+ required: ["$ref"],
43
+ properties: { $ref: { $ref: "#/$defs/InternalRef" } },
44
+ additionalProperties: false,
45
+ } as const;
46
+
47
+ export const switchNodeSchema = {
48
+ type: "object",
49
+ required: ["$switch", "cases"],
50
+ properties: {
51
+ tagName: { $ref: "#/$defs/TagName" },
52
+ $switch: { $ref: "#/$defs/SwitchDef" },
53
+ cases: {
54
+ type: "object",
55
+ additionalProperties: {
56
+ oneOf: [{ $ref: "#/$defs/ElementDef" }, { $ref: "#/$defs/ExternalComponentRef" }],
57
+ },
58
+ },
59
+ },
60
+ } as const;
61
+
62
+ export const elementDefSchema = {
63
+ description: "A Jx element definition. Maps directly to a DOM element.",
64
+ type: "object",
65
+ required: ["tagName"],
66
+ properties: {
67
+ tagName: { $ref: "#/$defs/TagName" },
68
+ id: { type: "string" },
69
+ className: { $ref: "#/$defs/StringOrRef" },
70
+ textContent: { $ref: "#/$defs/StringOrRef" },
71
+ innerHTML: { $ref: "#/$defs/StringOrRef" },
72
+ innerText: { $ref: "#/$defs/StringOrRef" },
73
+ hidden: { $ref: "#/$defs/BoolOrRef" },
74
+ tabIndex: { $ref: "#/$defs/NumberOrRef" },
75
+ title: { $ref: "#/$defs/StringOrRef" },
76
+ lang: { $ref: "#/$defs/StringOrRef" },
77
+ dir: { type: "string", enum: ["ltr", "rtl", "auto"] },
78
+ value: { $ref: "#/$defs/StringOrRef" },
79
+ checked: { $ref: "#/$defs/BoolOrRef" },
80
+ disabled: { $ref: "#/$defs/BoolOrRef" },
81
+ selected: { $ref: "#/$defs/BoolOrRef" },
82
+ src: { $ref: "#/$defs/StringOrRef" },
83
+ href: { $ref: "#/$defs/StringOrRef" },
84
+ alt: { $ref: "#/$defs/StringOrRef" },
85
+ type: { $ref: "#/$defs/StringOrRef" },
86
+ name: { $ref: "#/$defs/StringOrRef" },
87
+ placeholder: { $ref: "#/$defs/StringOrRef" },
88
+ children: { $ref: "#/$defs/ChildrenValue" },
89
+ style: { $ref: "#/$defs/StyleObject" },
90
+ attributes: { $ref: "#/$defs/AttributesObject" },
91
+ $switch: { $ref: "#/$defs/SwitchDef" },
92
+ $ref: { $ref: "#/$defs/ExternalRef" },
93
+ $props: { $ref: "#/$defs/PropsObject" },
94
+ "$map/item": { $ref: "#/$defs/RefObject" },
95
+ "$map/index": { $ref: "#/$defs/RefObject" },
96
+ },
97
+ additionalProperties: { $ref: "#/$defs/ElementPropertyValue" },
98
+ } as const;
@@ -0,0 +1,140 @@
1
+ export const expressionPointerSchema = {
2
+ description: "A JSON Pointer $ref operand within an expression node.",
3
+ type: "object",
4
+ properties: {
5
+ $ref: {
6
+ type: "string",
7
+ pattern: "^(\\$map/|\\$reduce/|event#/|#/|parent#/|window#/|document#/)",
8
+ },
9
+ },
10
+ required: ["$ref"],
11
+ additionalProperties: false,
12
+ } as const;
13
+
14
+ export const expressionLiteralSchema = {
15
+ description: "A non-reactive operand: scalar or array of operands.",
16
+ anyOf: [
17
+ { type: "string", not: { pattern: "\\$\\{" } },
18
+ { type: "number" },
19
+ { type: "boolean" },
20
+ { type: "null" },
21
+ { type: "array", items: { $ref: "#/$defs/ExpressionOperand" } },
22
+ ],
23
+ } as const;
24
+
25
+ export const expressionOperandSchema = {
26
+ description:
27
+ "Anything that may appear in target or value: a pointer, a literal, or a nested expression node.",
28
+ anyOf: [
29
+ { $ref: "#/$defs/ExpressionPointer" },
30
+ { $ref: "#/$defs/ExpressionNode" },
31
+ { $ref: "#/$defs/ExpressionLiteral" },
32
+ ],
33
+ } as const;
34
+
35
+ export const unaryOperatorSchema = { enum: ["!", "-"] } as const;
36
+ export const binaryOperatorSchema = {
37
+ enum: ["+", "-", "*", "/", "%", "===", "!==", "<", "<=", ">", ">=", "&&", "||"],
38
+ } as const;
39
+ export const assignmentOperatorSchema = { enum: ["=", "+=", "-=", "*=", "/="] } as const;
40
+ export const noArgMethodSchema = { enum: ["pop", "shift"] } as const;
41
+ export const oneArgMethodSchema = { enum: ["push", "unshift"] } as const;
42
+ export const spliceMethodSchema = { const: "splice" } as const;
43
+ export const reduceMethodSchema = { const: "reduce" } as const;
44
+ export const mapFilterMethodSchema = { enum: ["map", "filter"] } as const;
45
+
46
+ export const expressionNodeSchema = {
47
+ description: "The core expression node. operator + target, with value gated by arity.",
48
+ type: "object",
49
+ required: ["operator", "target"],
50
+ additionalProperties: false,
51
+ properties: {
52
+ operator: { type: "string" },
53
+ target: { $ref: "#/$defs/ExpressionOperand" },
54
+ value: { $ref: "#/$defs/ExpressionOperand" },
55
+ initial: { $ref: "#/$defs/ExpressionOperand" },
56
+ },
57
+ oneOf: [
58
+ {
59
+ title: "Unary — target only, no value",
60
+ properties: { operator: { $ref: "#/$defs/UnaryOperator" } },
61
+ required: ["operator"],
62
+ not: { anyOf: [{ required: ["value"] }, { required: ["initial"] }] },
63
+ },
64
+ {
65
+ title: "Binary — left in target, right in value",
66
+ properties: { operator: { $ref: "#/$defs/BinaryOperator" } },
67
+ required: ["operator", "value"],
68
+ not: { required: ["initial"] },
69
+ },
70
+ {
71
+ title: "Assignment — writable target, value required",
72
+ properties: {
73
+ operator: { $ref: "#/$defs/AssignmentOperator" },
74
+ target: { $ref: "#/$defs/ExpressionPointer" },
75
+ },
76
+ required: ["operator", "value"],
77
+ not: { required: ["initial"] },
78
+ },
79
+ {
80
+ title: "pop / shift — array receiver, no value",
81
+ properties: {
82
+ operator: { $ref: "#/$defs/NoArgMethod" },
83
+ target: { $ref: "#/$defs/ExpressionPointer" },
84
+ },
85
+ required: ["operator"],
86
+ not: { anyOf: [{ required: ["value"] }, { required: ["initial"] }] },
87
+ },
88
+ {
89
+ title: "push / unshift — array receiver, single value argument",
90
+ properties: {
91
+ operator: { $ref: "#/$defs/OneArgMethod" },
92
+ target: { $ref: "#/$defs/ExpressionPointer" },
93
+ },
94
+ required: ["operator", "value"],
95
+ not: { required: ["initial"] },
96
+ },
97
+ {
98
+ title: "splice — array receiver, [start, deleteCount, ...items]",
99
+ properties: {
100
+ operator: { $ref: "#/$defs/SpliceMethod" },
101
+ target: { $ref: "#/$defs/ExpressionPointer" },
102
+ value: { type: "array", items: { $ref: "#/$defs/ExpressionOperand" }, minItems: 1 },
103
+ },
104
+ required: ["operator", "value"],
105
+ not: { required: ["initial"] },
106
+ },
107
+ {
108
+ title: "reduce — pure fold; per-item expression in value, seed in initial",
109
+ properties: {
110
+ operator: { $ref: "#/$defs/ReduceMethod" },
111
+ target: { $ref: "#/$defs/ExpressionPointer" },
112
+ value: { $ref: "#/$defs/ExpressionNode" },
113
+ },
114
+ required: ["operator", "value", "initial"],
115
+ },
116
+ {
117
+ title: "map / filter — pure; per-item expression in value, no initial",
118
+ properties: {
119
+ operator: { $ref: "#/$defs/MapFilterMethod" },
120
+ target: { $ref: "#/$defs/ExpressionPointer" },
121
+ value: { $ref: "#/$defs/ExpressionNode" },
122
+ },
123
+ required: ["operator", "value"],
124
+ not: { required: ["initial"] },
125
+ },
126
+ ],
127
+ } as const;
128
+
129
+ export const expressionEntrySchema = {
130
+ description:
131
+ "A declarative expression entry (Shape 5). Used as a state entry or inline event handler.",
132
+ type: "object",
133
+ required: ["$expression"],
134
+ properties: {
135
+ $expression: { $ref: "#/$defs/ExpressionNode" },
136
+ $title: { type: "string" },
137
+ $description: { type: "string" },
138
+ },
139
+ additionalProperties: false,
140
+ } as const;
@@ -0,0 +1,107 @@
1
+ export const BUILT_IN_PROTOTYPES = [
2
+ "Function",
3
+ "Request",
4
+ "URLSearchParams",
5
+ "FormData",
6
+ "LocalStorage",
7
+ "SessionStorage",
8
+ "Cookie",
9
+ "IndexedDB",
10
+ "Array",
11
+ "Set",
12
+ "Map",
13
+ "Blob",
14
+ "ReadableStream",
15
+ ] as const;
16
+
17
+ export const externalClassDefSchema = {
18
+ description:
19
+ 'An external class / data source. $prototype is a constructor name (not "Function"). ' +
20
+ "When $prototype is not in the built-in registry, $src is required. " +
21
+ "All state entries are reactive by default.",
22
+ type: "object",
23
+ required: ["$prototype"],
24
+ properties: {
25
+ $prototype: {
26
+ description: "Constructor name — built-in Web API class or external class name.",
27
+ type: "string",
28
+ not: { const: "Function" },
29
+ examples: [
30
+ "Request",
31
+ "URLSearchParams",
32
+ "FormData",
33
+ "LocalStorage",
34
+ "SessionStorage",
35
+ "Cookie",
36
+ "IndexedDB",
37
+ "Array",
38
+ "Set",
39
+ "Map",
40
+ "Blob",
41
+ "ReadableStream",
42
+ "MarkdownCollection",
43
+ "MyParser",
44
+ ],
45
+ },
46
+ $src: {
47
+ description: "External module specifier. Required when $prototype is not a built-in.",
48
+ type: "string",
49
+ examples: ["@jxsuite/md", "./lib/my-parser.js", "npm:@myorg/data"],
50
+ },
51
+ $export: {
52
+ description: "Named export in $src module. Defaults to the $prototype value.",
53
+ type: "string",
54
+ },
55
+ timing: { type: "string", enum: ["compiler", "server", "client"] },
56
+ manual: { type: "boolean" },
57
+ debounce: { type: "integer", minimum: 0 },
58
+ url: { $ref: "#/$defs/StringOrRef" },
59
+ method: {
60
+ type: "string",
61
+ enum: ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"],
62
+ },
63
+ headers: { type: "object", additionalProperties: { type: "string" } },
64
+ body: {},
65
+ responseType: {
66
+ type: "string",
67
+ enum: ["json", "text", "blob", "arraybuffer", "document", ""],
68
+ },
69
+ key: { type: "string" },
70
+ name: { type: "string" },
71
+ maxAge: { type: "integer" },
72
+ expires: { type: "string" },
73
+ path: { type: "string" },
74
+ domain: { type: "string" },
75
+ secure: { type: "boolean" },
76
+ sameSite: { type: "string", enum: ["strict", "lax", "none"] },
77
+ database: { type: "string" },
78
+ store: { type: "string" },
79
+ version: { type: "integer", minimum: 1 },
80
+ keyPath: { type: "string" },
81
+ autoIncrement: { type: "boolean" },
82
+ indexes: {
83
+ type: "array",
84
+ items: {
85
+ type: "object",
86
+ required: ["name", "keyPath"],
87
+ properties: {
88
+ name: { type: "string" },
89
+ keyPath: {
90
+ oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }],
91
+ },
92
+ unique: { type: "boolean" },
93
+ },
94
+ },
95
+ },
96
+ default: {},
97
+ description: { type: "string" },
98
+ items: {},
99
+ map: { $ref: "#/$defs/ElementDef" },
100
+ filter: { $ref: "#/$defs/RefObject" },
101
+ sort: { $ref: "#/$defs/RefObject" },
102
+ src: {
103
+ description: "Configuration property passed to external class constructor.",
104
+ type: "string",
105
+ },
106
+ },
107
+ } as const;
@@ -0,0 +1,59 @@
1
+ export const functionDefSchema = {
2
+ description:
3
+ 'A function declaration. $prototype must be "Function". ' +
4
+ "body (inline) and $src (external) are mutually exclusive. " +
5
+ "First parameter is always state (the reactive scope).",
6
+ type: "object",
7
+ required: ["$prototype"],
8
+ properties: {
9
+ $prototype: { type: "string", const: "Function" },
10
+ body: {
11
+ description: "Inline function body string. First implicit parameter is state.",
12
+ type: "string",
13
+ examples: [
14
+ "state.count++",
15
+ 'state.items.push({ id: Date.now(), text: "", done: false })',
16
+ 'return state.score >= 90 ? "gold" : "silver"',
17
+ ],
18
+ },
19
+ parameters: {
20
+ description:
21
+ "Function parameters (after the implicit state parameter). " +
22
+ "Accepts CEM-compatible parameter objects or bare string names for backward compatibility.",
23
+ type: "array",
24
+ items: {
25
+ oneOf: [{ type: "string" }, { $ref: "#/$defs/CemParameter" }],
26
+ },
27
+ examples: [
28
+ ["event"],
29
+ [{ name: "event", type: { text: "Event" } }],
30
+ [{ name: "id", type: { text: "number" }, description: "Item identifier" }],
31
+ ],
32
+ },
33
+ name: {
34
+ description: "Explicit function name. Defaults to the state key name.",
35
+ type: "string",
36
+ },
37
+ $src: {
38
+ description: "External module specifier. Mutually exclusive with body.",
39
+ type: "string",
40
+ examples: ["./counter.js", "npm:@myorg/validators"],
41
+ },
42
+ $export: {
43
+ description: "Named export in $src module. Defaults to the state key name.",
44
+ type: "string",
45
+ },
46
+ type: {
47
+ description: "Return type for tooling (JSON Schema or CEM { text } format).",
48
+ },
49
+ emits: {
50
+ description:
51
+ "Array of CEM-compatible Event objects this function dispatches. " +
52
+ "Used for CEM extraction and studio event discovery.",
53
+ type: "array",
54
+ items: { $ref: "#/$defs/CemEvent" },
55
+ },
56
+ description: { type: "string" },
57
+ },
58
+ additionalProperties: false,
59
+ } as const;
@@ -0,0 +1,17 @@
1
+ export const headEntrySchema = {
2
+ description: "A page-level <head> entry. Defines meta tags, link tags, script tags, etc.",
3
+ type: "object",
4
+ required: ["tagName"],
5
+ properties: {
6
+ tagName: { type: "string" },
7
+ attributes: {
8
+ type: "object",
9
+ additionalProperties: {
10
+ oneOf: [{ type: "string" }, { type: "boolean" }],
11
+ },
12
+ },
13
+ textContent: { type: "string" },
14
+ children: { type: "array", items: { $ref: "#/$defs/HeadEntry" } },
15
+ },
16
+ additionalProperties: true,
17
+ } as const;