@kubuild/schema 0.6.0 → 0.8.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.
- package/README.md +24 -0
- package/dist/actions.d.ts +26 -2
- package/dist/actions.d.ts.map +1 -1
- package/dist/breakpoints.d.ts +35 -0
- package/dist/breakpoints.d.ts.map +1 -0
- package/dist/builtin-components.d.ts +17 -0
- package/dist/builtin-components.d.ts.map +1 -0
- package/dist/canonical-props.d.ts +39 -0
- package/dist/canonical-props.d.ts.map +1 -0
- package/dist/chunk-MT3M7D67.js +1041 -0
- package/dist/chunk-MT3M7D67.js.map +1 -0
- package/dist/chunk-PECTZDCI.js +1038 -0
- package/dist/chunk-PECTZDCI.js.map +1 -0
- package/dist/document.d.ts +21 -82
- package/dist/document.d.ts.map +1 -1
- package/dist/index.cjs +700 -169
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +447 -747
- package/dist/index.js.map +1 -1
- package/dist/json-schema.d.ts +323 -10
- package/dist/json-schema.d.ts.map +1 -1
- package/dist/template.d.ts +6 -18
- package/dist/template.d.ts.map +1 -1
- package/dist/theme.d.ts +80 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/tracking.d.ts +178 -31
- package/dist/tracking.d.ts.map +1 -1
- package/dist/types.cjs +19 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.ts +331 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/dist/validate.cjs +715 -0
- package/dist/validate.cjs.map +1 -0
- package/dist/validate.d.ts +16 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +53 -0
- package/dist/validate.js.map +1 -0
- package/package.json +22 -2
package/README.md
CHANGED
|
@@ -110,6 +110,30 @@ const pipelineData = {
|
|
|
110
110
|
const pipeline: ActionPipeline = ActionPipelineSchema.parse(pipelineData);
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
+
### Zod-free types and validation (hosts on another zod major)
|
|
114
|
+
|
|
115
|
+
`@kubuild/schema/types` contains plain TypeScript interfaces (`PageDocument`, `Node`,
|
|
116
|
+
`ResponsiveStyles`, `ActionPipeline`, `TemplateRecord`, `Theme`, ...) with no zod import, and
|
|
117
|
+
`@kubuild/schema/validate` exposes validators whose signatures only use those types:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
import type { PageDocument } from '@kubuild/schema/types';
|
|
121
|
+
import { validateDocument } from '@kubuild/schema/validate';
|
|
122
|
+
|
|
123
|
+
const result = validateDocument(json);
|
|
124
|
+
if (result.success) {
|
|
125
|
+
const doc: PageDocument = result.data;
|
|
126
|
+
} else {
|
|
127
|
+
console.log(result.issues); // [{ path: 'document.type', message: '...', code: '...' }]
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Theme tokens
|
|
132
|
+
|
|
133
|
+
`PageDocument.theme` holds `colors`, `fonts`, `radii` and `spacing` tokens. The renderer emits
|
|
134
|
+
them as CSS custom properties (`--kb-color-*`, `--kb-font-*`, `--kb-radius-*`, `--kb-space-*`)
|
|
135
|
+
and styles reference them as `var(--kb-color-primary)` (see `themeTokenRef`).
|
|
136
|
+
|
|
113
137
|
---
|
|
114
138
|
|
|
115
139
|
## 📄 License
|
package/dist/actions.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare const ActionTriggerTypeSchema: z.ZodEnum<{
|
|
|
10
10
|
click: "click";
|
|
11
11
|
focus: "focus";
|
|
12
12
|
submit: "submit";
|
|
13
|
+
expire: "expire";
|
|
13
14
|
}>;
|
|
14
15
|
export type ActionTriggerType = z.infer<typeof ActionTriggerTypeSchema>;
|
|
15
16
|
export type ActionTrigger = ActionTriggerType;
|
|
@@ -20,6 +21,7 @@ export declare const ActionTriggerSchema: z.ZodEnum<{
|
|
|
20
21
|
click: "click";
|
|
21
22
|
focus: "focus";
|
|
22
23
|
submit: "submit";
|
|
24
|
+
expire: "expire";
|
|
23
25
|
}>;
|
|
24
26
|
/**
|
|
25
27
|
* Action Step Types
|
|
@@ -33,6 +35,7 @@ export declare const ActionStepTypeSchema: z.ZodEnum<{
|
|
|
33
35
|
show_toast: "show_toast";
|
|
34
36
|
open_modal: "open_modal";
|
|
35
37
|
close_modal: "close_modal";
|
|
38
|
+
toggle_modal: "toggle_modal";
|
|
36
39
|
copy_clipboard: "copy_clipboard";
|
|
37
40
|
custom_event: "custom_event";
|
|
38
41
|
track_event: "track_event";
|
|
@@ -94,7 +97,7 @@ export declare const ApiRequestStepPayloadSchema: z.ZodObject<{
|
|
|
94
97
|
}>>;
|
|
95
98
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
96
99
|
queryParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
97
|
-
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]
|
|
100
|
+
body: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>>;
|
|
98
101
|
bodyFormat: z.ZodOptional<z.ZodEnum<{
|
|
99
102
|
raw: "raw";
|
|
100
103
|
formData: "formData";
|
|
@@ -203,6 +206,19 @@ export declare const CloseModalStepPayloadSchema: z.ZodObject<{
|
|
|
203
206
|
modalNodeId: z.ZodOptional<z.ZodString>;
|
|
204
207
|
}, z.core.$strip>;
|
|
205
208
|
export type CloseModalStepPayload = z.infer<typeof CloseModalStepPayloadSchema>;
|
|
209
|
+
/**
|
|
210
|
+
* 7b. Toggle Modal Step Payload Schema
|
|
211
|
+
* Flips a modal/drawer/collapsible between open and closed. The renderer's
|
|
212
|
+
* `toggle_modal` runner resolves the target from the first non-empty of
|
|
213
|
+
* `modalId`, `modalNodeId`, `targetNodeId`, `nodeId`.
|
|
214
|
+
*/
|
|
215
|
+
export declare const ToggleModalStepPayloadSchema: z.ZodObject<{
|
|
216
|
+
modalId: z.ZodOptional<z.ZodString>;
|
|
217
|
+
modalNodeId: z.ZodOptional<z.ZodString>;
|
|
218
|
+
targetNodeId: z.ZodOptional<z.ZodString>;
|
|
219
|
+
nodeId: z.ZodOptional<z.ZodString>;
|
|
220
|
+
}, z.core.$strip>;
|
|
221
|
+
export type ToggleModalStepPayload = z.infer<typeof ToggleModalStepPayloadSchema>;
|
|
206
222
|
/**
|
|
207
223
|
* 8. Copy Clipboard Step Payload Schema
|
|
208
224
|
*/
|
|
@@ -240,7 +256,7 @@ export declare const StepPayloadSchemas: {
|
|
|
240
256
|
}>>;
|
|
241
257
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
242
258
|
queryParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
243
|
-
body: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]
|
|
259
|
+
body: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>>;
|
|
244
260
|
bodyFormat: z.ZodOptional<z.ZodEnum<{
|
|
245
261
|
raw: "raw";
|
|
246
262
|
formData: "formData";
|
|
@@ -324,6 +340,12 @@ export declare const StepPayloadSchemas: {
|
|
|
324
340
|
modalId: z.ZodOptional<z.ZodString>;
|
|
325
341
|
modalNodeId: z.ZodOptional<z.ZodString>;
|
|
326
342
|
}, z.core.$strip>;
|
|
343
|
+
readonly toggle_modal: z.ZodObject<{
|
|
344
|
+
modalId: z.ZodOptional<z.ZodString>;
|
|
345
|
+
modalNodeId: z.ZodOptional<z.ZodString>;
|
|
346
|
+
targetNodeId: z.ZodOptional<z.ZodString>;
|
|
347
|
+
nodeId: z.ZodOptional<z.ZodString>;
|
|
348
|
+
}, z.core.$strip>;
|
|
327
349
|
readonly copy_clipboard: z.ZodObject<{
|
|
328
350
|
text: z.ZodOptional<z.ZodString>;
|
|
329
351
|
value: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -347,6 +369,7 @@ export declare const StepPayloadSchemas: {
|
|
|
347
369
|
custom: "custom";
|
|
348
370
|
meta: "meta";
|
|
349
371
|
google: "google";
|
|
372
|
+
gtm: "gtm";
|
|
350
373
|
tiktok: "tiktok";
|
|
351
374
|
}>>>;
|
|
352
375
|
delivery: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
@@ -393,6 +416,7 @@ export declare const ActionPipelineSchema: z.ZodObject<{
|
|
|
393
416
|
click: "click";
|
|
394
417
|
focus: "focus";
|
|
395
418
|
submit: "submit";
|
|
419
|
+
expire: "expire";
|
|
396
420
|
}>;
|
|
397
421
|
label: z.ZodOptional<z.ZodString>;
|
|
398
422
|
debounceMs: z.ZodOptional<z.ZodNumber>;
|
package/dist/actions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AACH,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;EASlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC;AAC9C,eAAO,MAAM,mBAAmB;;;;;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EG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,GAAE,MAAW,GAAG,MAAM,CAMlF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAwB3D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAK3G;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAuB/D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,cAAc,GAAG,cAAc,CAM/E"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single source of truth for responsive breakpoints (STORA-541).
|
|
3
|
+
*
|
|
4
|
+
* Every consumer that maps a screen width to a `ResponsiveStyles` layer — the editor's
|
|
5
|
+
* viewport switcher/resizer, the runtime renderer's `@media` output, the preview adapter
|
|
6
|
+
* and the static code generator — must read these values instead of hard-coding numbers.
|
|
7
|
+
*
|
|
8
|
+
* Ranges are disjoint and mirror the editor's per-viewport preview exactly: a viewport's
|
|
9
|
+
* effective style is `base` merged with *that one* layer (tablet does not cascade into
|
|
10
|
+
* mobile, desktop does not leak into tablet/mobile).
|
|
11
|
+
*
|
|
12
|
+
* mobile : width < 768px
|
|
13
|
+
* tablet : 768 <= width < 1024px
|
|
14
|
+
* desktop : 1024 <= width
|
|
15
|
+
*
|
|
16
|
+
* 768/1024 were chosen over the older 640/1024 code-generator values because they match
|
|
17
|
+
* the published docs, the editor's existing width→viewport logic and its default tablet
|
|
18
|
+
* preview width (768px), so what users see in the editor is what ships.
|
|
19
|
+
*/
|
|
20
|
+
/** Viewport layers that carry breakpoint overrides (`base` applies everywhere). */
|
|
21
|
+
export type BreakpointName = 'desktop' | 'tablet' | 'mobile';
|
|
22
|
+
export interface BreakpointRange {
|
|
23
|
+
/** Inclusive lower bound in CSS px. */
|
|
24
|
+
readonly minWidth: number;
|
|
25
|
+
/** Inclusive upper bound in CSS px, or `null` for unbounded. */
|
|
26
|
+
readonly maxWidth: number | null;
|
|
27
|
+
}
|
|
28
|
+
export declare const BREAKPOINTS: Readonly<Record<BreakpointName, BreakpointRange>>;
|
|
29
|
+
/** Order used for emitting CSS and iterating layers (widest first). */
|
|
30
|
+
export declare const BREAKPOINT_ORDER: readonly BreakpointName[];
|
|
31
|
+
/** CSS media query (without the `@media` keyword) for each breakpoint layer. */
|
|
32
|
+
export declare const BREAKPOINT_MEDIA_QUERIES: Readonly<Record<BreakpointName, string>>;
|
|
33
|
+
/** Resolve which breakpoint layer applies at a given viewport width in CSS px. */
|
|
34
|
+
export declare function getBreakpointForWidth(width: number): BreakpointName;
|
|
35
|
+
//# sourceMappingURL=breakpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../src/breakpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,mFAAmF;AACnF,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7D,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC,CAIxE,CAAC;AAEH,uEAAuE;AACvE,eAAO,MAAM,gBAAgB,EAAE,SAAS,cAAc,EAIpD,CAAC;AAUH,gFAAgF;AAChF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAM5E,CAAC;AAEH,kFAAkF;AAClF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAInE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical list of built-in component type names shipped by `@kubuild/components`'
|
|
3
|
+
* `createDefaultComponentRegistry()`.
|
|
4
|
+
*
|
|
5
|
+
* It lives in `@kubuild/schema` (the bottom of the dependency graph) so that
|
|
6
|
+
* `@kubuild/core` can use it — e.g. to tell built-in from custom components in
|
|
7
|
+
* `extractTemplateRequirements` — without depending on `@kubuild/components`, which
|
|
8
|
+
* would invert the `schema → core → components` direction. `@kubuild/components`
|
|
9
|
+
* derives its `CoreComponentType` union from this list and a test there asserts the
|
|
10
|
+
* default registry registers exactly these types, so the two cannot drift apart.
|
|
11
|
+
*
|
|
12
|
+
* When adding a built-in component definition, add its type here as well.
|
|
13
|
+
*/
|
|
14
|
+
export declare const BUILTIN_COMPONENT_TYPES: readonly ["page", "section", "container", "columns", "flex", "grid", "heading", "text", "paragraph", "link", "blockquote", "badge", "code-block", "image", "video", "icon", "html-embed", "button", "button-submit", "form", "input", "textarea", "select", "checkbox", "switch", "radio-group", "radio", "radio-item", "file-upload", "collection", "list", "list-item", "table", "table-row", "table-cell", "modal", "drawer", "collapsible", "countdown", "accordion", "accordion-item", "tabs", "tab-panel", "carousel", "rating", "divider", "spacer"];
|
|
15
|
+
export type BuiltinComponentType = (typeof BUILTIN_COMPONENT_TYPES)[number];
|
|
16
|
+
export declare function isBuiltinComponentType(type: unknown): type is BuiltinComponentType;
|
|
17
|
+
//# sourceMappingURL=builtin-components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-components.d.ts","sourceRoot":"","sources":["../src/builtin-components.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,6hBAuD1B,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,oBAAoB,CAElF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical prop names for text-bearing components (STORA-550).
|
|
3
|
+
*
|
|
4
|
+
* Historically the renderer accepted several names for the same visible text
|
|
5
|
+
* (`text` / `content`, `text` / `label`, `quote` / `text`, ...). Each component now has
|
|
6
|
+
* exactly one canonical name; the others are deprecated aliases that
|
|
7
|
+
* - the `1.1.0 -> 1.2.0` document migration moves onto the canonical name, and
|
|
8
|
+
* - the renderer still reads (for one minor version) while emitting a
|
|
9
|
+
* `DEPRECATED_PROP` diagnostic.
|
|
10
|
+
*
|
|
11
|
+
* Pure data, no zod — safe to import from any layer.
|
|
12
|
+
*/
|
|
13
|
+
export interface CanonicalTextPropRule {
|
|
14
|
+
/** The one prop name authors, templates and the editor should write. */
|
|
15
|
+
canonical: string;
|
|
16
|
+
/** Deprecated names still read for backwards compatibility. */
|
|
17
|
+
aliases: readonly string[];
|
|
18
|
+
/**
|
|
19
|
+
* Order in which the pre-1.2.0 renderer resolved the visible value (first defined
|
|
20
|
+
* wins). The migration uses this so a migrated document renders exactly as before.
|
|
21
|
+
*/
|
|
22
|
+
legacyReadOrder: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
export declare const CANONICAL_TEXT_PROPS: Readonly<Record<string, CanonicalTextPropRule>>;
|
|
25
|
+
/** Returns the canonical text prop rule for a component type, if it has one. */
|
|
26
|
+
export declare function getCanonicalTextPropRule(componentType: string): CanonicalTextPropRule | undefined;
|
|
27
|
+
export interface DeprecatedPropUsage {
|
|
28
|
+
/** Alias prop present on the node. */
|
|
29
|
+
propName: string;
|
|
30
|
+
/** Canonical prop name that should be used instead. */
|
|
31
|
+
canonicalName: string;
|
|
32
|
+
/** True when the canonical prop is absent, i.e. the alias is what actually renders. */
|
|
33
|
+
inEffect: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Lists deprecated alias props present on a node's props (does not mutate).
|
|
37
|
+
*/
|
|
38
|
+
export declare function findDeprecatedPropAliases(componentType: string, props: Record<string, unknown> | undefined): DeprecatedPropUsage[];
|
|
39
|
+
//# sourceMappingURL=canonical-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-props.d.ts","sourceRoot":"","sources":["../src/canonical-props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B;;;OAGG;IACH,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAgB/E,CAAC;AAEH,gFAAgF;AAChF,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAIjG;AAED,MAAM,WAAW,mBAAmB;IAClC,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,aAAa,EAAE,MAAM,CAAC;IACtB,uFAAuF;IACvF,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACzC,mBAAmB,EAAE,CAYvB"}
|