@polotno/schema 0.1.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/LICENSE.md +10 -0
- package/README.md +81 -0
- package/lib/constants.d.ts +6 -0
- package/lib/constants.d.ts.map +1 -0
- package/lib/constants.js +61 -0
- package/lib/constants.js.map +1 -0
- package/lib/defaults.d.ts +445 -0
- package/lib/defaults.d.ts.map +1 -0
- package/lib/defaults.js +254 -0
- package/lib/defaults.js.map +1 -0
- package/lib/design.schema.json +2771 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -0
- package/lib/migrate.d.ts +6 -0
- package/lib/migrate.d.ts.map +1 -0
- package/lib/migrate.js +58 -0
- package/lib/migrate.js.map +1 -0
- package/lib/normalize.d.ts +2 -0
- package/lib/normalize.d.ts.map +1 -0
- package/lib/normalize.js +36 -0
- package/lib/normalize.js.map +1 -0
- package/lib/processors.d.ts +13 -0
- package/lib/processors.d.ts.map +1 -0
- package/lib/processors.js +170 -0
- package/lib/processors.js.map +1 -0
- package/lib/schema.d.ts +693 -0
- package/lib/schema.d.ts.map +1 -0
- package/lib/schema.js +379 -0
- package/lib/schema.js.map +1 -0
- package/lib/traverse.d.ts +3 -0
- package/lib/traverse.d.ts.map +1 -0
- package/lib/traverse.js +32 -0
- package/lib/traverse.js.map +1 -0
- package/lib/types-parity.d.ts +2 -0
- package/lib/types-parity.d.ts.map +1 -0
- package/lib/types-parity.js +11 -0
- package/lib/types-parity.js.map +1 -0
- package/lib/types.d.ts +349 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +22 -0
- package/lib/types.js.map +1 -0
- package/lib/validate.d.ts +19 -0
- package/lib/validate.d.ts.map +1 -0
- package/lib/validate.js +383 -0
- package/lib/validate.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot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AAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AACD,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;CAChC;AAYD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,IAAI,GAAE,eAAoB,GACzB,gBAAgB,CAOlB;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,IAAI,GAAE,eAAoB,GACzB,IAAI,CAMN"}
|
package/lib/schema.js
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
// The Polotno design format, authored once in zod v4. This is the SINGLE source
|
|
2
|
+
// of truth for the package: default values (inline `.default(...)`), validation,
|
|
3
|
+
// and the generated JSON Schema all come from here. TypeScript types are the
|
|
4
|
+
// hand-written `./types` (zod can't cleanly infer the recursive group type).
|
|
5
|
+
//
|
|
6
|
+
// The whole schema is built by `build(o)` (where `o` is the zod object
|
|
7
|
+
// constructor) so the two variants differ all the way down — the strict one
|
|
8
|
+
// rejects unknown keys even inside table cells, animations, filters, and cell
|
|
9
|
+
// borders. Both fill defaults. The validation MODE selects the variant:
|
|
10
|
+
// - `designSchemaLenient` (built with `z.object`) — strips unknown keys.
|
|
11
|
+
// Used by `normalizeDesign` and by `validateDesign({ mode: 'partial' })`.
|
|
12
|
+
// - `designSchemaCanonical` (built with `z.strictObject`) — rejects unknown
|
|
13
|
+
// keys everywhere (additionalProperties:false). Used by
|
|
14
|
+
// `validateDesign({ mode: 'canonical' })`.
|
|
15
|
+
//
|
|
16
|
+
// Defaults match the core MST models. We do NOT reproduce loadJSON's imperative
|
|
17
|
+
// quirk handling (locked shorthand, svgSource fallback, fontSize clamp, cell
|
|
18
|
+
// stripping) — normalize is "fill defaults + validate", exact for clean input.
|
|
19
|
+
import { z } from 'zod';
|
|
20
|
+
export const CURRENT_SCHEMA_VERSION = 4;
|
|
21
|
+
// `o` is the object constructor (`z.object` for lenient, `z.strictObject` for
|
|
22
|
+
// canonical), passed concretely so its precise generic return type is preserved
|
|
23
|
+
// — a `strict ? z.strictObject : z.object` ternary would widen to a union and
|
|
24
|
+
// break `z.infer` of the leaf schemas (and thus the type-drift guard).
|
|
25
|
+
function build(o) {
|
|
26
|
+
const animation = o({
|
|
27
|
+
delay: z.number().default(0).describe('Delay before the animation starts, in milliseconds.'),
|
|
28
|
+
duration: z.number().default(500).describe('Animation duration in milliseconds.'),
|
|
29
|
+
enabled: z.boolean().default(true).describe('Whether the animation is enabled.'),
|
|
30
|
+
type: z.enum(['enter', 'exit', 'loop']).describe('Animation phase.'),
|
|
31
|
+
name: z.string().default('none').describe('Animation name identifier.'),
|
|
32
|
+
data: z.unknown().default({}).describe('Animation-specific data.'),
|
|
33
|
+
});
|
|
34
|
+
const filters = z
|
|
35
|
+
.record(z.string(), o({ intensity: z.number().default(1).describe('Filter intensity (-1 to 1).') }))
|
|
36
|
+
.describe('Applied image filters keyed by filter name.');
|
|
37
|
+
// Fields shared by every Shape-derived element. Defaults inline.
|
|
38
|
+
const shapeBase = {
|
|
39
|
+
id: z.string().describe('Unique identifier for the element.'),
|
|
40
|
+
type: z.string().describe('Element type identifier.'),
|
|
41
|
+
name: z.string().default('').describe('Display name for the element.'),
|
|
42
|
+
custom: z.unknown().optional().describe('Custom data attached to the element.'),
|
|
43
|
+
x: z.number().default(0).describe('X position in pixels.'),
|
|
44
|
+
y: z.number().default(0).describe('Y position in pixels.'),
|
|
45
|
+
width: z.number().default(100).describe('Width in pixels.'),
|
|
46
|
+
height: z.number().default(100).describe('Height in pixels.'),
|
|
47
|
+
rotation: z.number().default(0).describe('Rotation angle in degrees.'),
|
|
48
|
+
opacity: z.number().default(1).describe('Opacity level (0-1).'),
|
|
49
|
+
animations: z.array(animation).default([]).describe('Animation configurations.'),
|
|
50
|
+
blurEnabled: z.boolean().default(false).describe('Whether blur effect is enabled.'),
|
|
51
|
+
blurRadius: z.number().default(10).describe('Blur radius in pixels.'),
|
|
52
|
+
brightnessEnabled: z.boolean().default(false).describe('Whether brightness effect is enabled.'),
|
|
53
|
+
brightness: z.number().default(0).describe('Brightness level (-1 to 1).'),
|
|
54
|
+
sepiaEnabled: z.boolean().default(false).describe('Whether sepia effect is enabled.'),
|
|
55
|
+
grayscaleEnabled: z.boolean().default(false).describe('Whether grayscale effect is enabled.'),
|
|
56
|
+
filters: filters.default({}),
|
|
57
|
+
shadowEnabled: z.boolean().default(false).describe('Whether shadow is enabled.'),
|
|
58
|
+
shadowBlur: z.number().default(5).describe('Shadow blur radius in pixels.'),
|
|
59
|
+
shadowOffsetX: z.number().default(0).describe('Shadow horizontal offset in pixels.'),
|
|
60
|
+
shadowOffsetY: z.number().default(0).describe('Shadow vertical offset in pixels.'),
|
|
61
|
+
shadowColor: z.string().default('black').describe('Shadow color.'),
|
|
62
|
+
shadowOpacity: z.number().default(1).describe('Shadow opacity (0-1).'),
|
|
63
|
+
visible: z.boolean().default(true).describe('Whether the element is visible.'),
|
|
64
|
+
draggable: z.boolean().default(true).describe('Whether the element can be dragged.'),
|
|
65
|
+
resizable: z.boolean().default(true).describe('Whether the element can be resized.'),
|
|
66
|
+
selectable: z.boolean().default(true).describe('Whether the element can be selected.'),
|
|
67
|
+
removable: z.boolean().default(true).describe('Whether the element can be removed.'),
|
|
68
|
+
contentEditable: z.boolean().default(true).describe('Whether the element content can be edited.'),
|
|
69
|
+
styleEditable: z.boolean().default(true).describe('Whether the element style can be edited.'),
|
|
70
|
+
alwaysOnTop: z.boolean().default(false).describe('Whether the element stays on top of others.'),
|
|
71
|
+
showInExport: z.boolean().default(true).describe('Whether the element appears in exports.'),
|
|
72
|
+
};
|
|
73
|
+
const imageProps = {
|
|
74
|
+
src: z.string().default('').describe('URL or data URI of the image file.'),
|
|
75
|
+
cropX: z.number().default(0).describe('Crop X offset as a fraction (0-1).'),
|
|
76
|
+
cropY: z.number().default(0).describe('Crop Y offset as a fraction (0-1).'),
|
|
77
|
+
cropWidth: z.number().default(1).describe('Crop width as a fraction (0-1).'),
|
|
78
|
+
cropHeight: z.number().default(1).describe('Crop height as a fraction (0-1).'),
|
|
79
|
+
cornerRadius: z.number().default(0).describe('Corner radius in pixels.'),
|
|
80
|
+
flipX: z.boolean().default(false).describe('Whether the image is flipped horizontally.'),
|
|
81
|
+
flipY: z.boolean().default(false).describe('Whether the image is flipped vertically.'),
|
|
82
|
+
clipSrc: z.string().default('').describe('URL or data URI for a clipping mask.'),
|
|
83
|
+
borderColor: z.string().default('black').describe('Border color.'),
|
|
84
|
+
borderSize: z.number().default(0).describe('Border width in pixels.'),
|
|
85
|
+
keepRatio: z.boolean().default(false).describe('Whether to maintain aspect ratio when resizing.'),
|
|
86
|
+
stretchEnabled: z.boolean().default(false).describe('Whether stretch mode is enabled.'),
|
|
87
|
+
};
|
|
88
|
+
const textShape = {
|
|
89
|
+
...shapeBase,
|
|
90
|
+
type: z.literal('text'),
|
|
91
|
+
text: z.string().default('').describe('Visible text shown on canvas.'),
|
|
92
|
+
placeholder: z.string().default('').describe('Placeholder text shown when empty.'),
|
|
93
|
+
fontSize: z.number().default(14).describe('Font size in pixels.'),
|
|
94
|
+
fontFamily: z.string().default('Roboto').describe('Font family name.'),
|
|
95
|
+
fontStyle: z.string().default('normal').describe("Font style: 'normal' or 'italic'."),
|
|
96
|
+
fontWeight: z.string().default('normal').describe("Font weight: 'normal', 'bold', or numeric string."),
|
|
97
|
+
textDecoration: z.string().default('').describe('Text decoration (e.g. underline, line-through).'),
|
|
98
|
+
textTransform: z.string().default('none').describe('Text transform: uppercase, lowercase, capitalize, none.'),
|
|
99
|
+
fill: z.string().default('black').describe('Text color.'),
|
|
100
|
+
// model stores align as a free string (loadJSON can emit e.g. 'start')
|
|
101
|
+
align: z.string().default('center').describe('Horizontal alignment (commonly left | center | right | justify).'),
|
|
102
|
+
width: z.number().default(100).describe('Width in pixels.'),
|
|
103
|
+
height: z.number().default(0).describe('Height in pixels (0 until measured/rendered).'),
|
|
104
|
+
verticalAlign: z.string().default('top').describe('Vertical alignment: top, middle, bottom.'),
|
|
105
|
+
strokeWidth: z.number().default(0).describe('Stroke width in pixels.'),
|
|
106
|
+
stroke: z.string().default('black').describe('Stroke color.'),
|
|
107
|
+
lineHeight: z.union([z.number(), z.string()]).default(1.2).describe("Line height multiplier or 'auto'."),
|
|
108
|
+
letterSpacing: z.number().default(0).describe('Letter spacing as a fraction of font size.'),
|
|
109
|
+
backgroundEnabled: z.boolean().default(false).describe('Whether the text background is enabled.'),
|
|
110
|
+
backgroundColor: z.string().default('#7ED321').describe('Text background color.'),
|
|
111
|
+
backgroundOpacity: z.number().default(1).describe('Text background opacity (0-1).'),
|
|
112
|
+
backgroundCornerRadius: z.number().default(0.5).describe('Text background corner radius.'),
|
|
113
|
+
backgroundPadding: z.number().default(0.5).describe('Text background padding.'),
|
|
114
|
+
curveEnabled: z.boolean().default(false).describe('Whether the text curve effect is enabled.'),
|
|
115
|
+
curvePower: z.number().default(0.5).describe('Text curve power (-1 to 1, 0 = straight).'),
|
|
116
|
+
legacyBackground: z.boolean().optional().describe('Internal compatibility flag stamped by the v2→v3 migration.'),
|
|
117
|
+
};
|
|
118
|
+
const imageShape = { ...shapeBase, ...imageProps, type: z.literal('image') };
|
|
119
|
+
const svgShape = {
|
|
120
|
+
...shapeBase,
|
|
121
|
+
type: z.literal('svg'),
|
|
122
|
+
src: z.string().default('').describe('URL or data URI of the SVG.'),
|
|
123
|
+
maskSrc: z.string().default('').describe('URL or data URI for an SVG mask.'),
|
|
124
|
+
cropX: z.number().default(0),
|
|
125
|
+
cropY: z.number().default(0),
|
|
126
|
+
cropWidth: z.number().default(1),
|
|
127
|
+
cropHeight: z.number().default(1),
|
|
128
|
+
keepRatio: z.boolean().default(true),
|
|
129
|
+
stretchEnabled: z.boolean().default(true),
|
|
130
|
+
flipX: z.boolean().default(false),
|
|
131
|
+
flipY: z.boolean().default(false),
|
|
132
|
+
width: z.number().default(100),
|
|
133
|
+
height: z.number().default(100),
|
|
134
|
+
borderColor: z.string().default('black'),
|
|
135
|
+
borderSize: z.number().default(0),
|
|
136
|
+
cornerRadius: z.number().default(0),
|
|
137
|
+
colorsReplace: z.record(z.string(), z.string()).default({}).describe('Color replacement mappings (original → replacement).'),
|
|
138
|
+
};
|
|
139
|
+
const lineShape = {
|
|
140
|
+
...shapeBase,
|
|
141
|
+
type: z.literal('line'),
|
|
142
|
+
width: z.number().default(400),
|
|
143
|
+
height: z.number().default(10),
|
|
144
|
+
color: z.string().default('black').describe('Line color.'),
|
|
145
|
+
dash: z.array(z.number()).default([]).describe('Dash pattern array.'),
|
|
146
|
+
startHead: z.string().default('').describe('Start arrow head: empty, arrow, circle, square, bar.'),
|
|
147
|
+
endHead: z.string().default('').describe('End arrow head: empty, arrow, circle, square, bar.'),
|
|
148
|
+
};
|
|
149
|
+
const figureShape = {
|
|
150
|
+
...shapeBase,
|
|
151
|
+
type: z.literal('figure'),
|
|
152
|
+
subType: z.string().default('rect').describe('Figure subtype: rect, ellipse, triangle, etc.'),
|
|
153
|
+
fill: z.string().default('rgb(0, 161, 255)').describe('Fill color.'),
|
|
154
|
+
dash: z.array(z.number()).default([]).describe('Dash pattern array.'),
|
|
155
|
+
strokeWidth: z.number().default(0),
|
|
156
|
+
stroke: z.string().default('rgba(98, 197, 255, 1)'),
|
|
157
|
+
cornerRadius: z.number().default(0),
|
|
158
|
+
};
|
|
159
|
+
const gifShape = {
|
|
160
|
+
...shapeBase,
|
|
161
|
+
...imageProps,
|
|
162
|
+
type: z.literal('gif'),
|
|
163
|
+
duration: z.number().default(0).describe('GIF duration in milliseconds.'),
|
|
164
|
+
keepRatio: z.boolean().default(true),
|
|
165
|
+
};
|
|
166
|
+
const videoShape = {
|
|
167
|
+
...shapeBase,
|
|
168
|
+
...imageProps,
|
|
169
|
+
type: z.literal('video'),
|
|
170
|
+
duration: z.number().default(0).describe('Video duration in milliseconds.'),
|
|
171
|
+
startTime: z.number().default(0).describe('Start offset (0-1).'),
|
|
172
|
+
endTime: z.number().default(1).describe('End offset (0-1).'),
|
|
173
|
+
volume: z.number().default(1).describe('Volume (0-1).'),
|
|
174
|
+
speed: z.number().default(1).describe('Playback speed multiplier (1 = normal).'),
|
|
175
|
+
};
|
|
176
|
+
const borderSide = o({
|
|
177
|
+
color: z.string().optional(),
|
|
178
|
+
width: z.number().optional(),
|
|
179
|
+
style: z.enum(['solid', 'dashed', 'dotted', 'none']).optional(),
|
|
180
|
+
});
|
|
181
|
+
// Cell styling fields are optional (inherit from the table when omitted).
|
|
182
|
+
const tableCell = o({
|
|
183
|
+
id: z.string(),
|
|
184
|
+
type: z.literal('tablecell').default('tablecell'),
|
|
185
|
+
text: z.string().default(''),
|
|
186
|
+
opacity: z.number().optional(),
|
|
187
|
+
rowSpan: z.number().optional(),
|
|
188
|
+
colSpan: z.number().optional(),
|
|
189
|
+
mergedInto: z.string().optional(),
|
|
190
|
+
name: z.string().optional(),
|
|
191
|
+
custom: z.unknown().optional(),
|
|
192
|
+
borders: o({
|
|
193
|
+
top: borderSide.optional(),
|
|
194
|
+
right: borderSide.optional(),
|
|
195
|
+
bottom: borderSide.optional(),
|
|
196
|
+
left: borderSide.optional(),
|
|
197
|
+
}).optional(),
|
|
198
|
+
fontSize: z.number().optional(),
|
|
199
|
+
fontFamily: z.string().optional(),
|
|
200
|
+
fontWeight: z.string().optional(),
|
|
201
|
+
fontStyle: z.string().optional(),
|
|
202
|
+
textDecoration: z.string().optional(),
|
|
203
|
+
textTransform: z.string().optional(),
|
|
204
|
+
fill: z.string().optional(),
|
|
205
|
+
align: z.string().optional(),
|
|
206
|
+
verticalAlign: z.string().optional(),
|
|
207
|
+
lineHeight: z.union([z.number(), z.string()]).optional(),
|
|
208
|
+
letterSpacing: z.number().optional(),
|
|
209
|
+
strokeWidth: z.number().optional(),
|
|
210
|
+
stroke: z.string().optional(),
|
|
211
|
+
cellBackground: z.string().optional(),
|
|
212
|
+
cellPadding: z.number().optional(),
|
|
213
|
+
});
|
|
214
|
+
// Effect props are nonsensical for tables and not part of its serialized form —
|
|
215
|
+
// omit them via a typed destructure (so `tableShape` keeps precise field types).
|
|
216
|
+
const { blurEnabled: _o1, blurRadius: _o2, brightnessEnabled: _o3, brightness: _o4, sepiaEnabled: _o5, grayscaleEnabled: _o6, filters: _o7, shadowEnabled: _o8, shadowBlur: _o9, shadowOffsetX: _o10, shadowOffsetY: _o11, shadowColor: _o12, shadowOpacity: _o13, ...shapeBaseNoEffects } = shapeBase;
|
|
217
|
+
const tableShape = {
|
|
218
|
+
...shapeBaseNoEffects,
|
|
219
|
+
type: z.literal('table'),
|
|
220
|
+
width: z.number().default(300),
|
|
221
|
+
height: z.number().default(200),
|
|
222
|
+
rows: z.number().default(3).describe('Number of rows.'),
|
|
223
|
+
cols: z.number().default(3).describe('Number of columns.'),
|
|
224
|
+
colWidths: z.array(z.number()).default([]).describe('Column width fractions (sum to 1).'),
|
|
225
|
+
rowHeights: z.array(z.number()).default([]).describe('Row height fractions (sum to 1).'),
|
|
226
|
+
cells: z.array(tableCell).default([]).describe('Flat cell array in row-major order.'),
|
|
227
|
+
borderColor: z.string().default('#000000'),
|
|
228
|
+
borderWidth: z.number().default(1),
|
|
229
|
+
borderStyle: z.enum(['solid', 'dashed', 'dotted', 'none']).default('solid'),
|
|
230
|
+
fontSize: z.number().default(30),
|
|
231
|
+
fontFamily: z.string().default('Roboto'),
|
|
232
|
+
fontWeight: z.string().default('normal'),
|
|
233
|
+
fontStyle: z.string().default('normal'),
|
|
234
|
+
textDecoration: z.string().default(''),
|
|
235
|
+
textTransform: z.string().default('none'),
|
|
236
|
+
fill: z.string().default('black'),
|
|
237
|
+
align: z.string().default('center'),
|
|
238
|
+
verticalAlign: z.string().default('middle'),
|
|
239
|
+
lineHeight: z.union([z.number(), z.string()]).default(1.2),
|
|
240
|
+
letterSpacing: z.number().default(0),
|
|
241
|
+
strokeWidth: z.number().default(0),
|
|
242
|
+
stroke: z.string().default('black'),
|
|
243
|
+
cellBackground: z.string().default('transparent'),
|
|
244
|
+
cellPadding: z.number().default(4),
|
|
245
|
+
};
|
|
246
|
+
const groupShape = (element) => ({
|
|
247
|
+
id: z.string(),
|
|
248
|
+
type: z.literal('group'),
|
|
249
|
+
name: z.string().default(''),
|
|
250
|
+
custom: z.unknown().optional(),
|
|
251
|
+
opacity: z.number().default(1),
|
|
252
|
+
visible: z.boolean().default(true),
|
|
253
|
+
selectable: z.boolean().default(true),
|
|
254
|
+
removable: z.boolean().default(true),
|
|
255
|
+
alwaysOnTop: z.boolean().default(false),
|
|
256
|
+
showInExport: z.boolean().default(true),
|
|
257
|
+
animations: z.array(animation).default([]),
|
|
258
|
+
children: z.array(element).default([]).describe('Child elements in this group.'),
|
|
259
|
+
});
|
|
260
|
+
const element = z.lazy(() => z.discriminatedUnion('type', [
|
|
261
|
+
o(textShape),
|
|
262
|
+
o(imageShape),
|
|
263
|
+
o(svgShape),
|
|
264
|
+
o(lineShape),
|
|
265
|
+
o(figureShape),
|
|
266
|
+
o(gifShape),
|
|
267
|
+
o(videoShape),
|
|
268
|
+
o(tableShape),
|
|
269
|
+
o(groupShape(element)),
|
|
270
|
+
]));
|
|
271
|
+
const fontShape = {
|
|
272
|
+
fontFamily: z.string().describe('Font family name.'),
|
|
273
|
+
url: z.string().default('').describe('URL to load the font from (single-variant fonts).'),
|
|
274
|
+
styles: z
|
|
275
|
+
.array(o({
|
|
276
|
+
src: z.string().describe('Font source, typically in CSS url() form.'),
|
|
277
|
+
fontStyle: z.string().optional(),
|
|
278
|
+
fontWeight: z.string().optional(),
|
|
279
|
+
}))
|
|
280
|
+
.optional()
|
|
281
|
+
.describe('Per-weight/style variants for multi-variant families.'),
|
|
282
|
+
};
|
|
283
|
+
const audioShape = {
|
|
284
|
+
id: z.string().describe('Unique identifier for the audio track.'),
|
|
285
|
+
src: z.string().default('').describe('URL or data URI of the audio file.'),
|
|
286
|
+
duration: z.number().default(0).describe('Duration in milliseconds.'),
|
|
287
|
+
startTime: z.number().default(0).describe('Start offset (0-1).'),
|
|
288
|
+
endTime: z.number().default(1).describe('End offset (0-1).'),
|
|
289
|
+
volume: z.number().default(1).describe('Volume level (0-1).'),
|
|
290
|
+
delay: z.number().default(0).describe('Delay before playing, in milliseconds.'),
|
|
291
|
+
speed: z.number().default(1).describe('Playback speed multiplier (1 = normal).'),
|
|
292
|
+
custom: z.unknown().optional(),
|
|
293
|
+
};
|
|
294
|
+
const page = o({
|
|
295
|
+
id: z.string().describe('Unique identifier for the page.'),
|
|
296
|
+
width: z.union([z.number(), z.literal('auto')]).default('auto').describe("Page width in pixels or 'auto'."),
|
|
297
|
+
height: z.union([z.number(), z.literal('auto')]).default('auto').describe("Page height in pixels or 'auto'."),
|
|
298
|
+
background: z.string().default('white').describe('Background color or image.'),
|
|
299
|
+
bleed: z.number().default(0).describe('Bleed area in pixels for print.'),
|
|
300
|
+
custom: z.unknown().optional(),
|
|
301
|
+
duration: z.number().default(5000).describe('Page duration in milliseconds.'),
|
|
302
|
+
children: z.array(element).default([]).describe('Elements on this page.'),
|
|
303
|
+
});
|
|
304
|
+
const design = o({
|
|
305
|
+
schemaVersion: z.number().default(CURRENT_SCHEMA_VERSION).describe('Schema version for compatibility / migration.'),
|
|
306
|
+
width: z.number().default(1080).describe('Canvas width in pixels.'),
|
|
307
|
+
height: z.number().default(1080).describe('Canvas height in pixels.'),
|
|
308
|
+
unit: z.enum(['px', 'pt', 'mm', 'cm', 'in']).default('px').describe('Unit type for print measurements.'),
|
|
309
|
+
dpi: z.number().default(72).describe('Dots per inch for print calculations.'),
|
|
310
|
+
custom: z.unknown().optional().describe('Custom data attached to the design.'),
|
|
311
|
+
fonts: z.array(o(fontShape)).default([]).describe('Fonts used in the design.'),
|
|
312
|
+
pages: z.array(page).default([]).describe('Pages in the design.'),
|
|
313
|
+
audios: z.array(o(audioShape)).default([]).describe('Audio tracks in the design.'),
|
|
314
|
+
});
|
|
315
|
+
// Raw per-type field bags (not zod objects). The leaf schemas for the type
|
|
316
|
+
// guard are wrapped from these once at module level (below) so they aren't
|
|
317
|
+
// rebuilt on the canonical `build()` call.
|
|
318
|
+
const shapes = {
|
|
319
|
+
text: textShape,
|
|
320
|
+
image: imageShape,
|
|
321
|
+
svg: svgShape,
|
|
322
|
+
line: lineShape,
|
|
323
|
+
figure: figureShape,
|
|
324
|
+
gif: gifShape,
|
|
325
|
+
video: videoShape,
|
|
326
|
+
table: tableShape,
|
|
327
|
+
font: fontShape,
|
|
328
|
+
audio: audioShape,
|
|
329
|
+
};
|
|
330
|
+
return { design, shapes };
|
|
331
|
+
}
|
|
332
|
+
const lenient = build(z.object);
|
|
333
|
+
/** Non-strict: strips unknown keys, fills defaults. `normalizeDesign` uses this. */
|
|
334
|
+
export const designSchemaLenient = lenient.design;
|
|
335
|
+
/**
|
|
336
|
+
* Strict: rejects unknown keys (additionalProperties:false) at every level.
|
|
337
|
+
* Built with `z.strictObject` at runtime; the cast keeps the lenient leaf types
|
|
338
|
+
* as the single inferred source (this tree is only ever parsed, never inferred).
|
|
339
|
+
*/
|
|
340
|
+
export const designSchemaCanonical = build(z.strictObject).design;
|
|
341
|
+
/**
|
|
342
|
+
* Lenient per-type leaf schemas, used by the compile-time type-drift guard.
|
|
343
|
+
* `z.infer` is identical whether strict or not, so the non-strict wrapping here
|
|
344
|
+
* matches the hand-written `./types`. Recursive group/page/design are excluded.
|
|
345
|
+
*/
|
|
346
|
+
export const leafSchemas = {
|
|
347
|
+
text: z.object(lenient.shapes.text),
|
|
348
|
+
image: z.object(lenient.shapes.image),
|
|
349
|
+
svg: z.object(lenient.shapes.svg),
|
|
350
|
+
line: z.object(lenient.shapes.line),
|
|
351
|
+
figure: z.object(lenient.shapes.figure),
|
|
352
|
+
gif: z.object(lenient.shapes.gif),
|
|
353
|
+
video: z.object(lenient.shapes.video),
|
|
354
|
+
table: z.object(lenient.shapes.table),
|
|
355
|
+
font: z.object(lenient.shapes.font),
|
|
356
|
+
audio: z.object(lenient.shapes.audio),
|
|
357
|
+
};
|
|
358
|
+
function toErrors(issues) {
|
|
359
|
+
return issues.map((issue) => ({
|
|
360
|
+
// dotted path into the design, e.g. "pages.0.children.0.opacity" ('' = root)
|
|
361
|
+
path: issue.path.map(String).join('.'),
|
|
362
|
+
message: issue.message,
|
|
363
|
+
}));
|
|
364
|
+
}
|
|
365
|
+
export function validateDesign(input, opts = {}) {
|
|
366
|
+
const schema = opts.mode === 'canonical' ? designSchemaCanonical : designSchemaLenient;
|
|
367
|
+
const result = schema.safeParse(input);
|
|
368
|
+
return result.success
|
|
369
|
+
? { valid: true, errors: [] }
|
|
370
|
+
: { valid: false, errors: toErrors(result.error.issues) };
|
|
371
|
+
}
|
|
372
|
+
export function assertValidDesign(input, opts = {}) {
|
|
373
|
+
const { valid, errors } = validateDesign(input, opts);
|
|
374
|
+
if (!valid) {
|
|
375
|
+
const summary = errors.slice(0, 10).map((e) => ` ${e.path}: ${e.message}`).join('\n');
|
|
376
|
+
throw new Error(`Invalid Polotno design:\n${summary}`);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,iFAAiF;AACjF,6EAA6E;AAC7E,6EAA6E;AAC7E,EAAE;AACF,uEAAuE;AACvE,4EAA4E;AAC5E,8EAA8E;AAC9E,wEAAwE;AACxE,2EAA2E;AAC3E,8EAA8E;AAC9E,8EAA8E;AAC9E,4DAA4D;AAC5D,+CAA+C;AAC/C,EAAE;AACF,gFAAgF;AAChF,6EAA6E;AAC7E,+EAA+E;AAE/E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC,8EAA8E;AAC9E,gFAAgF;AAChF,8EAA8E;AAC9E,uEAAuE;AACvE,SAAS,KAAK,CAAC,CAAkB;IAC/B,MAAM,SAAS,GAAG,CAAC,CAAC;QAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE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UAAU,iBAAiB,CAC/B,KAAc,EACd,OAAwB,EAAE;IAE1B,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACtD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvF,MAAM,IAAI,KAAK,CAAC,4BAA4B,OAAO,EAAE,CAAC,CAAC;IACzD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse.d.ts","sourceRoot":"","sources":["../src/traverse.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,GAAI,MAAM,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,GAAG,IAAI,SAU1E,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,MAAM,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,GAAG,IAAI,SAczE,CAAC"}
|
package/lib/traverse.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Pure tree-walk helpers, moved verbatim from `group-model.ts`. They read only
|
|
2
|
+
// `.children` / `.cells` / the callback's return, so they work identically on
|
|
3
|
+
// plain JSON (what we need here) and on live MST instances (what core needs).
|
|
4
|
+
export const forEveryChild = (node, cb) => {
|
|
5
|
+
if (node.children) {
|
|
6
|
+
for (const child of node.children) {
|
|
7
|
+
const shouldStop = cb(child);
|
|
8
|
+
if (shouldStop === true) {
|
|
9
|
+
break;
|
|
10
|
+
}
|
|
11
|
+
forEveryChild(child, cb);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export const forEveryNode = (node, cb) => {
|
|
16
|
+
if (node.children) {
|
|
17
|
+
for (const child of node.children) {
|
|
18
|
+
const shouldStop = cb(child);
|
|
19
|
+
if (shouldStop === true)
|
|
20
|
+
break;
|
|
21
|
+
forEveryNode(child, cb);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (node.cells) {
|
|
25
|
+
for (const cell of node.cells) {
|
|
26
|
+
const shouldStop = cb(cell);
|
|
27
|
+
if (shouldStop === true)
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=traverse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse.js","sourceRoot":"","sources":["../src/traverse.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAE9E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAS,EAAE,EAAkC,EAAE,EAAE;IAC7E,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClC,MAAM,UAAU,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;YAC7B,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;gBACxB,MAAM;YACR,CAAC;YACD,aAAa,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAS,EAAE,EAAkC,EAAE,EAAE;IAC5E,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClC,MAAM,UAAU,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;YAC7B,IAAI,UAAU,KAAK,IAAI;gBAAE,MAAM;YAC/B,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,MAAM,UAAU,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,UAAU,KAAK,IAAI;gBAAE,MAAM;QACjC,CAAC;IACH,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-parity.d.ts","sourceRoot":"","sources":["../src/types-parity.ts"],"names":[],"mappings":"AA+CA,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// COMPILE-TIME TYPE-DRIFT GUARD.
|
|
2
|
+
//
|
|
3
|
+
// Asserts that every non-recursive public type in `./types` is exactly equal to
|
|
4
|
+
// `z.infer` of its zod leaf schema in `./schema`. If a field is added, renamed,
|
|
5
|
+
// retyped, or made optional on one side but not the other, `tsc` fails here.
|
|
6
|
+
//
|
|
7
|
+
// This file emits nothing at runtime (all imports are used only in type
|
|
8
|
+
// positions). The recursive types (group/page/design) can't be inferred from
|
|
9
|
+
// zod and are therefore not covered — see the note in `./types.ts`.
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=types-parity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-parity.js","sourceRoot":"","sources":["../src/types-parity.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,6EAA6E;AAC7E,EAAE;AACF,wEAAwE;AACxE,6EAA6E;AAC7E,oEAAoE"}
|