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