@polotno/schema 0.12.0 → 0.13.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 +4 -0
- package/lib/defaults.d.ts +18 -0
- package/lib/defaults.js +21 -0
- package/lib/design.schema.json +1 -1
- package/lib/normalize.js +39 -5
- package/lib/schema.js +31 -8
- package/lib/types.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,6 +50,10 @@ Idempotent and exact for current-format input. It migrates older
|
|
|
50
50
|
`schemaVersion` documents up first (see below), and it leaves render-derived
|
|
51
51
|
values (e.g. text auto-height) for the editor to compute.
|
|
52
52
|
|
|
53
|
+
It reads an element `width` or `height` of 0 or less, or `null`, as 1, as the
|
|
54
|
+
editor does when it loads the design. A text `height` of 0 stays 0: it means
|
|
55
|
+
"not measured yet".
|
|
56
|
+
|
|
53
57
|
## Schema versions
|
|
54
58
|
|
|
55
59
|
Every design carries a `schemaVersion`. `normalizeDesign` / `parseDesign` migrate
|
package/lib/defaults.d.ts
CHANGED
|
@@ -78,6 +78,24 @@ export declare const MIN_FONT_SIZE = 1;
|
|
|
78
78
|
* the table", which is not a size to clamp.
|
|
79
79
|
*/
|
|
80
80
|
export declare const clampFontSize: <T extends number | undefined>(size: T) => T;
|
|
81
|
+
/**
|
|
82
|
+
* The smallest width or height an element holds, and the size a stored width
|
|
83
|
+
* or height reads as when it is not a positive finite number: zero, negative,
|
|
84
|
+
* NaN, ±Infinity or null. One rule, no negative-size semantics. The editor's
|
|
85
|
+
* transformer never makes such a box, so only hand-written JSON holds one.
|
|
86
|
+
*
|
|
87
|
+
* The editor's model applies it to every element it loads (polotno's
|
|
88
|
+
* `shape-model.ts`), and the schema's normalize step applies it for every
|
|
89
|
+
* converter, so a 0×70 box is the same 1px column on the Canvas and in every
|
|
90
|
+
* export. Text height is exempt: 0 there means "not measured yet"
|
|
91
|
+
* (@polotno/core's `hasMeasuredHeight`), and the text model keeps it.
|
|
92
|
+
*/
|
|
93
|
+
export declare const MIN_ELEMENT_SIZE = 1;
|
|
94
|
+
/**
|
|
95
|
+
* Apply that rule to a stored width or height. A non-number other than null
|
|
96
|
+
* passes through unchanged, so validation still rejects it.
|
|
97
|
+
*/
|
|
98
|
+
export declare const clampElementSize: <T>(size: T) => T | number;
|
|
81
99
|
export declare const BLEND_MODES: readonly ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'];
|
|
82
100
|
export declare const GROUP_BLEND_MODES: readonly ["pass-through", "normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
|
|
83
101
|
/** The page size, on both sides, of a design that names none. */
|
package/lib/defaults.js
CHANGED
|
@@ -126,6 +126,27 @@ export const MIN_FONT_SIZE = 1;
|
|
|
126
126
|
* the table", which is not a size to clamp.
|
|
127
127
|
*/
|
|
128
128
|
export const clampFontSize = (size) => (size != null && size < MIN_FONT_SIZE ? MIN_FONT_SIZE : size);
|
|
129
|
+
/**
|
|
130
|
+
* The smallest width or height an element holds, and the size a stored width
|
|
131
|
+
* or height reads as when it is not a positive finite number: zero, negative,
|
|
132
|
+
* NaN, ±Infinity or null. One rule, no negative-size semantics. The editor's
|
|
133
|
+
* transformer never makes such a box, so only hand-written JSON holds one.
|
|
134
|
+
*
|
|
135
|
+
* The editor's model applies it to every element it loads (polotno's
|
|
136
|
+
* `shape-model.ts`), and the schema's normalize step applies it for every
|
|
137
|
+
* converter, so a 0×70 box is the same 1px column on the Canvas and in every
|
|
138
|
+
* export. Text height is exempt: 0 there means "not measured yet"
|
|
139
|
+
* (@polotno/core's `hasMeasuredHeight`), and the text model keeps it.
|
|
140
|
+
*/
|
|
141
|
+
export const MIN_ELEMENT_SIZE = 1;
|
|
142
|
+
/**
|
|
143
|
+
* Apply that rule to a stored width or height. A non-number other than null
|
|
144
|
+
* passes through unchanged, so validation still rejects it.
|
|
145
|
+
*/
|
|
146
|
+
export const clampElementSize = (size) => size == null ||
|
|
147
|
+
(typeof size === 'number' && !(Number.isFinite(size) && size > 0))
|
|
148
|
+
? MIN_ELEMENT_SIZE
|
|
149
|
+
: size;
|
|
129
150
|
export const BLEND_MODES = [
|
|
130
151
|
'normal',
|
|
131
152
|
'multiply',
|
package/lib/design.schema.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"schemaVersion":{"default":5,"description":"Schema version for compatibility / migration. A design without it counts as version 0, the oldest format, and is migrated on load, so write the current version in new JSON.","type":"number"},"width":{"default":1080,"description":"Canvas width in pixels.","type":"number"},"height":{"default":1080,"description":"Canvas height in pixels.","type":"number"},"unit":{"default":"px","description":"Unit type for print measurements.","type":"string","enum":["px","pt","mm","cm","in"]},"dpi":{"default":72,"description":"Dots per inch for print calculations.","type":"number"},"custom":{"description":"Custom data attached to the design."},"fonts":{"default":[],"description":"Fonts used in the design.","type":"array","items":{"type":"object","properties":{"fontFamily":{"type":"string","description":"Font family name."},"url":{"default":"","description":"URL to load the font from (single-variant fonts).","type":"string"},"styles":{"description":"Per-weight/style variants for multi-variant families.","type":"array","items":{"type":"object","properties":{"src":{"type":"string","description":"Font source, typically in CSS url() form."},"fontStyle":{"type":"string"},"fontWeight":{"type":"string"}},"required":["src"]}}},"required":["fontFamily"]}},"pages":{"default":[],"description":"Pages in the design.","type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the page."},"width":{"default":"auto","description":"Page width in pixels or 'auto'.","anyOf":[{"type":"number"},{"type":"string","const":"auto"}]},"height":{"default":"auto","description":"Page height in pixels or 'auto'.","anyOf":[{"type":"number"},{"type":"string","const":"auto"}]},"background":{"default":"white","description":"Background color or image.","type":"string"},"bleed":{"default":0,"description":"Bleed area in pixels for print (all sides; base value for per-side overrides).","type":"number"},"bleedTop":{"description":"Per-side bleed override (top), in pixels. Inherits `bleed` when omitted.","type":"number"},"bleedRight":{"description":"Per-side bleed override (right), in pixels. Inherits `bleed` when omitted.","type":"number"},"bleedBottom":{"description":"Per-side bleed override (bottom), in pixels. Inherits `bleed` when omitted.","type":"number"},"bleedLeft":{"description":"Per-side bleed override (left), in pixels. Inherits `bleed` when omitted.","type":"number"},"custom":{},"duration":{"default":5000,"description":"Page duration in milliseconds.","type":"number"},"children":{"default":[],"description":"Elements on this page.","type":"array","items":{"$ref":"#/$defs/__schema0"}}},"required":["id"]}},"audios":{"default":[],"description":"Audio tracks in the design.","type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the audio track."},"name":{"default":"","description":"Display name shown on the timeline.","type":"string"},"src":{"default":"","description":"URL or data URI of the audio file.","type":"string"},"duration":{"default":0,"description":"Duration in milliseconds.","type":"number"},"startTime":{"default":0,"description":"Start offset (0-1).","type":"number"},"endTime":{"default":1,"description":"End offset (0-1).","type":"number"},"volume":{"default":1,"description":"Volume level (0-1).","type":"number"},"delay":{"default":0,"description":"Delay before playing, in milliseconds.","type":"number"},"speed":{"default":1,"description":"Playback speed multiplier (1 = normal).","type":"number"},"custom":{}},"required":["id"]}}},"$defs":{"__schema0":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"text","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":100,"description":"Width in pixels.","type":"number"},"height":{"default":0,"description":"Height in pixels (0 until measured/rendered).","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"text":{"default":"","description":"Visible text shown on canvas.","type":"string"},"placeholder":{"default":"","description":"Placeholder text shown when empty.","type":"string"},"fontSize":{"default":14,"description":"Font size in pixels (minimum 1).","type":"number"},"fontFamily":{"default":"Roboto","description":"Font family name.","type":"string"},"fontStyle":{"default":"normal","description":"Font style: 'normal' or 'italic'.","type":"string"},"fontWeight":{"default":"normal","description":"Font weight: 'normal', 'bold', or numeric string.","type":"string"},"textDecoration":{"default":"","description":"Text decoration (e.g. underline, line-through).","type":"string"},"textTransform":{"default":"none","description":"Text transform: uppercase, lowercase, capitalize, none.","type":"string"},"fill":{"default":"black","description":"Text color.","type":"string"},"align":{"default":"center","description":"Horizontal alignment (commonly left | center | right | justify).","type":"string"},"verticalAlign":{"default":"top","description":"Vertical alignment: top, middle, bottom.","type":"string"},"strokeWidth":{"default":0,"description":"Stroke width in pixels.","type":"number"},"stroke":{"default":"black","description":"Stroke color.","type":"string"},"strokeLineJoin":{"default":"round","description":"Stroke corner join: round, miter, bevel.","type":"string"},"lineHeight":{"default":1.2,"description":"Line height multiplier or 'auto'.","type":["number","string"]},"letterSpacing":{"default":0,"description":"Letter spacing as a fraction of font size.","type":"number"},"backgroundEnabled":{"default":false,"description":"Whether the text background is enabled.","type":"boolean"},"backgroundColor":{"default":"#7ED321","description":"Text background color.","type":"string"},"backgroundOpacity":{"default":1,"description":"Text background opacity (0-1).","type":"number"},"backgroundCornerRadius":{"default":0.5,"description":"Text background corner radius.","type":"number"},"backgroundPadding":{"default":0.5,"description":"Text background padding.","type":"number"},"borderColor":{"default":"black","description":"Text box border color.","type":"string"},"borderSize":{"default":0,"description":"Text box border width in pixels.","type":"number"},"curveEnabled":{"default":false,"description":"Whether the text curve effect is enabled.","type":"boolean"},"curvePower":{"default":0.5,"description":"Text curve power (-1 to 1, 0 = straight).","type":"number"},"legacyBackground":{"description":"Internal compatibility flag stamped by the v2→v3 migration.","type":"boolean"},"textOverflow":{"description":"What to do when the text does not fit: 'resize' | 'ellipsis' | 'fit'. Missing (or unknown) follows the global setting.","type":"string"},"maxLines":{"description":"Line cap in every overflow mode; text past it ends in an ellipsis.","type":"number"},"minFontSize":{"description":"Smallest size 'fit' may draw at, in pixels.","type":"number"},"maxFontSize":{"description":"Largest size 'fit' may draw at, in pixels (defaults to fontSize). Above fontSize it grows text to fit.","type":"number"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"image","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":100,"description":"Width in pixels.","type":"number"},"height":{"default":100,"description":"Height in pixels.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"src":{"default":"","description":"URL or data URI of the image file.","type":"string"},"cropX":{"default":0,"description":"Crop X offset as a fraction (0-1).","type":"number"},"cropY":{"default":0,"description":"Crop Y offset as a fraction (0-1).","type":"number"},"cropWidth":{"default":1,"description":"Crop width as a fraction (0-1).","type":"number"},"cropHeight":{"default":1,"description":"Crop height as a fraction (0-1).","type":"number"},"cornerRadius":{"default":0,"description":"Corner radius in pixels.","type":"number"},"flipX":{"default":false,"description":"Whether the image is flipped horizontally.","type":"boolean"},"flipY":{"default":false,"description":"Whether the image is flipped vertically.","type":"boolean"},"clipSrc":{"default":"","description":"URL or data URI for a clipping mask.","type":"string"},"borderColor":{"default":"black","description":"Border color.","type":"string"},"borderSize":{"default":0,"description":"Border width in pixels.","type":"number"},"keepRatio":{"default":false,"description":"Whether to maintain aspect ratio when resizing.","type":"boolean"},"stretchEnabled":{"default":false,"description":"Whether stretch mode is enabled.","type":"boolean"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"svg","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":100,"description":"Width in pixels.","type":"number"},"height":{"default":100,"description":"Height in pixels.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"src":{"default":"","description":"URL or data URI of the SVG.","type":"string"},"maskSrc":{"default":"","description":"URL or data URI for an SVG mask.","type":"string"},"cropX":{"default":0,"description":"Crop X offset as a fraction (0-1).","type":"number"},"cropY":{"default":0,"description":"Crop Y offset as a fraction (0-1).","type":"number"},"cropWidth":{"default":1,"description":"Crop width as a fraction (0-1).","type":"number"},"cropHeight":{"default":1,"description":"Crop height as a fraction (0-1).","type":"number"},"keepRatio":{"default":true,"description":"Whether to maintain aspect ratio when resizing.","type":"boolean"},"stretchEnabled":{"default":true,"description":"Whether stretch mode is enabled.","type":"boolean"},"flipX":{"default":false,"description":"Whether the image is flipped horizontally.","type":"boolean"},"flipY":{"default":false,"description":"Whether the image is flipped vertically.","type":"boolean"},"borderColor":{"default":"black","description":"Border color.","type":"string"},"borderSize":{"default":0,"description":"Border width in pixels.","type":"number"},"cornerRadius":{"default":0,"description":"Corner radius in pixels.","type":"number"},"colorsReplace":{"default":{},"description":"Color replacement mappings (original → replacement).","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"line","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":400,"description":"Width in pixels.","type":"number"},"height":{"default":10,"description":"Height in pixels.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"color":{"default":"black","description":"Line color.","type":"string"},"dash":{"default":[],"description":"Dash pattern array.","type":"array","items":{"type":"number"}},"startHead":{"default":"","description":"Start arrow head: empty, arrow, circle, square, bar.","type":"string"},"endHead":{"default":"","description":"End arrow head: empty, arrow, circle, square, bar.","type":"string"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"figure","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":100,"description":"Width in pixels.","type":"number"},"height":{"default":100,"description":"Height in pixels.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"subType":{"default":"rect","description":"Figure subtype: rect, ellipse, triangle, etc.","type":"string"},"fill":{"default":"rgb(0, 161, 255)","description":"Fill color.","type":"string"},"dash":{"default":[],"description":"Dash pattern array.","type":"array","items":{"type":"number"}},"strokeWidth":{"default":0,"description":"Stroke width in pixels.","type":"number"},"stroke":{"default":"rgba(98, 197, 255, 1)","description":"Stroke color.","type":"string"},"cornerRadius":{"default":0,"description":"Corner radius in pixels.","type":"number"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"gif","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":100,"description":"Width in pixels.","type":"number"},"height":{"default":100,"description":"Height in pixels.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"src":{"default":"","description":"URL or data URI of the image file.","type":"string"},"cropX":{"default":0,"description":"Crop X offset as a fraction (0-1).","type":"number"},"cropY":{"default":0,"description":"Crop Y offset as a fraction (0-1).","type":"number"},"cropWidth":{"default":1,"description":"Crop width as a fraction (0-1).","type":"number"},"cropHeight":{"default":1,"description":"Crop height as a fraction (0-1).","type":"number"},"cornerRadius":{"default":0,"description":"Corner radius in pixels.","type":"number"},"flipX":{"default":false,"description":"Whether the image is flipped horizontally.","type":"boolean"},"flipY":{"default":false,"description":"Whether the image is flipped vertically.","type":"boolean"},"clipSrc":{"default":"","description":"URL or data URI for a clipping mask.","type":"string"},"borderColor":{"default":"black","description":"Border color.","type":"string"},"borderSize":{"default":0,"description":"Border width in pixels.","type":"number"},"keepRatio":{"default":true,"description":"Whether to maintain aspect ratio when resizing.","type":"boolean"},"stretchEnabled":{"default":false,"description":"Whether stretch mode is enabled.","type":"boolean"},"duration":{"default":0,"description":"GIF duration in milliseconds.","type":"number"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"lottie","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":100,"description":"Width in pixels.","type":"number"},"height":{"default":100,"description":"Height in pixels.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"src":{"default":"","description":"URL or data URI of the image file.","type":"string"},"cropX":{"default":0,"description":"Crop X offset as a fraction (0-1).","type":"number"},"cropY":{"default":0,"description":"Crop Y offset as a fraction (0-1).","type":"number"},"cropWidth":{"default":1,"description":"Crop width as a fraction (0-1).","type":"number"},"cropHeight":{"default":1,"description":"Crop height as a fraction (0-1).","type":"number"},"cornerRadius":{"default":0,"description":"Corner radius in pixels.","type":"number"},"flipX":{"default":false,"description":"Whether the image is flipped horizontally.","type":"boolean"},"flipY":{"default":false,"description":"Whether the image is flipped vertically.","type":"boolean"},"clipSrc":{"default":"","description":"URL or data URI for a clipping mask.","type":"string"},"borderColor":{"default":"black","description":"Border color.","type":"string"},"borderSize":{"default":0,"description":"Border width in pixels.","type":"number"},"keepRatio":{"default":true,"description":"Whether to maintain aspect ratio when resizing.","type":"boolean"},"stretchEnabled":{"default":false,"description":"Whether stretch mode is enabled.","type":"boolean"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"video","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":100,"description":"Width in pixels.","type":"number"},"height":{"default":100,"description":"Height in pixels.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"src":{"default":"","description":"URL or data URI of the image file.","type":"string"},"cropX":{"default":0,"description":"Crop X offset as a fraction (0-1).","type":"number"},"cropY":{"default":0,"description":"Crop Y offset as a fraction (0-1).","type":"number"},"cropWidth":{"default":1,"description":"Crop width as a fraction (0-1).","type":"number"},"cropHeight":{"default":1,"description":"Crop height as a fraction (0-1).","type":"number"},"cornerRadius":{"default":0,"description":"Corner radius in pixels.","type":"number"},"flipX":{"default":false,"description":"Whether the image is flipped horizontally.","type":"boolean"},"flipY":{"default":false,"description":"Whether the image is flipped vertically.","type":"boolean"},"clipSrc":{"default":"","description":"URL or data URI for a clipping mask.","type":"string"},"borderColor":{"default":"black","description":"Border color.","type":"string"},"borderSize":{"default":0,"description":"Border width in pixels.","type":"number"},"keepRatio":{"default":false,"description":"Whether to maintain aspect ratio when resizing.","type":"boolean"},"stretchEnabled":{"default":false,"description":"Whether stretch mode is enabled.","type":"boolean"},"duration":{"default":0,"description":"Video duration in milliseconds.","type":"number"},"startTime":{"default":0,"description":"Start offset (0-1).","type":"number"},"endTime":{"default":1,"description":"End offset (0-1).","type":"number"},"volume":{"default":1,"description":"Volume (0-1).","type":"number"},"speed":{"default":1,"description":"Playback speed multiplier (1 = normal).","type":"number"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"table","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":300,"description":"Width in pixels.","type":"number"},"height":{"default":200,"description":"Height in pixels.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"rows":{"default":3,"description":"Number of rows.","type":"number"},"cols":{"default":3,"description":"Number of columns.","type":"number"},"colWidths":{"default":[],"description":"Column width fractions (sum to 1).","type":"array","items":{"type":"number"}},"rowHeights":{"default":[],"description":"Row height fractions (sum to 1).","type":"array","items":{"type":"number"}},"cells":{"default":[],"description":"Flat cell array in row-major order.","type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the cell."},"type":{"default":"tablecell","description":"Cell type identifier.","type":"string","const":"tablecell"},"text":{"default":"","description":"Visible text shown in the cell.","type":"string"},"opacity":{"description":"Opacity level (0-1).","type":"number"},"rowSpan":{"description":"Number of rows this cell spans.","type":"number"},"colSpan":{"description":"Number of columns this cell spans.","type":"number"},"mergedInto":{"description":"Id of the cell this one is merged into, if any.","type":"string"},"name":{"description":"Display name for the cell.","type":"string"},"custom":{"description":"Custom data attached to the cell."},"borders":{"description":"Per-side border overrides for this cell.","type":"object","properties":{"top":{"description":"Top border override for this cell.","$ref":"#/$defs/BorderSide"},"right":{"description":"Right border override for this cell.","$ref":"#/$defs/BorderSide"},"bottom":{"description":"Bottom border override for this cell.","$ref":"#/$defs/BorderSide"},"left":{"description":"Left border override for this cell.","$ref":"#/$defs/BorderSide"}}},"fontSize":{"description":"Font size in pixels (inherits from the table when omitted, minimum 1).","type":"number"},"fontFamily":{"description":"Font family name (inherits from the table when omitted).","type":"string"},"fontWeight":{"description":"Font weight: 'normal', 'bold', or numeric string (inherits from the table when omitted).","type":"string"},"fontStyle":{"description":"Font style: 'normal' or 'italic' (inherits from the table when omitted).","type":"string"},"textDecoration":{"description":"Text decoration, e.g. underline, line-through (inherits from the table when omitted).","type":"string"},"textTransform":{"description":"Text transform: uppercase, lowercase, capitalize, none (inherits from the table when omitted).","type":"string"},"fill":{"description":"Text color (inherits from the table when omitted).","type":"string"},"align":{"description":"Horizontal alignment: left, center, right, justify (inherits from the table when omitted).","type":"string"},"verticalAlign":{"description":"Vertical alignment: top, middle, bottom (inherits from the table when omitted).","type":"string"},"lineHeight":{"description":"Line height multiplier or 'auto' (inherits from the table when omitted).","type":["number","string"]},"letterSpacing":{"description":"Letter spacing as a fraction of font size (inherits from the table when omitted).","type":"number"},"strokeWidth":{"description":"Stroke width in pixels (inherits from the table when omitted).","type":"number"},"stroke":{"description":"Stroke color (inherits from the table when omitted).","type":"string"},"cellBackground":{"description":"Cell background color (inherits from the table when omitted).","type":"string"},"cellPadding":{"description":"Cell padding in pixels (inherits from the table when omitted).","type":"number"}},"required":["id"]}},"borderColor":{"default":"#000000","description":"Default border color for the table grid.","type":"string"},"borderWidth":{"default":1,"description":"Default border width in pixels.","type":"number"},"borderStyle":{"default":"solid","description":"Default border style.","type":"string","enum":["solid","dashed","dotted","none"]},"fontSize":{"default":30,"description":"Default font size in pixels for cells (minimum 1).","type":"number"},"fontFamily":{"default":"Roboto","description":"Default font family name for cells.","type":"string"},"fontWeight":{"default":"normal","description":"Default font weight: 'normal', 'bold', or numeric string.","type":"string"},"fontStyle":{"default":"normal","description":"Default font style: 'normal' or 'italic'.","type":"string"},"textDecoration":{"default":"","description":"Default text decoration (e.g. underline, line-through).","type":"string"},"textTransform":{"default":"none","description":"Default text transform: uppercase, lowercase, capitalize, none.","type":"string"},"fill":{"default":"black","description":"Default text color for cells.","type":"string"},"align":{"default":"center","description":"Default horizontal alignment: left, center, right, justify.","type":"string"},"verticalAlign":{"default":"middle","description":"Default vertical alignment: top, middle, bottom.","type":"string"},"lineHeight":{"default":1.2,"description":"Default line height multiplier or 'auto'.","type":["number","string"]},"letterSpacing":{"default":0,"description":"Default letter spacing as a fraction of font size.","type":"number"},"strokeWidth":{"default":0,"description":"Default stroke width in pixels.","type":"number"},"stroke":{"default":"black","description":"Default stroke color.","type":"string"},"cellBackground":{"default":"transparent","description":"Default cell background color.","type":"string"},"cellPadding":{"default":4,"description":"Default cell padding in pixels.","type":"number"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"group","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the group composites with the content beneath it. Omitted means pass-through: children blend with that content directly. Any other mode composites the children together first.","type":"string","enum":["pass-through","normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"children":{"default":[],"description":"Child elements in this group.","type":"array","items":{"$ref":"#/$defs/__schema0"}}},"required":["id","type"]}]},"BlendMode":{"type":"string","enum":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]},"Animation":{"type":"object","properties":{"delay":{"default":0,"description":"Time in milliseconds, measured on the element's page, not on the whole design. On 'enter': how long after the page starts the element appears. It is hidden until then. On 'exit': how long before the page ends the element disappears. The exit finishes at that moment, and the element stays hidden after it. On 'loop': how long after the page starts the first cycle begins. It does not wait for the entrance, so a loop can be mid-cycle when the element appears. Until then the element is at rest. kenBurns ignores it, and letterWave also waits for an entrance that is a text preset to finish.","type":"number"},"duration":{"default":500,"description":"Time in milliseconds. On 'enter': how long the entrance plays, from its `delay`. On 'exit': how long the exit plays, up to the moment the element disappears. If the two together are longer than the element's time on the page, both play faster by the same factor to fit. On 'loop': the length of one cycle. Cycles repeat until the element disappears or the page ends. kenBurns ignores it and plays once across the element's whole time on the page. The default suits a transition of the whole element. Picking a preset in the editor sets a longer one: 1000 for lineRise, wordRise, wordFade, letterPop, wordBlur, lineWipe and linePeek, 50 per letter from 1000 to 4000 for typewriter, 4000 for rotate, 2500 for float, 2000 for letterWave and glow, 1500 for blink and pulse, and 1000 for shake.","type":"number"},"enabled":{"default":true,"description":"Whether the animation plays. A disabled 'enter' or 'exit' also loses its `delay`, so the element is on the page from its start or to its end. To time an element with no transition, keep it enabled with the name 'none'.","type":"boolean"},"type":{"type":"string","enum":["enter","exit","loop"],"description":"Animation phase: 'enter' brings the element onto the page, 'exit' takes it off, and 'loop' repeats while it is there, also during the entrance and the exit."},"name":{"default":"none","description":"Preset to play. Which names are valid depends on `type`. On 'enter' and 'exit': 'none' | 'fade' | 'move' | 'zoom' | 'pop' | 'rise' | 'flip' | 'growTurn' | 'wipe' | 'blur' | 'count' | 'typewriter' | 'lineRise' | 'wordRise' | 'wordFade' | 'letterPop' | 'wordBlur' | 'lineWipe' | 'linePeek'. On 'loop': 'none' | 'rotate' | 'blink' | 'bounce' | 'pulse' | 'float' | 'shake' | 'glow' | 'kenBurns' | 'letterWave'. Use a name only on its own type: a fade on 'loop' plays once and leaves the element hidden. An unknown name passes validation, logs a console error and does not animate. none is a hard cut: the element still appears or disappears at its `delay`, with no transition, and `duration` is ignored. As entrances: fade fades in, move slides in along a straight line, zoom scales into place, pop grows into place and fades in over its first third, rise moves up into place while fading in, flip turns half round about its vertical center line from its mirrored back, growTurn turns into place from half size while fading in, wipe shows the element behind a travelling edge, blur comes into focus while fading in, and count counts the first number in the text up to its value, keeping the style of the text and the format of the number, such as its thousands separator. An exit plays the same preset backwards, except that move, rise, growTurn and wipe carry on the way they were going. Presets that scale keep the center of the element in place. The text presets play on each unit of the text in turn, and `duration` covers them all: typewriter shows letters, letterPop pops letters, wordRise, wordFade and wordBlur play rise, fade and blur on words, lineRise and lineWipe play rise and wipe on lines, and linePeek slides each line into place behind a wipe's edge, clipped to the line's own row. An exit runs from the last unit back to the first, and a linePeek line carries on the way it came. As loops: rotate turns clockwise once per cycle, blink fades out and back, pulse grows a little and back, float lifts and settles, shake swings side to side and dies out within the cycle, glow swells and fades a halo around the element, letterWave bobs each letter in turn, and kenBurns zooms, and can pan, inside the frame of the element. bounce shrinks and grows back: the editor no longer offers it, so prefer pulse. Element limits: count, the text presets and letterWave are for 'text' elements. count plays nothing without a number in the text. Curved text or any other element plays a text preset whole, as its base preset: typewriter and wordFade as fade, lineRise and wordRise as rise, letterPop as pop, wordBlur as blur, lineWipe and linePeek as wipe and letterWave as float. blur blurs only 'text', 'image', 'svg', 'video' and 'gif', and any other element only fades. glow plays nothing on 'table' and 'group'. kenBurns plays on the crop, so only on 'image', 'svg', 'video' and 'gif'. Every other preset plays on every element, groups included.","type":"string"},"data":{"default":{},"description":"Object of options for the preset in `name`. Every option is optional, and a preset not listed here takes none. `strength` is always a multiplier, default 1, and the editor offers 0.1 to 3. move: `direction` 'right' | 'left' | 'up' | 'down' | 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left', default 'right', the way the element travels on both 'enter' and 'exit'. `strength` 1 travels 20% of the shorter side of the page: it covers that distance, not the way to the edge of the page. zoom: `direction` 'in' | 'out', default 'in'. 'in' starts smaller and grows into place, 'out' starts larger and shrinks into place, and any other value plays as 'out'. `strength` 1 starts 25% away from full size. pop: `strength` 1 starts from nothing, and 0.5 from half size. rise: `strength` 1 travels 5% of the shorter side of the page. growTurn: `strength` 1 turns 180 degrees. wipe: `direction` 'right' | 'left' | 'up' | 'down', default 'right', the way its edge travels. lineWipe: `direction` as wipe; without one, each line wipes in its own reading direction. linePeek: `direction` 'right' | 'left' | 'up' | 'down', default 'up', the way each line travels. blur: `strength` 1 adds 20 to `blurRadius` at its most blurred. count: `from`, a number, default 0, where the count starts on 'enter' and ends on 'exit'. bounce: `strength` 1 shrinks to a third of the size, and 0.5 to half. pulse: `strength` 1 grows 8%. float: `strength` 1 lifts 2% of the shorter side of the page. shake: `strength` 1 swings 1.5% of the shorter side of the page. letterWave: `strength` 1 lifts each letter 0.3 of its font size. glow: `strength` 1 spreads 2% of the shorter side of the page. It has no color option: it uses the element's `shadowColor` when `shadowEnabled` is true or `shadowColor` is not 'black', else its `fill` (`color` on a line), else black. So a `shadowColor` with `shadowEnabled` false glows in that color and shows no shadow at rest. kenBurns: `zoom` 'in' | 'out', default 'in'. 'in' narrows the saved crop, and 'out' widens to it. `direction` 'none' | 'right' | 'left' | 'up' | 'down', default 'none', the way the view pans. `strength` 1 narrows the crop by 15%. A design below `schemaVersion` 5, or with none, has its move `strength` rescaled on load to keep the fixed 200px those versions travelled."},"easing":{"description":"Timing curve: 'linear' | 'easeIn' | 'easeOut' | 'easeInOut' | 'backIn' | 'backOut' | 'backInOut'. Missing (or unknown) plays linear. Setting a preset in the editor writes its recommended curve: fade, move, zoom, blur, count, rise, flip, growTurn and wipe ease out on enter and ease in on exit, pop overshoots (backOut on enter, backIn on exit), blink and bounce ease in and out on each sweep, kenBurns eases in and out across the element's time, a text preset eases each of its letters, words or lines as the preset it plays, and every other animation is linear.","type":"string"}},"required":["type"]},"Filters":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"intensity":{"default":1,"description":"Filter intensity (-1 to 1).","type":"number"}}}},"BorderSide":{"type":"object","properties":{"color":{"description":"Border color for this side.","type":"string"},"width":{"description":"Border width in pixels for this side.","type":"number"},"style":{"description":"Border style for this side.","type":"string","enum":["solid","dashed","dotted","none"]}}}},"$id":"https://schema.polotno.com/v1/design.schema.json","title":"Polotno Design"}
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"schemaVersion":{"default":5,"description":"Schema version for compatibility / migration. A design without it counts as version 0, the oldest format, and is migrated on load, so write the current version in new JSON.","type":"number"},"width":{"default":1080,"description":"Canvas width in pixels.","type":"number"},"height":{"default":1080,"description":"Canvas height in pixels.","type":"number"},"unit":{"default":"px","description":"Unit type for print measurements.","type":"string","enum":["px","pt","mm","cm","in"]},"dpi":{"default":72,"description":"Dots per inch for print calculations.","type":"number"},"custom":{"description":"Custom data attached to the design."},"fonts":{"default":[],"description":"Fonts used in the design.","type":"array","items":{"type":"object","properties":{"fontFamily":{"type":"string","description":"Font family name."},"url":{"default":"","description":"URL to load the font from (single-variant fonts).","type":"string"},"styles":{"description":"Per-weight/style variants for multi-variant families.","type":"array","items":{"type":"object","properties":{"src":{"type":"string","description":"Font source, typically in CSS url() form."},"fontStyle":{"type":"string"},"fontWeight":{"type":"string"}},"required":["src"]}}},"required":["fontFamily"]}},"pages":{"default":[],"description":"Pages in the design.","type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the page."},"width":{"default":"auto","description":"Page width in pixels or 'auto'.","anyOf":[{"type":"number"},{"type":"string","const":"auto"}]},"height":{"default":"auto","description":"Page height in pixels or 'auto'.","anyOf":[{"type":"number"},{"type":"string","const":"auto"}]},"background":{"default":"white","description":"Background color or image.","type":"string"},"bleed":{"default":0,"description":"Bleed area in pixels for print (all sides; base value for per-side overrides).","type":"number"},"bleedTop":{"description":"Per-side bleed override (top), in pixels. Inherits `bleed` when omitted.","type":"number"},"bleedRight":{"description":"Per-side bleed override (right), in pixels. Inherits `bleed` when omitted.","type":"number"},"bleedBottom":{"description":"Per-side bleed override (bottom), in pixels. Inherits `bleed` when omitted.","type":"number"},"bleedLeft":{"description":"Per-side bleed override (left), in pixels. Inherits `bleed` when omitted.","type":"number"},"custom":{},"duration":{"default":5000,"description":"Page duration in milliseconds.","type":"number"},"children":{"default":[],"description":"Elements on this page.","type":"array","items":{"$ref":"#/$defs/__schema0"}}},"required":["id"]}},"audios":{"default":[],"description":"Audio tracks in the design.","type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the audio track."},"name":{"default":"","description":"Display name shown on the timeline.","type":"string"},"src":{"default":"","description":"URL or data URI of the audio file.","type":"string"},"duration":{"default":0,"description":"Duration in milliseconds.","type":"number"},"startTime":{"default":0,"description":"Start offset (0-1).","type":"number"},"endTime":{"default":1,"description":"End offset (0-1).","type":"number"},"volume":{"default":1,"description":"Volume level (0-1).","type":"number"},"delay":{"default":0,"description":"Delay before playing, in milliseconds.","type":"number"},"speed":{"default":1,"description":"Playback speed multiplier (1 = normal).","type":"number"},"custom":{}},"required":["id"]}}},"$defs":{"__schema0":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"text","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":100,"description":"Width in pixels. A value of 0 or less reads as 1.","type":"number"},"height":{"default":0,"description":"Height in pixels (0 until measured/rendered).","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"text":{"default":"","description":"Visible text shown on canvas.","type":"string"},"placeholder":{"default":"","description":"Placeholder text shown when empty.","type":"string"},"fontSize":{"default":14,"description":"Font size in pixels (minimum 1).","type":"number"},"fontFamily":{"default":"Roboto","description":"Font family name.","type":"string"},"fontStyle":{"default":"normal","description":"Font style: 'normal' or 'italic'.","type":"string"},"fontWeight":{"default":"normal","description":"Font weight: 'normal', 'bold', or numeric string.","type":"string"},"textDecoration":{"default":"","description":"Text decoration (e.g. underline, line-through).","type":"string"},"textTransform":{"default":"none","description":"Text transform: uppercase, lowercase, capitalize, none.","type":"string"},"fill":{"default":"black","description":"Text color.","type":"string"},"align":{"default":"center","description":"Horizontal alignment (commonly left | center | right | justify).","type":"string"},"verticalAlign":{"default":"top","description":"Vertical alignment: top, middle, bottom.","type":"string"},"strokeWidth":{"default":0,"description":"Stroke width in pixels.","type":"number"},"stroke":{"default":"black","description":"Stroke color.","type":"string"},"strokeLineJoin":{"default":"round","description":"Stroke corner join: round, miter, bevel.","type":"string"},"lineHeight":{"default":1.2,"description":"Line height multiplier or 'auto'.","type":["number","string"]},"letterSpacing":{"default":0,"description":"Letter spacing as a fraction of font size.","type":"number"},"backgroundEnabled":{"default":false,"description":"Whether the text background is enabled.","type":"boolean"},"backgroundColor":{"default":"#7ED321","description":"Text background color.","type":"string"},"backgroundOpacity":{"default":1,"description":"Text background opacity (0-1).","type":"number"},"backgroundCornerRadius":{"default":0.5,"description":"Text background corner radius.","type":"number"},"backgroundPadding":{"default":0.5,"description":"Text background padding.","type":"number"},"borderColor":{"default":"black","description":"Text box border color.","type":"string"},"borderSize":{"default":0,"description":"Text box border width in pixels.","type":"number"},"curveEnabled":{"default":false,"description":"Whether the text curve effect is enabled.","type":"boolean"},"curvePower":{"default":0.5,"description":"Text curve power (-1 to 1, 0 = straight).","type":"number"},"legacyBackground":{"description":"Internal compatibility flag stamped by the v2→v3 migration.","type":"boolean"},"textOverflow":{"description":"What to do when the text does not fit: 'resize' | 'ellipsis' | 'fit'. Missing (or unknown) follows the global setting.","type":"string"},"maxLines":{"description":"Line cap in every overflow mode; text past it ends in an ellipsis.","type":"number"},"minFontSize":{"description":"Smallest size 'fit' may draw at, in pixels.","type":"number"},"maxFontSize":{"description":"Largest size 'fit' may draw at, in pixels (defaults to fontSize). Above fontSize it grows text to fit.","type":"number"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"image","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":100,"description":"Width in pixels. A value of 0 or less reads as 1.","type":"number"},"height":{"default":100,"description":"Height in pixels. A value of 0 or less reads as 1.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"src":{"default":"","description":"URL or data URI of the image file.","type":"string"},"cropX":{"default":0,"description":"Crop X offset as a fraction (0-1).","type":"number"},"cropY":{"default":0,"description":"Crop Y offset as a fraction (0-1).","type":"number"},"cropWidth":{"default":1,"description":"Crop width as a fraction (0-1).","type":"number"},"cropHeight":{"default":1,"description":"Crop height as a fraction (0-1).","type":"number"},"cornerRadius":{"default":0,"description":"Corner radius in pixels.","type":"number"},"flipX":{"default":false,"description":"Whether the image is flipped horizontally.","type":"boolean"},"flipY":{"default":false,"description":"Whether the image is flipped vertically.","type":"boolean"},"clipSrc":{"default":"","description":"URL or data URI for a clipping mask.","type":"string"},"borderColor":{"default":"black","description":"Border color.","type":"string"},"borderSize":{"default":0,"description":"Border width in pixels.","type":"number"},"keepRatio":{"default":false,"description":"Whether to maintain aspect ratio when resizing.","type":"boolean"},"stretchEnabled":{"default":false,"description":"Whether stretch mode is enabled.","type":"boolean"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"svg","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":100,"description":"Width in pixels. A value of 0 or less reads as 1.","type":"number"},"height":{"default":100,"description":"Height in pixels. A value of 0 or less reads as 1.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"src":{"default":"","description":"URL or data URI of the SVG.","type":"string"},"maskSrc":{"default":"","description":"URL or data URI for an SVG mask.","type":"string"},"cropX":{"default":0,"description":"Crop X offset as a fraction (0-1).","type":"number"},"cropY":{"default":0,"description":"Crop Y offset as a fraction (0-1).","type":"number"},"cropWidth":{"default":1,"description":"Crop width as a fraction (0-1).","type":"number"},"cropHeight":{"default":1,"description":"Crop height as a fraction (0-1).","type":"number"},"keepRatio":{"default":true,"description":"Whether to maintain aspect ratio when resizing.","type":"boolean"},"stretchEnabled":{"default":true,"description":"Whether stretch mode is enabled.","type":"boolean"},"flipX":{"default":false,"description":"Whether the image is flipped horizontally.","type":"boolean"},"flipY":{"default":false,"description":"Whether the image is flipped vertically.","type":"boolean"},"borderColor":{"default":"black","description":"Border color.","type":"string"},"borderSize":{"default":0,"description":"Border width in pixels.","type":"number"},"cornerRadius":{"default":0,"description":"Corner radius in pixels.","type":"number"},"colorsReplace":{"default":{},"description":"Color replacement mappings (original → replacement).","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"line","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":400,"description":"Width in pixels. A value of 0 or less reads as 1.","type":"number"},"height":{"default":10,"description":"Height in pixels. A value of 0 or less reads as 1.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"color":{"default":"black","description":"Line color.","type":"string"},"dash":{"default":[],"description":"Dash pattern array.","type":"array","items":{"type":"number"}},"startHead":{"default":"","description":"Start arrow head: empty, arrow, circle, square, bar.","type":"string"},"endHead":{"default":"","description":"End arrow head: empty, arrow, circle, square, bar.","type":"string"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"figure","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":100,"description":"Width in pixels. A value of 0 or less reads as 1.","type":"number"},"height":{"default":100,"description":"Height in pixels. A value of 0 or less reads as 1.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"subType":{"default":"rect","description":"Figure subtype: rect, ellipse, triangle, etc.","type":"string"},"fill":{"default":"rgb(0, 161, 255)","description":"Fill color.","type":"string"},"dash":{"default":[],"description":"Dash pattern array.","type":"array","items":{"type":"number"}},"strokeWidth":{"default":0,"description":"Stroke width in pixels.","type":"number"},"stroke":{"default":"rgba(98, 197, 255, 1)","description":"Stroke color.","type":"string"},"cornerRadius":{"default":0,"description":"Corner radius in pixels.","type":"number"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"gif","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":100,"description":"Width in pixels. A value of 0 or less reads as 1.","type":"number"},"height":{"default":100,"description":"Height in pixels. A value of 0 or less reads as 1.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"src":{"default":"","description":"URL or data URI of the image file.","type":"string"},"cropX":{"default":0,"description":"Crop X offset as a fraction (0-1).","type":"number"},"cropY":{"default":0,"description":"Crop Y offset as a fraction (0-1).","type":"number"},"cropWidth":{"default":1,"description":"Crop width as a fraction (0-1).","type":"number"},"cropHeight":{"default":1,"description":"Crop height as a fraction (0-1).","type":"number"},"cornerRadius":{"default":0,"description":"Corner radius in pixels.","type":"number"},"flipX":{"default":false,"description":"Whether the image is flipped horizontally.","type":"boolean"},"flipY":{"default":false,"description":"Whether the image is flipped vertically.","type":"boolean"},"clipSrc":{"default":"","description":"URL or data URI for a clipping mask.","type":"string"},"borderColor":{"default":"black","description":"Border color.","type":"string"},"borderSize":{"default":0,"description":"Border width in pixels.","type":"number"},"keepRatio":{"default":true,"description":"Whether to maintain aspect ratio when resizing.","type":"boolean"},"stretchEnabled":{"default":false,"description":"Whether stretch mode is enabled.","type":"boolean"},"duration":{"default":0,"description":"GIF duration in milliseconds.","type":"number"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"lottie","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":100,"description":"Width in pixels. A value of 0 or less reads as 1.","type":"number"},"height":{"default":100,"description":"Height in pixels. A value of 0 or less reads as 1.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"src":{"default":"","description":"URL or data URI of the image file.","type":"string"},"cropX":{"default":0,"description":"Crop X offset as a fraction (0-1).","type":"number"},"cropY":{"default":0,"description":"Crop Y offset as a fraction (0-1).","type":"number"},"cropWidth":{"default":1,"description":"Crop width as a fraction (0-1).","type":"number"},"cropHeight":{"default":1,"description":"Crop height as a fraction (0-1).","type":"number"},"cornerRadius":{"default":0,"description":"Corner radius in pixels.","type":"number"},"flipX":{"default":false,"description":"Whether the image is flipped horizontally.","type":"boolean"},"flipY":{"default":false,"description":"Whether the image is flipped vertically.","type":"boolean"},"clipSrc":{"default":"","description":"URL or data URI for a clipping mask.","type":"string"},"borderColor":{"default":"black","description":"Border color.","type":"string"},"borderSize":{"default":0,"description":"Border width in pixels.","type":"number"},"keepRatio":{"default":true,"description":"Whether to maintain aspect ratio when resizing.","type":"boolean"},"stretchEnabled":{"default":false,"description":"Whether stretch mode is enabled.","type":"boolean"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"video","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":100,"description":"Width in pixels. A value of 0 or less reads as 1.","type":"number"},"height":{"default":100,"description":"Height in pixels. A value of 0 or less reads as 1.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"blurEnabled":{"default":false,"description":"Whether blur effect is enabled.","type":"boolean"},"blurRadius":{"default":10,"description":"Blur radius in pixels.","type":"number"},"brightnessEnabled":{"default":false,"description":"Whether brightness effect is enabled.","type":"boolean"},"brightness":{"default":0,"description":"Brightness level (-1 to 1).","type":"number"},"sepiaEnabled":{"default":false,"description":"Whether sepia effect is enabled.","type":"boolean"},"grayscaleEnabled":{"default":false,"description":"Whether grayscale effect is enabled.","type":"boolean"},"filters":{"default":{},"description":"Applied image filters keyed by filter name.","$ref":"#/$defs/Filters"},"shadowEnabled":{"default":false,"description":"Whether shadow is enabled.","type":"boolean"},"shadowBlur":{"default":5,"description":"Shadow blur radius in pixels.","type":"number"},"shadowOffsetX":{"default":0,"description":"Shadow horizontal offset in pixels.","type":"number"},"shadowOffsetY":{"default":0,"description":"Shadow vertical offset in pixels.","type":"number"},"shadowColor":{"default":"black","description":"Shadow color.","type":"string"},"shadowOpacity":{"default":1,"description":"Shadow opacity (0-1).","type":"number"},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"src":{"default":"","description":"URL or data URI of the image file.","type":"string"},"cropX":{"default":0,"description":"Crop X offset as a fraction (0-1).","type":"number"},"cropY":{"default":0,"description":"Crop Y offset as a fraction (0-1).","type":"number"},"cropWidth":{"default":1,"description":"Crop width as a fraction (0-1).","type":"number"},"cropHeight":{"default":1,"description":"Crop height as a fraction (0-1).","type":"number"},"cornerRadius":{"default":0,"description":"Corner radius in pixels.","type":"number"},"flipX":{"default":false,"description":"Whether the image is flipped horizontally.","type":"boolean"},"flipY":{"default":false,"description":"Whether the image is flipped vertically.","type":"boolean"},"clipSrc":{"default":"","description":"URL or data URI for a clipping mask.","type":"string"},"borderColor":{"default":"black","description":"Border color.","type":"string"},"borderSize":{"default":0,"description":"Border width in pixels.","type":"number"},"keepRatio":{"default":false,"description":"Whether to maintain aspect ratio when resizing.","type":"boolean"},"stretchEnabled":{"default":false,"description":"Whether stretch mode is enabled.","type":"boolean"},"duration":{"default":0,"description":"Video duration in milliseconds.","type":"number"},"startTime":{"default":0,"description":"Start offset (0-1).","type":"number"},"endTime":{"default":1,"description":"End offset (0-1).","type":"number"},"volume":{"default":1,"description":"Volume (0-1).","type":"number"},"speed":{"default":1,"description":"Playback speed multiplier (1 = normal).","type":"number"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"table","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"x":{"default":0,"description":"X position in pixels.","type":"number"},"y":{"default":0,"description":"Y position in pixels.","type":"number"},"width":{"default":300,"description":"Width in pixels. A value of 0 or less reads as 1.","type":"number"},"height":{"default":200,"description":"Height in pixels. A value of 0 or less reads as 1.","type":"number"},"rotation":{"default":0,"description":"Rotation angle in degrees.","type":"number"},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the element composites with the content beneath it. Omitted means normal.","$ref":"#/$defs/BlendMode"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"draggable":{"default":true,"description":"Whether the element can be dragged.","type":"boolean"},"resizable":{"default":true,"description":"Whether the element can be resized.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"contentEditable":{"default":true,"description":"Whether the element content can be edited.","type":"boolean"},"styleEditable":{"default":true,"description":"Whether the element style can be edited.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"rows":{"default":3,"description":"Number of rows.","type":"number"},"cols":{"default":3,"description":"Number of columns.","type":"number"},"colWidths":{"default":[],"description":"Column width fractions (sum to 1).","type":"array","items":{"type":"number"}},"rowHeights":{"default":[],"description":"Row height fractions (sum to 1).","type":"array","items":{"type":"number"}},"cells":{"default":[],"description":"Flat cell array in row-major order.","type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the cell."},"type":{"default":"tablecell","description":"Cell type identifier.","type":"string","const":"tablecell"},"text":{"default":"","description":"Visible text shown in the cell.","type":"string"},"opacity":{"description":"Opacity level (0-1).","type":"number"},"rowSpan":{"description":"Number of rows this cell spans.","type":"number"},"colSpan":{"description":"Number of columns this cell spans.","type":"number"},"mergedInto":{"description":"Id of the cell this one is merged into, if any.","type":"string"},"name":{"description":"Display name for the cell.","type":"string"},"custom":{"description":"Custom data attached to the cell."},"borders":{"description":"Per-side border overrides for this cell.","type":"object","properties":{"top":{"description":"Top border override for this cell.","$ref":"#/$defs/BorderSide"},"right":{"description":"Right border override for this cell.","$ref":"#/$defs/BorderSide"},"bottom":{"description":"Bottom border override for this cell.","$ref":"#/$defs/BorderSide"},"left":{"description":"Left border override for this cell.","$ref":"#/$defs/BorderSide"}}},"fontSize":{"description":"Font size in pixels (inherits from the table when omitted, minimum 1).","type":"number"},"fontFamily":{"description":"Font family name (inherits from the table when omitted).","type":"string"},"fontWeight":{"description":"Font weight: 'normal', 'bold', or numeric string (inherits from the table when omitted).","type":"string"},"fontStyle":{"description":"Font style: 'normal' or 'italic' (inherits from the table when omitted).","type":"string"},"textDecoration":{"description":"Text decoration, e.g. underline, line-through (inherits from the table when omitted).","type":"string"},"textTransform":{"description":"Text transform: uppercase, lowercase, capitalize, none (inherits from the table when omitted).","type":"string"},"fill":{"description":"Text color (inherits from the table when omitted).","type":"string"},"align":{"description":"Horizontal alignment: left, center, right, justify (inherits from the table when omitted).","type":"string"},"verticalAlign":{"description":"Vertical alignment: top, middle, bottom (inherits from the table when omitted).","type":"string"},"lineHeight":{"description":"Line height multiplier or 'auto' (inherits from the table when omitted).","type":["number","string"]},"letterSpacing":{"description":"Letter spacing as a fraction of font size (inherits from the table when omitted).","type":"number"},"strokeWidth":{"description":"Stroke width in pixels (inherits from the table when omitted).","type":"number"},"stroke":{"description":"Stroke color (inherits from the table when omitted).","type":"string"},"cellBackground":{"description":"Cell background color (inherits from the table when omitted).","type":"string"},"cellPadding":{"description":"Cell padding in pixels (inherits from the table when omitted).","type":"number"}},"required":["id"]}},"borderColor":{"default":"#000000","description":"Default border color for the table grid.","type":"string"},"borderWidth":{"default":1,"description":"Default border width in pixels.","type":"number"},"borderStyle":{"default":"solid","description":"Default border style.","type":"string","enum":["solid","dashed","dotted","none"]},"fontSize":{"default":30,"description":"Default font size in pixels for cells (minimum 1).","type":"number"},"fontFamily":{"default":"Roboto","description":"Default font family name for cells.","type":"string"},"fontWeight":{"default":"normal","description":"Default font weight: 'normal', 'bold', or numeric string.","type":"string"},"fontStyle":{"default":"normal","description":"Default font style: 'normal' or 'italic'.","type":"string"},"textDecoration":{"default":"","description":"Default text decoration (e.g. underline, line-through).","type":"string"},"textTransform":{"default":"none","description":"Default text transform: uppercase, lowercase, capitalize, none.","type":"string"},"fill":{"default":"black","description":"Default text color for cells.","type":"string"},"align":{"default":"center","description":"Default horizontal alignment: left, center, right, justify.","type":"string"},"verticalAlign":{"default":"middle","description":"Default vertical alignment: top, middle, bottom.","type":"string"},"lineHeight":{"default":1.2,"description":"Default line height multiplier or 'auto'.","type":["number","string"]},"letterSpacing":{"default":0,"description":"Default letter spacing as a fraction of font size.","type":"number"},"strokeWidth":{"default":0,"description":"Default stroke width in pixels.","type":"number"},"stroke":{"default":"black","description":"Default stroke color.","type":"string"},"cellBackground":{"default":"transparent","description":"Default cell background color.","type":"string"},"cellPadding":{"default":4,"description":"Default cell padding in pixels.","type":"number"}},"required":["id","type"]},{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier for the element."},"type":{"type":"string","const":"group","description":"Element type identifier."},"name":{"default":"","description":"Display name for the element.","type":"string"},"custom":{"description":"Custom data attached to the element."},"opacity":{"default":1,"description":"Opacity level (0-1).","type":"number"},"blendMode":{"description":"How the group composites with the content beneath it. Omitted means pass-through: children blend with that content directly. Any other mode composites the children together first.","type":"string","enum":["pass-through","normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]},"visible":{"default":true,"description":"Whether the element is visible.","type":"boolean"},"selectable":{"default":true,"description":"Whether the element can be selected.","type":"boolean"},"removable":{"default":true,"description":"Whether the element can be removed.","type":"boolean"},"alwaysOnTop":{"default":false,"description":"Whether the element stays on top of others.","type":"boolean"},"showInExport":{"default":true,"description":"Whether the element appears in exports.","type":"boolean"},"animations":{"default":[],"description":"The element's animations, at most one of each `type`, so an 'enter', an 'exit' and a 'loop' can play together. A group's animations play on top of its children's.","type":"array","items":{"$ref":"#/$defs/Animation"}},"children":{"default":[],"description":"Child elements in this group.","type":"array","items":{"$ref":"#/$defs/__schema0"}}},"required":["id","type"]}]},"BlendMode":{"type":"string","enum":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"]},"Animation":{"type":"object","properties":{"delay":{"default":0,"description":"Time in milliseconds, measured on the element's page, not on the whole design. On 'enter': how long after the page starts the element appears. It is hidden until then. On 'exit': how long before the page ends the element disappears. The exit finishes at that moment, and the element stays hidden after it. On 'loop': how long after the page starts the first cycle begins. It does not wait for the entrance, so a loop can be mid-cycle when the element appears. Until then the element is at rest. kenBurns ignores it, and letterWave also waits for an entrance that is a text preset to finish.","type":"number"},"duration":{"default":500,"description":"Time in milliseconds. On 'enter': how long the entrance plays, from its `delay`. On 'exit': how long the exit plays, up to the moment the element disappears. If the two together are longer than the element's time on the page, both play faster by the same factor to fit. On 'loop': the length of one cycle. Cycles repeat until the element disappears or the page ends. kenBurns ignores it and plays once across the element's whole time on the page. The default suits a transition of the whole element. Picking a preset in the editor sets a longer one: 1000 for lineRise, wordRise, wordFade, letterPop, wordBlur, lineWipe and linePeek, 50 per letter from 1000 to 4000 for typewriter, 4000 for rotate, 2500 for float, 2000 for letterWave and glow, 1500 for blink and pulse, and 1000 for shake.","type":"number"},"enabled":{"default":true,"description":"Whether the animation plays. A disabled 'enter' or 'exit' also loses its `delay`, so the element is on the page from its start or to its end. To time an element with no transition, keep it enabled with the name 'none'.","type":"boolean"},"type":{"type":"string","enum":["enter","exit","loop"],"description":"Animation phase: 'enter' brings the element onto the page, 'exit' takes it off, and 'loop' repeats while it is there, also during the entrance and the exit."},"name":{"default":"none","description":"Preset to play. Which names are valid depends on `type`. On 'enter' and 'exit': 'none' | 'fade' | 'move' | 'zoom' | 'pop' | 'rise' | 'flip' | 'growTurn' | 'wipe' | 'blur' | 'count' | 'typewriter' | 'lineRise' | 'wordRise' | 'wordFade' | 'letterPop' | 'wordBlur' | 'lineWipe' | 'linePeek'. On 'loop': 'none' | 'rotate' | 'blink' | 'bounce' | 'pulse' | 'float' | 'shake' | 'glow' | 'kenBurns' | 'letterWave'. Use a name only on its own type: a fade on 'loop' plays once and leaves the element hidden. An unknown name passes validation, logs a console error and does not animate. none is a hard cut: the element still appears or disappears at its `delay`, with no transition, and `duration` is ignored. As entrances: fade fades in, move slides in along a straight line, zoom scales into place, pop grows into place and fades in over its first third, rise moves up into place while fading in, flip turns half round about its vertical center line from its mirrored back, growTurn turns into place from half size while fading in, wipe shows the element behind a travelling edge, blur comes into focus while fading in, and count counts the first number in the text up to its value, keeping the style of the text and the format of the number, such as its thousands separator. An exit plays the same preset backwards, except that move, rise, growTurn and wipe carry on the way they were going. Presets that scale keep the center of the element in place. The text presets play on each unit of the text in turn, and `duration` covers them all: typewriter shows letters, letterPop pops letters, wordRise, wordFade and wordBlur play rise, fade and blur on words, lineRise and lineWipe play rise and wipe on lines, and linePeek slides each line into place behind a wipe's edge, clipped to the line's own row. An exit runs from the last unit back to the first, and a linePeek line carries on the way it came. As loops: rotate turns clockwise once per cycle, blink fades out and back, pulse grows a little and back, float lifts and settles, shake swings side to side and dies out within the cycle, glow swells and fades a halo around the element, letterWave bobs each letter in turn, and kenBurns zooms, and can pan, inside the frame of the element. bounce shrinks and grows back: the editor no longer offers it, so prefer pulse. Element limits: count, the text presets and letterWave are for 'text' elements. count plays nothing without a number in the text. Curved text or any other element plays a text preset whole, as its base preset: typewriter and wordFade as fade, lineRise and wordRise as rise, letterPop as pop, wordBlur as blur, lineWipe and linePeek as wipe and letterWave as float. blur blurs only 'text', 'image', 'svg', 'video' and 'gif', and any other element only fades. glow plays nothing on 'table' and 'group'. kenBurns plays on the crop, so only on 'image', 'svg', 'video' and 'gif'. Every other preset plays on every element, groups included.","type":"string"},"data":{"default":{},"description":"Object of options for the preset in `name`. Every option is optional, and a preset not listed here takes none. `strength` is always a multiplier, default 1, and the editor offers 0.1 to 3. move: `direction` 'right' | 'left' | 'up' | 'down' | 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left', default 'right', the way the element travels on both 'enter' and 'exit'. `strength` 1 travels 20% of the shorter side of the page: it covers that distance, not the way to the edge of the page. zoom: `direction` 'in' | 'out', default 'in'. 'in' starts smaller and grows into place, 'out' starts larger and shrinks into place, and any other value plays as 'out'. `strength` 1 starts 25% away from full size. pop: `strength` 1 starts from nothing, and 0.5 from half size. rise: `strength` 1 travels 5% of the shorter side of the page. growTurn: `strength` 1 turns 180 degrees. wipe: `direction` 'right' | 'left' | 'up' | 'down', default 'right', the way its edge travels. lineWipe: `direction` as wipe; without one, each line wipes in its own reading direction. linePeek: `direction` 'right' | 'left' | 'up' | 'down', default 'up', the way each line travels. blur: `strength` 1 adds 20 to `blurRadius` at its most blurred. count: `from`, a number, default 0, where the count starts on 'enter' and ends on 'exit'. bounce: `strength` 1 shrinks to a third of the size, and 0.5 to half. pulse: `strength` 1 grows 8%. float: `strength` 1 lifts 2% of the shorter side of the page. shake: `strength` 1 swings 1.5% of the shorter side of the page. letterWave: `strength` 1 lifts each letter 0.3 of its font size. glow: `strength` 1 spreads 2% of the shorter side of the page. It has no color option: it uses the element's `shadowColor` when `shadowEnabled` is true or `shadowColor` is not 'black', else its `fill` (`color` on a line), else black. So a `shadowColor` with `shadowEnabled` false glows in that color and shows no shadow at rest. kenBurns: `zoom` 'in' | 'out', default 'in'. 'in' narrows the saved crop, and 'out' widens to it. `direction` 'none' | 'right' | 'left' | 'up' | 'down', default 'none', the way the view pans. `strength` 1 narrows the crop by 15%. A design below `schemaVersion` 5, or with none, has its move `strength` rescaled on load to keep the fixed 200px those versions travelled."},"easing":{"description":"Timing curve: 'linear' | 'easeIn' | 'easeOut' | 'easeInOut' | 'backIn' | 'backOut' | 'backInOut'. Missing (or unknown) plays linear. Setting a preset in the editor writes its recommended curve: fade, move, zoom, blur, count, rise, flip, growTurn and wipe ease out on enter and ease in on exit, pop overshoots (backOut on enter, backIn on exit), blink and bounce ease in and out on each sweep, kenBurns eases in and out across the element's time, a text preset eases each of its letters, words or lines as the preset it plays, and every other animation is linear.","type":"string"}},"required":["type"]},"Filters":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"intensity":{"default":1,"description":"Filter intensity (-1 to 1).","type":"number"}}}},"BorderSide":{"type":"object","properties":{"color":{"description":"Border color for this side.","type":"string"},"width":{"description":"Border width in pixels for this side.","type":"number"},"style":{"description":"Border style for this side.","type":"string","enum":["solid","dashed","dotted","none"]}}}},"$id":"https://schema.polotno.com/v1/design.schema.json","title":"Polotno Design"}
|
package/lib/normalize.js
CHANGED
|
@@ -1,12 +1,45 @@
|
|
|
1
|
-
// normalizeDesign = migrate -> drop nulls -> zod parse (fills
|
|
2
|
-
// unknown keys). The migration step is what makes a design
|
|
3
|
-
// in every package; migrate.ts explains why it lives here
|
|
4
|
-
// `schemaVersion` counts as 0.
|
|
1
|
+
// normalizeDesign = migrate -> size floor -> drop nulls -> zod parse (fills
|
|
2
|
+
// defaults, strips unknown keys). The migration step is what makes a design
|
|
3
|
+
// mean the same thing in every package; migrate.ts explains why it lives here
|
|
4
|
+
// and why a missing `schemaVersion` counts as 0.
|
|
5
5
|
import { designSchemaLenient, parseValidDesign, cloneDropNulls, ELEMENT_TYPES, } from './schema.js';
|
|
6
6
|
import { polotnoError } from './errors.js';
|
|
7
7
|
import { migrateDesign } from './migrate.js';
|
|
8
|
+
import { clampElementSize } from './defaults.js';
|
|
8
9
|
export function normalizeDesign(json) {
|
|
9
|
-
|
|
10
|
+
const migrated = migrateDesign(json);
|
|
11
|
+
clampElementSizes(migrated);
|
|
12
|
+
return designSchemaLenient.parse(cloneDropNulls(migrated));
|
|
13
|
+
}
|
|
14
|
+
const isRecord = (value) => !!value && typeof value === 'object';
|
|
15
|
+
// Read every element width and height the way the editor's model loads it
|
|
16
|
+
// (MIN_ELEMENT_SIZE in ./defaults), so a converter never meets a size the
|
|
17
|
+
// Canvas does not draw. It runs before the zod pass, which would read a null
|
|
18
|
+
// size as missing and fill the type's default where the model reads 1; NaN and
|
|
19
|
+
// Infinity arrive here as null, from migrateDesign's JSON round-trip. Mutates
|
|
20
|
+
// in place — callers pass their private migrated copy.
|
|
21
|
+
function clampElementSizes(design) {
|
|
22
|
+
const walk = (children) => {
|
|
23
|
+
if (!Array.isArray(children))
|
|
24
|
+
return;
|
|
25
|
+
for (const element of children) {
|
|
26
|
+
if (!isRecord(element))
|
|
27
|
+
continue;
|
|
28
|
+
if ('width' in element)
|
|
29
|
+
element.width = clampElementSize(element.width);
|
|
30
|
+
// Text keeps its height: 0 there means "not measured yet".
|
|
31
|
+
if ('height' in element && element.type !== 'text') {
|
|
32
|
+
element.height = clampElementSize(element.height);
|
|
33
|
+
}
|
|
34
|
+
walk(element.children);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
if (!isRecord(design) || !Array.isArray(design.pages))
|
|
38
|
+
return;
|
|
39
|
+
for (const page of design.pages) {
|
|
40
|
+
if (isRecord(page))
|
|
41
|
+
walk(page.children);
|
|
42
|
+
}
|
|
10
43
|
}
|
|
11
44
|
// Fill missing `id`s with DETERMINISTIC structural ids — the index path from
|
|
12
45
|
// the document root (`page-0`, `el-0-2`, nested `el-0-2-1`, `cell-0-2-3`).
|
|
@@ -190,6 +223,7 @@ export function parseDesign(input, opts = {}) {
|
|
|
190
223
|
// exporter tolerance tests pin that (pdf dpi.test.js). So the caller's input
|
|
191
224
|
// is never touched and nothing needs cloning again below.
|
|
192
225
|
const migrated = migrateDesign(input);
|
|
226
|
+
clampElementSizes(migrated);
|
|
193
227
|
const pre = (opts.preserveClientData || opts.fillMissingIds) &&
|
|
194
228
|
migrated &&
|
|
195
229
|
typeof migrated === 'object';
|
package/lib/schema.js
CHANGED
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
// text and table models clamp it at every door, so it is an invariant of the
|
|
23
23
|
// format rather than a behavior of one entry point. Leaving it out did not keep
|
|
24
24
|
// the schema neutral, it just moved the decision into each renderer — see
|
|
25
|
-
// MIN_FONT_SIZE in ./defaults for what they each decided.
|
|
25
|
+
// MIN_FONT_SIZE in ./defaults for what they each decided. The element size
|
|
26
|
+
// floor (MIN_ELEMENT_SIZE) is the same kind of rule, but normalize applies it
|
|
27
|
+
// before this schema runs, because it also reads a null size as 1.
|
|
26
28
|
//
|
|
27
29
|
// A type used in more than one place takes `.meta({ id })`, so the generated
|
|
28
30
|
// JSON Schema defines it once under `$defs` and `$ref`s it, rather than copying
|
|
@@ -169,8 +171,14 @@ function build(o) {
|
|
|
169
171
|
.describe('Custom data attached to the element.'),
|
|
170
172
|
x: z.number().default(0).describe('X position in pixels.'),
|
|
171
173
|
y: z.number().default(0).describe('Y position in pixels.'),
|
|
172
|
-
width: z
|
|
173
|
-
|
|
174
|
+
width: z
|
|
175
|
+
.number()
|
|
176
|
+
.default(100)
|
|
177
|
+
.describe('Width in pixels. A value of 0 or less reads as 1.'),
|
|
178
|
+
height: z
|
|
179
|
+
.number()
|
|
180
|
+
.default(100)
|
|
181
|
+
.describe('Height in pixels. A value of 0 or less reads as 1.'),
|
|
174
182
|
rotation: z.number().default(0).describe('Rotation angle in degrees.'),
|
|
175
183
|
opacity: z.number().default(1).describe('Opacity level (0-1).'),
|
|
176
184
|
blendMode,
|
|
@@ -331,7 +339,10 @@ function build(o) {
|
|
|
331
339
|
.string()
|
|
332
340
|
.default(TEXT_DEFAULTS.align)
|
|
333
341
|
.describe('Horizontal alignment (commonly left | center | right | justify).'),
|
|
334
|
-
width: z
|
|
342
|
+
width: z
|
|
343
|
+
.number()
|
|
344
|
+
.default(100)
|
|
345
|
+
.describe('Width in pixels. A value of 0 or less reads as 1.'),
|
|
335
346
|
height: z
|
|
336
347
|
.number()
|
|
337
348
|
.default(0)
|
|
@@ -459,8 +470,14 @@ function build(o) {
|
|
|
459
470
|
const lineShape = {
|
|
460
471
|
...shapeBase,
|
|
461
472
|
type: z.literal('line').describe('Element type identifier.'),
|
|
462
|
-
width: z
|
|
463
|
-
|
|
473
|
+
width: z
|
|
474
|
+
.number()
|
|
475
|
+
.default(400)
|
|
476
|
+
.describe('Width in pixels. A value of 0 or less reads as 1.'),
|
|
477
|
+
height: z
|
|
478
|
+
.number()
|
|
479
|
+
.default(10)
|
|
480
|
+
.describe('Height in pixels. A value of 0 or less reads as 1.'),
|
|
464
481
|
color: z.string().default('black').describe('Line color.'),
|
|
465
482
|
dash: z.array(z.number()).default([]).describe('Dash pattern array.'),
|
|
466
483
|
startHead: z
|
|
@@ -633,8 +650,14 @@ function build(o) {
|
|
|
633
650
|
const tableShape = {
|
|
634
651
|
...shapeBaseNoEffects,
|
|
635
652
|
type: z.literal('table').describe('Element type identifier.'),
|
|
636
|
-
width: z
|
|
637
|
-
|
|
653
|
+
width: z
|
|
654
|
+
.number()
|
|
655
|
+
.default(300)
|
|
656
|
+
.describe('Width in pixels. A value of 0 or less reads as 1.'),
|
|
657
|
+
height: z
|
|
658
|
+
.number()
|
|
659
|
+
.default(200)
|
|
660
|
+
.describe('Height in pixels. A value of 0 or less reads as 1.'),
|
|
638
661
|
rows: z.number().default(3).describe('Number of rows.'),
|
|
639
662
|
cols: z.number().default(3).describe('Number of columns.'),
|
|
640
663
|
colWidths: z
|
package/lib/types.d.ts
CHANGED
|
@@ -128,9 +128,9 @@ export interface ShapeAttributes {
|
|
|
128
128
|
x: number;
|
|
129
129
|
/** Y position in pixels. */
|
|
130
130
|
y: number;
|
|
131
|
-
/** Width in pixels. */
|
|
131
|
+
/** Width in pixels. A value of 0 or less reads as 1. */
|
|
132
132
|
width: number;
|
|
133
|
-
/** Height in pixels. */
|
|
133
|
+
/** Height in pixels. A value of 0 or less reads as 1, except on text. */
|
|
134
134
|
height: number;
|
|
135
135
|
/** Rotation in degrees. */
|
|
136
136
|
rotation: number;
|
package/package.json
CHANGED