@cesdk/node-native 1.77.0-nightly.20260610

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE.md +137 -0
  2. package/README.md +474 -0
  3. package/ThirdPartyLicenses.md +1041 -0
  4. package/assets/ly.img.cesdk/fonts/imgly_font_inter_semibold.otf +0 -0
  5. package/assets/ly.img.cesdk/icons/ErrorAudio.svg +5 -0
  6. package/assets/ly.img.cesdk/icons/ErrorConnection.svg +5 -0
  7. package/assets/ly.img.cesdk/icons/ErrorImage.svg +6 -0
  8. package/assets/ly.img.cesdk/icons/ErrorUnknown.svg +3 -0
  9. package/assets/ly.img.cesdk/icons/ErrorVideo.svg +6 -0
  10. package/assets/ly.img.cesdk/icons/Move.svg +3 -0
  11. package/assets/ly.img.cesdk/icons/RotateIndicator.svg +5 -0
  12. package/assets/ly.img.cesdk/icu/icudt74l.dat +0 -0
  13. package/assets/ly.img.cesdk/presets/.keep +0 -0
  14. package/assets/ly.img.cesdk/shaders/adjustments.sksl +106 -0
  15. package/assets/ly.img.cesdk/shaders/black_and_white_color_mixer.sksl +152 -0
  16. package/assets/ly.img.cesdk/shaders/common/ubq_adjustments.sksl +102 -0
  17. package/assets/ly.img.cesdk/shaders/common/ubq_color_conversions.sksl +354 -0
  18. package/assets/ly.img.cesdk/shaders/common/ubq_constants.sksl +13 -0
  19. package/assets/ly.img.cesdk/shaders/common/ubq_hue_constants.sksl +86 -0
  20. package/assets/ly.img.cesdk/shaders/common/ubq_noise.sksl +82 -0
  21. package/assets/ly.img.cesdk/shaders/cross_cut.sksl +38 -0
  22. package/assets/ly.img.cesdk/shaders/dot_pattern.sksl +29 -0
  23. package/assets/ly.img.cesdk/shaders/duotone_filter.sksl +26 -0
  24. package/assets/ly.img.cesdk/shaders/extrude_blur.sksl +85 -0
  25. package/assets/ly.img.cesdk/shaders/glow.sksl +31 -0
  26. package/assets/ly.img.cesdk/shaders/half_tone.sksl +14 -0
  27. package/assets/ly.img.cesdk/shaders/linocut.sksl +30 -0
  28. package/assets/ly.img.cesdk/shaders/liquid.sksl +19 -0
  29. package/assets/ly.img.cesdk/shaders/lut_filter.sksl +70 -0
  30. package/assets/ly.img.cesdk/shaders/mask_color.sksl +16 -0
  31. package/assets/ly.img.cesdk/shaders/mirror.sksl +21 -0
  32. package/assets/ly.img.cesdk/shaders/outliner.sksl +40 -0
  33. package/assets/ly.img.cesdk/shaders/pixelize.sksl +10 -0
  34. package/assets/ly.img.cesdk/shaders/placeholder_overlay_lines.sksl +18 -0
  35. package/assets/ly.img.cesdk/shaders/posterize.sksl +8 -0
  36. package/assets/ly.img.cesdk/shaders/radial_pixel.sksl +22 -0
  37. package/assets/ly.img.cesdk/shaders/recolor.sksl +57 -0
  38. package/assets/ly.img.cesdk/shaders/sharpie.sksl +74 -0
  39. package/assets/ly.img.cesdk/shaders/shifter.sksl +22 -0
  40. package/assets/ly.img.cesdk/shaders/tiltshift.sksl +21 -0
  41. package/assets/ly.img.cesdk/shaders/tv_glitch.sksl +25 -0
  42. package/assets/ly.img.cesdk/shaders/vignette.sksl +12 -0
  43. package/example.js +31 -0
  44. package/lib/index.d.ts +4072 -0
  45. package/lib/index.js +4922 -0
  46. package/lib/index.js.map +7 -0
  47. package/package.json +59 -0
package/lib/index.d.ts ADDED
@@ -0,0 +1,4072 @@
1
+ /**
2
+ * Logger types and runtime export. Mirrors `@cesdk/node`'s
3
+ * `bindings/wasm/js_web/src/types/Logger.ts` so consumers can import
4
+ * `LogLevel` / `Logger` from either `@cesdk/node` or `@cesdk/node-native`
5
+ * interchangeably.
6
+ *
7
+ * @public
8
+ */
9
+ export type LogLevel = "Info" | "Warning" | "Error";
10
+ /**
11
+ * Provides a set of predefined log levels for the Creative Editor SDK.
12
+ *
13
+ * The `LogLevel` object contains constants representing different severity levels
14
+ * for logging messages. These levels can be used to categorize log messages based
15
+ * on their importance and urgency.
16
+ *
17
+ * @public
18
+ * @deprecated Specifying log levels via `LogLevel.Info` has been deprecated.
19
+ * Please use the desired LogLevel string directly.
20
+ */
21
+ export declare const LogLevel: {
22
+ readonly Info: "Info";
23
+ readonly Warning: "Warning";
24
+ readonly Error: "Error";
25
+ };
26
+ /**
27
+ * Represents a logger callable.
28
+ *
29
+ * @public
30
+ */
31
+ export type Logger = (message: string, level?: LogLevel) => void;
32
+ /**
33
+ * Block, shape, fill, effect, blur, and animation type constants and
34
+ * the derived shorthand/longhand/union types. Mirrors `@cesdk/node`'s
35
+ * `bindings/wasm/js_web/src/types/blockTypes.ts` exactly so a const
36
+ * array equality check (e.g. `DESIGN_BLOCK_TYPES.includes(t)`) returns
37
+ * the same value across bindings.
38
+ */
39
+ /**
40
+ * The shorthand block type IDs for the top-level design blocks. These
41
+ * are the IDs used to create new blocks via `engine.block.create(id)`.
42
+ *
43
+ * @public
44
+ */
45
+ export declare const DESIGN_BLOCK_TYPES: readonly [
46
+ "scene",
47
+ "stack",
48
+ "camera",
49
+ "page",
50
+ "graphic",
51
+ "audio",
52
+ "text",
53
+ "group",
54
+ "cutout",
55
+ "track",
56
+ "caption",
57
+ "captionTrack"
58
+ ];
59
+ /** @public */
60
+ export type DesignBlockTypeShorthand = (typeof DESIGN_BLOCK_TYPES)[number];
61
+ /** @public */
62
+ export type DesignBlockTypeLonghand = `//ly.img.ubq/${DesignBlockTypeShorthand}`;
63
+ /** @public */
64
+ export type DesignBlockType = DesignBlockTypeShorthand | DesignBlockTypeLonghand;
65
+ /** @public */
66
+ export declare const SHAPE_TYPES: readonly [
67
+ "rect",
68
+ "line",
69
+ "ellipse",
70
+ "polygon",
71
+ "star",
72
+ "vector_path"
73
+ ];
74
+ /** @public */
75
+ export type ShapeTypeShorthand = (typeof SHAPE_TYPES)[number];
76
+ /** @public */
77
+ export type ShapeTypeLonghand = `//ly.img.ubq/shape/${ShapeTypeShorthand}`;
78
+ /** @public */
79
+ export type ShapeType = ShapeTypeShorthand | ShapeTypeLonghand;
80
+ /** @public */
81
+ export declare const FILL_TYPES: readonly [
82
+ "color",
83
+ "gradient/linear",
84
+ "gradient/radial",
85
+ "gradient/conical",
86
+ "image",
87
+ "video",
88
+ "pixelStream"
89
+ ];
90
+ /** @public */
91
+ export type FillTypeShorthand = (typeof FILL_TYPES)[number];
92
+ /** @public */
93
+ export type FillTypeLonghand = `//ly.img.ubq/fill/${FillTypeShorthand}`;
94
+ /** @public */
95
+ export type FillType = FillTypeShorthand | FillTypeLonghand;
96
+ /** @public */
97
+ export declare const EFFECT_TYPES: readonly [
98
+ "adjustments",
99
+ "cross_cut",
100
+ "dot_pattern",
101
+ "duotone_filter",
102
+ "extrude_blur",
103
+ "glow",
104
+ "green_screen",
105
+ "half_tone",
106
+ "linocut",
107
+ "liquid",
108
+ "lut_filter",
109
+ "mirror",
110
+ "outliner",
111
+ "pixelize",
112
+ "posterize",
113
+ "radial_pixel",
114
+ "recolor",
115
+ "sharpie",
116
+ "shifter",
117
+ "tilt_shift",
118
+ "tv_glitch",
119
+ "vignette"
120
+ ];
121
+ /** @public */
122
+ export type EffectTypeShorthand = (typeof EFFECT_TYPES)[number];
123
+ /** @public */
124
+ export type EffectTypeLonghand = `//ly.img.ubq/effect/${EffectTypeShorthand}`;
125
+ /** @public */
126
+ export type EffectType = EffectTypeShorthand | EffectTypeLonghand;
127
+ /** @public */
128
+ export declare const BLUR_TYPES: readonly [
129
+ "uniform",
130
+ "linear",
131
+ "mirrored",
132
+ "radial"
133
+ ];
134
+ /** @public */
135
+ export type BlurTypeShorthand = (typeof BLUR_TYPES)[number];
136
+ /** @public */
137
+ export type BlurTypeLonghand = `//ly.img.ubq/blur/${BlurTypeShorthand}`;
138
+ /** @public */
139
+ export type BlurType = BlurTypeShorthand | BlurTypeLonghand;
140
+ /** @public */
141
+ export declare const ANIMATION_TYPES: readonly [
142
+ "slide",
143
+ "pan",
144
+ "fade",
145
+ "blur",
146
+ "grow",
147
+ "zoom",
148
+ "pop",
149
+ "wipe",
150
+ "baseline",
151
+ "crop_zoom",
152
+ "spin",
153
+ "spin_loop",
154
+ "fade_loop",
155
+ "blur_loop",
156
+ "pulsating_loop",
157
+ "breathing_loop",
158
+ "jump_loop",
159
+ "squeeze_loop",
160
+ "sway_loop",
161
+ "scale_loop",
162
+ "typewriter_text",
163
+ "block_swipe_text",
164
+ "spread_text",
165
+ "merge_text",
166
+ "ken_burns"
167
+ ];
168
+ /** @public */
169
+ export type AnimationTypeShorthand = (typeof ANIMATION_TYPES)[number];
170
+ /** @public */
171
+ export type AnimationTypeLonghand = `//ly.img.ubq/animation/${AnimationTypeShorthand}`;
172
+ /** @public */
173
+ export type AnimationType = AnimationTypeShorthand | AnimationTypeLonghand;
174
+ /** @public */
175
+ export type ObjectTypeShorthand = DesignBlockTypeShorthand | `shape/${ShapeTypeShorthand}` | `fill/${FillTypeShorthand}` | `effect/${EffectTypeShorthand}` | `blur/${BlurTypeShorthand}` | `animation/${AnimationTypeShorthand}`;
176
+ /** @public */
177
+ export type ObjectTypeLonghand = DesignBlockTypeLonghand | ShapeTypeLonghand | FillTypeLonghand | EffectTypeLonghand | BlurTypeLonghand | AnimationTypeLonghand;
178
+ /** @public */
179
+ export type ObjectType = ObjectTypeShorthand | ObjectTypeLonghand;
180
+ /**
181
+ * Shared type definitions for CE.SDK bindings
182
+ * These types are implemented by both Node.js (Native) and Web (WASM) bindings
183
+ */
184
+ /** A unique identifier for a design block */
185
+ export type DesignBlockId = number;
186
+ /** A unique identifier for a history state */
187
+ export type HistoryId = number;
188
+ /** A unique identifier for an event subscription (used internally by bindings) */
189
+ export type SubscriptionId = number;
190
+ /**
191
+ * Render-/decode-/encode-device selector.
192
+ *
193
+ * - `'auto'` — engine picks (default).
194
+ * - `'cpu'` — software path (Skia raster on native, canvas2d on web).
195
+ * - `'gpu'` — any available GPU backend (Metal on macOS, EGL on Linux,
196
+ * WebGL2 in browser, no-op in WASM Node). The engine auto-selects the
197
+ * platform backend; there is no per-sub-backend selection.
198
+ */
199
+ export type Device = "auto" | "cpu" | "gpu";
200
+ /**
201
+ * Configuration options for engine initialization. Mirrors `@cesdk/node`'s
202
+ * engine-level `Configuration` (`bindings/wasm/js_web/src/configuration/
203
+ * index.ts`) verbatim, plus a native-only `device` selector.
204
+ *
205
+ * Web/WASM-only fields are kept on the type for cross-binding shape
206
+ * compatibility — the node native binding ignores them at runtime.
207
+ */
208
+ export interface Configuration {
209
+ /** Base URL for loading engine assets. */
210
+ baseURL?: string;
211
+ /** License key for the engine. Empty string drops the engine into Evaluation mode. */
212
+ license?: string;
213
+ /** Optional user identifier passed through to engine tracking. */
214
+ userId?: string;
215
+ /**
216
+ * WASM core asset locator. Used by `@cesdk/node` to find `cesdk.wasm`
217
+ * / `cesdk.data` next to the loader. Native binding doesn't consume
218
+ * this; kept on the shape for cross-binding portability.
219
+ */
220
+ core?: {
221
+ baseURL: string;
222
+ };
223
+ /** Custom logger. Defaults to `console.log` / `console.warn` / `console.error` per level. */
224
+ logger?: Logger;
225
+ /** Feature flag bag. Mirrors `@cesdk/node`'s `featureFlags`. */
226
+ featureFlags?: {
227
+ [flag: string]: boolean | string;
228
+ };
229
+ /** @deprecated Mirrored from `@cesdk/node` for shape parity. Not consumed. */
230
+ presets?: {
231
+ typefaces?: {
232
+ [id: string]: unknown;
233
+ };
234
+ };
235
+ /**
236
+ * Render-device selection. Defaults to `'auto'` (Metal/EGL → CPU fallback
237
+ * on native; WebGL2/canvas2d on web). Native-only knob today; web/WASM
238
+ * accept the value for shape parity but ignore non-`'auto'` strings.
239
+ *
240
+ * @example
241
+ * ```ts
242
+ * await CreativeEngine.init({ license, device: 'gpu' });
243
+ * await CreativeEngine.init({ license, device: 'cpu' });
244
+ * ```
245
+ */
246
+ device?: Device;
247
+ }
248
+ /** Options for exporting images */
249
+ export interface ExportOptions {
250
+ /** The MIME type of the exported file */
251
+ mimeType?: "image/png" | "image/jpeg" | "image/webp" | "application/pdf";
252
+ /** PNG compression level (0-9) */
253
+ pngCompressionLevel?: number;
254
+ /** JPEG quality (0-1) */
255
+ jpegQuality?: number;
256
+ /** WebP quality (0-1) */
257
+ webpQuality?: number;
258
+ /** Target width for export */
259
+ targetWidth?: number;
260
+ /** Target height for export */
261
+ targetHeight?: number;
262
+ /** Export PDF with high compatibility */
263
+ exportPdfWithHighCompatibility?: boolean;
264
+ /** Export PDF with DeviceCMYK color space (instead of sRGB) for prepress workflows */
265
+ exportPdfWithDeviceCMYK?: boolean;
266
+ /** Export PDF with underlayer */
267
+ exportPdfWithUnderlayer?: boolean;
268
+ /** Spot color name for underlayer */
269
+ underlayerSpotColorName?: string;
270
+ /** Underlayer offset */
271
+ underlayerOffset?: number;
272
+ /**
273
+ * Resolution multiplier for the raster pass that extracts the underlayer contour.
274
+ * Higher values produce sharper underlayer outlines at the cost of memory and export time.
275
+ * Useful for small text on large pages. Values `<= 0` fall back to 1.0.
276
+ */
277
+ underlayerRenderRatio?: number;
278
+ /**
279
+ * Maximum acceptable curve-fit error, in pixels, when vectorising the underlayer contour.
280
+ * Smaller values produce tighter fits at the cost of more path complexity.
281
+ * Values `<= 0` fall back to 2.0.
282
+ */
283
+ underlayerMaxError?: number;
284
+ /** Allow text to extend beyond block boundaries */
285
+ allowTextOverhang?: boolean;
286
+ }
287
+ /** Options for exporting video */
288
+ export interface VideoExportOptions {
289
+ /** Time offset in seconds relative to the target block */
290
+ timeOffset?: number;
291
+ /** Duration in seconds of the final video */
292
+ duration?: number;
293
+ /** H.264 profile */
294
+ h264Profile?: number;
295
+ /** H.264 level */
296
+ h264Level?: number;
297
+ /** Video bitrate in bits per second */
298
+ videoBitrate?: number;
299
+ /** Audio bitrate in bits per second */
300
+ audioBitrate?: number;
301
+ /** Target framerate */
302
+ framerate?: number;
303
+ /** Whether to use target size instead of block size */
304
+ useTargetSize?: boolean;
305
+ /** Target width */
306
+ targetWidth?: number;
307
+ /** Target height */
308
+ targetHeight?: number;
309
+ /** Allow text to extend beyond block boundaries */
310
+ allowTextOverhang?: boolean;
311
+ /** Enable HEVC/H.265 */
312
+ enableHEVC?: boolean;
313
+ }
314
+ /** Options for exporting audio */
315
+ export interface AudioExportOptions {
316
+ /** Time offset in seconds relative to the target block */
317
+ timeOffset?: number;
318
+ /** Duration in seconds of the final audio */
319
+ duration?: number;
320
+ /** Sample rate in Hz */
321
+ sampleRate?: number;
322
+ /** Number of channels */
323
+ numberOfChannels?: number;
324
+ /** Skip encoding */
325
+ skipEncoding?: boolean;
326
+ /** Progress callback */
327
+ onProgress?: (rendered: number, encoded: number, total: number) => void;
328
+ }
329
+ /** RGBA color representation */
330
+ export interface RGBAColor {
331
+ r: number;
332
+ g: number;
333
+ b: number;
334
+ a: number;
335
+ }
336
+ /**
337
+ * CMYK color representation. Field shape matches `@cesdk/engine` (WASM):
338
+ * `tint` is required so the same `Color` value works against both bindings.
339
+ */
340
+ export interface CMYKColor {
341
+ c: number;
342
+ m: number;
343
+ y: number;
344
+ k: number;
345
+ tint: number;
346
+ }
347
+ /**
348
+ * Spot color representation. Field shape matches `@cesdk/engine` (WASM) so
349
+ * the same `Color` union is interchangeable across both bindings.
350
+ */
351
+ export interface SpotColor {
352
+ name: string;
353
+ tint: number;
354
+ externalReference: string;
355
+ }
356
+ /** Internal color format from the node native binding */
357
+ export interface ColorInternal {
358
+ colorSpace: number;
359
+ components: {
360
+ x: number;
361
+ y: number;
362
+ z: number;
363
+ w: number;
364
+ };
365
+ spotColorName?: string;
366
+ tint: number;
367
+ externalReference?: string;
368
+ }
369
+ /** Union of all color types */
370
+ export type Color = RGBAColor | CMYKColor | SpotColor;
371
+ /** Source for image/video content */
372
+ export interface Source {
373
+ uri: string;
374
+ width: number;
375
+ height: number;
376
+ }
377
+ /** Rectangle with position and dimensions */
378
+ export interface XYWH {
379
+ x: number;
380
+ y: number;
381
+ width: number;
382
+ height: number;
383
+ }
384
+ /**
385
+ * Tight ink-paint bounding box of a single grapheme, in global scene
386
+ * coordinates. Returned by `block.getTextCharacterInkBoxes`. The baseline
387
+ * Y is reported separately because it does not equal `y + height` (the
388
+ * box is the tight ink rect; the baseline anchors glyph descenders).
389
+ */
390
+ export interface CharacterInkBox {
391
+ /** Global X of the tight ink rect (left edge, Y-down scene space). */
392
+ x: number;
393
+ /** Global Y of the tight ink rect (top edge, Y-down scene space). */
394
+ y: number;
395
+ /** Width of the tight ink rect. */
396
+ width: number;
397
+ /** Height of the tight ink rect. */
398
+ height: number;
399
+ /** Global Y of the glyph baseline. */
400
+ baselineY: number;
401
+ }
402
+ /** Range of indices */
403
+ export interface Range {
404
+ from: number;
405
+ to: number;
406
+ }
407
+ /** Insets/padding values */
408
+ export interface Insets {
409
+ top: number;
410
+ right: number;
411
+ bottom: number;
412
+ left: number;
413
+ }
414
+ /** Typeface definition */
415
+ export interface Typeface {
416
+ name: string;
417
+ fonts: Font[];
418
+ }
419
+ /**
420
+ * Allowed font weights. Mirrors the `@cesdk/engine` (WASM) `FontWeight`
421
+ * union so a single `Font` is interchangeable across bindings.
422
+ */
423
+ export type FontWeight = "thin" | "extraLight" | "light" | "normal" | "medium" | "semiBold" | "bold" | "extraBold" | "heavy";
424
+ /** Allowed font styles. Mirrors the WASM `FontStyle` union. */
425
+ export type FontStyle = "normal" | "italic";
426
+ /**
427
+ * Individual font within a typeface. Field optionality matches `@cesdk/engine`
428
+ * (WASM) — fields not present in the engine response are simply omitted
429
+ * rather than empty strings.
430
+ */
431
+ export interface Font {
432
+ uri: string;
433
+ subFamily?: string;
434
+ weight?: FontWeight;
435
+ style?: FontStyle;
436
+ }
437
+ /** Gradient color stop */
438
+ export interface GradientColorStop {
439
+ color: Color;
440
+ stop: number;
441
+ }
442
+ /** Locale tag, e.g. `'en'`, `'de'`. */
443
+ export type Locale = string;
444
+ /**
445
+ * Groups carry semantic meaning used to build and group UIs over assets
446
+ * (sections in a content library, topics, etc.). Tags in comparison are
447
+ * looser, used for extended search/filter.
448
+ */
449
+ export type Groups = string[];
450
+ /**
451
+ * Sort order applied by an asset source when supported.
452
+ * `None` keeps insertion order.
453
+ */
454
+ export type SortingOrder = "None" | "Ascending" | "Descending";
455
+ /**
456
+ * Asset metadata.
457
+ *
458
+ * The known named fields are descriptive — they hint at how the asset is
459
+ * meant to be created/used (which block type, mime type, dimensions, etc.).
460
+ * The trailing `Record<string, unknown>` extension lets sources attach
461
+ * arbitrary data without losing the named-field type safety.
462
+ *
463
+ * The node native binding stores `meta` as a flat string map at the C++
464
+ * layer; non-string values pass through TypeScript but throw a `TypeError`
465
+ * at the binding boundary. Treat the rich shape as documentation for the
466
+ * named fields while sticking to string values across bindings.
467
+ */
468
+ export type AssetMetaData = {
469
+ /** The mime type of this asset or the data behind the asset's uri. */
470
+ mimeType?: string;
471
+ /** Block type id to create from this asset. */
472
+ blockType?: string;
473
+ fillType?: string;
474
+ shapeType?: string;
475
+ kind?: string;
476
+ uri?: string;
477
+ thumbUri?: string;
478
+ previewUri?: string;
479
+ sourceSet?: Source[];
480
+ filename?: string;
481
+ vectorPath?: string;
482
+ width?: number;
483
+ height?: number;
484
+ duration?: string;
485
+ /**
486
+ * WASM types this as `EffectType` (a union of effect kind strings); shared
487
+ * widens to `string` so this type does not depend on WASM-specific enums.
488
+ */
489
+ effectType?: string;
490
+ /** WASM types this as `BlurType`; shared widens to `string`. */
491
+ blurType?: string;
492
+ looping?: boolean;
493
+ } & Record<string, unknown>;
494
+ /** Asset color payload, RGB representation. */
495
+ export interface AssetRGBColor {
496
+ colorSpace: "sRGB";
497
+ r: number;
498
+ g: number;
499
+ b: number;
500
+ }
501
+ /** Asset color payload, CMYK representation. */
502
+ export interface AssetCMYKColor {
503
+ colorSpace: "CMYK";
504
+ c: number;
505
+ m: number;
506
+ y: number;
507
+ k: number;
508
+ }
509
+ /** Asset color payload, spot-color representation. */
510
+ export interface AssetSpotColor {
511
+ colorSpace: "SpotColor";
512
+ name: string;
513
+ externalReference: string;
514
+ representation: AssetRGBColor | AssetCMYKColor;
515
+ }
516
+ /** Asset color payload (parallel to engine `Color`; intentionally separate). */
517
+ export type AssetColor = AssetRGBColor | AssetCMYKColor | AssetSpotColor;
518
+ /** Asset transform preset — fixed aspect ratio. */
519
+ export interface AssetFixedAspectRatio {
520
+ type: "FixedAspectRatio";
521
+ width: number;
522
+ height: number;
523
+ }
524
+ /** Asset transform preset — free aspect ratio. */
525
+ export interface AssetFreeAspectRatio {
526
+ type: "FreeAspectRatio";
527
+ }
528
+ /** Asset transform preset — snap to the intrinsic content aspect ratio. */
529
+ export interface AssetContentAspectRatio {
530
+ type: "ContentAspectRatio";
531
+ }
532
+ /** Asset transform preset — fixed size in design units. */
533
+ export interface AssetFixedSize {
534
+ type: "FixedSize";
535
+ width: number;
536
+ height: number;
537
+ designUnit: DesignUnit;
538
+ }
539
+ /** Transform preset payload union. */
540
+ export type AssetTransformPreset = AssetFixedAspectRatio | AssetFreeAspectRatio | AssetContentAspectRatio | AssetFixedSize;
541
+ /** Structured asset payload. */
542
+ export interface AssetPayload {
543
+ color?: AssetColor;
544
+ sourceSet?: Source[];
545
+ typeface?: Typeface;
546
+ transformPreset?: AssetTransformPreset;
547
+ properties?: AssetProperty[];
548
+ }
549
+ /** Generic asset information. */
550
+ export interface Asset {
551
+ id: string;
552
+ groups?: Groups;
553
+ /** Asset-specific and custom meta information. */
554
+ meta?: AssetMetaData;
555
+ /** Structured asset-specific data. */
556
+ payload?: AssetPayload;
557
+ }
558
+ /**
559
+ * Query for searching assets. Field shape mirrors `@cesdk/engine`'s
560
+ * `AssetQueryData` so a single query object is interchangeable across
561
+ * bindings. `page` and `perPage` are required by WASM but kept optional
562
+ * here so simpler callers (e.g., native shared tests) can omit them; the
563
+ * binding layers fall back to defaults.
564
+ */
565
+ export interface AssetsQuery {
566
+ query?: string;
567
+ page?: number;
568
+ perPage?: number;
569
+ groups?: Groups;
570
+ /** Filter by tags. Pass a string for one tag, or an array for any-of. */
571
+ tags?: string | string[];
572
+ locale?: Locale;
573
+ excludeGroups?: Groups;
574
+ sortKey?: string;
575
+ sortingOrder?: SortingOrder | string;
576
+ sortActiveFirst?: boolean;
577
+ /**
578
+ * Structured filter, AND-combined with `query` / `tags` / `groups` /
579
+ * `excludeGroups`. The top-level array is an implicit AND of its
580
+ * entries.
581
+ *
582
+ * Prefer `filter` over the legacy `tags` / `groups` / `excludeGroups`
583
+ * fields for anything beyond a plain case-sensitive include/exclude
584
+ * list (substring matches, `meta.<key>`, `or` / `not` combinators).
585
+ */
586
+ filter?: AssetFilter[];
587
+ }
588
+ /** Alias matching the WASM public type name. */
589
+ export type AssetQueryData = AssetsQuery;
590
+ /**
591
+ * Dot-path against the resolved asset that a property predicate targets:
592
+ * `label`, `id`, `tags`, `groups`, or `meta.<key>` (one segment — meta
593
+ * values in the engine are flat strings).
594
+ *
595
+ * The template literal accepts `'meta.'` (empty key) because TypeScript's
596
+ * `${string}` includes the empty string; the engine rejects this at
597
+ * runtime with an explanatory error.
598
+ * @public
599
+ */
600
+ export type AssetPropertyPath = "label" | "tags" | "id" | "groups" | `meta.${string}`;
601
+ /**
602
+ * A single property predicate. Exactly one of `contains` (case-insensitive
603
+ * substring) or `equals` (case-insensitive equality) must be set — the
604
+ * type forbids passing both or neither. On a string-array property
605
+ * (`tags`, `groups`), the operator matches if any element matches.
606
+ *
607
+ * `meta.<key>` values are flat strings in the engine; if a meta value
608
+ * was originally serialized as a number or boolean, stringify it the
609
+ * same way before comparing.
610
+ * @public
611
+ */
612
+ export type AssetPropertyFilter = {
613
+ property: AssetPropertyPath;
614
+ } & ({
615
+ contains: string;
616
+ equals?: never;
617
+ } | {
618
+ equals: string;
619
+ contains?: never;
620
+ });
621
+ /**
622
+ * Filter expression — predicate or logical combinator. Combinators nest
623
+ * arbitrarily. The union is mutually exclusive: an object with both
624
+ * `and` and `or`, or with `property` next to a combinator key, is
625
+ * rejected at the type level.
626
+ *
627
+ * Missing-key semantics for `not`: a predicate is `false` on an asset
628
+ * that lacks the targeted field, so a negated `meta.foo === 'x'` matches
629
+ * assets where `meta.foo !== 'x'` **and** assets that lack `meta.foo`
630
+ * entirely.
631
+ * @public
632
+ */
633
+ export type AssetFilter = AssetPropertyFilter | {
634
+ and: AssetFilter[];
635
+ or?: never;
636
+ not?: never;
637
+ property?: never;
638
+ } | {
639
+ or: AssetFilter[];
640
+ and?: never;
641
+ not?: never;
642
+ property?: never;
643
+ } | {
644
+ not: AssetFilter;
645
+ and?: never;
646
+ or?: never;
647
+ property?: never;
648
+ };
649
+ /**
650
+ * Result of an assets query. Generic over the result element type so a
651
+ * binding can refine the surface (WASM returns `CompleteAssetResult`).
652
+ * `nextPage` is optional — bindings that paginate finitely return
653
+ * undefined when there's no next page.
654
+ */
655
+ export interface AssetsQueryResult<T extends AssetResult = AssetResult> {
656
+ assets: T[];
657
+ currentPage: number;
658
+ total: number;
659
+ nextPage?: number;
660
+ }
661
+ /** Asset source license information */
662
+ export interface AssetSourceLicense {
663
+ name: string;
664
+ url?: string;
665
+ }
666
+ /** Asset source credits information */
667
+ export interface AssetSourceCredits {
668
+ name: string;
669
+ url?: string;
670
+ }
671
+ /** Audio track information */
672
+ export interface AudioTrackInfo {
673
+ audioCodec: string;
674
+ channels: number;
675
+ sampleRate: number;
676
+ audioDuration: number;
677
+ numAudioPackets: number;
678
+ numAudioFrames: number;
679
+ trackName: string;
680
+ trackIndex: number;
681
+ language: string;
682
+ }
683
+ /**
684
+ * Supported MIME types. Mirrors `@cesdk/node`'s const-object shape
685
+ * (`bindings/wasm/js_web/src/types/MimeType.ts`) verbatim so
686
+ * `MimeType.Png`, `MimeType.Jpeg`, etc. are interchangeable across
687
+ * bindings.
688
+ *
689
+ * @public
690
+ * @deprecated Use the `MimeType` string literal types instead.
691
+ */
692
+ export declare const MimeType: {
693
+ readonly Png: "image/png";
694
+ readonly Jpeg: "image/jpeg";
695
+ readonly WebP: "image/webp";
696
+ readonly Tga: "image/x-tga";
697
+ readonly Svg: "image/svg+xml";
698
+ readonly Wav: "audio/wav";
699
+ readonly Mp4Audio: "audio/mp4";
700
+ readonly Mp4: "video/mp4";
701
+ readonly QuickTime: "video/quicktime";
702
+ readonly Binary: "application/octet-stream";
703
+ readonly Pdf: "application/pdf";
704
+ readonly Zip: "application/zip";
705
+ };
706
+ /** @public */
707
+ export type MimeType = (typeof MimeType)[keyof typeof MimeType];
708
+ /** @public */
709
+ export type ImageMimeType = Extract<MimeType, "image/png" | "image/jpeg" | "image/webp" | "image/x-tga" | "image/svg+xml">;
710
+ /** @public */
711
+ export type AudioMimeType = Extract<MimeType, "audio/wav" | "audio/mp4">;
712
+ /** @public */
713
+ export type VideoMimeType = Extract<MimeType, "video/mp4" | "video/quicktime">;
714
+ /** @public */
715
+ export type ApplicationMimeType = Extract<MimeType, "application/octet-stream" | "application/pdf" | "application/zip">;
716
+ /** Scene modes */
717
+ export type SceneMode = "Design" | "Video";
718
+ /** Design units */
719
+ export type DesignUnit = "Pixel" | "Millimeter" | "Inch";
720
+ /** Position modes */
721
+ export type PositionMode = "Absolute" | "Percent" | "Auto";
722
+ /** Size modes */
723
+ export type SizeMode = "Absolute" | "Percent" | "Auto";
724
+ /** Blend modes */
725
+ export type BlendMode = "PassThrough" | "Normal" | "Darken" | "Multiply" | "ColorBurn" | "LinearBurn" | "DarkenColor" | "Lighten" | "Screen" | "ColorDodge" | "LinearDodge" | "LightenColor" | "Overlay" | "SoftLight" | "HardLight" | "VividLight" | "LinearLight" | "PinLight" | "HardMix" | "Difference" | "Exclusion" | "Subtract" | "Divide" | "Hue" | "Saturation" | "Color" | "Luminosity";
726
+ /** Stroke styles */
727
+ export type StrokeStyle = "Solid" | "Dashed" | "DashedRound" | "LongDashed" | "LongDashedRound";
728
+ /** Stroke positions */
729
+ export type StrokePosition = "Center" | "Inner" | "Outer";
730
+ /** Stroke corner geometry */
731
+ export type StrokeCornerGeometry = "Round" | "Miter" | "Bevel";
732
+ /** Stroke cap geometry for open paths (line shapes, dashes). */
733
+ export type StrokeCap = "Butt" | "Round" | "Square";
734
+ /** Text horizontal alignment */
735
+ export type TextHorizontalAlignment = "Left" | "Center" | "Right";
736
+ /** Text vertical alignment */
737
+ export type TextVerticalAlignment = "Top" | "Center" | "Bottom";
738
+ /** Property types */
739
+ export type PropertyType = "Bool" | "Int" | "Float" | "Double" | "String" | "Enum" | "Color" | "Struct" | "SourceSet";
740
+ /** Block event types */
741
+ /**
742
+ * The kind of block-lifecycle event the engine emits. Matches the engine's
743
+ * internal `BlockEventType` enum used in subscription payloads.
744
+ */
745
+ export type BlockEventType = "Created" | "Updated" | "Destroyed";
746
+ /**
747
+ * Subscription payload delivered to `engine.event.subscribe` callbacks.
748
+ * Field shape matches `@cesdk/engine` (WASM) so subscribers can be written
749
+ * once and run against either binding.
750
+ */
751
+ export interface BlockEvent {
752
+ block: DesignBlockId;
753
+ type: BlockEventType;
754
+ }
755
+ /** Scene layout type */
756
+ export type SceneLayout = string;
757
+ /** Asset property types for dynamic asset configuration */
758
+ export interface AssetStringProperty {
759
+ property: string;
760
+ type: "String";
761
+ value: string;
762
+ defaultValue: string;
763
+ }
764
+ export interface AssetNumberProperty {
765
+ property: string;
766
+ type: "Int" | "Float" | "Double";
767
+ value: number;
768
+ defaultValue: number;
769
+ min: number;
770
+ max: number;
771
+ step: number;
772
+ }
773
+ export interface AssetBooleanProperty {
774
+ property: string;
775
+ type: "Boolean";
776
+ value: boolean;
777
+ defaultValue: boolean;
778
+ }
779
+ export interface AssetEnumProperty {
780
+ property: string;
781
+ type: "Enum";
782
+ value: string;
783
+ defaultValue: string;
784
+ options: string[];
785
+ }
786
+ export interface AssetColorProperty {
787
+ property: string;
788
+ type: "Color";
789
+ value: Color;
790
+ defaultValue: Color;
791
+ }
792
+ /** Union of all asset property types */
793
+ export type AssetProperty = AssetBooleanProperty | AssetColorProperty | AssetEnumProperty | AssetNumberProperty | AssetStringProperty;
794
+ /**
795
+ * Single asset returned from `findAssets`. Field shape mirrors `@cesdk/engine`
796
+ * (WASM) so a single result is interchangeable across bindings. `label` and
797
+ * `tags` here are flat strings (already resolved to `locale`); compare to
798
+ * `AssetDefinition` where they are localized maps.
799
+ */
800
+ export interface AssetResult extends Asset {
801
+ /** The locale of the label and tags */
802
+ locale?: Locale;
803
+ /** Resolved label for the active locale. */
804
+ label?: string;
805
+ /** Resolved tags for the active locale. */
806
+ tags?: string[];
807
+ /** If the asset is marked as active */
808
+ active?: boolean;
809
+ /** Credits for the asset */
810
+ credits?: {
811
+ name: string;
812
+ url?: string;
813
+ };
814
+ /** License for this asset */
815
+ license?: {
816
+ name: string;
817
+ url?: string;
818
+ };
819
+ /** UTM parameters */
820
+ utm?: {
821
+ source?: string;
822
+ medium?: string;
823
+ };
824
+ }
825
+ /** Complete asset result with context information */
826
+ export interface CompleteAssetResult extends AssetResult {
827
+ /** Context of how/where the asset was used */
828
+ context: {
829
+ sourceId: string;
830
+ };
831
+ /** Always present in complete results */
832
+ active: boolean;
833
+ }
834
+ /**
835
+ * Asset definition supplied to `addAsset`. Distinct from `AssetResult`:
836
+ * `label` and `tags` here are localized maps (`Locale -> value`) so a single
837
+ * definition can serve every supported locale.
838
+ */
839
+ export interface AssetDefinition extends Asset {
840
+ /** Localized labels (one entry per supported locale). */
841
+ label?: Record<Locale, string>;
842
+ /** Localized tags (one entry per supported locale). */
843
+ tags?: Record<Locale, string[]>;
844
+ }
845
+ /**
846
+ * A source of assets that can be registered with the engine.
847
+ * Allows custom asset sources with callbacks for querying and applying assets.
848
+ */
849
+ export interface AssetSource {
850
+ /** The unique id of this asset source */
851
+ id: string;
852
+ /**
853
+ * Find assets matching the query.
854
+ * This is the only required callback.
855
+ */
856
+ findAssets(queryData: AssetsQuery): Promise<AssetsQueryResult | undefined>;
857
+ /** Fetch a single asset by id */
858
+ fetchAsset?: (id: string, params?: {
859
+ locale?: string;
860
+ }) => Promise<AssetResult | null>;
861
+ /** Return available groups */
862
+ getGroups?: () => Promise<string[]>;
863
+ /** Credits for this source */
864
+ credits?: {
865
+ name: string;
866
+ url?: string;
867
+ };
868
+ /** General license for assets from this source */
869
+ license?: {
870
+ name: string;
871
+ url?: string;
872
+ };
873
+ /**
874
+ * @deprecated Will be removed in v1.11
875
+ */
876
+ canManageAssets?: boolean;
877
+ /** Apply an asset to the active scene */
878
+ applyAsset?: (asset: CompleteAssetResult) => Promise<DesignBlockId | undefined>;
879
+ /** Apply an asset to a specific block */
880
+ applyAssetToBlock?: (asset: CompleteAssetResult, block: DesignBlockId) => Promise<void>;
881
+ /** Apply a property of an asset */
882
+ applyAssetProperty?: (asset: CompleteAssetResult, property: AssetProperty) => Promise<void>;
883
+ /** Add an asset to this source */
884
+ addAsset?: (asset: AssetDefinition) => void;
885
+ /** Remove an asset from this source */
886
+ removeAsset?: (assetId: string) => void;
887
+ /** Get supported MIME types */
888
+ getSupportedMimeTypes?: () => string[] | undefined;
889
+ }
890
+ /**
891
+ * Hex color string starting with `#`. `@cesdk/node` exposes this as a
892
+ * branded string alias; we use a plain string alias for runtime parity.
893
+ *
894
+ * @public
895
+ */
896
+ export type HexColorString = string;
897
+ /**
898
+ * RGB color (no alpha). Mirrors `@cesdk/node`'s
899
+ * `bindings/wasm/js_web/src/types/color.ts`.
900
+ *
901
+ * @public
902
+ */
903
+ export interface RGBColor {
904
+ /** Red component (0..1). */
905
+ r: number;
906
+ /** Green component (0..1). */
907
+ g: number;
908
+ /** Blue component (0..1). */
909
+ b: number;
910
+ }
911
+ /**
912
+ * Custom-palette color. Mirrors `@cesdk/node`'s `PaletteColor`.
913
+ *
914
+ * @public
915
+ */
916
+ export type PaletteColor = HexColorString | RGBColor | RGBAColor | SpotColor;
917
+ /**
918
+ * Engine color space discriminator.
919
+ *
920
+ * @public
921
+ */
922
+ export type ColorSpace = "sRGB" | "CMYK" | "SpotColor";
923
+ /** @public */
924
+ export interface Vec2 {
925
+ x: number;
926
+ y: number;
927
+ }
928
+ /** @public */
929
+ export interface Vec3 {
930
+ x: number;
931
+ y: number;
932
+ z: number;
933
+ }
934
+ /** @public */
935
+ export interface Size2 {
936
+ width: number;
937
+ height: number;
938
+ }
939
+ /**
940
+ * Per-export tracking metadata sent to the engine's tracking pipeline.
941
+ *
942
+ * @public
943
+ */
944
+ export interface TrackingMetadata {
945
+ [key: string]: string | number | boolean;
946
+ }
947
+ /** @public */
948
+ export type ZoomAutoFitAxis = "Horizontal" | "Vertical" | "Both";
949
+ /**
950
+ * Editor edit mode. Mirrors `@cesdk/node`'s `EditMode` literal union.
951
+ *
952
+ * @public
953
+ */
954
+ export type EditMode = "Transform" | "Crop" | "Text" | "TextLink" | "Playback" | "AdjustmentsCutout" | "AdjustmentsVectorEdit" | string;
955
+ /**
956
+ * Scene-level design unit. Alias of {@link DesignUnit} for cross-binding
957
+ * naming parity (`@cesdk/node` exposes both names).
958
+ *
959
+ * @public
960
+ */
961
+ export type SceneDesignUnit = DesignUnit;
962
+ /**
963
+ * Font-size unit. Mirrors `@cesdk/node`'s
964
+ * `bindings/wasm/js_web/src/utils/unitConversion.ts`. `'Point'` is
965
+ * the engine's native unit; the rest are converted to points before
966
+ * reaching the C++ engine via DPI-aware conversion.
967
+ *
968
+ * @public
969
+ */
970
+ export type FontSizeUnit = SceneDesignUnit | "Point";
971
+ /**
972
+ * Engine role string. Mirrors `@cesdk/node`'s
973
+ * `bindings/wasm/js_web/src/types/role.ts`. The engine accepts arbitrary
974
+ * strings; well-known values are `'Adopter'` and `'Creator'`.
975
+ *
976
+ * @public
977
+ */
978
+ export type RoleString = "Adopter" | "Creator" | string;
979
+ /**
980
+ * Engine scope string. Mirrors `@cesdk/node`'s
981
+ * `bindings/wasm/js_web/src/types/scope.ts`.
982
+ *
983
+ * @public
984
+ */
985
+ export type Scope = string;
986
+ /**
987
+ * Single page's timing window. Mirrors `@cesdk/node`'s
988
+ * `bindings/wasm/js_web/src/types/Pageduration.ts`.
989
+ *
990
+ * @public
991
+ */
992
+ export interface PageDuration {
993
+ pageId: DesignBlockId;
994
+ duration: number;
995
+ start: number;
996
+ end: number;
997
+ }
998
+ /**
999
+ * Boolean operation between cutout shapes. Mirrors `@cesdk/node`'s
1000
+ * `bindings/wasm/js_web/src/types/cutout.ts`.
1001
+ *
1002
+ * @public
1003
+ */
1004
+ export type CutoutOperation = "Union" | "Difference" | "Intersection";
1005
+ /**
1006
+ * Boolean operation for `block.combineShapes` / cutout creation.
1007
+ *
1008
+ * @public
1009
+ */
1010
+ export type BooleanOperation = "Union" | "Difference" | "Intersection" | "XOR";
1011
+ /**
1012
+ * Text case transform. Mirrors `@cesdk/node`'s `BlockAPI.ts`.
1013
+ *
1014
+ * @public
1015
+ */
1016
+ export type TextCase = "Normal" | "Uppercase" | "Lowercase" | "Titlecase";
1017
+ /**
1018
+ * Ordered/unordered text list style. Mirrors `@cesdk/node`'s
1019
+ * `BlockAPI.ts`.
1020
+ *
1021
+ * @public
1022
+ */
1023
+ export type ListStyle = "None" | "Disc" | "Decimal";
1024
+ /**
1025
+ * Multi-block horizontal alignment passed to `block.alignHorizontally`.
1026
+ * Alias of {@link TextHorizontalAlignment} for cross-binding naming
1027
+ * parity (`@cesdk/node` re-exports it under this name from `BlockAPI`).
1028
+ *
1029
+ * @public
1030
+ */
1031
+ export type HorizontalBlockAlignment = TextHorizontalAlignment;
1032
+ /**
1033
+ * Multi-block vertical alignment passed to `block.alignVertically`.
1034
+ * Alias of {@link TextVerticalAlignment}.
1035
+ *
1036
+ * @public
1037
+ */
1038
+ export type VerticalBlockAlignment = TextVerticalAlignment;
1039
+ /**
1040
+ * Dominant color sample returned from `block.getDominantColors`.
1041
+ *
1042
+ * @public
1043
+ */
1044
+ export interface DominantColor {
1045
+ /** sRGB color. */
1046
+ color: RGBAColor;
1047
+ /** Relative weight in the source image (0..1). */
1048
+ weight: number;
1049
+ }
1050
+ /**
1051
+ * Options for `block.getDominantColors`.
1052
+ *
1053
+ * @public
1054
+ */
1055
+ export interface DominantColorsOptions {
1056
+ /** Number of color samples to compute. Default: 6. */
1057
+ numColors?: number;
1058
+ /** Sample-grid step in pixels. Higher = faster, lower = more accurate. */
1059
+ step?: number;
1060
+ }
1061
+ /**
1062
+ * Options for `block.split`. Mirrors `@cesdk/node`'s `SplitOptions`.
1063
+ *
1064
+ * @public
1065
+ */
1066
+ export interface SplitOptions {
1067
+ /** Attach the new tail block to the original parent. Default: true. */
1068
+ attachToParent?: boolean;
1069
+ /** Create a parent track if needed. Default: true. */
1070
+ createParentTrackIfNeeded?: boolean;
1071
+ /** Select the newly created tail block after split. Default: false. */
1072
+ selectNewBlock?: boolean;
1073
+ }
1074
+ /**
1075
+ * Options for `block.setTextFontSize` (new overload). Mirrors
1076
+ * `@cesdk/node`'s `TextFontSizeOptions`.
1077
+ *
1078
+ * @public
1079
+ */
1080
+ export interface TextFontSizeOptions {
1081
+ /** Unit of the supplied size value. Default: `'Point'`. */
1082
+ unit?: FontSizeUnit;
1083
+ /** Inclusive start grapheme index of the run. Default: -1 (whole block). */
1084
+ from?: number;
1085
+ /** Exclusive end grapheme index of the run. Default: -1 (whole block). */
1086
+ to?: number;
1087
+ }
1088
+ /**
1089
+ * Animation entry on `applyAnimation`'s options object.
1090
+ *
1091
+ * @public
1092
+ */
1093
+ export interface AnimationEntry {
1094
+ /** Animation type id (shorthand or longhand). */
1095
+ type: AnimationTypeShorthand | AnimationTypeLonghand;
1096
+ /** Animation duration in seconds. */
1097
+ duration?: number;
1098
+ /** Animation start delay in seconds. */
1099
+ delay?: number;
1100
+ /**
1101
+ * Easing curve. Loose `string` here so each binding can narrow it to
1102
+ * its own `AnimationEasing` union (`@cesdk/node`'s 18-entry list vs
1103
+ * the WASM web list).
1104
+ */
1105
+ easing?: string;
1106
+ }
1107
+ /**
1108
+ * Options for `block.applyAnimation`.
1109
+ *
1110
+ * @public
1111
+ */
1112
+ export interface AnimationOptions {
1113
+ in?: AnimationEntry;
1114
+ loop?: AnimationEntry;
1115
+ out?: AnimationEntry;
1116
+ }
1117
+ /**
1118
+ * Options for `block.applyDropShadow`.
1119
+ *
1120
+ * @public
1121
+ */
1122
+ export interface DropShadowOptions {
1123
+ color?: Color;
1124
+ offset?: {
1125
+ x?: number;
1126
+ y?: number;
1127
+ };
1128
+ blur?: {
1129
+ x?: number;
1130
+ y?: number;
1131
+ };
1132
+ }
1133
+ /**
1134
+ * Options for `block.addImage`.
1135
+ *
1136
+ * @public
1137
+ */
1138
+ export interface AddImageOptions {
1139
+ sizeMode?: SizeMode;
1140
+ positionMode?: PositionMode;
1141
+ x?: number;
1142
+ y?: number;
1143
+ cornerRadius?: number;
1144
+ size?: number | {
1145
+ width: number;
1146
+ height: number;
1147
+ };
1148
+ timeline?: {
1149
+ timeOffset?: number;
1150
+ duration?: number;
1151
+ };
1152
+ shadow?: DropShadowOptions;
1153
+ animation?: AnimationOptions;
1154
+ }
1155
+ /**
1156
+ * Options for `block.addVideo`.
1157
+ *
1158
+ * @public
1159
+ */
1160
+ export interface AddVideoOptions extends AddImageOptions {
1161
+ trimOffset?: number;
1162
+ loop?: boolean;
1163
+ muted?: boolean;
1164
+ }
1165
+ /**
1166
+ * Options for `block.getAudioInfoFromVideo` /
1167
+ * `block.createAudiosFromVideo`.
1168
+ *
1169
+ * @public
1170
+ */
1171
+ export interface AudioFromVideoOptions {
1172
+ trackIndex?: number;
1173
+ }
1174
+ /**
1175
+ * Options for `block.applyAsset`. Mirrors `@cesdk/node`'s
1176
+ * `bindings/wasm/js_web/src/AssetAPI.ts`.
1177
+ *
1178
+ * @public
1179
+ */
1180
+ export interface ApplyAssetOptions {
1181
+ /** Block id to apply the asset to. If omitted, asset becomes a new block. */
1182
+ block?: DesignBlockId;
1183
+ }
1184
+ /**
1185
+ * Discriminator for `editor.{get,set}Setting` family. Mirrors the strings
1186
+ * accepted by `@cesdk/node`'s typed setter overloads.
1187
+ *
1188
+ * @public
1189
+ */
1190
+ export type SettingType = "bool" | "int" | "float" | "string" | "color" | "enum";
1191
+ /** @public */
1192
+ export type SettingsBool = string;
1193
+ /** @public */
1194
+ export type SettingsInt = string;
1195
+ /** @public */
1196
+ export type SettingsFloat = string;
1197
+ /** @public */
1198
+ export type SettingsString = string;
1199
+ /** @public */
1200
+ export type SettingsColor = string;
1201
+ /** @public */
1202
+ export type SettingsColorRGBA = string;
1203
+ /** @public */
1204
+ export type SettingsEnum = string;
1205
+ /**
1206
+ * Helper that strips an optional `ubq://` prefix from a settings keypath.
1207
+ * Mirrors `@cesdk/node`'s `OptionalPrefix<T>`.
1208
+ *
1209
+ * @public
1210
+ */
1211
+ export type OptionalPrefix<T extends string> = T | `ubq://${T}`;
1212
+ /**
1213
+ * Synchronous URI resolver. Mirrors `@cesdk/node`'s
1214
+ * `bindings/wasm/js_web/src/EditorAPI.ts`.
1215
+ *
1216
+ * @public
1217
+ */
1218
+ export type SyncURIResolver = (uri: string, defaultResolver?: SyncURIResolver) => string;
1219
+ /**
1220
+ * Asynchronous URI resolver. Mirrors `@cesdk/node`'s
1221
+ * `bindings/wasm/js_web/src/EditorAPI.ts`.
1222
+ *
1223
+ * @public
1224
+ */
1225
+ export type AsyncURIResolver = (uri: string, defaultResolver?: AsyncURIResolver) => Promise<string> | string;
1226
+ /**
1227
+ * Discriminator emitted by `editor.onHistoryUpdatedWithKind`. Matches engine
1228
+ * `ubq::editor::HistoryUpdate` (`engine/src/ubq/editor/History.hpp`).
1229
+ *
1230
+ * - `Updated`: a snapshot was added or undo/redo applied (scene state mutated).
1231
+ * - `Activated`: a different history buffer was activated via
1232
+ * `setActiveHistory`. The visible undo stack changed but no new snapshot
1233
+ * was created — save-button logic should ignore this.
1234
+ *
1235
+ * @public
1236
+ */
1237
+ export type HistoryUpdate = "Updated" | "Activated";
1238
+ /**
1239
+ * Horizontal alignment of the content fill inside a block. Applies when
1240
+ * `ContentFillMode` is `Contain` or `Cover`. Mirrors engine
1241
+ * `ubq::types::HorizontalContentFillAlignment`
1242
+ * (`engine/src/ubq/types/ContentFillAlignment.hpp`).
1243
+ *
1244
+ * @public
1245
+ */
1246
+ export type HorizontalContentFillAlignment = "Left" | "Center" | "Right";
1247
+ /**
1248
+ * Vertical alignment of the content fill inside a block. Applies when
1249
+ * `ContentFillMode` is `Contain` or `Cover`. Mirrors engine
1250
+ * `ubq::types::VerticalContentFillAlignment`
1251
+ * (`engine/src/ubq/types/ContentFillAlignment.hpp`).
1252
+ *
1253
+ * @public
1254
+ */
1255
+ export type VerticalContentFillAlignment = "Top" | "Center" | "Bottom";
1256
+ /**
1257
+ * Typeface migration entry shipped on the deprecated
1258
+ * `Configuration.presets.typefaces` field. Mirrors `@cesdk/node`'s
1259
+ * `bindings/wasm/js_web/src/configuration/types.ts`.
1260
+ *
1261
+ * @public
1262
+ */
1263
+ export interface TypefaceDefinition {
1264
+ name: string;
1265
+ fonts: Array<{
1266
+ uri: string;
1267
+ subFamily?: string;
1268
+ weight?: FontWeight;
1269
+ style?: FontStyle;
1270
+ }>;
1271
+ }
1272
+ /**
1273
+ * Type guard for {@link RGBAColor}.
1274
+ *
1275
+ * @public
1276
+ */
1277
+ export declare function isRGBAColor(color: Color): color is RGBAColor;
1278
+ /**
1279
+ * Type guard for {@link SpotColor}.
1280
+ *
1281
+ * @public
1282
+ */
1283
+ export declare function isSpotColor(color: Color): color is SpotColor;
1284
+ /**
1285
+ * Type guard for {@link CMYKColor}.
1286
+ *
1287
+ * @public
1288
+ */
1289
+ export declare function isCMYKColor(color: Color): color is CMYKColor;
1290
+ /**
1291
+ * Default logger used by `@cesdk/node-native` when `Configuration.logger`
1292
+ * is not supplied. Routes by level to `console.info` / `console.warn` /
1293
+ * `console.error`, mirroring `@cesdk/node`'s defaultLogger
1294
+ * (`bindings/wasm/js_web/src/configuration/defaultLogger.ts`).
1295
+ *
1296
+ * @public
1297
+ */
1298
+ export function defaultLogger(message: string, level?: LogLevel): void;
1299
+ /**
1300
+ * Interface for block operations
1301
+ * Provides methods for creating, manipulating, and querying design blocks
1302
+ */
1303
+ export interface IBlockAPI {
1304
+ create(type: string): DesignBlockId;
1305
+ createFill(type: string): DesignBlockId;
1306
+ createShape(type: string): DesignBlockId;
1307
+ createEffect(type: string): DesignBlockId;
1308
+ createBlur(type: string): DesignBlockId;
1309
+ createAnimation(type: string): DesignBlockId;
1310
+ duplicate(block: DesignBlockId, attachToParent?: boolean): DesignBlockId;
1311
+ destroy(block: DesignBlockId): void;
1312
+ isValid(block: DesignBlockId): boolean;
1313
+ findAll(): DesignBlockId[];
1314
+ findAllPlaceholders(): DesignBlockId[];
1315
+ findByName(name: string): DesignBlockId[];
1316
+ findByType(type: string): DesignBlockId[];
1317
+ findByKind(kind: string): DesignBlockId[];
1318
+ findAllSelected(): DesignBlockId[];
1319
+ getParent(block: DesignBlockId): DesignBlockId | null;
1320
+ getChildren(block: DesignBlockId): DesignBlockId[];
1321
+ insertChild(parent: DesignBlockId, child: DesignBlockId, index: number): void;
1322
+ appendChild(parent: DesignBlockId, child: DesignBlockId): void;
1323
+ getType(block: DesignBlockId): string;
1324
+ getKind(block: DesignBlockId): string;
1325
+ setKind(block: DesignBlockId, kind: string): void;
1326
+ getName(block: DesignBlockId): string;
1327
+ setName(block: DesignBlockId, name: string): void;
1328
+ getUUID(block: DesignBlockId): string;
1329
+ getBool(block: DesignBlockId, property: string): boolean;
1330
+ setBool(block: DesignBlockId, property: string, value: boolean): void;
1331
+ getInt(block: DesignBlockId, property: string): number;
1332
+ setInt(block: DesignBlockId, property: string, value: number): void;
1333
+ getFloat(block: DesignBlockId, property: string): number;
1334
+ setFloat(block: DesignBlockId, property: string, value: number): void;
1335
+ getDouble(block: DesignBlockId, property: string): number;
1336
+ setDouble(block: DesignBlockId, property: string, value: number): void;
1337
+ getString(block: DesignBlockId, property: string): string;
1338
+ setString(block: DesignBlockId, property: string, value: string): void;
1339
+ getColor(block: DesignBlockId, property: string): Color;
1340
+ setColor(block: DesignBlockId, property: string, value: Color): void;
1341
+ getEnum(block: DesignBlockId, property: string): string;
1342
+ setEnum(block: DesignBlockId, property: string, value: string): void;
1343
+ getPositionX(block: DesignBlockId): number;
1344
+ setPositionX(block: DesignBlockId, value: number): void;
1345
+ getPositionY(block: DesignBlockId): number;
1346
+ setPositionY(block: DesignBlockId, value: number): void;
1347
+ getPositionXMode(block: DesignBlockId): string;
1348
+ setPositionXMode(block: DesignBlockId, mode: string): void;
1349
+ getPositionYMode(block: DesignBlockId): string;
1350
+ setPositionYMode(block: DesignBlockId, mode: string): void;
1351
+ getWidth(block: DesignBlockId): number;
1352
+ setWidth(block: DesignBlockId, value: number): void;
1353
+ getWidthMode(block: DesignBlockId): string;
1354
+ setWidthMode(block: DesignBlockId, mode: string): void;
1355
+ getHeight(block: DesignBlockId): number;
1356
+ setHeight(block: DesignBlockId, value: number): void;
1357
+ getHeightMode(block: DesignBlockId): string;
1358
+ setHeightMode(block: DesignBlockId, mode: string): void;
1359
+ getRotation(block: DesignBlockId): number;
1360
+ setRotation(block: DesignBlockId, value: number): void;
1361
+ getGlobalBoundingBoxX(block: DesignBlockId): number;
1362
+ getGlobalBoundingBoxY(block: DesignBlockId): number;
1363
+ getGlobalBoundingBoxWidth(block: DesignBlockId): number;
1364
+ getGlobalBoundingBoxHeight(block: DesignBlockId): number;
1365
+ getScreenSpaceBoundingBoxXYWH(blocks: DesignBlockId[]): XYWH | readonly [
1366
+ number,
1367
+ number,
1368
+ number,
1369
+ number
1370
+ ];
1371
+ supportsFill(block: DesignBlockId): boolean;
1372
+ hasFill(block: DesignBlockId): boolean;
1373
+ getFill(block: DesignBlockId): DesignBlockId;
1374
+ setFill(block: DesignBlockId, fill: DesignBlockId): void;
1375
+ isFillEnabled(block: DesignBlockId): boolean;
1376
+ setFillEnabled(block: DesignBlockId, enabled: boolean): void;
1377
+ getFillSolidColor(block: DesignBlockId): Color | readonly [
1378
+ number,
1379
+ number,
1380
+ number,
1381
+ number
1382
+ ];
1383
+ setFillSolidColor(block: DesignBlockId, r: number, g: number, b: number, a?: number): void;
1384
+ getGradientColorStops(block: DesignBlockId, property: string): GradientColorStop[];
1385
+ setGradientColorStops(block: DesignBlockId, property: string, stops: GradientColorStop[]): void;
1386
+ supportsStroke(block: DesignBlockId): boolean;
1387
+ hasStroke(block: DesignBlockId): boolean;
1388
+ isStrokeEnabled(block: DesignBlockId): boolean;
1389
+ setStrokeEnabled(block: DesignBlockId, enabled: boolean): void;
1390
+ getStrokeColor(block: DesignBlockId): Color;
1391
+ setStrokeColor(block: DesignBlockId, color: Color): void;
1392
+ getStrokeColorRGBA(block: DesignBlockId): RGBAColor | readonly [
1393
+ number,
1394
+ number,
1395
+ number,
1396
+ number
1397
+ ];
1398
+ setStrokeColorRGBA(block: DesignBlockId, r: number, g: number, b: number, a: number): void;
1399
+ getStrokeWidth(block: DesignBlockId): number;
1400
+ setStrokeWidth(block: DesignBlockId, width: number): void;
1401
+ setStrokeCap(block: DesignBlockId, cap: StrokeCap): void;
1402
+ getStrokeCap(block: DesignBlockId): StrokeCap;
1403
+ setStrokeStartCap(block: DesignBlockId, cap: StrokeCap): void;
1404
+ getStrokeStartCap(block: DesignBlockId): StrokeCap;
1405
+ setStrokeEndCap(block: DesignBlockId, cap: StrokeCap): void;
1406
+ getStrokeEndCap(block: DesignBlockId): StrokeCap;
1407
+ setStrokeDashStartCap(block: DesignBlockId, cap: StrokeCap): void;
1408
+ getStrokeDashStartCap(block: DesignBlockId): StrokeCap;
1409
+ setStrokeDashEndCap(block: DesignBlockId, cap: StrokeCap): void;
1410
+ getStrokeDashEndCap(block: DesignBlockId): StrokeCap;
1411
+ setStrokeDashArray(block: DesignBlockId, dashArray: number[]): void;
1412
+ getStrokeDashArray(block: DesignBlockId): number[];
1413
+ setStrokeDashOffset(block: DesignBlockId, dashOffset: number): void;
1414
+ getStrokeDashOffset(block: DesignBlockId): number;
1415
+ isLineOrigin(block: DesignBlockId): boolean;
1416
+ supportsEffects(block: DesignBlockId): boolean;
1417
+ hasEffects(block: DesignBlockId): boolean;
1418
+ getEffects(block: DesignBlockId): DesignBlockId[];
1419
+ appendEffect(block: DesignBlockId, effect: DesignBlockId): void;
1420
+ insertEffect(block: DesignBlockId, effect: DesignBlockId, index: number): void;
1421
+ removeEffect(block: DesignBlockId, index: number): void;
1422
+ isEffectEnabled(effect: DesignBlockId): boolean;
1423
+ setEffectEnabled(effect: DesignBlockId, enabled: boolean): void;
1424
+ supportsBlur(block: DesignBlockId): boolean;
1425
+ hasBlur(block: DesignBlockId): boolean;
1426
+ getBlur(block: DesignBlockId): DesignBlockId;
1427
+ setBlur(block: DesignBlockId, blur: DesignBlockId): void;
1428
+ isBlurEnabled(block: DesignBlockId): boolean;
1429
+ setBlurEnabled(block: DesignBlockId, enabled: boolean): void;
1430
+ supportsDropShadow(block: DesignBlockId): boolean;
1431
+ isDropShadowEnabled(block: DesignBlockId): boolean;
1432
+ setDropShadowEnabled(block: DesignBlockId, enabled: boolean): void;
1433
+ getDropShadowColor(block: DesignBlockId): Color;
1434
+ setDropShadowColor(block: DesignBlockId, color: Color): void;
1435
+ getDropShadowColorRGBA(block: DesignBlockId): RGBAColor | readonly [
1436
+ number,
1437
+ number,
1438
+ number,
1439
+ number
1440
+ ];
1441
+ setDropShadowColorRGBA(block: DesignBlockId, r: number, g: number, b: number, a: number): void;
1442
+ supportsBlendMode(block: DesignBlockId): boolean;
1443
+ getBlendMode(block: DesignBlockId): string;
1444
+ setBlendMode(block: DesignBlockId, mode: string): void;
1445
+ supportsOpacity(block: DesignBlockId): boolean;
1446
+ getOpacity(block: DesignBlockId): number;
1447
+ setOpacity(block: DesignBlockId, opacity: number): void;
1448
+ isVisible(block: DesignBlockId): boolean;
1449
+ setVisible(block: DesignBlockId, visible: boolean): void;
1450
+ isClipped(block: DesignBlockId): boolean;
1451
+ setClipped(block: DesignBlockId, clipped: boolean): void;
1452
+ setSelected(block: DesignBlockId, selected: boolean): void;
1453
+ isSelected(block: DesignBlockId): boolean;
1454
+ select(block: DesignBlockId): void;
1455
+ hasMetadata(block: DesignBlockId, key: string): boolean;
1456
+ getMetadata(block: DesignBlockId, key: string): string;
1457
+ setMetadata(block: DesignBlockId, key: string, value: string): void;
1458
+ removeMetadata(block: DesignBlockId, key: string): void;
1459
+ findAllMetadata(block: DesignBlockId): string[];
1460
+ replaceText(block: DesignBlockId, text: string, from?: number, to?: number): void;
1461
+ removeText(block: DesignBlockId, from?: number, to?: number): void;
1462
+ getTextFontSizes(block: DesignBlockId, options?: TextFontSizeOptions): number[];
1463
+ getTextFontSizes(block: DesignBlockId, from?: number, to?: number): number[];
1464
+ setTextFontSize(block: DesignBlockId, size: number): void;
1465
+ getTextColors(block: DesignBlockId): Color[];
1466
+ setTextColor(block: DesignBlockId, color: Color): void;
1467
+ /**
1468
+ * Resolves the typefaces in use across `block`'s text.
1469
+ *
1470
+ * - Without `from`/`to`: returns the union of typefaces resolved across
1471
+ * the entire text (never throws on partial coverage).
1472
+ * - With a range: throws `block has no typeface` when the range has no
1473
+ * explicit typeface assignment. Pass the range when you need the
1474
+ * strict "no-typeface" signal for downstream font discovery.
1475
+ */
1476
+ getTypefaces(block: DesignBlockId, from?: number, to?: number): Typeface[];
1477
+ setTypeface(block: DesignBlockId, typeface: Typeface): void;
1478
+ getTypeface(block: DesignBlockId): Typeface;
1479
+ setFont(block: DesignBlockId, fontUri: string, typeface: Typeface): void;
1480
+ setTextKerning(block: DesignBlockId, kerning: number, from?: number, to?: number): void;
1481
+ getTextKernings(block: DesignBlockId, from?: number, to?: number): number[];
1482
+ getTextCharacterInkBoxes(block: DesignBlockId, from?: number, to?: number): CharacterInkBox[];
1483
+ setContentFillHorizontalAlignment(block: DesignBlockId, alignment: HorizontalContentFillAlignment): void;
1484
+ getContentFillHorizontalAlignment(block: DesignBlockId): HorizontalContentFillAlignment;
1485
+ setContentFillVerticalAlignment(block: DesignBlockId, alignment: VerticalContentFillAlignment): void;
1486
+ getContentFillVerticalAlignment(block: DesignBlockId): VerticalContentFillAlignment;
1487
+ getSourceSet(block: DesignBlockId, property: string): Source[];
1488
+ setSourceSet(block: DesignBlockId, property: string, sources: Source[]): void;
1489
+ addImageFileURIToSourceSet(block: DesignBlockId, property: string, uri: string): Promise<void>;
1490
+ addVideoFileURIToSourceSet(block: DesignBlockId, property: string, uri: string): Promise<void>;
1491
+ supportsDuration(block: DesignBlockId): boolean;
1492
+ getDuration(block: DesignBlockId): number;
1493
+ setDuration(block: DesignBlockId, duration: number): void;
1494
+ supportsTimeOffset(block: DesignBlockId): boolean;
1495
+ getTimeOffset(block: DesignBlockId): number;
1496
+ setTimeOffset(block: DesignBlockId, offset: number): void;
1497
+ loadFromString(content: string): Promise<DesignBlockId[]>;
1498
+ loadFromURL(url: string): Promise<DesignBlockId[]>;
1499
+ saveToString(blocks: DesignBlockId[]): Promise<string>;
1500
+ saveToArchive(blocks: DesignBlockId[]): Promise<Uint8Array | Blob>;
1501
+ onStateChanged(ids: DesignBlockId[], callback: (ids: DesignBlockId[]) => void): () => void;
1502
+ onSelectionChanged(callback: () => void): () => void;
1503
+ onClicked(callback: (id: DesignBlockId) => void): () => void;
1504
+ }
1505
+ /**
1506
+ * Interface for scene operations
1507
+ * Provides methods for creating, loading, and saving scenes
1508
+ */
1509
+ export interface ISceneAPI {
1510
+ create(): DesignBlockId;
1511
+ createVideo(): DesignBlockId;
1512
+ createFromImage(uri: string, dpi?: number, pixelScaleFactor?: number): Promise<DesignBlockId>;
1513
+ createFromVideo(uri: string): Promise<DesignBlockId>;
1514
+ loadFromString(content: string): Promise<DesignBlockId>;
1515
+ loadFromURL(url: string): Promise<DesignBlockId>;
1516
+ saveToString(options?: {
1517
+ allowedResourceSchemes?: string[];
1518
+ onDisallowedResourceScheme?: (url: string, dataHash: string) => Promise<string>;
1519
+ compression?: {
1520
+ format?: number;
1521
+ level?: number;
1522
+ };
1523
+ }): Promise<string>;
1524
+ saveToArchive(scene?: DesignBlockId): Promise<Uint8Array | Blob>;
1525
+ applyTemplateFromString(content: string): Promise<void>;
1526
+ applyTemplateFromURL(url: string): Promise<void>;
1527
+ getPages(scene?: DesignBlockId): DesignBlockId[];
1528
+ /** Returns null when there's no scene or no current page. */
1529
+ getCurrentPage(scene?: DesignBlockId): DesignBlockId | null;
1530
+ getMode(scene?: DesignBlockId): string | null;
1531
+ getLayout(scene?: DesignBlockId): SceneLayout;
1532
+ setLayout(layout: SceneLayout, scene?: DesignBlockId): void;
1533
+ getDesignUnit(scene?: DesignBlockId): string;
1534
+ setDesignUnit(unit: string, scene?: DesignBlockId): void;
1535
+ getFontSizeUnit(scene?: DesignBlockId): string;
1536
+ setFontSizeUnit(unit: string, scene?: DesignBlockId): void;
1537
+ get(): DesignBlockId | null;
1538
+ }
1539
+ /**
1540
+ * Interface for editor operations
1541
+ * Provides methods for editor settings and state management
1542
+ */
1543
+ export interface IEditorAPI {
1544
+ /** Active license JWT, or '' in Evaluation mode. */
1545
+ getActiveLicense(): string;
1546
+ /**
1547
+ * Activate or re-activate the engine with a license key. Empty string =
1548
+ * Evaluation mode. Most callers should set `Configuration.license` at
1549
+ * `CreativeEngine.init()` time instead.
1550
+ */
1551
+ unlockWithLicense(license: string): void;
1552
+ findAllSettings(): string[];
1553
+ getSettingType(key: string): string;
1554
+ getSettingBool(key: string): boolean;
1555
+ setSettingBool(key: string, value: boolean): void;
1556
+ getSettingInt(key: string): number;
1557
+ setSettingInt(key: string, value: number): void;
1558
+ getSettingFloat(key: string): number;
1559
+ setSettingFloat(key: string, value: number): void;
1560
+ getSettingString(key: string): string;
1561
+ setSettingString(key: string, value: string): void;
1562
+ getSettingColor(key: string): Color;
1563
+ setSettingColor(key: string, value: Color): void;
1564
+ getSettingEnum(key: string): string;
1565
+ setSettingEnum(key: string, value: string): void;
1566
+ getSettingEnumOptions(key: string): string[];
1567
+ getEditMode(): string;
1568
+ setEditMode(mode: string): void;
1569
+ getRole(): string;
1570
+ setRole(role: string): void;
1571
+ createHistory(): HistoryId;
1572
+ destroyHistory(history: HistoryId): void;
1573
+ getActiveHistory(): HistoryId;
1574
+ setActiveHistory(history: HistoryId): void;
1575
+ undo(): void;
1576
+ redo(): void;
1577
+ canUndo(): boolean;
1578
+ canRedo(): boolean;
1579
+ addUndoStep(): void;
1580
+ removeUndoStep(): void;
1581
+ convertColorToColorSpace(color: Color, colorSpace: string): Color;
1582
+ supportsP3?(): boolean;
1583
+ findAllSpotColors(): string[];
1584
+ getSpotColorRGBA(name: string): RGBAColor | readonly [
1585
+ number,
1586
+ number,
1587
+ number,
1588
+ number
1589
+ ];
1590
+ getSpotColorCMYK(name: string): CMYKColor | readonly [
1591
+ number,
1592
+ number,
1593
+ number,
1594
+ number
1595
+ ];
1596
+ setSpotColorRGB(name: string, r: number, g: number, b: number): void;
1597
+ setSpotColorCMYK(name: string, c: number, m: number, y: number, k: number): void;
1598
+ removeSpotColor(name: string): void;
1599
+ setSafeAreaInsets(insets: Insets): void;
1600
+ getSafeAreaInsets(): Insets;
1601
+ getAbsoluteURI(relativeUri: string): string | Promise<string>;
1602
+ defaultURIResolver(relativePath: string): string;
1603
+ getMimeType(uri: string): Promise<string>;
1604
+ relocateResource(currentUri: string, newUri: string): void;
1605
+ findAllMediaURIs(): string[];
1606
+ /**
1607
+ * Engine-managed in-memory buffers. Allocate via {@link createBuffer},
1608
+ * write through {@link setBufferData}, read back via
1609
+ * {@link getBufferData}, and free with {@link destroyBuffer}. The
1610
+ * returned URI is consumable wherever the engine accepts a resource
1611
+ * URI (e.g. `image/uri` properties), avoiding a filesystem round-trip
1612
+ * for transient resources produced by importers and exporters.
1613
+ */
1614
+ createBuffer(): string;
1615
+ destroyBuffer(uri: string): void;
1616
+ setBufferData(uri: string, offset: number, data: Uint8Array): void;
1617
+ getBufferData(uri: string, offset: number, length: number): Uint8Array;
1618
+ setBufferLength(uri: string, length: number): void;
1619
+ getBufferLength(uri: string): number;
1620
+ /**
1621
+ * List all transient (in-engine) resources. Each entry has a `size`
1622
+ * and a URI under one of two field names: WASM emits `URL`, native
1623
+ * emits `uri`. Portable consumers should read both, e.g.
1624
+ * `(r as any).URL ?? (r as any).uri`. See
1625
+ * `@imgly/psd-importer`'s transient-resource-relocation test for the
1626
+ * canonical pattern.
1627
+ */
1628
+ findAllTransientResources(): Array<{
1629
+ URL: string;
1630
+ size: number;
1631
+ } | {
1632
+ uri: string;
1633
+ size: number;
1634
+ }>;
1635
+ /** @deprecated Use {@link onHistoryUpdatedWithKind} instead. */
1636
+ onHistoryUpdated(callback: () => void): () => void;
1637
+ onHistoryUpdatedWithKind(callback: (kind: HistoryUpdate) => void): () => void;
1638
+ onSettingsChanged(callback: () => void): () => void;
1639
+ }
1640
+ /**
1641
+ * Interface for asset operations
1642
+ * Provides methods for managing asset sources
1643
+ */
1644
+ export interface IAssetAPI {
1645
+ addSource(source: AssetSource): void;
1646
+ addLocalSource(id: string, supportedMimeTypes?: string[]): void;
1647
+ addLocalAssetSourceFromJSONString(contentJSON: string, basePath?: string): Promise<string>;
1648
+ addLocalAssetSourceFromJSONURI(contentURI: string): Promise<string>;
1649
+ removeSource(id: string): void;
1650
+ findAllSources(): string[];
1651
+ findAssets(sourceId: string, query: AssetsQuery): Promise<AssetsQueryResult<CompleteAssetResult>>;
1652
+ getGroups(sourceId: string): Promise<string[]>;
1653
+ getLicense(sourceId: string): AssetSourceLicense | null | undefined;
1654
+ getCredits(sourceId: string): AssetSourceCredits | null | undefined;
1655
+ getSupportedMimeTypes(sourceId: string): string[];
1656
+ addAssetToSource(sourceId: string, asset: AssetDefinition): void;
1657
+ removeAssetFromSource(sourceId: string, assetId: string): void;
1658
+ assetSourceContentsChanged(sourceId: string): void;
1659
+ }
1660
+ /**
1661
+ * Interface for event subscriptions
1662
+ */
1663
+ export interface IEventAPI {
1664
+ subscribe(blocks: DesignBlockId[], callback: (events: BlockEvent[]) => void): () => void;
1665
+ }
1666
+ /**
1667
+ * Interface for variable management
1668
+ */
1669
+ export interface IVariableAPI {
1670
+ setString(key: string, value: string): void;
1671
+ getString(key: string): string;
1672
+ findAll(): string[];
1673
+ remove(key: string): void;
1674
+ }
1675
+ /**
1676
+ * Main Creative Engine interface
1677
+ * This interface defines the contract that all binding implementations must fulfill.
1678
+ *
1679
+ * When adding a new `I<X>API` to this file, also add a phantom assertion in
1680
+ * `bindings/wasm/js_web/src/__type_checks__/shared-interface-parity.ts` so the
1681
+ * node wasm binding stays pinned. The node native binding pins itself via
1682
+ * its `class … implements I<X>API` declarations.
1683
+ */
1684
+ export interface ICreativeEngine {
1685
+ /** Engine version string */
1686
+ readonly version: string;
1687
+ /** Block operations API */
1688
+ readonly block: IBlockAPI;
1689
+ /** Scene operations API */
1690
+ readonly scene: ISceneAPI;
1691
+ /** Editor operations API */
1692
+ readonly editor: IEditorAPI;
1693
+ /** Asset operations API */
1694
+ readonly asset: IAssetAPI;
1695
+ /** Event subscription API */
1696
+ readonly event: IEventAPI;
1697
+ /** Variable management API */
1698
+ readonly variable: IVariableAPI;
1699
+ /** Dispose the engine and clean up all resources */
1700
+ dispose(): void;
1701
+ }
1702
+ /**
1703
+ * Normalized contract that both the node wasm binding and the node native
1704
+ * binding can satisfy after a thin adapter layer.
1705
+ *
1706
+ * Each shared API class (`VariableAPI`, `EventAPI`, …) operates against this
1707
+ * interface so the high-level method bodies are written once. Bindings provide
1708
+ * adapters:
1709
+ *
1710
+ * • The node wasm adapter unwraps `UBQResult<T>`, flattens `Vector<T>` to
1711
+ * `T[]`, and converts the internal color shape to the user-facing `Color`.
1712
+ * • The node native adapter is mostly pass-through — it already speaks the
1713
+ * normalized shape.
1714
+ *
1715
+ * This file is the *minimum* contract needed by the migrated classes. As
1716
+ * additional API classes move into `@cesdk/shared`, methods get added here
1717
+ * (it's an intentionally incremental migration). The interface MUST stay
1718
+ * narrow — every method here is a runtime obligation for both adapters.
1719
+ */
1720
+ export interface EngineBindingHandle {
1721
+ findAllVariables(): string[];
1722
+ setVariableString(key: string, value: string): void;
1723
+ getVariableString(key: string): string;
1724
+ removeVariable(key: string): void;
1725
+ }
1726
+ export declare class VariableAPI implements IVariableAPI {
1727
+ #private;
1728
+ constructor(engine: EngineBindingHandle);
1729
+ /**
1730
+ * Get all text variable names currently stored in the engine.
1731
+ * @returns List of variable names.
1732
+ */
1733
+ findAll(): string[];
1734
+ /**
1735
+ * Set a text variable's value. Creates the variable if it doesn't exist.
1736
+ * @param key - The variable's key.
1737
+ * @param value - The text value to assign.
1738
+ */
1739
+ setString(key: string, value: string): void;
1740
+ /**
1741
+ * Get a text variable's value.
1742
+ * @param key - The variable's key.
1743
+ * @returns The text value of the variable.
1744
+ */
1745
+ getString(key: string): string;
1746
+ /**
1747
+ * Remove a text variable from the engine.
1748
+ * @param key - The variable's key to remove.
1749
+ */
1750
+ remove(key: string): void;
1751
+ }
1752
+ /**
1753
+ * v4-era default asset source IDs. Public surface mirrors @cesdk/node:
1754
+ * bindings/wasm/js_node/src/CreativeEngine.ts uses the same union from
1755
+ * bindings/wasm/js_web/src/addDefaultAssetSources.ts.
1756
+ *
1757
+ * `ly.img.captionPresets` is handled specially (loaded via a dedicated
1758
+ * sub-loader, not content.json) to match WASM behavior.
1759
+ *
1760
+ * @public
1761
+ */
1762
+ export type DefaultAssetSourceId = "ly.img.sticker" | "ly.img.vectorpath" | "ly.img.colors.defaultPalette" | "ly.img.filter.lut" | "ly.img.filter.duotone" | "ly.img.effect" | "ly.img.blur" | "ly.img.typeface" | "ly.img.page.presets" | "ly.img.page.presets.video" | "ly.img.crop.presets" | "ly.img.text" | "ly.img.captionPresets";
1763
+ /**
1764
+ * Demo (v3) asset source IDs. Mirrors `@cesdk/node`'s
1765
+ * `bindings/wasm/js_web/src/addDemoAssetSources.ts`.
1766
+ *
1767
+ * `ly.img.template`, `ly.img.video.template`, and `ly.img.textComponents`
1768
+ * are accepted on the type even though they need extra wiring (template
1769
+ * sources require a custom `applyAsset` callback that calls
1770
+ * `scene.applyTemplateFromString` / `applyTemplateFromURL`). Native
1771
+ * supplies that wiring via the same callback path.
1772
+ *
1773
+ * @deprecated Mirrors `@cesdk/node`'s deprecated demo asset shape;
1774
+ * migrate to v4 sources via `addLocalAssetSourceFromJSONURI` directly.
1775
+ * @public
1776
+ */
1777
+ export type DemoAssetSourceId = "ly.img.template" | "ly.img.video.template" | "ly.img.textComponents" | "ly.img.image" | "ly.img.video" | "ly.img.audio" | "ly.img.image.upload" | "ly.img.video.upload" | "ly.img.audio.upload";
1778
+ /**
1779
+ * Options for creating a scene with a default page in one call.
1780
+ * @public
1781
+ */
1782
+ export type CreateSceneOptions = {
1783
+ /** Page-level options applied to a freshly-created page. */
1784
+ page?: {
1785
+ /** Page dimensions. A number is treated as a square (w = h). */
1786
+ size: number | {
1787
+ width: number;
1788
+ height: number;
1789
+ };
1790
+ /** Optional solid fill color applied to the page. */
1791
+ color?: Color;
1792
+ };
1793
+ /** Design unit. Also pairs the font-size unit (Pixel→Pixel, else→Point). */
1794
+ designUnit?: string;
1795
+ /** Font-size unit. Overrides the pairing from `designUnit`. */
1796
+ fontSizeUnit?: string;
1797
+ };
1798
+ /**
1799
+ * Font metrics extracted from a font file.
1800
+ * Values are in the font's design units coordinate space.
1801
+ * @public
1802
+ */
1803
+ export interface FontMetrics {
1804
+ ascender: number;
1805
+ descender: number;
1806
+ unitsPerEm: number;
1807
+ lineGap: number;
1808
+ capHeight: number;
1809
+ xHeight: number;
1810
+ underlineOffset: number;
1811
+ underlineSize: number;
1812
+ strikeoutOffset: number;
1813
+ strikeoutSize: number;
1814
+ }
1815
+ /**
1816
+ * Compression format for `engine.scene.saveToString` / `loadFromString`.
1817
+ * `None` is the default (legacy base64 string output); `Zstd` returns raw
1818
+ * compressed bytes.
1819
+ * @public
1820
+ */
1821
+ export declare enum CompressionFormat {
1822
+ None = 0,
1823
+ Zstd = 1
1824
+ }
1825
+ /**
1826
+ * Compression level preset for Zstd. `Default` is balanced; `Fastest`
1827
+ * trades ratio for speed; `Best` trades speed for ratio.
1828
+ * @public
1829
+ */
1830
+ export declare enum CompressionLevel {
1831
+ Fastest = 0,
1832
+ Default = 1,
1833
+ Best = 2
1834
+ }
1835
+ /**
1836
+ * Lines that can be drawn as text decorations. `None` disables decorations.
1837
+ * Multiple lines may be combined in a single config.
1838
+ * @public
1839
+ */
1840
+ export type TextDecorationLine = "None" | "Underline" | "Strikethrough" | "Overline";
1841
+ /**
1842
+ * Visual style for text decoration lines.
1843
+ * @public
1844
+ */
1845
+ export type TextDecorationStyle = "Solid" | "Double" | "Dotted" | "Dashed" | "Wavy";
1846
+ /**
1847
+ * Configuration for text decoration rendering.
1848
+ * @public
1849
+ */
1850
+ export interface TextDecorationConfig {
1851
+ lines: TextDecorationLine[];
1852
+ style?: TextDecorationStyle;
1853
+ /** Override color for underlines (only). */
1854
+ underlineColor?: Color;
1855
+ /** Multiplier on the font-derived underline thickness. Default 1.0. */
1856
+ underlineThickness?: number;
1857
+ /** Relative offset multiplier for the underline position. */
1858
+ underlineOffset?: number;
1859
+ /** When true, underlines skip glyph descenders. Default true. */
1860
+ skipInk?: boolean;
1861
+ }
1862
+ /**
1863
+ * A movement constraint rule. The scope is determined by which key is
1864
+ * present: neither (scene-wide default), `block` (per-block, includes
1865
+ * pages), or `blockType` (per-block-type).
1866
+ *
1867
+ * `overshoot` is a non-negative fraction of the moved block's own size.
1868
+ * @public
1869
+ */
1870
+ export type MovementConstraintRule = {
1871
+ overshoot: number;
1872
+ } | {
1873
+ overshoot: number;
1874
+ block: number;
1875
+ } | {
1876
+ overshoot: number;
1877
+ blockType: string;
1878
+ };
1879
+ /**
1880
+ * Scope descriptor used to identify an existing movement constraint for
1881
+ * removal.
1882
+ * @public
1883
+ */
1884
+ export type MovementConstraintScope = {
1885
+ block: number;
1886
+ } | {
1887
+ blockType: string;
1888
+ };
1889
+ /**
1890
+ * Effective movement constraint for a block, or `null` when no constraint
1891
+ * applies.
1892
+ * @public
1893
+ */
1894
+ export type ResolvedMovementConstraint = {
1895
+ overshoot: number;
1896
+ } | null;
1897
+ /**
1898
+ * Animation easing types for animated operations
1899
+ * @public
1900
+ */
1901
+ export type AnimationEasing = "Linear" | "EaseIn" | "EaseOut" | "EaseInOut" | "EaseInQuart" | "EaseOutQuart" | "EaseInOutQuart" | "EaseInQuint" | "EaseOutQuint" | "EaseInOutQuint" | "EaseInBack" | "EaseOutBack" | "EaseInOutBack" | "EaseInSpring" | "EaseOutSpring" | "EaseInOutSpring";
1902
+ /**
1903
+ * Options for zooming to a block with optional animation.
1904
+ * @public
1905
+ */
1906
+ export type ZoomOptions = {
1907
+ /** Padding configuration around the block */
1908
+ padding?: number | {
1909
+ x?: number;
1910
+ y?: number;
1911
+ } | {
1912
+ top?: number;
1913
+ bottom?: number;
1914
+ left?: number;
1915
+ right?: number;
1916
+ };
1917
+ /** Animation configuration - boolean for default animation or object for custom settings */
1918
+ animate?: boolean | {
1919
+ /** Duration of the animation in seconds */
1920
+ duration?: number;
1921
+ /** Easing function for the animation */
1922
+ easing?: AnimationEasing;
1923
+ /** Whether the animation can be interrupted */
1924
+ interruptible?: boolean;
1925
+ };
1926
+ };
1927
+ /**
1928
+ * Internal color representation used by the node native binding.
1929
+ * Converts between the internal format (colorSpace, components) and
1930
+ * the user-friendly format (r,g,b,a or c,m,y,k or spotColorName).
1931
+ */
1932
+ export interface NativeColorInternal {
1933
+ colorSpace: number;
1934
+ components: {
1935
+ x: number;
1936
+ y: number;
1937
+ z: number;
1938
+ w: number;
1939
+ };
1940
+ spotColorName: string;
1941
+ tint: number;
1942
+ externalReference: string;
1943
+ }
1944
+ declare namespace NativeColorInternal {
1945
+ enum ColorSpace {
1946
+ sRGB = 0,
1947
+ CMYK = 1,
1948
+ SpotColor = 2
1949
+ }
1950
+ function toColor(color: NativeColorInternal): Color;
1951
+ function fromColor(color: Color): NativeColorInternal;
1952
+ }
1953
+ /**
1954
+ * BlockAPI provides methods for creating, manipulating, and querying design blocks.
1955
+ * Design blocks are the fundamental building blocks of a scene - they represent
1956
+ * visual elements like graphics, text, images, and containers.
1957
+ *
1958
+ * API matches Web bindings: engine.block.*
1959
+ */
1960
+ export declare class BlockAPI implements IBlockAPI {
1961
+ #private;
1962
+ constructor(engine: NativeEngine);
1963
+ /**
1964
+ * Create a new block of the specified type.
1965
+ * @param type - The block type (e.g., 'graphic', 'text', 'page', 'audio').
1966
+ * @returns The ID of the newly created block.
1967
+ */
1968
+ create(type: string): DesignBlockId;
1969
+ /**
1970
+ * Create a new fill block of the specified type.
1971
+ * @param type - The fill type (e.g., 'color', 'gradient/linear', 'gradient/radial', 'image', 'video').
1972
+ * @returns The ID of the newly created fill block.
1973
+ */
1974
+ createFill(type: string): DesignBlockId;
1975
+ /**
1976
+ * Create a new shape block of the specified type.
1977
+ * @param type - The shape type (e.g., 'rect', 'ellipse', 'polygon', 'star', 'line').
1978
+ * @returns The ID of the newly created shape block.
1979
+ */
1980
+ createShape(type: string): DesignBlockId;
1981
+ /**
1982
+ * Create a new effect block of the specified type.
1983
+ * @param type - The effect type (e.g., 'adjustments', 'pixelize', 'glow', 'half_tone').
1984
+ * @returns The ID of the newly created effect block.
1985
+ */
1986
+ createEffect(type: string): DesignBlockId;
1987
+ /**
1988
+ * Create a new blur block of the specified type.
1989
+ * @param type - The blur type (e.g., 'uniform', 'linear', 'mirrored', 'radial').
1990
+ * @returns The ID of the newly created blur block.
1991
+ */
1992
+ createBlur(type: string): DesignBlockId;
1993
+ /**
1994
+ * Create a new animation block of the specified type.
1995
+ * @param type - The animation type.
1996
+ * @returns The ID of the newly created animation block.
1997
+ */
1998
+ createAnimation(type: string): DesignBlockId;
1999
+ /**
2000
+ * Duplicate an existing block.
2001
+ * @param block - The ID of the block to duplicate.
2002
+ * @param attachToParent - Whether to attach the duplicate to the same parent (default: true).
2003
+ * @returns The ID of the duplicated block.
2004
+ */
2005
+ duplicate(block: DesignBlockId, attachToParent?: boolean): DesignBlockId;
2006
+ /**
2007
+ * Destroy a block and release its resources.
2008
+ * @param block - The ID of the block to destroy.
2009
+ */
2010
+ destroy(block: DesignBlockId): void;
2011
+ /**
2012
+ * Check if a block ID refers to a valid, existing block.
2013
+ * @param block - The ID to check.
2014
+ * @returns True if the block exists and is valid, false otherwise.
2015
+ */
2016
+ isValid(block: DesignBlockId): boolean;
2017
+ /**
2018
+ * Find all blocks in the scene.
2019
+ * @returns Array of all block IDs.
2020
+ */
2021
+ findAll(): DesignBlockId[];
2022
+ /**
2023
+ * Find all placeholder blocks in the scene.
2024
+ * @returns Array of placeholder block IDs.
2025
+ */
2026
+ findAllPlaceholders(): DesignBlockId[];
2027
+ /**
2028
+ * Find all blocks that are not part of the active scene tree (orphans).
2029
+ * Useful for diagnosing leaks where blocks are created with `create(...)`
2030
+ * but never appended to a parent.
2031
+ * @returns Array of unreferenced block IDs.
2032
+ */
2033
+ findAllUnused(): DesignBlockId[];
2034
+ /**
2035
+ * Find blocks by their name.
2036
+ * @param name - The name to search for.
2037
+ * @returns Array of matching block IDs.
2038
+ */
2039
+ findByName(name: string): DesignBlockId[];
2040
+ /**
2041
+ * Find blocks by their type.
2042
+ * @param type - The type to search for (e.g., '//ly.img.ubq/graphic').
2043
+ * @returns Array of matching block IDs.
2044
+ */
2045
+ findByType(type: string): DesignBlockId[];
2046
+ /**
2047
+ * Find blocks by their kind.
2048
+ * @param kind - The kind to search for (e.g., 'image', 'text', 'sticker').
2049
+ * @returns Array of matching block IDs.
2050
+ */
2051
+ findByKind(kind: string): DesignBlockId[];
2052
+ /**
2053
+ * Find all currently selected blocks.
2054
+ * @returns Array of selected block IDs.
2055
+ */
2056
+ findAllSelected(): DesignBlockId[];
2057
+ /**
2058
+ * Get the parent of a block.
2059
+ * @param block - The ID of the block.
2060
+ * @returns The ID of the parent block, or null if no parent.
2061
+ */
2062
+ getParent(block: DesignBlockId): DesignBlockId | null;
2063
+ /**
2064
+ * Check if a block has a parent.
2065
+ * @param block - The ID of the block.
2066
+ * @returns True if the block has a parent.
2067
+ */
2068
+ hasParent(block: DesignBlockId): boolean;
2069
+ /**
2070
+ * Get all children of a block.
2071
+ * @param block - The ID of the parent block.
2072
+ * @returns Array of child block IDs.
2073
+ */
2074
+ getChildren(block: DesignBlockId): DesignBlockId[];
2075
+ /**
2076
+ * Insert a child block at a specific index.
2077
+ * @param parent - The ID of the parent block.
2078
+ * @param child - The ID of the child block to insert.
2079
+ * @param index - The index at which to insert the child.
2080
+ */
2081
+ insertChild(parent: DesignBlockId, child: DesignBlockId, index: number): void;
2082
+ /**
2083
+ * Append a child block to the end of the parent's children.
2084
+ * @param parent - The ID of the parent block.
2085
+ * @param child - The ID of the child block to append.
2086
+ */
2087
+ appendChild(parent: DesignBlockId, child: DesignBlockId): void;
2088
+ /**
2089
+ * Get the type of a block.
2090
+ * @param block - The ID of the block.
2091
+ * @returns The block type string (e.g., '//ly.img.ubq/graphic').
2092
+ */
2093
+ getType(block: DesignBlockId): string;
2094
+ /**
2095
+ * Get the kind of a block.
2096
+ * @param block - The ID of the block.
2097
+ * @returns The block kind string (e.g., 'image', 'text', 'sticker').
2098
+ */
2099
+ getKind(block: DesignBlockId): string;
2100
+ /**
2101
+ * Set the kind of a block.
2102
+ * @param block - The ID of the block.
2103
+ * @param kind - The new kind value.
2104
+ */
2105
+ setKind(block: DesignBlockId, kind: string): void;
2106
+ /**
2107
+ * Get the name of a block.
2108
+ * @param block - The ID of the block.
2109
+ * @returns The block name.
2110
+ */
2111
+ getName(block: DesignBlockId): string;
2112
+ /**
2113
+ * Set the name of a block.
2114
+ * @param block - The ID of the block.
2115
+ * @param name - The new name.
2116
+ */
2117
+ setName(block: DesignBlockId, name: string): void;
2118
+ /**
2119
+ * Get the UUID of a block.
2120
+ * @param block - The ID of the block.
2121
+ * @returns The block's UUID string.
2122
+ */
2123
+ getUUID(block: DesignBlockId): string;
2124
+ getBool(block: DesignBlockId, property: string): boolean;
2125
+ setBool(block: DesignBlockId, property: string, value: boolean): void;
2126
+ getInt(block: DesignBlockId, property: string): number;
2127
+ setInt(block: DesignBlockId, property: string, value: number): void;
2128
+ getFloat(block: DesignBlockId, property: string): number;
2129
+ setFloat(block: DesignBlockId, property: string, value: number): void;
2130
+ getDouble(block: DesignBlockId, property: string): number;
2131
+ setDouble(block: DesignBlockId, property: string, value: number): void;
2132
+ getString(block: DesignBlockId, property: string): string;
2133
+ setString(block: DesignBlockId, property: string, value: string): void;
2134
+ getColor(block: DesignBlockId, property: string): Color;
2135
+ setColor(block: DesignBlockId, property: string, value: Color): void;
2136
+ getColorRGBA(block: DesignBlockId, property: string): RGBAColor;
2137
+ setColorRGBA(block: DesignBlockId, property: string, r: number, g: number, b: number, a: number): void;
2138
+ getEnum(block: DesignBlockId, property: string): string;
2139
+ setEnum(block: DesignBlockId, property: string, value: string): void;
2140
+ getPositionX(block: DesignBlockId): number;
2141
+ setPositionX(block: DesignBlockId, value: number): void;
2142
+ getPositionY(block: DesignBlockId): number;
2143
+ setPositionY(block: DesignBlockId, value: number): void;
2144
+ getPositionXMode(block: DesignBlockId): string;
2145
+ setPositionXMode(block: DesignBlockId, mode: string): void;
2146
+ getPositionYMode(block: DesignBlockId): string;
2147
+ setPositionYMode(block: DesignBlockId, mode: string): void;
2148
+ getWidth(block: DesignBlockId): number;
2149
+ setWidth(block: DesignBlockId, value: number): void;
2150
+ getWidthMode(block: DesignBlockId): string;
2151
+ setWidthMode(block: DesignBlockId, mode: string): void;
2152
+ getHeight(block: DesignBlockId): number;
2153
+ setHeight(block: DesignBlockId, value: number): void;
2154
+ getHeightMode(block: DesignBlockId): string;
2155
+ setHeightMode(block: DesignBlockId, mode: string): void;
2156
+ getRotation(block: DesignBlockId): number;
2157
+ setRotation(block: DesignBlockId, value: number): void;
2158
+ getFlipHorizontal(block: DesignBlockId): boolean;
2159
+ getFlipVertical(block: DesignBlockId): boolean;
2160
+ setFlipHorizontal(block: DesignBlockId, flip: boolean): void;
2161
+ setFlipVertical(block: DesignBlockId, flip: boolean): void;
2162
+ setPosition(block: DesignBlockId, x: number, y: number, options?: {
2163
+ positionMode?: string;
2164
+ }): void;
2165
+ setSize(block: DesignBlockId, width: number, height: number, options?: {
2166
+ maintainCrop?: boolean;
2167
+ sizeMode?: string;
2168
+ }): void;
2169
+ scale(block: DesignBlockId, scale: number, anchorX?: number, anchorY?: number): void;
2170
+ fillParent(block: DesignBlockId): void;
2171
+ resizeContentAware(blocks: DesignBlockId[], width: number, height: number): Promise<void>;
2172
+ getGlobalBoundingBoxX(block: DesignBlockId): number;
2173
+ getGlobalBoundingBoxY(block: DesignBlockId): number;
2174
+ getGlobalBoundingBoxWidth(block: DesignBlockId): number;
2175
+ getGlobalBoundingBoxHeight(block: DesignBlockId): number;
2176
+ getScreenSpaceBoundingBoxXYWH(blocks: DesignBlockId[]): XYWH;
2177
+ supportsFill(block: DesignBlockId): boolean;
2178
+ hasFill(block: DesignBlockId): boolean;
2179
+ hasFillColor(block: DesignBlockId): boolean;
2180
+ isFillColorEnabled(block: DesignBlockId): boolean;
2181
+ setFillColorEnabled(block: DesignBlockId, enabled: boolean): void;
2182
+ getFillColorRGBA(block: DesignBlockId): RGBAColor;
2183
+ setFillColorRGBA(block: DesignBlockId, r: number, g: number, b: number, a: number): void;
2184
+ getFill(block: DesignBlockId): DesignBlockId;
2185
+ setFill(block: DesignBlockId, fill: DesignBlockId): void;
2186
+ getFillEnabled(block: DesignBlockId): boolean;
2187
+ isFillEnabled(block: DesignBlockId): boolean;
2188
+ setFillEnabled(block: DesignBlockId, enabled: boolean): void;
2189
+ getFillSolidColor(block: DesignBlockId): RGBAColor;
2190
+ setFillSolidColor(block: DesignBlockId, r: number, g: number, b: number, a?: number): void;
2191
+ getGradientColorStops(block: DesignBlockId, property: string): GradientColorStop[];
2192
+ setGradientColorStops(block: DesignBlockId, property: string, stops: GradientColorStop[]): void;
2193
+ supportsStroke(block: DesignBlockId): boolean;
2194
+ hasStroke(block: DesignBlockId): boolean;
2195
+ getStroke(block: DesignBlockId): DesignBlockId;
2196
+ setStroke(block: DesignBlockId, stroke: DesignBlockId): void;
2197
+ getStrokeEnabled(block: DesignBlockId): boolean;
2198
+ isStrokeEnabled(block: DesignBlockId): boolean;
2199
+ setStrokeEnabled(block: DesignBlockId, enabled: boolean): void;
2200
+ getStrokeColor(block: DesignBlockId): Color;
2201
+ setStrokeColor(block: DesignBlockId, color: Color): void;
2202
+ getStrokeWidth(block: DesignBlockId): number;
2203
+ setStrokeWidth(block: DesignBlockId, width: number): void;
2204
+ getStrokeStyle(block: DesignBlockId): string;
2205
+ setStrokeStyle(block: DesignBlockId, style: string): void;
2206
+ getStrokePosition(block: DesignBlockId): string;
2207
+ setStrokePosition(block: DesignBlockId, position: string): void;
2208
+ getStrokeCornerGeometry(block: DesignBlockId): string;
2209
+ setStrokeCornerGeometry(block: DesignBlockId, geometry: string): void;
2210
+ getStrokeCap(block: DesignBlockId): StrokeCap;
2211
+ setStrokeCap(block: DesignBlockId, cap: StrokeCap): void;
2212
+ getStrokeStartCap(block: DesignBlockId): StrokeCap;
2213
+ setStrokeStartCap(block: DesignBlockId, cap: StrokeCap): void;
2214
+ getStrokeEndCap(block: DesignBlockId): StrokeCap;
2215
+ setStrokeEndCap(block: DesignBlockId, cap: StrokeCap): void;
2216
+ getStrokeDashStartCap(block: DesignBlockId): StrokeCap;
2217
+ setStrokeDashStartCap(block: DesignBlockId, cap: StrokeCap): void;
2218
+ getStrokeDashEndCap(block: DesignBlockId): StrokeCap;
2219
+ setStrokeDashEndCap(block: DesignBlockId, cap: StrokeCap): void;
2220
+ getStrokeDashArray(block: DesignBlockId): number[];
2221
+ setStrokeDashArray(block: DesignBlockId, dashArray: number[]): void;
2222
+ getStrokeDashOffset(block: DesignBlockId): number;
2223
+ setStrokeDashOffset(block: DesignBlockId, dashOffset: number): void;
2224
+ isLineOrigin(block: DesignBlockId): boolean;
2225
+ getStrokeColorRGBA(block: DesignBlockId): RGBAColor;
2226
+ setStrokeColorRGBA(block: DesignBlockId, r: number, g: number, b: number, a: number): void;
2227
+ supportsEffects(block: DesignBlockId): boolean;
2228
+ hasEffects(block: DesignBlockId): boolean;
2229
+ getEffects(block: DesignBlockId): DesignBlockId[];
2230
+ appendEffect(block: DesignBlockId, effect: DesignBlockId): void;
2231
+ insertEffect(block: DesignBlockId, effect: DesignBlockId, index: number): void;
2232
+ removeEffect(block: DesignBlockId, index: number): void;
2233
+ isEffectEnabled(effect: DesignBlockId): boolean;
2234
+ hasEffectEnabled(effect: DesignBlockId): boolean;
2235
+ setEffectEnabled(effect: DesignBlockId, enabled: boolean): void;
2236
+ supportsBlur(block: DesignBlockId): boolean;
2237
+ hasBlur(block: DesignBlockId): boolean;
2238
+ getBlur(block: DesignBlockId): DesignBlockId;
2239
+ setBlur(block: DesignBlockId, blur: DesignBlockId): void;
2240
+ getBlurEnabled(block: DesignBlockId): boolean;
2241
+ isBlurEnabled(block: DesignBlockId): boolean;
2242
+ setBlurEnabled(block: DesignBlockId, enabled: boolean): void;
2243
+ supportsShape(block: DesignBlockId): boolean;
2244
+ getShape(block: DesignBlockId): DesignBlockId;
2245
+ setShape(block: DesignBlockId, shape: DesignBlockId): void;
2246
+ hasShape(block: DesignBlockId): boolean;
2247
+ supportsAnimation(block: DesignBlockId): boolean;
2248
+ getInAnimation(block: DesignBlockId): DesignBlockId;
2249
+ setInAnimation(block: DesignBlockId, animation: DesignBlockId): void;
2250
+ getOutAnimation(block: DesignBlockId): DesignBlockId;
2251
+ setOutAnimation(block: DesignBlockId, animation: DesignBlockId): void;
2252
+ getLoopAnimation(block: DesignBlockId): DesignBlockId;
2253
+ setLoopAnimation(block: DesignBlockId, animation: DesignBlockId): void;
2254
+ supportsContentFillMode(block: DesignBlockId): boolean;
2255
+ hasContentFillMode(block: DesignBlockId): boolean;
2256
+ getContentFillMode(block: DesignBlockId): string;
2257
+ setContentFillMode(block: DesignBlockId, mode: string): void;
2258
+ setContentFillHorizontalAlignment(block: DesignBlockId, alignment: HorizontalContentFillAlignment): void;
2259
+ getContentFillHorizontalAlignment(block: DesignBlockId): HorizontalContentFillAlignment;
2260
+ setContentFillVerticalAlignment(block: DesignBlockId, alignment: VerticalContentFillAlignment): void;
2261
+ getContentFillVerticalAlignment(block: DesignBlockId): VerticalContentFillAlignment;
2262
+ supportsCrop(block: DesignBlockId): boolean;
2263
+ hasCrop(block: DesignBlockId): boolean;
2264
+ resetCrop(block: DesignBlockId): void;
2265
+ adjustCropToFillFrame(block: DesignBlockId, minScaleRatio?: number): void;
2266
+ getCropRotation(block: DesignBlockId): number;
2267
+ setCropRotation(block: DesignBlockId, rotation: number): void;
2268
+ getCropScaleX(block: DesignBlockId): number;
2269
+ setCropScaleX(block: DesignBlockId, scale: number): void;
2270
+ getCropScaleY(block: DesignBlockId): number;
2271
+ setCropScaleY(block: DesignBlockId, scale: number): void;
2272
+ getCropScaleRatio(block: DesignBlockId): number;
2273
+ setCropScaleRatio(block: DesignBlockId, ratio: number): void;
2274
+ getCropTranslationX(block: DesignBlockId): number;
2275
+ setCropTranslationX(block: DesignBlockId, translation: number): void;
2276
+ getCropTranslationY(block: DesignBlockId): number;
2277
+ setCropTranslationY(block: DesignBlockId, translation: number): void;
2278
+ isCropAspectRatioLocked(block: DesignBlockId): boolean;
2279
+ setCropAspectRatioLocked(block: DesignBlockId, locked: boolean): void;
2280
+ flipCropHorizontal(block: DesignBlockId): void;
2281
+ flipCropVertical(block: DesignBlockId): void;
2282
+ supportsDropShadow(block: DesignBlockId): boolean;
2283
+ hasDropShadow(block: DesignBlockId): boolean;
2284
+ isDropShadowEnabled(block: DesignBlockId): boolean;
2285
+ setDropShadowEnabled(block: DesignBlockId, enabled: boolean): void;
2286
+ getDropShadowColor(block: DesignBlockId): Color;
2287
+ setDropShadowColor(block: DesignBlockId, color: Color): void;
2288
+ getDropShadowColorRGBA(block: DesignBlockId): RGBAColor;
2289
+ setDropShadowColorRGBA(block: DesignBlockId, r: number, g: number, b: number, a: number): void;
2290
+ getDropShadowOffsetX(block: DesignBlockId): number;
2291
+ setDropShadowOffsetX(block: DesignBlockId, offset: number): void;
2292
+ getDropShadowOffsetY(block: DesignBlockId): number;
2293
+ setDropShadowOffsetY(block: DesignBlockId, offset: number): void;
2294
+ getDropShadowBlurRadiusX(block: DesignBlockId): number;
2295
+ setDropShadowBlurRadiusX(block: DesignBlockId, radius: number): void;
2296
+ getDropShadowBlurRadiusY(block: DesignBlockId): number;
2297
+ setDropShadowBlurRadiusY(block: DesignBlockId, radius: number): void;
2298
+ getDropShadowClip(block: DesignBlockId): boolean;
2299
+ setDropShadowClip(block: DesignBlockId, clip: boolean): void;
2300
+ supportsBlendMode(block: DesignBlockId): boolean;
2301
+ getBlendMode(block: DesignBlockId): string;
2302
+ setBlendMode(block: DesignBlockId, mode: string): void;
2303
+ hasBlendMode(block: DesignBlockId): boolean;
2304
+ supportsOpacity(block: DesignBlockId): boolean;
2305
+ hasOpacity(block: DesignBlockId): boolean;
2306
+ getOpacity(block: DesignBlockId): number;
2307
+ setOpacity(block: DesignBlockId, opacity: number): void;
2308
+ getVisible(block: DesignBlockId): boolean;
2309
+ isVisible(block: DesignBlockId): boolean;
2310
+ setVisible(block: DesignBlockId, visible: boolean): void;
2311
+ getClipped(block: DesignBlockId): boolean;
2312
+ isClipped(block: DesignBlockId): boolean;
2313
+ setClipped(block: DesignBlockId, clipped: boolean): void;
2314
+ setSelected(block: DesignBlockId, selected: boolean): void;
2315
+ isSelected(block: DesignBlockId): boolean;
2316
+ select(block: DesignBlockId): void;
2317
+ bringToFront(block: DesignBlockId): void;
2318
+ sendToBack(block: DesignBlockId): void;
2319
+ bringForward(block: DesignBlockId): void;
2320
+ sendBackward(block: DesignBlockId): void;
2321
+ setAlwaysOnTop(block: DesignBlockId, enabled: boolean): void;
2322
+ setAlwaysOnBottom(block: DesignBlockId, enabled: boolean): void;
2323
+ isAlwaysOnTop(block: DesignBlockId): boolean;
2324
+ isAlwaysOnBottom(block: DesignBlockId): boolean;
2325
+ alignHorizontally(blocks: DesignBlockId[], alignment: string): void;
2326
+ alignVertically(blocks: DesignBlockId[], alignment: string): void;
2327
+ isAlignable(blocks: DesignBlockId[]): boolean;
2328
+ distributeHorizontally(blocks: DesignBlockId[]): void;
2329
+ distributeVertically(blocks: DesignBlockId[]): void;
2330
+ isDistributable(blocks: DesignBlockId[]): boolean;
2331
+ group(blocks: DesignBlockId[]): DesignBlockId;
2332
+ ungroup(group: DesignBlockId): void;
2333
+ isGroupable(blocks: DesignBlockId[]): boolean;
2334
+ enterGroup(group: DesignBlockId): void;
2335
+ exitGroup(block: DesignBlockId): void;
2336
+ combine(blocks: DesignBlockId[], operation: string): DesignBlockId;
2337
+ isCombinable(blocks: DesignBlockId[]): boolean;
2338
+ supportsDuration(block: DesignBlockId): boolean;
2339
+ hasDuration(block: DesignBlockId): boolean;
2340
+ getDuration(block: DesignBlockId): number;
2341
+ setDuration(block: DesignBlockId, duration: number): void;
2342
+ supportsTimeOffset(block: DesignBlockId): boolean;
2343
+ hasTimeOffset(block: DesignBlockId): boolean;
2344
+ getTimeOffset(block: DesignBlockId): number;
2345
+ setTimeOffset(block: DesignBlockId, offset: number): void;
2346
+ supportsTrim(block: DesignBlockId): boolean;
2347
+ hasTrim(block: DesignBlockId): boolean;
2348
+ getTrimOffset(block: DesignBlockId): number;
2349
+ setTrimOffset(block: DesignBlockId, offset: number): void;
2350
+ getTrimLength(block: DesignBlockId): number;
2351
+ setTrimLength(block: DesignBlockId, length: number): void;
2352
+ supportsPlaybackControl(block: DesignBlockId): boolean;
2353
+ hasPlaybackControl(block: DesignBlockId): boolean;
2354
+ supportsPlaybackTime(block: DesignBlockId): boolean;
2355
+ hasPlaybackTime(block: DesignBlockId): boolean;
2356
+ getPlaybackTime(block: DesignBlockId): number;
2357
+ setPlaybackTime(block: DesignBlockId, time: number): void;
2358
+ isPlaying(block: DesignBlockId): boolean;
2359
+ setPlaying(block: DesignBlockId, playing: boolean): void;
2360
+ isLooping(block: DesignBlockId): boolean;
2361
+ setLooping(block: DesignBlockId, looping: boolean): void;
2362
+ getPlaybackSpeed(block: DesignBlockId): number;
2363
+ setPlaybackSpeed(block: DesignBlockId, speed: number): void;
2364
+ isMuted(block: DesignBlockId): boolean;
2365
+ setMuted(block: DesignBlockId, muted: boolean): void;
2366
+ getVolume(block: DesignBlockId): number;
2367
+ setVolume(block: DesignBlockId, volume: number): void;
2368
+ isSoloPlaybackEnabled(block: DesignBlockId): boolean;
2369
+ setSoloPlaybackEnabled(block: DesignBlockId, enabled: boolean): void;
2370
+ isForceMuted(block: DesignBlockId): boolean;
2371
+ getTotalSceneDuration(scene: DesignBlockId): number;
2372
+ isVisibleAtCurrentPlaybackTime(block: DesignBlockId): boolean;
2373
+ isTransformLocked(block: DesignBlockId): boolean;
2374
+ setTransformLocked(block: DesignBlockId, locked: boolean): void;
2375
+ isIncludedInExport(block: DesignBlockId): boolean;
2376
+ setIncludedInExport(block: DesignBlockId, included: boolean): void;
2377
+ isPlaceholderEnabled(block: DesignBlockId): boolean;
2378
+ setPlaceholderEnabled(block: DesignBlockId, enabled: boolean): void;
2379
+ supportsPlaceholderBehavior(block: DesignBlockId): boolean;
2380
+ hasPlaceholderBehavior(block: DesignBlockId): boolean;
2381
+ isPlaceholderBehaviorEnabled(block: DesignBlockId): boolean;
2382
+ setPlaceholderBehaviorEnabled(block: DesignBlockId, enabled: boolean): void;
2383
+ supportsPlaceholderControls(block: DesignBlockId): boolean;
2384
+ hasPlaceholderControls(block: DesignBlockId): boolean;
2385
+ isPlaceholderControlsOverlayEnabled(block: DesignBlockId): boolean;
2386
+ setPlaceholderControlsOverlayEnabled(block: DesignBlockId, enabled: boolean): void;
2387
+ isPlaceholderControlsButtonEnabled(block: DesignBlockId): boolean;
2388
+ setPlaceholderControlsButtonEnabled(block: DesignBlockId, enabled: boolean): void;
2389
+ supportsBackgroundColor(block: DesignBlockId): boolean;
2390
+ hasBackgroundColor(block: DesignBlockId): boolean;
2391
+ isBackgroundColorEnabled(block: DesignBlockId): boolean;
2392
+ setBackgroundColorEnabled(block: DesignBlockId, enabled: boolean): void;
2393
+ getBackgroundColorRGBA(block: DesignBlockId): RGBAColor;
2394
+ setBackgroundColorRGBA(block: DesignBlockId, r: number, g: number, b: number, a: number): void;
2395
+ hasMetadata(block: DesignBlockId, key: string): boolean;
2396
+ getMetadata(block: DesignBlockId, key: string): string;
2397
+ setMetadata(block: DesignBlockId, key: string, value: string): void;
2398
+ removeMetadata(block: DesignBlockId, key: string): void;
2399
+ findAllMetadata(block: DesignBlockId): string[];
2400
+ replaceText(block: DesignBlockId, text: string, from?: number, to?: number): void;
2401
+ removeText(block: DesignBlockId, from?: number, to?: number): void;
2402
+ getTextFontSizes(block: DesignBlockId, options?: TextFontSizeOptions): number[];
2403
+ /** @deprecated Use the options-object overload. */
2404
+ getTextFontSizes(block: DesignBlockId, from?: number, to?: number): number[];
2405
+ setTextFontSize(block: DesignBlockId, size: number, from?: number, to?: number): void;
2406
+ setTextFontSize(block: DesignBlockId, size: number, options: TextFontSizeOptions): void;
2407
+ getTextFontStyles(block: DesignBlockId, from?: number, to?: number): string[];
2408
+ setTextFontStyle(block: DesignBlockId, style: string, from?: number, to?: number): void;
2409
+ getTextFontWeights(block: DesignBlockId, from?: number, to?: number): string[];
2410
+ setTextFontWeight(block: DesignBlockId, weight: string, from?: number, to?: number): void;
2411
+ getTextColors(block: DesignBlockId, from?: number, to?: number): Color[];
2412
+ setTextColor(block: DesignBlockId, color: Color, from?: number, to?: number): void;
2413
+ getTextCases(block: DesignBlockId, from?: number, to?: number): string[];
2414
+ setTextCase(block: DesignBlockId, textCase: string, from?: number, to?: number): void;
2415
+ getTypefaces(block: DesignBlockId, from?: number, to?: number): Typeface[];
2416
+ setTypeface(block: DesignBlockId, typeface: Typeface, from?: number, to?: number): void;
2417
+ getTypeface(block: DesignBlockId): Typeface;
2418
+ /**
2419
+ * Set extra character-level kerning offset for a grapheme range. The
2420
+ * value is in em units (1.0 = one full em); 0.0 resets to no extra
2421
+ * offset. Matches the node wasm binding's `BlockAPI.setTextKerning`.
2422
+ */
2423
+ setTextKerning(block: DesignBlockId, kerning: number, from?: number, to?: number): void;
2424
+ /**
2425
+ * Return the unique kerning values seen across the grapheme range.
2426
+ * Mirrors `getTextFontSizes` / `getTextFontStyles` — `[0]` for a clean
2427
+ * block, `[v1, v2, …]` when the range spans multiple distinct values.
2428
+ */
2429
+ getTextKernings(block: DesignBlockId, from?: number, to?: number): number[];
2430
+ setFont(block: DesignBlockId, fontUri: string, typeface: Typeface): void;
2431
+ canToggleBoldFont(block: DesignBlockId): boolean;
2432
+ toggleBoldFont(block: DesignBlockId): void;
2433
+ canToggleItalicFont(block: DesignBlockId): boolean;
2434
+ toggleItalicFont(block: DesignBlockId): void;
2435
+ /**
2436
+ * Returns the current text cursor range as UTF-16 indices. When no block
2437
+ * is currently being edited, returns `{ from: -1, to: -1 }`.
2438
+ */
2439
+ getTextCursorRange(): Range;
2440
+ /**
2441
+ * Sets the text cursor range. `from`/`to` are UTF-16 indices. Negative
2442
+ * values mean "from start" / "to end" (so `{ from: -1, to: -1 }` selects
2443
+ * the entire text).
2444
+ */
2445
+ setTextCursorRange(range: Range): void;
2446
+ getTextCursorPositionInScreenSpaceX(block: DesignBlockId): number;
2447
+ getTextCursorPositionInScreenSpaceY(block: DesignBlockId): number;
2448
+ getTextVisibleLineCount(block: DesignBlockId): number;
2449
+ getTextVisibleLineContent(block: DesignBlockId, lineIndex: number): string;
2450
+ getTextVisibleLineGlobalBoundingBoxXYWH(block: DesignBlockId, lineIndex: number): XYWH;
2451
+ /**
2452
+ * Returns the tight ink-paint bounding box for each grapheme in the
2453
+ * range. One entry per grapheme in [from, to). Non-printable graphemes
2454
+ * (e.g. newline) get a zero-rect entry. Coordinates are in global
2455
+ * scene space.
2456
+ *
2457
+ * @param block - The text block to query.
2458
+ * @param from - Start UTF-16 index (-1 = start of cursor selection or 0).
2459
+ * @param to - End UTF-16 index (-1 = end of cursor selection or text length).
2460
+ */
2461
+ getTextCharacterInkBoxes(block: DesignBlockId, from?: number, to?: number): CharacterInkBox[];
2462
+ getTextEffectiveHorizontalAlignment(block: DesignBlockId): string;
2463
+ /**
2464
+ * Returns the horizontal alignment override for a specific paragraph, or
2465
+ * the block-level alignment for negative paragraph indices. Returns
2466
+ * `undefined` when no override is set for the given paragraph.
2467
+ * @param block - The text block to query.
2468
+ * @param paragraphIndex - 0-based paragraph index. Negative values return
2469
+ * the block-level `text/horizontalAlignment` setting.
2470
+ */
2471
+ getTextHorizontalAlignment(block: DesignBlockId, paragraphIndex?: number): string | undefined;
2472
+ /**
2473
+ * Sets the horizontal alignment override for a specific paragraph of a text
2474
+ * block. Pass `undefined` for `alignment` to clear the paragraph-level
2475
+ * override. Negative `paragraphIndex` clears all paragraph overrides and
2476
+ * applies the alignment block-wide.
2477
+ */
2478
+ setTextHorizontalAlignment(block: DesignBlockId, alignment: string | undefined, paragraphIndex?: number): void;
2479
+ /**
2480
+ * Returns the ordered list of unique text-decoration configurations within
2481
+ * the given grapheme range. `from` / `to` are UTF-16 indices and are
2482
+ * converted to grapheme indices to match WASM semantics.
2483
+ */
2484
+ getTextDecorations(block: DesignBlockId, from?: number, to?: number): TextDecorationConfig[];
2485
+ /**
2486
+ * Sets the given text-decoration config for the given grapheme range. Set
2487
+ * `lines: ['None']` to clear all decorations.
2488
+ */
2489
+ setTextDecoration(block: DesignBlockId, config: TextDecorationConfig, from?: number, to?: number): void;
2490
+ toggleTextDecorationUnderline(block: DesignBlockId, from?: number, to?: number): void;
2491
+ toggleTextDecorationStrikethrough(block: DesignBlockId, from?: number, to?: number): void;
2492
+ toggleTextDecorationOverline(block: DesignBlockId, from?: number, to?: number): void;
2493
+ getTextListStyle(block: DesignBlockId, paragraphIndex: number): "None" | "Unordered" | "Ordered";
2494
+ setTextListStyle(block: DesignBlockId, listStyle: "None" | "Unordered" | "Ordered", paragraphIndex?: number, listLevel?: number): void;
2495
+ getTextListLevel(block: DesignBlockId, paragraphIndex: number): number;
2496
+ setTextListLevel(block: DesignBlockId, listLevel: number, paragraphIndex?: number): void;
2497
+ /**
2498
+ * Returns the 0-based paragraph indices that overlap the given UTF-16 range.
2499
+ * Range is half-open: `from` inclusive, `to` exclusive. Negative values mean
2500
+ * "all paragraphs". When `from === to`, returns the paragraph containing the
2501
+ * cursor at `from`.
2502
+ */
2503
+ getTextParagraphIndices(block: DesignBlockId, from?: number, to?: number): number[];
2504
+ getTextLineHeight(block: DesignBlockId, paragraphIndex: number): number;
2505
+ setTextLineHeight(block: DesignBlockId, lineHeight: number | null, paragraphIndex?: number): void;
2506
+ getFontMetrics(fontFileUri: string): Promise<FontMetrics>;
2507
+ getSourceSet(block: DesignBlockId, property: string): Source[];
2508
+ setSourceSet(block: DesignBlockId, property: string, sources: Source[]): void;
2509
+ addImageFileURIToSourceSet(block: DesignBlockId, property: string, uri: string): Promise<void>;
2510
+ addVideoFileURIToSourceSet(block: DesignBlockId, property: string, uri: string): Promise<void>;
2511
+ getVideoWidth(block: DesignBlockId): number;
2512
+ getVideoHeight(block: DesignBlockId): number;
2513
+ getAudioTrackCountFromVideo(block: DesignBlockId): number;
2514
+ getAVResourceTotalDuration(block: DesignBlockId): number;
2515
+ /**
2516
+ * Splits the block at the given time. The original block keeps the
2517
+ * leading portion; the trailing portion is returned as a newly
2518
+ * created block id (matches `@cesdk/node`'s return contract).
2519
+ *
2520
+ * @remarks Matches `@cesdk/node`'s `SplitOptions` shape:
2521
+ * `attachToParent` and `selectNewBlock` default to `true`,
2522
+ * `createParentTrackIfNeeded` defaults to `false`. Non-default values
2523
+ * are accepted for shape parity but not yet plumbed to the C++ binding
2524
+ * — when set, a warning is emitted so callers can detect the gap.
2525
+ *
2526
+ * @param block - The block to split.
2527
+ * @param atTime - The time (seconds) at which to split.
2528
+ * @param options - Split-behavior overrides.
2529
+ * @returns The id of the newly created trailing block.
2530
+ * @public
2531
+ */
2532
+ split(block: DesignBlockId, atTime: number, options?: SplitOptions): DesignBlockId;
2533
+ getFrameX(block: DesignBlockId): number;
2534
+ getFrameY(block: DesignBlockId): number;
2535
+ getFrameWidth(block: DesignBlockId): number;
2536
+ getFrameHeight(block: DesignBlockId): number;
2537
+ supportsPageDurationSource(page: DesignBlockId, block: DesignBlockId): boolean;
2538
+ setPageDurationSource(page: DesignBlockId, block: DesignBlockId): void;
2539
+ removePageDurationSource(page: DesignBlockId): void;
2540
+ isPageDurationSource(block: DesignBlockId): boolean;
2541
+ isScopeEnabled(block: DesignBlockId, scope: string): boolean;
2542
+ setScopeEnabled(block: DesignBlockId, scope: string, enabled: boolean): void;
2543
+ isAllowedByScope(block: DesignBlockId, scope: string): boolean;
2544
+ findAllProperties(block: DesignBlockId): string[];
2545
+ getPropertyType(blockOrProperty: DesignBlockId | string, property?: string): string;
2546
+ isPropertyReadable(blockOrProperty: DesignBlockId | string, property?: string): boolean;
2547
+ isPropertyWritable(blockOrProperty: DesignBlockId | string, property?: string): boolean;
2548
+ getEnumValues(blockOrProperty: DesignBlockId | string, property?: string): string[];
2549
+ getState(block: DesignBlockId): string;
2550
+ export(block: DesignBlockId, options?: ExportOptions): Promise<Blob>;
2551
+ export(block: DesignBlockId, mimeType: string, options?: ExportOptions): Promise<Blob>;
2552
+ exportToBuffer(block: DesignBlockId, mimeType: string, options?: ExportOptions): Promise<Uint8Array>;
2553
+ /**
2554
+ * Exports a design block and a color mask to two separate buffers.
2555
+ *
2556
+ * Removes all pixels that exactly match the given RGB color and replaces them with transparency.
2557
+ * The output includes two buffers: the masked image and the mask itself.
2558
+ *
2559
+ * @param block - The design block element to export.
2560
+ * @param maskColorR - The red component of the special color mask color (0-1).
2561
+ * @param maskColorG - The green component of the special color mask color (0-1).
2562
+ * @param maskColorB - The blue component of the special color mask color (0-1).
2563
+ * @param options - The options for exporting the block type.
2564
+ * @returns A promise that resolves with an array of two Uint8Arrays: [image, mask].
2565
+ */
2566
+ exportWithColorMask(block: DesignBlockId, maskColorR: number, maskColorG: number, maskColorB: number, options?: ExportOptions): Promise<Blob[]>;
2567
+ exportWithColorMask(block: DesignBlockId, mimeType: string | undefined, maskColorR: number, maskColorG: number, maskColorB: number, options?: ExportOptions): Promise<Blob[]>;
2568
+ exportVideo(block: DesignBlockId, options?: VideoExportOptions & {
2569
+ mimeType?: string;
2570
+ onProgress?: (rendered: number, encoded: number, total: number) => void;
2571
+ }): Promise<Blob>;
2572
+ exportVideo(block: DesignBlockId, mimeType: string, progressCallback?: (rendered: number, encoded: number, total: number) => void, options?: VideoExportOptions): Promise<Blob>;
2573
+ exportVideoToBuffer(block: DesignBlockId, mimeType: string, options?: VideoExportOptions, progressCallback?: (rendered: number, encoded: number, total: number) => void): Promise<Uint8Array>;
2574
+ /**
2575
+ * Export an audio block to a buffer.
2576
+ *
2577
+ * Two call shapes are accepted:
2578
+ * - WASM-style (preferred): `exportAudio(block, options?)` where `options.mimeType`
2579
+ * defaults to `'audio/wav'`.
2580
+ * - Native-only positional: `exportAudio(block, mimeType, options?)`.
2581
+ *
2582
+ * The two forms produce identical bytes; the WASM-style form keeps source
2583
+ * code portable between `@cesdk/node` (WASM) and `@cesdk/node-native`.
2584
+ */
2585
+ exportAudio(block: DesignBlockId, options?: AudioExportOptions): Promise<Blob>;
2586
+ exportAudio(block: DesignBlockId, mimeType: string, options?: AudioExportOptions): Promise<Blob>;
2587
+ exportAudioToBuffer(block: DesignBlockId, mimeType: string, options?: AudioExportOptions): Promise<Uint8Array>;
2588
+ loadFromString(content: string): Promise<DesignBlockId[]>;
2589
+ loadFromURL(url: string): Promise<DesignBlockId[]>;
2590
+ /**
2591
+ * Load blocks from an archive URL.
2592
+ * Also supports data URIs (data:application/zip;base64,...) which are converted to buffer:// protocol internally.
2593
+ * @param url - The URL of the archive file, or a data URI containing base64-encoded archive data.
2594
+ * @returns A promise that resolves with an array of block IDs.
2595
+ */
2596
+ loadFromArchiveURL(url: string): Promise<DesignBlockId[]>;
2597
+ saveToString(blocks: DesignBlockId[]): Promise<string>;
2598
+ saveToArchive(blocks: DesignBlockId[]): Promise<Blob>;
2599
+ /**
2600
+ * Force-load the audio/video resource for an audio block or video-fill block.
2601
+ * Resolves once the asset is fully fetched and demuxed (so subsequent
2602
+ * `exportVideo` calls have data immediately available on frame 0). Without
2603
+ * this prime, the encoder can race ahead of the HTTP fetch and produce
2604
+ * silent audio / black-frame video segments.
2605
+ */
2606
+ forceLoadAVResource(block: DesignBlockId): Promise<void>;
2607
+ /**
2608
+ * Force-load every resource referenced by `blocks`. Useful before
2609
+ * `exportVideo` on a scene with multiple remote assets — saves N network
2610
+ * round-trips compared to calling `forceLoadAVResource` per block.
2611
+ */
2612
+ forceLoadResources(blocks: DesignBlockId[]): Promise<void>;
2613
+ /**
2614
+ * Apply an animation set (in/loop/out) to a block. Mirrors
2615
+ * `@cesdk/node`'s `BlockAPI.applyAnimation` exactly.
2616
+ *
2617
+ * @public
2618
+ */
2619
+ applyAnimation(block: DesignBlockId, animation?: AnimationOptions): void;
2620
+ /**
2621
+ * Apply a drop shadow effect to a block. Mirrors `@cesdk/node`'s
2622
+ * `BlockAPI.applyDropShadow` exactly.
2623
+ *
2624
+ * @public
2625
+ */
2626
+ applyDropShadow(block: DesignBlockId, options?: DropShadowOptions): void;
2627
+ /**
2628
+ * Add an image to the current page as a graphic block with an image fill.
2629
+ * Mirrors `@cesdk/node`'s `BlockAPI.addImage` shape — same options bag,
2630
+ * same chained-call sequence.
2631
+ *
2632
+ * @remarks Unlike WASM (which uses `new Image()` to auto-detect size when
2633
+ * `options.size` is omitted), Node has no DOM `Image` global. In Node,
2634
+ * `options.size` must be supplied; calling without it throws a clear
2635
+ * error with the suggested fix.
2636
+ *
2637
+ * @public
2638
+ */
2639
+ addImage(url: string, options?: AddImageOptions): DesignBlockId;
2640
+ /**
2641
+ * Add a video to the current page as a graphic block with a video fill.
2642
+ * Mirrors `@cesdk/node`'s `BlockAPI.addVideo` shape.
2643
+ *
2644
+ * @remarks Like `addImage`, requires explicit `options.size` in Node.
2645
+ *
2646
+ * @public
2647
+ */
2648
+ addVideo(url: string, options?: AddVideoOptions): DesignBlockId;
2649
+ /**
2650
+ * Subscribe to state changes on a set of blocks. Matches WASM's
2651
+ * `engine.block.onStateChanged(ids, callback)` contract — pass an empty
2652
+ * array to monitor every block in the scene. The native C++ side
2653
+ * already implements this via `subscribeToBlockState`; this wrapper
2654
+ * exposes it on `engine.block` so portable consumers (e.g.
2655
+ * `@imgly/psd-importer`'s transient-relocation tests) can subscribe the
2656
+ * same way on both bindings.
2657
+ *
2658
+ * @returns A function to unsubscribe.
2659
+ */
2660
+ onStateChanged(ids: DesignBlockId[], callback: (ids: DesignBlockId[]) => void): () => void;
2661
+ /**
2662
+ * Subscribe to selection changes. Matches WASM's
2663
+ * `engine.block.onSelectionChanged(callback)` contract — fires when the
2664
+ * set of selected blocks changes. The native C++ side already implements
2665
+ * this via `subscribeToSelectionChange`; this wrapper exposes it so
2666
+ * portable consumers (selection-reactive UI) work on both bindings.
2667
+ *
2668
+ * @returns A function to unsubscribe.
2669
+ */
2670
+ onSelectionChanged(callback: () => void): () => void;
2671
+ /**
2672
+ * Subscribe to block clicks. Matches WASM's
2673
+ * `engine.block.onClicked((id) => …)` contract. In a headless Node
2674
+ * context the engine never fires this event (no UI input), but the
2675
+ * subscription surface exists for API parity so the same code compiles
2676
+ * and runs against both bindings.
2677
+ *
2678
+ * @returns A function to unsubscribe.
2679
+ */
2680
+ onClicked(callback: (id: DesignBlockId) => void): () => void;
2681
+ }
2682
+ /**
2683
+ * SceneAPI provides methods for managing scenes and pages
2684
+ */
2685
+ export declare class SceneAPI implements ISceneAPI {
2686
+ #private;
2687
+ constructor(engine: NativeEngine);
2688
+ /**
2689
+ * Create a new design scene, along with its own camera.
2690
+ * @param sceneLayout - The layout of the scene.
2691
+ * @returns The scene's handle.
2692
+ */
2693
+ create(sceneLayout?: SceneLayout, options?: CreateSceneOptions): DesignBlockId;
2694
+ /**
2695
+ * Create a new scene in video mode, along with its own camera.
2696
+ * @returns The scene's handle.
2697
+ */
2698
+ createVideo(options?: CreateSceneOptions): DesignBlockId;
2699
+ /**
2700
+ * Return the currently active scene.
2701
+ * @returns The scene or null, if none was created yet.
2702
+ */
2703
+ get(): DesignBlockId | null;
2704
+ /**
2705
+ * Load the contents of a scene file.
2706
+ * @param sceneContent - The scene file contents, a base64 string.
2707
+ * @param overrideEditorConfig - Whether to override editor configuration.
2708
+ * @param waitForResources - Whether to wait for all resources to finish loading.
2709
+ * @returns A handle to the loaded scene.
2710
+ */
2711
+ loadFromString(sceneContent: string, overrideEditorConfig?: boolean, waitForResources?: boolean): Promise<DesignBlockId>;
2712
+ /**
2713
+ * Load a scene from the URL to the scene file.
2714
+ * @param url - The URL of the scene file.
2715
+ * @param overrideEditorConfig - Whether to override editor configuration.
2716
+ * @param waitForResources - Whether to wait for all resources to finish loading.
2717
+ * @returns A promise that resolves with the scene ID.
2718
+ */
2719
+ loadFromURL(url: string, overrideEditorConfig?: boolean, waitForResources?: boolean): Promise<DesignBlockId>;
2720
+ /**
2721
+ * Load a previously archived scene from the URL to the scene file.
2722
+ * Also supports data URIs (data:application/zip;base64,...) which are converted to buffer:// protocol internally.
2723
+ * @param url - The URL of the scene archive file, or a data URI containing base64-encoded archive data.
2724
+ * @param overrideEditorConfig - Whether to override editor configuration.
2725
+ * @param waitForResources - Whether to wait for all resources to finish loading.
2726
+ * @returns A promise that resolves with the scene ID.
2727
+ */
2728
+ loadFromArchiveURL(url: string, overrideEditorConfig?: boolean, waitForResources?: boolean): Promise<DesignBlockId>;
2729
+ /**
2730
+ * Serializes the current scene into a string.
2731
+ *
2732
+ * Optionally accepts a `compression` option to apply Zstd compression to
2733
+ * the output. When compression is enabled the returned string contains
2734
+ * raw compressed bytes (not base64) — pass it back to `loadFromString`
2735
+ * to round-trip.
2736
+ *
2737
+ * @returns A promise that resolves with the serialized scene.
2738
+ */
2739
+ saveToString(options?: {
2740
+ compression?: {
2741
+ format?: CompressionFormat;
2742
+ level?: CompressionLevel;
2743
+ };
2744
+ }): Promise<string>;
2745
+ /**
2746
+ * Saves the current scene and all of its referenced assets into an archive.
2747
+ * @returns A promise that resolves with a Uint8Array.
2748
+ */
2749
+ saveToArchive(): Promise<Blob>;
2750
+ /**
2751
+ * Loads the given image and creates a scene with a single page showing the image.
2752
+ * @param url - The image URL.
2753
+ * @param dpi - The scene's DPI.
2754
+ * @param pixelScaleFactor - The display's pixel scale factor.
2755
+ * @returns A promise that resolves with the scene ID.
2756
+ */
2757
+ /**
2758
+ * Loads the given image and creates a scene with a single page showing the image.
2759
+ *
2760
+ * @remarks The 4th/5th/6th args (`sceneLayout`, `spacing`,
2761
+ * `spacingInScreenSpace`) are part of `@cesdk/node`'s signature and
2762
+ * accepted here for shape parity. The C++ binding currently hardcodes
2763
+ * `Free`/`0.f`/`false`; non-default values are not yet plumbed
2764
+ * through. A warning is emitted when a caller passes a non-default
2765
+ * value so the discrepancy is visible.
2766
+ *
2767
+ * @public
2768
+ */
2769
+ createFromImage(url: string, dpi?: number, pixelScaleFactor?: number, sceneLayout?: SceneLayout, spacing?: number, spacingInScreenSpace?: boolean): Promise<DesignBlockId>;
2770
+ /**
2771
+ * Loads the given video and creates a scene with a single page showing the video.
2772
+ * @param url - The video URL.
2773
+ * @returns A promise that resolves with the scene ID.
2774
+ */
2775
+ createFromVideo(url: string): Promise<DesignBlockId>;
2776
+ /**
2777
+ * Applies the contents of the given template scene to the currently loaded scene.
2778
+ * @param content - The template scene file contents, a base64 string.
2779
+ * @returns A Promise that resolves once the template was applied.
2780
+ */
2781
+ applyTemplateFromString(content: string): Promise<void>;
2782
+ /**
2783
+ * Applies the contents of the given template scene to the currently loaded scene.
2784
+ * @param url - The url to the template scene file.
2785
+ * @returns A Promise that resolves once the template was applied.
2786
+ */
2787
+ applyTemplateFromURL(url: string): Promise<void>;
2788
+ /**
2789
+ * Get the current scene mode.
2790
+ * @deprecated Scene mode no longer affects engine behavior. All features work regardless of mode.
2791
+ * @returns The current mode of the scene, or null if no mode has been set.
2792
+ */
2793
+ getMode(): string | null;
2794
+ /**
2795
+ * Set the mode of the current scene.
2796
+ * @param mode - The new mode for the scene ('Design' or 'Video').
2797
+ */
2798
+ setMode(mode: "Design" | "Video"): void;
2799
+ /**
2800
+ * Converts all values of the current scene into the given design unit.
2801
+ * @param designUnit - The new design unit of the scene.
2802
+ */
2803
+ setDesignUnit(designUnit: string): void;
2804
+ /**
2805
+ * Returns the design unit of the current scene.
2806
+ * @returns The current design unit.
2807
+ */
2808
+ getDesignUnit(): string;
2809
+ /**
2810
+ * Sets the unit ('Pixel' | 'Point') in which the current scene's font sizes
2811
+ * are interpreted at the API boundary (setTextFontSize / getTextFontSizes).
2812
+ * The engine stores font sizes in points internally.
2813
+ * @param unit - The new font-size unit.
2814
+ */
2815
+ setFontSizeUnit(unit: string): void;
2816
+ /**
2817
+ * Returns the font-size unit of the current scene ('Pixel' | 'Point').
2818
+ * @returns The current font-size unit.
2819
+ */
2820
+ getFontSizeUnit(): string;
2821
+ /** Start or stop playback of the current page. */
2822
+ setPlaying(play: boolean): void;
2823
+ /**
2824
+ * Get the layout of the current scene.
2825
+ * @returns The current layout of the scene.
2826
+ */
2827
+ getLayout(): SceneLayout;
2828
+ /**
2829
+ * Set the layout of the current scene.
2830
+ * @param layout - The new layout for the scene.
2831
+ */
2832
+ setLayout(layout: SceneLayout): void;
2833
+ /**
2834
+ * Get the sorted list of pages in the scene.
2835
+ * @returns The sorted list of pages in the scene.
2836
+ */
2837
+ getPages(): DesignBlockId[];
2838
+ /**
2839
+ * Add a new page to the scene.
2840
+ * @param scene - Optional scene ID. If not provided, uses the current scene.
2841
+ * @returns The ID of the newly created page.
2842
+ */
2843
+ addPage(scene?: DesignBlockId): DesignBlockId;
2844
+ /**
2845
+ * Get the current page.
2846
+ * @returns The current page in the scene or null when there is no scene
2847
+ * available or no current page is set.
2848
+ */
2849
+ getCurrentPage(scene?: DesignBlockId): DesignBlockId | null;
2850
+ /**
2851
+ * Find all blocks with the given type sorted by the distance to viewport center.
2852
+ * @param type - The type to search for.
2853
+ * @returns A list of block ids sorted by distance to viewport center.
2854
+ */
2855
+ findNearestToViewPortCenterByType(type: string): DesignBlockId[];
2856
+ /**
2857
+ * Find all blocks with the given kind sorted by the distance to viewport center.
2858
+ * @param kind - The kind to search for.
2859
+ * @returns A list of block ids sorted by distance to viewport center.
2860
+ */
2861
+ findNearestToViewPortCenterByKind(kind: string): DesignBlockId[];
2862
+ /**
2863
+ * Set the zoom level of the scene.
2864
+ * @param zoomLevel - The new zoom level.
2865
+ */
2866
+ setZoomLevel(zoomLevel?: number): void;
2867
+ /**
2868
+ * Get the zoom level of the scene.
2869
+ * @returns The zoom level of the scene.
2870
+ */
2871
+ getZoomLevel(): number;
2872
+ /**
2873
+ * Sets the zoom and focus to show a block, optionally with animation.
2874
+ * This only shows an effect if the zoom level is not handled/overwritten by the UI.
2875
+ * Without padding, this results in a tight view on the block.
2876
+ *
2877
+ * @param id - The block that should be focused on.
2878
+ * @param options - Configuration for padding and animation.
2879
+ * @returns A promise that resolves once the zoom was set or rejects with an error otherwise.
2880
+ */
2881
+ zoomToBlock(id: DesignBlockId, options?: ZoomOptions): Promise<void>;
2882
+ /**
2883
+ * Sets the zoom and focus to show a block.
2884
+ *
2885
+ * This only shows an effect if the zoom level is not handled/overwritten by the UI.
2886
+ * Without padding, this results in a tight view on the block.
2887
+ *
2888
+ * @param id - The block that should be focused on.
2889
+ * @param paddingLeft - Optional padding in screen pixels to the left of the block.
2890
+ * @param paddingTop - Optional padding in screen pixels to the top of the block.
2891
+ * @param paddingRight - Optional padding in screen pixels to the right of the block.
2892
+ * @param paddingBottom - Optional padding in screen pixels to the bottom of the block.
2893
+ * @returns A promise that resolves once the zoom was set or rejects with an error otherwise.
2894
+ * @deprecated Use zoomToBlock with options object instead
2895
+ */
2896
+ zoomToBlock(id: DesignBlockId, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): Promise<void>;
2897
+ /**
2898
+ * Continually adjust the zoom level to fit the block's bounding box on the
2899
+ * chosen axis. For 'Horizontal'/'Vertical', the second/third arguments are
2900
+ * `paddingBefore`/`paddingAfter` along that axis. For 'Both' the four
2901
+ * arguments map to left/top/right/bottom.
2902
+ *
2903
+ * @param id - The block to follow.
2904
+ * @param axis - 'Horizontal' | 'Vertical' | 'Both'.
2905
+ */
2906
+ enableZoomAutoFit(id: DesignBlockId, axis: string, paddingBeforeOrLeft?: number, paddingAfterOrTop?: number, paddingRight?: number, paddingBottom?: number): void;
2907
+ /**
2908
+ * Disables any previously set zoom auto-fit.
2909
+ * @param blockOrScene - The scene or a block in the scene.
2910
+ */
2911
+ disableZoomAutoFit(blockOrScene: DesignBlockId): void;
2912
+ /**
2913
+ * Queries whether zoom auto-fit is enabled for the given block.
2914
+ * @param blockOrScene - The scene or a block in the scene.
2915
+ * @returns True if auto-fit is set, false otherwise.
2916
+ */
2917
+ isZoomAutoFitEnabled(blockOrScene: DesignBlockId): boolean;
2918
+ /**
2919
+ * Continually clamp the camera position so that the given blocks stay
2920
+ * within view (with optional padding).
2921
+ * @experimental
2922
+ */
2923
+ unstable_enableCameraPositionClamping(blocks: DesignBlockId[], paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number, scaledPaddingLeft?: number, scaledPaddingTop?: number, scaledPaddingRight?: number, scaledPaddingBottom?: number): void;
2924
+ unstable_disableCameraPositionClamping(block?: DesignBlockId): void;
2925
+ unstable_isCameraPositionClampingEnabled(block?: DesignBlockId): boolean;
2926
+ /**
2927
+ * Continually clamp the camera zoom level to the range
2928
+ * `[minZoomLimit, maxZoomLimit]` while showing the given blocks (with
2929
+ * optional padding).
2930
+ * @experimental
2931
+ */
2932
+ unstable_enableCameraZoomClamping(blocks: DesignBlockId[], minZoomLimit?: number, maxZoomLimit?: number, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): void;
2933
+ unstable_disableCameraZoomClamping(block?: DesignBlockId): void;
2934
+ unstable_isCameraZoomClampingEnabled(block?: DesignBlockId): boolean;
2935
+ /**
2936
+ * Subscribe to zoom-level changes.
2937
+ * @param callback - Called whenever the zoom level changes.
2938
+ * @returns A function that unsubscribes when called.
2939
+ */
2940
+ onZoomLevelChanged(callback: () => void): () => void;
2941
+ /**
2942
+ * Subscribe to active-scene changes.
2943
+ * @param callback - Called whenever the active scene changes.
2944
+ * @returns A function that unsubscribes when called.
2945
+ */
2946
+ onActiveChanged(callback: () => void): () => void;
2947
+ }
2948
+ /**
2949
+ * EditorAPI provides methods for editor state management
2950
+ */
2951
+ export declare class EditorAPI implements IEditorAPI {
2952
+ #private;
2953
+ constructor(engine: NativeEngine);
2954
+ getEditMode(): string;
2955
+ setEditMode(mode: string): void;
2956
+ /**
2957
+ * Returns the JWT string of the currently active license. An empty string
2958
+ * indicates the engine is in Evaluation mode (the trial license created
2959
+ * when init() is called with an empty/null/undefined license). Throws if
2960
+ * the engine has no active license at all.
2961
+ *
2962
+ * Mirrors @cesdk/node's `engine.editor.getActiveLicense()`.
2963
+ * @internal
2964
+ */
2965
+ getActiveLicense(): string;
2966
+ /**
2967
+ * Activate (or re-activate) the engine with a license key. Pass an empty
2968
+ * string to drop into Evaluation mode. Mirrors
2969
+ * `@cesdk/node`'s `engine.editor.unlockWithLicense()`.
2970
+ *
2971
+ * Most callers should pass `license` via `CreativeEngine.init({ license })`
2972
+ * — `init` calls this internally. Use this method only to switch licenses
2973
+ * at runtime (e.g. trial → paid upgrade in place).
2974
+ */
2975
+ unlockWithLicense(license: string): void;
2976
+ getSettingBool(key: string): boolean;
2977
+ setSettingBool(key: string, value: boolean): void;
2978
+ getSettingInt(key: string): number;
2979
+ setSettingInt(key: string, value: number): void;
2980
+ getSettingFloat(key: string): number;
2981
+ setSettingFloat(key: string, value: number): void;
2982
+ getSettingString(key: string): string;
2983
+ setSettingString(key: string, value: string): void;
2984
+ getSettingColor(key: string): Color;
2985
+ setSettingColor(key: string, value: Color): void;
2986
+ getSettingEnum(key: string): string;
2987
+ setSettingEnum(key: string, value: string): void;
2988
+ findAllSettings(): string[];
2989
+ getSettingType(key: string): string;
2990
+ getSettingEnumOptions(key: string): string[];
2991
+ /**
2992
+ * Generic setting getter that dispatches to the typed getter based on
2993
+ * `getSettingType`.
2994
+ */
2995
+ getSetting<T = boolean | number | string | Color>(key: string): T;
2996
+ /**
2997
+ * Generic setting setter — dispatches to the typed setter via
2998
+ * `getSettingType`.
2999
+ */
3000
+ setSetting(key: string, value: boolean | number | string | Color): void;
3001
+ /** Get the font metrics for a font URI. */
3002
+ getFontMetrics(fontFileUri: string): Promise<FontMetrics>;
3003
+ /**
3004
+ * Set one or more rules limiting how far blocks may be moved outside their
3005
+ * parent page during user interactions.
3006
+ */
3007
+ setMovementConstraint(rules: MovementConstraintRule | MovementConstraintRule[]): void;
3008
+ /**
3009
+ * Get the effective movement constraint for a block (most specific rule
3010
+ * wins: block > parent page > blockType > scene-wide). Returns `null`
3011
+ * when unconstrained.
3012
+ */
3013
+ getMovementConstraint(id: DesignBlockId): ResolvedMovementConstraint;
3014
+ /**
3015
+ * Remove movement constraints. No argument removes the scene-wide default.
3016
+ * `{ block }` / `{ blockType }` (or array) removes the matching scope(s).
3017
+ */
3018
+ removeMovementConstraint(scopes?: MovementConstraintScope | MovementConstraintScope[]): void;
3019
+ getCursorType(): string;
3020
+ getCursorRotation(): number;
3021
+ setSafeAreaInsets(insets: Insets): void;
3022
+ getSafeAreaInsets(): Insets;
3023
+ getUsedMemory(): number;
3024
+ getAvailableMemory(): number;
3025
+ convertColorToColorSpace(color: Color, colorSpace: string): Color;
3026
+ supportsP3(): boolean;
3027
+ getAbsoluteURI(relativeUri: string): Promise<string>;
3028
+ getMimeType(uri: string): Promise<string>;
3029
+ defaultURIResolver(relativePath: string): string;
3030
+ /**
3031
+ * Register a synchronous URI resolver. Matches `@cesdk/node`'s
3032
+ * `(uri, defaultResolver) => string` signature
3033
+ * (`bindings/wasm/js_web/src/EditorAPI.ts`). The
3034
+ * `defaultResolver` argument is the engine's built-in resolver — call
3035
+ * it to delegate the lookup chain.
3036
+ *
3037
+ * @public
3038
+ */
3039
+ setURIResolver(resolver: SyncURIResolver | ((uri: string) => string) | null): void;
3040
+ /**
3041
+ * Register an asynchronous URI resolver. Matches `@cesdk/node`'s
3042
+ * `(uri, defaultResolver) => Promise<string> | string` signature
3043
+ * (`bindings/wasm/js_web/src/EditorAPI.ts`). Bridges to the
3044
+ * native callback-style binding by adapting the returned Promise.
3045
+ *
3046
+ * Pass `null` to restore the default resolver.
3047
+ *
3048
+ * @public
3049
+ */
3050
+ setURIResolverAsync(resolver: AsyncURIResolver | null): void;
3051
+ relocateResource(currentUri: string, newUri: string): void;
3052
+ findAllMediaURIs(): string[];
3053
+ /**
3054
+ * List all transient (in-engine) resources — typically `buffer://` URIs
3055
+ * created by importers (psd, pdf, idml) before they're uploaded to a
3056
+ * permanent location. Each entry is `{ uri, size }`.
3057
+ *
3058
+ * Note: WASM uses `URL` as the key name; consumers that target both
3059
+ * bindings should accept either (see e.g. psd-importer's
3060
+ * `transient-resource-relocation.test.ts`).
3061
+ */
3062
+ findAllTransientResources(): Array<{
3063
+ uri: string;
3064
+ size: number;
3065
+ }>;
3066
+ findAllSpotColors(): string[];
3067
+ getSpotColorRGBA(name: string): RGBAColor;
3068
+ getSpotColorCMYK(name: string): CMYKColor;
3069
+ setSpotColorRGB(name: string, r: number, g: number, b: number): void;
3070
+ setSpotColorCMYK(name: string, c: number, m: number, y: number, k: number): void;
3071
+ removeSpotColor(name: string): void;
3072
+ getRole(): string;
3073
+ setRole(role: string): void;
3074
+ /**
3075
+ * Start the engine's analytics tracking pipeline. Mirrors
3076
+ * `@cesdk/node`'s `editor.startTracking(license, userId)`; invoked
3077
+ * automatically from {@link CreativeEngine.init} when `license` and/or
3078
+ * `userId` are passed in the Configuration. Safe to call multiple times.
3079
+ *
3080
+ * The C++ binding accepts a third `deviceId` argument that the engine
3081
+ * itself uses for tracking-pipeline disambiguation; WASM always passes
3082
+ * `''` (see `bindings/wasm/js_web/src/EditorAPI.ts`) — we
3083
+ * mirror that here so the no-args / "engine picks a default device id"
3084
+ * path is honored.
3085
+ *
3086
+ * @public
3087
+ */
3088
+ startTracking(license: string, userId: string, deviceId?: string): void;
3089
+ findAllScopes(): string[];
3090
+ getGlobalScope(scope: string): string;
3091
+ setGlobalScope(scope: string, value: string): void;
3092
+ createHistory(): HistoryId;
3093
+ destroyHistory(history: HistoryId): void;
3094
+ getActiveHistory(): HistoryId;
3095
+ setActiveHistory(history: HistoryId): void;
3096
+ /**
3097
+ * Undo one step in the active history if an undo step is available.
3098
+ * Use {@link canUndo} beforehand to determine whether a step is available.
3099
+ */
3100
+ undo(): void;
3101
+ /**
3102
+ * Redo one step in the active history if a redo step is available.
3103
+ * Use {@link canRedo} beforehand to determine whether a step is available.
3104
+ */
3105
+ redo(): void;
3106
+ canUndo(): boolean;
3107
+ canRedo(): boolean;
3108
+ addUndoStep(): void;
3109
+ removeUndoStep(): void;
3110
+ /**
3111
+ * Subscribe to editor-state changes.
3112
+ * @param callback - Called whenever the editor state changes.
3113
+ * @returns A function that unsubscribes when called.
3114
+ */
3115
+ onStateChanged(callback: () => void): () => void;
3116
+ /**
3117
+ * Subscribe to editor settings changes. Matches WASM's
3118
+ * `engine.editor.onSettingsChanged(callback)`. The native C++ side
3119
+ * implements this via `subscribeToSettings`; this wrapper exposes it on
3120
+ * the editor API so portable consumers (settings-reactive UI) work on
3121
+ * both bindings.
3122
+ * @returns A function that unsubscribes when called.
3123
+ */
3124
+ onSettingsChanged(callback: () => void): () => void;
3125
+ /**
3126
+ * Subscribe to history updates.
3127
+ * @deprecated Use {@link onHistoryUpdatedWithKind} instead, which also
3128
+ * reports the kind of update.
3129
+ * @param callback - Called when the undo/redo history changes.
3130
+ * @returns A function that unsubscribes when called.
3131
+ */
3132
+ onHistoryUpdated(callback: () => void): () => void;
3133
+ /**
3134
+ * Subscribe to history updates. The callback receives a `HistoryUpdate`
3135
+ * describing what kind of update happened (matches the node wasm
3136
+ * binding's `EditorAPI` surface) so consumers can distinguish a
3137
+ * snapshot mutation from an `Activated` event triggered by
3138
+ * `setActiveHistory` — important for save-button logic that should NOT
3139
+ * fire on activation alone.
3140
+ * @param callback - Called with the kind of update.
3141
+ * @returns A function that unsubscribes when called.
3142
+ */
3143
+ onHistoryUpdatedWithKind(callback: (kind: HistoryUpdate) => void): () => void;
3144
+ /**
3145
+ * Subscribe to role changes.
3146
+ * @param callback - Called with the new role when it changes.
3147
+ * @returns A function that unsubscribes when called.
3148
+ */
3149
+ onRoleChanged(callback: (role: string) => void): () => void;
3150
+ /**
3151
+ * Create a new buffer and return its URI.
3152
+ * @returns A URI to identify the created buffer (buffer://N format).
3153
+ */
3154
+ createBuffer(): string;
3155
+ /**
3156
+ * Destroy a buffer and free its resources.
3157
+ * @param uri - The URI of the buffer to destroy.
3158
+ */
3159
+ destroyBuffer(uri: string): void;
3160
+ /**
3161
+ * Set the data of a buffer at a given offset.
3162
+ * @param uri - The URI of the buffer to update.
3163
+ * @param offset - The offset in bytes at which to start writing.
3164
+ * @param data - The data to write.
3165
+ */
3166
+ setBufferData(uri: string, offset: number, data: Uint8Array): void;
3167
+ /**
3168
+ * Get the data of a buffer at a given offset.
3169
+ * @param uri - The URI of the buffer to query.
3170
+ * @param offset - The offset in bytes at which to start reading.
3171
+ * @param length - The number of bytes to read.
3172
+ * @returns The data at the given offset.
3173
+ */
3174
+ getBufferData(uri: string, offset: number, length: number): Uint8Array;
3175
+ /**
3176
+ * Get the length of a buffer.
3177
+ * @param uri - The URI of the buffer to query.
3178
+ * @returns The length of the buffer in bytes.
3179
+ */
3180
+ getBufferLength(uri: string): number;
3181
+ /**
3182
+ * Resize a buffer. Truncates if `length` is smaller than the current
3183
+ * size; zero-extends if larger. Matches the WASM `editor.setBufferLength`
3184
+ * shape used by psd/pdf/idml importers to pre-allocate a buffer before
3185
+ * writing data with `setBufferData`.
3186
+ */
3187
+ setBufferLength(uri: string, length: number): void;
3188
+ }
3189
+ /**
3190
+ * EventAPI provides methods for event subscription
3191
+ */
3192
+ export declare class EventAPI implements IEventAPI {
3193
+ #private;
3194
+ constructor(engine: NativeEngine);
3195
+ /**
3196
+ * Subscribe to block lifecycle events.
3197
+ * Events are bundled and delivered at the end of each engine update cycle.
3198
+ * @param blocks - List of blocks to filter events by. If empty, events for all blocks are sent.
3199
+ * @param callback - Function called with bundled events.
3200
+ * @returns A method to unsubscribe from the events.
3201
+ */
3202
+ subscribe: (blocks: DesignBlockId[], callback: (events: BlockEvent[]) => void) => (() => void);
3203
+ }
3204
+ /**
3205
+ * AssetAPI provides methods for asset source management
3206
+ * API matches Web bindings: engine.asset.*
3207
+ */
3208
+ export declare class AssetAPI implements IAssetAPI {
3209
+ #private;
3210
+ constructor(engine: NativeEngine);
3211
+ /**
3212
+ * Add a custom asset source with callbacks.
3213
+ *
3214
+ * This allows you to provide custom implementations for finding, fetching,
3215
+ * and applying assets from any data source.
3216
+ *
3217
+ * @param source - The asset source configuration with callbacks.
3218
+ */
3219
+ addSource(source: AssetSource): void;
3220
+ /**
3221
+ * Add a local asset source.
3222
+ *
3223
+ * Mirrors `@cesdk/node`'s 4-argument shape
3224
+ * (`bindings/wasm/js_web/src/AssetAPI.ts`): when `applyAsset`
3225
+ * or `applyAssetToBlock` is supplied, we wrap the local source as a
3226
+ * synthetic `AssetSource` via {@link addSource} so the callbacks are
3227
+ * honored. Without callbacks we go through the cheap `addLocalSource`
3228
+ * fast path.
3229
+ *
3230
+ * @param id - Unique identifier for the asset source.
3231
+ * @param supportedMimeTypes - The mime types of assets that are allowed to be added.
3232
+ * @param applyAsset - Optional callback invoked when the asset is applied to a new block.
3233
+ * @param applyAssetToBlock - Optional callback invoked when the asset is applied to an existing block.
3234
+ */
3235
+ addLocalSource(id: string, supportedMimeTypes?: string[], applyAsset?: (asset: CompleteAssetResult) => Promise<DesignBlockId | undefined>, applyAssetToBlock?: (asset: CompleteAssetResult, block: DesignBlockId) => Promise<void>): void;
3236
+ /**
3237
+ * Creates a new local asset source from a JSON string.
3238
+ * @param contentJSON - The JSON string containing the asset definitions.
3239
+ * @param basePath - Optional base path for resolving relative URLs.
3240
+ * @param options - Optional configuration with matcher patterns.
3241
+ * @returns The ID of the created asset source.
3242
+ */
3243
+ addLocalAssetSourceFromJSONString(contentJSON: string, basePath?: string, options?: {
3244
+ matcher?: string[];
3245
+ }): Promise<string>;
3246
+ /**
3247
+ * Creates a new local asset source from a JSON URI.
3248
+ * @param contentURI - The URI for the JSON file to load.
3249
+ * @param options - Optional configuration with matcher patterns.
3250
+ * @returns The ID of the created asset source.
3251
+ */
3252
+ addLocalAssetSourceFromJSONURI(contentURI: string, options?: {
3253
+ matcher?: string[];
3254
+ }): Promise<string>;
3255
+ /**
3256
+ * Remove a registered asset source.
3257
+ * @param id - The ID of the asset source to remove.
3258
+ */
3259
+ removeSource(id: string): void;
3260
+ /**
3261
+ * Get all registered asset source IDs.
3262
+ * @returns A list with the IDs of all registered asset sources.
3263
+ */
3264
+ findAllSources(): string[];
3265
+ /**
3266
+ * Search for assets in a specific source.
3267
+ *
3268
+ * @param sourceId - The ID of the asset source.
3269
+ * @param query - Query options to filter and sort the search results.
3270
+ * @returns Promise resolving to paginated search results.
3271
+ */
3272
+ findAssets(sourceId: string, query: AssetsQuery): Promise<AssetsQueryResult<CompleteAssetResult>>;
3273
+ /**
3274
+ * Fetch a specific asset by id from an asset source.
3275
+ * Returns `null` when the asset is not found.
3276
+ */
3277
+ fetchAsset(sourceId: string, assetId: string, params?: {
3278
+ locale?: string;
3279
+ }): Promise<CompleteAssetResult | null>;
3280
+ /**
3281
+ * Get available asset groups from a source.
3282
+ * @param id - The ID of the asset source.
3283
+ * @returns Promise resolving to list of available group names.
3284
+ */
3285
+ getGroups(id: string): Promise<string[]>;
3286
+ /**
3287
+ * Get license information for an asset source.
3288
+ * @param sourceId - The ID of the asset source.
3289
+ * @returns The asset source's license info.
3290
+ */
3291
+ getLicense(sourceId: string): {
3292
+ name: string;
3293
+ url: string | undefined;
3294
+ } | undefined;
3295
+ /**
3296
+ * Get attribution credits for an asset source.
3297
+ * @param sourceId - The ID of the asset source.
3298
+ * @returns The asset source's credits info.
3299
+ */
3300
+ getCredits(sourceId: string): {
3301
+ name: string;
3302
+ url: string | undefined;
3303
+ } | undefined;
3304
+ /**
3305
+ * Get supported MIME types for an asset source.
3306
+ * @param sourceId - The ID of the asset source.
3307
+ * @returns Array of supported MIME type strings.
3308
+ */
3309
+ getSupportedMimeTypes(sourceId: string): string[];
3310
+ /**
3311
+ * Add an asset to a local asset source.
3312
+ * @param sourceId - The local asset source ID.
3313
+ * @param asset - The asset definition to add.
3314
+ */
3315
+ addAssetToSource(sourceId: string, asset: Asset): void;
3316
+ /**
3317
+ * Remove an asset from a local asset source.
3318
+ * @param sourceId - The ID of the local asset source.
3319
+ * @param assetId - The ID of the asset to remove.
3320
+ */
3321
+ removeAssetFromSource(sourceId: string, assetId: string): void;
3322
+ /**
3323
+ * Notify the engine that an asset source's contents have changed.
3324
+ * @param sourceID - The asset source whose contents changed.
3325
+ */
3326
+ assetSourceContentsChanged(sourceID: string): void;
3327
+ /**
3328
+ * Subscribe to "asset source added" events.
3329
+ * @param callback - Called with the source ID whenever a new asset source is registered.
3330
+ * @returns A function that unsubscribes when called.
3331
+ */
3332
+ onAssetSourceAdded(callback: (sourceId: string) => void): () => void;
3333
+ /**
3334
+ * Subscribe to "asset source removed" events.
3335
+ * @param callback - Called with the source ID whenever an asset source is removed.
3336
+ * @returns A function that unsubscribes when called.
3337
+ */
3338
+ onAssetSourceRemoved(callback: (sourceId: string) => void): () => void;
3339
+ /**
3340
+ * Subscribe to "asset source updated" events.
3341
+ * @param callback - Called with the source ID whenever an asset source's contents change.
3342
+ * @returns A function that unsubscribes when called.
3343
+ */
3344
+ onAssetSourceUpdated(callback: (sourceId: string) => void): () => void;
3345
+ /**
3346
+ * Apply an asset to the current scene. Honors any middleware registered
3347
+ * via {@link registerApplyMiddleware} and falls back to
3348
+ * {@link defaultApplyAsset}.
3349
+ *
3350
+ * @public
3351
+ */
3352
+ apply(sourceId: string, asset: CompleteAssetResult): Promise<DesignBlockId | undefined>;
3353
+ /**
3354
+ * Apply an asset to a specific block. Honors any middleware registered
3355
+ * via {@link registerApplyToBlockMiddleware} and falls back to
3356
+ * {@link defaultApplyAssetToBlock}.
3357
+ *
3358
+ * @public
3359
+ */
3360
+ applyToBlock(sourceId: string, asset: CompleteAssetResult, block: DesignBlockId): Promise<void>;
3361
+ /**
3362
+ * Apply a property change from an asset payload.
3363
+ *
3364
+ * @public
3365
+ */
3366
+ applyProperty(sourceId: string, asset: CompleteAssetResult, property: AssetProperty): Promise<void>;
3367
+ /**
3368
+ * Default apply-asset implementation (no middleware). Calls the engine's
3369
+ * built-in apply logic; used as the tail of the middleware chain in
3370
+ * {@link apply}.
3371
+ *
3372
+ * @public
3373
+ */
3374
+ defaultApplyAsset(asset: CompleteAssetResult): Promise<DesignBlockId | undefined>;
3375
+ /**
3376
+ * Default apply-to-block implementation (no middleware). Used as the
3377
+ * tail of the middleware chain in {@link applyToBlock}.
3378
+ *
3379
+ * @public
3380
+ */
3381
+ defaultApplyAssetToBlock(asset: CompleteAssetResult, block: DesignBlockId): Promise<void>;
3382
+ /**
3383
+ * Register a middleware in the apply-asset chain for a source.
3384
+ *
3385
+ * @param sourceId - The source to install the middleware on.
3386
+ * @param middleware - Callable that may consume the asset, defer to
3387
+ * the next middleware, or short-circuit. Returns the created block id
3388
+ * (or undefined to fall through).
3389
+ * @public
3390
+ */
3391
+ registerApplyMiddleware(sourceId: string, middleware: (asset: CompleteAssetResult, next: (asset: CompleteAssetResult) => Promise<DesignBlockId | undefined>) => Promise<DesignBlockId | undefined>): void;
3392
+ /**
3393
+ * Register a middleware in the apply-asset-to-block chain for a source.
3394
+ *
3395
+ * @public
3396
+ */
3397
+ registerApplyToBlockMiddleware(sourceId: string, middleware: (asset: CompleteAssetResult, block: DesignBlockId, next: (asset: CompleteAssetResult, block: DesignBlockId) => Promise<void>) => Promise<void>): void;
3398
+ /**
3399
+ * Whether the named source supports `addAssetToSource` /
3400
+ * `removeAssetFromSource`. Local sources return `true` by default; custom
3401
+ * sources return whatever they declared via `canManageAssets` in their
3402
+ * registration object.
3403
+ *
3404
+ * @public
3405
+ */
3406
+ canManageAssets(sourceId: string): boolean;
3407
+ }
3408
+ export interface NativeEngine {
3409
+ update(): boolean;
3410
+ dispose(): void;
3411
+ unlockWithLicense(license: string): void;
3412
+ getActiveLicense(): string;
3413
+ createScene(sceneLayout?: string): DesignBlockId;
3414
+ createVideoScene(): DesignBlockId;
3415
+ createSceneFromImage(uri: string, dpi?: number, pixelScaleFactor?: number): Promise<DesignBlockId>;
3416
+ createSceneFromVideo(uri: string): Promise<DesignBlockId>;
3417
+ loadSceneFromString(content: string, overrideEditorConfig?: boolean, waitForResources?: boolean): Promise<DesignBlockId>;
3418
+ loadSceneFromURL(url: string, overrideEditorConfig?: boolean, waitForResources?: boolean): Promise<DesignBlockId>;
3419
+ loadSceneFromArchiveURL(url: string, overrideEditorConfig?: boolean, waitForResources?: boolean): Promise<DesignBlockId>;
3420
+ saveSceneToString(scene: DesignBlockId, options?: {
3421
+ compression?: {
3422
+ format?: number;
3423
+ level?: number;
3424
+ };
3425
+ }): Promise<string>;
3426
+ saveSceneToArchive(scene: DesignBlockId): Promise<Uint8Array>;
3427
+ applyTemplateFromString(content: string): Promise<void>;
3428
+ applyTemplateFromURL(url: string): Promise<void>;
3429
+ getPages(scene: DesignBlockId): DesignBlockId[];
3430
+ addPage(scene: DesignBlockId): DesignBlockId;
3431
+ getCurrentPage(scene: DesignBlockId): DesignBlockId | null;
3432
+ getSceneMode(scene: DesignBlockId): string;
3433
+ getSceneLayout(scene: DesignBlockId): string;
3434
+ setSceneLayout(scene: DesignBlockId, layout: string): void;
3435
+ getDesignUnit(scene: DesignBlockId): string;
3436
+ setDesignUnit(scene: DesignBlockId, unit: string): void;
3437
+ getFontSizeUnit(scene: DesignBlockId): string;
3438
+ setFontSizeUnit(scene: DesignBlockId, unit: string): void;
3439
+ create(type: string): DesignBlockId;
3440
+ createFill(type: string): DesignBlockId;
3441
+ createShape(type: string): DesignBlockId;
3442
+ createEffect(type: string): DesignBlockId;
3443
+ createBlur(type: string): DesignBlockId;
3444
+ createAnimation(type: string): DesignBlockId;
3445
+ duplicate(block: DesignBlockId, attachToParent?: boolean): DesignBlockId;
3446
+ destroy(block: DesignBlockId): void;
3447
+ isValid(block: DesignBlockId): boolean;
3448
+ findAll(): DesignBlockId[];
3449
+ findAllPlaceholders(): DesignBlockId[];
3450
+ findAllUnused(): DesignBlockId[];
3451
+ findByName(name: string): DesignBlockId[];
3452
+ findByType(type: string): DesignBlockId[];
3453
+ findByKind(kind: string): DesignBlockId[];
3454
+ findAllSelected(): DesignBlockId[];
3455
+ getParent(block: DesignBlockId): DesignBlockId;
3456
+ hasParent(block: DesignBlockId): boolean;
3457
+ getChildren(block: DesignBlockId): DesignBlockId[];
3458
+ insertChild(parent: DesignBlockId, child: DesignBlockId, index: number): void;
3459
+ appendChild(parent: DesignBlockId, child: DesignBlockId): void;
3460
+ getType(block: DesignBlockId): string;
3461
+ getKind(block: DesignBlockId): string;
3462
+ setKind(block: DesignBlockId, kind: string): void;
3463
+ getName(block: DesignBlockId): string;
3464
+ setName(block: DesignBlockId, name: string): void;
3465
+ getUUID(block: DesignBlockId): string;
3466
+ getBool(block: DesignBlockId, property: string): boolean;
3467
+ setBool(block: DesignBlockId, property: string, value: boolean): void;
3468
+ getInt(block: DesignBlockId, property: string): number;
3469
+ setInt(block: DesignBlockId, property: string, value: number): void;
3470
+ getFloat(block: DesignBlockId, property: string): number;
3471
+ setFloat(block: DesignBlockId, property: string, value: number): void;
3472
+ getDouble(block: DesignBlockId, property: string): number;
3473
+ setDouble(block: DesignBlockId, property: string, value: number): void;
3474
+ getString(block: DesignBlockId, property: string): string;
3475
+ setString(block: DesignBlockId, property: string, value: string): void;
3476
+ getColor(block: DesignBlockId, property: string): NativeColorInternal;
3477
+ setColor(block: DesignBlockId, property: string, value: NativeColorInternal): void;
3478
+ getEnum(block: DesignBlockId, property: string): string;
3479
+ setEnum(block: DesignBlockId, property: string, value: string): void;
3480
+ getPositionX(block: DesignBlockId): number;
3481
+ setPositionX(block: DesignBlockId, value: number): void;
3482
+ getPositionY(block: DesignBlockId): number;
3483
+ setPositionY(block: DesignBlockId, value: number): void;
3484
+ getPositionXMode(block: DesignBlockId): string;
3485
+ setPositionXMode(block: DesignBlockId, mode: string): void;
3486
+ getPositionYMode(block: DesignBlockId): string;
3487
+ setPositionYMode(block: DesignBlockId, mode: string): void;
3488
+ getWidth(block: DesignBlockId): number;
3489
+ setWidth(block: DesignBlockId, value: number): void;
3490
+ getWidthMode(block: DesignBlockId): string;
3491
+ setWidthMode(block: DesignBlockId, mode: string): void;
3492
+ getHeight(block: DesignBlockId): number;
3493
+ setHeight(block: DesignBlockId, value: number): void;
3494
+ getHeightMode(block: DesignBlockId): string;
3495
+ setHeightMode(block: DesignBlockId, mode: string): void;
3496
+ getRotation(block: DesignBlockId): number;
3497
+ setRotation(block: DesignBlockId, value: number): void;
3498
+ getScaleX(block: DesignBlockId): number;
3499
+ setScaleX(block: DesignBlockId, value: number): void;
3500
+ getScaleY(block: DesignBlockId): number;
3501
+ setScaleY(block: DesignBlockId, value: number): void;
3502
+ getFlip(block: DesignBlockId): {
3503
+ horizontal: boolean;
3504
+ vertical: boolean;
3505
+ };
3506
+ setFlipHorizontal(block: DesignBlockId, flip: boolean): void;
3507
+ setFlipVertical(block: DesignBlockId, flip: boolean): void;
3508
+ scale(block: DesignBlockId, scale: number, anchorX?: number, anchorY?: number): void;
3509
+ fillParent(block: DesignBlockId): void;
3510
+ resizeContentAware(blocks: DesignBlockId[], width: number, height: number): Promise<void>;
3511
+ getGlobalBoundingBoxX(block: DesignBlockId): number;
3512
+ getGlobalBoundingBoxY(block: DesignBlockId): number;
3513
+ getGlobalBoundingBoxWidth(block: DesignBlockId): number;
3514
+ getGlobalBoundingBoxHeight(block: DesignBlockId): number;
3515
+ getScreenSpaceBoundingBoxXYWH(blocks: DesignBlockId[]): XYWH;
3516
+ supportsFill(block: DesignBlockId): boolean;
3517
+ hasFill(block: DesignBlockId): boolean;
3518
+ getFill(block: DesignBlockId): DesignBlockId;
3519
+ setFill(block: DesignBlockId, fill: DesignBlockId): void;
3520
+ getFillEnabled(block: DesignBlockId): boolean;
3521
+ setFillEnabled(block: DesignBlockId, enabled: boolean): void;
3522
+ getFillSolidColor(block: DesignBlockId): RGBAColor;
3523
+ setFillSolidColor(block: DesignBlockId, color: {
3524
+ r: number;
3525
+ g: number;
3526
+ b: number;
3527
+ a: number;
3528
+ }): void;
3529
+ getGradientColorStops(block: DesignBlockId, property: string): Array<{
3530
+ color: NativeColorInternal;
3531
+ stop: number;
3532
+ }>;
3533
+ setGradientColorStops(block: DesignBlockId, property: string, stops: Array<{
3534
+ color: NativeColorInternal;
3535
+ stop: number;
3536
+ }>): void;
3537
+ supportsStroke(block: DesignBlockId): boolean;
3538
+ hasStroke(block: DesignBlockId): boolean;
3539
+ getStroke(block: DesignBlockId): DesignBlockId;
3540
+ setStroke(block: DesignBlockId, stroke: DesignBlockId): void;
3541
+ getStrokeEnabled(block: DesignBlockId): boolean;
3542
+ setStrokeEnabled(block: DesignBlockId, enabled: boolean): void;
3543
+ getStrokeColor(block: DesignBlockId): NativeColorInternal;
3544
+ setStrokeColor(block: DesignBlockId, color: NativeColorInternal): void;
3545
+ getStrokeColorRGBA(block: DesignBlockId): RGBAColor;
3546
+ setStrokeColorRGBA(block: DesignBlockId, r: number, g: number, b: number, a: number): void;
3547
+ getStrokeWidth(block: DesignBlockId): number;
3548
+ setStrokeWidth(block: DesignBlockId, width: number): void;
3549
+ getStrokeStyle(block: DesignBlockId): string;
3550
+ setStrokeStyle(block: DesignBlockId, style: string): void;
3551
+ getStrokePosition(block: DesignBlockId): string;
3552
+ setStrokePosition(block: DesignBlockId, position: string): void;
3553
+ getStrokeCornerGeometry(block: DesignBlockId): string;
3554
+ setStrokeCornerGeometry(block: DesignBlockId, geometry: string): void;
3555
+ getStrokeCap(block: DesignBlockId): string;
3556
+ setStrokeCap(block: DesignBlockId, cap: string): void;
3557
+ getStrokeStartCap(block: DesignBlockId): string;
3558
+ setStrokeStartCap(block: DesignBlockId, cap: string): void;
3559
+ getStrokeEndCap(block: DesignBlockId): string;
3560
+ setStrokeEndCap(block: DesignBlockId, cap: string): void;
3561
+ getStrokeDashStartCap(block: DesignBlockId): string;
3562
+ setStrokeDashStartCap(block: DesignBlockId, cap: string): void;
3563
+ getStrokeDashEndCap(block: DesignBlockId): string;
3564
+ setStrokeDashEndCap(block: DesignBlockId, cap: string): void;
3565
+ getStrokeDashArray(block: DesignBlockId): number[];
3566
+ setStrokeDashArray(block: DesignBlockId, dashArray: number[]): void;
3567
+ getStrokeDashOffset(block: DesignBlockId): number;
3568
+ setStrokeDashOffset(block: DesignBlockId, dashOffset: number): void;
3569
+ isLineOrigin(block: DesignBlockId): boolean;
3570
+ supportsEffects(block: DesignBlockId): boolean;
3571
+ hasEffects(block: DesignBlockId): boolean;
3572
+ getEffects(block: DesignBlockId): DesignBlockId[];
3573
+ appendEffect(block: DesignBlockId, effect: DesignBlockId): void;
3574
+ insertEffect(block: DesignBlockId, effect: DesignBlockId, index: number): void;
3575
+ removeEffect(block: DesignBlockId, index: number): void;
3576
+ isEffectEnabled(effect: DesignBlockId): boolean;
3577
+ setEffectEnabled(effect: DesignBlockId, enabled: boolean): void;
3578
+ supportsBlur(block: DesignBlockId): boolean;
3579
+ hasBlur(block: DesignBlockId): boolean;
3580
+ getBlur(block: DesignBlockId): DesignBlockId;
3581
+ setBlur(block: DesignBlockId, blur: DesignBlockId): void;
3582
+ getBlurEnabled(block: DesignBlockId): boolean;
3583
+ setBlurEnabled(block: DesignBlockId, enabled: boolean): void;
3584
+ supportsShape(block: DesignBlockId): boolean;
3585
+ getShape(block: DesignBlockId): DesignBlockId;
3586
+ setShape(block: DesignBlockId, shape: DesignBlockId): void;
3587
+ supportsAnimation(block: DesignBlockId): boolean;
3588
+ getInAnimation(block: DesignBlockId): DesignBlockId;
3589
+ setInAnimation(block: DesignBlockId, animation: DesignBlockId): void;
3590
+ getOutAnimation(block: DesignBlockId): DesignBlockId;
3591
+ setOutAnimation(block: DesignBlockId, animation: DesignBlockId): void;
3592
+ getLoopAnimation(block: DesignBlockId): DesignBlockId;
3593
+ setLoopAnimation(block: DesignBlockId, animation: DesignBlockId): void;
3594
+ supportsContentFillMode(block: DesignBlockId): boolean;
3595
+ getContentFillMode(block: DesignBlockId): string;
3596
+ setContentFillMode(block: DesignBlockId, mode: string): void;
3597
+ supportsCrop(block: DesignBlockId): boolean;
3598
+ resetCrop(block: DesignBlockId): void;
3599
+ adjustCropToFillFrame(block: DesignBlockId, minScaleRatio?: number): void;
3600
+ getCropRotation(block: DesignBlockId): number;
3601
+ setCropRotation(block: DesignBlockId, rotation: number): void;
3602
+ getCropScaleX(block: DesignBlockId): number;
3603
+ setCropScaleX(block: DesignBlockId, scale: number): void;
3604
+ getCropScaleY(block: DesignBlockId): number;
3605
+ setCropScaleY(block: DesignBlockId, scale: number): void;
3606
+ getCropScaleRatio(block: DesignBlockId): number;
3607
+ setCropScaleRatio(block: DesignBlockId, ratio: number): void;
3608
+ getCropTranslationX(block: DesignBlockId): number;
3609
+ setCropTranslationX(block: DesignBlockId, translation: number): void;
3610
+ getCropTranslationY(block: DesignBlockId): number;
3611
+ setCropTranslationY(block: DesignBlockId, translation: number): void;
3612
+ isCropAspectRatioLocked(block: DesignBlockId): boolean;
3613
+ setCropAspectRatioLocked(block: DesignBlockId, locked: boolean): void;
3614
+ flipCropHorizontal(block: DesignBlockId): void;
3615
+ flipCropVertical(block: DesignBlockId): void;
3616
+ supportsDropShadow(block: DesignBlockId): boolean;
3617
+ isDropShadowEnabled(block: DesignBlockId): boolean;
3618
+ setDropShadowEnabled(block: DesignBlockId, enabled: boolean): void;
3619
+ getDropShadowColor(block: DesignBlockId): NativeColorInternal;
3620
+ setDropShadowColor(block: DesignBlockId, color: NativeColorInternal): void;
3621
+ getDropShadowColorRGBA(block: DesignBlockId): RGBAColor;
3622
+ setDropShadowColorRGBA(block: DesignBlockId, r: number, g: number, b: number, a: number): void;
3623
+ getDropShadowOffsetX(block: DesignBlockId): number;
3624
+ setDropShadowOffsetX(block: DesignBlockId, offset: number): void;
3625
+ getDropShadowOffsetY(block: DesignBlockId): number;
3626
+ setDropShadowOffsetY(block: DesignBlockId, offset: number): void;
3627
+ getDropShadowBlurRadiusX(block: DesignBlockId): number;
3628
+ setDropShadowBlurRadiusX(block: DesignBlockId, radius: number): void;
3629
+ getDropShadowBlurRadiusY(block: DesignBlockId): number;
3630
+ setDropShadowBlurRadiusY(block: DesignBlockId, radius: number): void;
3631
+ getDropShadowClip(block: DesignBlockId): boolean;
3632
+ setDropShadowClip(block: DesignBlockId, clip: boolean): void;
3633
+ supportsBlendMode(block: DesignBlockId): boolean;
3634
+ getBlendMode(block: DesignBlockId): string;
3635
+ setBlendMode(block: DesignBlockId, mode: string): void;
3636
+ supportsOpacity(block: DesignBlockId): boolean;
3637
+ getOpacity(block: DesignBlockId): number;
3638
+ setOpacity(block: DesignBlockId, opacity: number): void;
3639
+ getVisible(block: DesignBlockId): boolean;
3640
+ setVisible(block: DesignBlockId, visible: boolean): void;
3641
+ getClipped(block: DesignBlockId): boolean;
3642
+ setClipped(block: DesignBlockId, clipped: boolean): void;
3643
+ setSelected(block: DesignBlockId, selected: boolean): void;
3644
+ isSelected(block: DesignBlockId): boolean;
3645
+ select(block: DesignBlockId): void;
3646
+ bringToFront(block: DesignBlockId): void;
3647
+ sendToBack(block: DesignBlockId): void;
3648
+ bringForward(block: DesignBlockId): void;
3649
+ sendBackward(block: DesignBlockId): void;
3650
+ setAlwaysOnTop(block: DesignBlockId, enabled: boolean): void;
3651
+ setAlwaysOnBottom(block: DesignBlockId, enabled: boolean): void;
3652
+ isAlwaysOnTop(block: DesignBlockId): boolean;
3653
+ isAlwaysOnBottom(block: DesignBlockId): boolean;
3654
+ alignHorizontally(blocks: DesignBlockId[], alignment: string): void;
3655
+ alignVertically(blocks: DesignBlockId[], alignment: string): void;
3656
+ isAlignable(blocks: DesignBlockId[]): boolean;
3657
+ distributeHorizontally(blocks: DesignBlockId[]): void;
3658
+ distributeVertically(blocks: DesignBlockId[]): void;
3659
+ isDistributable(blocks: DesignBlockId[]): boolean;
3660
+ group(blocks: DesignBlockId[]): DesignBlockId;
3661
+ ungroup(group: DesignBlockId): void;
3662
+ isGroupable(blocks: DesignBlockId[]): boolean;
3663
+ enterGroup(group: DesignBlockId): void;
3664
+ exitGroup(block: DesignBlockId): void;
3665
+ combine(blocks: DesignBlockId[], operation: string): DesignBlockId;
3666
+ isCombinable(blocks: DesignBlockId[]): boolean;
3667
+ supportsDuration(block: DesignBlockId): boolean;
3668
+ getDuration(block: DesignBlockId): number;
3669
+ setDuration(block: DesignBlockId, duration: number): void;
3670
+ supportsTimeOffset(block: DesignBlockId): boolean;
3671
+ getTimeOffset(block: DesignBlockId): number;
3672
+ setTimeOffset(block: DesignBlockId, offset: number): void;
3673
+ supportsTrim(block: DesignBlockId): boolean;
3674
+ getTrimOffset(block: DesignBlockId): number;
3675
+ setTrimOffset(block: DesignBlockId, offset: number): void;
3676
+ getTrimLength(block: DesignBlockId): number;
3677
+ setTrimLength(block: DesignBlockId, length: number): void;
3678
+ supportsPlaybackControl(block: DesignBlockId): boolean;
3679
+ supportsPlaybackTime(block: DesignBlockId): boolean;
3680
+ getPlaybackTime(block: DesignBlockId): number;
3681
+ setPlaybackTime(block: DesignBlockId, time: number): void;
3682
+ isPlaying(block: DesignBlockId): boolean;
3683
+ setPlaying(block: DesignBlockId, playing: boolean): void;
3684
+ isLooping(block: DesignBlockId): boolean;
3685
+ setLooping(block: DesignBlockId, looping: boolean): void;
3686
+ getPlaybackSpeed(block: DesignBlockId): number;
3687
+ setPlaybackSpeed(block: DesignBlockId, speed: number): void;
3688
+ isMuted(block: DesignBlockId): boolean;
3689
+ setMuted(block: DesignBlockId, muted: boolean): void;
3690
+ getVolume(block: DesignBlockId): number;
3691
+ setVolume(block: DesignBlockId, volume: number): void;
3692
+ isSoloPlaybackEnabled(block: DesignBlockId): boolean;
3693
+ setSoloPlaybackEnabled(block: DesignBlockId, enabled: boolean): void;
3694
+ isForceMuted(block: DesignBlockId): boolean;
3695
+ getTotalSceneDuration(scene: DesignBlockId): number;
3696
+ isVisibleAtCurrentPlaybackTime(block: DesignBlockId): boolean;
3697
+ isTransformLocked(block: DesignBlockId): boolean;
3698
+ setTransformLocked(block: DesignBlockId, locked: boolean): void;
3699
+ isHighlightingEnabled(block: DesignBlockId): boolean;
3700
+ setHighlightingEnabled(block: DesignBlockId, enabled: boolean): void;
3701
+ isSelectionEnabled(block: DesignBlockId): boolean;
3702
+ setSelectionEnabled(block: DesignBlockId, enabled: boolean): void;
3703
+ isIncludedInExport(block: DesignBlockId): boolean;
3704
+ setIncludedInExport(block: DesignBlockId, included: boolean): void;
3705
+ isPlaceholderEnabled(block: DesignBlockId): boolean;
3706
+ setPlaceholderEnabled(block: DesignBlockId, enabled: boolean): void;
3707
+ supportsPlaceholderBehavior(block: DesignBlockId): boolean;
3708
+ isPlaceholderBehaviorEnabled(block: DesignBlockId): boolean;
3709
+ setPlaceholderBehaviorEnabled(block: DesignBlockId, enabled: boolean): void;
3710
+ supportsPlaceholderControls(block: DesignBlockId): boolean;
3711
+ isPlaceholderControlsOverlayEnabled(block: DesignBlockId): boolean;
3712
+ setPlaceholderControlsOverlayEnabled(block: DesignBlockId, enabled: boolean): void;
3713
+ isPlaceholderControlsButtonEnabled(block: DesignBlockId): boolean;
3714
+ setPlaceholderControlsButtonEnabled(block: DesignBlockId, enabled: boolean): void;
3715
+ supportsBackgroundColor(block: DesignBlockId): boolean;
3716
+ isBackgroundColorEnabled(block: DesignBlockId): boolean;
3717
+ setBackgroundColorEnabled(block: DesignBlockId, enabled: boolean): void;
3718
+ hasMetadata(block: DesignBlockId, key: string): boolean;
3719
+ getMetadata(block: DesignBlockId, key: string): string;
3720
+ setMetadata(block: DesignBlockId, key: string, value: string): void;
3721
+ removeMetadata(block: DesignBlockId, key: string): void;
3722
+ findAllMetadata(block: DesignBlockId): string[];
3723
+ replaceText(block: DesignBlockId, text: string, from?: number, to?: number): void;
3724
+ removeText(block: DesignBlockId, from?: number, to?: number): void;
3725
+ getTextFontSizes(block: DesignBlockId, from?: number, to?: number): number[];
3726
+ setTextFontSize(block: DesignBlockId, size: number, from?: number, to?: number): void;
3727
+ getTextFontStyles(block: DesignBlockId, from?: number, to?: number): string[];
3728
+ setTextFontStyle(block: DesignBlockId, style: string, from?: number, to?: number): void;
3729
+ getTextFontWeights(block: DesignBlockId, from?: number, to?: number): string[];
3730
+ setTextFontWeight(block: DesignBlockId, weight: string, from?: number, to?: number): void;
3731
+ getTextColors(block: DesignBlockId, from?: number, to?: number): NativeColorInternal[];
3732
+ setTextColor(block: DesignBlockId, color: NativeColorInternal, from?: number, to?: number): void;
3733
+ getTextCases(block: DesignBlockId, from?: number, to?: number): string[];
3734
+ setTextCase(block: DesignBlockId, textCase: string, from?: number, to?: number): void;
3735
+ getTypefaces(block: DesignBlockId, from?: number, to?: number): Typeface[];
3736
+ setTypeface(block: DesignBlockId, typeface: Typeface, from?: number, to?: number): void;
3737
+ getTypeface(block: DesignBlockId): Typeface;
3738
+ setFont(block: DesignBlockId, fontUri: string, typeface: Typeface): void;
3739
+ setTextKerning(block: DesignBlockId, kerning: number, from?: number, to?: number): void;
3740
+ getTextKernings(block: DesignBlockId, from?: number, to?: number): number[];
3741
+ setContentFillHorizontalAlignment(block: DesignBlockId, alignment: string): void;
3742
+ getContentFillHorizontalAlignment(block: DesignBlockId): string;
3743
+ setContentFillVerticalAlignment(block: DesignBlockId, alignment: string): void;
3744
+ getContentFillVerticalAlignment(block: DesignBlockId): string;
3745
+ canToggleBoldFont(block: DesignBlockId): boolean;
3746
+ toggleBoldFont(block: DesignBlockId): void;
3747
+ canToggleItalicFont(block: DesignBlockId): boolean;
3748
+ toggleItalicFont(block: DesignBlockId): void;
3749
+ getTextCursorRange(): Range;
3750
+ setTextCursorRange(from: number, to: number): void;
3751
+ getTextCursorPositionInScreenSpaceX(block: DesignBlockId): number;
3752
+ getTextCursorPositionInScreenSpaceY(block: DesignBlockId): number;
3753
+ getTextVisibleLineCount(block: DesignBlockId): number;
3754
+ getTextVisibleLineContent(block: DesignBlockId, lineIndex: number): string;
3755
+ getTextVisibleLineGlobalBoundingBoxXYWH(block: DesignBlockId, lineIndex: number): XYWH;
3756
+ getTextCharacterInkBoxes(block: DesignBlockId, from?: number, to?: number): CharacterInkBox[];
3757
+ getTextEffectiveHorizontalAlignment(block: DesignBlockId): string;
3758
+ getTextHorizontalAlignment(block: DesignBlockId, paragraphIndex?: number): string | undefined;
3759
+ setTextHorizontalAlignment(block: DesignBlockId, alignment: string | undefined, paragraphIndex?: number): void;
3760
+ getTextDecorations(block: DesignBlockId, from?: number, to?: number): unknown[];
3761
+ setTextDecoration(block: DesignBlockId, config: unknown, from?: number, to?: number): void;
3762
+ toggleTextDecorationUnderline(block: DesignBlockId, from?: number, to?: number): void;
3763
+ toggleTextDecorationStrikethrough(block: DesignBlockId, from?: number, to?: number): void;
3764
+ toggleTextDecorationOverline(block: DesignBlockId, from?: number, to?: number): void;
3765
+ getTextListStyle(block: DesignBlockId, paragraphIndex: number): string;
3766
+ setTextListStyle(block: DesignBlockId, listStyle: string, paragraphIndex?: number, listLevel?: number): void;
3767
+ getTextListLevel(block: DesignBlockId, paragraphIndex: number): number;
3768
+ setTextListLevel(block: DesignBlockId, listLevel: number, paragraphIndex?: number): void;
3769
+ getTextParagraphIndices(block: DesignBlockId, from?: number, to?: number): number[];
3770
+ getTextLineHeight(block: DesignBlockId, paragraphIndex: number): number;
3771
+ setTextLineHeight(block: DesignBlockId, lineHeight: number | undefined, paragraphIndex?: number): void;
3772
+ getFontMetrics(fontFileUri: string): Promise<FontMetrics>;
3773
+ setMovementConstraint(targets: (DesignBlockId | string)[], overshoot: number): void;
3774
+ getMovementConstraint(block: DesignBlockId): number;
3775
+ removeMovementConstraint(targets: (DesignBlockId | string)[]): void;
3776
+ getSourceSet(block: DesignBlockId, property: string): Source[];
3777
+ setSourceSet(block: DesignBlockId, property: string, sources: Source[]): void;
3778
+ addImageFileURIToSourceSet(block: DesignBlockId, property: string, uri: string): Promise<void>;
3779
+ addVideoFileURIToSourceSet(block: DesignBlockId, property: string, uri: string): Promise<void>;
3780
+ getVideoWidth(block: DesignBlockId): number;
3781
+ getVideoHeight(block: DesignBlockId): number;
3782
+ getAudioTrackCountFromVideo(block: DesignBlockId): number;
3783
+ getAVResourceTotalDuration(block: DesignBlockId): number;
3784
+ split(block: DesignBlockId, time: number): DesignBlockId;
3785
+ getSceneMode(scene: DesignBlockId): string;
3786
+ setSceneMode(scene: DesignBlockId, mode: string): void;
3787
+ getSceneLayout(scene: DesignBlockId): SceneLayout;
3788
+ setSceneLayout(scene: DesignBlockId, layout: SceneLayout): void;
3789
+ getDesignUnit(scene: DesignBlockId): string;
3790
+ setDesignUnit(scene: DesignBlockId, unit: string): void;
3791
+ getFontSizeUnit(scene: DesignBlockId): string;
3792
+ setFontSizeUnit(scene: DesignBlockId, unit: string): void;
3793
+ getLastFrameX(block: DesignBlockId): number;
3794
+ getLastFrameY(block: DesignBlockId): number;
3795
+ getLastFrameWidth(block: DesignBlockId): number;
3796
+ getLastFrameHeight(block: DesignBlockId): number;
3797
+ supportsPageDurationSource(page: DesignBlockId, block: DesignBlockId): boolean;
3798
+ setPageDurationSource(page: DesignBlockId, block: DesignBlockId): void;
3799
+ removePageDurationSource(page: DesignBlockId): void;
3800
+ isPageDurationSource(block: DesignBlockId): boolean;
3801
+ findAllScopes(): string[];
3802
+ getGlobalScope(key: string): string;
3803
+ setGlobalScope(key: string, value: string): void;
3804
+ isScopeEnabled(block: DesignBlockId, scope: string): boolean;
3805
+ setScopeEnabled(block: DesignBlockId, scope: string, enabled: boolean): void;
3806
+ isAllowedByScope(block: DesignBlockId, scope: string): boolean;
3807
+ findAllProperties(block: DesignBlockId): string[];
3808
+ getPropertyType(property: string): string;
3809
+ isPropertyReadable(property: string): boolean;
3810
+ isPropertyWritable(property: string): boolean;
3811
+ getEnumValues(property: string): string[];
3812
+ getRole(): string;
3813
+ setRole(role: string): void;
3814
+ startTracking(license: string, userId: string, deviceId: string): void;
3815
+ getState(block: DesignBlockId): string;
3816
+ setZoomLevel(sceneOrCamera: DesignBlockId, level: number): void;
3817
+ getZoomLevel(sceneOrCamera: DesignBlockId): number;
3818
+ zoomToBlock(block: DesignBlockId, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): Promise<void>;
3819
+ zoomToBlockWithAnimation(block: DesignBlockId, paddingLeft: number, paddingTop: number, paddingRight: number, paddingBottom: number, duration: number, easing: string, interruptible: boolean): Promise<void>;
3820
+ immediateZoomToBlock(block: DesignBlockId, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): void;
3821
+ enableZoomAutoFit(scene: DesignBlockId, axis: string, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): void;
3822
+ disableZoomAutoFit(scene: DesignBlockId): void;
3823
+ isZoomAutoFitEnabled(scene: DesignBlockId): boolean;
3824
+ findNearestToViewPortCenterByType(scene: DesignBlockId, type: string): DesignBlockId[];
3825
+ findNearestToViewPortCenterByKind(scene: DesignBlockId, kind: string): DesignBlockId[];
3826
+ unstable_enableCameraPositionClamping(blocks: DesignBlockId[], paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number, scaledPaddingLeft?: number, scaledPaddingTop?: number, scaledPaddingRight?: number, scaledPaddingBottom?: number): void;
3827
+ unstable_disableCameraPositionClamping(block: DesignBlockId): void;
3828
+ unstable_isCameraPositionClampingEnabled(block: DesignBlockId): boolean;
3829
+ unstable_enableCameraZoomClamping(blocks: DesignBlockId[], minZoomLimit?: number, maxZoomLimit?: number, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): void;
3830
+ unstable_disableCameraZoomClamping(block: DesignBlockId): void;
3831
+ unstable_isCameraZoomClampingEnabled(block: DesignBlockId): boolean;
3832
+ exportToBuffer(block: DesignBlockId, mimeType: string, options?: Record<string, unknown>): Promise<Uint8Array>;
3833
+ exportWithColorMaskToBuffer(block: DesignBlockId, mimeType: string, maskColorR: number, maskColorG: number, maskColorB: number, options: {
3834
+ targetWidth: number;
3835
+ targetHeight: number;
3836
+ useTargetSize: boolean;
3837
+ jpegQuality: number;
3838
+ webpQuality: number;
3839
+ pngCompressionLevel: number;
3840
+ exportPdfWithHighCompatibility: boolean;
3841
+ exportPdfWithUnderlayer: boolean;
3842
+ underlayerSpotColorName: string;
3843
+ underlayerOffset: number;
3844
+ underlayerRenderRatio: number;
3845
+ underlayerMaxError: number;
3846
+ allowTextOverhang: boolean;
3847
+ }): Promise<Uint8Array[]>;
3848
+ exportVideoToBuffer(block: DesignBlockId, timeOffset: number, duration: number, mimeType: string, progressCallback: (rendered: number, encoded: number, total: number) => void, resultCallback: (error: Error | null, data?: Uint8Array) => void, options: {
3849
+ h264Profile: number;
3850
+ h264Level: number;
3851
+ videoBitrate: number;
3852
+ audioBitrate: number;
3853
+ framerate: number;
3854
+ useTargetSize: boolean;
3855
+ targetWidth: number;
3856
+ targetHeight: number;
3857
+ allowTextOverhang: boolean;
3858
+ }): void;
3859
+ exportAudioToBuffer(block: DesignBlockId, timeOffset: number, duration: number, mimeType: string, progressCallback: (rendered: number, encoded: number, total: number) => void, resultCallback: (error: Error | null, data?: Uint8Array) => void, options: {
3860
+ sampleRate: number;
3861
+ numberOfChannels: number;
3862
+ skipEncoding?: boolean;
3863
+ }): void;
3864
+ loadBlocksFromString(content: string): Promise<DesignBlockId[]>;
3865
+ loadBlocksFromURL(url: string): Promise<DesignBlockId[]>;
3866
+ loadBlocksFromArchiveURL(url: string): Promise<DesignBlockId[]>;
3867
+ saveBlocksToString(blocks: DesignBlockId[]): Promise<string>;
3868
+ saveBlocksToArchive(blocks: DesignBlockId[]): Promise<Uint8Array>;
3869
+ forceLoadAVResource(block: DesignBlockId): Promise<void>;
3870
+ forceLoadResources(blocks: DesignBlockId[]): Promise<void>;
3871
+ createHistory(): HistoryId;
3872
+ destroyHistory(history: HistoryId): void;
3873
+ getActiveHistory(): HistoryId;
3874
+ setActiveHistory(history: HistoryId): void;
3875
+ undo(): void;
3876
+ redo(): void;
3877
+ canUndo(): boolean;
3878
+ canRedo(): boolean;
3879
+ addUndoStep(): void;
3880
+ removeUndoStep(): void;
3881
+ subscribe(blocks: DesignBlockId[], callback: (events: BlockEvent[]) => void): SubscriptionId;
3882
+ unsubscribe(subscription: SubscriptionId): void;
3883
+ subscribeToZoomLevel(callback: () => void): SubscriptionId;
3884
+ subscribeToActiveSceneChange(callback: () => void): SubscriptionId;
3885
+ subscribeToBlockState(blocks: DesignBlockId[], callback: (ids: DesignBlockId[]) => void): SubscriptionId;
3886
+ subscribeToEditorState(callback: () => void): SubscriptionId;
3887
+ subscribeToSettings(callback: () => void): SubscriptionId;
3888
+ subscribeToSelectionChange(callback: () => void): SubscriptionId;
3889
+ subscribeToBlockClicked(callback: (id: DesignBlockId) => void): SubscriptionId;
3890
+ subscribeToHistoryWithKind(callback: (kind: number) => void): SubscriptionId;
3891
+ subscribeToRoleChange(callback: (role: string) => void): SubscriptionId;
3892
+ subscribeToAssetSourceAdded(callback: (sourceId: string) => void): SubscriptionId;
3893
+ subscribeToAssetSourceRemoved(callback: (sourceId: string) => void): SubscriptionId;
3894
+ subscribeToAssetSourceUpdated(callback: (sourceId: string) => void): SubscriptionId;
3895
+ addAssetSource(source: {
3896
+ id: string;
3897
+ findAssets: (query: AssetsQuery, resultCb: (error: any, result?: AssetsQueryResult) => void) => void;
3898
+ fetchAsset?: (id: string, params: {
3899
+ locale?: string;
3900
+ } | undefined, resultCb: (error: any, result?: AssetResult | null) => void) => void;
3901
+ getGroups?: (resultCb: (error: any, result?: string[]) => void) => void;
3902
+ credits?: {
3903
+ name: string;
3904
+ url?: string;
3905
+ };
3906
+ license?: {
3907
+ name: string;
3908
+ url?: string;
3909
+ };
3910
+ getSupportedMimeTypes?: () => string[] | undefined;
3911
+ applyAsset?: (asset: CompleteAssetResult, resultCb: (error: any, result?: DesignBlockId) => void) => void;
3912
+ applyAssetToBlock?: (asset: CompleteAssetResult, block: DesignBlockId, resultCb: (error: any) => void) => void;
3913
+ applyAssetProperty?: (asset: CompleteAssetResult, property: AssetProperty, resultCb: (error: any) => void) => void;
3914
+ addAsset?: (asset: AssetDefinition) => void;
3915
+ removeAsset?: (assetId: string) => void;
3916
+ }): void;
3917
+ addLocalAssetSource(id: string, supportedMimeTypes: string[]): void;
3918
+ addLocalAssetSourceFromJSONString(contentJSON: string, basePath?: string, matcher?: string[]): string;
3919
+ addLocalAssetSourceFromJSONURI(contentURI: string, matcher?: string[]): Promise<string>;
3920
+ removeAssetSource(id: string): void;
3921
+ findAllAssetSources(): string[];
3922
+ findAssetSourceAssets(sourceId: string, query: AssetsQuery): Promise<AssetsQueryResult>;
3923
+ fetchAssetSourceAsset(sourceId: string, assetId: string, query: {
3924
+ locale: string;
3925
+ }): Promise<CompleteAssetResult | null>;
3926
+ getAssetSourceGroups(sourceId: string): string[];
3927
+ getAssetSourceLicense(sourceId: string): AssetSourceLicense | null;
3928
+ getAssetSourceCredits(sourceId: string): AssetSourceCredits | null;
3929
+ getAssetSourceSupportedMimeTypes(sourceId: string): string[];
3930
+ addAssetToSource(sourceId: string, asset: Asset): void;
3931
+ removeAssetFromSource(sourceId: string, assetId: string): void;
3932
+ assetSourceContentsChanged(sourceId: string): void;
3933
+ applyAssetSourceAsset(sourceId: string, asset: CompleteAssetResult): Promise<DesignBlockId | undefined>;
3934
+ applyAssetSourceAssetToBlock(sourceId: string, asset: CompleteAssetResult, block: DesignBlockId): Promise<void>;
3935
+ applyAssetSourceProperty(sourceId: string, asset: CompleteAssetResult, property: AssetProperty): Promise<void>;
3936
+ defaultApplyAsset(asset: CompleteAssetResult): Promise<DesignBlockId | undefined>;
3937
+ defaultApplyAssetToBlock(asset: CompleteAssetResult, block: DesignBlockId): Promise<void>;
3938
+ setVariable(key: string, value: string): void;
3939
+ getVariable(key: string): string;
3940
+ findAllVariables(): string[];
3941
+ removeVariable(key: string): void;
3942
+ getVariableString(key: string): string;
3943
+ setVariableString(key: string, value: string): void;
3944
+ referencesAnyVariables(block: DesignBlockId): boolean;
3945
+ getEditMode(): string;
3946
+ setEditMode(mode: string): void;
3947
+ getSettingBool(key: string): boolean;
3948
+ setSettingBool(key: string, value: boolean): void;
3949
+ getSettingInt(key: string): number;
3950
+ setSettingInt(key: string, value: number): void;
3951
+ getSettingFloat(key: string): number;
3952
+ setSettingFloat(key: string, value: number): void;
3953
+ getSettingString(key: string): string;
3954
+ setSettingString(key: string, value: string): void;
3955
+ getSettingColor(key: string): NativeColorInternal;
3956
+ setSettingColor(key: string, value: NativeColorInternal): void;
3957
+ getSettingEnum(key: string): string;
3958
+ setSettingEnum(key: string, value: string): void;
3959
+ findAllSettings(): string[];
3960
+ getSettingType(key: string): string;
3961
+ getSettingEnumOptions(key: string): string[];
3962
+ getCursorType(): string;
3963
+ getCursorRotation(): number;
3964
+ setSafeAreaInsets(left: number, top: number, right: number, bottom: number): void;
3965
+ getSafeAreaInsets(): Insets;
3966
+ getUsedMemory(): number;
3967
+ getAvailableMemory(): number;
3968
+ convertColorToColorSpace(color: NativeColorInternal, colorSpace: number): NativeColorInternal;
3969
+ supportsP3(): boolean;
3970
+ getAbsoluteURI(relativeUri: string): Promise<string>;
3971
+ defaultURIResolver(relativePath: string): string;
3972
+ setURIResolver(resolver: (uri: string) => string): void;
3973
+ setURIResolverAsync(resolver: (uri: string, callback: (result: string | Error) => void) => void): void;
3974
+ getMimeType(uri: string): Promise<string>;
3975
+ relocateResource(currentUri: string, newUri: string): void;
3976
+ findAllMediaURIs(): string[];
3977
+ findAllTransientResources(): Array<{
3978
+ uri: string;
3979
+ size: number;
3980
+ }>;
3981
+ findAllSpotColors(): string[];
3982
+ getSpotColorRGB(name: string): RGBAColor;
3983
+ getSpotColorCMYK(name: string): CMYKColor;
3984
+ setSpotColorRGB(name: string, r: number, g: number, b: number): void;
3985
+ setSpotColorCMYK(name: string, c: number, m: number, y: number, k: number): void;
3986
+ removeSpotColor(name: string): void;
3987
+ createBuffer(): string;
3988
+ destroyBuffer(uri: string): void;
3989
+ setBufferData(uri: string, offset: number, data: Uint8Array): void;
3990
+ getBufferData(uri: string, offset: number, length: number): Uint8Array;
3991
+ getBufferLength(uri: string): number;
3992
+ setBufferLength(uri: string, length: number): void;
3993
+ }
3994
+ declare class CreativeEngine implements ICreativeEngine {
3995
+ #private;
3996
+ static readonly version: string;
3997
+ asset: AssetAPI;
3998
+ block: BlockAPI;
3999
+ editor: EditorAPI;
4000
+ event: EventAPI;
4001
+ scene: SceneAPI;
4002
+ variable: VariableAPI;
4003
+ readonly version: string;
4004
+ private constructor();
4005
+ /**
4006
+ * Update the engine's internal state
4007
+ * @returns Whether the engine needed an update.
4008
+ */
4009
+ update(): boolean;
4010
+ /**
4011
+ * Dispose the engine and clean up all resources
4012
+ */
4013
+ dispose(): void;
4014
+ /**
4015
+ * Initialize a CreativeEngine.
4016
+ *
4017
+ * Mirrors `@cesdk/node`'s {@link Configuration} shape exactly. The
4018
+ * native-only `device` field selects the render backend
4019
+ * (`'auto'` | `'cpu'` | `'gpu'`); web/WASM Node accept the field for shape
4020
+ * parity but ignore non-`'auto'` values.
4021
+ *
4022
+ * @param config - Engine configuration. All fields optional; defaults
4023
+ * match `@cesdk/node` + `'auto'` device selection.
4024
+ * @returns A ready-to-use engine instance.
4025
+ * @public
4026
+ */
4027
+ static init(config?: Partial<Configuration>): Promise<CreativeEngine>;
4028
+ /**
4029
+ * Get the base URL for engine assets
4030
+ */
4031
+ getBaseURL(): string;
4032
+ /**
4033
+ * Register a set of default asset sources containing default assets.
4034
+ *
4035
+ * Mirrors `@cesdk/node`'s instance method
4036
+ * (bindings/wasm/js_node/src/CreativeEngine.ts). Loads
4037
+ * `${baseURL}/<source-id>/content.json` for each id in the default set
4038
+ * and registers the contents as a local asset source. baseURL defaults
4039
+ * to the engine's configured baseURL (`file://<addon>/assets/` if none
4040
+ * was passed to init).
4041
+ *
4042
+ * @public
4043
+ */
4044
+ addDefaultAssetSources({ baseURL, excludeAssetSourceIds }?: {
4045
+ baseURL?: string;
4046
+ excludeAssetSourceIds?: DefaultAssetSourceId[];
4047
+ }): Promise<void>;
4048
+ /**
4049
+ * Register a set of demo asset sources containing example assets.
4050
+ *
4051
+ * Mirrors `@cesdk/node`'s `bindings/wasm/js_web/src/addDemoAssetSources.ts`
4052
+ * — accepts `sceneMode`, `withUploadAssetSources`, and the full demo
4053
+ * source-ID union (templates + textComponents + uploads + media).
4054
+ *
4055
+ * @public
4056
+ */
4057
+ addDemoAssetSources({ baseURL, excludeAssetSourceIds, sceneMode, withUploadAssetSources }?: {
4058
+ baseURL?: string;
4059
+ excludeAssetSourceIds?: DemoAssetSourceId[];
4060
+ sceneMode?: "Design" | "Video";
4061
+ withUploadAssetSources?: boolean;
4062
+ }): Promise<void>;
4063
+ }
4064
+
4065
+ export {
4066
+ CreativeEngine as default,
4067
+ MimeType as MimeTypeString,
4068
+ TextHorizontalAlignment as HorizontalTextAlignment,
4069
+ TextVerticalAlignment as VerticalTextAlignment,
4070
+ };
4071
+
4072
+ export {};