@nordcraft/core 1.0.77 → 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 +3 -3
- package/dist/api/apiTypes.d.ts +2 -2
- package/dist/component/component.types.d.ts +8 -1
- package/dist/component/component.types.js.map +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 -1077
- package/dist/component/schemas/zod-schemas.js.map +1 -1
- package/dist/styling/style.css.d.ts +3 -1
- package/dist/styling/style.css.js +124 -128
- package/dist/styling/style.css.js.map +1 -1
- package/dist/styling/theme.const.d.ts +2 -0
- package/dist/styling/theme.const.js +2 -0
- package/dist/styling/theme.const.js.map +1 -1
- package/dist/styling/theme.js +2 -2
- package/dist/styling/theme.js.map +1 -1
- package/dist/styling/variantSelector.d.ts +1 -8
- package/dist/styling/variantSelector.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 +6 -1
- package/src/api/apiTypes.ts +2 -2
- package/src/component/component.types.ts +9 -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 -1489
- package/src/styling/style.css.test.ts +929 -0
- package/src/styling/style.css.ts +148 -152
- package/src/styling/theme.const.ts +3 -0
- package/src/styling/theme.test.ts +4 -4
- package/src/styling/theme.ts +2 -2
- package/src/styling/variantSelector.ts +1 -7
- package/src/types.ts +1 -1
- package/src/utils/collections.ts +4 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type { StyleTokenCategory } from '../../styling/theme'
|
|
3
|
+
import type { StyleVariant } from '../../styling/variantSelector'
|
|
4
|
+
import type {
|
|
5
|
+
AnimationKeyframe,
|
|
6
|
+
ComponentNodeModel,
|
|
7
|
+
ElementNodeModel,
|
|
8
|
+
NodeModel,
|
|
9
|
+
NodeStyleModel,
|
|
10
|
+
SlotNodeModel,
|
|
11
|
+
TextNodeModel,
|
|
12
|
+
} from '../component.types'
|
|
13
|
+
import { EventModelSchema } from './event-schema'
|
|
14
|
+
import { FormulaSchema } from './formula-schema'
|
|
15
|
+
import { SCHEMA_DESCRIPTIONS } from './zod-schemas'
|
|
16
|
+
|
|
17
|
+
// Style and Animation
|
|
18
|
+
const NodeStyleModelSchema: z.ZodType<NodeStyleModel> = z.record(
|
|
19
|
+
z.string(),
|
|
20
|
+
z.string(),
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const AnimationKeyframeSchema: z.ZodType<AnimationKeyframe> = z.object({
|
|
24
|
+
position: z
|
|
25
|
+
.number()
|
|
26
|
+
.describe(
|
|
27
|
+
"Value between 0 and 1 representing the keyframe's position in the animation",
|
|
28
|
+
),
|
|
29
|
+
key: z.string().describe('CSS property to be animated'),
|
|
30
|
+
value: z.string().describe('Value of the CSS property at this keyframe'),
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const StyleTokenCategorySchema: z.ZodType<StyleTokenCategory> = z.enum([
|
|
34
|
+
'spacing',
|
|
35
|
+
'color',
|
|
36
|
+
'font-size',
|
|
37
|
+
'font-weight',
|
|
38
|
+
'z-index',
|
|
39
|
+
'border-radius',
|
|
40
|
+
'shadow',
|
|
41
|
+
])
|
|
42
|
+
|
|
43
|
+
const StyleVariantSchema: z.ZodType<StyleVariant> = z.object({
|
|
44
|
+
style: NodeStyleModelSchema,
|
|
45
|
+
id: z.string().nullish(),
|
|
46
|
+
className: z.string().nullish(),
|
|
47
|
+
hover: z.boolean().nullish(),
|
|
48
|
+
active: z.boolean().nullish(),
|
|
49
|
+
focus: z.boolean().nullish(),
|
|
50
|
+
focusWithin: z.boolean().nullish(),
|
|
51
|
+
disabled: z.boolean().nullish(),
|
|
52
|
+
empty: z.boolean().nullish(),
|
|
53
|
+
firstChild: z.boolean().nullish(),
|
|
54
|
+
lastChild: z.boolean().nullish(),
|
|
55
|
+
evenChild: z.boolean().nullish(),
|
|
56
|
+
startingStyle: z.boolean().nullish(),
|
|
57
|
+
mediaQuery: z
|
|
58
|
+
.object({
|
|
59
|
+
'min-width': z.string().nullish(),
|
|
60
|
+
'max-width': z.string().nullish(),
|
|
61
|
+
'min-height': z.string().nullish(),
|
|
62
|
+
'max-height': z.string().nullish(),
|
|
63
|
+
'prefers-reduced-motion': z.enum(['reduce', 'no-preference']).nullish(),
|
|
64
|
+
})
|
|
65
|
+
.nullish(),
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
// Node Models
|
|
69
|
+
const TextNodeModelSchema: z.ZodType<TextNodeModel> = z
|
|
70
|
+
.object({
|
|
71
|
+
type: z.literal('text'),
|
|
72
|
+
value: FormulaSchema.describe('Formula evaluating to the text content.'),
|
|
73
|
+
condition: FormulaSchema.nullish().describe(
|
|
74
|
+
SCHEMA_DESCRIPTIONS.condition('text node'),
|
|
75
|
+
),
|
|
76
|
+
repeat: FormulaSchema.nullish().describe(
|
|
77
|
+
SCHEMA_DESCRIPTIONS.repeat('text node'),
|
|
78
|
+
),
|
|
79
|
+
repeatKey: FormulaSchema.nullish().describe(
|
|
80
|
+
SCHEMA_DESCRIPTIONS.repeatKey('text node'),
|
|
81
|
+
),
|
|
82
|
+
slot: z.string().nullish().describe(SCHEMA_DESCRIPTIONS.slot('text node')),
|
|
83
|
+
})
|
|
84
|
+
.describe(
|
|
85
|
+
'Schema defining a Text Node Model. A text node represents text content inside of an element.',
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
const SlotNodeModelSchema: z.ZodType<SlotNodeModel> = z
|
|
89
|
+
.object({
|
|
90
|
+
type: z.literal('slot'),
|
|
91
|
+
children: z
|
|
92
|
+
.array(z.string())
|
|
93
|
+
.describe(
|
|
94
|
+
`${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.`,
|
|
95
|
+
),
|
|
96
|
+
name: z
|
|
97
|
+
.string()
|
|
98
|
+
.nullish()
|
|
99
|
+
.describe(
|
|
100
|
+
'Name of the slot. This is the name that must be used when passing content to this slot.',
|
|
101
|
+
),
|
|
102
|
+
condition: FormulaSchema.nullish().describe(
|
|
103
|
+
SCHEMA_DESCRIPTIONS.condition('slot node'),
|
|
104
|
+
),
|
|
105
|
+
slot: z.string().nullish().describe(SCHEMA_DESCRIPTIONS.slot('slot node')),
|
|
106
|
+
})
|
|
107
|
+
.describe(
|
|
108
|
+
'Schema defining a Slot Node Model. A slot is a placeholder for child nodes. Slot nodes can only exist inside components.',
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
const ElementNodeModelSchema: z.ZodType<ElementNodeModel> = z
|
|
112
|
+
.object({
|
|
113
|
+
type: z.literal('element'),
|
|
114
|
+
tag: z
|
|
115
|
+
.string()
|
|
116
|
+
.describe(
|
|
117
|
+
'The HTML tag of the element node, such as "div", "span", "img", "a", etc.',
|
|
118
|
+
),
|
|
119
|
+
attrs: z
|
|
120
|
+
.record(z.string(), FormulaSchema)
|
|
121
|
+
.describe(
|
|
122
|
+
'Attributes of the element node such as "src", "alt", "href", or any other attribute that is applicable to the corresponding HTML element.',
|
|
123
|
+
),
|
|
124
|
+
style: NodeStyleModelSchema.describe(
|
|
125
|
+
SCHEMA_DESCRIPTIONS.style('element node'),
|
|
126
|
+
),
|
|
127
|
+
children: z.array(z.string()).describe(SCHEMA_DESCRIPTIONS.children),
|
|
128
|
+
events: z
|
|
129
|
+
.record(z.string(), EventModelSchema)
|
|
130
|
+
.describe(
|
|
131
|
+
'Events on the element node such as "click", "hover", or any other event that is applicable to the corresponding HTML element.',
|
|
132
|
+
),
|
|
133
|
+
classes: z
|
|
134
|
+
.record(
|
|
135
|
+
z.string().describe('The class name'),
|
|
136
|
+
z
|
|
137
|
+
.object({ formula: FormulaSchema.nullish() })
|
|
138
|
+
.describe(
|
|
139
|
+
'Formula that will determine when the class is applied. The class is applied when the formula is truthy.',
|
|
140
|
+
),
|
|
141
|
+
)
|
|
142
|
+
.describe('Classes applied to this element node.'),
|
|
143
|
+
'style-variables': z
|
|
144
|
+
.array(
|
|
145
|
+
z.object({
|
|
146
|
+
category: StyleTokenCategorySchema.describe(
|
|
147
|
+
'Category of the style token.',
|
|
148
|
+
),
|
|
149
|
+
name: z.string().describe('Name of the style token.'),
|
|
150
|
+
formula: FormulaSchema.describe(
|
|
151
|
+
'Formula defining the value of the token.',
|
|
152
|
+
),
|
|
153
|
+
unit: z
|
|
154
|
+
.string()
|
|
155
|
+
.nullish()
|
|
156
|
+
.describe('Unit of the style token, if applicable.'),
|
|
157
|
+
}),
|
|
158
|
+
)
|
|
159
|
+
.nullish()
|
|
160
|
+
.describe(
|
|
161
|
+
'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.',
|
|
162
|
+
),
|
|
163
|
+
condition: FormulaSchema.nullish().describe(
|
|
164
|
+
SCHEMA_DESCRIPTIONS.condition('element node'),
|
|
165
|
+
),
|
|
166
|
+
repeat: FormulaSchema.nullish().describe(
|
|
167
|
+
SCHEMA_DESCRIPTIONS.repeat('element node'),
|
|
168
|
+
),
|
|
169
|
+
repeatKey: FormulaSchema.nullish().describe(
|
|
170
|
+
SCHEMA_DESCRIPTIONS.repeatKey('element node'),
|
|
171
|
+
),
|
|
172
|
+
slot: z
|
|
173
|
+
.string()
|
|
174
|
+
.nullish()
|
|
175
|
+
.describe(SCHEMA_DESCRIPTIONS.slot('element node')),
|
|
176
|
+
variants: z
|
|
177
|
+
.array(StyleVariantSchema)
|
|
178
|
+
.nullish()
|
|
179
|
+
.describe(SCHEMA_DESCRIPTIONS.variants('element node')),
|
|
180
|
+
animations: z
|
|
181
|
+
.record(
|
|
182
|
+
z.string().describe(SCHEMA_DESCRIPTIONS.animationKey),
|
|
183
|
+
z.record(
|
|
184
|
+
z.string().describe(SCHEMA_DESCRIPTIONS.animationKeyframeKey),
|
|
185
|
+
AnimationKeyframeSchema,
|
|
186
|
+
),
|
|
187
|
+
)
|
|
188
|
+
.nullish()
|
|
189
|
+
.describe(SCHEMA_DESCRIPTIONS.animations('element node')),
|
|
190
|
+
})
|
|
191
|
+
.describe(
|
|
192
|
+
'Schema defining an Element Node Model. An element is a standard HTML element.',
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
const ComponentNodeModelSchema: z.ZodType<ComponentNodeModel> = z
|
|
196
|
+
.object({
|
|
197
|
+
type: z.literal('component'),
|
|
198
|
+
name: z.string().describe('Name of the component to render.'),
|
|
199
|
+
package: z
|
|
200
|
+
.string()
|
|
201
|
+
.nullish()
|
|
202
|
+
.describe(
|
|
203
|
+
'Name of the package this component comes from. If empty, it is a component defined in the current project.',
|
|
204
|
+
),
|
|
205
|
+
attrs: z
|
|
206
|
+
.record(
|
|
207
|
+
z.string().describe('The name of the attribute'),
|
|
208
|
+
FormulaSchema.describe(
|
|
209
|
+
'Formula evaluating to the value of the attribute',
|
|
210
|
+
),
|
|
211
|
+
)
|
|
212
|
+
.describe('Attributes/props passed to the component.'),
|
|
213
|
+
children: z.array(z.string()).describe(SCHEMA_DESCRIPTIONS.children),
|
|
214
|
+
events: z
|
|
215
|
+
.record(z.string(), EventModelSchema)
|
|
216
|
+
.describe(
|
|
217
|
+
'Record of events passed to the component. Only custom events defined by the component can be passed here.',
|
|
218
|
+
),
|
|
219
|
+
style: NodeStyleModelSchema.nullish().describe(
|
|
220
|
+
SCHEMA_DESCRIPTIONS.style('component node'),
|
|
221
|
+
),
|
|
222
|
+
condition: FormulaSchema.nullish().describe(
|
|
223
|
+
SCHEMA_DESCRIPTIONS.condition('component node'),
|
|
224
|
+
),
|
|
225
|
+
repeat: FormulaSchema.nullish().describe(
|
|
226
|
+
SCHEMA_DESCRIPTIONS.repeat('component node'),
|
|
227
|
+
),
|
|
228
|
+
repeatKey: FormulaSchema.nullish().describe(
|
|
229
|
+
SCHEMA_DESCRIPTIONS.repeatKey('component node'),
|
|
230
|
+
),
|
|
231
|
+
slot: z
|
|
232
|
+
.string()
|
|
233
|
+
.nullish()
|
|
234
|
+
.describe(SCHEMA_DESCRIPTIONS.slot('component node')),
|
|
235
|
+
variants: z
|
|
236
|
+
.array(StyleVariantSchema)
|
|
237
|
+
.nullish()
|
|
238
|
+
.describe(SCHEMA_DESCRIPTIONS.variants('component node')),
|
|
239
|
+
animations: z
|
|
240
|
+
.record(
|
|
241
|
+
z.string().describe(SCHEMA_DESCRIPTIONS.animationKey),
|
|
242
|
+
z.record(
|
|
243
|
+
z.string().describe(SCHEMA_DESCRIPTIONS.animationKeyframeKey),
|
|
244
|
+
AnimationKeyframeSchema,
|
|
245
|
+
),
|
|
246
|
+
)
|
|
247
|
+
.nullish()
|
|
248
|
+
.describe(SCHEMA_DESCRIPTIONS.animations('component node')),
|
|
249
|
+
})
|
|
250
|
+
.describe('Schema defining a Component Node Model.')
|
|
251
|
+
|
|
252
|
+
export const NodeModelSchema: z.ZodType<NodeModel> = z.lazy(() =>
|
|
253
|
+
z.union([
|
|
254
|
+
TextNodeModelSchema,
|
|
255
|
+
SlotNodeModelSchema,
|
|
256
|
+
ElementNodeModelSchema,
|
|
257
|
+
ComponentNodeModelSchema,
|
|
258
|
+
]),
|
|
259
|
+
)
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type {
|
|
3
|
+
DynamicPathSegment,
|
|
4
|
+
MetaEntry,
|
|
5
|
+
RouteDeclaration,
|
|
6
|
+
StaticPathSegment,
|
|
7
|
+
} from '../component.types'
|
|
8
|
+
import { FormulaSchema } from './formula-schema'
|
|
9
|
+
import { SCHEMA_DESCRIPTIONS } from './zod-schemas'
|
|
10
|
+
|
|
11
|
+
const HeadTagTypesSchema: z.ZodType<any> = z
|
|
12
|
+
.enum(['meta', 'link', 'script', 'noscript', 'style'])
|
|
13
|
+
.describe('Available head tags.')
|
|
14
|
+
|
|
15
|
+
const MetaEntrySchema: z.ZodType<MetaEntry> = z
|
|
16
|
+
.object({
|
|
17
|
+
tag: HeadTagTypesSchema.describe(
|
|
18
|
+
'Type of the head tag such as meta, link, script.',
|
|
19
|
+
),
|
|
20
|
+
attrs: z
|
|
21
|
+
.record(
|
|
22
|
+
z.string().describe('The name of the head tag attribute'),
|
|
23
|
+
FormulaSchema.describe(
|
|
24
|
+
'The Formula evaluating to the value of the head tag attribute',
|
|
25
|
+
),
|
|
26
|
+
)
|
|
27
|
+
.describe('Attributes for the head tag.'),
|
|
28
|
+
content: FormulaSchema.describe(
|
|
29
|
+
'Optional content for the head tag, used for tags like style or script.',
|
|
30
|
+
),
|
|
31
|
+
})
|
|
32
|
+
.describe('Schema defining a single meta entry for the head of the document.')
|
|
33
|
+
|
|
34
|
+
// Route Models
|
|
35
|
+
const StaticPathSegmentSchema: z.ZodType<StaticPathSegment> = z
|
|
36
|
+
.object({
|
|
37
|
+
type: z.literal('static').describe('Static path segment'),
|
|
38
|
+
name: z.string().describe('Name of the static path segment'),
|
|
39
|
+
optional: z
|
|
40
|
+
.boolean()
|
|
41
|
+
.nullish()
|
|
42
|
+
.describe('Indicates if the segment is optional'),
|
|
43
|
+
})
|
|
44
|
+
.describe('Schema for static path segments')
|
|
45
|
+
|
|
46
|
+
const DynamicPathSegmentSchema: z.ZodType<DynamicPathSegment> = z
|
|
47
|
+
.object({
|
|
48
|
+
type: z
|
|
49
|
+
.literal('param')
|
|
50
|
+
.describe('Dynamic path segment representing a URL parameter'),
|
|
51
|
+
name: z.string().describe('Name of the URL parameter'),
|
|
52
|
+
testValue: z
|
|
53
|
+
.string()
|
|
54
|
+
.describe(SCHEMA_DESCRIPTIONS.testData('dynamic URL parameter')),
|
|
55
|
+
optional: z
|
|
56
|
+
.boolean()
|
|
57
|
+
.nullish()
|
|
58
|
+
.describe('Indicates if the URL parameter is optional'),
|
|
59
|
+
})
|
|
60
|
+
.describe('Schema for dynamic path segments (URL parameters)')
|
|
61
|
+
|
|
62
|
+
export const RouteSchema: z.ZodType<RouteDeclaration> = z
|
|
63
|
+
.object({
|
|
64
|
+
path: z
|
|
65
|
+
.array(z.union([StaticPathSegmentSchema, DynamicPathSegmentSchema]))
|
|
66
|
+
.describe(
|
|
67
|
+
'Array of path segments defining the route path. Each segment can be static or dynamic (parameterized). Each segment must be unique.',
|
|
68
|
+
),
|
|
69
|
+
query: z.record(
|
|
70
|
+
z.string().describe('Name of the query parameter. This must be unique.'),
|
|
71
|
+
z
|
|
72
|
+
.object({
|
|
73
|
+
name: z
|
|
74
|
+
.string()
|
|
75
|
+
.describe('Name of the query parameter. Same as the key'),
|
|
76
|
+
testValue: z
|
|
77
|
+
.any()
|
|
78
|
+
.describe(
|
|
79
|
+
'Test value for the query parameter. Test data is only used while building the component in the Nordcraft editor.',
|
|
80
|
+
),
|
|
81
|
+
})
|
|
82
|
+
.describe(
|
|
83
|
+
'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.',
|
|
84
|
+
),
|
|
85
|
+
),
|
|
86
|
+
info: z
|
|
87
|
+
.object({
|
|
88
|
+
title: z
|
|
89
|
+
.object({ formula: FormulaSchema })
|
|
90
|
+
.nullish()
|
|
91
|
+
.describe(
|
|
92
|
+
'Title of the page, used in the document title and SEO metadata.',
|
|
93
|
+
),
|
|
94
|
+
description: z
|
|
95
|
+
.object({ formula: FormulaSchema })
|
|
96
|
+
.nullish()
|
|
97
|
+
.describe(
|
|
98
|
+
'Description of the page, used in SEO metadata and social sharing previews.',
|
|
99
|
+
),
|
|
100
|
+
icon: z
|
|
101
|
+
.object({ formula: FormulaSchema })
|
|
102
|
+
.nullish()
|
|
103
|
+
.describe(
|
|
104
|
+
'URL to the icon of the page, used in SEO metadata and social sharing previews.',
|
|
105
|
+
),
|
|
106
|
+
language: z
|
|
107
|
+
.object({ formula: FormulaSchema })
|
|
108
|
+
.nullish()
|
|
109
|
+
.describe(
|
|
110
|
+
'Language of the page, used in the lang attribute of the HTML document.',
|
|
111
|
+
),
|
|
112
|
+
charset: z
|
|
113
|
+
.object({ formula: FormulaSchema })
|
|
114
|
+
.nullish()
|
|
115
|
+
.describe(
|
|
116
|
+
'Character set of the page, used in the meta charset tag of the HTML document.',
|
|
117
|
+
),
|
|
118
|
+
meta: z
|
|
119
|
+
.record(
|
|
120
|
+
z.string().describe('The key of the meta data record.'),
|
|
121
|
+
MetaEntrySchema,
|
|
122
|
+
)
|
|
123
|
+
.nullish()
|
|
124
|
+
.describe(
|
|
125
|
+
'Additional meta tags to include in the head of the document. Each entry defines a tag and its attributes.',
|
|
126
|
+
),
|
|
127
|
+
})
|
|
128
|
+
.nullish()
|
|
129
|
+
.describe(
|
|
130
|
+
'Contains additional information for the route such as SEO metadata.',
|
|
131
|
+
),
|
|
132
|
+
})
|
|
133
|
+
.describe(
|
|
134
|
+
'Schema defining the route information for a page as well as SEO related metadata.',
|
|
135
|
+
)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type { ComponentVariable } from '../component.types'
|
|
3
|
+
import { FormulaSchema } from './formula-schema'
|
|
4
|
+
import { MetadataSchema, SCHEMA_DESCRIPTIONS } from './zod-schemas'
|
|
5
|
+
|
|
6
|
+
export const ComponentVariableSchema: z.ZodType<ComponentVariable> = z.object({
|
|
7
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(
|
|
8
|
+
SCHEMA_DESCRIPTIONS.metadata('variable'),
|
|
9
|
+
),
|
|
10
|
+
initialValue: FormulaSchema.describe('Initial value of the variable'),
|
|
11
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import type { ComponentWorkflow } from '../component.types'
|
|
3
|
+
import { ActionModelSchema } from './action-schema'
|
|
4
|
+
import { MetadataSchema, SCHEMA_DESCRIPTIONS } from './zod-schemas'
|
|
5
|
+
|
|
6
|
+
export const ComponentWorkflowSchema: z.ZodType<ComponentWorkflow> = z
|
|
7
|
+
.object({
|
|
8
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(
|
|
9
|
+
SCHEMA_DESCRIPTIONS.metadata('workflow'),
|
|
10
|
+
),
|
|
11
|
+
name: z.string().describe('Name of the workflow'),
|
|
12
|
+
parameters: z
|
|
13
|
+
.array(
|
|
14
|
+
z.object({
|
|
15
|
+
name: z.string().describe('Name of the workflow parameter'),
|
|
16
|
+
testValue: z.any().describe('Test value for the workflow parameter'),
|
|
17
|
+
}),
|
|
18
|
+
)
|
|
19
|
+
.describe('Parameters accepted by the workflow'),
|
|
20
|
+
actions: z
|
|
21
|
+
.array(ActionModelSchema)
|
|
22
|
+
.describe('List of actions that make up the workflow'),
|
|
23
|
+
exposeInContext: z
|
|
24
|
+
.boolean()
|
|
25
|
+
.nullish()
|
|
26
|
+
.describe(
|
|
27
|
+
'Indicates if the workflow should be exposed in the context for child components to subscribe to.',
|
|
28
|
+
),
|
|
29
|
+
})
|
|
30
|
+
.describe('Schema defining a workflow.')
|