@kubuild/schema 0.0.1
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/document.d.ts +145 -0
- package/dist/document.d.ts.map +1 -0
- package/dist/fixtures.d.ts +3 -0
- package/dist/fixtures.d.ts.map +1 -0
- package/dist/index.cjs +926 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +862 -0
- package/dist/index.js.map +1 -0
- package/dist/json-schema.d.ts +971 -0
- package/dist/json-schema.d.ts.map +1 -0
- package/dist/manifest.d.ts +28 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/template.d.ts +127 -0
- package/dist/template.d.ts.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SCHEMA_NAME: "stora.page";
|
|
3
|
+
export declare const CURRENT_SCHEMA_VERSION: "1.0.0";
|
|
4
|
+
/**
|
|
5
|
+
* Asset Reference Schema
|
|
6
|
+
* Represents a reference to an asset stored either locally within the .stora package or hosted externally.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AssetReferenceSchema: z.ZodObject<{
|
|
9
|
+
type: z.ZodLiteral<"asset">;
|
|
10
|
+
assetId: z.ZodString;
|
|
11
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
12
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
13
|
+
fallbackUrl: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export type AssetReference = z.infer<typeof AssetReferenceSchema>;
|
|
16
|
+
/**
|
|
17
|
+
* Variable Binding Schema
|
|
18
|
+
* Represents a dynamic runtime variable replacement (e.g. {{ site.name }}).
|
|
19
|
+
*/
|
|
20
|
+
export declare const VariableBindingSchema: z.ZodObject<{
|
|
21
|
+
type: z.ZodLiteral<"variable">;
|
|
22
|
+
key: z.ZodString;
|
|
23
|
+
fallback: z.ZodOptional<z.ZodUnknown>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export type VariableBinding = z.infer<typeof VariableBindingSchema>;
|
|
26
|
+
/**
|
|
27
|
+
* Action Binding Schema
|
|
28
|
+
* Represents an interactive action triggerable by UI components (e.g. navigation, modal, custom event).
|
|
29
|
+
*/
|
|
30
|
+
export declare const ActionBindingSchema: z.ZodObject<{
|
|
31
|
+
type: z.ZodString;
|
|
32
|
+
payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type ActionBinding = z.infer<typeof ActionBindingSchema>;
|
|
35
|
+
export declare const StyleValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>;
|
|
36
|
+
export declare const StyleDefinitionSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>>;
|
|
37
|
+
export type StyleDefinition = Record<string, string | number | boolean | null | undefined>;
|
|
38
|
+
/**
|
|
39
|
+
* Pseudo-state style definitions keyed by CSS pseudo-class selector
|
|
40
|
+
* (e.g. `:hover`, `:focus`, `:active`). Each entry is a style layer applied
|
|
41
|
+
* on top of the resolved breakpoint styles when the state is active.
|
|
42
|
+
*/
|
|
43
|
+
export declare const PseudoStateStylesSchema: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>>>;
|
|
44
|
+
export type PseudoStateStyles = Record<string, StyleDefinition>;
|
|
45
|
+
/**
|
|
46
|
+
* Responsive Styles Schema
|
|
47
|
+
* Breakpoint-specific style definitions: base (all viewports), desktop, tablet, and mobile.
|
|
48
|
+
* Optionally carries `states` — pseudo-class style layers (e.g. `:hover`).
|
|
49
|
+
*/
|
|
50
|
+
export declare const ResponsiveStylesSchema: z.ZodDefault<z.ZodObject<{
|
|
51
|
+
base: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>>>;
|
|
52
|
+
desktop: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>>>;
|
|
53
|
+
tablet: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>>>;
|
|
54
|
+
mobile: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>>>;
|
|
55
|
+
states: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>>>>;
|
|
56
|
+
}, z.core.$catchall<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>>>>>;
|
|
57
|
+
export type ResponsiveStyles = z.infer<typeof ResponsiveStylesSchema>;
|
|
58
|
+
/**
|
|
59
|
+
* Recursive Node Type Definition
|
|
60
|
+
*/
|
|
61
|
+
export type Node = {
|
|
62
|
+
id: string;
|
|
63
|
+
type: string;
|
|
64
|
+
props?: Record<string, unknown>;
|
|
65
|
+
styles?: ResponsiveStyles;
|
|
66
|
+
children?: Node[];
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Recursive Node Schema
|
|
70
|
+
* Represents any element/node in the document tree.
|
|
71
|
+
* Node IDs are deterministic, independent of React keys, and unique across the document.
|
|
72
|
+
*/
|
|
73
|
+
export declare const NodeSchema: z.ZodType<Node>;
|
|
74
|
+
export type RootPageNode = Node & {
|
|
75
|
+
type: 'page';
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Root Page Node Schema
|
|
79
|
+
* The root node of a PageDocument must be of type 'page'.
|
|
80
|
+
*/
|
|
81
|
+
export declare const RootPageNodeSchema: z.ZodType<RootPageNode>;
|
|
82
|
+
/**
|
|
83
|
+
* Document Metadata Schema
|
|
84
|
+
* Pure serializable metadata for the document.
|
|
85
|
+
*/
|
|
86
|
+
export declare const DocumentMetadataSchema: z.ZodObject<{
|
|
87
|
+
title: z.ZodDefault<z.ZodString>;
|
|
88
|
+
description: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
89
|
+
author: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
90
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
91
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
92
|
+
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
93
|
+
category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
94
|
+
version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
95
|
+
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
|
+
export type DocumentMetadata = z.infer<typeof DocumentMetadataSchema>;
|
|
98
|
+
/**
|
|
99
|
+
* Page Document Schema v1
|
|
100
|
+
* Root portable document structure:
|
|
101
|
+
* - schema: strictly "stora.page"
|
|
102
|
+
* - version: schema version string (e.g. "1.0.0")
|
|
103
|
+
* - metadata: serializable metadata
|
|
104
|
+
* - document: root page node
|
|
105
|
+
*/
|
|
106
|
+
export declare const PageDocumentSchema: z.ZodObject<{
|
|
107
|
+
schema: z.ZodLiteral<"stora.page">;
|
|
108
|
+
version: z.ZodDefault<z.ZodString>;
|
|
109
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
110
|
+
title: z.ZodDefault<z.ZodString>;
|
|
111
|
+
description: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
112
|
+
author: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
113
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
114
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
115
|
+
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
116
|
+
category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
117
|
+
version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
118
|
+
custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
document: z.ZodType<RootPageNode, unknown, z.core.$ZodTypeInternals<RootPageNode, unknown>>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
export type PageDocument = z.infer<typeof PageDocumentSchema>;
|
|
123
|
+
/**
|
|
124
|
+
* Type guards
|
|
125
|
+
*/
|
|
126
|
+
export declare function isAssetReference(value: unknown): value is AssetReference;
|
|
127
|
+
export declare function isVariableBinding(value: unknown): value is VariableBinding;
|
|
128
|
+
export declare function isActionBinding(value: unknown): value is ActionBinding;
|
|
129
|
+
/**
|
|
130
|
+
* Deterministic Node ID Generator
|
|
131
|
+
* Generates predictable IDs based on prefix and an index/identifier (not bound to React keys).
|
|
132
|
+
*/
|
|
133
|
+
export declare function generateDeterministicNodeId(prefix: string, indexOrKey: number | string): string;
|
|
134
|
+
/**
|
|
135
|
+
* Collect all Node IDs in a node tree
|
|
136
|
+
*/
|
|
137
|
+
export declare function collectNodeIds(node: Node): string[];
|
|
138
|
+
/**
|
|
139
|
+
* Validate Node ID uniqueness across a node tree or document
|
|
140
|
+
*/
|
|
141
|
+
export declare function validateNodeIdUniqueness(node: Node): {
|
|
142
|
+
valid: boolean;
|
|
143
|
+
duplicateIds: string[];
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=document.d.ts.map
|
|
@@ -0,0 +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