@polotno/schema 0.2.0 → 0.3.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.
Files changed (53) hide show
  1. package/lib/bleed.d.ts +0 -1
  2. package/lib/bleed.js +0 -1
  3. package/lib/defaults.d.ts +24 -434
  4. package/lib/defaults.js +62 -243
  5. package/lib/errors.d.ts +23 -6
  6. package/lib/errors.js +5 -1
  7. package/lib/index.d.ts +1 -1
  8. package/lib/index.js +2 -1
  9. package/lib/normalize.d.ts +20 -3
  10. package/lib/normalize.js +190 -43
  11. package/lib/schema.d.ts +10 -1
  12. package/lib/schema.js +60 -27
  13. package/lib/types-parity.d.ts +0 -1
  14. package/lib/types-parity.js +0 -1
  15. package/lib/types.d.ts +0 -1
  16. package/lib/types.js +0 -1
  17. package/package.json +8 -8
  18. package/lib/bleed.d.ts.map +0 -1
  19. package/lib/bleed.js.map +0 -1
  20. package/lib/constants.d.ts +0 -6
  21. package/lib/constants.d.ts.map +0 -1
  22. package/lib/constants.js +0 -61
  23. package/lib/constants.js.map +0 -1
  24. package/lib/defaults.d.ts.map +0 -1
  25. package/lib/defaults.js.map +0 -1
  26. package/lib/errors.d.ts.map +0 -1
  27. package/lib/errors.js.map +0 -1
  28. package/lib/index.d.ts.map +0 -1
  29. package/lib/index.js.map +0 -1
  30. package/lib/migrate.d.ts +0 -6
  31. package/lib/migrate.d.ts.map +0 -1
  32. package/lib/migrate.js +0 -58
  33. package/lib/migrate.js.map +0 -1
  34. package/lib/normalize.d.ts.map +0 -1
  35. package/lib/normalize.js.map +0 -1
  36. package/lib/processors.d.ts +0 -13
  37. package/lib/processors.d.ts.map +0 -1
  38. package/lib/processors.js +0 -170
  39. package/lib/processors.js.map +0 -1
  40. package/lib/schema.d.ts.map +0 -1
  41. package/lib/schema.js.map +0 -1
  42. package/lib/traverse.d.ts +0 -3
  43. package/lib/traverse.d.ts.map +0 -1
  44. package/lib/traverse.js +0 -32
  45. package/lib/traverse.js.map +0 -1
  46. package/lib/types-parity.d.ts.map +0 -1
  47. package/lib/types-parity.js.map +0 -1
  48. package/lib/types.d.ts.map +0 -1
  49. package/lib/types.js.map +0 -1
  50. package/lib/validate.d.ts +0 -19
  51. package/lib/validate.d.ts.map +0 -1
  52. package/lib/validate.js +0 -383
  53. package/lib/validate.js.map +0 -1
package/lib/normalize.js CHANGED
@@ -4,51 +4,177 @@
4
4
  // No schemaVersion migration: this package assumes current-format input. A
5
5
  // missing schemaVersion defaults to the current version; old documents that
6
6
  // need migrating should round-trip through the core `polotno` store.
7
- import { designSchemaLenient, assertValidDesign, cloneDropNulls, } from './schema.js';
7
+ import { designSchemaLenient, parseValidDesign, cloneDropNulls, ELEMENT_TYPES, } from './schema.js';
8
8
  import { polotnoError } from './errors.js';
9
9
  export function normalizeDesign(json) {
10
10
  return designSchemaLenient.parse(cloneDropNulls(json));
11
11
  }
12
- const ID_ALPHABET = 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
13
- // URL-safe id matching core's `nanoid(10)` (group-model.ts / page-model.ts) — 10
14
- // chars from a 64-char alphabet. Inlined (no dependency) so schema bundles under
15
- // any platform/bundler; prefers Web Crypto where present (browser + modern Node),
16
- // falls back to Math.random so it never throws.
17
- function randomId(size = 10) {
18
- const c = globalThis.crypto;
19
- let id = '';
20
- if (c && typeof c.getRandomValues === 'function') {
21
- const bytes = c.getRandomValues(new Uint8Array(size));
22
- for (let i = 0; i < size; i++)
23
- id += ID_ALPHABET[bytes[i] & 63];
24
- }
25
- else {
26
- for (let i = 0; i < size; i++)
27
- id += ID_ALPHABET[(Math.random() * 64) | 0];
28
- }
29
- return id;
30
- }
31
- // Return a deep copy with a fresh `id` on any page/element/cell missing one.
32
- // Recurses children (groups) + cells (tables) so ids stay collision-safe even if
33
- // designs are later merged. Other required fields (`type`, font `fontFamily`) are
34
- // left alone — their absence is genuinely malformed.
35
- function withFilledIds(input) {
36
- if (!input || typeof input !== 'object')
37
- return input;
38
- const clone = JSON.parse(JSON.stringify(input));
39
- const ensure = (node) => {
12
+ // Fill missing `id`s with DETERMINISTIC structural ids — the index path from
13
+ // the document root (`page-0`, `el-0-2`, nested `el-0-2-1`, `cell-0-2-3`).
14
+ // Ids are emitted into exported HTML/SVG, so a random id would make the same
15
+ // input produce different output on every call (breaking snapshots, hashing,
16
+ // cache keys). Uniqueness is guaranteed within THIS design (an authored id
17
+ // that collides gets a `_2` suffix); real `store.toJSON()` output always has
18
+ // ids, so this never runs on it. Other required fields (`type`, font
19
+ // `fontFamily`) are left alone — their absence is genuinely malformed.
20
+ // Mutates in place — runs only on parseDesign's private working copy.
21
+ function fillIds(clone) {
22
+ if (!Array.isArray(clone.pages))
23
+ return;
24
+ const taken = new Set();
25
+ const collect = (node) => {
40
26
  if (node && typeof node === 'object') {
41
- if (node.id == null || node.id === '')
42
- node.id = randomId(10);
27
+ if (typeof node.id === 'string' && node.id !== '')
28
+ taken.add(node.id);
43
29
  if (Array.isArray(node.children))
44
- node.children.forEach(ensure);
30
+ node.children.forEach(collect);
45
31
  if (Array.isArray(node.cells))
46
- node.cells.forEach(ensure);
32
+ node.cells.forEach(collect);
33
+ }
34
+ };
35
+ clone.pages.forEach(collect);
36
+ const claim = (base) => {
37
+ let id = base;
38
+ for (let n = 2; taken.has(id); n++)
39
+ id = `${base}_${n}`;
40
+ taken.add(id);
41
+ return id;
42
+ };
43
+ const ensure = (node, kind, path) => {
44
+ if (!node || typeof node !== 'object')
45
+ return;
46
+ if (node.id == null || node.id === '') {
47
+ node.id = claim(`${kind}-${path.join('-')}`);
48
+ }
49
+ if (Array.isArray(node.children)) {
50
+ node.children.forEach((child, i) => ensure(child, 'el', [...path, i]));
51
+ }
52
+ if (Array.isArray(node.cells)) {
53
+ node.cells.forEach((cell, i) => ensure(cell, 'cell', [...path, i]));
54
+ }
55
+ };
56
+ clone.pages.forEach((page, i) => ensure(page, 'page', [i]));
57
+ }
58
+ const KNOWN_ELEMENT_TYPES = new Set(ELEMENT_TYPES);
59
+ // Pull unknown-type elements out of the working copy before validation (they
60
+ // would fail the element union), remembering their original index path so
61
+ // they can be spliced back verbatim after the parse. Scans in document order
62
+ // — the splice replay depends on it (restoring earlier siblings first keeps
63
+ // later recorded paths valid). Nullish children are dropped, matching what
64
+ // cloneDropNulls does inside the parse, so the trees stay index-aligned.
65
+ function extractUnknownElements(clone) {
66
+ const out = [];
67
+ const scan = (node, path) => {
68
+ if (!node || !Array.isArray(node.children))
69
+ return;
70
+ const kept = [];
71
+ // Index in the null-free (reconstructed) array — recorded paths must not
72
+ // count dropped nullish slots.
73
+ let outIdx = 0;
74
+ for (const child of node.children) {
75
+ if (child == null)
76
+ continue;
77
+ if (typeof child === 'object' && KNOWN_ELEMENT_TYPES.has(child.type)) {
78
+ kept.push(child);
79
+ scan(child, [...path, outIdx]);
80
+ }
81
+ else if (typeof child === 'object' && typeof child.type === 'string') {
82
+ out.push({ path: [...path, outIdx], element: child });
83
+ }
84
+ else {
85
+ // Not an extension element (extension types always carry a string
86
+ // `type`): strings, numbers, type-less objects stay in place so the
87
+ // schema pass rejects them as DESIGN_INVALID — the editor's model
88
+ // would reject them too.
89
+ kept.push(child);
90
+ }
91
+ outIdx++;
92
+ }
93
+ node.children = kept;
94
+ };
95
+ if (Array.isArray(clone.pages)) {
96
+ clone.pages.forEach((page, i) => scan(page, [i]));
97
+ }
98
+ return out;
99
+ }
100
+ // Re-insert the extracted unknown elements at their original positions, in
101
+ // extraction (document) order so every path's ancestor indices are already
102
+ // restored by the time it is replayed.
103
+ function spliceUnknownElements(design, extracted) {
104
+ for (const { path, element } of extracted) {
105
+ let arr = design.pages[path[0]].children;
106
+ for (const idx of path.slice(1, -1))
107
+ arr = arr[idx].children;
108
+ arr.splice(path[path.length - 1], 0, element);
109
+ }
110
+ }
111
+ // Restore client-owned content from the CALLER's original input: keys the
112
+ // schema stripped as unrecognized come back (ad-hoc extension fields), and
113
+ // kept unknown-type elements become shallow copies of the caller's objects
114
+ // (keeping the working copy's filled `id`). `custom` needs no special path —
115
+ // it is JSON-like data by contract and the schema keeps it everywhere
116
+ // (z.unknown()), so it survives the round-trip + validation on its own.
117
+ // Runs AFTER unknown elements are spliced back: the parsed arrays then equal
118
+ // the original minus nullish entries, which the walk skips.
119
+ function restoreClientData(original, design) {
120
+ const restoreKeys = (orig, parsed) => {
121
+ for (const key of Object.keys(orig)) {
122
+ if (orig[key] != null && !(key in parsed))
123
+ parsed[key] = orig[key];
47
124
  }
48
125
  };
49
- if (Array.isArray(clone.pages))
50
- clone.pages.forEach(ensure);
51
- return clone;
126
+ // Flat record lists (table cells, audio tracks): restore keys per entry.
127
+ const walkRecords = (origList, parsedList) => {
128
+ let j = 0;
129
+ for (const orig of origList) {
130
+ if (orig == null)
131
+ continue;
132
+ const parsed = parsedList[j++];
133
+ if (typeof orig === 'object' && parsed)
134
+ restoreKeys(orig, parsed);
135
+ }
136
+ };
137
+ const walkElements = (origList, parsedList) => {
138
+ let j = 0;
139
+ for (const orig of origList) {
140
+ if (orig == null)
141
+ continue;
142
+ const parsed = parsedList[j++];
143
+ if (typeof orig !== 'object' || !parsed)
144
+ continue;
145
+ if (!KNOWN_ELEMENT_TYPES.has(orig.type)) {
146
+ // Unknown type: hand the caller's element through (shallow copy so
147
+ // the filled `id` never mutates the caller's input).
148
+ parsedList[j - 1] = { ...orig, id: parsed.id ?? orig.id };
149
+ continue;
150
+ }
151
+ restoreKeys(orig, parsed);
152
+ if (Array.isArray(orig.children) && Array.isArray(parsed.children)) {
153
+ walkElements(orig.children, parsed.children);
154
+ }
155
+ if (Array.isArray(orig.cells) && Array.isArray(parsed.cells)) {
156
+ walkRecords(orig.cells, parsed.cells);
157
+ }
158
+ }
159
+ };
160
+ restoreKeys(original, design);
161
+ if (Array.isArray(original.audios) && Array.isArray(design.audios)) {
162
+ walkRecords(original.audios, design.audios);
163
+ }
164
+ if (!Array.isArray(original.pages))
165
+ return;
166
+ let p = 0;
167
+ for (const origPage of original.pages) {
168
+ if (origPage == null)
169
+ continue;
170
+ const page = design.pages[p++];
171
+ if (typeof origPage !== 'object' || !page)
172
+ continue;
173
+ restoreKeys(origPage, page);
174
+ if (Array.isArray(origPage.children) && Array.isArray(page.children)) {
175
+ walkElements(origPage.children, page.children);
176
+ }
177
+ }
52
178
  }
53
179
  /**
54
180
  * The one entry a consumer should use to accept design JSON: validate, then
@@ -57,15 +183,36 @@ function withFilledIds(input) {
57
183
  * with `assertValidDesign`.
58
184
  */
59
185
  export function parseDesign(input, opts = {}) {
60
- if (opts.fillMissingIds)
61
- input = withFilledIds(input);
62
- // Both `assertValidDesign` and the schema's parse drop null-valued fields
63
- // (treating them as "unset", e.g. `dpi: null`) so they agree on what's valid.
64
- assertValidDesign(input, opts);
65
- const design = designSchemaLenient.parse(cloneDropNulls(input));
186
+ const original = input;
187
+ const pre = (opts.preserveClientData || opts.fillMissingIds) &&
188
+ input &&
189
+ typeof input === 'object';
190
+ let extracted = [];
191
+ if (pre) {
192
+ // ONE working copy for all pre-transforms; the walkers mutate it in
193
+ // place. The caller's input is never touched. The JSON round-trip is NOT
194
+ // just a copy — it coerces non-JSON values (NaN/Infinity → null, which
195
+ // the parse then treats as "unset") exactly like real store JSON
196
+ // serialization; exporter tolerance tests pin that (pdf dpi.test.js).
197
+ // Don't replace it with cloneDropNulls to save the second traversal.
198
+ input = JSON.parse(JSON.stringify(input));
199
+ // fillIds first so unknown elements get ids too, numbered off the full
200
+ // tree (extraction would hide them from the structural paths).
201
+ if (opts.fillMissingIds)
202
+ fillIds(input);
203
+ if (opts.preserveClientData)
204
+ extracted = extractUnknownElements(input);
205
+ }
206
+ // Single schema pass: validates (drops null-valued fields, so it agrees
207
+ // with the core store on what's valid) and fills defaults in one parse.
208
+ const design = parseValidDesign(input, opts);
209
+ if (pre && opts.preserveClientData) {
210
+ if (extracted.length)
211
+ spliceUnknownElements(design, extracted);
212
+ restoreClientData(original, design);
213
+ }
66
214
  if (opts.requirePages && design.pages.length === 0) {
67
215
  throw polotnoError('DESIGN_INVALID', 'Invalid Polotno design: no pages — did you pass `store.toJSON()`?', { errors: [{ path: 'pages', message: 'no pages' }] });
68
216
  }
69
217
  return design;
70
218
  }
71
- //# sourceMappingURL=normalize.js.map
package/lib/schema.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const CURRENT_SCHEMA_VERSION = 4;
3
+ export declare const ELEMENT_TYPES: readonly ["text", "image", "svg", "line", "figure", "gif", "video", "table", "group"];
3
4
  /** Non-strict: strips unknown keys, fills defaults. `normalizeDesign` uses this. */
4
5
  export declare const designSchemaLenient: z.ZodObject<{
5
6
  schemaVersion: z.ZodDefault<z.ZodNumber>;
@@ -706,4 +707,12 @@ export interface ValidateOptions {
706
707
  export declare function cloneDropNulls(value: any): any;
707
708
  export declare function validateDesign(input: unknown, opts?: ValidateOptions): ValidationResult;
708
709
  export declare function assertValidDesign(input: unknown, opts?: ValidateOptions): void;
709
- //# sourceMappingURL=schema.d.ts.map
710
+ /**
711
+ * Validate AND normalize in a single schema pass (safeParse both raises the
712
+ * same DESIGN_INVALID as `assertValidDesign` and returns the defaults-filled
713
+ * result) — designs are re-cloned/re-parsed nowhere else on the hot path.
714
+ * For canonical mode the single pass is equally faithful: input that passes
715
+ * the strict schema has no unknown keys, so its parse result equals the
716
+ * lenient one.
717
+ */
718
+ export declare function parseValidDesign(input: unknown, opts?: ValidateOptions): unknown;
package/lib/schema.js CHANGED
@@ -1,6 +1,7 @@
1
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
2
+ // of truth for the package: default values (inline `.default(...)`, except the
3
+ // text rendering defaults, which live in `./defaults` so renderers can share
4
+ // them), validation, and the generated JSON Schema all come from here. TypeScript types are the
4
5
  // hand-written `./types` (zod can't cleanly infer the recursive group type).
5
6
  //
6
7
  // The whole schema is built by `build(o)` (where `o` is the zod object
@@ -18,7 +19,21 @@
18
19
  // stripping) — normalize is "fill defaults + validate", exact for clean input.
19
20
  import { z } from 'zod';
20
21
  import { polotnoError } from './errors.js';
22
+ import { TEXT_DEFAULTS } from './defaults.js';
21
23
  export const CURRENT_SCHEMA_VERSION = 4;
24
+ // Every element type the design format knows. Kept in sync with the
25
+ // element discriminatedUnion in build() below.
26
+ export const ELEMENT_TYPES = [
27
+ 'text',
28
+ 'image',
29
+ 'svg',
30
+ 'line',
31
+ 'figure',
32
+ 'gif',
33
+ 'video',
34
+ 'table',
35
+ 'group',
36
+ ];
22
37
  // `o` is the object constructor (`z.object` for lenient, `z.strictObject` for
23
38
  // canonical), passed concretely so its precise generic return type is preserved
24
39
  // — a `strict ? z.strictObject : z.object` ternary would widen to a union and
@@ -91,30 +106,30 @@ function build(o) {
91
106
  type: z.literal('text'),
92
107
  text: z.string().default('').describe('Visible text shown on canvas.'),
93
108
  placeholder: z.string().default('').describe('Placeholder text shown when empty.'),
94
- fontSize: z.number().default(14).describe('Font size in pixels.'),
95
- fontFamily: z.string().default('Roboto').describe('Font family name.'),
96
- fontStyle: z.string().default('normal').describe("Font style: 'normal' or 'italic'."),
97
- fontWeight: z.string().default('normal').describe("Font weight: 'normal', 'bold', or numeric string."),
98
- textDecoration: z.string().default('').describe('Text decoration (e.g. underline, line-through).'),
99
- textTransform: z.string().default('none').describe('Text transform: uppercase, lowercase, capitalize, none.'),
100
- fill: z.string().default('black').describe('Text color.'),
109
+ fontSize: z.number().default(TEXT_DEFAULTS.fontSize).describe('Font size in pixels.'),
110
+ fontFamily: z.string().default(TEXT_DEFAULTS.fontFamily).describe('Font family name.'),
111
+ fontStyle: z.string().default(TEXT_DEFAULTS.fontStyle).describe("Font style: 'normal' or 'italic'."),
112
+ fontWeight: z.string().default(TEXT_DEFAULTS.fontWeight).describe("Font weight: 'normal', 'bold', or numeric string."),
113
+ textDecoration: z.string().default(TEXT_DEFAULTS.textDecoration).describe('Text decoration (e.g. underline, line-through).'),
114
+ textTransform: z.string().default(TEXT_DEFAULTS.textTransform).describe('Text transform: uppercase, lowercase, capitalize, none.'),
115
+ fill: z.string().default(TEXT_DEFAULTS.fill).describe('Text color.'),
101
116
  // model stores align as a free string (loadJSON can emit e.g. 'start')
102
- align: z.string().default('center').describe('Horizontal alignment (commonly left | center | right | justify).'),
117
+ align: z.string().default(TEXT_DEFAULTS.align).describe('Horizontal alignment (commonly left | center | right | justify).'),
103
118
  width: z.number().default(100).describe('Width in pixels.'),
104
119
  height: z.number().default(0).describe('Height in pixels (0 until measured/rendered).'),
105
120
  verticalAlign: z.string().default('top').describe('Vertical alignment: top, middle, bottom.'),
106
- strokeWidth: z.number().default(0).describe('Stroke width in pixels.'),
107
- stroke: z.string().default('black').describe('Stroke color.'),
108
- strokeLineJoin: z.string().default('round').describe('Stroke corner join: round, miter, bevel.'),
109
- lineHeight: z.union([z.number(), z.string()]).default(1.2).describe("Line height multiplier or 'auto'."),
110
- letterSpacing: z.number().default(0).describe('Letter spacing as a fraction of font size.'),
121
+ strokeWidth: z.number().default(TEXT_DEFAULTS.strokeWidth).describe('Stroke width in pixels.'),
122
+ stroke: z.string().default(TEXT_DEFAULTS.stroke).describe('Stroke color.'),
123
+ strokeLineJoin: z.string().default(TEXT_DEFAULTS.strokeLineJoin).describe('Stroke corner join: round, miter, bevel.'),
124
+ lineHeight: z.union([z.number(), z.string()]).default(TEXT_DEFAULTS.lineHeight).describe("Line height multiplier or 'auto'."),
125
+ letterSpacing: z.number().default(TEXT_DEFAULTS.letterSpacing).describe('Letter spacing as a fraction of font size.'),
111
126
  backgroundEnabled: z.boolean().default(false).describe('Whether the text background is enabled.'),
112
127
  backgroundColor: z.string().default('#7ED321').describe('Text background color.'),
113
128
  backgroundOpacity: z.number().default(1).describe('Text background opacity (0-1).'),
114
129
  backgroundCornerRadius: z.number().default(0.5).describe('Text background corner radius.'),
115
130
  backgroundPadding: z.number().default(0.5).describe('Text background padding.'),
116
- curveEnabled: z.boolean().default(false).describe('Whether the text curve effect is enabled.'),
117
- curvePower: z.number().default(0.5).describe('Text curve power (-1 to 1, 0 = straight).'),
131
+ curveEnabled: z.boolean().default(TEXT_DEFAULTS.curveEnabled).describe('Whether the text curve effect is enabled.'),
132
+ curvePower: z.number().default(TEXT_DEFAULTS.curvePower).describe('Text curve power (-1 to 1, 0 = straight).'),
118
133
  legacyBackground: z.boolean().optional().describe('Internal compatibility flag stamped by the v2→v3 migration.'),
119
134
  };
120
135
  const imageShape = { ...shapeBase, ...imageProps, type: z.literal('image') };
@@ -259,7 +274,9 @@ function build(o) {
259
274
  animations: z.array(animation).default([]),
260
275
  children: z.array(element).default([]).describe('Child elements in this group.'),
261
276
  });
262
- const element = z.lazy(() => z.discriminatedUnion('type', [
277
+ const element = z.lazy(() =>
278
+ // Keep ELEMENT_TYPES (below) in sync with this union.
279
+ z.discriminatedUnion('type', [
263
280
  o(textShape),
264
281
  o(imageShape),
265
282
  o(svgShape),
@@ -413,15 +430,31 @@ export function validateDesign(input, opts = {}) {
413
430
  ? { valid: true, errors: [] }
414
431
  : { valid: false, errors: toErrors(result.error.issues) };
415
432
  }
433
+ // Message prefix `Invalid Polotno design:` is frozen (legacy matchers);
434
+ // the code + details are the stable contract going forward.
435
+ function throwInvalidDesign(errors) {
436
+ const summary = errors.slice(0, 10).map((e) => ` ${e.path}: ${e.message}`).join('\n');
437
+ throw polotnoError('DESIGN_INVALID', `Invalid Polotno design:\n${summary}`, {
438
+ errors,
439
+ });
440
+ }
416
441
  export function assertValidDesign(input, opts = {}) {
417
442
  const { valid, errors } = validateDesign(input, opts);
418
- if (!valid) {
419
- // Message prefix `Invalid Polotno design:` is frozen (legacy matchers);
420
- // the code + details are the stable contract going forward.
421
- const summary = errors.slice(0, 10).map((e) => ` ${e.path}: ${e.message}`).join('\n');
422
- throw polotnoError('DESIGN_INVALID', `Invalid Polotno design:\n${summary}`, {
423
- errors,
424
- });
425
- }
443
+ if (!valid)
444
+ throwInvalidDesign(errors);
445
+ }
446
+ /**
447
+ * Validate AND normalize in a single schema pass (safeParse both raises the
448
+ * same DESIGN_INVALID as `assertValidDesign` and returns the defaults-filled
449
+ * result) — designs are re-cloned/re-parsed nowhere else on the hot path.
450
+ * For canonical mode the single pass is equally faithful: input that passes
451
+ * the strict schema has no unknown keys, so its parse result equals the
452
+ * lenient one.
453
+ */
454
+ export function parseValidDesign(input, opts = {}) {
455
+ const schema = opts.mode === 'canonical' ? designSchemaCanonical : designSchemaLenient;
456
+ const result = schema.safeParse(cloneDropNulls(input));
457
+ if (!result.success)
458
+ throwInvalidDesign(toErrors(result.error.issues));
459
+ return result.data;
426
460
  }
427
- //# sourceMappingURL=schema.js.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=types-parity.d.ts.map
@@ -8,4 +8,3 @@
8
8
  // positions). The recursive types (group/page/design) can't be inferred from
9
9
  // zod and are therefore not covered — see the note in `./types.ts`.
10
10
  export {};
11
- //# sourceMappingURL=types-parity.js.map
package/lib/types.d.ts CHANGED
@@ -356,4 +356,3 @@ export interface TableElement extends Omit<ShapeAttributes, 'blurEnabled' | 'blu
356
356
  cellBackground: string;
357
357
  cellPadding: number;
358
358
  }
359
- //# sourceMappingURL=types.d.ts.map
package/lib/types.js CHANGED
@@ -19,4 +19,3 @@
19
19
  // These reflect NORMALIZED output, so every field with a schema default is
20
20
  // present (required) here, even when it's an empty string / zero.
21
21
  export {};
22
- //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@polotno/schema",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Canonical Polotno design format: types, normalize, validate, JSON Schema. Authored in zod, DOM-free.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",
7
+ "sideEffects": false,
7
8
  "main": "./lib/index.js",
8
9
  "types": "./lib/index.d.ts",
9
10
  "exports": {
@@ -11,6 +12,10 @@
11
12
  "import": "./lib/index.js",
12
13
  "types": "./lib/index.d.ts"
13
14
  },
15
+ "./defaults": {
16
+ "import": "./lib/defaults.js",
17
+ "types": "./lib/defaults.d.ts"
18
+ },
14
19
  "./json": {
15
20
  "import": "./lib/design.schema.json"
16
21
  },
@@ -18,11 +23,6 @@
18
23
  },
19
24
  "author": "Anton Lavrenov",
20
25
  "homepage": "https://polotno.com",
21
- "repository": {
22
- "type": "git",
23
- "url": "git+https://github.com/polotno-project/polotno.git",
24
- "directory": "packages/schema"
25
- },
26
26
  "keywords": [
27
27
  "polotno",
28
28
  "design",
@@ -46,10 +46,10 @@
46
46
  },
47
47
  "devDependencies": {
48
48
  "typescript": "~6.0.3",
49
- "vitest": "^4.1.9"
49
+ "vitest": "^4.1.10"
50
50
  },
51
51
  "scripts": {
52
- "build": "tsc && node scripts/generate-schema.mjs",
52
+ "build": "rm -rf lib && tsc && node scripts/generate-schema.mjs && node ../../scripts/check-pack.mjs",
53
53
  "build:schema": "node scripts/generate-schema.mjs",
54
54
  "typecheck": "tsc --noEmit",
55
55
  "test": "vitest run"
@@ -1 +0,0 @@
1
- {"version":3,"file":"bleed.d.ts","sourceRoot":"","sources":["../src/bleed.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,aAAa,CAQhB;AAKD,eAAO,MAAM,UAAU,EAAE,aAKvB,CAAC"}
package/lib/bleed.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"bleed.js","sourceRoot":"","sources":["../src/bleed.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8EAA8E;AAC9E,gFAAgF;AAChF,0EAA0E;AAC1E,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,6EAA6E;AAS7E,MAAM,UAAU,YAAY,CAAC,CAM5B;IACC,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAC1B,OAAO;QACL,GAAG,EAAE,CAAC,CAAC,QAAQ,IAAI,IAAI;QACvB,KAAK,EAAE,CAAC,CAAC,UAAU,IAAI,IAAI;QAC3B,MAAM,EAAE,CAAC,CAAC,WAAW,IAAI,IAAI;QAC7B,IAAI,EAAE,CAAC,CAAC,SAAS,IAAI,IAAI;KAC1B,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,4EAA4E;AAC5E,iDAAiD;AACjD,MAAM,CAAC,MAAM,UAAU,GAAkB,MAAM,CAAC,MAAM,CAAC;IACrD,GAAG,EAAE,CAAC;IACN,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;CACR,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- export declare const OVERRIDABLE_KEYS: readonly ["fontSize", "fontFamily", "fontWeight", "fontStyle", "textDecoration", "textTransform", "fill", "align", "verticalAlign", "lineHeight", "letterSpacing", "strokeWidth", "stroke", "cellBackground", "cellPadding"];
2
- export declare const OVERRIDABLE_KEYS_SET: Set<string>;
3
- export declare const TABLE_NONSENSICAL_KEYS: string[];
4
- export declare const DIRECT_KEYS: readonly ["id", "type", "text", "opacity", "rowSpan", "colSpan", "mergedInto", "name", "custom", "borders"];
5
- export declare const CELL_DIRECT_DEFAULTS: Record<string, number | string>;
6
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,8NAgBnB,CAAC;AAEX,eAAO,MAAM,oBAAoB,aAAoC,CAAC;AAItE,eAAO,MAAM,sBAAsB,UAclC,CAAC;AAGF,eAAO,MAAM,WAAW,6GAWd,CAAC;AAIX,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKhE,CAAC"}
package/lib/constants.js DELETED
@@ -1,61 +0,0 @@
1
- // Table key-sets, extracted verbatim from `table-model.ts`. Shared by the table
2
- // snapshot processors here and (re-imported) by core's `cell.set` logic.
3
- // Cell text-styling props that fall back to the table default when unset. On a
4
- // cell snapshot they are stored `_`-prefixed (`_fontSize`).
5
- export const OVERRIDABLE_KEYS = [
6
- 'fontSize',
7
- 'fontFamily',
8
- 'fontWeight',
9
- 'fontStyle',
10
- 'textDecoration',
11
- 'textTransform',
12
- 'fill',
13
- 'align',
14
- 'verticalAlign',
15
- 'lineHeight',
16
- 'letterSpacing',
17
- 'strokeWidth',
18
- 'stroke',
19
- 'cellBackground',
20
- 'cellPadding',
21
- ];
22
- export const OVERRIDABLE_KEYS_SET = new Set(OVERRIDABLE_KEYS);
23
- // Props inherited from Shape that are nonsensical for tables — stripped from the
24
- // table snapshot in postProcess.
25
- export const TABLE_NONSENSICAL_KEYS = [
26
- 'blurEnabled',
27
- 'blurRadius',
28
- 'brightnessEnabled',
29
- 'brightness',
30
- 'sepiaEnabled',
31
- 'grayscaleEnabled',
32
- 'filters',
33
- 'shadowEnabled',
34
- 'shadowBlur',
35
- 'shadowOffsetX',
36
- 'shadowOffsetY',
37
- 'shadowColor',
38
- 'shadowOpacity',
39
- ];
40
- // Non-overridable direct cell props (kept as-is on the cell snapshot).
41
- export const DIRECT_KEYS = [
42
- 'id',
43
- 'type',
44
- 'text',
45
- 'opacity',
46
- 'rowSpan',
47
- 'colSpan',
48
- 'mergedInto',
49
- 'name',
50
- 'custom',
51
- 'borders',
52
- ];
53
- // Direct cell props whose value, when equal to the default, is stripped from the
54
- // snapshot. NOTE: 'type' and 'text' are intentionally NOT here.
55
- export const CELL_DIRECT_DEFAULTS = {
56
- opacity: 1,
57
- rowSpan: 1,
58
- colSpan: 1,
59
- name: '',
60
- };
61
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,yEAAyE;AAEzE,+EAA+E;AAC/E,4DAA4D;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,UAAU;IACV,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,gBAAgB;IAChB,eAAe;IACf,MAAM;IACN,OAAO;IACP,eAAe;IACf,YAAY;IACZ,eAAe;IACf,aAAa;IACb,QAAQ;IACR,gBAAgB;IAChB,aAAa;CACL,CAAC;AAEX,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAS,gBAAgB,CAAC,CAAC;AAEtE,iFAAiF;AACjF,iCAAiC;AACjC,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,aAAa;IACb,YAAY;IACZ,mBAAmB;IACnB,YAAY;IACZ,cAAc;IACd,kBAAkB;IAClB,SAAS;IACT,eAAe;IACf,YAAY;IACZ,eAAe;IACf,eAAe;IACf,aAAa;IACb,eAAe;CAChB,CAAC;AAEF,uEAAuE;AACvE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI;IACJ,MAAM;IACN,MAAM;IACN,SAAS;IACT,SAAS;IACT,SAAS;IACT,YAAY;IACZ,MAAM;IACN,QAAQ;IACR,SAAS;CACD,CAAC;AAEX,iFAAiF;AACjF,gEAAgE;AAChE,MAAM,CAAC,MAAM,oBAAoB,GAAoC;IACnE,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,EAAE;CACT,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,aAAa;;;;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UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACpC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACtC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;IAChF,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;CACxC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,iDAAiD;AACjD,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAEhD,MAAM,WAAW,YAAa,SAAQ,KAAK;IACzC,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,KAAK,CAAC,EAAE,OAAO,GACd,YAAY,CAMd"}
package/lib/errors.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,MAAM,UAAU,YAAY,CAC1B,IAAsB,EACtB,OAAe,EACf,OAA6B,EAC7B,KAAe;IAEf,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,OAAO,CAAiB,CAAC;IAC/C,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;IAChB,IAAI,OAAO,KAAK,SAAS;QAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;IACjD,IAAI,KAAK,KAAK,SAAS;QAAE,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;IAC3C,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC9D,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACtD,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,mBAAmB,YAAY,CAAC"}
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,gFAAgF;AAChF,8EAA8E;AAC9E,iEAAiE;AAIjE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG9D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGtD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,aAAa,CAAC"}
package/lib/migrate.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export interface MigrateOptions {
2
- applyHtmlTextMigrations: boolean;
3
- modernizeTextBackground?: boolean;
4
- }
5
- export declare function migrateDesign(json: any, opts: MigrateOptions): any;
6
- //# sourceMappingURL=migrate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../src/migrate.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,cAAc;IAI7B,uBAAuB,EAAE,OAAO,CAAC;IAGjC,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAMD,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,GAAG,GAAG,CAmDlE"}