@nordcraft/core 1.0.78 → 1.0.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/ToddleApiV2.d.ts +2 -2
- package/dist/api/apiTypes.d.ts +1 -1
- package/dist/component/component.types.d.ts +1 -1
- package/dist/component/schemas/action-schema.d.ts +3 -0
- package/dist/component/schemas/action-schema.js +169 -0
- package/dist/component/schemas/action-schema.js.map +1 -0
- package/dist/component/schemas/api-schema.d.ts +3 -0
- package/dist/component/schemas/api-schema.js +174 -0
- package/dist/component/schemas/api-schema.js.map +1 -0
- package/dist/component/schemas/attribute-schema.d.ts +3 -0
- package/dist/component/schemas/attribute-schema.js +12 -0
- package/dist/component/schemas/attribute-schema.js.map +1 -0
- package/dist/component/schemas/component-schema.d.ts +6 -0
- package/dist/component/schemas/component-schema.js +132 -0
- package/dist/component/schemas/component-schema.js.map +1 -0
- package/dist/component/schemas/context-schema.d.ts +3 -0
- package/dist/component/schemas/context-schema.js +20 -0
- package/dist/component/schemas/context-schema.js.map +1 -0
- package/dist/component/schemas/event-schema.d.ts +4 -0
- package/dist/component/schemas/event-schema.js +25 -0
- package/dist/component/schemas/event-schema.js.map +1 -0
- package/dist/component/schemas/formula-schema.d.ts +5 -0
- package/dist/component/schemas/formula-schema.js +203 -0
- package/dist/component/schemas/formula-schema.js.map +1 -0
- package/dist/component/schemas/node-schema.d.ts +3 -0
- package/dist/component/schemas/node-schema.js +159 -0
- package/dist/component/schemas/node-schema.js.map +1 -0
- package/dist/component/schemas/route-schema.d.ts +3 -0
- package/dist/component/schemas/route-schema.js +88 -0
- package/dist/component/schemas/route-schema.js.map +1 -0
- package/dist/component/schemas/variable-schema.d.ts +3 -0
- package/dist/component/schemas/variable-schema.js +8 -0
- package/dist/component/schemas/variable-schema.js.map +1 -0
- package/dist/component/schemas/workflow-schema.d.ts +3 -0
- package/dist/component/schemas/workflow-schema.js +23 -0
- package/dist/component/schemas/workflow-schema.js.map +1 -0
- package/dist/component/schemas/zod-schemas.d.ts +26 -3
- package/dist/component/schemas/zod-schemas.js +4 -1081
- package/dist/component/schemas/zod-schemas.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/collections.d.ts +1 -1
- package/dist/utils/collections.js.map +1 -1
- package/package.json +1 -1
- package/src/api/apiTypes.ts +1 -1
- package/src/component/component.types.ts +1 -1
- package/src/component/schemas/action-schema.ts +258 -0
- package/src/component/schemas/api-schema.ts +255 -0
- package/src/component/schemas/attribute-schema.ts +15 -0
- package/src/component/schemas/component-schema.ts +174 -0
- package/src/component/schemas/context-schema.ts +21 -0
- package/src/component/schemas/event-schema.ts +35 -0
- package/src/component/schemas/formula-schema.ts +299 -0
- package/src/component/schemas/node-schema.ts +259 -0
- package/src/component/schemas/route-schema.ts +135 -0
- package/src/component/schemas/variable-schema.ts +11 -0
- package/src/component/schemas/workflow-schema.ts +30 -0
- package/src/component/schemas/zod-schemas.ts +4 -1493
- package/src/types.ts +1 -1
- package/src/utils/collections.ts +4 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* eslint-disable inclusive-language/use-inclusive-words */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ActionModelSchema } from './action-schema';
|
|
4
|
+
import { MetadataSchema, SCHEMA_DESCRIPTIONS } from './zod-schemas';
|
|
5
|
+
// Event Model
|
|
6
|
+
export const EventModelSchema = z
|
|
7
|
+
.lazy(() => z.object({
|
|
8
|
+
trigger: z
|
|
9
|
+
.string()
|
|
10
|
+
.describe('Name of the event trigger. Nordcraft does not prefix events with "on", fx a click event is just called: "click".'),
|
|
11
|
+
actions: z
|
|
12
|
+
.array(ActionModelSchema)
|
|
13
|
+
.describe('List of actions to execute.'),
|
|
14
|
+
}))
|
|
15
|
+
.describe('Model describing an event. Events are used to define actions that should be executed in response to specific triggers, such as user interactions or lifecycle events.');
|
|
16
|
+
export const ComponentEventSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(SCHEMA_DESCRIPTIONS.metadata('component event')),
|
|
19
|
+
name: z.string().describe('Name of the component event'),
|
|
20
|
+
dummyEvent: z
|
|
21
|
+
.any()
|
|
22
|
+
.describe(SCHEMA_DESCRIPTIONS.testData('component event')),
|
|
23
|
+
})
|
|
24
|
+
.describe('Schema for a component event.');
|
|
25
|
+
//# sourceMappingURL=event-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-schema.js","sourceRoot":"","sources":["../../../src/component/schemas/event-schema.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnE,cAAc;AACd,MAAM,CAAC,MAAM,gBAAgB,GAA0B,CAAC;KACrD,IAAI,CAAC,GAAG,EAAE,CACT,CAAC,CAAC,MAAM,CAAC;IACP,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,CACP,kHAAkH,CACnH;IACH,OAAO,EAAE,CAAC;SACP,KAAK,CAAC,iBAAiB,CAAC;SACxB,QAAQ,CAAC,6BAA6B,CAAC;CAC3C,CAAC,CACH;KACA,QAAQ,CACP,uKAAuK,CACxK,CAAA;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAA8B,CAAC;KAC7D,MAAM,CAAC;IACN,qBAAqB,EAAE,cAAc,CAAC,OAAO,EAAE,CAAC,QAAQ,CACtD,mBAAmB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAChD;IACD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IACxD,UAAU,EAAE,CAAC;SACV,GAAG,EAAE;SACL,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;CAC7D,CAAC;KACD,QAAQ,CAAC,+BAA+B,CAAC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Formula } from '../../formula/formula';
|
|
3
|
+
import type { ComponentFormula } from '../component.types';
|
|
4
|
+
export declare const FormulaSchema: z.ZodType<Formula>;
|
|
5
|
+
export declare const ComponentFormulaSchema: z.ZodType<ComponentFormula>;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MetadataSchema, SCHEMA_DESCRIPTIONS } from './zod-schemas';
|
|
3
|
+
// Value Operation
|
|
4
|
+
const ValueOperationValueSchema = z.union([
|
|
5
|
+
z.string(),
|
|
6
|
+
z.number(),
|
|
7
|
+
z.boolean(),
|
|
8
|
+
z.null(),
|
|
9
|
+
z.object({}),
|
|
10
|
+
]);
|
|
11
|
+
const ValueOperationSchema = z.object({
|
|
12
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(SCHEMA_DESCRIPTIONS.metadata('value operation')),
|
|
13
|
+
type: z.literal('value'),
|
|
14
|
+
value: ValueOperationValueSchema.describe('Literal value.'),
|
|
15
|
+
});
|
|
16
|
+
// Path Operation
|
|
17
|
+
const PathOperationSchema = z.object({
|
|
18
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(SCHEMA_DESCRIPTIONS.metadata('path operation')),
|
|
19
|
+
type: z.literal('path'),
|
|
20
|
+
path: z
|
|
21
|
+
.array(z.string())
|
|
22
|
+
.describe('Path segments for the path operation. Each segment is a string that corresponds to a property name or array index in the Data object passed to the system prompt.'),
|
|
23
|
+
});
|
|
24
|
+
// Formula argument base
|
|
25
|
+
const FormulaArgumentSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
get formula() {
|
|
28
|
+
return FormulaSchema.describe('Formula for the argument.');
|
|
29
|
+
},
|
|
30
|
+
isFunction: z
|
|
31
|
+
.boolean()
|
|
32
|
+
.nullish()
|
|
33
|
+
.describe('Whether the argument is a function. This will be true on array formulas like map, filter, reduce, etc. formulas.'),
|
|
34
|
+
name: z
|
|
35
|
+
.string()
|
|
36
|
+
.describe('The name of the argument. This name corresponds to the argument name from the formula definition.'),
|
|
37
|
+
})
|
|
38
|
+
.describe('Argument for formulas in Nordcraft formulas.');
|
|
39
|
+
// Array Operation
|
|
40
|
+
const ArrayOperationSchema = z
|
|
41
|
+
.object({
|
|
42
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(SCHEMA_DESCRIPTIONS.metadata('array operation')),
|
|
43
|
+
type: z.literal('array'),
|
|
44
|
+
get arguments() {
|
|
45
|
+
return z
|
|
46
|
+
.array(z.object({ formula: FormulaSchema }))
|
|
47
|
+
.describe('List of formulas for the array elements.');
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
.describe('Model for describing an array in Nordcraft formulas.');
|
|
51
|
+
// Object Operation
|
|
52
|
+
const ObjectOperationSchema = z
|
|
53
|
+
.object({
|
|
54
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(SCHEMA_DESCRIPTIONS.metadata('object operation')),
|
|
55
|
+
type: z.literal('object'),
|
|
56
|
+
get arguments() {
|
|
57
|
+
return z
|
|
58
|
+
.array(FormulaArgumentSchema)
|
|
59
|
+
.nullish()
|
|
60
|
+
.describe('List of key-value pairs for the object. Each entry must have a name and a formula.');
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
.describe('Model for describing an object in Nordcraft formulas.');
|
|
64
|
+
// Record Operation
|
|
65
|
+
const RecordOperationSchema = z
|
|
66
|
+
.object({
|
|
67
|
+
'@nordcraft/metadata': MetadataSchema.nullish(),
|
|
68
|
+
type: z.literal('record'),
|
|
69
|
+
get entries() {
|
|
70
|
+
return z.array(FormulaArgumentSchema);
|
|
71
|
+
},
|
|
72
|
+
label: z.string().nullish(),
|
|
73
|
+
})
|
|
74
|
+
.describe('Deprecated - use Object operation instead.');
|
|
75
|
+
// And Operation
|
|
76
|
+
const AndOperationSchema = z
|
|
77
|
+
.object({
|
|
78
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(SCHEMA_DESCRIPTIONS.metadata('AND operation')),
|
|
79
|
+
type: z.literal('and'),
|
|
80
|
+
get arguments() {
|
|
81
|
+
return z
|
|
82
|
+
.array(z.object({ formula: FormulaSchema }))
|
|
83
|
+
.describe('List of formulas to evaluate in the AND operation. All formulas must evaluate to a truthy value for the AND operation to return true.');
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
.describe('Model for describing a logical AND operation. The return value is a boolean value.');
|
|
87
|
+
// Or Operation
|
|
88
|
+
const OrOperationSchema = z
|
|
89
|
+
.object({
|
|
90
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(SCHEMA_DESCRIPTIONS.metadata('OR operation')),
|
|
91
|
+
type: z.literal('or'),
|
|
92
|
+
get arguments() {
|
|
93
|
+
return z
|
|
94
|
+
.array(z.object({ formula: FormulaSchema }))
|
|
95
|
+
.describe('List of formulas to evaluate in the OR operation. At least one formula must evaluate to a truthy value for the OR operation to return true.');
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
.describe('Model for describing a logical OR operation. The return value is a boolean value.');
|
|
99
|
+
// Switch Operation
|
|
100
|
+
const SwitchOperationSchema = z
|
|
101
|
+
.object({
|
|
102
|
+
'@nordcraft/metadata': MetadataSchema.nullish(),
|
|
103
|
+
type: z.literal('switch'),
|
|
104
|
+
cases: z
|
|
105
|
+
.array(z.object({
|
|
106
|
+
get condition() {
|
|
107
|
+
return z
|
|
108
|
+
.lazy(() => FormulaSchema)
|
|
109
|
+
.describe('Condition to evaluate for this case. If truthy, the formula is used.');
|
|
110
|
+
},
|
|
111
|
+
get formula() {
|
|
112
|
+
return z
|
|
113
|
+
.lazy(() => FormulaSchema)
|
|
114
|
+
.describe('Formula to use if the condition is met.');
|
|
115
|
+
},
|
|
116
|
+
}))
|
|
117
|
+
.length(1)
|
|
118
|
+
.describe('Cases for the switch operation. Each case has a condition and a formula. The length of cases cannot exceed 1 at this time as the UI does not currently support this.'),
|
|
119
|
+
get default() {
|
|
120
|
+
return FormulaSchema.describe('Default formula if no case matches.');
|
|
121
|
+
},
|
|
122
|
+
})
|
|
123
|
+
.describe('Model for describing a switch operation. A switch operation allows branching logic based on conditions.');
|
|
124
|
+
// Project Function Operation
|
|
125
|
+
const ProjectFunctionOperationSchema = z
|
|
126
|
+
.object({
|
|
127
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(SCHEMA_DESCRIPTIONS.metadata('project formula operation')),
|
|
128
|
+
type: z.literal('function'),
|
|
129
|
+
name: z
|
|
130
|
+
.string()
|
|
131
|
+
.describe('Key of the project formula to be called. This must match the key of the project formulas passed to the system prompt.'),
|
|
132
|
+
get arguments() {
|
|
133
|
+
return z.array(FormulaArgumentSchema).describe('Formula arguments.');
|
|
134
|
+
},
|
|
135
|
+
})
|
|
136
|
+
.describe('Model for describing a Project Formula operation. A Project Formula is a user-defined formula that can be reused across the project.');
|
|
137
|
+
// Built-in Function Operation
|
|
138
|
+
const BuiltInFunctionOperationSchema = z.object({
|
|
139
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(SCHEMA_DESCRIPTIONS.metadata('built-in formula operation')),
|
|
140
|
+
type: z.literal('function'),
|
|
141
|
+
name: z
|
|
142
|
+
.string()
|
|
143
|
+
.describe('Key of the built-in formula to be called. This key is always prefixed with "@toddle/" and can be read from the built-in formula definition.'),
|
|
144
|
+
get arguments() {
|
|
145
|
+
return z.array(FormulaArgumentSchema).describe('Formula arguments.');
|
|
146
|
+
},
|
|
147
|
+
display_name: z
|
|
148
|
+
.string()
|
|
149
|
+
.nullish()
|
|
150
|
+
.describe('Human readable label for the operation. This should be set from the "name" read from the built-in formula definition.'),
|
|
151
|
+
variableArguments: z
|
|
152
|
+
.boolean()
|
|
153
|
+
.nullish()
|
|
154
|
+
.describe('Field defining if the formula accepts variable number of arguments. This value is read from the built-in formula definition.'),
|
|
155
|
+
});
|
|
156
|
+
// Apply Operation
|
|
157
|
+
const ApplyOperationSchema = z
|
|
158
|
+
.object({
|
|
159
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(SCHEMA_DESCRIPTIONS.formulas('apply operation')),
|
|
160
|
+
type: z.literal('apply'),
|
|
161
|
+
name: z
|
|
162
|
+
.string()
|
|
163
|
+
.describe('Key of the formula to be applied. This is the key defined in the formulas object found in the same file.'),
|
|
164
|
+
arguments: z
|
|
165
|
+
.array(FormulaArgumentSchema)
|
|
166
|
+
.describe('Arguments to pass to the formula being applied.'),
|
|
167
|
+
})
|
|
168
|
+
.describe('Model for describing an Apply operation. An apply operation is used when a formula wants to run another formula defined in the same file.');
|
|
169
|
+
// Formula - union of all operation types
|
|
170
|
+
export const FormulaSchema = z.lazy(() => z.union([
|
|
171
|
+
BuiltInFunctionOperationSchema,
|
|
172
|
+
ProjectFunctionOperationSchema,
|
|
173
|
+
RecordOperationSchema,
|
|
174
|
+
ObjectOperationSchema,
|
|
175
|
+
ArrayOperationSchema,
|
|
176
|
+
PathOperationSchema,
|
|
177
|
+
SwitchOperationSchema,
|
|
178
|
+
OrOperationSchema,
|
|
179
|
+
AndOperationSchema,
|
|
180
|
+
ValueOperationSchema,
|
|
181
|
+
ApplyOperationSchema,
|
|
182
|
+
]));
|
|
183
|
+
export const ComponentFormulaSchema = z.object({
|
|
184
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(SCHEMA_DESCRIPTIONS.metadata('formula')),
|
|
185
|
+
name: z.string().describe('Name of the formula'),
|
|
186
|
+
formula: FormulaSchema.describe('Contains the "code" that will be executed when this formula is called.'),
|
|
187
|
+
arguments: z
|
|
188
|
+
.array(z.object({
|
|
189
|
+
name: z.string().describe('Name of the formula argument'),
|
|
190
|
+
testValue: z.any().describe('Test value for the formula argument'),
|
|
191
|
+
}))
|
|
192
|
+
.nullish()
|
|
193
|
+
.describe('List of arguments accepted by the formula.'),
|
|
194
|
+
memoize: z
|
|
195
|
+
.boolean()
|
|
196
|
+
.nullish()
|
|
197
|
+
.describe('Indicates if the formula result should be memoized.'),
|
|
198
|
+
exposeInContext: z
|
|
199
|
+
.boolean()
|
|
200
|
+
.nullish()
|
|
201
|
+
.describe('Indicates if the formula should be exposed in the component context for child components to subscribe to.'),
|
|
202
|
+
});
|
|
203
|
+
//# sourceMappingURL=formula-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formula-schema.js","sourceRoot":"","sources":["../../../src/component/schemas/formula-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAiBvB,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnE,kBAAkB;AAClB,MAAM,yBAAyB,GAAmC,CAAC,CAAC,KAAK,CAAC;IACxE,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,OAAO,EAAE;IACX,CAAC,CAAC,IAAI,EAAE;IACR,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;CACb,CAAC,CAAA;AAEF,MAAM,oBAAoB,GAA8B,CAAC,CAAC,MAAM,CAAC;IAC/D,qBAAqB,EAAE,cAAc,CAAC,OAAO,EAAE,CAAC,QAAQ,CACtD,mBAAmB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAChD;IACD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACxB,KAAK,EAAE,yBAAyB,CAAC,QAAQ,CAAC,gBAAgB,CAAC;CAC5D,CAAC,CAAA;AAEF,iBAAiB;AACjB,MAAM,mBAAmB,GAA6B,CAAC,CAAC,MAAM,CAAC;IAC7D,qBAAqB,EAAE,cAAc,CAAC,OAAO,EAAE,CAAC,QAAQ,CACtD,mBAAmB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAC/C;IACD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACvB,IAAI,EAAE,CAAC;SACJ,KAA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CAAC,MAAM,aAAa,GAAuB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAC3D,CAAC,CAAC,KAAK,CAAC;IACN,8BAA8B;IAC9B,8BAA8B;IAC9B,qBAAqB;IACrB,qBAAqB;IACrB,oBAAoB;IACpB,mBAAmB;IACnB,qBAAqB;IACrB,iBAAiB;IACjB,kBAAkB;IAClB,oBAAoB;IACpB,oBAAoB;CACrB,CAAC,CACH,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAgC,CAAC,CAAC,MAAM,CAAC;IAC1E,qBAAqB,EAAE,cAAc,CAAC,OAAO,EAAE,CAAC,QAAQ,CACtD,mBAAmB,CAAC,QAAQ,CAAC,SAAS,CAAC,CACxC;IACD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;IAChD,OAAO,EAAE,aAAa,CAAC,QAAQ,CAC7B,wEAAwE,CACzE;IACD,SAAS,EAAE,CAAC;SACT,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;QACzD,SAAS,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;KACnE,CAAC,CACH;SACA,OAAO,EAAE;SACT,QAAQ,CAAC,4CAA4C,CAAC;IACzD,OAAO,EAAE,CAAC;SACP,OAAO,EAAE;SACT,OAAO,EAAE;SACT,QAAQ,CAAC,qDAAqD,CAAC;IAClE,eAAe,EAAE,CAAC;SACf,OAAO,EAAE;SACT,OAAO,EAAE;SACT,QAAQ,CACP,2GAA2G,CAC5G;CACJ,CAAC,CAAA"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { EventModelSchema } from './event-schema';
|
|
3
|
+
import { FormulaSchema } from './formula-schema';
|
|
4
|
+
import { SCHEMA_DESCRIPTIONS } from './zod-schemas';
|
|
5
|
+
// Style and Animation
|
|
6
|
+
const NodeStyleModelSchema = z.record(z.string(), z.string());
|
|
7
|
+
const AnimationKeyframeSchema = z.object({
|
|
8
|
+
position: z
|
|
9
|
+
.number()
|
|
10
|
+
.describe("Value between 0 and 1 representing the keyframe's position in the animation"),
|
|
11
|
+
key: z.string().describe('CSS property to be animated'),
|
|
12
|
+
value: z.string().describe('Value of the CSS property at this keyframe'),
|
|
13
|
+
});
|
|
14
|
+
const StyleTokenCategorySchema = z.enum([
|
|
15
|
+
'spacing',
|
|
16
|
+
'color',
|
|
17
|
+
'font-size',
|
|
18
|
+
'font-weight',
|
|
19
|
+
'z-index',
|
|
20
|
+
'border-radius',
|
|
21
|
+
'shadow',
|
|
22
|
+
]);
|
|
23
|
+
const StyleVariantSchema = z.object({
|
|
24
|
+
style: NodeStyleModelSchema,
|
|
25
|
+
id: z.string().nullish(),
|
|
26
|
+
className: z.string().nullish(),
|
|
27
|
+
hover: z.boolean().nullish(),
|
|
28
|
+
active: z.boolean().nullish(),
|
|
29
|
+
focus: z.boolean().nullish(),
|
|
30
|
+
focusWithin: z.boolean().nullish(),
|
|
31
|
+
disabled: z.boolean().nullish(),
|
|
32
|
+
empty: z.boolean().nullish(),
|
|
33
|
+
firstChild: z.boolean().nullish(),
|
|
34
|
+
lastChild: z.boolean().nullish(),
|
|
35
|
+
evenChild: z.boolean().nullish(),
|
|
36
|
+
startingStyle: z.boolean().nullish(),
|
|
37
|
+
mediaQuery: z
|
|
38
|
+
.object({
|
|
39
|
+
'min-width': z.string().nullish(),
|
|
40
|
+
'max-width': z.string().nullish(),
|
|
41
|
+
'min-height': z.string().nullish(),
|
|
42
|
+
'max-height': z.string().nullish(),
|
|
43
|
+
'prefers-reduced-motion': z.enum(['reduce', 'no-preference']).nullish(),
|
|
44
|
+
})
|
|
45
|
+
.nullish(),
|
|
46
|
+
});
|
|
47
|
+
// Node Models
|
|
48
|
+
const TextNodeModelSchema = z
|
|
49
|
+
.object({
|
|
50
|
+
type: z.literal('text'),
|
|
51
|
+
value: FormulaSchema.describe('Formula evaluating to the text content.'),
|
|
52
|
+
condition: FormulaSchema.nullish().describe(SCHEMA_DESCRIPTIONS.condition('text node')),
|
|
53
|
+
repeat: FormulaSchema.nullish().describe(SCHEMA_DESCRIPTIONS.repeat('text node')),
|
|
54
|
+
repeatKey: FormulaSchema.nullish().describe(SCHEMA_DESCRIPTIONS.repeatKey('text node')),
|
|
55
|
+
slot: z.string().nullish().describe(SCHEMA_DESCRIPTIONS.slot('text node')),
|
|
56
|
+
})
|
|
57
|
+
.describe('Schema defining a Text Node Model. A text node represents text content inside of an element.');
|
|
58
|
+
const SlotNodeModelSchema = z
|
|
59
|
+
.object({
|
|
60
|
+
type: z.literal('slot'),
|
|
61
|
+
children: z
|
|
62
|
+
.array(z.string())
|
|
63
|
+
.describe(`${SCHEMA_DESCRIPTIONS.children}. These are the default child nodes for the slot. If no content is passed to the slot when used inside a component, these default child nodes will be rendered.`),
|
|
64
|
+
name: z
|
|
65
|
+
.string()
|
|
66
|
+
.nullish()
|
|
67
|
+
.describe('Name of the slot. This is the name that must be used when passing content to this slot.'),
|
|
68
|
+
condition: FormulaSchema.nullish().describe(SCHEMA_DESCRIPTIONS.condition('slot node')),
|
|
69
|
+
slot: z.string().nullish().describe(SCHEMA_DESCRIPTIONS.slot('slot node')),
|
|
70
|
+
})
|
|
71
|
+
.describe('Schema defining a Slot Node Model. A slot is a placeholder for child nodes. Slot nodes can only exist inside components.');
|
|
72
|
+
const ElementNodeModelSchema = z
|
|
73
|
+
.object({
|
|
74
|
+
type: z.literal('element'),
|
|
75
|
+
tag: z
|
|
76
|
+
.string()
|
|
77
|
+
.describe('The HTML tag of the element node, such as "div", "span", "img", "a", etc.'),
|
|
78
|
+
attrs: z
|
|
79
|
+
.record(z.string(), FormulaSchema)
|
|
80
|
+
.describe('Attributes of the element node such as "src", "alt", "href", or any other attribute that is applicable to the corresponding HTML element.'),
|
|
81
|
+
style: NodeStyleModelSchema.describe(SCHEMA_DESCRIPTIONS.style('element node')),
|
|
82
|
+
children: z.array(z.string()).describe(SCHEMA_DESCRIPTIONS.children),
|
|
83
|
+
events: z
|
|
84
|
+
.record(z.string(), EventModelSchema)
|
|
85
|
+
.describe('Events on the element node such as "click", "hover", or any other event that is applicable to the corresponding HTML element.'),
|
|
86
|
+
classes: z
|
|
87
|
+
.record(z.string().describe('The class name'), z
|
|
88
|
+
.object({ formula: FormulaSchema.nullish() })
|
|
89
|
+
.describe('Formula that will determine when the class is applied. The class is applied when the formula is truthy.'))
|
|
90
|
+
.describe('Classes applied to this element node.'),
|
|
91
|
+
'style-variables': z
|
|
92
|
+
.array(z.object({
|
|
93
|
+
category: StyleTokenCategorySchema.describe('Category of the style token.'),
|
|
94
|
+
name: z.string().describe('Name of the style token.'),
|
|
95
|
+
formula: FormulaSchema.describe('Formula defining the value of the token.'),
|
|
96
|
+
unit: z
|
|
97
|
+
.string()
|
|
98
|
+
.nullish()
|
|
99
|
+
.describe('Unit of the style token, if applicable.'),
|
|
100
|
+
}))
|
|
101
|
+
.nullish()
|
|
102
|
+
.describe('Style variables defined on this element node. Style variables can be used to define design tokens such as colors, spacing, font sizes, and other reusable style values.'),
|
|
103
|
+
condition: FormulaSchema.nullish().describe(SCHEMA_DESCRIPTIONS.condition('element node')),
|
|
104
|
+
repeat: FormulaSchema.nullish().describe(SCHEMA_DESCRIPTIONS.repeat('element node')),
|
|
105
|
+
repeatKey: FormulaSchema.nullish().describe(SCHEMA_DESCRIPTIONS.repeatKey('element node')),
|
|
106
|
+
slot: z
|
|
107
|
+
.string()
|
|
108
|
+
.nullish()
|
|
109
|
+
.describe(SCHEMA_DESCRIPTIONS.slot('element node')),
|
|
110
|
+
variants: z
|
|
111
|
+
.array(StyleVariantSchema)
|
|
112
|
+
.nullish()
|
|
113
|
+
.describe(SCHEMA_DESCRIPTIONS.variants('element node')),
|
|
114
|
+
animations: z
|
|
115
|
+
.record(z.string().describe(SCHEMA_DESCRIPTIONS.animationKey), z.record(z.string().describe(SCHEMA_DESCRIPTIONS.animationKeyframeKey), AnimationKeyframeSchema))
|
|
116
|
+
.nullish()
|
|
117
|
+
.describe(SCHEMA_DESCRIPTIONS.animations('element node')),
|
|
118
|
+
})
|
|
119
|
+
.describe('Schema defining an Element Node Model. An element is a standard HTML element.');
|
|
120
|
+
const ComponentNodeModelSchema = z
|
|
121
|
+
.object({
|
|
122
|
+
type: z.literal('component'),
|
|
123
|
+
name: z.string().describe('Name of the component to render.'),
|
|
124
|
+
package: z
|
|
125
|
+
.string()
|
|
126
|
+
.nullish()
|
|
127
|
+
.describe('Name of the package this component comes from. If empty, it is a component defined in the current project.'),
|
|
128
|
+
attrs: z
|
|
129
|
+
.record(z.string().describe('The name of the attribute'), FormulaSchema.describe('Formula evaluating to the value of the attribute'))
|
|
130
|
+
.describe('Attributes/props passed to the component.'),
|
|
131
|
+
children: z.array(z.string()).describe(SCHEMA_DESCRIPTIONS.children),
|
|
132
|
+
events: z
|
|
133
|
+
.record(z.string(), EventModelSchema)
|
|
134
|
+
.describe('Record of events passed to the component. Only custom events defined by the component can be passed here.'),
|
|
135
|
+
style: NodeStyleModelSchema.nullish().describe(SCHEMA_DESCRIPTIONS.style('component node')),
|
|
136
|
+
condition: FormulaSchema.nullish().describe(SCHEMA_DESCRIPTIONS.condition('component node')),
|
|
137
|
+
repeat: FormulaSchema.nullish().describe(SCHEMA_DESCRIPTIONS.repeat('component node')),
|
|
138
|
+
repeatKey: FormulaSchema.nullish().describe(SCHEMA_DESCRIPTIONS.repeatKey('component node')),
|
|
139
|
+
slot: z
|
|
140
|
+
.string()
|
|
141
|
+
.nullish()
|
|
142
|
+
.describe(SCHEMA_DESCRIPTIONS.slot('component node')),
|
|
143
|
+
variants: z
|
|
144
|
+
.array(StyleVariantSchema)
|
|
145
|
+
.nullish()
|
|
146
|
+
.describe(SCHEMA_DESCRIPTIONS.variants('component node')),
|
|
147
|
+
animations: z
|
|
148
|
+
.record(z.string().describe(SCHEMA_DESCRIPTIONS.animationKey), z.record(z.string().describe(SCHEMA_DESCRIPTIONS.animationKeyframeKey), AnimationKeyframeSchema))
|
|
149
|
+
.nullish()
|
|
150
|
+
.describe(SCHEMA_DESCRIPTIONS.animations('component node')),
|
|
151
|
+
})
|
|
152
|
+
.describe('Schema defining a Component Node Model.');
|
|
153
|
+
export const NodeModelSchema = z.lazy(() => z.union([
|
|
154
|
+
TextNodeModelSchema,
|
|
155
|
+
SlotNodeModelSchema,
|
|
156
|
+
ElementNodeModelSchema,
|
|
157
|
+
ComponentNodeModelSchema,
|
|
158
|
+
]));
|
|
159
|
+
//# sourceMappingURL=node-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-schema.js","sourceRoot":"","sources":["../../../src/component/schemas/node-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAYvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnD,sBAAsB;AACtB,MAAM,oBAAoB,GAA8B,CAAC,CAAC,MAAM,CAC9D,CAAC,CAAC,MAAM,EAAE,EACV,CAAC,CAAC,MAAM,EAAE,CACX,CAAA;AAED,MAAM,uBAAuB,GAAiC,CAAC,CAAC,MAAM,CAAC;IACrE,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,CACP,6EAA6E,CAC9E;IACH,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IACvD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;CACzE,CAAC,CAAA;AAEF,MAAM,wBAAwB,GAAkC,CAAC,CAAC,IAAI,CAAC;IACrE,SAAS;IACT,OAAO;IACP,WAAW;IACX,aAAa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AAQ,CAAC,gBAAgB,CAAC,CAAC;IAC3D,UAAU,EAAE,CAAC;SACV,MAAM,CACL,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC,YAAY,CAAC,EACrD,CAAC,CAAC,MAAM,CACN,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,EAC7D,uBAAuB,CACxB,CACF;SACA,OAAO,EAAE;SACT,QAAQ,CAAC,mBAAmB,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;CAC9D,CAAC;KACD,QAAQ,CAAC,yCAAyC,CAAC,CAAA;AAEtD,MAAM,CAAC,MAAM,eAAe,GAAyB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAC/D,CAAC,CAAC,KAAK,CAAC;IACN,mBAAmB;IACnB,mBAAmB;IACnB,sBAAsB;IACtB,wBAAwB;CACzB,CAAC,CACH,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { FormulaSchema } from './formula-schema';
|
|
3
|
+
import { SCHEMA_DESCRIPTIONS } from './zod-schemas';
|
|
4
|
+
const HeadTagTypesSchema = z
|
|
5
|
+
.enum(['meta', 'link', 'script', 'noscript', 'style'])
|
|
6
|
+
.describe('Available head tags.');
|
|
7
|
+
const MetaEntrySchema = z
|
|
8
|
+
.object({
|
|
9
|
+
tag: HeadTagTypesSchema.describe('Type of the head tag such as meta, link, script.'),
|
|
10
|
+
attrs: z
|
|
11
|
+
.record(z.string().describe('The name of the head tag attribute'), FormulaSchema.describe('The Formula evaluating to the value of the head tag attribute'))
|
|
12
|
+
.describe('Attributes for the head tag.'),
|
|
13
|
+
content: FormulaSchema.describe('Optional content for the head tag, used for tags like style or script.'),
|
|
14
|
+
})
|
|
15
|
+
.describe('Schema defining a single meta entry for the head of the document.');
|
|
16
|
+
// Route Models
|
|
17
|
+
const StaticPathSegmentSchema = z
|
|
18
|
+
.object({
|
|
19
|
+
type: z.literal('static').describe('Static path segment'),
|
|
20
|
+
name: z.string().describe('Name of the static path segment'),
|
|
21
|
+
optional: z
|
|
22
|
+
.boolean()
|
|
23
|
+
.nullish()
|
|
24
|
+
.describe('Indicates if the segment is optional'),
|
|
25
|
+
})
|
|
26
|
+
.describe('Schema for static path segments');
|
|
27
|
+
const DynamicPathSegmentSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
type: z
|
|
30
|
+
.literal('param')
|
|
31
|
+
.describe('Dynamic path segment representing a URL parameter'),
|
|
32
|
+
name: z.string().describe('Name of the URL parameter'),
|
|
33
|
+
testValue: z
|
|
34
|
+
.string()
|
|
35
|
+
.describe(SCHEMA_DESCRIPTIONS.testData('dynamic URL parameter')),
|
|
36
|
+
optional: z
|
|
37
|
+
.boolean()
|
|
38
|
+
.nullish()
|
|
39
|
+
.describe('Indicates if the URL parameter is optional'),
|
|
40
|
+
})
|
|
41
|
+
.describe('Schema for dynamic path segments (URL parameters)');
|
|
42
|
+
export const RouteSchema = z
|
|
43
|
+
.object({
|
|
44
|
+
path: z
|
|
45
|
+
.array(z.union([StaticPathSegmentSchema, DynamicPathSegmentSchema]))
|
|
46
|
+
.describe('Array of path segments defining the route path. Each segment can be static or dynamic (parameterized). Each segment must be unique.'),
|
|
47
|
+
query: z.record(z.string().describe('Name of the query parameter. This must be unique.'), z
|
|
48
|
+
.object({
|
|
49
|
+
name: z
|
|
50
|
+
.string()
|
|
51
|
+
.describe('Name of the query parameter. Same as the key'),
|
|
52
|
+
testValue: z
|
|
53
|
+
.any()
|
|
54
|
+
.describe('Test value for the query parameter. Test data is only used while building the component in the Nordcraft editor.'),
|
|
55
|
+
})
|
|
56
|
+
.describe('Schema defining a query parameter. Nordcraft supports having query parameters with multiple values. Defining a query parameter as an array will allow multiple values for that parameter.')),
|
|
57
|
+
info: z
|
|
58
|
+
.object({
|
|
59
|
+
title: z
|
|
60
|
+
.object({ formula: FormulaSchema })
|
|
61
|
+
.nullish()
|
|
62
|
+
.describe('Title of the page, used in the document title and SEO metadata.'),
|
|
63
|
+
description: z
|
|
64
|
+
.object({ formula: FormulaSchema })
|
|
65
|
+
.nullish()
|
|
66
|
+
.describe('Description of the page, used in SEO metadata and social sharing previews.'),
|
|
67
|
+
icon: z
|
|
68
|
+
.object({ formula: FormulaSchema })
|
|
69
|
+
.nullish()
|
|
70
|
+
.describe('URL to the icon of the page, used in SEO metadata and social sharing previews.'),
|
|
71
|
+
language: z
|
|
72
|
+
.object({ formula: FormulaSchema })
|
|
73
|
+
.nullish()
|
|
74
|
+
.describe('Language of the page, used in the lang attribute of the HTML document.'),
|
|
75
|
+
charset: z
|
|
76
|
+
.object({ formula: FormulaSchema })
|
|
77
|
+
.nullish()
|
|
78
|
+
.describe('Character set of the page, used in the meta charset tag of the HTML document.'),
|
|
79
|
+
meta: z
|
|
80
|
+
.record(z.string().describe('The key of the meta data record.'), MetaEntrySchema)
|
|
81
|
+
.nullish()
|
|
82
|
+
.describe('Additional meta tags to include in the head of the document. Each entry defines a tag and its attributes.'),
|
|
83
|
+
})
|
|
84
|
+
.nullish()
|
|
85
|
+
.describe('Contains additional information for the route such as SEO metadata.'),
|
|
86
|
+
})
|
|
87
|
+
.describe('Schema defining the route information for a page as well as SEO related metadata.');
|
|
88
|
+
//# sourceMappingURL=route-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-schema.js","sourceRoot":"","sources":["../../../src/component/schemas/route-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnD,MAAM,kBAAkB,GAAmB,CAAC;KACzC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;KACrD,QAAQ,CAAC,sB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AAI,EAAE,CAAC;aACJ,MAAM,CACL,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC,EACvD,eAAe,CAChB;aACA,OAAO,EAAE;aACT,QAAQ,CACP,2GAA2G,CAC5G;KACJ,CAAC;SACD,OAAO,EAAE;SACT,QAAQ,CACP,qEAAqE,CACtE;CACJ,CAAC;KACD,QAAQ,CACP,mFAAmF,CACpF,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { FormulaSchema } from './formula-schema';
|
|
3
|
+
import { MetadataSchema, SCHEMA_DESCRIPTIONS } from './zod-schemas';
|
|
4
|
+
export const ComponentVariableSchema = z.object({
|
|
5
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(SCHEMA_DESCRIPTIONS.metadata('variable')),
|
|
6
|
+
initialValue: FormulaSchema.describe('Initial value of the variable'),
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=variable-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variable-schema.js","sourceRoot":"","sources":["../../../src/component/schemas/variable-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnE,MAAM,CAAC,MAAM,uBAAuB,GAAiC,CAAC,CAAC,MAAM,CAAC;IAC5E,qBAAqB,EAAE,cAAc,CAAC,OAAO,EAAE,CAAC,QAAQ,CACtD,mBAAmB,CAAC,QAAQ,CAAC,UAAU,CAAC,CACzC;IACD,YAAY,EAAE,aAAa,CAAC,QAAQ,CAAC,+BAA+B,CAAC;CACtE,CAAC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ActionModelSchema } from './action-schema';
|
|
3
|
+
import { MetadataSchema, SCHEMA_DESCRIPTIONS } from './zod-schemas';
|
|
4
|
+
export const ComponentWorkflowSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(SCHEMA_DESCRIPTIONS.metadata('workflow')),
|
|
7
|
+
name: z.string().describe('Name of the workflow'),
|
|
8
|
+
parameters: z
|
|
9
|
+
.array(z.object({
|
|
10
|
+
name: z.string().describe('Name of the workflow parameter'),
|
|
11
|
+
testValue: z.any().describe('Test value for the workflow parameter'),
|
|
12
|
+
}))
|
|
13
|
+
.describe('Parameters accepted by the workflow'),
|
|
14
|
+
actions: z
|
|
15
|
+
.array(ActionModelSchema)
|
|
16
|
+
.describe('List of actions that make up the workflow'),
|
|
17
|
+
exposeInContext: z
|
|
18
|
+
.boolean()
|
|
19
|
+
.nullish()
|
|
20
|
+
.describe('Indicates if the workflow should be exposed in the context for child components to subscribe to.'),
|
|
21
|
+
})
|
|
22
|
+
.describe('Schema defining a workflow.');
|
|
23
|
+
//# sourceMappingURL=workflow-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-schema.js","sourceRoot":"","sources":["../../../src/component/schemas/workflow-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnE,MAAM,CAAC,MAAM,uBAAuB,GAAiC,CAAC;KACnE,MAAM,CAAC;IACN,qBAAqB,EAAE,cAAc,CAAC,OAAO,EAAE,CAAC,QAAQ,CACtD,mBAAmB,CAAC,QAAQ,CAAC,UAAU,CAAC,CACzC;IACD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IACjD,UAAU,EAAE,CAAC;SACV,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;QAC3D,SAAS,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;KACrE,CAAC,CACH;SACA,QAAQ,CAAC,qCAAqC,CAAC;IAClD,OAAO,EAAE,CAAC;SACP,KAAK,CAAC,iBAAiB,CAAC;SACxB,QAAQ,CAAC,2CAA2C,CAAC;IACxD,eAAe,EAAE,CAAC;SACf,OAAO,EAAE;SACT,OAAO,EAAE;SACT,QAAQ,CACP,kGAAkG,CACnG;CACJ,CAAC;KACD,QAAQ,CAAC,6BAA6B,CAAC,CAAA"}
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export declare const SCHEMA_DESCRIPTIONS: {
|
|
3
|
+
animations: (type: string) => string;
|
|
4
|
+
animationKey: string;
|
|
5
|
+
animationKeyframeKey: string;
|
|
6
|
+
apis: (type: string) => string;
|
|
7
|
+
children: string;
|
|
8
|
+
condition: (type: string) => string;
|
|
9
|
+
formulas: (type: string) => string;
|
|
10
|
+
metadata: (type: string) => string;
|
|
11
|
+
onAttributeChange: (type: string) => string;
|
|
12
|
+
onLoad: (type: string) => string;
|
|
13
|
+
repeat: (type: string) => string;
|
|
14
|
+
repeatKey: (type: string) => string;
|
|
15
|
+
slot: (type: string) => string;
|
|
16
|
+
style: (type: string) => string;
|
|
17
|
+
testData: (type: string) => string;
|
|
18
|
+
variables: (type: string) => string;
|
|
19
|
+
variants: (type: string) => string;
|
|
20
|
+
workflows: (type: string) => string;
|
|
21
|
+
};
|
|
22
|
+
export declare const MetadataSchema: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
23
|
+
comments: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
24
|
+
index: z.ZodNumber;
|
|
25
|
+
text: z.ZodString;
|
|
26
|
+
}, z.core.$strip>>>>;
|
|
27
|
+
}, z.core.$strip>>>;
|