@cesdk/cesdk-js 1.6.1 → 1.7.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -3,27 +3,27 @@
3
3
  * @public
4
4
  */
5
5
  declare type A11y = {
6
- /**
7
- * The option define a level of heading to start from (in a range 1-6)
8
- */
9
- headingsHierarchyStart: 1 | 2 | 3 | 4 | 5 | 6;
6
+ /**
7
+ * The option define a level of heading to start from (in a range 1-6)
8
+ */
9
+ headingsHierarchyStart: 1 | 2 | 3 | 4 | 5 | 6;
10
10
  };
11
11
 
12
12
  /** @public */
13
13
  export declare class API {
14
- block: BlockAPI;
15
- scene: SceneAPI;
16
- event: EventAPI;
17
- variable: VariableAPI;
18
- editor: EditorAPI;
14
+ block: BlockAPI;
15
+ scene: SceneAPI;
16
+ event: EventAPI;
17
+ variable: VariableAPI;
18
+ editor: EditorAPI;
19
19
  }
20
20
 
21
21
  /** @public */
22
22
  export declare interface _AssetElement {
23
- id: string;
24
- name: string;
25
- uri: string;
26
- thumbUri: string;
23
+ id: string;
24
+ name: string;
25
+ uri: string;
26
+ thumbUri: string;
27
27
  }
28
28
 
29
29
  /**
@@ -31,41 +31,41 @@ export declare interface _AssetElement {
31
31
  * @public
32
32
  */
33
33
  declare interface AssetResult {
34
- /** A unique id of this asset */
35
- id: string;
36
- /** E.g. `ly.img.image` */
37
- type: string;
38
- /** URI to a thumbnail of the asset used e.g. in the content library UI */
39
- thumbUri: string;
40
- /** Original size of the asset. */
41
- size: {
42
- width: number;
43
- height: number;
44
- };
45
- /** Asset-specific and custom meta information */
46
- meta?: {
47
- uri?: string;
48
- filename?: string;
49
- } & Record<string, unknown>;
50
- /** The locale of the label and tags */
51
- locale?: string;
52
- /** The label of the result. Used for description and tooltips. */
53
- label?: string;
54
- /** The tags of this asset. Used for filtering and free-text searching. */
55
- tags?: string[];
56
- context: {
57
- sourceId: string;
58
- };
59
- /** Credits for the artist of the asset */
60
- credits?: {
61
- name: string;
62
- url?: string;
63
- };
64
- /** License for this asset. Overwrites the source license if present */
65
- license?: {
66
- name: string;
67
- url?: string;
68
- };
34
+ /** A unique id of this asset */
35
+ id: string;
36
+ /** E.g. `ly.img.image` */
37
+ type: string;
38
+ /** URI to a thumbnail of the asset used e.g. in the content library UI */
39
+ thumbUri: string;
40
+ /** Original size of the asset. */
41
+ size: {
42
+ width: number;
43
+ height: number;
44
+ };
45
+ /** Asset-specific and custom meta information */
46
+ meta?: {
47
+ uri?: string;
48
+ filename?: string;
49
+ } & Record<string, unknown>;
50
+ /** The locale of the label and tags */
51
+ locale?: string;
52
+ /** The label of the result. Used for description and tooltips. */
53
+ label?: string;
54
+ /** The tags of this asset. Used for filtering and free-text searching. */
55
+ tags?: string[];
56
+ context: {
57
+ sourceId: string;
58
+ };
59
+ /** Credits for the artist of the asset */
60
+ credits?: {
61
+ name: string;
62
+ url?: string;
63
+ };
64
+ /** License for this asset. Overwrites the source license if present */
65
+ license?: {
66
+ name: string;
67
+ url?: string;
68
+ };
69
69
  }
70
70
 
71
71
  /**
@@ -73,36 +73,33 @@ declare interface AssetResult {
73
73
  * @public
74
74
  */
75
75
  declare interface AssetSource {
76
- /** The asset types returned by this source. Will default to ['ly.img.image']. */
77
- types?: string[];
78
- /** Find all asset for the given type and the provided query data. */
79
- findAssets(
80
- type: string,
81
- queryData?: QueryData
82
- ): Promise<AssetsQueryResult | undefined>;
83
- /**
84
- * Indicates if the asset shall be downloaded to handle the raw data instead
85
- * of an URL reference. Do this if you do not want to depend on
86
- * a service after adding the asset to the scene. If this is your own API
87
- * with your own service, you do not need to set this and avoid downloading /
88
- * re-uploading the assets.
89
- */
90
- downloadAssets?: (asset: AssetResult) => Promise<Blob>;
91
- /** Credits for the source/api */
92
- credits?: {
93
- name: string;
94
- url?: string;
95
- };
96
- /** General license for all asset from this source */
97
- license?: {
98
- name: string;
99
- url?: string;
100
- };
76
+ /** The asset types returned by this source. Will default to ['ly.img.image']. */
77
+ types?: string[];
78
+ /** Find all asset for the given type and the provided query data. */
79
+ findAssets(type: string, queryData?: QueryData): Promise<AssetsQueryResult | undefined>;
80
+ /**
81
+ * Indicates if the asset shall be downloaded to handle the raw data instead
82
+ * of an URL reference. Do this if you do not want to depend on
83
+ * a service after adding the asset to the scene. If this is your own API
84
+ * with your own service, you do not need to set this and avoid downloading /
85
+ * re-uploading the assets.
86
+ */
87
+ downloadAssets?: (asset: AssetResult) => Promise<Blob>;
88
+ /** Credits for the source/api */
89
+ credits?: {
90
+ name: string;
91
+ url?: string;
92
+ };
93
+ /** General license for all asset from this source */
94
+ license?: {
95
+ name: string;
96
+ url?: string;
97
+ };
101
98
  }
102
99
 
103
100
  /** @public */
104
101
  declare type AssetSources = {
105
- [id: string]: AssetSource;
102
+ [id: string]: AssetSource;
106
103
  };
107
104
 
108
105
  /**
@@ -110,52 +107,36 @@ declare type AssetSources = {
110
107
  * @public
111
108
  */
112
109
  declare interface AssetsQueryResult {
113
- /** The assets in the requested page */
114
- assets: AssetResult[];
115
- /** The current, requested page */
116
- currentPage: number;
117
- /** The next page to query if it exists */
118
- nextPage?: number;
119
- /** How many assets are there in total for the current query regardless of the page */
120
- total: number;
110
+ /** The assets in the requested page */
111
+ assets: AssetResult[];
112
+ /** The current, requested page */
113
+ currentPage: number;
114
+ /** The next page to query if it exists */
115
+ nextPage?: number;
116
+ /** How many assets are there in total for the current query regardless of the page */
117
+ total: number;
121
118
  }
122
119
 
123
120
  /**
124
121
  * Bleed margin configuration options for a single design unit type.
122
+ * @public
125
123
  */
126
124
  declare interface BleedMarginOptions {
127
- /**
128
- * The bleed margin options that can be selected from a dropdown in the UI.
129
- * Other bleed margin values can be entered directly using the input field.
130
- */
131
- dropdownOptions: number[];
132
- /**
133
- * The default bleed margin value.
134
- */
135
- defaultBleedMargin: number;
125
+ /**
126
+ * The bleed margin options that can be selected from a dropdown in the UI.
127
+ * Other bleed margin values can be entered directly using the input field.
128
+ */
129
+ dropdownOptions: number[];
130
+ /**
131
+ * The default bleed margin value.
132
+ */
133
+ defaultBleedMargin: number;
136
134
  }
137
135
 
138
136
  /**
139
137
  * @public
140
138
  */
141
- export declare type BlendMode =
142
- | 'PassThrough'
143
- | 'Normal'
144
- | 'Darken'
145
- | 'Multiply'
146
- | 'ColorBurn'
147
- | 'Lighten'
148
- | 'Screen'
149
- | 'ColorDodge'
150
- | 'Overlay'
151
- | 'SoftLight'
152
- | 'HardLight'
153
- | 'Difference'
154
- | 'Exclusion'
155
- | 'Hue'
156
- | 'Saturation'
157
- | 'Color'
158
- | 'Luminosity';
139
+ export declare type BlendMode = 'PassThrough' | 'Normal' | 'Darken' | 'Multiply' | 'ColorBurn' | 'Lighten' | 'Screen' | 'ColorDodge' | 'Overlay' | 'SoftLight' | 'HardLight' | 'Difference' | 'Exclusion' | 'Hue' | 'Saturation' | 'Color' | 'Luminosity';
159
140
 
160
141
  /** @public */
161
142
  declare type Block = number;
@@ -164,1046 +145,996 @@ declare type Block = number;
164
145
  * @public
165
146
  */
166
147
  export declare class BlockAPI {
167
- #private;
168
-
169
- /**
170
- * Exports a design block element as a file of the given mime type.
171
- * Performs an internal update to resolve the final layout for the blocks.
172
- * @param handle - The design block element to export.
173
- * @param mimeType - The mime type of the output file.
174
- * @returns A promise that resolves with the exported image or is rejected with an error.
175
- */
176
- export(handle: DesignBlockId, mimeType?: MimeType_2): Promise<Blob>;
177
-
178
- /**
179
- * Loads existing blocks from the given string.
180
- * The blocks are not attached by default and won't be visible until attached to a page or the scene.
181
- * @param content - A string representing the given blocks.
182
- * @returns A promise that resolves with a list of handles representing the found blocks or an error.
183
- */
184
- loadFromString(content: string): Promise<DesignBlockId[]>;
185
- /**
186
- * Saves the given blocks into a string. If given the root of a block hierarchy, e.g. a
187
- * page with multiple children, the entire hierarchy is saved.
188
- * @param blocks - The blocks to save
189
- * @returns A promise that resolves to a string representing the blocks or an error.
190
- */
191
- saveToString(blocks: DesignBlockId[]): Promise<string>;
192
- /**
193
- * Create a new block, fails if type is unknown.
194
- * @param type - The type of the block that shall be created.
195
- * @returns The created blocks handle.
196
- */
197
- create(type: DesignBlockType): DesignBlockId;
198
-
199
- /**
200
- * Get the type of the given block, fails if the block is invalid.
201
- * @param id - The block to query.
202
- * @returns The blocks type.
203
- */
204
- getType(id: DesignBlockId): DesignBlockType;
205
- /**
206
- * Update the selection state of a block.
207
- * Fails for invalid blocks.
208
- * @param id - The block to query.
209
- * @param selected - Whether or not the block should be selected.
210
- */
211
- setSelected(id: DesignBlockId, selected: boolean): void;
212
- /**
213
- * Get the selected state of a block.
214
- * @param id - The block to query.
215
- * @returns True if the block is selected, false otherwise.
216
- */
217
- isSelected(id: DesignBlockId): boolean;
218
- /**
219
- * Get all currently selected blocks.
220
- * @returns An array of block ids.
221
- */
222
- findAllSelected(): DesignBlockId[];
223
- /**
224
- * Confirms that a given set of blocks can be grouped together.
225
- * @param ids - A non-empty array of block ids.
226
- * @returns Whether the blocks can be grouped together.
227
- */
228
- isGroupable(ids: DesignBlockId[]): boolean;
229
- /**
230
- * Group blocks together.
231
- * @param ids - A non-empty array of block ids.
232
- * @returns The block id of the created group.
233
- */
234
- group(ids: DesignBlockId[]): DesignBlockId;
235
- /**
236
- * Ungroups a group.
237
- * @param id - The group id from a previous call to `group`.
238
- */
239
- ungroup(id: DesignBlockId): void;
240
- /**
241
- * Changes selection from selected group to a block within that group.
242
- * Nothing happens if `group` is not a group.
243
- * @param id - The group id from a previous call to `group`.
244
- */
245
- enterGroup(id: DesignBlockId): void;
246
- /**
247
- * Changes selection from a group's selected block to that group.
248
- * Nothing happens if the `id` is not part of a group.
249
- * @param id - A block id.
250
- */
251
- exitGroup(id: DesignBlockId): void;
252
- /**
253
- * Update a block's name.
254
- * @param id - The block to update.
255
- * @param name - The name to set.
256
- */
257
- setName(id: DesignBlockId, name: string): void;
258
- /**
259
- * Get a block's name.
260
- * @param id - The block to update.
261
- */
262
- getName(id: DesignBlockId): string;
263
- /**
264
- * Finds all blocks with the given name.
265
- * @param name - The name to search for.
266
- * @returns A list of block ids.
267
- */
268
- findByName(name: string): DesignBlockId[];
269
- /**
270
- * Finds all blocks with the given type.
271
- * @param type - The type to search for.
272
- * @returns A list of block ids.
273
- */
274
- findByType(type: DesignBlockType): DesignBlockId[];
275
- /**
276
- * Return all blocks currently known to the engine.
277
- * @returns A list of block ids.
278
- */
279
- findAll(): DesignBlockId[];
280
- /**
281
- * Return all placeholder blocks in the current scene.
282
- * @returns A list of block ids.
283
- */
284
- findAllPlaceholders(): DesignBlockId[];
285
- /**
286
- * Query a block's visibility.
287
- * @param id - The block to query.
288
- * @returns True if visible, false otherwise.
289
- */
290
- isVisible(id: DesignBlockId): boolean;
291
- /**
292
- * Update a block's visibility.
293
- * @param id - The block to update.
294
- * @param visible - Whether the block shall be visible.
295
- */
296
- setVisible(id: DesignBlockId, visible: boolean): void;
297
- /**
298
- * Query a block's clipped state. If true, the block should clip
299
- * its contents to its frame.
300
- * @param id - The block to query.
301
- * @returns True if clipped, false otherwise.
302
- */
303
- isClipped(id: DesignBlockId): boolean;
304
- /**
305
- * Update a block's clipped state.
306
- * @param id - The block to update.
307
- * @param clipped - Whether the block should clips its contents to its frame.
308
- */
309
- setClipped(id: DesignBlockId, clipped: boolean): void;
310
- /**
311
- * Query a block's x position.
312
- * @param id - The block to query.
313
- * @returns The value of the x position.
314
- */
315
- getPositionX(id: DesignBlockId): number;
316
- /**
317
- * Query a block's mode for its x position.
318
- * @param id - The block to query.
319
- * @returns The current mode for the x position: absolute, percent or undefined.
320
- */
321
- getPositionXMode(id: DesignBlockId): PositionMode;
322
- /**
323
- * Query a block's y position.
324
- * @param id - The block to query.
325
- * @returns The value of the y position.
326
- */
327
- getPositionY(id: DesignBlockId): number;
328
- /**
329
- * Query a block's mode for its y position.
330
- * @param id - The block to query.
331
- * @returns The current mode for the y position: absolute, percent or undefined.
332
- */
333
- getPositionYMode(id: DesignBlockId): PositionMode;
334
- /**
335
- * Update a block's x position.
336
- * The position refers to the block's local space, relative to its parent with the origin at the top left.
337
- * @param id - The block to update.
338
- * @param value - The value of the x position.
339
- */
340
- setPositionX(id: DesignBlockId, value: number): void;
341
- /**
342
- * Set a block's mode for its x position.
343
- * @param id - The block to update.
344
- * @param mode - The x position mode: absolute, percent or undefined.
345
- */
346
- setPositionXMode(id: DesignBlockId, mode: PositionMode): void;
347
- /**
348
- * Update a block's y position.
349
- * The position refers to the block's local space, relative to its parent with the origin at the top left.
350
- * @param id - The block to update.
351
- * @param value - The value of the y position.
352
- */
353
- setPositionY(id: DesignBlockId, value: number): void;
354
- /**
355
- * Set a block's mode for its y position.
356
- * @param id - The block to update.
357
- * @param mode - The y position mode: absolute, percent or undefined.
358
- */
359
- setPositionYMode(id: DesignBlockId, mode: PositionMode): void;
360
- /**
361
- * Query a block's rotation in radians.
362
- * @param id - The block to query.
363
- * @returns The block's rotation around its center in radians.
364
- */
365
- getRotation(id: DesignBlockId): number;
366
- /**
367
- * Update a block's rotation.
368
- * @param id - The block to update.
369
- * @param radians - The new rotation in radians. Rotation is applied around the block's center.
370
- */
371
- setRotation(id: DesignBlockId, radians: number): void;
372
- /**
373
- * Query a block's horizontal flip state.
374
- * @param id - The block to query.
375
- * @returns A boolean indicating for whether the block is flipped in the queried direction
376
- */
377
- getFlipHorizontal(id: DesignBlockId): boolean;
378
- /**
379
- * Query a block's vertical flip state.
380
- * @param id - The block to query.
381
- * @returns A boolean indicating for whether the block is flipped in the queried direction
382
- */
383
- getFlipVertical(id: DesignBlockId): boolean;
384
- /**
385
- * Update a block's horizontal flip.
386
- * @param id - The block to update.
387
- * @param flip - If the flip should be enabled.
388
- */
389
- setFlipHorizontal(id: DesignBlockId, flip: boolean): void;
390
- /**
391
- * Update a block's vertical flip.
392
- * @param id - The block to update.
393
- * @param flip - If the flip should be enabled.
394
- */
395
- setFlipVertical(id: DesignBlockId, flip: boolean): void;
396
- /**
397
- * Query a block's width.
398
- * @param id - The block to query.
399
- * @returns The value of the block's width.
400
- */
401
- getWidth(id: DesignBlockId): number;
402
- /**
403
- * Query a block's mode for its width.
404
- * @param id - The block to query.
405
- * @returns The current mode for the width: absolute, percent or auto.
406
- */
407
- getWidthMode(id: DesignBlockId): SizeMode;
408
- /**
409
- * Query a block's height.
410
- * @param id - The block to query.
411
- * @returns The value of the block's height.
412
- */
413
- getHeight(id: DesignBlockId): number;
414
- /**
415
- * Query a block's mode for its height.
416
- * @param id - The block to query.
417
- * @returns The current mode for the height: absolute, percent or auto.
418
- */
419
- getHeightMode(id: DesignBlockId): SizeMode;
420
- /**
421
- * Query a block's content fill mode.
422
- * @param id - The block to query.
423
- * @returns The current mode: crop, cover or contain.
424
- */
425
- getContentFillMode(id: DesignBlockId): ContentFillMode;
426
- /**
427
- * Update a block's width.
428
- * @param id - The block to update.
429
- * @param value - The new width of the block.
430
- */
431
- setWidth(id: DesignBlockId, value: number): void;
432
- /**
433
- * Set a block's mode for its width.
434
- * @param id - The block to update.
435
- * @param mode - The width mode: absolute, percent or auto.
436
- */
437
- setWidthMode(id: DesignBlockId, mode: SizeMode): void;
438
- /**
439
- * Update a block's height.
440
- * @param id - The block to update.
441
- * @param value - The new height of the block.
442
- */
443
- setHeight(id: DesignBlockId, value: number): void;
444
- /**
445
- * Set a block's mode for its height.
446
- * @param id - The block to update.
447
- * @param mode - The height mode: absolute, percent or auto.
448
- */
449
- setHeightMode(id: DesignBlockId, mode: SizeMode): void;
450
- /**
451
- * Set a block's content fill mode.
452
- * @param id - The block to update.
453
- * @param mode - The content fill mode mode: crop, cover or contain.
454
- */
455
- setContentFillMode(id: DesignBlockId, mode: ContentFillMode): void;
456
- /**
457
- * Get a block's layouted width. The layouted width is only available after an
458
- * internal update loop, which may not happen immediately.
459
- * @param id - The block to query.
460
- * @returns The layouted width.
461
- */
462
- getFrameWidth(id: DesignBlockId): number;
463
- /**
464
- * Get a block's layouted height. The layouted height is only available after an
465
- * internal update loop, which may not happen immediately.
466
- * @param id - The block to query.
467
- * @returns The layouted height.
468
- */
469
- getFrameHeight(id: DesignBlockId): number;
470
- /**
471
- * Duplicates a block including its children.
472
- * @param id - The block to duplicate.
473
- * @returns The handle of the duplicate.
474
- */
475
- duplicate(id: DesignBlockId): DesignBlockId;
476
- /**
477
- * Destroys a block.
478
- * @param id - The block to destroy.
479
- */
480
- destroy(id: DesignBlockId): void;
481
- /**
482
- * Check if a block is valid. A block becomes invalid once it has been destroyed.
483
- * @param id - The block to query.
484
- * @returns True, if the block is valid.
485
- */
486
- isValid(id: DesignBlockId): boolean;
487
- /**
488
- * Query a block's parent.
489
- * @param id - The block to query.
490
- * @returns The parent's handle.
491
- */
492
- getParent(id: DesignBlockId): DesignBlockId;
493
- /**
494
- * Get all children of the given block. Children
495
- * are sorted in their rendering order: Last child is rendered
496
- * in front of other children.
497
- * @param id - The block to query.
498
- * @returns A list of block ids.
499
- */
500
- getChildren(id: DesignBlockId): DesignBlockId[];
501
- /**
502
- * Insert a new or existing child at a certain position in the parent's children.
503
- * @param parent - The block whose children should be updated.
504
- * @param child - The child to insert. Can be an existing child of `parent`.
505
- * @param index - The index to insert or move to.
506
- */
507
- insertChild(parent: DesignBlockId, child: DesignBlockId, index: number): void;
508
- /**
509
- * Appends a new or existing child to a block's children.
510
- * @param parent - The block whose children should be updated.
511
- * @param child - The child to insert. Can be an existing child of `parent`.
512
- */
513
- appendChild(parent: DesignBlockId, child: DesignBlockId): void;
514
- /** Checks whether the given block references any variables. Doesn't check the block's children.
515
- *
516
- * @param id - The block to inspect.
517
- * @returns true if the block references variables and false otherwise.
518
- */
519
- referencesAnyVariables(id: DesignBlockId): boolean;
520
- /**
521
- * Get the x position of the block's axis-aligned bounding box in the scene's global coordinate space.
522
- * The scene's global coordinate space has its origin at the top left.
523
- * @param id - The block whose bounding box should be calculated.
524
- * @returns float The x coordinate of the position of the axis-aligned bounding box.
525
- */
526
- getGlobalBoundingBoxX(id: DesignBlockId): number;
527
- /**
528
- * Get the y position of the block's axis-aligned bounding box in the scene's global coordinate space.
529
- * The scene's global coordinate space has its origin at the top left.
530
- * @param id - The block whose bounding box should be calculated.
531
- * @returns float The y coordinate of the position of the axis-aligned bounding box.
532
- */
533
- getGlobalBoundingBoxY(id: DesignBlockId): number;
534
- /**
535
- * Get the width of the block's axis-aligned bounding box in the scene's global coordinate space.
536
- * The scene's global coordinate space has its origin at the top left.
537
- * @param id - The block whose bounding box should be calculated.
538
- * @returns float The width of the axis-aligned bounding box.
539
- */
540
- getGlobalBoundingBoxWidth(id: DesignBlockId): number;
541
- /**
542
- * Get the height of the block's axis-aligned bounding box in the scene's global coordinate space.
543
- * The scene's global coordinate space has its origin at the top left.
544
- * @param id - The block whose bounding box should be calculated.
545
- * @returns float The height of the axis-aligned bounding box.
546
- */
547
- getGlobalBoundingBoxHeight(id: DesignBlockId): number;
548
- /**
549
- * Scales the block and all of its children proportionally around the specified
550
- * relative anchor point.
551
- *
552
- * This updates the position, size and style properties (e.g. stroke width) of
553
- * the block and its children.
554
- *
555
- * @param id - The block that should be scaled.
556
- * @param scale - The scale factor to be applied to the current properties of the block.
557
- * @param anchorX - The relative position along the width of the block around which the
558
- * scaling should occur. (0 = left edge, 0.5 = center, 1 = right edge)
559
- * @param anchorY - The relative position along the height of the block around which the
560
- * scaling should occur. (0 = top edge, 0.5 = center, 1 = bottom edge)
561
- */
562
- scale(
563
- id: DesignBlockId,
564
- scale: number,
565
- anchorX?: number,
566
- anchorY?: number
567
- ): void;
568
- /**
569
- * Get all available properties of a block.
570
- * @param id - The block whose properties should be queried.
571
- * @returns A list of the property names.
572
- */
573
- findAllProperties(id: DesignBlockId): string[];
574
- /**
575
- * Get the type of a property given its name.
576
- * @param property - The name of the property whose type should be queried.
577
- * @returns The property type.
578
- */
579
- getPropertyType(property: string): PropertyType;
580
- /**
581
- * Get all the possible values of an enum given an enum property.
582
- * @param enumProperty - The name of the property whose enum values should be queried.
583
- * @returns A list of the enum value names as string.
584
- */
585
- getEnumValues<T = string>(enumProperty: string): T[];
586
- /**
587
- * Set a bool property of the given design block to the given value.
588
- * @param id - The block whose property should be set.
589
- * @param property - The name of the property to set.
590
- * @param value - The value to set.
591
- */
592
- setBool(id: DesignBlockId, property: string, value: boolean): void;
593
- /**
594
- * Get the value of a bool property of the given design block.
595
- * @param id - The block whose property should be queried.
596
- * @param property - The name of the property to query.
597
- * @returns The value of the property.
598
- */
599
- getBool(id: DesignBlockId, property: string): boolean;
600
- /**
601
- * Set an int property of the given design block to the given value.
602
- * @param id - The block whose property should be set.
603
- * @param property - The name of the property to set.
604
- * @param value - The value to set.
605
- */
606
- setInt(id: DesignBlockId, property: string, value: number): void;
607
- /**
608
- * Get the value of an int property of the given design block.
609
- * @param id - The block whose property should be queried.
610
- * @param property - The name of the property to query.
611
- * @returns The value of the property.
612
- */
613
- getInt(id: DesignBlockId, property: string): number;
614
- /**
615
- * Set a float property of the given design block to the given value.
616
- * @param id - The block whose property should be set.
617
- * @param property - The name of the property to set.
618
- * @param value - The value to set.
619
- */
620
- setFloat(id: DesignBlockId, property: string, value: number): void;
621
- /**
622
- * Get the value of a float property of the given design block.
623
- * @param id - The block whose property should be queried.
624
- * @param property - The name of the property to query.
625
- * @returns The value of the property.
626
- */
627
- getFloat(id: DesignBlockId, property: string): number;
628
- /**
629
- * Set a string property of the given design block to the given value.
630
- * @param id - The block whose property should be set.
631
- * @param property - The name of the property to set.
632
- * @param value - The value to set.
633
- */
634
- setString(id: DesignBlockId, property: string, value: string): void;
635
- /**
636
- * Get the value of a string property of the given design block.
637
- * @param id - The block whose property should be queried.
638
- * @param property - The name of the property to query.
639
- * @returns The value of the property.
640
- */
641
- getString(id: DesignBlockId, property: string): string;
642
- /**
643
- * Set a color property of the given design block to the given value.
644
- * @param id - The block whose property should be set.
645
- * @param property - The name of the property to set.
646
- * @param r - The red color component in the range of 0 to 1.
647
- * @param g - The green color component in the range of 0 to 1.
648
- * @param b - The blue color component in the range of 0 to 1.
649
- * @param a - The alpha color component in the range of 0 to 1.
650
- */
651
- setColorRGBA(
652
- id: DesignBlockId,
653
- property: string,
654
- r: number,
655
- g: number,
656
- b: number,
657
- a: number
658
- ): void;
659
- /**
660
- * Get the value of a string property of the given design block.
661
- * @param id - The block whose property should be queried.
662
- * @param property - The name of the property to query.
663
- * @returns A tuple of channels red, green, blue and alpha in the range of 0 to 1.
664
- */
665
- getColorRGBA(id: DesignBlockId, property: string): RGBA;
666
- /**
667
- * Set an enum property of the given design block to the given value.
668
- * @param id - The block whose property should be set.
669
- * @param property - The name of the property to set.
670
- * @param value - The enum value as string.
671
- */
672
- setEnum(id: DesignBlockId, property: string, value: string): void;
673
- /**
674
- * Get the value of an enum property of the given design block.
675
- * @param id - The block whose property should be queried.
676
- * @param property - The name of the property to query.
677
- * @returns The value as string.
678
- */
679
- getEnum(id: DesignBlockId, property: string): string;
680
- /**
681
- * Query if the given block has crop properties.
682
- * @param id - The block to query.
683
- * @returns true, if the block has crop properties.
684
- */
685
- hasCrop(id: DesignBlockId): boolean;
686
- /**
687
- * Set the crop scale in x direction of the given design block.
688
- * @param id - The block whose crop should be set.
689
- * @param scaleX - The scale in x direction.
690
- */
691
- setCropScaleX(id: DesignBlockId, scaleX: number): void;
692
- /**
693
- * Set the crop scale in y direction of the given design block.
694
- * @param id - The block whose crop should be set.
695
- * @param scaleY - The scale in y direction.
696
- */
697
- setCropScaleY(id: DesignBlockId, scaleY: number): void;
698
- /**
699
- * Set the crop rotation of the given design block.
700
- * @param id - The block whose crop should be set.
701
- * @param rotation - The rotation in radians.
702
- */
703
- setCropRotation(id: DesignBlockId, rotation: number): void;
704
- /**
705
- * Set the crop translation in x direction of the given design block.
706
- * @param id - The block whose crop should be set.
707
- * @param translationY - The translation in y direction.
708
- */
709
- setCropTranslationX(id: DesignBlockId, translationX: number): void;
710
- /**
711
- * Set the crop translation in y direction of the given design block.
712
- * @param id - The block whose crop should be set.
713
- * @param translationY - The translation in y direction.
714
- */
715
- setCropTranslationY(id: DesignBlockId, translationY: number): void;
716
- /**
717
- * Resets the manually set crop of the given design block.
718
- * The block's content fill mode is set to 'cover'.
719
- * @param id - The block whose crop should be reset.
720
- */
721
- resetCrop(id: DesignBlockId): void;
722
- /**
723
- * Get the crop scale on the x axis of the given design block.
724
- * @param id - The block whose scale should be queried.
725
- * @returns The scale on the x axis.
726
- */
727
- getCropScaleX(id: DesignBlockId): number;
728
- /**
729
- * Get the crop scale on the y axis of the given design block.
730
- * @param id - The block whose scale should be queried.
731
- * @returns The scale on the y axis.
732
- */
733
- getCropScaleY(id: DesignBlockId): number;
734
- /**
735
- * Get the crop rotation of the given design block.
736
- * @param id - The block whose crop rotation should be queried.
737
- * @returns The crop rotation.
738
- */
739
- getCropRotation(id: DesignBlockId): number;
740
- /**
741
- * Get the crop translation on the x axis of the given design block.
742
- * @param id - The block whose translation should be queried.
743
- * @returns The translation on the x axis.
744
- */
745
- getCropTranslationX(id: DesignBlockId): number;
746
- /**
747
- * Get the crop translation on the y axis of the given design block.
748
- * @param id - The block whose translation should be queried.
749
- * @returns The translation on the y axis.
750
- */
751
- getCropTranslationY(id: DesignBlockId): number;
752
- /**
753
- * Query if the given block has an opacity.
754
- * @param id - The block to query.
755
- * @returns true, if the block has an opacity.
756
- */
757
- hasOpacity(id: DesignBlockId): boolean;
758
- /**
759
- * Set the opacity of the given design block.
760
- * @param id - The block whose opacity should be set.
761
- * @param opacity - The opacity to be set. The valid range is 0 to 1.
762
- */
763
- setOpacity(id: DesignBlockId, opacity: number): void;
764
- /**
765
- * Get the opacity of the given design block.
766
- * @param id - The block whose opacity should be queried.
767
- * @returns The opacity.
768
- */
769
- getOpacity(id: DesignBlockId): number;
770
- /**
771
- * Set the blend mode of the given design block.
772
- * @param id - The block whose blend mode should be set.
773
- * @param blendMode - The blend mode to be set.
774
- * @returns
775
- */
776
- setBlendMode(id: DesignBlockId, blendMode: BlendMode): void;
777
- /**
778
- * Get the blend mode of the given design block.
779
- * @param id - The block whose blend mode should be queried.
780
- * @returns The blend mode.
781
- */
782
- getBlendMode(id: DesignBlockId): BlendMode;
783
- /**
784
- * Query if the given block has fill color properties.
785
- * @param id - The block to query.
786
- * @returns true, if the block has fill color properties.
787
- */
788
- hasFillColor(id: DesignBlockId): boolean;
789
- /**
790
- * Set the fill color of the given design block.
791
- * @param id - The block whose fill color should be set.
792
- * @param color - The fill color to be set, a tuple of
793
- * @param r - The red color component in the range of 0 to 1.
794
- * @param g - The green color component in the range of 0 to 1.
795
- * @param b - The blue color component in the range of 0 to 1.
796
- * @param a - The alpha color component in the range of 0 to 1.
797
- */
798
- setFillColorRGBA(
799
- id: DesignBlockId,
800
- r: number,
801
- g: number,
802
- b: number,
803
- a: number
804
- ): void;
805
- /**
806
- * Get the fill color of the given design block.
807
- * @param id - The block whose fill color should be queried.
808
- * @returns The fill color.
809
- */
810
- getFillColorRGBA(id: DesignBlockId): RGBA;
811
- /**
812
- * Enable or disable the fill of the given design block.
813
- * @param id - The block whose fill should be enabled or disabled.
814
- * @param enabled - If true, the fill will be enabled.
815
- */
816
- setFillColorEnabled(id: DesignBlockId, enabled: boolean): void;
817
- /**
818
- * Query if the fill of the given design block is enabled.
819
- * @param id - The block whose fill state should be queried.
820
- * @returns True, if fill is enabled.
821
- */
822
- isFillColorEnabled(id: DesignBlockId): boolean;
823
- /**
824
- * Query if the given block has background color properties.
825
- * @param id - The block to query.
826
- * @returns true, if the block has background color properties.
827
- */
828
- hasBackgroundColor(id: DesignBlockId): boolean;
829
- /**
830
- * Set the background color of the given design block.
831
- * @param id - The block whose background color should be set.
832
- * @param color - The background color to be set, a tuple of
833
- * @param r - The red color component in the range of 0 to 1.
834
- * @param g - The green color component in the range of 0 to 1.
835
- * @param b - The blue color component in the range of 0 to 1.
836
- * @param a - The alpha color component in the range of 0 to 1.
837
- */
838
- setBackgroundColorRGBA(
839
- id: DesignBlockId,
840
- r: number,
841
- g: number,
842
- b: number,
843
- a: number
844
- ): void;
845
- /**
846
- * Get the background color of the given design block.
847
- * @param id - The block whose background color should be queried.
848
- * @returns The background color.
849
- */
850
- getBackgroundColorRGBA(id: DesignBlockId): RGBA;
851
- /**
852
- * Enable or disable the background of the given design block.
853
- * @param id - The block whose background should be enabled or disabled.
854
- * @param enabled - If true, the background will be enabled.
855
- */
856
- setBackgroundColorEnabled(id: DesignBlockId, enabled: boolean): void;
857
- /**
858
- * Query if the background of the given design block is enabled.
859
- * @param id - The block whose background state should be queried.
860
- * @returns True, if background is enabled.
861
- */
862
- isBackgroundColorEnabled(id: DesignBlockId): boolean;
863
- /**
864
- * Query if the given block has a stroke property.
865
- * @param id - The block to query.
866
- * @returns True if the block has a stroke property.
867
- */
868
- hasStroke(id: DesignBlockId): boolean;
869
- /**
870
- * Enable or disable the stroke of the given design block.
871
- * @param id - The block whose stroke should be enabled or disabled.
872
- * @param enabled - If true, the stroke will be enabled.
873
- */
874
- setStrokeEnabled(id: DesignBlockId, enabled: boolean): void;
875
- /**
876
- * Query if the stroke of the given design block is enabled.
877
- * @param id - The block whose stroke state should be queried.
878
- * @returns True if the block's stroke is enabled.
879
- */
880
- isStrokeEnabled(id: DesignBlockId): boolean;
881
- /**
882
- * Set the stroke color of the given design block.
883
- * @param id - The block whose stroke color should be set.
884
- * @param r - The red color component in the range of 0 to 1.
885
- * @param g - The green color component in the range of 0 to 1.
886
- * @param b - The blue color component in the range of 0 to 1.
887
- * @param a - The alpha color component in the range of 0 to 1.
888
- */
889
- setStrokeColorRGBA(
890
- id: DesignBlockId,
891
- r: number,
892
- g: number,
893
- b: number,
894
- a: number
895
- ): void;
896
- /**
897
- * Get the stroke color of the given design block.
898
- * @param id - The block whose background color should be queried.
899
- * @returns The background color.
900
- */
901
- getStrokeColorRGBA(id: DesignBlockId): RGBA;
902
- /**
903
- * Set the stroke width of the given design block.
904
- * @param id - The block whose stroke width should be set.
905
- * @param width - The stroke width to be set.
906
- */
907
- setStrokeWidth(id: DesignBlockId, width: number): void;
908
- /**
909
- * Get the stroke width of the given design block.
910
- * @param id - The block whose stroke width should be queried.
911
- * @returns The stroke's width.
912
- */
913
- getStrokeWidth(id: DesignBlockId): number;
914
- /**
915
- * Set the stroke style of the given design block.
916
- * @param id - The block whose stroke style should be set.
917
- * @param style - The stroke style to be set.
918
- */
919
- setStrokeStyle(id: DesignBlockId, style: StrokeStyle): void;
920
- /**
921
- * Get the stroke style of the given design block.
922
- * @param id - The block whose stroke style should be queried.
923
- * @returns The stroke's style.
924
- */
925
- getStrokeStyle(id: DesignBlockId): StrokeStyle;
926
- /**
927
- * Set the stroke position of the given design block.
928
- * @param id - The block whose stroke position should be set.
929
- * @param position - The stroke position to be set.
930
- */
931
- setStrokePosition(id: DesignBlockId, position: StrokePosition): void;
932
- /**
933
- * Get the stroke position of the given design block.
934
- * @param id - The block whose stroke position should be queried.
935
- * @returns The stroke position.
936
- */
937
- getStrokePosition(id: DesignBlockId): StrokePosition;
938
- /**
939
- * Set the stroke corner geometry of the given design block.
940
- * @param id - The block whose stroke join geometry should be set.
941
- * @param cornerGeometry - The stroke join geometry to be set.
942
- */
943
- setStrokeCornerGeometry(
944
- id: DesignBlockId,
945
- cornerGeometry: StrokeCornerGeometry
946
- ): void;
947
- /**
948
- * Get the stroke corner geometry of the given design block.
949
- * @param id - The block whose stroke join geometry should be queried.
950
- * @returns The stroke join geometry.
951
- */
952
- getStrokeCornerGeometry(id: DesignBlockId): StrokeCornerGeometry;
953
- /**
954
- * Query if the given block has outline properties.
955
- * @param id - The block to query.
956
- * @returns true, if the block has outline properties.
957
- * @deprecated Use `hasStroke`.
958
- */
959
- hasOutline(id: DesignBlockId): boolean;
960
- /**
961
- * Set the outline color of the given design block.
962
- * @param id - The block whose outline color should be set.
963
- * @param color - The outline color to be set, a tuple of
964
- * @param r - The red color component in the range of 0 to 1.
965
- * @param g - The green color component in the range of 0 to 1.
966
- * @param b - The blue color component in the range of 0 to 1.
967
- * @param a - The alpha color component in the range of 0 to 1.
968
- * @deprecated Use `setStrokeColorRGBA`.
969
- */
970
- setOutlineColorRGBA(
971
- id: DesignBlockId,
972
- r: number,
973
- g: number,
974
- b: number,
975
- a: number
976
- ): void;
977
- /**
978
- * Get the outline color of the given design block.
979
- * @param id - The block whose outline color should be queried.
980
- * @returns The outline color.
981
- * @deprecated Use `getStrokeColorRGBA`.
982
- */
983
- getOutlineColorRGBA(id: DesignBlockId): RGBA;
984
- /**
985
- * Enable or disable the outline of the given design block.
986
- * @param id - The block whose outline should be enabled or disabled.
987
- * @param enabled - If true, the outline will be enabled.
988
- * @deprecated Use `setStrokeEnabled`.
989
- */
990
- setOutlineEnabled(id: DesignBlockId, enabled: boolean): void;
991
- /**
992
- * Query if the outline of the given design block is enabled.
993
- * @param id - The block whose outline state should be queried.
994
- * @returns True, if outline is enabled.
995
- * @deprecated Use `isStrokeEnabled`.
996
- */
997
- isOutlineEnabled(id: DesignBlockId): boolean;
998
- /**
999
- * Set the outline width of the given design block.
1000
- * @param id - The block whose outline width should be set.
1001
- * @param width - The outline width to be set.
1002
- * @deprecated Use `setStrokeWidth`.
1003
- */
1004
- setOutlineWidth(id: DesignBlockId, width: number): void;
1005
- /**
1006
- * Get the outline width of the given design block.
1007
- * @param id - The block whose outline width should be queried.
1008
- * @returns The outline width.
1009
- * @deprecated Use the Stroke function
1010
- * @deprecated Use `getStrokeWidth`.
1011
- */
1012
- getOutlineWidth(id: DesignBlockId): number;
1013
- /**
1014
- * Query if the given block has fill color properties.
1015
- * @param id - The block to query.
1016
- * @returns true, if the block has fill color properties, an error otherwise.
1017
- */
1018
- hasFill(id: DesignBlockId): boolean;
1019
- /**
1020
- * Query if the fill of the given design block is enabled.
1021
- * @param id - The block whose fill state should be queried.
1022
- * @returns A result holding the fill state or an error.
1023
- */
1024
- isFillEnabled(id: DesignBlockId): boolean;
1025
- /**
1026
- * Enable or disable the fill of the given design block.
1027
- * @param id - The block whose fill should be enabled or disabled.
1028
- * @param enabled - If true, the fill will be enabled.
1029
- * @returns An empty result on success, an error otherwise.
1030
- */
1031
- setFillEnabled(id: DesignBlockId, enabled: boolean): void;
1032
- /**
1033
- * Set the fill type of the given design block.
1034
- * @param id - The block whose fill type should be set.
1035
- * @param type - The fill type to set.
1036
- * @returns An empty result on success, an error otherwise.
1037
- */
1038
- setFillType(id: DesignBlockId, fillType: FillType): void;
1039
- /**
1040
- * Get the fill type of the given design block.
1041
- * @param id - The block whose fill type should be queried.
1042
- * @returns The block's fill type or an error.
1043
- */
1044
- getFillType(id: DesignBlockId): FillType;
1045
- /**
1046
- * Set the fill color of the given design block.
1047
- * @param id - The block whose fill color should be set.
1048
- * @param r - The red color component in the range of 0 to 1.
1049
- * @param g - The green color component in the range of 0 to 1.
1050
- * @param b - The blue color component in the range of 0 to 1.
1051
- * @param a - The alpha color component in the range of 0 to 1.
1052
- * @returns An empty result on success, an error otherwise.
1053
- */
1054
- setFillSolidColor(
1055
- id: DesignBlockId,
1056
- r: number,
1057
- b: number,
1058
- g: number,
1059
- a: number
1060
- ): void;
1061
- /**
1062
- * Get the fill color of the given design block.
1063
- * @param id - The block whose fill color should be queried.
1064
- * @returns A result holding the fill color or an error.
1065
- */
1066
- getFillSolidColor(id: DesignBlockId): RGBA;
1067
- /**
1068
- * Set the gradient type of the given design block.
1069
- * @param id - The block whose gradient type should be set.
1070
- * @param type - The gradient type.
1071
- * @returns An empty result on success, an error otherwise.
1072
- */
1073
- setFillGradientType(id: DesignBlockId, gradientType: GradientType): void;
1074
- /**
1075
- * Get the gradient type of the given design block.
1076
- * @param id - The block whose gradient type should be queried.
1077
- * @returns The gradient type.
1078
- */
1079
- getFillGradientType(id: DesignBlockId): GradientType;
1080
- /**
1081
- * Add a gradient color stop on a design block.
1082
- * @param id - The block on which a gradient color stop should be added.
1083
- * @param stop - Where to add a color stop in the range 0 to 1.
1084
- * @param r - The red color component in the range of 0 to 1.
1085
- * @param g - The green color component in the range of 0 to 1.
1086
- * @param b - The blue color component in the range of 0 to 1.
1087
- * @param a - The alpha color component in the range of 0 to 1.
1088
- * @returns An empty result on success, an error otherwise.
1089
- */
1090
- addFillGradientColorStop(
1091
- id: DesignBlockId,
1092
- stop: number,
1093
- r: number,
1094
- g: number,
1095
- b: number,
1096
- a: number
1097
- ): void;
1098
- /**
1099
- * Remove a previously gradient color stop on a design block.
1100
- * @param id - The block from which to remvove the gradient color stop.
1101
- * @param stop - The stop's position.
1102
- * @returns An empty result on success, an error otherwise.
1103
- */
1104
- removeFillGradientColorStop(id: DesignBlockId, stop: number): void;
1105
- /**
1106
- * Get the gradient fill color stops of the given design block.
1107
- * @param id - The block whose gradient color stop should be queried.
1108
- * @returns All of the design block's gradient color stops.
1109
- */
1110
- getFillGradientColorStops(id: DesignBlockId): GradientstopRGBA[];
1111
- /**
1112
- * Set the gradient fill color stops of the given design block, overwriting previously set color stops.
1113
- * @param id - The block whose gradient color stop should be set.
1114
- * @param stops - The gradient color stops to set.
1115
- * @returns An empty result on success, an error otherwise.
1116
- */
1117
- setFillGradientColorStops(id: DesignBlockId, stops: GradientstopRGBA[]): void;
1118
- /**
1119
- * Set the position of a gradient's control point.
1120
- * Note that Different gradient types of different control points.
1121
- * @param id - The block whose gradient control point should be set.
1122
- * @param gradientControlPointType - The type of control point.
1123
- * @param x - The horizontal component of the control point.
1124
- * @param y - The vertical component of the control point.
1125
- * @returns true if the control point was set, an error otherwise.
1126
- */
1127
- setFillGradientControlPoint(
1128
- id: DesignBlockId,
1129
- gradientControlPointType: GradientControlPointType,
1130
- x: number,
1131
- y: number
1132
- ): boolean;
1133
- /**
1134
- * Get the horizontal component of a gradient's control point.
1135
- * @param id - The block whose gradient control point should be queried.
1136
- * @param gradientControlPointType - The type of control point.
1137
- * @returns The horizontal component of the control point, an error otherwise.
1138
- */
1139
- getFillGradientControlPointX(
1140
- id: DesignBlockId,
1141
- gradientControlPointType: GradientControlPointType
1142
- ): number;
1143
- /**
1144
- * Get the vertical component of a gradient's control point.
1145
- * @param id - The block whose gradient control point should be queried.
1146
- * @param gradientControlPointType - The type of control point.
1147
- * @returns The vertical component of the control point, an error otherwise.
1148
- */
1149
- getFillGradientControlPointY(
1150
- id: DesignBlockId,
1151
- gradientControlPointType: GradientControlPointType
1152
- ): number;
1153
- /**
1154
- * Set a gradient's radius.
1155
- * Note that Not all gradients have a radius.
1156
- * @param id - The block whose gradient radius should be set.
1157
- * @param radius - The gradient's radius.
1158
- * @returns true if the control point was set, an error otherwise.
1159
- */
1160
- setFillGradientRadius(id: DesignBlockId, radius: number): boolean;
1161
- /**
1162
- * Get a gradient's radius.
1163
- * Note that Not all gradients have a radius.
1164
- * @param id - The block whose gradient radius should be queried.
1165
- * @returns the gradient's radius, an error otherwise.
1166
- */
1167
- getFillGradientRadius(id: DesignBlockId): number;
148
+ #private;
149
+
150
+ /**
151
+ * Exports a design block element as a file of the given mime type.
152
+ * Performs an internal update to resolve the final layout for the blocks.
153
+ * @param handle - The design block element to export.
154
+ * @param mimeType - The mime type of the output file.
155
+ * @returns A promise that resolves with the exported image or is rejected with an error.
156
+ */
157
+ export(handle: DesignBlockId, mimeType?: MimeType_2): Promise<Blob>;
158
+
159
+ /**
160
+ * Loads existing blocks from the given string.
161
+ * The blocks are not attached by default and won't be visible until attached to a page or the scene.
162
+ * @param content - A string representing the given blocks.
163
+ * @returns A promise that resolves with a list of handles representing the found blocks or an error.
164
+ */
165
+ loadFromString(content: string): Promise<DesignBlockId[]>;
166
+ /**
167
+ * Saves the given blocks into a string. If given the root of a block hierarchy, e.g. a
168
+ * page with multiple children, the entire hierarchy is saved.
169
+ * @param blocks - The blocks to save
170
+ * @returns A promise that resolves to a string representing the blocks or an error.
171
+ */
172
+ saveToString(blocks: DesignBlockId[]): Promise<string>;
173
+ /**
174
+ * Create a new block, fails if type is unknown.
175
+ * @param type - The type of the block that shall be created.
176
+ * @returns The created blocks handle.
177
+ */
178
+ create(type: DesignBlockType): DesignBlockId;
179
+
180
+ /**
181
+ * Get the type of the given block, fails if the block is invalid.
182
+ * @param id - The block to query.
183
+ * @returns The blocks type.
184
+ */
185
+ getType(id: DesignBlockId): DesignBlockType;
186
+ /**
187
+ * Update the selection state of a block.
188
+ * Fails for invalid blocks.
189
+ * @param id - The block to query.
190
+ * @param selected - Whether or not the block should be selected.
191
+ */
192
+ setSelected(id: DesignBlockId, selected: boolean): void;
193
+ /**
194
+ * Get the selected state of a block.
195
+ * @param id - The block to query.
196
+ * @returns True if the block is selected, false otherwise.
197
+ */
198
+ isSelected(id: DesignBlockId): boolean;
199
+ /**
200
+ * Get all currently selected blocks.
201
+ * @returns An array of block ids.
202
+ */
203
+ findAllSelected(): DesignBlockId[];
204
+ /**
205
+ * Confirms that a given set of blocks can be grouped together.
206
+ * @param ids - A non-empty array of block ids.
207
+ * @returns Whether the blocks can be grouped together.
208
+ */
209
+ isGroupable(ids: DesignBlockId[]): boolean;
210
+ /**
211
+ * Group blocks together.
212
+ * @param ids - A non-empty array of block ids.
213
+ * @returns The block id of the created group.
214
+ */
215
+ group(ids: DesignBlockId[]): DesignBlockId;
216
+ /**
217
+ * Ungroups a group.
218
+ * @param id - The group id from a previous call to `group`.
219
+ */
220
+ ungroup(id: DesignBlockId): void;
221
+ /**
222
+ * Changes selection from selected group to a block within that group.
223
+ * Nothing happens if `group` is not a group.
224
+ * @param id - The group id from a previous call to `group`.
225
+ */
226
+ enterGroup(id: DesignBlockId): void;
227
+ /**
228
+ * Changes selection from a group's selected block to that group.
229
+ * Nothing happens if the `id` is not part of a group.
230
+ * @param id - A block id.
231
+ */
232
+ exitGroup(id: DesignBlockId): void;
233
+ /**
234
+ * Update a block's name.
235
+ * @param id - The block to update.
236
+ * @param name - The name to set.
237
+ */
238
+ setName(id: DesignBlockId, name: string): void;
239
+ /**
240
+ * Get a block's name.
241
+ * @param id - The block to update.
242
+ */
243
+ getName(id: DesignBlockId): string;
244
+ /**
245
+ * Finds all blocks with the given name.
246
+ * @param name - The name to search for.
247
+ * @returns A list of block ids.
248
+ */
249
+ findByName(name: string): DesignBlockId[];
250
+ /**
251
+ * Finds all blocks with the given type.
252
+ * @param type - The type to search for.
253
+ * @returns A list of block ids.
254
+ */
255
+ findByType(type: DesignBlockType): DesignBlockId[];
256
+ /**
257
+ * Return all blocks currently known to the engine.
258
+ * @returns A list of block ids.
259
+ */
260
+ findAll(): DesignBlockId[];
261
+ /**
262
+ * Return all placeholder blocks in the current scene.
263
+ * @returns A list of block ids.
264
+ */
265
+ findAllPlaceholders(): DesignBlockId[];
266
+ /**
267
+ * Query a block's visibility.
268
+ * @param id - The block to query.
269
+ * @returns True if visible, false otherwise.
270
+ */
271
+ isVisible(id: DesignBlockId): boolean;
272
+ /**
273
+ * Update a block's visibility.
274
+ * @param id - The block to update.
275
+ * @param visible - Whether the block shall be visible.
276
+ */
277
+ setVisible(id: DesignBlockId, visible: boolean): void;
278
+ /**
279
+ * Query a block's clipped state. If true, the block should clip
280
+ * its contents to its frame.
281
+ * @param id - The block to query.
282
+ * @returns True if clipped, false otherwise.
283
+ */
284
+ isClipped(id: DesignBlockId): boolean;
285
+ /**
286
+ * Update a block's clipped state.
287
+ * @param id - The block to update.
288
+ * @param clipped - Whether the block should clips its contents to its frame.
289
+ */
290
+ setClipped(id: DesignBlockId, clipped: boolean): void;
291
+ /**
292
+ * Query a block's x position.
293
+ * @param id - The block to query.
294
+ * @returns The value of the x position.
295
+ */
296
+ getPositionX(id: DesignBlockId): number;
297
+ /**
298
+ * Query a block's mode for its x position.
299
+ * @param id - The block to query.
300
+ * @returns The current mode for the x position: absolute, percent or undefined.
301
+ */
302
+ getPositionXMode(id: DesignBlockId): PositionMode;
303
+ /**
304
+ * Query a block's y position.
305
+ * @param id - The block to query.
306
+ * @returns The value of the y position.
307
+ */
308
+ getPositionY(id: DesignBlockId): number;
309
+ /**
310
+ * Query a block's mode for its y position.
311
+ * @param id - The block to query.
312
+ * @returns The current mode for the y position: absolute, percent or undefined.
313
+ */
314
+ getPositionYMode(id: DesignBlockId): PositionMode;
315
+ /**
316
+ * Update a block's x position.
317
+ * The position refers to the block's local space, relative to its parent with the origin at the top left.
318
+ * @param id - The block to update.
319
+ * @param value - The value of the x position.
320
+ */
321
+ setPositionX(id: DesignBlockId, value: number): void;
322
+ /**
323
+ * Set a block's mode for its x position.
324
+ * @param id - The block to update.
325
+ * @param mode - The x position mode: absolute, percent or undefined.
326
+ */
327
+ setPositionXMode(id: DesignBlockId, mode: PositionMode): void;
328
+ /**
329
+ * Update a block's y position.
330
+ * The position refers to the block's local space, relative to its parent with the origin at the top left.
331
+ * @param id - The block to update.
332
+ * @param value - The value of the y position.
333
+ */
334
+ setPositionY(id: DesignBlockId, value: number): void;
335
+ /**
336
+ * Set a block's mode for its y position.
337
+ * @param id - The block to update.
338
+ * @param mode - The y position mode: absolute, percent or undefined.
339
+ */
340
+ setPositionYMode(id: DesignBlockId, mode: PositionMode): void;
341
+ /**
342
+ * Query a block's rotation in radians.
343
+ * @param id - The block to query.
344
+ * @returns The block's rotation around its center in radians.
345
+ */
346
+ getRotation(id: DesignBlockId): number;
347
+ /**
348
+ * Update a block's rotation.
349
+ * @param id - The block to update.
350
+ * @param radians - The new rotation in radians. Rotation is applied around the block's center.
351
+ */
352
+ setRotation(id: DesignBlockId, radians: number): void;
353
+ /**
354
+ * Query a block's horizontal flip state.
355
+ * @param id - The block to query.
356
+ * @returns A boolean indicating for whether the block is flipped in the queried direction
357
+ */
358
+ getFlipHorizontal(id: DesignBlockId): boolean;
359
+ /**
360
+ * Query a block's vertical flip state.
361
+ * @param id - The block to query.
362
+ * @returns A boolean indicating for whether the block is flipped in the queried direction
363
+ */
364
+ getFlipVertical(id: DesignBlockId): boolean;
365
+ /**
366
+ * Update a block's horizontal flip.
367
+ * @param id - The block to update.
368
+ * @param flip - If the flip should be enabled.
369
+ */
370
+ setFlipHorizontal(id: DesignBlockId, flip: boolean): void;
371
+ /**
372
+ * Update a block's vertical flip.
373
+ * @param id - The block to update.
374
+ * @param flip - If the flip should be enabled.
375
+ */
376
+ setFlipVertical(id: DesignBlockId, flip: boolean): void;
377
+ /**
378
+ * Query if the given block has a content fill mode.
379
+ * @param id - The block to query.
380
+ * @returns true, if the block has a content fill mode.
381
+ */
382
+ hasContentFillMode(id: DesignBlockId): boolean;
383
+ /**
384
+ * Query if the given block shows placeholder content.
385
+ * @param id - The block to query.
386
+ * @returns true, if the block shows placeholder content.
387
+ */
388
+ hasPlaceholderContent(id: DesignBlockId): boolean;
389
+ /**
390
+ * Query a block's width.
391
+ * @param id - The block to query.
392
+ * @returns The value of the block's width.
393
+ */
394
+ getWidth(id: DesignBlockId): number;
395
+ /**
396
+ * Query a block's mode for its width.
397
+ * @param id - The block to query.
398
+ * @returns The current mode for the width: absolute, percent or auto.
399
+ */
400
+ getWidthMode(id: DesignBlockId): SizeMode;
401
+ /**
402
+ * Query a block's height.
403
+ * @param id - The block to query.
404
+ * @returns The value of the block's height.
405
+ */
406
+ getHeight(id: DesignBlockId): number;
407
+ /**
408
+ * Query a block's mode for its height.
409
+ * @param id - The block to query.
410
+ * @returns The current mode for the height: absolute, percent or auto.
411
+ */
412
+ getHeightMode(id: DesignBlockId): SizeMode;
413
+ /**
414
+ * Query a block's content fill mode.
415
+ * @param id - The block to query.
416
+ * @returns The current mode: crop, cover or contain.
417
+ */
418
+ getContentFillMode(id: DesignBlockId): ContentFillMode;
419
+ /**
420
+ * Update a block's width.
421
+ * @param id - The block to update.
422
+ * @param value - The new width of the block.
423
+ */
424
+ setWidth(id: DesignBlockId, value: number): void;
425
+ /**
426
+ * Set a block's mode for its width.
427
+ * @param id - The block to update.
428
+ * @param mode - The width mode: absolute, percent or auto.
429
+ */
430
+ setWidthMode(id: DesignBlockId, mode: SizeMode): void;
431
+ /**
432
+ * Update a block's height.
433
+ * @param id - The block to update.
434
+ * @param value - The new height of the block.
435
+ */
436
+ setHeight(id: DesignBlockId, value: number): void;
437
+ /**
438
+ * Set a block's mode for its height.
439
+ * @param id - The block to update.
440
+ * @param mode - The height mode: absolute, percent or auto.
441
+ */
442
+ setHeightMode(id: DesignBlockId, mode: SizeMode): void;
443
+ /**
444
+ * Set a block's content fill mode.
445
+ * @param id - The block to update.
446
+ * @param mode - The content fill mode mode: crop, cover or contain.
447
+ */
448
+ setContentFillMode(id: DesignBlockId, mode: ContentFillMode): void;
449
+ /**
450
+ * Get a block's layout width. The layout width is only available after an
451
+ * internal update loop, which may not happen immediately.
452
+ * @param id - The block to query.
453
+ * @returns The layout width.
454
+ */
455
+ getFrameWidth(id: DesignBlockId): number;
456
+ /**
457
+ * Get a block's layout height. The layout height is only available after an
458
+ * internal update loop, which may not happen immediately.
459
+ * @param id - The block to query.
460
+ * @returns The layout height.
461
+ */
462
+ getFrameHeight(id: DesignBlockId): number;
463
+ /**
464
+ * Duplicates a block including its children.
465
+ * @param id - The block to duplicate.
466
+ * @returns The handle of the duplicate.
467
+ */
468
+ duplicate(id: DesignBlockId): DesignBlockId;
469
+ /**
470
+ * Destroys a block.
471
+ * @param id - The block to destroy.
472
+ */
473
+ destroy(id: DesignBlockId): void;
474
+ /**
475
+ * Check if a block is valid. A block becomes invalid once it has been destroyed.
476
+ * @param id - The block to query.
477
+ * @returns True, if the block is valid.
478
+ */
479
+ isValid(id: DesignBlockId): boolean;
480
+ /**
481
+ * Query a block's parent.
482
+ * @param id - The block to query.
483
+ * @returns The parent's handle or null if the block has no parent.
484
+ */
485
+ getParent(id: DesignBlockId): DesignBlockId | null;
486
+ /**
487
+ * Get all children of the given block. Children
488
+ * are sorted in their rendering order: Last child is rendered
489
+ * in front of other children.
490
+ * @param id - The block to query.
491
+ * @returns A list of block ids.
492
+ */
493
+ getChildren(id: DesignBlockId): DesignBlockId[];
494
+ /**
495
+ * Insert a new or existing child at a certain position in the parent's children.
496
+ * @param parent - The block whose children should be updated.
497
+ * @param child - The child to insert. Can be an existing child of `parent`.
498
+ * @param index - The index to insert or move to.
499
+ */
500
+ insertChild(parent: DesignBlockId, child: DesignBlockId, index: number): void;
501
+ /**
502
+ * Appends a new or existing child to a block's children.
503
+ * @param parent - The block whose children should be updated.
504
+ * @param child - The child to insert. Can be an existing child of `parent`.
505
+ */
506
+ appendChild(parent: DesignBlockId, child: DesignBlockId): void;
507
+ /** Checks whether the given block references any variables. Doesn't check the block's children.
508
+ *
509
+ * @param id - The block to inspect.
510
+ * @returns true if the block references variables and false otherwise.
511
+ */
512
+ referencesAnyVariables(id: DesignBlockId): boolean;
513
+ /**
514
+ * Get the x position of the block's axis-aligned bounding box in the scene's global coordinate space.
515
+ * The scene's global coordinate space has its origin at the top left.
516
+ * @param id - The block whose bounding box should be calculated.
517
+ * @returns float The x coordinate of the position of the axis-aligned bounding box.
518
+ */
519
+ getGlobalBoundingBoxX(id: DesignBlockId): number;
520
+ /**
521
+ * Get the y position of the block's axis-aligned bounding box in the scene's global coordinate space.
522
+ * The scene's global coordinate space has its origin at the top left.
523
+ * @param id - The block whose bounding box should be calculated.
524
+ * @returns float The y coordinate of the position of the axis-aligned bounding box.
525
+ */
526
+ getGlobalBoundingBoxY(id: DesignBlockId): number;
527
+ /**
528
+ * Get the width of the block's axis-aligned bounding box in the scene's global coordinate space.
529
+ * The scene's global coordinate space has its origin at the top left.
530
+ * @param id - The block whose bounding box should be calculated.
531
+ * @returns float The width of the axis-aligned bounding box.
532
+ */
533
+ getGlobalBoundingBoxWidth(id: DesignBlockId): number;
534
+ /**
535
+ * Get the height of the block's axis-aligned bounding box in the scene's global coordinate space.
536
+ * The scene's global coordinate space has its origin at the top left.
537
+ * @param id - The block whose bounding box should be calculated.
538
+ * @returns float The height of the axis-aligned bounding box.
539
+ */
540
+ getGlobalBoundingBoxHeight(id: DesignBlockId): number;
541
+ /**
542
+ * Scales the block and all of its children proportionally around the specified
543
+ * relative anchor point.
544
+ *
545
+ * This updates the position, size and style properties (e.g. stroke width) of
546
+ * the block and its children.
547
+ *
548
+ * @param id - The block that should be scaled.
549
+ * @param scale - The scale factor to be applied to the current properties of the block.
550
+ * @param anchorX - The relative position along the width of the block around which the
551
+ * scaling should occur. (0 = left edge, 0.5 = center, 1 = right edge)
552
+ * @param anchorY - The relative position along the height of the block around which the
553
+ * scaling should occur. (0 = top edge, 0.5 = center, 1 = bottom edge)
554
+ */
555
+ scale(id: DesignBlockId, scale: number, anchorX?: number, anchorY?: number): void;
556
+ /**
557
+ * Get all available properties of a block.
558
+ * @param id - The block whose properties should be queried.
559
+ * @returns A list of the property names.
560
+ */
561
+ findAllProperties(id: DesignBlockId): string[];
562
+ /**
563
+ * Get the type of a property given its name.
564
+ * @param property - The name of the property whose type should be queried.
565
+ * @returns The property type.
566
+ */
567
+ getPropertyType(property: string): PropertyType;
568
+ /**
569
+ * Get all the possible values of an enum given an enum property.
570
+ * @param enumProperty - The name of the property whose enum values should be queried.
571
+ * @returns A list of the enum value names as string.
572
+ */
573
+ getEnumValues<T = string>(enumProperty: string): T[];
574
+ /**
575
+ * Set a bool property of the given design block to the given value.
576
+ * @param id - The block whose property should be set.
577
+ * @param property - The name of the property to set.
578
+ * @param value - The value to set.
579
+ */
580
+ setBool(id: DesignBlockId, property: string, value: boolean): void;
581
+ /**
582
+ * Get the value of a bool property of the given design block.
583
+ * @param id - The block whose property should be queried.
584
+ * @param property - The name of the property to query.
585
+ * @returns The value of the property.
586
+ */
587
+ getBool(id: DesignBlockId, property: string): boolean;
588
+ /**
589
+ * Set an int property of the given design block to the given value.
590
+ * @param id - The block whose property should be set.
591
+ * @param property - The name of the property to set.
592
+ * @param value - The value to set.
593
+ */
594
+ setInt(id: DesignBlockId, property: string, value: number): void;
595
+ /**
596
+ * Get the value of an int property of the given design block.
597
+ * @param id - The block whose property should be queried.
598
+ * @param property - The name of the property to query.
599
+ * @returns The value of the property.
600
+ */
601
+ getInt(id: DesignBlockId, property: string): number;
602
+ /**
603
+ * Set a float property of the given design block to the given value.
604
+ * @param id - The block whose property should be set.
605
+ * @param property - The name of the property to set.
606
+ * @param value - The value to set.
607
+ */
608
+ setFloat(id: DesignBlockId, property: string, value: number): void;
609
+ /**
610
+ * Get the value of a float property of the given design block.
611
+ * @param id - The block whose property should be queried.
612
+ * @param property - The name of the property to query.
613
+ * @returns The value of the property.
614
+ */
615
+ getFloat(id: DesignBlockId, property: string): number;
616
+ /**
617
+ * Set a string property of the given design block to the given value.
618
+ * @param id - The block whose property should be set.
619
+ * @param property - The name of the property to set.
620
+ * @param value - The value to set.
621
+ */
622
+ setString(id: DesignBlockId, property: string, value: string): void;
623
+ /**
624
+ * Get the value of a string property of the given design block.
625
+ * @param id - The block whose property should be queried.
626
+ * @param property - The name of the property to query.
627
+ * @returns The value of the property.
628
+ */
629
+ getString(id: DesignBlockId, property: string): string;
630
+ /**
631
+ * Set a color property of the given design block to the given value.
632
+ * @param id - The block whose property should be set.
633
+ * @param property - The name of the property to set.
634
+ * @param r - The red color component in the range of 0 to 1.
635
+ * @param g - The green color component in the range of 0 to 1.
636
+ * @param b - The blue color component in the range of 0 to 1.
637
+ * @param a - The alpha color component in the range of 0 to 1.
638
+ */
639
+ setColorRGBA(id: DesignBlockId, property: string, r: number, g: number, b: number, a?: number): void;
640
+ /**
641
+ * Get the value of a string property of the given design block.
642
+ * @param id - The block whose property should be queried.
643
+ * @param property - The name of the property to query.
644
+ * @returns A tuple of channels red, green, blue and alpha in the range of 0 to 1.
645
+ */
646
+ getColorRGBA(id: DesignBlockId, property: string): RGBA;
647
+ /**
648
+ * Set an enum property of the given design block to the given value.
649
+ * @param id - The block whose property should be set.
650
+ * @param property - The name of the property to set.
651
+ * @param value - The enum value as string.
652
+ */
653
+ setEnum(id: DesignBlockId, property: string, value: string): void;
654
+ /**
655
+ * Get the value of an enum property of the given design block.
656
+ * @param id - The block whose property should be queried.
657
+ * @param property - The name of the property to query.
658
+ * @returns The value as string.
659
+ */
660
+ getEnum(id: DesignBlockId, property: string): string;
661
+ /**
662
+ * Query if the given block has crop properties.
663
+ * @param id - The block to query.
664
+ * @returns true, if the block has crop properties.
665
+ */
666
+ hasCrop(id: DesignBlockId): boolean;
667
+ /**
668
+ * Set the crop scale in x direction of the given design block.
669
+ * @param id - The block whose crop should be set.
670
+ * @param scaleX - The scale in x direction.
671
+ */
672
+ setCropScaleX(id: DesignBlockId, scaleX: number): void;
673
+ /**
674
+ * Set the crop scale in y direction of the given design block.
675
+ * @param id - The block whose crop should be set.
676
+ * @param scaleY - The scale in y direction.
677
+ */
678
+ setCropScaleY(id: DesignBlockId, scaleY: number): void;
679
+ /**
680
+ * Set the crop rotation of the given design block.
681
+ * @param id - The block whose crop should be set.
682
+ * @param rotation - The rotation in radians.
683
+ */
684
+ setCropRotation(id: DesignBlockId, rotation: number): void;
685
+ /**
686
+ * Set the crop translation in x direction of the given design block.
687
+ * @param id - The block whose crop should be set.
688
+ * @param translationY - The translation in y direction.
689
+ */
690
+ setCropTranslationX(id: DesignBlockId, translationX: number): void;
691
+ /**
692
+ * Set the crop translation in y direction of the given design block.
693
+ * @param id - The block whose crop should be set.
694
+ * @param translationY - The translation in y direction.
695
+ */
696
+ setCropTranslationY(id: DesignBlockId, translationY: number): void;
697
+ /**
698
+ * Resets the manually set crop of the given design block.
699
+ * The block's content fill mode is set to 'cover'.
700
+ * @param id - The block whose crop should be reset.
701
+ */
702
+ resetCrop(id: DesignBlockId): void;
703
+ /**
704
+ * Get the crop scale on the x axis of the given design block.
705
+ * @param id - The block whose scale should be queried.
706
+ * @returns The scale on the x axis.
707
+ */
708
+ getCropScaleX(id: DesignBlockId): number;
709
+ /**
710
+ * Get the crop scale on the y axis of the given design block.
711
+ * @param id - The block whose scale should be queried.
712
+ * @returns The scale on the y axis.
713
+ */
714
+ getCropScaleY(id: DesignBlockId): number;
715
+ /**
716
+ * Get the crop rotation of the given design block.
717
+ * @param id - The block whose crop rotation should be queried.
718
+ * @returns The crop rotation.
719
+ */
720
+ getCropRotation(id: DesignBlockId): number;
721
+ /**
722
+ * Get the crop translation on the x axis of the given design block.
723
+ * @param id - The block whose translation should be queried.
724
+ * @returns The translation on the x axis.
725
+ */
726
+ getCropTranslationX(id: DesignBlockId): number;
727
+ /**
728
+ * Get the crop translation on the y axis of the given design block.
729
+ * @param id - The block whose translation should be queried.
730
+ * @returns The translation on the y axis.
731
+ */
732
+ getCropTranslationY(id: DesignBlockId): number;
733
+ /**
734
+ * Query if the given block has an opacity.
735
+ * @param id - The block to query.
736
+ * @returns true, if the block has an opacity.
737
+ */
738
+ hasOpacity(id: DesignBlockId): boolean;
739
+ /**
740
+ * Set the opacity of the given design block.
741
+ * @param id - The block whose opacity should be set.
742
+ * @param opacity - The opacity to be set. The valid range is 0 to 1.
743
+ */
744
+ setOpacity(id: DesignBlockId, opacity: number): void;
745
+ /**
746
+ * Get the opacity of the given design block.
747
+ * @param id - The block whose opacity should be queried.
748
+ * @returns The opacity.
749
+ */
750
+ getOpacity(id: DesignBlockId): number;
751
+ /**
752
+ * Query if the given block has a blend mode.
753
+ * @param id - The block to query.
754
+ * @returns true, if the block has a blend mode.
755
+ */
756
+ hasBlendMode(id: DesignBlockId): boolean;
757
+ /**
758
+ * Set the blend mode of the given design block.
759
+ * @param id - The block whose blend mode should be set.
760
+ * @param blendMode - The blend mode to be set.
761
+ * @returns
762
+ */
763
+ setBlendMode(id: DesignBlockId, blendMode: BlendMode): void;
764
+ /**
765
+ * Get the blend mode of the given design block.
766
+ * @param id - The block whose blend mode should be queried.
767
+ * @returns The blend mode.
768
+ */
769
+ getBlendMode(id: DesignBlockId): BlendMode;
770
+ /**
771
+ * Query if the given block has fill color properties.
772
+ * @param id - The block to query.
773
+ * @returns true, if the block has fill color properties.
774
+ */
775
+ hasFillColor(id: DesignBlockId): boolean;
776
+ /**
777
+ * Set the fill color of the given design block.
778
+ * @param id - The block whose fill color should be set.
779
+ * @param color - The fill color to be set, a tuple of
780
+ * @param r - The red color component in the range of 0 to 1.
781
+ * @param g - The green color component in the range of 0 to 1.
782
+ * @param b - The blue color component in the range of 0 to 1.
783
+ * @param a - The alpha color component in the range of 0 to 1.
784
+ */
785
+ setFillColorRGBA(id: DesignBlockId, r: number, g: number, b: number, a?: number): void;
786
+ /**
787
+ * Get the fill color of the given design block.
788
+ * @param id - The block whose fill color should be queried.
789
+ * @returns The fill color.
790
+ */
791
+ getFillColorRGBA(id: DesignBlockId): RGBA;
792
+ /**
793
+ * Enable or disable the fill of the given design block.
794
+ * @param id - The block whose fill should be enabled or disabled.
795
+ * @param enabled - If true, the fill will be enabled.
796
+ */
797
+ setFillColorEnabled(id: DesignBlockId, enabled: boolean): void;
798
+ /**
799
+ * Query if the fill of the given design block is enabled.
800
+ * @param id - The block whose fill state should be queried.
801
+ * @returns True, if fill is enabled.
802
+ */
803
+ isFillColorEnabled(id: DesignBlockId): boolean;
804
+ /**
805
+ * Query if the given block has background color properties.
806
+ * @param id - The block to query.
807
+ * @returns true, if the block has background color properties.
808
+ */
809
+ hasBackgroundColor(id: DesignBlockId): boolean;
810
+ /**
811
+ * Set the background color of the given design block.
812
+ * @param id - The block whose background color should be set.
813
+ * @param color - The background color to be set, a tuple of
814
+ * @param r - The red color component in the range of 0 to 1.
815
+ * @param g - The green color component in the range of 0 to 1.
816
+ * @param b - The blue color component in the range of 0 to 1.
817
+ * @param a - The alpha color component in the range of 0 to 1.
818
+ */
819
+ setBackgroundColorRGBA(id: DesignBlockId, r: number, g: number, b: number, a?: number): void;
820
+ /**
821
+ * Get the background color of the given design block.
822
+ * @param id - The block whose background color should be queried.
823
+ * @returns The background color.
824
+ */
825
+ getBackgroundColorRGBA(id: DesignBlockId): RGBA;
826
+ /**
827
+ * Enable or disable the background of the given design block.
828
+ * @param id - The block whose background should be enabled or disabled.
829
+ * @param enabled - If true, the background will be enabled.
830
+ */
831
+ setBackgroundColorEnabled(id: DesignBlockId, enabled: boolean): void;
832
+ /**
833
+ * Query if the background of the given design block is enabled.
834
+ * @param id - The block whose background state should be queried.
835
+ * @returns True, if background is enabled.
836
+ */
837
+ isBackgroundColorEnabled(id: DesignBlockId): boolean;
838
+ /**
839
+ * Query if the given block has a stroke property.
840
+ * @param id - The block to query.
841
+ * @returns True if the block has a stroke property.
842
+ */
843
+ hasStroke(id: DesignBlockId): boolean;
844
+ /**
845
+ * Enable or disable the stroke of the given design block.
846
+ * @param id - The block whose stroke should be enabled or disabled.
847
+ * @param enabled - If true, the stroke will be enabled.
848
+ */
849
+ setStrokeEnabled(id: DesignBlockId, enabled: boolean): void;
850
+ /**
851
+ * Query if the stroke of the given design block is enabled.
852
+ * @param id - The block whose stroke state should be queried.
853
+ * @returns True if the block's stroke is enabled.
854
+ */
855
+ isStrokeEnabled(id: DesignBlockId): boolean;
856
+ /**
857
+ * Set the stroke color of the given design block.
858
+ * @param id - The block whose stroke color should be set.
859
+ * @param r - The red color component in the range of 0 to 1.
860
+ * @param g - The green color component in the range of 0 to 1.
861
+ * @param b - The blue color component in the range of 0 to 1.
862
+ * @param a - The alpha color component in the range of 0 to 1.
863
+ */
864
+ setStrokeColorRGBA(id: DesignBlockId, r: number, g: number, b: number, a?: number): void;
865
+ /**
866
+ * Get the stroke color of the given design block.
867
+ * @param id - The block whose background color should be queried.
868
+ * @returns The background color.
869
+ */
870
+ getStrokeColorRGBA(id: DesignBlockId): RGBA;
871
+ /**
872
+ * Set the stroke width of the given design block.
873
+ * @param id - The block whose stroke width should be set.
874
+ * @param width - The stroke width to be set.
875
+ */
876
+ setStrokeWidth(id: DesignBlockId, width: number): void;
877
+ /**
878
+ * Get the stroke width of the given design block.
879
+ * @param id - The block whose stroke width should be queried.
880
+ * @returns The stroke's width.
881
+ */
882
+ getStrokeWidth(id: DesignBlockId): number;
883
+ /**
884
+ * Set the stroke style of the given design block.
885
+ * @param id - The block whose stroke style should be set.
886
+ * @param style - The stroke style to be set.
887
+ */
888
+ setStrokeStyle(id: DesignBlockId, style: StrokeStyle): void;
889
+ /**
890
+ * Get the stroke style of the given design block.
891
+ * @param id - The block whose stroke style should be queried.
892
+ * @returns The stroke's style.
893
+ */
894
+ getStrokeStyle(id: DesignBlockId): StrokeStyle;
895
+ /**
896
+ * Set the stroke position of the given design block.
897
+ * @param id - The block whose stroke position should be set.
898
+ * @param position - The stroke position to be set.
899
+ */
900
+ setStrokePosition(id: DesignBlockId, position: StrokePosition): void;
901
+ /**
902
+ * Get the stroke position of the given design block.
903
+ * @param id - The block whose stroke position should be queried.
904
+ * @returns The stroke position.
905
+ */
906
+ getStrokePosition(id: DesignBlockId): StrokePosition;
907
+ /**
908
+ * Set the stroke corner geometry of the given design block.
909
+ * @param id - The block whose stroke join geometry should be set.
910
+ * @param cornerGeometry - The stroke join geometry to be set.
911
+ */
912
+ setStrokeCornerGeometry(id: DesignBlockId, cornerGeometry: StrokeCornerGeometry): void;
913
+ /**
914
+ * Get the stroke corner geometry of the given design block.
915
+ * @param id - The block whose stroke join geometry should be queried.
916
+ * @returns The stroke join geometry.
917
+ */
918
+ getStrokeCornerGeometry(id: DesignBlockId): StrokeCornerGeometry;
919
+ /**
920
+ * Query if the given block has outline properties.
921
+ * @param id - The block to query.
922
+ * @returns true, if the block has outline properties.
923
+ * @deprecated Use `hasStroke`.
924
+ */
925
+ hasOutline(id: DesignBlockId): boolean;
926
+ /**
927
+ * Set the outline color of the given design block.
928
+ * @param id - The block whose outline color should be set.
929
+ * @param color - The outline color to be set, a tuple of
930
+ * @param r - The red color component in the range of 0 to 1.
931
+ * @param g - The green color component in the range of 0 to 1.
932
+ * @param b - The blue color component in the range of 0 to 1.
933
+ * @param a - The alpha color component in the range of 0 to 1.
934
+ * @deprecated Use `setStrokeColorRGBA`.
935
+ */
936
+ setOutlineColorRGBA(id: DesignBlockId, r: number, g: number, b: number, a?: number): void;
937
+ /**
938
+ * Get the outline color of the given design block.
939
+ * @param id - The block whose outline color should be queried.
940
+ * @returns The outline color.
941
+ * @deprecated Use `getStrokeColorRGBA`.
942
+ */
943
+ getOutlineColorRGBA(id: DesignBlockId): RGBA;
944
+ /**
945
+ * Enable or disable the outline of the given design block.
946
+ * @param id - The block whose outline should be enabled or disabled.
947
+ * @param enabled - If true, the outline will be enabled.
948
+ * @deprecated Use `setStrokeEnabled`.
949
+ */
950
+ setOutlineEnabled(id: DesignBlockId, enabled: boolean): void;
951
+ /**
952
+ * Query if the outline of the given design block is enabled.
953
+ * @param id - The block whose outline state should be queried.
954
+ * @returns True, if outline is enabled.
955
+ * @deprecated Use `isStrokeEnabled`.
956
+ */
957
+ isOutlineEnabled(id: DesignBlockId): boolean;
958
+ /**
959
+ * Set the outline width of the given design block.
960
+ * @param id - The block whose outline width should be set.
961
+ * @param width - The outline width to be set.
962
+ * @deprecated Use `setStrokeWidth`.
963
+ */
964
+ setOutlineWidth(id: DesignBlockId, width: number): void;
965
+ /**
966
+ * Get the outline width of the given design block.
967
+ * @param id - The block whose outline width should be queried.
968
+ * @returns The outline width.
969
+ * @deprecated Use the Stroke function
970
+ * @deprecated Use `getStrokeWidth`.
971
+ */
972
+ getOutlineWidth(id: DesignBlockId): number;
973
+ /**
974
+ * Query if the given block has fill color properties.
975
+ * @param id - The block to query.
976
+ * @returns true, if the block has fill color properties, an error otherwise.
977
+ */
978
+ hasFill(id: DesignBlockId): boolean;
979
+ /**
980
+ * Query if the fill of the given design block is enabled.
981
+ * @param id - The block whose fill state should be queried.
982
+ * @returns A result holding the fill state or an error.
983
+ */
984
+ isFillEnabled(id: DesignBlockId): boolean;
985
+ /**
986
+ * Enable or disable the fill of the given design block.
987
+ * @param id - The block whose fill should be enabled or disabled.
988
+ * @param enabled - If true, the fill will be enabled.
989
+ * @returns An empty result on success, an error otherwise.
990
+ */
991
+ setFillEnabled(id: DesignBlockId, enabled: boolean): void;
992
+ /**
993
+ * Set the fill type of the given design block.
994
+ * @param id - The block whose fill type should be set.
995
+ * @param type - The fill type to set.
996
+ * @returns An empty result on success, an error otherwise.
997
+ */
998
+ setFillType(id: DesignBlockId, fillType: FillType): void;
999
+ /**
1000
+ * Get the fill type of the given design block.
1001
+ * @param id - The block whose fill type should be queried.
1002
+ * @returns The block's fill type or an error.
1003
+ */
1004
+ getFillType(id: DesignBlockId): FillType;
1005
+ /**
1006
+ * Set the fill color of the given design block.
1007
+ * @param id - The block whose fill color should be set.
1008
+ * @param r - The red color component in the range of 0 to 1.
1009
+ * @param g - The green color component in the range of 0 to 1.
1010
+ * @param b - The blue color component in the range of 0 to 1.
1011
+ * @param a - The alpha color component in the range of 0 to 1.
1012
+ * @returns An empty result on success, an error otherwise.
1013
+ */
1014
+ setFillSolidColor(id: DesignBlockId, r: number, g: number, b: number, a?: number): void;
1015
+ /**
1016
+ * Get the fill color of the given design block.
1017
+ * @param id - The block whose fill color should be queried.
1018
+ * @returns A result holding the fill color or an error.
1019
+ */
1020
+ getFillSolidColor(id: DesignBlockId): RGBA;
1021
+ /**
1022
+ * Set the gradient type of the given design block.
1023
+ * @param id - The block whose gradient type should be set.
1024
+ * @param type - The gradient type.
1025
+ * @returns An empty result on success, an error otherwise.
1026
+ */
1027
+ setFillGradientType(id: DesignBlockId, gradientType: GradientType): void;
1028
+ /**
1029
+ * Get the gradient type of the given design block.
1030
+ * @param id - The block whose gradient type should be queried.
1031
+ * @returns The gradient type.
1032
+ */
1033
+ getFillGradientType(id: DesignBlockId): GradientType;
1034
+ /**
1035
+ * Add a gradient color stop on a design block.
1036
+ * @param id - The block on which a gradient color stop should be added.
1037
+ * @param stop - Where to add a color stop in the range 0 to 1.
1038
+ * @param r - The red color component in the range of 0 to 1.
1039
+ * @param g - The green color component in the range of 0 to 1.
1040
+ * @param b - The blue color component in the range of 0 to 1.
1041
+ * @param a - The alpha color component in the range of 0 to 1.
1042
+ * @returns An empty result on success, an error otherwise.
1043
+ */
1044
+ addFillGradientColorStop(id: DesignBlockId, stop: number, r: number, g: number, b: number, a?: number): void;
1045
+ /**
1046
+ * Remove a previously gradient color stop on a design block.
1047
+ * @param id - The block from which to remove the gradient color stop.
1048
+ * @param stop - The stop's position.
1049
+ * @returns An empty result on success, an error otherwise.
1050
+ */
1051
+ removeFillGradientColorStop(id: DesignBlockId, stop: number): void;
1052
+ /**
1053
+ * Get the gradient fill color stops of the given design block.
1054
+ * @param id - The block whose gradient color stop should be queried.
1055
+ * @returns All of the design block's gradient color stops.
1056
+ */
1057
+ getFillGradientColorStops(id: DesignBlockId): GradientstopRGBA[];
1058
+ /**
1059
+ * Set the gradient fill color stops of the given design block, overwriting previously set color stops.
1060
+ * @param id - The block whose gradient color stop should be set.
1061
+ * @param stops - The gradient color stops to set.
1062
+ * @returns An empty result on success, an error otherwise.
1063
+ */
1064
+ setFillGradientColorStops(id: DesignBlockId, stops: GradientstopRGBA[]): void;
1065
+ /**
1066
+ * Set the position of a gradient's control point.
1067
+ * Note that Different gradient types of different control points.
1068
+ * @param id - The block whose gradient control point should be set.
1069
+ * @param gradientControlPointType - The type of control point.
1070
+ * @param x - The horizontal component of the control point.
1071
+ * @param y - The vertical component of the control point.
1072
+ * @returns true if the control point was set, an error otherwise.
1073
+ */
1074
+ setFillGradientControlPoint(id: DesignBlockId, gradientControlPointType: GradientControlPointType, x: number, y: number): boolean;
1075
+ /**
1076
+ * Get the horizontal component of a gradient's control point.
1077
+ * @param id - The block whose gradient control point should be queried.
1078
+ * @param gradientControlPointType - The type of control point.
1079
+ * @returns The horizontal component of the control point, an error otherwise.
1080
+ */
1081
+ getFillGradientControlPointX(id: DesignBlockId, gradientControlPointType: GradientControlPointType): number;
1082
+ /**
1083
+ * Get the vertical component of a gradient's control point.
1084
+ * @param id - The block whose gradient control point should be queried.
1085
+ * @param gradientControlPointType - The type of control point.
1086
+ * @returns The vertical component of the control point, an error otherwise.
1087
+ */
1088
+ getFillGradientControlPointY(id: DesignBlockId, gradientControlPointType: GradientControlPointType): number;
1089
+ /**
1090
+ * Set a gradient's radius.
1091
+ * Note that Not all gradients have a radius.
1092
+ * @param id - The block whose gradient radius should be set.
1093
+ * @param radius - The gradient's radius.
1094
+ * @returns true if the control point was set, an error otherwise.
1095
+ */
1096
+ setFillGradientRadius(id: DesignBlockId, radius: number): boolean;
1097
+ /**
1098
+ * Get a gradient's radius.
1099
+ * Note that Not all gradients have a radius.
1100
+ * @param id - The block whose gradient radius should be queried.
1101
+ * @returns the gradient's radius, an error otherwise.
1102
+ */
1103
+ getFillGradientRadius(id: DesignBlockId): number;
1168
1104
  }
1169
1105
 
1170
1106
  /**
1171
1107
  * @public
1172
1108
  */
1173
1109
  export declare type BlockEvent = {
1174
- block: DesignBlockId;
1175
- type: 'Created' | 'Updated' | 'Destroyed';
1110
+ block: DesignBlockId;
1111
+ type: 'Created' | 'Updated' | 'Destroyed';
1176
1112
  };
1177
1113
 
1178
1114
  /** @public */
1179
1115
  declare interface BlockEvent_2 {
1180
- block: Block;
1181
- type: 'Created' | 'Updated' | 'Destroyed';
1116
+ block: Block;
1117
+ type: 'Created' | 'Updated' | 'Destroyed';
1182
1118
  }
1183
1119
 
1184
1120
  /** @public */
1185
1121
  declare type Callbacks = {
1186
- log?: Logger;
1122
+ log?: Logger;
1187
1123
  };
1188
1124
 
1189
1125
  /** @public */
1190
1126
  declare type Callbacks_2 = _EngineConfigTypes.Callbacks & {
1191
- onBack?: () => void;
1192
- onClose?: () => void;
1193
- onShare?: (s: string) => void | Promise<void>;
1194
- onSave?: (s: string) => void | Promise<void>;
1195
- onLoad?: (() => Promise<string>) | 'upload';
1196
- onDownload?: ((s: string) => void | Promise<void>) | 'download';
1197
- onExport?:
1198
- | ((blobs: Blob[], options: ExportOptions) => void | Promise<void>)
1199
- | 'download';
1200
- onUpload?:
1201
- | OnUploadCallback
1202
- | 'local'
1203
- | (Partial<OnUploadOptions> & {
1127
+ onBack?: () => void | Promise<void>;
1128
+ onClose?: () => void | Promise<void>;
1129
+ onShare?: (s: string) => void | Promise<void>;
1130
+ onSave?: (s: string) => void | Promise<void>;
1131
+ onLoad?: (() => Promise<string>) | 'upload';
1132
+ onDownload?: ((s: string) => void | Promise<void>) | 'download';
1133
+ onExport?: ((blobs: Blob[], options: ExportOptions) => void | Promise<void>) | 'download';
1134
+ onUpload?: OnUploadCallback | 'local' | (Partial<OnUploadOptions> & {
1204
1135
  callback: OnUploadCallback;
1205
- });
1206
- onUnsupportedBrowser?: () => void;
1136
+ });
1137
+ onUnsupportedBrowser?: () => void;
1207
1138
  };
1208
1139
 
1209
1140
  /**
@@ -1211,10 +1142,10 @@ declare type Callbacks_2 = _EngineConfigTypes.Callbacks & {
1211
1142
  * @public
1212
1143
  */
1213
1144
  export declare interface CMYKColor {
1214
- c: number;
1215
- m: number;
1216
- y: number;
1217
- k: number;
1145
+ c: number;
1146
+ m: number;
1147
+ y: number;
1148
+ k: number;
1218
1149
  }
1219
1150
 
1220
1151
  /**
@@ -1226,33 +1157,33 @@ declare type Color = HexColorString | RGBColor | RGBAColor | SpotColor;
1226
1157
 
1227
1158
  /** @public */
1228
1159
  declare type ColorDefinition = Preset & {
1229
- value: Color;
1160
+ value: Color;
1230
1161
  };
1231
1162
 
1232
1163
  /** @public */
1233
1164
  declare type ColorPaletteDefinition = Preset & {
1234
- entries: Color[];
1165
+ entries: Color[];
1235
1166
  };
1236
1167
 
1237
1168
  declare namespace ConfigTypes {
1238
- export {
1239
- _RequiredConfiguration as Configuration,
1240
- Theme,
1241
- Scale,
1242
- PartialImageElement,
1243
- I18n,
1244
- A11y,
1245
- OnUploadCallback,
1246
- OnUploadOptions,
1247
- Callbacks_2 as Callbacks,
1248
- BleedMarginOptions,
1249
- FontSizeOptions,
1250
- UIOptionsForSingleDesignUnit,
1251
- UIOptionsPerDesignUnit,
1252
- ViewStyle
1253
- };
1169
+ export {
1170
+ _RequiredConfiguration as Configuration,
1171
+ Theme,
1172
+ Scale,
1173
+ PartialImageElement,
1174
+ I18n,
1175
+ A11y,
1176
+ OnUploadCallback,
1177
+ OnUploadOptions,
1178
+ Callbacks_2 as Callbacks,
1179
+ BleedMarginOptions,
1180
+ FontSizeOptions,
1181
+ UIOptionsForSingleDesignUnit,
1182
+ UIOptionsPerDesignUnit,
1183
+ ViewStyle
1184
+ }
1254
1185
  }
1255
- export { ConfigTypes };
1186
+ export { ConfigTypes }
1256
1187
 
1257
1188
  /**
1258
1189
  * @public
@@ -1262,9 +1193,7 @@ export { ConfigTypes };
1262
1193
  * optional and what mandatory. This is Configuration, but `ui` is recursively
1263
1194
  * optional, and all other props are non-recursively optional
1264
1195
  */
1265
- export declare type Configuration = Partial<
1266
- _DeepOptional<_RequiredConfiguration, 'ui'>
1267
- >;
1196
+ export declare type Configuration = Partial<_DeepOptional<_RequiredConfiguration, 'ui'>>;
1268
1197
 
1269
1198
  /**
1270
1199
  * - Crop: Manual crop.
@@ -1277,131 +1206,124 @@ export declare type ContentFillMode = 'Crop' | 'Cover' | 'Contain';
1277
1206
 
1278
1207
  /** @public */
1279
1208
  declare type Core = {
1280
- baseURL: string;
1209
+ baseURL: string;
1281
1210
  };
1282
1211
 
1283
1212
  /**
1284
1213
  * @public
1285
1214
  */
1286
1215
  declare class CreativeEditorSDK {
1287
- #private;
1288
- engine: API;
1289
- /**
1290
- * Exports one or multiple page(s) as an file in the given mimeType
1291
- *
1292
- * Please note: the `onExport` callback provided in the configuration will be
1293
- * not called. This callback is for exports triggered by an user interaction.
1294
- *
1295
- * @param options - options for the export
1296
- *
1297
- * @returns a promise with an object holding `blobs` of the export pages and the provided `options`.
1298
- */
1299
- export(
1300
- options: ExportOptions
1301
- ): Promise<{
1302
- blobs: Blob[];
1303
- options: ExportOptions;
1304
- }>;
1305
- /**
1306
- * Load an encoded scene from the provided string.
1307
- * @deprecated Use `loadFromString` instead.
1308
- * @param scene - A string starting with UBQ1 and containing the encoded scene.
1309
- */
1310
- load(scene: string): Promise<void>;
1311
- /**
1312
- * Load an encoded scene from the provided string.
1313
- * @param scene - A string starting with UBQ1 and containing the encoded scene.
1314
- * @returns a promise which resolves if the scene was successfully loaded.
1315
- */
1316
- loadFromString(scene: string): Promise<void>;
1317
- /**
1318
- * Load the scene stored in the file at the given URL.
1319
- * @param url - The url to fetch to acquire the scene string.
1320
- * @returns a promise which resolves if the scene was successfully loaded.
1321
- */
1322
- loadFromURL(url: string): Promise<void>;
1323
- /**
1324
- * Save and return a scene as a base64 encoded string.
1325
- *
1326
- * @returns a promise with the scene as a string
1327
- */
1328
- save(): Promise<string>;
1329
- /**
1330
- * Adds or update text variable definition.
1331
- *
1332
- * Translations can be added inside the custom locale translations under the
1333
- * key `variables.${id}.label`.
1334
- *
1335
- * @param definitions - text variable definitions to add or update
1336
- *
1337
- * @returns a resolved promise if all variables were set successfully.
1338
- */
1339
- setVariableDefinitions(definitions: {
1340
- [id: string]: _EngineConfigTypes.VariableDefinition;
1341
- }): Promise<void>;
1342
- /**
1343
- * Adds an image definition which can be used in the image library.
1344
- *
1345
- * @param definitions - image definitions
1346
- *
1347
- * @returns a resolved promise if all images were add successfully
1348
- */
1349
- setImageDefinitions(definitions: {
1350
- [id: string]: _EngineConfigTypes.ImageDefinition;
1351
- }): Promise<void[]>;
1352
- /**
1353
- * Adds translations to be used by the editor.
1354
- *
1355
- * @param translations - locale to a translation object
1356
- *
1357
- * @example
1358
- * ```
1359
- * setTranslations({
1360
- * en: {
1361
- * presets: {
1362
- * scene: ...
1363
- * }
1364
- * }
1365
- * })
1366
- * ```
1367
- */
1368
- setTranslations(definition: { [locale: string]: object }): void;
1369
- unstable_switchPage(pageId: number): void;
1370
- unstable_getPages(): Promise<number[]>;
1371
- unstable_getActivePage(): Promise<number>;
1372
- unstable_onActivePageChanged(callback: (id: number) => void): () => void;
1373
- /**
1374
- * Disposes the editor and engine if no longer needed.
1375
- */
1376
- dispose(): void;
1377
- /**
1378
- * Initializes the editor and renders it for the given container.
1379
- *
1380
- * @param container - the container to mount the editor as a HTML element or selector
1381
- * @param config - the initial configuration to start the editor
1382
- *
1383
- * @returns a promise which resolves after the engine is ready to receive further commands on the CreativeEditorSDK instance
1384
- */
1385
- static init(
1386
- container: HTMLDivElement | string,
1387
- config?: Configuration
1388
- ): Promise<CreativeEditorSDK>;
1216
+ #private;
1217
+ engine: API;
1218
+ /**
1219
+ * Exports one or multiple page(s) as an file in the given mimeType
1220
+ *
1221
+ * Please note: the `onExport` callback provided in the configuration will be
1222
+ * not called. This callback is for exports triggered by an user interaction.
1223
+ *
1224
+ * @param options - options for the export
1225
+ *
1226
+ * @returns a promise with an object holding `blobs` of the export pages and the provided `options`.
1227
+ */
1228
+ export(options: ExportOptions): Promise<{
1229
+ blobs: Blob[];
1230
+ options: ExportOptions;
1231
+ }>;
1232
+ /**
1233
+ * Load an encoded scene from the provided string.
1234
+ * @deprecated Use `loadFromString` instead.
1235
+ * @param scene - A string starting with UBQ1 and containing the encoded scene.
1236
+ */
1237
+ load(scene: string): Promise<void>;
1238
+ /**
1239
+ * Load an encoded scene from the provided string.
1240
+ * @param scene - A string starting with UBQ1 and containing the encoded scene.
1241
+ * @returns a promise which resolves if the scene was successfully loaded.
1242
+ */
1243
+ loadFromString(scene: string): Promise<void>;
1244
+ /**
1245
+ * Load the scene stored in the file at the given URL.
1246
+ * @param url - The url to fetch to acquire the scene string.
1247
+ * @returns a promise which resolves if the scene was successfully loaded.
1248
+ */
1249
+ loadFromURL(url: string): Promise<void>;
1250
+ /**
1251
+ * Save and return a scene as a base64 encoded string.
1252
+ *
1253
+ * @returns a promise with the scene as a string
1254
+ */
1255
+ save(): Promise<string>;
1256
+ /**
1257
+ * Adds or update text variable definition.
1258
+ *
1259
+ * Translations can be added inside the custom locale translations under the
1260
+ * key `variables.${id}.label`.
1261
+ *
1262
+ * @param definitions - text variable definitions to add or update
1263
+ *
1264
+ * @returns a resolved promise if all variables were set successfully.
1265
+ */
1266
+ setVariableDefinitions(definitions: {
1267
+ [id: string]: _EngineConfigTypes.VariableDefinition;
1268
+ }): Promise<void>;
1269
+ /**
1270
+ * Adds an image definition which can be used in the image library.
1271
+ *
1272
+ * @param definitions - image definitions
1273
+ *
1274
+ * @returns a resolved promise if all images were add successfully
1275
+ */
1276
+ setImageDefinitions(definitions: {
1277
+ [id: string]: _EngineConfigTypes.ImageDefinition;
1278
+ }): Promise<void[]>;
1279
+ /**
1280
+ * Adds translations to be used by the editor.
1281
+ *
1282
+ * @param translations - locale to a translation object
1283
+ *
1284
+ * @example
1285
+ * ```
1286
+ * setTranslations({
1287
+ * en: {
1288
+ * presets: {
1289
+ * scene: ...
1290
+ * }
1291
+ * }
1292
+ * })
1293
+ * ```
1294
+ */
1295
+ setTranslations(definition: {
1296
+ [locale: string]: object;
1297
+ }): void;
1298
+ unstable_switchPage(pageId: number): void;
1299
+ unstable_getPages(): Promise<number[]>;
1300
+ unstable_getActivePage(): Promise<number>;
1301
+ unstable_onActivePageChanged(callback: (id: number) => void): () => void;
1302
+ /**
1303
+ * Disposes the editor and engine if no longer needed.
1304
+ */
1305
+ dispose(): void;
1306
+ /**
1307
+ * Initializes the editor and renders it for the given container.
1308
+ *
1309
+ * @param container - the container to mount the editor as a HTML element or selector
1310
+ * @param config - the initial configuration to start the editor
1311
+ *
1312
+ * @returns a promise which resolves after the engine is ready to receive further commands on the CreativeEditorSDK instance
1313
+ */
1314
+ static init(container: HTMLDivElement | string, config?: Configuration): Promise<CreativeEditorSDK>;
1389
1315
  }
1390
1316
  export default CreativeEditorSDK;
1391
1317
 
1392
1318
  /** @public */
1393
- export declare type _DeepOptional<T, K extends keyof T> = Pick<
1394
- _DeepPartial<T>,
1395
- K
1396
- > &
1397
- Omit<T, K>;
1319
+ export declare type _DeepOptional<T, K extends keyof T> = Pick<_DeepPartial<T>, K> & Omit<T, K>;
1398
1320
 
1399
1321
  /**
1400
1322
  * Recursively makes all properties of an object Partial
1401
1323
  * @public
1402
1324
  */
1403
1325
  export declare type _DeepPartial<T> = {
1404
- [P in keyof T]?: _DeepPartial<T[P]>;
1326
+ [P in keyof T]?: _DeepPartial<T[P]>;
1405
1327
  };
1406
1328
 
1407
1329
  /**
@@ -1414,21 +1336,21 @@ export declare type DesignBlockId = number;
1414
1336
  * @public
1415
1337
  */
1416
1338
  export declare enum DesignBlockType {
1417
- Scene = '//ly.img.ubq/scene',
1418
- Stack = '//ly.img.ubq/stack',
1419
- Camera = '//ly.img.ubq/camera',
1420
- Page = '//ly.img.ubq/page',
1421
- Image = '//ly.img.ubq/image',
1422
- Video = '//ly.img.ubq/video',
1423
- Text = '//ly.img.ubq/text',
1424
- Sticker = '//ly.img.ubq/sticker',
1425
- VectorPath = '//ly.img.ubq/vector_path',
1426
- RectShape = '//ly.img.ubq/shapes/rect',
1427
- LineShape = '//ly.img.ubq/shapes/line',
1428
- StarShape = '//ly.img.ubq/shapes/star',
1429
- PolygonShape = '//ly.img.ubq/shapes/polygon',
1430
- EllipseShape = '//ly.img.ubq/shapes/ellipse',
1431
- Group = '//ly.img.ubq/group'
1339
+ Scene = "//ly.img.ubq/scene",
1340
+ Stack = "//ly.img.ubq/stack",
1341
+ Camera = "//ly.img.ubq/camera",
1342
+ Page = "//ly.img.ubq/page",
1343
+ Image = "//ly.img.ubq/image",
1344
+ Video = "//ly.img.ubq/video",
1345
+ Text = "//ly.img.ubq/text",
1346
+ Sticker = "//ly.img.ubq/sticker",
1347
+ VectorPath = "//ly.img.ubq/vector_path",
1348
+ RectShape = "//ly.img.ubq/shapes/rect",
1349
+ LineShape = "//ly.img.ubq/shapes/line",
1350
+ StarShape = "//ly.img.ubq/shapes/star",
1351
+ PolygonShape = "//ly.img.ubq/shapes/polygon",
1352
+ EllipseShape = "//ly.img.ubq/shapes/ellipse",
1353
+ Group = "//ly.img.ubq/group"
1432
1354
  }
1433
1355
 
1434
1356
  /** @public */
@@ -1438,243 +1360,228 @@ export declare type DesignUnit = 'mm' | 'px' | 'in';
1438
1360
  * @public
1439
1361
  */
1440
1362
  export declare class EditorAPI {
1441
- #private;
1442
-
1443
- /**
1444
- * Subscribe to changes to the editor state.
1445
- * @param callback - This function is called at the end of the engine update, if the editor state has changed.
1446
- * @returns A method to unsubscribe.
1447
- */
1448
- onStateChanged(callback: () => void): () => void;
1449
- /**
1450
- * Set the edit mode of the editor.
1451
- * An edit mode defines what type of content can currently be edited by the user.
1452
- * Hint: the initial edit mode is "Transform".
1453
- * @param mode - "Transform", "Crop", "Text", or a custom value.
1454
- */
1455
- setEditMode(mode: 'Transform' | 'Crop' | 'Text' | string): void;
1456
- /**
1457
- * Get the current edit mode of the editor.
1458
- * An edit mode defines what type of content can currently be edited by the user.
1459
- * @returns "Transform", "Crop", "Text", or a custom value.
1460
- */
1461
- getEditMode(): 'Transform' | 'Crop' | 'Text' | string;
1462
- /**
1463
- * Get the type of cursor that should be displayed by the application.
1464
- * @returns The cursor type.
1465
- */
1466
- getCursorType():
1467
- | 'Arrow'
1468
- | 'Move'
1469
- | 'MoveNotPermitted'
1470
- | 'Resize'
1471
- | 'Rotate'
1472
- | 'Text';
1473
- /**
1474
- * Get the rotation with which to render the mouse cursor.
1475
- * @returns The angle in radians.
1476
- */
1477
- getCursorRotation(): number;
1478
- /**
1479
- * Get the current text cursor's x position in screen space.
1480
- * @returns The text cursor's x position in screen space.
1481
- */
1482
- getTextCursorPositionInScreenSpaceX(): number;
1483
- /**
1484
- * Get the current text cursor's y position in screen space.
1485
- * @returns The text cursor's y position in screen space.
1486
- */
1487
- getTextCursorPositionInScreenSpaceY(): number;
1488
- /**
1489
- * Sets the zoom level of the scene.
1490
- * @param zoomLevel - The new zoom level.
1491
- */
1492
- setZoomLevel(zoomLevel?: number): void;
1493
- /**
1494
- * Query a camera zoom level.
1495
- * @returns The zoom level of the block's (main) camera.
1496
- */
1497
- getZoomLevel(): number;
1498
- /**
1499
- * Adds a new history state to the stack, if undoable changes were made.
1500
- */
1501
- addUndoStep(): void;
1502
- /**
1503
- * Undo one step in the history if an undo step is available.
1504
- */
1505
- undo(): void;
1506
- /**
1507
- * Redo one step in the history if a redo step is available.
1508
- */
1509
- redo(): void;
1510
- /**
1511
- * If an undo step is available.
1512
- *
1513
- * @returns True if an undo step is available.
1514
- */
1515
- canUndo(): boolean;
1516
- /**
1517
- * If a redo step is available.
1518
- *
1519
- * @returns True if a redo step is available.
1520
- */
1521
- canRedo(): boolean;
1522
- /**
1523
- * Set a boolean setting.
1524
- * @param keypath - The settings keypath, e.g. `ubq://doubleClickToCropEnabled`
1525
- * @param value - The value to set.
1526
- * @throws An error, if the keypath is invalid.
1527
- */
1528
- setSettingBool(keypath: string, value: boolean): void;
1529
- /**
1530
- * Get a boolean setting.
1531
- * @param keypath - The settings keypath, e.g. `ubq://doubleClickToCropEnabled`
1532
- * @throws An error, if the keypath is invalid.
1533
- */
1534
- getSettingBool(keypath: string): boolean;
1535
- /**
1536
- * Set an integer setting.
1537
- * @param keypath - The settings keypath.
1538
- * @param value - The value to set.
1539
- * @throws An error, if the keypath is invalid.
1540
- */
1541
- setSettingInt(keypath: string, value: number): void;
1542
- /**
1543
- * Get an integer setting.
1544
- * @param keypath - The settings keypath.
1545
- * @throws An error, if the keypath is invalid.
1546
- */
1547
- getSettingInt(keypath: string): number;
1548
- /**
1549
- * Set a float setting.
1550
- * @param keypath - The settings keypath, e.g. `ubq://positionSnappingThreshold`
1551
- * @param value - The value to set.
1552
- * @throws An error, if the keypath is invalid.
1553
- */
1554
- setSettingFloat(keypath: string, value: number): void;
1555
- /**
1556
- * Get a float setting.
1557
- * @param keypath - The settings keypath, e.g. `ubq://positionSnappingThreshold`
1558
- * @throws An error, if the keypath is invalid.
1559
- */
1560
- getSettingFloat(keypath: string): number;
1561
- /**
1562
- * Set a string setting.
1563
- * @param keypath - The settings keypath, e.g. `ubq://license`
1564
- * @param value - The value to set.
1565
- * @throws An error, if the keypath is invalid.
1566
- */
1567
- setSettingString(keypath: string, value: string): void;
1568
- /**
1569
- * Get a string setting.
1570
- * @param keypath - The settings keypath, e.g. `ubq://license`
1571
- * @throws An error, if the keypath is invalid.
1572
- */
1573
- getSettingString(keypath: string): string;
1574
- /**
1575
- * Set a color setting.
1576
- * @param keypath - The settings keypath, e.g. `ubq://highlightColor`.
1577
- * @param r - The red color component in the range of 0 to 1.
1578
- * @param g - The green color component in the range of 0 to 1.
1579
- * @param b - The blue color component in the range of 0 to 1.
1580
- * @param a - The alpha color component in the range of 0 to 1.
1581
- */
1582
- setSettingColorRGBA(
1583
- keypath: string,
1584
- r: number,
1585
- g: number,
1586
- b: number,
1587
- a: number
1588
- ): void;
1589
- /**
1590
- * Get a color setting.
1591
- * @param keypath - The settings keypath, e.g. `ubq://highlightColor`.
1592
- * @returns A tuple of channels red, green, blue and alpha in the range of 0 to 1.
1593
- */
1594
- getSettingColorRGBA(keypath: string): RGBA;
1595
- /**
1596
- * Set an enum setting.
1597
- * @param keypath - The settings keypath, e.g. `ubq://role`.
1598
- * @param value - The enum value as string.
1599
- */
1600
- setSettingEnum(keypath: string, value: string): void;
1601
- /**
1602
- * Get an enum setting.
1603
- * @param keypath - The settings keypath, e.g. `ubq://role`.
1604
- * @returns The value as string.
1605
- */
1606
- getSettingEnum(keypath: string): string;
1363
+ #private;
1364
+
1365
+ /**
1366
+ * Subscribe to changes to the editor state.
1367
+ * @param callback - This function is called at the end of the engine update, if the editor state has changed.
1368
+ * @returns A method to unsubscribe.
1369
+ */
1370
+ onStateChanged(callback: () => void): () => void;
1371
+ /**
1372
+ * Set the edit mode of the editor.
1373
+ * An edit mode defines what type of content can currently be edited by the user.
1374
+ * Hint: the initial edit mode is "Transform".
1375
+ * @param mode - "Transform", "Crop", "Text", or a custom value.
1376
+ */
1377
+ setEditMode(mode: 'Transform' | 'Crop' | 'Text' | string): void;
1378
+ /**
1379
+ * Get the current edit mode of the editor.
1380
+ * An edit mode defines what type of content can currently be edited by the user.
1381
+ * @returns "Transform", "Crop", "Text", or a custom value.
1382
+ */
1383
+ getEditMode(): 'Transform' | 'Crop' | 'Text' | string;
1384
+ /**
1385
+ * Get the type of cursor that should be displayed by the application.
1386
+ * @returns The cursor type.
1387
+ */
1388
+ getCursorType(): 'Arrow' | 'Move' | 'MoveNotPermitted' | 'Resize' | 'Rotate' | 'Text';
1389
+ /**
1390
+ * Get the rotation with which to render the mouse cursor.
1391
+ * @returns The angle in radians.
1392
+ */
1393
+ getCursorRotation(): number;
1394
+ /**
1395
+ * Get the current text cursor's x position in screen space.
1396
+ * @returns The text cursor's x position in screen space.
1397
+ */
1398
+ getTextCursorPositionInScreenSpaceX(): number;
1399
+ /**
1400
+ * Get the current text cursor's y position in screen space.
1401
+ * @returns The text cursor's y position in screen space.
1402
+ */
1403
+ getTextCursorPositionInScreenSpaceY(): number;
1404
+ /**
1405
+ * Sets the zoom level of the scene.
1406
+ * @param zoomLevel - The new zoom level.
1407
+ */
1408
+ setZoomLevel(zoomLevel?: number): void;
1409
+ /**
1410
+ * Query a camera zoom level.
1411
+ * @returns The zoom level of the block's (main) camera.
1412
+ */
1413
+ getZoomLevel(): number;
1414
+ /**
1415
+ * Adds a new history state to the stack, if undoable changes were made.
1416
+ */
1417
+ addUndoStep(): void;
1418
+ /**
1419
+ * Undo one step in the history if an undo step is available.
1420
+ */
1421
+ undo(): void;
1422
+ /**
1423
+ * Redo one step in the history if a redo step is available.
1424
+ */
1425
+ redo(): void;
1426
+ /**
1427
+ * If an undo step is available.
1428
+ *
1429
+ * @returns True if an undo step is available.
1430
+ */
1431
+ canUndo(): boolean;
1432
+ /**
1433
+ * If a redo step is available.
1434
+ *
1435
+ * @returns True if a redo step is available.
1436
+ */
1437
+ canRedo(): boolean;
1438
+ /**
1439
+ * Set a boolean setting.
1440
+ * @param keypath - The settings keypath, e.g. `ubq://doubleClickToCropEnabled`
1441
+ * @param value - The value to set.
1442
+ * @throws An error, if the keypath is invalid.
1443
+ */
1444
+ setSettingBool(keypath: string, value: boolean): void;
1445
+ /**
1446
+ * Get a boolean setting.
1447
+ * @param keypath - The settings keypath, e.g. `ubq://doubleClickToCropEnabled`
1448
+ * @throws An error, if the keypath is invalid.
1449
+ */
1450
+ getSettingBool(keypath: string): boolean;
1451
+ /**
1452
+ * Set an integer setting.
1453
+ * @param keypath - The settings keypath.
1454
+ * @param value - The value to set.
1455
+ * @throws An error, if the keypath is invalid.
1456
+ */
1457
+ setSettingInt(keypath: string, value: number): void;
1458
+ /**
1459
+ * Get an integer setting.
1460
+ * @param keypath - The settings keypath.
1461
+ * @throws An error, if the keypath is invalid.
1462
+ */
1463
+ getSettingInt(keypath: string): number;
1464
+ /**
1465
+ * Set a float setting.
1466
+ * @param keypath - The settings keypath, e.g. `ubq://positionSnappingThreshold`
1467
+ * @param value - The value to set.
1468
+ * @throws An error, if the keypath is invalid.
1469
+ */
1470
+ setSettingFloat(keypath: string, value: number): void;
1471
+ /**
1472
+ * Get a float setting.
1473
+ * @param keypath - The settings keypath, e.g. `ubq://positionSnappingThreshold`
1474
+ * @throws An error, if the keypath is invalid.
1475
+ */
1476
+ getSettingFloat(keypath: string): number;
1477
+ /**
1478
+ * Set a string setting.
1479
+ * @param keypath - The settings keypath, e.g. `ubq://license`
1480
+ * @param value - The value to set.
1481
+ * @throws An error, if the keypath is invalid.
1482
+ */
1483
+ setSettingString(keypath: string, value: string): void;
1484
+ /**
1485
+ * Get a string setting.
1486
+ * @param keypath - The settings keypath, e.g. `ubq://license`
1487
+ * @throws An error, if the keypath is invalid.
1488
+ */
1489
+ getSettingString(keypath: string): string;
1490
+ /**
1491
+ * Set a color setting.
1492
+ * @param keypath - The settings keypath, e.g. `ubq://highlightColor`.
1493
+ * @param r - The red color component in the range of 0 to 1.
1494
+ * @param g - The green color component in the range of 0 to 1.
1495
+ * @param b - The blue color component in the range of 0 to 1.
1496
+ * @param a - The alpha color component in the range of 0 to 1.
1497
+ */
1498
+ setSettingColorRGBA(keypath: string, r: number, g: number, b: number, a?: number): void;
1499
+ /**
1500
+ * Get a color setting.
1501
+ * @param keypath - The settings keypath, e.g. `ubq://highlightColor`.
1502
+ * @returns A tuple of channels red, green, blue and alpha in the range of 0 to 1.
1503
+ */
1504
+ getSettingColorRGBA(keypath: string): RGBA;
1505
+ /**
1506
+ * Set an enum setting.
1507
+ * @param keypath - The settings keypath, e.g. `ubq://role`.
1508
+ * @param value - The enum value as string.
1509
+ */
1510
+ setSettingEnum(keypath: string, value: string): void;
1511
+ /**
1512
+ * Get an enum setting.
1513
+ * @param keypath - The settings keypath, e.g. `ubq://role`.
1514
+ * @returns The value as string.
1515
+ */
1516
+ getSettingEnum(keypath: string): string;
1607
1517
  }
1608
1518
 
1609
1519
  declare namespace _EngineConfigTypes {
1610
- export {
1611
- HexColorString,
1612
- Color,
1613
- AssetSources,
1614
- AssetSource,
1615
- AssetResult,
1616
- AssetsQueryResult,
1617
- QueryData,
1618
- Preset,
1619
- VariableDefinition,
1620
- ColorDefinition,
1621
- ColorPaletteDefinition,
1622
- PageFormatDefinition,
1623
- TemplateDefinition,
1624
- TypefaceDefinition,
1625
- ImageDefinition,
1626
- Presets,
1627
- Variables,
1628
- Core,
1629
- Extensions,
1630
- Scene,
1631
- Page,
1632
- Callbacks
1633
- };
1520
+ export {
1521
+ HexColorString,
1522
+ Color,
1523
+ AssetSources,
1524
+ AssetSource,
1525
+ AssetResult,
1526
+ AssetsQueryResult,
1527
+ QueryData,
1528
+ Preset,
1529
+ VariableDefinition,
1530
+ ColorDefinition,
1531
+ ColorPaletteDefinition,
1532
+ PageFormatDefinition,
1533
+ TemplateDefinition,
1534
+ TypefaceDefinition,
1535
+ ImageDefinition,
1536
+ Presets,
1537
+ Variables,
1538
+ Core,
1539
+ Extensions,
1540
+ Scene,
1541
+ Page,
1542
+ Callbacks
1543
+ }
1634
1544
  }
1635
- export { _EngineConfigTypes };
1545
+ export { _EngineConfigTypes }
1636
1546
 
1637
1547
  /** @public */
1638
1548
  export declare interface _EngineConfiguration {
1639
- baseURL: string;
1640
- license?: string;
1641
- role: RoleString;
1642
- featureFlags?: Record<string, string | boolean>;
1643
- extensions: _EngineConfigTypes.Extensions;
1644
- core: _EngineConfigTypes.Core;
1645
- scene: _EngineConfigTypes.Scene;
1646
- page: _EngineConfigTypes.Page;
1647
- assetSources: _EngineConfigTypes.AssetSources;
1648
- presets: _EngineConfigTypes.Presets;
1649
- variables: _EngineConfigTypes.Variables;
1650
- callbacks: _EngineConfigTypes.Callbacks;
1651
- /**
1652
- * The default font used by a text added to the scene. Needs to be the id of
1653
- * the font from a extension pack including namespace, e.g.
1654
- *
1655
- * '//ly.img.cesdk.fonts/roboto_regular'
1656
- *
1657
- * If not configured the fallback font is used.
1658
- */
1659
- defaultFont?: string;
1549
+ baseURL: string;
1550
+ license?: string;
1551
+ role: RoleString;
1552
+ featureFlags?: Record<string, string | boolean>;
1553
+ extensions: _EngineConfigTypes.Extensions;
1554
+ core: _EngineConfigTypes.Core;
1555
+ scene: _EngineConfigTypes.Scene;
1556
+ page: _EngineConfigTypes.Page;
1557
+ assetSources: _EngineConfigTypes.AssetSources;
1558
+ presets: _EngineConfigTypes.Presets;
1559
+ variables: _EngineConfigTypes.Variables;
1560
+ callbacks: _EngineConfigTypes.Callbacks;
1561
+ /**
1562
+ * The default font used by a text added to the scene. Needs to be the id of
1563
+ * the font from a extension pack including namespace, e.g.
1564
+ *
1565
+ * '//ly.img.cesdk.fonts/roboto_regular'
1566
+ *
1567
+ * If not configured the fallback font is used.
1568
+ */
1569
+ defaultFont?: string;
1660
1570
  }
1661
1571
 
1662
1572
  /**
1663
1573
  * @public
1664
1574
  */
1665
1575
  export declare class EventAPI {
1666
- #private;
1667
-
1668
- /**
1669
- * Subscribe to block life-cycle events.
1670
- * @param blocks - A list of blocks to filter events by. If the list is empty, events for every block are sent.
1671
- * @param callback - The event callback. Events are bundled and sent at the end of each engine update.
1672
- * @returns A method to unsubscribe.
1673
- */
1674
- subscribe(
1675
- blocks: DesignBlockId[],
1676
- callback: (events: BlockEvent[]) => void
1677
- ): () => void;
1576
+ #private;
1577
+
1578
+ /**
1579
+ * Subscribe to block life-cycle events.
1580
+ * @param blocks - A list of blocks to filter events by. If the list is empty, events for every block are sent.
1581
+ * @param callback - The event callback. Events are bundled and sent at the end of each engine update.
1582
+ * @returns A method to unsubscribe.
1583
+ */
1584
+ subscribe(blocks: DesignBlockId[], callback: (events: BlockEvent[]) => void): () => void;
1678
1585
  }
1679
1586
 
1680
1587
  /** @public */
@@ -1682,57 +1589,57 @@ declare type ExportFormat = 'image/png' | 'video/mp4' | 'application/pdf';
1682
1589
 
1683
1590
  /** @public */
1684
1591
  export declare interface ExportOptions {
1685
- /** The mime type of the exported blob */
1686
- mimeType: MimeType_2;
1687
- 'image/png'?: {
1688
- /**
1689
- * The PNG compression level to use, when exporting to PNG.
1690
- *
1691
- * Valid values are 0 to 9, higher means smaller, but slower.
1692
- * Quality is not affected.
1693
- * Ignored for other encodings.
1694
- * @defaultValue 5.
1695
- */
1696
- compression: number;
1697
- };
1698
- 'image/jpeg'?: {
1699
- /**
1700
- * The JPEG quality to use when encoding to JPEG.
1701
- *
1702
- * Valid values are (0-1], higher means better quality.
1703
- * Ignored for other encodings.
1704
- *
1705
- * @defaultValue 0.9
1706
- */
1707
- quality: number;
1708
- };
1709
- /** The pages to export with the selected page as the default */
1710
- pages?: number[];
1592
+ /** The mime type of the exported blob */
1593
+ mimeType: MimeType_2;
1594
+ 'image/png'?: {
1595
+ /**
1596
+ * The PNG compression level to use, when exporting to PNG.
1597
+ *
1598
+ * Valid values are 0 to 9, higher means smaller, but slower.
1599
+ * Quality is not affected.
1600
+ * Ignored for other encodings.
1601
+ * @defaultValue 5.
1602
+ */
1603
+ compression: number;
1604
+ };
1605
+ 'image/jpeg'?: {
1606
+ /**
1607
+ * The JPEG quality to use when encoding to JPEG.
1608
+ *
1609
+ * Valid values are (0-1], higher means better quality.
1610
+ * Ignored for other encodings.
1611
+ *
1612
+ * @defaultValue 0.9
1613
+ */
1614
+ quality: number;
1615
+ };
1616
+ /** The pages to export with the selected page as the default */
1617
+ pages?: number[];
1711
1618
  }
1712
1619
 
1713
1620
  /** @public */
1714
1621
  declare interface ExportOptions_2 {
1715
- jpegQuality: number;
1716
- pngCompressionLevel: number;
1717
- useTargetSize: boolean;
1718
- targetWidth: number;
1719
- targetHeight: number;
1622
+ jpegQuality: number;
1623
+ pngCompressionLevel: number;
1624
+ useTargetSize: boolean;
1625
+ targetWidth: number;
1626
+ targetHeight: number;
1720
1627
  }
1721
1628
 
1722
1629
  /** @public */
1723
1630
  declare interface ExportVideoOptions {
1724
- h264Profile: number;
1725
- h264Level: number;
1726
- framerate: number;
1727
- useTargetSize: boolean;
1728
- targetWidth: number;
1729
- targetHeight: number;
1631
+ h264Profile: number;
1632
+ h264Level: number;
1633
+ framerate: number;
1634
+ useTargetSize: boolean;
1635
+ targetWidth: number;
1636
+ targetHeight: number;
1730
1637
  }
1731
1638
 
1732
1639
  /** @public */
1733
1640
  declare type Extensions = {
1734
- baseURL: string;
1735
- entries: string[];
1641
+ baseURL: string;
1642
+ entries: string[];
1736
1643
  };
1737
1644
 
1738
1645
  /**
@@ -1742,32 +1649,24 @@ export declare type FillType = 'Solid' | 'Gradient';
1742
1649
 
1743
1650
  /** @public */
1744
1651
  declare interface Flip {
1745
- horizontal: boolean;
1746
- vertical: boolean;
1652
+ horizontal: boolean;
1653
+ vertical: boolean;
1747
1654
  }
1748
1655
 
1656
+ /** @public */
1749
1657
  declare interface FontSizeOptions {
1750
- /**
1751
- * The font size options that can be selected from a dropdown in the UI.
1752
- * Other font size values can be entered directly using the input field.
1753
- */
1754
- dropdownOptions: number[];
1658
+ /**
1659
+ * The font size options that can be selected from a dropdown in the UI.
1660
+ * Other font size values can be entered directly using the input field.
1661
+ */
1662
+ dropdownOptions: number[];
1755
1663
  }
1756
1664
 
1757
1665
  /** @public */
1758
1666
  export declare type FontStyle = 'normal' | 'italic';
1759
1667
 
1760
1668
  /** @public */
1761
- export declare type FontWeight =
1762
- | 'thin'
1763
- | 'extraLight'
1764
- | 'Light'
1765
- | 'normal'
1766
- | 'medium'
1767
- | 'semiBold'
1768
- | 'bold'
1769
- | 'extraBold'
1770
- | 'heavy';
1669
+ export declare type FontWeight = 'thin' | 'extraLight' | 'Light' | 'normal' | 'medium' | 'semiBold' | 'bold' | 'extraBold' | 'heavy';
1771
1670
 
1772
1671
  /**
1773
1672
  * @public
@@ -1778,11 +1677,11 @@ export declare type GradientControlPointType = 'Start' | 'End' | 'Center';
1778
1677
  * @public
1779
1678
  */
1780
1679
  export declare type GradientstopRGBA = [
1781
- stop: number,
1782
- r: number,
1783
- g: number,
1784
- b: number,
1785
- a: number
1680
+ stop: number,
1681
+ r: number,
1682
+ g: number,
1683
+ b: number,
1684
+ a: number
1786
1685
  ];
1787
1686
 
1788
1687
  /**
@@ -1806,22 +1705,22 @@ declare type I18n = Record<string, Translations>;
1806
1705
 
1807
1706
  /** @public */
1808
1707
  declare type ImageDefinition = Preset & {
1809
- imageURL: string;
1810
- thumbnailURL?: string;
1811
- width: number;
1812
- height: number;
1813
- levelOfDetail?: {
1814
- [lod: number]: string;
1815
- };
1708
+ imageURL: string;
1709
+ thumbnailURL?: string;
1710
+ width: number;
1711
+ height: number;
1712
+ levelOfDetail?: {
1713
+ [lod: number]: string;
1714
+ };
1816
1715
  };
1817
1716
 
1818
1717
  /** @public */
1819
1718
  export declare interface _ImageElement extends _AssetElement {
1820
- previewUri?: string;
1821
- size: {
1822
- width: number;
1823
- height: number;
1824
- };
1719
+ previewUri?: string;
1720
+ size: {
1721
+ width: number;
1722
+ height: number;
1723
+ };
1825
1724
  }
1826
1725
 
1827
1726
  /** @public */
@@ -1829,38 +1728,35 @@ export declare type Logger = (message: string, level: LogLevel) => void;
1829
1728
 
1830
1729
  /** @public */
1831
1730
  export declare enum LogLevel {
1832
- Info = 'Info',
1833
- Warning = 'Warning',
1834
- Error = 'Error'
1731
+ Info = "Info",
1732
+ Warning = "Warning",
1733
+ Error = "Error"
1835
1734
  }
1836
1735
 
1837
1736
  /** @public */
1838
1737
  declare enum MimeType_2 {
1839
- Png = 'image/png',
1840
- Jpeg = 'image/jpeg',
1841
- Tga = 'image/x-tga',
1842
- Mp4 = 'video/mp4',
1843
- Binary = 'application/octet-stream',
1844
- Pdf = 'application/pdf',
1845
- Zip = 'application/zip'
1738
+ Png = "image/png",
1739
+ Jpeg = "image/jpeg",
1740
+ Tga = "image/x-tga",
1741
+ Mp4 = "video/mp4",
1742
+ Binary = "application/octet-stream",
1743
+ Pdf = "application/pdf",
1744
+ Zip = "application/zip"
1846
1745
  }
1847
- export { MimeType_2 as MimeType };
1746
+ export { MimeType_2 as MimeType }
1848
1747
 
1849
1748
  /** @public */
1850
1749
  declare enum NavigationPosition {
1851
- Top = 'top',
1852
- Bottom = 'bottom'
1750
+ Top = "top",
1751
+ Bottom = "bottom"
1853
1752
  }
1854
1753
 
1855
1754
  /** @public */
1856
- declare type OnUploadCallback = (
1857
- file: File,
1858
- onProgress: (progress: number) => void
1859
- ) => Promise<PartialImageElement>;
1755
+ declare type OnUploadCallback = (file: File, onProgress: (progress: number) => void) => Promise<PartialImageElement>;
1860
1756
 
1861
1757
  /** @public */
1862
1758
  declare type OnUploadOptions = {
1863
- supportedMimeTypes: string[];
1759
+ supportedMimeTypes: string[];
1864
1760
  };
1865
1761
 
1866
1762
  /**
@@ -1871,36 +1767,36 @@ export declare type Optional<T, K extends keyof T> = Omit<T, K> & Partial<T>;
1871
1767
 
1872
1768
  /** @public */
1873
1769
  declare type Page = {
1874
- title: {
1875
- /**
1876
- * Whether newly created pages should show a title.
1877
- */
1878
- show?: boolean;
1770
+ title: {
1771
+ /**
1772
+ * Whether newly created pages should show a title.
1773
+ */
1774
+ show?: boolean;
1775
+ /**
1776
+ * The font file to use to render the page titles.
1777
+ */
1778
+ fontFileUri?: string;
1779
+ };
1879
1780
  /**
1880
- * The font file to use to render the page titles.
1781
+ * Whether the opacity of the region outside of all
1782
+ * pages should be reduced.
1881
1783
  */
1882
- fontFileUri?: string;
1883
- };
1884
- /**
1885
- * Whether the opacity of the region outside of all
1886
- * pages should be reduced.
1887
- */
1888
- dimOutOfPageAreas?: boolean;
1784
+ dimOutOfPageAreas?: boolean;
1889
1785
  };
1890
1786
 
1891
1787
  /** @public */
1892
1788
  declare type PageFormatDefinition = Preset & {
1893
- width: number;
1894
- height: number;
1895
- unit: DesignUnit;
1896
- dpi?: number;
1897
- bleedMargin?: number;
1789
+ width: number;
1790
+ height: number;
1791
+ unit: DesignUnit;
1792
+ dpi?: number;
1793
+ bleedMargin?: number;
1898
1794
  };
1899
1795
 
1900
1796
  /** @public */
1901
1797
  declare enum PanelPosition {
1902
- Left = 'left',
1903
- Right = 'right'
1798
+ Left = "left",
1799
+ Right = "right"
1904
1800
  }
1905
1801
 
1906
1802
  /** @public */
@@ -1917,72 +1813,65 @@ export declare type PositionMode = 'Absolute' | 'Percent' | 'Auto';
1917
1813
 
1918
1814
  /** @public */
1919
1815
  declare type Preset = {
1920
- meta?: {
1921
- default?: boolean;
1922
- library?: string;
1923
- categories?: string[];
1924
- };
1816
+ meta?: {
1817
+ default?: boolean;
1818
+ library?: string;
1819
+ categories?: string[];
1820
+ };
1925
1821
  };
1926
1822
 
1927
1823
  /** @public */
1928
1824
  declare type Presets = {
1929
- colors?: {
1930
- [id: string]: ColorDefinition;
1931
- };
1932
- typefaces?: {
1933
- [id: string]: TypefaceDefinition;
1934
- };
1935
- images?: {
1936
- [id: string]: ImageDefinition;
1937
- };
1938
- pageFormats?: {
1939
- [id: string]: PageFormatDefinition;
1940
- };
1941
- colorPalettes?: {
1942
- [id: string]: ColorPaletteDefinition;
1943
- };
1944
- templates?: {
1945
- [id: string]: TemplateDefinition;
1946
- };
1825
+ colors?: {
1826
+ [id: string]: ColorDefinition;
1827
+ };
1828
+ typefaces?: {
1829
+ [id: string]: TypefaceDefinition;
1830
+ };
1831
+ images?: {
1832
+ [id: string]: ImageDefinition;
1833
+ };
1834
+ pageFormats?: {
1835
+ [id: string]: PageFormatDefinition;
1836
+ };
1837
+ colorPalettes?: {
1838
+ [id: string]: ColorPaletteDefinition;
1839
+ };
1840
+ templates?: {
1841
+ [id: string]: TemplateDefinition;
1842
+ };
1947
1843
  };
1948
1844
 
1949
1845
  /** @public */
1950
- export declare type PropertyType =
1951
- | 'Bool'
1952
- | 'Int'
1953
- | 'Float'
1954
- | 'String'
1955
- | 'Color'
1956
- | 'Enum'
1957
- | 'Struct';
1846
+ export declare type PropertyType = 'Bool' | 'Int' | 'Float' | 'String' | 'Color' | 'Enum' | 'Struct';
1958
1847
 
1959
1848
  /** @public */
1960
1849
  declare interface QueryData {
1961
- /** A query string used for (fuzzy) searching of labels and tags */
1962
- query?: string;
1963
- /**
1964
- * The number of results queried. How many assets shall be returned regardless
1965
- * of the total number of assets available.
1966
- *
1967
- * Together with `page` this can be used for pagination.
1968
- */
1969
- perPage: number;
1970
- /** The current page queried for paginated views. */
1971
- page: number;
1850
+ /** A query string used for (fuzzy) searching of labels and tags */
1851
+ query?: string;
1852
+ /**
1853
+ * The number of results queried. How many assets shall be returned regardless
1854
+ * of the total number of assets available.
1855
+ *
1856
+ * Together with `page` this can be used for pagination.
1857
+ */
1858
+ perPage: number;
1859
+ /** The current page queried for paginated views. */
1860
+ page: number;
1972
1861
  }
1973
1862
 
1974
1863
  /** @public */
1975
1864
  export declare interface _RequiredConfiguration extends _EngineConfiguration {
1976
- initialSceneString?: string;
1977
- initialSceneURL?: string;
1978
- initialImageURL?: string;
1979
- locale: string;
1980
- theme: Theme;
1981
- devMode: boolean;
1982
- ui: UserInterface;
1983
- i18n: I18n;
1984
- a11y: A11y;
1985
- callbacks: Callbacks_2;
1865
+ initialSceneString?: string;
1866
+ initialSceneURL?: string;
1867
+ initialImageURL?: string;
1868
+ locale: string;
1869
+ theme: Theme;
1870
+ devMode: boolean;
1871
+ ui: UserInterface;
1872
+ i18n: I18n;
1873
+ a11y: A11y;
1874
+ callbacks: Callbacks_2;
1986
1875
  }
1987
1876
 
1988
1877
  /**
@@ -1995,10 +1884,10 @@ export declare type RGBA = [r: number, g: number, b: number, a: number];
1995
1884
  * @public
1996
1885
  */
1997
1886
  export declare interface RGBAColor {
1998
- r: number;
1999
- g: number;
2000
- b: number;
2001
- a: number;
1887
+ r: number;
1888
+ g: number;
1889
+ b: number;
1890
+ a: number;
2002
1891
  }
2003
1892
 
2004
1893
  /**
@@ -2006,9 +1895,9 @@ export declare interface RGBAColor {
2006
1895
  * @public
2007
1896
  */
2008
1897
  export declare interface RGBColor {
2009
- r: number;
2010
- g: number;
2011
- b: number;
1898
+ r: number;
1899
+ g: number;
1900
+ b: number;
2012
1901
  }
2013
1902
 
2014
1903
  /** @public */
@@ -2022,110 +1911,106 @@ declare type Scale = 'normal' | 'large';
2022
1911
  * @public
2023
1912
  */
2024
1913
  declare type Scene = {
2025
- maskSpotColor?: SpotColor;
2026
- /**
2027
- * The DPI value to use when exporting and when converting between pixels and inches or millimeter units.
2028
- * (In the CESDK, this value is synonymous with PPI).
2029
- *
2030
- * This is only relevant for new scenes that are created in the editor. Loaded scenes will use the
2031
- * value stored in their serialization file.
2032
- */
2033
- dpi: number;
2034
- /**
2035
- * A scale factor that is applied to the final export resolution.
2036
- *
2037
- * This is only relevant for new scenes that are created in the editor. Loaded scenes will use the
2038
- * value stored in their serialization file.
2039
- */
2040
- pixelScaleFactor: number;
1914
+ maskSpotColor?: SpotColor;
1915
+ /**
1916
+ * The DPI value to use when exporting and when converting between pixels and inches or millimeter units.
1917
+ * (In the CESDK, this value is synonymous with PPI).
1918
+ *
1919
+ * This is only relevant for new scenes that are created in the editor. Loaded scenes will use the
1920
+ * value stored in their serialization file.
1921
+ */
1922
+ dpi: number;
1923
+ /**
1924
+ * A scale factor that is applied to the final export resolution.
1925
+ *
1926
+ * This is only relevant for new scenes that are created in the editor. Loaded scenes will use the
1927
+ * value stored in their serialization file.
1928
+ */
1929
+ pixelScaleFactor: number;
2041
1930
  };
2042
1931
 
2043
1932
  /**
2044
1933
  * @public
2045
1934
  */
2046
1935
  export declare class SceneAPI {
2047
- #private;
2048
-
2049
- /**
2050
- * Load the contents of a scene file.
2051
- * @param sceneContent - The scene file contents, a base64 string.
2052
- * @returns A handle to the loaded scene.
2053
- */
2054
- loadFromString(sceneContent: string): Promise<DesignBlockId>;
2055
- /**
2056
- * Load a scene from the URL to the scene file.
2057
- * The scene file will be fetched asynchronously by the engine. This requires continous `render`
2058
- * calls on this engines instance.
2059
- * @param url - The URL of the scene file.
2060
- * @returns scene A promise that resolves once the scene was loaded or rejects with an error otherwise.
2061
- */
2062
- loadFromURL(url: string): Promise<DesignBlockId>;
2063
- /**
2064
- * Serializes the current scene into a string. Selection is discarded.
2065
- * @returns A promise that resolves with a string on success or an error on failure.
2066
- */
2067
- saveToString(): Promise<string>;
2068
- /**
2069
- * Saves the current scene and all of its referenced assets into an archive.
2070
- * The archive contains all assets, that were accessible when this function was called.
2071
- * Blocks in the archived scene reference assets relative from to the location of the scene
2072
- * file. These references are resolved when loading such a scene via `loadSceneFromURL`.
2073
- *
2074
- * @returns A promise that resolves with a Blob on success or an error on failure.
2075
- */
2076
- saveToArchive(): Promise<Blob>;
2077
- /**
2078
- * Create a new scene, along with its own camera.
2079
- * @returns The scenes handle.
2080
- */
2081
- create(): DesignBlockId;
2082
- /**
2083
- * Loads the given image and creates a scene with a single page showing the image.
2084
- * Fetching the image may take an arbitrary amount of time, so the scene isn't immediately
2085
- * available.
2086
- * @param url - The image URL.
2087
- * @param dpi - The scenes DPI.
2088
- * @param pixelScaleFactor - The displays pixel scale factor.
2089
- * @returns A promise that resolves with the scene ID on success or rejected with an error otherwise.
2090
- */
2091
- createFromImage(
2092
- url: string,
2093
- dpi?: number,
2094
- pixelScaleFactor?: number
2095
- ): Promise<DesignBlockId>;
2096
- /**
2097
- * Return the currently active scene.
2098
- * @returns The scene or null, if none was created yet.
2099
- */
2100
- get(): DesignBlockId | null;
2101
- /**
2102
- * Applies the contents of the given template scene to the currently loaded scene.
2103
- * This loads the template scene while keeping the design unit and page dimensions
2104
- * of the current scene. Page contents remain centered when the pages are resized
2105
- * to fit the new dimensions.
2106
- * @param content - The template scene file contents, a base64 string.
2107
- * @returns A Promise that resolves once the template was applied or rejects if there was an error.
2108
- */
2109
- applyTemplateFromString(content: string): Promise<void>;
2110
- /**
2111
- * Applies the contents of the given template scene to the currently loaded scene.
2112
- * This loads the template scene while keeping the design unit and page dimensions
2113
- * of the current scene. Page contents remain centered when the pages are resized
2114
- * to fit the new dimensions.
2115
- * @param url - The url to the template scene file.
2116
- * @returns A Promise that resolves once the template was applied or rejects if there was an error.
2117
- */
2118
- applyTemplateFromURL(url: string): Promise<void>;
2119
- /**
2120
- * Converts all values of the current scene into the given design unit.
2121
- * @param designUnit - The new design unit of the scene
2122
- */
2123
- unstable_setDesignUnit(designUnit: DesignUnit): void;
2124
- /**
2125
- * Returns the design unit of the current scene.
2126
- * @returns The current design unit.
2127
- */
2128
- unstable_getDesignUnit(): DesignUnit;
1936
+ #private;
1937
+
1938
+ /**
1939
+ * Load the contents of a scene file.
1940
+ * @param sceneContent - The scene file contents, a base64 string.
1941
+ * @returns A handle to the loaded scene.
1942
+ */
1943
+ loadFromString(sceneContent: string): Promise<DesignBlockId>;
1944
+ /**
1945
+ * Load a scene from the URL to the scene file.
1946
+ * The scene file will be fetched asynchronously by the engine. This requires continuous `render`
1947
+ * calls on this engines instance.
1948
+ * @param url - The URL of the scene file.
1949
+ * @returns scene A promise that resolves once the scene was loaded or rejects with an error otherwise.
1950
+ */
1951
+ loadFromURL(url: string): Promise<DesignBlockId>;
1952
+ /**
1953
+ * Serializes the current scene into a string. Selection is discarded.
1954
+ * @returns A promise that resolves with a string on success or an error on failure.
1955
+ */
1956
+ saveToString(): Promise<string>;
1957
+ /**
1958
+ * Saves the current scene and all of its referenced assets into an archive.
1959
+ * The archive contains all assets, that were accessible when this function was called.
1960
+ * Blocks in the archived scene reference assets relative from to the location of the scene
1961
+ * file. These references are resolved when loading such a scene via `loadSceneFromURL`.
1962
+ *
1963
+ * @returns A promise that resolves with a Blob on success or an error on failure.
1964
+ */
1965
+ saveToArchive(): Promise<Blob>;
1966
+ /**
1967
+ * Create a new scene, along with its own camera.
1968
+ * @returns The scenes handle.
1969
+ */
1970
+ create(): DesignBlockId;
1971
+ /**
1972
+ * Loads the given image and creates a scene with a single page showing the image.
1973
+ * Fetching the image may take an arbitrary amount of time, so the scene isn't immediately
1974
+ * available.
1975
+ * @param url - The image URL.
1976
+ * @param dpi - The scenes DPI.
1977
+ * @param pixelScaleFactor - The displays pixel scale factor.
1978
+ * @returns A promise that resolves with the scene ID on success or rejected with an error otherwise.
1979
+ */
1980
+ createFromImage(url: string, dpi?: number, pixelScaleFactor?: number): Promise<DesignBlockId>;
1981
+ /**
1982
+ * Return the currently active scene.
1983
+ * @returns The scene or null, if none was created yet.
1984
+ */
1985
+ get(): DesignBlockId | null;
1986
+ /**
1987
+ * Applies the contents of the given template scene to the currently loaded scene.
1988
+ * This loads the template scene while keeping the design unit and page dimensions
1989
+ * of the current scene. Page contents remain centered when the pages are resized
1990
+ * to fit the new dimensions.
1991
+ * @param content - The template scene file contents, a base64 string.
1992
+ * @returns A Promise that resolves once the template was applied or rejects if there was an error.
1993
+ */
1994
+ applyTemplateFromString(content: string): Promise<void>;
1995
+ /**
1996
+ * Applies the contents of the given template scene to the currently loaded scene.
1997
+ * This loads the template scene while keeping the design unit and page dimensions
1998
+ * of the current scene. Page contents remain centered when the pages are resized
1999
+ * to fit the new dimensions.
2000
+ * @param url - The url to the template scene file.
2001
+ * @returns A Promise that resolves once the template was applied or rejects if there was an error.
2002
+ */
2003
+ applyTemplateFromURL(url: string): Promise<void>;
2004
+ /**
2005
+ * Converts all values of the current scene into the given design unit.
2006
+ * @param designUnit - The new design unit of the scene
2007
+ */
2008
+ unstable_setDesignUnit(designUnit: DesignUnit): void;
2009
+ /**
2010
+ * Returns the design unit of the current scene.
2011
+ * @returns The current design unit.
2012
+ */
2013
+ unstable_getDesignUnit(): DesignUnit;
2129
2014
  }
2130
2015
 
2131
2016
  /**
@@ -2139,9 +2024,9 @@ export declare type SizeMode = 'Absolute' | 'Percent' | 'Auto';
2139
2024
 
2140
2025
  /** @public */
2141
2026
  export declare interface SpotColor {
2142
- name: string;
2143
- rgbApproximation: RGBAColor;
2144
- cmykApproximation: CMYKColor;
2027
+ name: string;
2028
+ rgbApproximation: RGBAColor;
2029
+ cmykApproximation: CMYKColor;
2145
2030
  }
2146
2031
 
2147
2032
  /** @public */
@@ -2151,22 +2036,16 @@ export declare type StrokeCornerGeometry = 'Bevel' | 'Miter' | 'Round';
2151
2036
  export declare type StrokePosition = 'Center' | 'Inner' | 'Outer';
2152
2037
 
2153
2038
  /** @public */
2154
- export declare type StrokeStyle =
2155
- | 'Dashed'
2156
- | 'DashedRound'
2157
- | 'Dotted'
2158
- | 'LongDashed'
2159
- | 'LongDashedRound'
2160
- | 'Solid';
2039
+ export declare type StrokeStyle = 'Dashed' | 'DashedRound' | 'Dotted' | 'LongDashed' | 'LongDashedRound' | 'Solid';
2161
2040
 
2162
2041
  /** @public */
2163
2042
  declare type Subscription = number;
2164
2043
 
2165
2044
  /** @public */
2166
2045
  declare type TemplateDefinition = Preset & {
2167
- label: string;
2168
- scene: string | URL | (() => Promise<string>);
2169
- thumbnailURL?: string | URL;
2046
+ label: string;
2047
+ scene: string | URL | (() => Promise<string>);
2048
+ thumbnailURL?: string | URL;
2170
2049
  };
2171
2050
 
2172
2051
  /** @public */
@@ -2174,236 +2053,236 @@ declare type Theme = 'light' | 'dark';
2174
2053
 
2175
2054
  /** @public */
2176
2055
  export declare interface Translations {
2177
- [key: string]: string | Translations;
2056
+ [key: string]: string | Translations;
2178
2057
  }
2179
2058
 
2180
2059
  /** @public */
2181
2060
  declare type TypefaceDefinition = Preset & {
2182
- family: string;
2183
- fonts: {
2184
- fontURL: string;
2185
- weight: FontWeight;
2186
- style: FontStyle;
2187
- }[];
2061
+ family: string;
2062
+ fonts: {
2063
+ fontURL: string;
2064
+ weight: FontWeight;
2065
+ style: FontStyle;
2066
+ }[];
2188
2067
  };
2189
2068
 
2069
+ /** @public */
2190
2070
  declare interface UIOptionsForSingleDesignUnit {
2191
- bleedMargin: BleedMarginOptions;
2071
+ bleedMargin: BleedMarginOptions;
2192
2072
  }
2193
2073
 
2074
+ /** @public */
2194
2075
  declare interface UIOptionsPerDesignUnit {
2195
- mm: UIOptionsForSingleDesignUnit;
2196
- px: UIOptionsForSingleDesignUnit;
2197
- in: UIOptionsForSingleDesignUnit;
2076
+ mm: UIOptionsForSingleDesignUnit;
2077
+ px: UIOptionsForSingleDesignUnit;
2078
+ in: UIOptionsForSingleDesignUnit;
2198
2079
  }
2199
2080
 
2200
2081
  /** @public */
2201
2082
  export declare interface UserInterface {
2202
- baseURL: string;
2203
- scale?: Scale;
2204
- elements: UserInterfaceElements_2;
2205
- stylesheets?: {
2206
- disableShadowDOM?: boolean;
2207
- disableTagInsertion?: boolean;
2208
- disableFontInsertion?: boolean;
2209
- };
2210
- hide?: boolean;
2083
+ baseURL: string;
2084
+ scale?: Scale;
2085
+ elements: UserInterfaceElements_2;
2086
+ stylesheets?: {
2087
+ disableShadowDOM?: boolean;
2088
+ disableTagInsertion?: boolean;
2089
+ disableFontInsertion?: boolean;
2090
+ };
2091
+ hide?: boolean;
2211
2092
  }
2212
2093
 
2213
2094
  /** @public */
2214
- declare interface UserInterfaceAssetLibrary extends UserInterfaceElement {}
2095
+ declare interface UserInterfaceAssetLibrary extends UserInterfaceElement {
2096
+ }
2215
2097
 
2216
2098
  /** @public */
2217
2099
  declare interface UserInterfaceCustomAction {
2218
- callback: () => void | Promise<void>;
2219
- label: string;
2220
- iconName: UserInterfaceCustomActionIconName;
2100
+ callback: () => void | Promise<void>;
2101
+ label: string;
2102
+ iconName: UserInterfaceCustomActionIconName;
2221
2103
  }
2222
2104
 
2223
2105
  /** @public */
2224
- declare type UserInterfaceCustomActionIconName =
2225
- | 'default'
2226
- | 'download'
2227
- | 'upload'
2228
- | 'save';
2106
+ declare type UserInterfaceCustomActionIconName = 'default' | 'download' | 'upload' | 'save';
2229
2107
 
2230
2108
  /** @public */
2231
2109
  declare interface UserInterfaceElement {
2232
- show?: boolean;
2110
+ show?: boolean;
2233
2111
  }
2234
2112
 
2235
2113
  declare namespace UserInterfaceElements {
2236
- export {
2237
- PanelPosition,
2238
- NavigationPosition,
2239
- UserInterfaceElement,
2240
- UserInterfaceInspectorBlocks,
2241
- UserInterfaceInspectorBlock,
2242
- UserInterfaceInspectorBlockText,
2243
- UserInterfaceInspectorBlockImage,
2244
- UserInterfaceInspector,
2245
- UserInterfaceSettings,
2246
- UserInterfaceAssetLibrary,
2247
- ExportFormat,
2248
- UserInterfaceExportAction,
2249
- UserInterfaceCustomActionIconName,
2250
- UserInterfaceCustomAction,
2251
- UserInterfaceNavigation,
2252
- UserInterfaceElements_2 as UserInterfaceElements
2253
- };
2114
+ export {
2115
+ PanelPosition,
2116
+ NavigationPosition,
2117
+ UserInterfaceElement,
2118
+ UserInterfaceInspectorBlocks,
2119
+ UserInterfaceInspectorBlock,
2120
+ UserInterfaceInspectorBlockText,
2121
+ UserInterfaceInspectorBlockImage,
2122
+ UserInterfaceInspector,
2123
+ UserInterfaceSettings,
2124
+ UserInterfaceAssetLibrary,
2125
+ ExportFormat,
2126
+ UserInterfaceExportAction,
2127
+ UserInterfaceCustomActionIconName,
2128
+ UserInterfaceCustomAction,
2129
+ UserInterfaceNavigation,
2130
+ UserInterfaceElements_2 as UserInterfaceElements
2131
+ }
2254
2132
  }
2255
- export { UserInterfaceElements };
2133
+ export { UserInterfaceElements }
2256
2134
 
2257
2135
  /** @public */
2258
2136
  declare interface UserInterfaceElements_2 {
2259
- view?: {
2260
- adopter?: {
2261
- style?: 'default' | 'advanced';
2137
+ view?: {
2138
+ adopter?: {
2139
+ style?: 'default' | 'advanced';
2140
+ };
2141
+ };
2142
+ panels?: {
2143
+ inspector?: UserInterfaceInspector | boolean;
2144
+ settings?: UserInterfaceSettings | boolean;
2145
+ assetLibrary?: UserInterfaceAssetLibrary | boolean;
2262
2146
  };
2263
- };
2264
- panels?: {
2265
- inspector?: UserInterfaceInspector | boolean;
2266
- settings?: UserInterfaceSettings | boolean;
2267
- assetLibrary?: UserInterfaceAssetLibrary | boolean;
2268
- };
2269
- templates?: UserInterfaceElement | boolean;
2270
- dock?: {
2271
- iconSize?: Scale;
2272
- hideLabels?: boolean;
2273
- };
2274
- libraries?: {
2275
- template?: UserInterfaceElement | boolean;
2276
- image?: UserInterfaceElement | boolean;
2277
- text?: UserInterfaceElement | boolean;
2278
- element?: UserInterfaceElement | boolean;
2279
- panel: {
2280
- insert: {
2281
- floating?: boolean;
2282
- };
2283
- replace: {
2284
- floating?: boolean;
2285
- };
2147
+ templates?: UserInterfaceElement | boolean;
2148
+ dock?: {
2149
+ iconSize?: Scale;
2150
+ hideLabels?: boolean;
2286
2151
  };
2287
- };
2288
- blocks?: UserInterfaceInspectorBlocks;
2289
- navigation: UserInterfaceNavigation;
2152
+ libraries?: {
2153
+ upload?: UserInterfaceElement | boolean;
2154
+ template?: UserInterfaceElement | boolean;
2155
+ image?: UserInterfaceElement | boolean;
2156
+ text?: UserInterfaceElement | boolean;
2157
+ element?: UserInterfaceElement | boolean;
2158
+ panel: {
2159
+ insert: {
2160
+ floating?: boolean;
2161
+ };
2162
+ replace: {
2163
+ floating?: boolean;
2164
+ };
2165
+ };
2166
+ };
2167
+ blocks?: UserInterfaceInspectorBlocks;
2168
+ navigation: UserInterfaceNavigation;
2290
2169
  }
2291
2170
 
2292
2171
  /** @public */
2293
2172
  declare interface UserInterfaceExportAction extends UserInterfaceElement {
2294
- format?: ExportFormat[];
2173
+ format?: ExportFormat[];
2295
2174
  }
2296
2175
 
2297
2176
  /** @public */
2298
2177
  declare interface UserInterfaceInspector extends UserInterfaceElement {
2299
- position?: PanelPosition;
2178
+ position?: PanelPosition;
2300
2179
  }
2301
2180
 
2302
2181
  /** @public */
2303
- declare interface UserInterfaceInspectorBlock {}
2182
+ declare interface UserInterfaceInspectorBlock {
2183
+ }
2304
2184
 
2305
2185
  /** @public */
2306
- declare interface UserInterfaceInspectorBlockImage
2307
- extends UserInterfaceInspectorBlock {
2308
- crop?: UserInterfaceElement | boolean;
2309
- filters?: UserInterfaceElement | boolean;
2310
- adjustments?: UserInterfaceElement | boolean;
2311
- effects?: UserInterfaceElement | boolean;
2312
- blur?: UserInterfaceElement | boolean;
2186
+ declare interface UserInterfaceInspectorBlockImage extends UserInterfaceInspectorBlock {
2187
+ crop?: UserInterfaceElement | boolean;
2188
+ filters?: UserInterfaceElement | boolean;
2189
+ adjustments?: UserInterfaceElement | boolean;
2190
+ effects?: UserInterfaceElement | boolean;
2191
+ blur?: UserInterfaceElement | boolean;
2313
2192
  }
2314
2193
 
2315
2194
  /** @public */
2316
2195
  declare interface UserInterfaceInspectorBlocks {
2317
- opacity?: UserInterfaceElement | boolean;
2318
- transform?: UserInterfaceElement | boolean;
2319
- '//ly.img.ubq/image': UserInterfaceInspectorBlockImage;
2320
- '//ly.img.ubq/text': UserInterfaceInspectorBlockText;
2196
+ opacity?: UserInterfaceElement | boolean;
2197
+ transform?: UserInterfaceElement | boolean;
2198
+ '//ly.img.ubq/image': UserInterfaceInspectorBlockImage;
2199
+ '//ly.img.ubq/text': UserInterfaceInspectorBlockText;
2321
2200
  }
2322
2201
 
2323
2202
  /** @public */
2324
- declare interface UserInterfaceInspectorBlockText
2325
- extends UserInterfaceInspectorBlock {
2326
- advanced?: UserInterfaceElement | boolean;
2327
- color?: UserInterfaceElement | boolean;
2328
- backgroundColor?: UserInterfaceElement | boolean;
2203
+ declare interface UserInterfaceInspectorBlockText extends UserInterfaceInspectorBlock {
2204
+ advanced?: UserInterfaceElement | boolean;
2205
+ color?: UserInterfaceElement | boolean;
2206
+ backgroundColor?: UserInterfaceElement | boolean;
2329
2207
  }
2330
2208
 
2331
2209
  /** @public */
2332
2210
  declare interface UserInterfaceNavigation extends UserInterfaceElement {
2333
- position: NavigationPosition;
2334
- title?: string | null;
2335
- action?: {
2336
- close: UserInterfaceElement | boolean;
2337
- back: UserInterfaceElement | boolean;
2338
- save: UserInterfaceElement | boolean;
2339
- export: UserInterfaceExportAction | boolean;
2340
- share: UserInterfaceElement | boolean;
2341
- load: UserInterfaceElement | boolean;
2342
- download: UserInterfaceElement | boolean;
2343
- custom: UserInterfaceCustomAction[];
2344
- };
2211
+ position: NavigationPosition;
2212
+ title?: string | null;
2213
+ action?: {
2214
+ close: UserInterfaceElement | boolean;
2215
+ back: UserInterfaceElement | boolean;
2216
+ save: UserInterfaceElement | boolean;
2217
+ export: UserInterfaceExportAction | boolean;
2218
+ share: UserInterfaceElement | boolean;
2219
+ load: UserInterfaceElement | boolean;
2220
+ download: UserInterfaceElement | boolean;
2221
+ custom: UserInterfaceCustomAction[];
2222
+ };
2345
2223
  }
2346
2224
 
2347
2225
  /** @public */
2348
- declare interface UserInterfaceSettings extends UserInterfaceElement {}
2226
+ declare interface UserInterfaceSettings extends UserInterfaceElement {
2227
+ }
2349
2228
 
2350
2229
  /**
2351
2230
  * @public
2352
2231
  */
2353
2232
  export declare class VariableAPI {
2354
- #private;
2355
-
2356
- /**
2357
- * Get all text variables currently stored in the engine.
2358
- * @returns Return a list of variable names
2359
- */
2360
- findAll(): string[];
2361
- /**
2362
- * Set a text variable.
2363
- * @param key - The variable's key.
2364
- * @param value - The text to replace the variable with.
2365
- */
2366
- setString(key: string, value: string): void;
2367
- /**
2368
- * Set a text variable.
2369
- * @param key - The variable's key.
2370
- * @returns The text value of the variable.
2371
- */
2372
- getString(key: string): string;
2373
- /**
2374
- * Destroy a text variable.
2375
- * @param key - The variable's key.
2376
- */
2377
- remove(key: string): void;
2233
+ #private;
2234
+
2235
+ /**
2236
+ * Get all text variables currently stored in the engine.
2237
+ * @returns Return a list of variable names
2238
+ */
2239
+ findAll(): string[];
2240
+ /**
2241
+ * Set a text variable.
2242
+ * @param key - The variable's key.
2243
+ * @param value - The text to replace the variable with.
2244
+ */
2245
+ setString(key: string, value: string): void;
2246
+ /**
2247
+ * Set a text variable.
2248
+ * @param key - The variable's key.
2249
+ * @returns The text value of the variable.
2250
+ */
2251
+ getString(key: string): string;
2252
+ /**
2253
+ * Destroy a text variable.
2254
+ * @param key - The variable's key.
2255
+ */
2256
+ remove(key: string): void;
2378
2257
  }
2379
2258
 
2380
2259
  /** @public */
2381
2260
  declare type VariableDefinition = Preset & {
2382
- value: string | number;
2261
+ value: string | number;
2383
2262
  };
2384
2263
 
2385
2264
  /** @public */
2386
2265
  declare type Variables = {
2387
- [id: string]: VariableDefinition;
2266
+ [id: string]: VariableDefinition;
2388
2267
  };
2389
2268
 
2390
2269
  /** @public */
2391
2270
  declare interface Vec2 {
2392
- x: number;
2393
- y: number;
2271
+ x: number;
2272
+ y: number;
2394
2273
  }
2395
2274
 
2396
2275
  /** @public */
2397
2276
  declare interface Vec3 {
2398
- x: number;
2399
- y: number;
2400
- z: number;
2277
+ x: number;
2278
+ y: number;
2279
+ z: number;
2401
2280
  }
2402
2281
 
2403
2282
  /** @public */
2404
2283
  declare enum ViewStyle {
2405
- Advanced = 'advanced',
2406
- Default = 'default'
2284
+ Advanced = "advanced",
2285
+ Default = "default"
2407
2286
  }
2408
2287
 
2409
- export {};
2288
+ export { }