@polotno/schema 0.6.0 → 0.6.2
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 +20 -3
- package/lib/design.schema.json +10 -21
- package/lib/schema.js +4 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -46,9 +46,26 @@ const complete = normalizeDesign(partial);
|
|
|
46
46
|
// every default filled in, unknown keys stripped
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
Idempotent and exact for current-format input. It
|
|
50
|
-
`schemaVersion` documents, and it leaves render-derived
|
|
51
|
-
auto-height) for the editor to compute.
|
|
49
|
+
Idempotent and exact for current-format input. It migrates older
|
|
50
|
+
`schemaVersion` documents up first (see below), and it leaves render-derived
|
|
51
|
+
values (e.g. text auto-height) for the editor to compute.
|
|
52
|
+
|
|
53
|
+
## Schema versions
|
|
54
|
+
|
|
55
|
+
Every design carries a `schemaVersion`. `normalizeDesign` / `parseDesign` migrate
|
|
56
|
+
an older document up to the current version before validating, so a consumer
|
|
57
|
+
never has to handle an old shape. A **missing** `schemaVersion` means 0 — the
|
|
58
|
+
oldest format, not the newest.
|
|
59
|
+
|
|
60
|
+
| Version | What changed |
|
|
61
|
+
| ------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
62
|
+
| 1 | `letterSpacing` is a ratio of the element's own `fontSize`, no longer of a 16px root. |
|
|
63
|
+
| 2 | Filter `intensity` moved from `-100..100` to `-1..1`. |
|
|
64
|
+
| 3 | Text backgrounds render as per-line polygons; pre-v3 rich text is stamped `legacyBackground` to keep the old full rect. |
|
|
65
|
+
| 4 | Video time anchoring changed. Marker only — no document transform. |
|
|
66
|
+
|
|
67
|
+
Steps 1 and 3 apply only to the modern text renderers, which every converter
|
|
68
|
+
uses.
|
|
52
69
|
|
|
53
70
|
## JSON Schema
|
|
54
71
|
|
package/lib/design.schema.json
CHANGED
|
@@ -517,13 +517,9 @@
|
|
|
517
517
|
"lineHeight": {
|
|
518
518
|
"default": 1.2,
|
|
519
519
|
"description": "Line height multiplier or 'auto'.",
|
|
520
|
-
"
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
},
|
|
524
|
-
{
|
|
525
|
-
"type": "string"
|
|
526
|
-
}
|
|
520
|
+
"type": [
|
|
521
|
+
"number",
|
|
522
|
+
"string"
|
|
527
523
|
]
|
|
528
524
|
},
|
|
529
525
|
"letterSpacing": {
|
|
@@ -1109,6 +1105,7 @@
|
|
|
1109
1105
|
},
|
|
1110
1106
|
"keepRatio": {
|
|
1111
1107
|
"default": true,
|
|
1108
|
+
"description": "Whether to maintain aspect ratio when resizing.",
|
|
1112
1109
|
"type": "boolean"
|
|
1113
1110
|
},
|
|
1114
1111
|
"stretchEnabled": {
|
|
@@ -2610,13 +2607,9 @@
|
|
|
2610
2607
|
},
|
|
2611
2608
|
"lineHeight": {
|
|
2612
2609
|
"description": "Line height multiplier or 'auto' (inherits from the table when omitted).",
|
|
2613
|
-
"
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
},
|
|
2617
|
-
{
|
|
2618
|
-
"type": "string"
|
|
2619
|
-
}
|
|
2610
|
+
"type": [
|
|
2611
|
+
"number",
|
|
2612
|
+
"string"
|
|
2620
2613
|
]
|
|
2621
2614
|
},
|
|
2622
2615
|
"letterSpacing": {
|
|
@@ -2714,13 +2707,9 @@
|
|
|
2714
2707
|
"lineHeight": {
|
|
2715
2708
|
"default": 1.2,
|
|
2716
2709
|
"description": "Default line height multiplier or 'auto'.",
|
|
2717
|
-
"
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
},
|
|
2721
|
-
{
|
|
2722
|
-
"type": "string"
|
|
2723
|
-
}
|
|
2710
|
+
"type": [
|
|
2711
|
+
"number",
|
|
2712
|
+
"string"
|
|
2724
2713
|
]
|
|
2725
2714
|
},
|
|
2726
2715
|
"letterSpacing": {
|
package/lib/schema.js
CHANGED
|
@@ -314,7 +314,10 @@ function build(o) {
|
|
|
314
314
|
cropY: z.number().default(0),
|
|
315
315
|
cropWidth: z.number().default(1),
|
|
316
316
|
cropHeight: z.number().default(1),
|
|
317
|
-
keepRatio: z
|
|
317
|
+
keepRatio: z
|
|
318
|
+
.boolean()
|
|
319
|
+
.default(true)
|
|
320
|
+
.describe('Whether to maintain aspect ratio when resizing.'),
|
|
318
321
|
stretchEnabled: z.boolean().default(true),
|
|
319
322
|
flipX: z.boolean().default(false),
|
|
320
323
|
flipY: z.boolean().default(false),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polotno/schema",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
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",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"LICENSE.md"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"zod": "^4.
|
|
45
|
+
"zod": "^4.6.5"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"typescript": "~6.0.3",
|
|
49
|
-
"vitest": "^
|
|
49
|
+
"vitest": "^5.0.1"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "rm -rf lib && tsc && node scripts/generate-schema.mjs && node ../../scripts/check-pack.mjs",
|