@cesdk/cesdk-js 1.5.1 → 1.6.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.
@@ -1,84 +1,204 @@
1
- declare type Asset = {
2
- src: string;
3
- };
1
+ /// <reference types="offscreencanvas" />
4
2
 
5
3
  /**
6
- * Single asset result of a query from the engine.
4
+ * Generic asset information
5
+ * @public
7
6
  */
8
- declare interface AssetResult {
7
+ export declare interface Asset {
9
8
  /**
10
- * A unique id of this asset
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
11
  */
12
12
  id: string;
13
+ /** E.g. `ly.img.image` */
14
+ type: string;
15
+ /** Groups of the asset. */
16
+ groups?: Groups;
17
+ /** URI to a thumbnail of the asset used e.g. in the content library UI */
18
+ thumbUri: string;
19
+
20
+ /** Asset-specific and custom meta information */
21
+ meta?: {
22
+ uri?: string;
23
+ filename?: string;
24
+ } & Record<string, unknown>;
25
+ }
26
+
27
+ /**
28
+ * API to query for assets.
29
+ *
30
+ * Could be remote or local.
31
+ *
32
+ * @typeParam QData - The shape of queries made against this API
33
+ * @public
34
+ */
35
+ export declare interface AssetAPI<QData extends AssetQueryData> {
36
+ /** The unique id of the API */
37
+ id: string;
38
+ /** Find all asset for the given type and the provided query data. */
39
+ findAssets(type: string, queryData?: QData): Promise<AssetsQueryResult>;
40
+ /** For a given type return every available group */
41
+ getGroups: (type: string) => Promise<string[]>;
42
+ /** Return all registered/available types */
43
+ getTypes: () => string[];
44
+ /** The given type is registered. */
45
+ hasType: (type: string) => boolean;
46
+ /** Credits for the source/api */
47
+ credits?: {
48
+ name: string;
49
+ url?: string;
50
+ };
51
+ /** General license for all asset from this source */
52
+ license?: {
53
+ name: string;
54
+ url?: string;
55
+ };
56
+ }
57
+
58
+ /**
59
+ * Definition of an assets used if an asset is added to an asset source.
60
+ * @public
61
+ */
62
+ export declare interface AssetDefinition extends Asset {
13
63
  /**
14
- * E.g. `ly.img.image`
64
+ * Label used to display in aria-label and as a tooltip.
65
+ * Will be also searched in a query and should be localized
15
66
  */
16
- type: string;
67
+ label?: Record<Locale, string>;
17
68
  /**
18
- * URI to a thumbnail of the asset used e.g. in the content library UI
69
+ * Tags for this asset. Can be used for filtering, but is also useful for
70
+ * free-text search. Since the label is searched as well as used for tooltips
71
+ * you do not want to overdo it, but still add things which are searched.
72
+ * Thus, it should be localized similar to the `label`.
19
73
  */
20
- thumbUri: string;
74
+ tags?: Record<Locale, string[]>;
75
+ }
76
+
77
+ /**
78
+ * Defines a request for querying assets
79
+ * @public
80
+ */
81
+ export declare interface AssetQueryData {
82
+ /** A query string used for (fuzzy) searching of labels and tags */
83
+ query?: string;
21
84
  /**
22
- * Original size of the asset.
85
+ * Tags are searched with the query parameter, but this search is fuzzy.
86
+ * If one needs to get assets with exactly the tag (from a tag cloud or filter)
87
+ * this query parameter should be used.
23
88
  */
89
+ tags?: string | string[];
90
+ /** Query only these groups */
91
+ groups?: Groups;
92
+ /** Filter out assets with this groups */
93
+ excludeGroups?: Groups;
94
+ /** Choose the locale of the labels and tags for localized search and filtering */
95
+ locale?: Locale;
96
+ /**
97
+ * The number of results queried. How many assets shall be returned regardless
98
+ * of the total number of assets available.
99
+ *
100
+ * Together with `page` this can be used for pagination.
101
+ */
102
+ perPage: number;
103
+ }
104
+
105
+ /**
106
+ * The registry of all available assets and sources registered in the engine.
107
+ * @public
108
+ */
109
+ export declare interface AssetRegistry {
110
+ /** Returns all sources available in the engine */
111
+ getSources(type?: string): AssetSource[];
112
+ /** Returns a source with the given id or undefined if not found */
113
+ getSource(id: string): AssetSource | undefined;
114
+ /** Adds a source to this registry. */
115
+ addSource(source: AssetSource): void;
116
+ /** Removes a source from this registry. */
117
+ removeSource(id: string): void;
118
+ }
119
+
120
+ /**
121
+ * Single asset result of a query from the engine.
122
+ * @public
123
+ */
124
+ export declare interface AssetResult extends Asset {
125
+ /** The locale of the label and tags */
126
+ locale?: Locale;
127
+ /** The label of the result. Used for description and tooltips. */
128
+ label?: string;
129
+ /** The tags of this asset. Used for filtering and free-text searching. */
130
+ tags?: string[];
131
+
132
+ /** Credits for the artist of the asset */
133
+ credits?: {
134
+ name: string;
135
+ url?: string;
136
+ };
137
+ /** License for this asset. Overwrites the source license if present */
138
+ license?: {
139
+ name: string;
140
+ url?: string;
141
+ };
142
+ /** UTM parameters for the links inside the credits */
143
+ utm?: {
144
+ source?: string;
145
+ medium?: string;
146
+ };
147
+ }
148
+
149
+ /**
150
+ * Single asset result of a query from the engine.
151
+ * @public
152
+ */
153
+ declare interface AssetResult_2 {
154
+ /** A unique id of this asset */
155
+ id: string;
156
+ /** E.g. `ly.img.image` */
157
+ type: string;
158
+ /** URI to a thumbnail of the asset used e.g. in the content library UI */
159
+ thumbUri: string;
160
+ /** Original size of the asset. */
24
161
  size: {
25
162
  width: number;
26
163
  height: number;
27
164
  };
28
- /**
29
- * Asset-specific and custom meta information
30
- */
165
+ /** Asset-specific and custom meta information */
31
166
  meta?: {
32
167
  uri?: string;
33
168
  filename?: string;
34
169
  } & Record<string, unknown>;
35
- /**
36
- * The locale of the label and tags
37
- */
170
+ /** The locale of the label and tags */
38
171
  locale?: string;
39
- /**
40
- * The label of the result. Used for description and tooltips.
41
- */
172
+ /** The label of the result. Used for description and tooltips. */
42
173
  label?: string;
43
- /**
44
- * The tags of this asset. Used for filtering and free-text searching.
45
- */
174
+ /** The tags of this asset. Used for filtering and free-text searching. */
46
175
  tags?: string[];
47
176
  context: {
48
177
  sourceId: string;
49
178
  };
50
- /**
51
- * Credits for the artist of the asset
52
- */
179
+ /** Credits for the artist of the asset */
53
180
  credits?: {
54
181
  name: string;
55
182
  url?: string;
56
183
  };
57
- /**
58
- * License for this asset. Overwrites the source license if present
59
- */
184
+ /** License for this asset. Overwrites the source license if present */
60
185
  license?: {
61
186
  name: string;
62
187
  url?: string;
63
188
  };
64
189
  }
65
190
 
66
- declare type Assets = {
67
- [id: string]: Asset;
68
- };
69
-
70
191
  /**
71
- * API to query for assets
192
+ * A source of assets
193
+ * @public
72
194
  */
73
- declare interface AssetSource {
195
+ export declare interface AssetSource extends AssetAPI<PaginatedAssetQueryData> {
74
196
  /**
75
- * The asset types returned by this source. Will default to ['ly.img.image'].
197
+ * Can the source add, update and remove assets dynamically? If `false`
198
+ * methods like `addAsset` `updateAsset` and `removeAsset` will throw and
199
+ * error.
76
200
  */
77
- types?: string[];
78
- /**
79
- * Find all asset for the given type and the provided query data.
80
- */
81
- findAssets(type: string, queryData?: QueryData): Promise<AssetsQueryResult | undefined>;
201
+ canManageAssets?: boolean;
82
202
  /**
83
203
  * Indicates if the asset shall be downloaded to handle the raw data instead
84
204
  * of an URL reference. Do this if you do not want to depend on
@@ -88,47 +208,101 @@ declare interface AssetSource {
88
208
  */
89
209
  downloadAssets?: (asset: AssetResult) => Promise<Blob>;
90
210
  /**
91
- * Credits for the source/api
211
+ * @returns the asset or undefined if no asset with the given id could be found
212
+ */
213
+ getAsset(id: string): Promise<AssetResult | undefined>;
214
+ /**
215
+ * Adds the given asset to this source. Throws an error if `canManageAssets`
216
+ * is `false`.
217
+ *
218
+ * @returns the id of the added asset
219
+ */
220
+ addAsset(type: string, asset: AssetDefinition): Promise<string>;
221
+ /**
222
+ * Updates the asset of this source. Throws an error if `canManageAssets`
223
+ * is `false` or no asset with the given id could not be found.
224
+ *
225
+ * @returns the id of the added asset
226
+ */
227
+ updateAsset(assetId: string, asset: AssetDefinition): Promise<void>;
228
+ /**
229
+ * Removes the given asset from this source.
230
+ *
231
+ * @returns true if asset was found and removed, and false otherwise
232
+ */
233
+ removeAsset(assetId: string): Promise<boolean>;
234
+ }
235
+
236
+ /**
237
+ * API to query for assets
238
+ * @public
239
+ */
240
+ declare interface AssetSource_2 {
241
+ /** The asset types returned by this source. Will default to ['ly.img.image']. */
242
+ types?: string[];
243
+ /** Find all asset for the given type and the provided query data. */
244
+ findAssets(type: string, queryData?: QueryData): Promise<AssetsQueryResult_2 | undefined>;
245
+ /**
246
+ * Indicates if the asset shall be downloaded to handle the raw data instead
247
+ * of an URL reference. Do this if you do not want to depend on
248
+ * a service after adding the asset to the scene. If this is your own API
249
+ * with your own service, you do not need to set this and avoid downloading /
250
+ * re-uploading the assets.
92
251
  */
252
+ downloadAssets?: (asset: AssetResult_2) => Promise<Blob>;
253
+ /** Credits for the source/api */
93
254
  credits?: {
94
255
  name: string;
95
256
  url?: string;
96
257
  };
97
- /**
98
- * General license for all asset from this source
99
- */
258
+ /** General license for all asset from this source */
100
259
  license?: {
101
260
  name: string;
102
261
  url?: string;
103
262
  };
104
263
  }
105
264
 
265
+ /** @public */
106
266
  declare type AssetSources = {
107
- [id: string]: AssetSource;
267
+ [id: string]: AssetSource_2;
108
268
  };
109
269
 
110
270
  /**
111
271
  * Return type of a `findAssets` query.
272
+ * @public
112
273
  */
113
- declare interface AssetsQueryResult {
114
- /**
115
- * The assets in the requested page
116
- */
274
+ export declare interface AssetsQueryResult {
275
+ /** The assets in the requested page */
117
276
  assets: AssetResult[];
118
- /**
119
- * The current, requested page
120
- */
277
+ /** The current, requested page */
121
278
  currentPage: number;
122
- /**
123
- * The next page to query if it exists
124
- */
125
- nextPage: number | undefined;
126
- /**
127
- * How many assets are there in total for the current query regardless of the page
128
- */
279
+ /** The next page to query if it exists */
280
+ nextPage?: number;
281
+ /** How many assets are there in total for the current query regardless of the page */
282
+ total: number;
283
+ }
284
+
285
+ /**
286
+ * Return type of a `findAssets` query.
287
+ * @public
288
+ */
289
+ declare interface AssetsQueryResult_2 {
290
+ /** The assets in the requested page */
291
+ assets: AssetResult_2[];
292
+ /** The current, requested page */
293
+ currentPage: number;
294
+ /** The next page to query if it exists */
295
+ nextPage?: number;
296
+ /** How many assets are there in total for the current query regardless of the page */
129
297
  total: number;
130
298
  }
131
299
 
300
+ /**
301
+ * @public
302
+ */
303
+ export declare type BlendMode = 'PassThrough' | 'Normal' | 'Darken' | 'Multiply' | 'ColorBurn' | 'Lighten' | 'Screen' | 'ColorDodge' | 'Overlay' | 'SoftLight' | 'HardLight' | 'Difference' | 'Exclusion' | 'Hue' | 'Saturation' | 'Color' | 'Luminosity';
304
+
305
+ /** @public */
132
306
  declare type Block = number;
133
307
 
134
308
  /**
@@ -145,6 +319,7 @@ export declare class BlockAPI {
145
319
  * @returns A promise that resolves with the exported image or is rejected with an error.
146
320
  */
147
321
  export(handle: DesignBlockId, mimeType?: MimeType_2): Promise<Blob>;
322
+
148
323
  /**
149
324
  * Loads existing blocks from the given string.
150
325
  * The blocks are not attached by default and won't be visible until attached to a page or the scene.
@@ -165,8 +340,8 @@ export declare class BlockAPI {
165
340
  * @returns The created blocks handle.
166
341
  */
167
342
  create(type: DesignBlockType): DesignBlockId;
168
- /**
169
343
 
344
+ /**
170
345
  * Get the type of the given block, fails if the block is invalid.
171
346
  * @param id - The block to query.
172
347
  * @returns The blocks type.
@@ -247,6 +422,11 @@ export declare class BlockAPI {
247
422
  * @returns A list of block ids.
248
423
  */
249
424
  findAll(): DesignBlockId[];
425
+ /**
426
+ * Return all placeholder blocks in the current scene.
427
+ * @returns A list of block ids.
428
+ */
429
+ findAllPlaceholders(): DesignBlockId[];
250
430
  /**
251
431
  * Query a block's visibility.
252
432
  * @param id - The block to query.
@@ -349,13 +529,13 @@ export declare class BlockAPI {
349
529
  /**
350
530
  * Update a block's horizontal flip.
351
531
  * @param id - The block to update.
352
- * @param horizontal - Whether the block should be flipped along its x-axis.
532
+ * @param flip - If the flip should be enabled.
353
533
  */
354
534
  setFlipHorizontal(id: DesignBlockId, flip: boolean): void;
355
535
  /**
356
536
  * Update a block's vertical flip.
357
537
  * @param id - The block to update.
358
- * @param vertical - Whether the block should be flipped along its y-axis.
538
+ * @param flip - If the flip should be enabled.
359
539
  */
360
540
  setFlipVertical(id: DesignBlockId, flip: boolean): void;
361
541
  /**
@@ -382,6 +562,12 @@ export declare class BlockAPI {
382
562
  * @returns The current mode for the height: absolute, percent or auto.
383
563
  */
384
564
  getHeightMode(id: DesignBlockId): SizeMode;
565
+ /**
566
+ * Query a block's content fill mode.
567
+ * @param id - The block to query.
568
+ * @returns The current mode: crop, cover or contain.
569
+ */
570
+ getContentFillMode(id: DesignBlockId): ContentFillMode;
385
571
  /**
386
572
  * Update a block's width.
387
573
  * @param id - The block to update.
@@ -406,6 +592,12 @@ export declare class BlockAPI {
406
592
  * @param mode - The height mode: absolute, percent or auto.
407
593
  */
408
594
  setHeightMode(id: DesignBlockId, mode: SizeMode): void;
595
+ /**
596
+ * Set a block's content fill mode.
597
+ * @param id - The block to update.
598
+ * @param mode - The content fill mode mode: crop, cover or contain.
599
+ */
600
+ setContentFillMode(id: DesignBlockId, mode: ContentFillMode): void;
409
601
  /**
410
602
  * Get a block's layouted width. The layouted width is only available after an
411
603
  * internal update loop, which may not happen immediately.
@@ -498,6 +690,21 @@ export declare class BlockAPI {
498
690
  * @returns float The height of the axis-aligned bounding box.
499
691
  */
500
692
  getGlobalBoundingBoxHeight(id: DesignBlockId): number;
693
+ /**
694
+ * Scales the block and all of its children proportionally around the specified
695
+ * relative anchor point.
696
+ *
697
+ * This updates the position, size and style properties (e.g. stroke width) of
698
+ * the block and its children.
699
+ *
700
+ * @param id - The block that should be scaled.
701
+ * @param scale - The scale factor to be applied to the current properties of the block.
702
+ * @param anchorX - The relative position along the width of the block around which the
703
+ * scaling should occur. (0 = left edge, 0.5 = center, 1 = right edge)
704
+ * @param anchorY - The relative position along the height of the block around which the
705
+ * scaling should occur. (0 = top edge, 0.5 = center, 1 = bottom edge)
706
+ */
707
+ scale(id: DesignBlockId, scale: number, anchorX?: number, anchorY?: number): void;
501
708
  /**
502
709
  * Get all available properties of a block.
503
710
  * @param id - The block whose properties should be queried.
@@ -591,14 +798,14 @@ export declare class BlockAPI {
591
798
  getColorRGBA(id: DesignBlockId, property: string): RGBA;
592
799
  /**
593
800
  * Set an enum property of the given design block to the given value.
594
- * @param block - The block whose property should be set.
801
+ * @param id - The block whose property should be set.
595
802
  * @param property - The name of the property to set.
596
803
  * @param value - The enum value as string.
597
804
  */
598
805
  setEnum(id: DesignBlockId, property: string, value: string): void;
599
806
  /**
600
807
  * Get the value of an enum property of the given design block.
601
- * @param block - The block whose property should be queried.
808
+ * @param id - The block whose property should be queried.
602
809
  * @param property - The name of the property to query.
603
810
  * @returns The value as string.
604
811
  */
@@ -630,7 +837,7 @@ export declare class BlockAPI {
630
837
  /**
631
838
  * Set the crop translation in x direction of the given design block.
632
839
  * @param id - The block whose crop should be set.
633
- * @param translationY - The translation in x direction.
840
+ * @param translationY - The translation in y direction.
634
841
  */
635
842
  setCropTranslationX(id: DesignBlockId, translationX: number): void;
636
843
  /**
@@ -678,7 +885,7 @@ export declare class BlockAPI {
678
885
  /**
679
886
  * Query if the given block has an opacity.
680
887
  * @param id - The block to query.
681
- * @returns true, if the block has an opcity.
888
+ * @returns true, if the block has an opacity.
682
889
  */
683
890
  hasOpacity(id: DesignBlockId): boolean;
684
891
  /**
@@ -693,6 +900,19 @@ export declare class BlockAPI {
693
900
  * @returns The opacity.
694
901
  */
695
902
  getOpacity(id: DesignBlockId): number;
903
+ /**
904
+ * Set the blend mode of the given design block.
905
+ * @param id - The block whose blend mode should be set.
906
+ * @param blendMode - The blend mode to be set.
907
+ * @returns
908
+ */
909
+ setBlendMode(id: DesignBlockId, blendMode: BlendMode): void;
910
+ /**
911
+ * Get the blend mode of the given design block.
912
+ * @param id - The block whose blend mode should be queried.
913
+ * @returns The blend mode.
914
+ */
915
+ getBlendMode(id: DesignBlockId): BlendMode;
696
916
  /**
697
917
  * Query if the given block has fill color properties.
698
918
  * @param id - The block to query.
@@ -896,6 +1116,137 @@ export declare class BlockAPI {
896
1116
  * @deprecated Use `getStrokeWidth`.
897
1117
  */
898
1118
  getOutlineWidth(id: DesignBlockId): number;
1119
+ /**
1120
+ * Query if the given block has fill color properties.
1121
+ * @param id - The block to query.
1122
+ * @returns true, if the block has fill color properties, an error otherwise.
1123
+ */
1124
+ hasFill(id: DesignBlockId): boolean;
1125
+ /**
1126
+ * Query if the fill of the given design block is enabled.
1127
+ * @param id - The block whose fill state should be queried.
1128
+ * @returns A result holding the fill state or an error.
1129
+ */
1130
+ isFillEnabled(id: DesignBlockId): boolean;
1131
+ /**
1132
+ * Enable or disable the fill of the given design block.
1133
+ * @param id - The block whose fill should be enabled or disabled.
1134
+ * @param enabled - If true, the fill will be enabled.
1135
+ * @returns An empty result on success, an error otherwise.
1136
+ */
1137
+ setFillEnabled(id: DesignBlockId, enabled: boolean): void;
1138
+ /**
1139
+ * Set the fill type of the given design block.
1140
+ * @param id - The block whose fill type should be set.
1141
+ * @param type - The fill type to set.
1142
+ * @returns An empty result on success, an error otherwise.
1143
+ */
1144
+ setFillType(id: DesignBlockId, fillType: FillType): void;
1145
+ /**
1146
+ * Get the fill type of the given design block.
1147
+ * @param id - The block whose fill type should be queried.
1148
+ * @returns The block's fill type or an error.
1149
+ */
1150
+ getFillType(id: DesignBlockId): FillType;
1151
+ /**
1152
+ * Set the fill color of the given design block.
1153
+ * @param id - The block whose fill color should be set.
1154
+ * @param r - The red color component in the range of 0 to 1.
1155
+ * @param g - The green color component in the range of 0 to 1.
1156
+ * @param b - The blue color component in the range of 0 to 1.
1157
+ * @param a - The alpha color component in the range of 0 to 1.
1158
+ * @returns An empty result on success, an error otherwise.
1159
+ */
1160
+ setFillSolidColor(id: DesignBlockId, r: number, b: number, g: number, a: number): void;
1161
+ /**
1162
+ * Get the fill color of the given design block.
1163
+ * @param id - The block whose fill color should be queried.
1164
+ * @returns A result holding the fill color or an error.
1165
+ */
1166
+ getFillSolidColor(id: DesignBlockId): RGBA;
1167
+ /**
1168
+ * Set the gradient type of the given design block.
1169
+ * @param id - The block whose gradient type should be set.
1170
+ * @param type - The gradient type.
1171
+ * @returns An empty result on success, an error otherwise.
1172
+ */
1173
+ setFillGradientType(id: DesignBlockId, gradientType: GradientType): void;
1174
+ /**
1175
+ * Get the gradient type of the given design block.
1176
+ * @param id - The block whose gradient type should be queried.
1177
+ * @returns The gradient type.
1178
+ */
1179
+ getFillGradientType(id: DesignBlockId): GradientType;
1180
+ /**
1181
+ * Add a gradient color stop on a design block.
1182
+ * @param id - The block on which a gradient color stop should be added.
1183
+ * @param stop - Where to add a color stop in the range 0 to 1.
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
+ * @returns An empty result on success, an error otherwise.
1189
+ */
1190
+ addFillGradientColorStop(id: DesignBlockId, stop: number, r: number, g: number, b: number, a: number): void;
1191
+ /**
1192
+ * Remove a previously gradient color stop on a design block.
1193
+ * @param id - The block from which to remvove the gradient color stop.
1194
+ * @param stop - The stop's position.
1195
+ * @returns An empty result on success, an error otherwise.
1196
+ */
1197
+ removeFillGradientColorStop(id: DesignBlockId, stop: number): void;
1198
+ /**
1199
+ * Get the gradient fill color stops of the given design block.
1200
+ * @param id - The block whose gradient color stop should be queried.
1201
+ * @returns All of the design block's gradient color stops.
1202
+ */
1203
+ getFillGradientColorStops(id: DesignBlockId): GradientstopRGBA[];
1204
+ /**
1205
+ * Set the gradient fill color stops of the given design block, overwriting previously set color stops.
1206
+ * @param id - The block whose gradient color stop should be set.
1207
+ * @param stops - The gradient color stops to set.
1208
+ * @returns An empty result on success, an error otherwise.
1209
+ */
1210
+ setFillGradientColorStops(id: DesignBlockId, stops: GradientstopRGBA[]): void;
1211
+ /**
1212
+ * Set the position of a gradient's control point.
1213
+ * Note that Different gradient types of different control points.
1214
+ * @param id - The block whose gradient control point should be set.
1215
+ * @param gradientControlPointType - The type of control point.
1216
+ * @param x - The horizontal component of the control point.
1217
+ * @param y - The vertical component of the control point.
1218
+ * @returns true if the control point was set, an error otherwise.
1219
+ */
1220
+ setFillGradientControlPoint(id: DesignBlockId, gradientControlPointType: GradientControlPointType, x: number, y: number): boolean;
1221
+ /**
1222
+ * Get the horizontal component of a gradient's control point.
1223
+ * @param id - The block whose gradient control point should be queried.
1224
+ * @param gradientControlPointType - The type of control point.
1225
+ * @returns The horizontal component of the control point, an error otherwise.
1226
+ */
1227
+ getFillGradientControlPointX(id: DesignBlockId, gradientControlPointType: GradientControlPointType): number;
1228
+ /**
1229
+ * Get the vertical component of a gradient's control point.
1230
+ * @param id - The block whose gradient control point should be queried.
1231
+ * @param gradientControlPointType - The type of control point.
1232
+ * @returns The vertical component of the control point, an error otherwise.
1233
+ */
1234
+ getFillGradientControlPointY(id: DesignBlockId, gradientControlPointType: GradientControlPointType): number;
1235
+ /**
1236
+ * Set a gradient's radius.
1237
+ * Note that Not all gradients have a radius.
1238
+ * @param id - The block whose gradient radius should be set.
1239
+ * @param radius - The gradient's radius.
1240
+ * @returns true if the control point was set, an error otherwise.
1241
+ */
1242
+ setFillGradientRadius(id: DesignBlockId, radius: number): boolean;
1243
+ /**
1244
+ * Get a gradient's radius.
1245
+ * Note that Not all gradients have a radius.
1246
+ * @param id - The block whose gradient radius should be queried.
1247
+ * @returns the gradient's radius, an error otherwise.
1248
+ */
1249
+ getFillGradientRadius(id: DesignBlockId): number;
899
1250
  }
900
1251
 
901
1252
  /**
@@ -906,65 +1257,87 @@ export declare type BlockEvent = {
906
1257
  type: 'Created' | 'Updated' | 'Destroyed';
907
1258
  };
908
1259
 
1260
+ /** @public */
909
1261
  declare interface BlockEvent_2 {
910
1262
  block: Block;
911
1263
  type: 'Created' | 'Updated' | 'Destroyed';
912
1264
  }
913
1265
 
1266
+ /** @public */
914
1267
  declare type Callbacks = {
915
1268
  log?: Logger;
916
1269
  };
917
1270
 
918
- /** All components between 0 and 1 */
919
- declare interface CMYKColor {
1271
+ /**
1272
+ * All components between 0 and 1
1273
+ * @public
1274
+ */
1275
+ export declare interface CMYKColor {
920
1276
  c: number;
921
1277
  m: number;
922
1278
  y: number;
923
1279
  k: number;
924
1280
  }
925
1281
 
926
- declare type ColorDefinition = Preset & {
927
- value: ColorPaletteColor;
928
- };
929
-
930
1282
  /**
931
1283
  * A color definition for the custom color palette.
932
1284
  * The RGB and CMYK components must all be specified in the range [0-1].
1285
+ * @public
933
1286
  */
934
- declare type ColorPaletteColor = HexColorString | RGBColor | RGBAColor | SpotColor;
1287
+ declare type Color_2 = HexColorString | RGBColor | RGBAColor | SpotColor;
935
1288
 
936
- declare type ColorPaletteDefinition = Preset & {
937
- entries: ColorPaletteColor[];
1289
+ /** @public */
1290
+ declare type ColorDefinition = Preset & {
1291
+ value: Color_2;
938
1292
  };
939
1293
 
940
- declare type Command = {
941
- identifier: string;
942
- argumentTypes: string[];
943
- returnType: string;
1294
+ /** @public */
1295
+ declare type ColorPaletteDefinition = Preset & {
1296
+ entries: Color_2[];
944
1297
  };
945
1298
 
946
- /**
947
- * @public
948
- */
949
- export declare type Configuration = Partial<_Configuration>;
1299
+ declare namespace ConfigTypes {
1300
+ export {
1301
+ HexColorString,
1302
+ Color_2 as Color,
1303
+ AssetSources,
1304
+ AssetSource_2 as AssetSource,
1305
+ AssetResult_2 as AssetResult,
1306
+ AssetsQueryResult_2 as AssetsQueryResult,
1307
+ QueryData,
1308
+ Preset,
1309
+ VariableDefinition,
1310
+ ColorDefinition,
1311
+ ColorPaletteDefinition,
1312
+ PageFormatDefinition,
1313
+ TemplateDefinition,
1314
+ TypefaceDefinition,
1315
+ ImageDefinition,
1316
+ Presets,
1317
+ Variables,
1318
+ Core,
1319
+ Extensions,
1320
+ Scene,
1321
+ Page,
1322
+ Callbacks
1323
+ }
1324
+ }
1325
+ export { ConfigTypes }
950
1326
 
951
- /**
952
- * @public
953
- */
954
- export declare interface _Configuration {
1327
+ /** @public */
1328
+ export declare interface Configuration {
955
1329
  baseURL: string;
956
1330
  license?: string;
957
- role: string;
1331
+ role: RoleString;
958
1332
  featureFlags?: Record<string, string | boolean>;
959
- extensions: Extensions;
960
- core: Core;
961
- scene: Scene;
962
- page: Page;
963
- assets: Assets;
964
- assetSources: AssetSources;
965
- presets: Presets;
966
- variables: Variables;
967
- callbacks: Callbacks;
1333
+ extensions: ConfigTypes.Extensions;
1334
+ core: ConfigTypes.Core;
1335
+ scene: ConfigTypes.Scene;
1336
+ page: ConfigTypes.Page;
1337
+ assetSources: ConfigTypes.AssetSources;
1338
+ presets: ConfigTypes.Presets;
1339
+ variables: ConfigTypes.Variables;
1340
+ callbacks: ConfigTypes.Callbacks;
968
1341
  /**
969
1342
  * The default font used by a text added to the scene. Needs to be the id of
970
1343
  * the font from a extension pack including namespace, e.g.
@@ -976,14 +1349,20 @@ export declare interface _Configuration {
976
1349
  defaultFont?: string;
977
1350
  }
978
1351
 
1352
+ /**
1353
+ * - Crop: Manual crop.
1354
+ * - Cover: Automatically cover the entire frame.
1355
+ * - Contain: Automatically contain content inside frame.
1356
+ *
1357
+ * @public
1358
+ */
1359
+ export declare type ContentFillMode = 'Crop' | 'Cover' | 'Contain';
1360
+
1361
+ /** @public */
979
1362
  declare type Core = {
980
1363
  baseURL: string;
981
1364
  };
982
1365
 
983
- declare interface CreateSceneOptions {
984
- layout: SceneLayout;
985
- }
986
-
987
1366
  /**
988
1367
  * A headless implementation that just initializes & exposes the Document API
989
1368
  *
@@ -991,17 +1370,10 @@ declare interface CreateSceneOptions {
991
1370
  */
992
1371
  declare class CreativeEngine {
993
1372
  #private;
994
- static PositionMode: typeof PositionMode;
995
- static SizeMode: typeof SizeMode;
996
- static PropertyType: typeof PropertyType;
997
- static DesignBlockType: typeof DesignBlockType;
998
- static MimeType: typeof MimeType_2;
999
- static StrokePosition: typeof StrokePosition;
1000
- static StrokeCornerGeometry: typeof StrokeCornerGeometry;
1001
- static StrokeStyle: typeof StrokeStyle;
1002
1373
  block: BlockAPI;
1003
1374
  scene: SceneAPI;
1004
1375
  variable: VariableAPI;
1376
+ editor: EditorAPI;
1005
1377
 
1006
1378
  event: EventAPI;
1007
1379
 
@@ -1016,7 +1388,7 @@ declare class CreativeEngine {
1016
1388
  * the engine works with an internal offscreen-canvas.
1017
1389
  * @returns An engine instance.
1018
1390
  */
1019
- static init(config?: Configuration, canvas?: HTMLCanvasElement): Promise<CreativeEngine>;
1391
+ static init(config?: Partial<Configuration>, canvas?: HTMLCanvasElement | OffscreenCanvas): Promise<CreativeEngine>;
1020
1392
  }
1021
1393
  export default CreativeEngine;
1022
1394
 
@@ -1031,6 +1403,7 @@ export declare type DesignBlockId = number;
1031
1403
  */
1032
1404
  export declare enum DesignBlockType {
1033
1405
  Scene = "//ly.img.ubq/scene",
1406
+ Stack = "//ly.img.ubq/stack",
1034
1407
  Camera = "//ly.img.ubq/camera",
1035
1408
  Page = "//ly.img.ubq/page",
1036
1409
  Image = "//ly.img.ubq/image",
@@ -1046,10 +1419,167 @@ export declare enum DesignBlockType {
1046
1419
  Group = "//ly.img.ubq/group"
1047
1420
  }
1048
1421
 
1049
- declare enum DesignUnit {
1050
- Pixel = "px",
1051
- Millimeter = "mm",
1052
- Inch = "in"
1422
+ /** @public */
1423
+ export declare type DesignUnit = 'mm' | 'px' | 'in';
1424
+
1425
+ /**
1426
+ * @public
1427
+ */
1428
+ export declare class EditorAPI {
1429
+ #private;
1430
+
1431
+ /**
1432
+ * Subscribe to changes to the editor state.
1433
+ * @param callback - This function is called at the end of the engine update, if the editor state has changed.
1434
+ * @returns A method to unsubscribe.
1435
+ */
1436
+ onStateChanged(callback: () => void): () => void;
1437
+ /**
1438
+ * Set the edit mode of the editor.
1439
+ * An edit mode defines what type of content can currently be edited by the user.
1440
+ * Hint: the initial edit mode is "Transform".
1441
+ * @param mode - "Transform", "Crop", "Text", or a custom value.
1442
+ */
1443
+ setEditMode(mode: 'Transform' | 'Crop' | 'Text' | string): void;
1444
+ /**
1445
+ * Get the current edit mode of the editor.
1446
+ * An edit mode defines what type of content can currently be edited by the user.
1447
+ * @returns "Transform", "Crop", "Text", or a custom value.
1448
+ */
1449
+ getEditMode(): 'Transform' | 'Crop' | 'Text' | string;
1450
+ /**
1451
+ * Get the type of cursor that should be displayed by the application.
1452
+ * @returns The cursor type.
1453
+ */
1454
+ getCursorType(): 'Arrow' | 'Move' | 'MoveNotPermitted' | 'Resize' | 'Rotate' | 'Text';
1455
+ /**
1456
+ * Get the rotation with which to render the mouse cursor.
1457
+ * @returns The angle in radians.
1458
+ */
1459
+ getCursorRotation(): number;
1460
+ /**
1461
+ * Get the current text cursor's x position in screen space.
1462
+ * @returns The text cursor's x position in screen space.
1463
+ */
1464
+ getTextCursorPositionInScreenSpaceX(): number;
1465
+ /**
1466
+ * Get the current text cursor's y position in screen space.
1467
+ * @returns The text cursor's y position in screen space.
1468
+ */
1469
+ getTextCursorPositionInScreenSpaceY(): number;
1470
+ /**
1471
+ * Sets the zoom level of the scene.
1472
+ * @param zoomLevel - The new zoom level.
1473
+ */
1474
+ setZoomLevel(zoomLevel?: number): void;
1475
+ /**
1476
+ * Query a camera zoom level.
1477
+ * @returns The zoom level of the block's (main) camera.
1478
+ */
1479
+ getZoomLevel(): number;
1480
+ /**
1481
+ * Adds a new history state to the stack, if undoable changes were made.
1482
+ */
1483
+ addUndoStep(): void;
1484
+ /**
1485
+ * Undo one step in the history if an undo step is available.
1486
+ */
1487
+ undo(): void;
1488
+ /**
1489
+ * Redo one step in the history if a redo step is available.
1490
+ */
1491
+ redo(): void;
1492
+ /**
1493
+ * If an undo step is available.
1494
+ *
1495
+ * @returns True if an undo step is available.
1496
+ */
1497
+ canUndo(): boolean;
1498
+ /**
1499
+ * If a redo step is available.
1500
+ *
1501
+ * @returns True if a redo step is available.
1502
+ */
1503
+ canRedo(): boolean;
1504
+ /**
1505
+ * Set a boolean setting.
1506
+ * @param keypath - The settings keypath, e.g. `ubq://doubleClickToCropEnabled`
1507
+ * @param value - The value to set.
1508
+ * @throws An error, if the keypath is invalid.
1509
+ */
1510
+ setSettingBool(keypath: string, value: boolean): void;
1511
+ /**
1512
+ * Get a boolean setting.
1513
+ * @param keypath - The settings keypath, e.g. `ubq://doubleClickToCropEnabled`
1514
+ * @throws An error, if the keypath is invalid.
1515
+ */
1516
+ getSettingBool(keypath: string): boolean;
1517
+ /**
1518
+ * Set an integer setting.
1519
+ * @param keypath - The settings keypath.
1520
+ * @param value - The value to set.
1521
+ * @throws An error, if the keypath is invalid.
1522
+ */
1523
+ setSettingInt(keypath: string, value: number): void;
1524
+ /**
1525
+ * Get an integer setting.
1526
+ * @param keypath - The settings keypath.
1527
+ * @throws An error, if the keypath is invalid.
1528
+ */
1529
+ getSettingInt(keypath: string): number;
1530
+ /**
1531
+ * Set a float setting.
1532
+ * @param keypath - The settings keypath, e.g. `ubq://positionSnappingThreshold`
1533
+ * @param value - The value to set.
1534
+ * @throws An error, if the keypath is invalid.
1535
+ */
1536
+ setSettingFloat(keypath: string, value: number): void;
1537
+ /**
1538
+ * Get a float setting.
1539
+ * @param keypath - The settings keypath, e.g. `ubq://positionSnappingThreshold`
1540
+ * @throws An error, if the keypath is invalid.
1541
+ */
1542
+ getSettingFloat(keypath: string): number;
1543
+ /**
1544
+ * Set a string setting.
1545
+ * @param keypath - The settings keypath, e.g. `ubq://license`
1546
+ * @param value - The value to set.
1547
+ * @throws An error, if the keypath is invalid.
1548
+ */
1549
+ setSettingString(keypath: string, value: string): void;
1550
+ /**
1551
+ * Get a string setting.
1552
+ * @param keypath - The settings keypath, e.g. `ubq://license`
1553
+ * @throws An error, if the keypath is invalid.
1554
+ */
1555
+ getSettingString(keypath: string): string;
1556
+ /**
1557
+ * Set a color setting.
1558
+ * @param keypath - The settings keypath, e.g. `ubq://highlightColor`.
1559
+ * @param r - The red color component in the range of 0 to 1.
1560
+ * @param g - The green color component in the range of 0 to 1.
1561
+ * @param b - The blue color component in the range of 0 to 1.
1562
+ * @param a - The alpha color component in the range of 0 to 1.
1563
+ */
1564
+ setSettingColorRGBA(keypath: string, r: number, g: number, b: number, a: number): void;
1565
+ /**
1566
+ * Get a color setting.
1567
+ * @param keypath - The settings keypath, e.g. `ubq://highlightColor`.
1568
+ * @returns A tuple of channels red, green, blue and alpha in the range of 0 to 1.
1569
+ */
1570
+ getSettingColorRGBA(keypath: string): RGBA;
1571
+ /**
1572
+ * Set an enum setting.
1573
+ * @param keypath - The settings keypath, e.g. `ubq://role`.
1574
+ * @param value - The enum value as string.
1575
+ */
1576
+ setSettingEnum(keypath: string, value: string): void;
1577
+ /**
1578
+ * Get an enum setting.
1579
+ * @param keypath - The settings keypath, e.g. `ubq://role`.
1580
+ * @returns The value as string.
1581
+ */
1582
+ getSettingEnum(keypath: string): string;
1053
1583
  }
1054
1584
 
1055
1585
  /**
@@ -1067,8 +1597,7 @@ export declare class EventAPI {
1067
1597
  subscribe(blocks: DesignBlockId[], callback: (events: BlockEvent[]) => void): () => void;
1068
1598
  }
1069
1599
 
1070
- declare type EventSubscription = number;
1071
-
1600
+ /** @public */
1072
1601
  declare interface ExportOptions {
1073
1602
  jpegQuality: number;
1074
1603
  pngCompressionLevel: number;
@@ -1077,26 +1606,79 @@ declare interface ExportOptions {
1077
1606
  targetHeight: number;
1078
1607
  }
1079
1608
 
1609
+ /** @public */
1610
+ declare interface ExportVideoOptions {
1611
+ h264Profile: number;
1612
+ h264Level: number;
1613
+ framerate: number;
1614
+ useTargetSize: boolean;
1615
+ targetWidth: number;
1616
+ targetHeight: number;
1617
+ }
1618
+
1619
+ /** @public */
1080
1620
  declare type Extensions = {
1081
1621
  baseURL: string;
1082
1622
  entries: string[];
1083
1623
  };
1084
1624
 
1625
+ /**
1626
+ * @public
1627
+ */
1628
+ export declare type FillType = 'Solid' | 'Gradient';
1629
+
1630
+ /** @public */
1085
1631
  declare interface Flip {
1086
1632
  horizontal: boolean;
1087
1633
  vertical: boolean;
1088
1634
  }
1089
1635
 
1090
- declare type FontStyle = 'normal' | 'italic';
1636
+ /** @public */
1637
+ export declare type FontStyle = 'normal' | 'italic';
1091
1638
 
1092
- declare type FontWeight = 'thin' | 'extraLight' | 'Light' | 'normal' | 'medium' | 'semiBold' | 'bold' | 'extraBold' | 'heavy';
1639
+ /** @public */
1640
+ export declare type FontWeight = 'thin' | 'extraLight' | 'Light' | 'normal' | 'medium' | 'semiBold' | 'bold' | 'extraBold' | 'heavy';
1641
+
1642
+ /**
1643
+ * @public
1644
+ */
1645
+ export declare type GradientControlPointType = 'Start' | 'End' | 'Center';
1646
+
1647
+ /**
1648
+ * @public
1649
+ */
1650
+ export declare type GradientstopRGBA = [
1651
+ stop: number,
1652
+ r: number,
1653
+ g: number,
1654
+ b: number,
1655
+ a: number
1656
+ ];
1657
+
1658
+ /**
1659
+ * @public
1660
+ */
1661
+ export declare type GradientType = 'Linear' | 'Radial' | 'Conical';
1662
+
1663
+ /**
1664
+ * An asset can be member of multiple groups. Groups have a semantic meaning
1665
+ * used to build and group UIs exploring the assets, e.g.sections in the
1666
+ * content library, or for things like topics in Unsplash for instance.
1667
+ *
1668
+ * Tags in comparison have are more loosely hold meaning used for extended
1669
+ * searching/filtering.
1670
+ * @public
1671
+ */
1672
+ declare type Groups = string[];
1093
1673
 
1094
1674
  /**
1095
1675
  * A hexadecimal color value (RGB or RGBA) that starts with a '#'
1096
1676
  * @example #6686FF or #6686FFFF
1677
+ * @public
1097
1678
  */
1098
1679
  declare type HexColorString = string;
1099
1680
 
1681
+ /** @public */
1100
1682
  declare type ImageDefinition = Preset & {
1101
1683
  imageURL: string;
1102
1684
  thumbnailURL?: string;
@@ -1107,9 +1689,17 @@ declare type ImageDefinition = Preset & {
1107
1689
  };
1108
1690
  };
1109
1691
 
1110
- declare type Logger = (message: string, level: LogLevel) => void;
1692
+ /**
1693
+ * e.g. `en`, `de`, etc.
1694
+ * @public
1695
+ */
1696
+ declare type Locale = string;
1697
+
1698
+ /** @public */
1699
+ export declare type Logger = (message: string, level: LogLevel) => void;
1111
1700
 
1112
- declare enum LogLevel {
1701
+ /** @public */
1702
+ export declare enum LogLevel {
1113
1703
  Info = "Info",
1114
1704
  Warning = "Warning",
1115
1705
  Error = "Error"
@@ -1120,23 +1710,14 @@ declare enum MimeType_2 {
1120
1710
  Png = "image/png",
1121
1711
  Jpeg = "image/jpeg",
1122
1712
  Tga = "image/x-tga",
1713
+ Mp4 = "video/mp4",
1123
1714
  Binary = "application/octet-stream",
1124
1715
  Pdf = "application/pdf",
1125
1716
  Zip = "application/zip"
1126
1717
  }
1127
1718
  export { MimeType_2 as MimeType }
1128
1719
 
1129
- declare interface NotificationEvent {
1130
- type: NotificationType;
1131
- i18n: string;
1132
- }
1133
-
1134
- declare enum NotificationType {
1135
- Information = 0,
1136
- Warning = 1,
1137
- Error = 2
1138
- }
1139
-
1720
+ /** @public */
1140
1721
  declare type Page = {
1141
1722
  title: {
1142
1723
  /**
@@ -1155,6 +1736,7 @@ declare type Page = {
1155
1736
  dimOutOfPageAreas?: boolean;
1156
1737
  };
1157
1738
 
1739
+ /** @public */
1158
1740
  declare type PageFormatDefinition = Preset & {
1159
1741
  width: number;
1160
1742
  height: number;
@@ -1163,18 +1745,22 @@ declare type PageFormatDefinition = Preset & {
1163
1745
  bleedMargin?: number;
1164
1746
  };
1165
1747
 
1748
+ /** @public */
1749
+ export declare interface PaginatedAssetQueryData extends AssetQueryData {
1750
+ /** The current page queried for paginated views. */
1751
+ page: number;
1752
+ }
1753
+
1166
1754
  /**
1755
+ * - Absolute: Position in absolute design units.
1756
+ * - Percent: Position in relation to the block's parent's size in percent, where 1.0 means 100%.
1757
+ * - Auto: Position is automatically determined
1758
+ *
1167
1759
  * @public
1168
1760
  */
1169
- export declare enum PositionMode {
1170
- /** Position in absolute design units. */
1171
- Absolute = "Absolute",
1172
- /** Position in relation to the block's parent's size in percent, where 1.0 means 100%. */
1173
- Percent = "Percent",
1174
- /** Position is automatically determined. */
1175
- Undefined = "Auto"
1176
- }
1761
+ export declare type PositionMode = 'Absolute' | 'Percent' | 'Auto';
1177
1762
 
1763
+ /** @public */
1178
1764
  declare type Preset = {
1179
1765
  meta?: {
1180
1766
  default?: boolean;
@@ -1183,6 +1769,7 @@ declare type Preset = {
1183
1769
  };
1184
1770
  };
1185
1771
 
1772
+ /** @public */
1186
1773
  declare type Presets = {
1187
1774
  colors?: {
1188
1775
  [id: string]: ColorDefinition;
@@ -1204,38 +1791,12 @@ declare type Presets = {
1204
1791
  };
1205
1792
  };
1206
1793
 
1207
- /**
1208
- * @public
1209
- */
1210
- export declare enum PropertyType {
1211
- Bool = "Bool",
1212
- Int = "Int",
1213
- Float = "Float",
1214
- String = "String",
1215
- Color = "Color",
1216
- Enum = "Enum",
1217
- Struct = "Struct"
1218
- }
1794
+ /** @public */
1795
+ export declare type PropertyType = 'Bool' | 'Int' | 'Float' | 'String' | 'Color' | 'Enum' | 'Struct';
1219
1796
 
1220
- /**
1221
- * Please read this before you change anything in this file.
1222
- *
1223
- * Types in here are a sub-set of the types in `api/asset.ts` and are meant to be
1224
- * exposed publicly.
1225
- *
1226
- * We do not use the types from `asset.ts` directly to handle (copy&paste) the
1227
- * syncing of the public type declarations and what we actually use in the config.
1228
- * This makes it easier to ensure that the customer is using the correct types and
1229
- * any missmatch between this and the `asset.ts` file will be shown by our
1230
- * type-checker.
1231
- *
1232
- * PLEASE NOTE: If you change anything in here, make the according changes in
1233
- * the `release/types.d.ts` file.
1234
- */
1797
+ /** @public */
1235
1798
  declare interface QueryData {
1236
- /**
1237
- * A query string used for (fuzzy) searching of labels and tags
1238
- */
1799
+ /** A query string used for (fuzzy) searching of labels and tags */
1239
1800
  query?: string;
1240
1801
  /**
1241
1802
  * The number of results queried. How many assets shall be returned regardless
@@ -1244,41 +1805,42 @@ declare interface QueryData {
1244
1805
  * Together with `page` this can be used for pagination.
1245
1806
  */
1246
1807
  perPage: number;
1247
- /**
1248
- * The current page queried for paginated views.
1249
- */
1808
+ /** The current page queried for paginated views. */
1250
1809
  page: number;
1251
1810
  }
1252
1811
 
1253
- declare type RGBA = [r: number, g: number, b: number, a: number];
1812
+ /**
1813
+ * @public
1814
+ */
1815
+ export declare type RGBA = [r: number, g: number, b: number, a: number];
1254
1816
 
1255
- /** All components between 0 and 1 */
1256
- declare interface RGBAColor {
1817
+ /**
1818
+ * All components between 0 and 1
1819
+ * @public
1820
+ */
1821
+ export declare interface RGBAColor {
1257
1822
  r: number;
1258
1823
  g: number;
1259
1824
  b: number;
1260
1825
  a: number;
1261
1826
  }
1262
1827
 
1263
- /** All components between 0 and 1 */
1264
- declare interface RGBColor {
1828
+ /**
1829
+ * All components between 0 and 1
1830
+ * @public
1831
+ */
1832
+ export declare interface RGBColor {
1265
1833
  r: number;
1266
1834
  g: number;
1267
1835
  b: number;
1268
1836
  }
1269
1837
 
1270
- /**
1271
- * Enum for the engine-internal numerical representations of the roles
1272
- */
1273
- declare const enum Role {
1274
- Creator = 0,
1275
- Adopter = 1,
1276
- Viewer = 2,
1277
- Presenter = 3
1278
- }
1838
+ /** @public */
1839
+ export declare type RoleString = 'Creator' | 'Adopter' | 'Viewer' | 'Presenter';
1279
1840
 
1280
- /** Export Settings
1281
- *
1841
+ /**
1842
+ * Export Settings
1843
+ * @public
1282
1844
  */
1283
1845
  declare type Scene = {
1284
1846
  maskSpotColor?: SpotColor;
@@ -1353,72 +1915,78 @@ export declare class SceneAPI {
1353
1915
  * @returns The scene or null, if none was created yet.
1354
1916
  */
1355
1917
  get(): DesignBlockId | null;
1918
+ /**
1919
+ * Applies the contents of the given template scene to the currently loaded scene.
1920
+ * This loads the template scene while keeping the design unit and page dimensions
1921
+ * of the current scene. Page contents remain centered when the pages are resized
1922
+ * to fit the new dimensions.
1923
+ * @param content - The template scene file contents, a base64 string.
1924
+ * @returns A Promise that resolves once the template was applied or rejects if there was an error.
1925
+ */
1926
+ applyTemplateFromString(content: string): Promise<void>;
1927
+ /**
1928
+ * Applies the contents of the given template scene to the currently loaded scene.
1929
+ * This loads the template scene while keeping the design unit and page dimensions
1930
+ * of the current scene. Page contents remain centered when the pages are resized
1931
+ * to fit the new dimensions.
1932
+ * @param url - The url to the template scene file.
1933
+ * @returns A Promise that resolves once the template was applied or rejects if there was an error.
1934
+ */
1935
+ applyTemplateFromURL(url: string): Promise<void>;
1936
+ /**
1937
+ * Converts all values of the current scene into the given design unit.
1938
+ * @param designUnit - The new design unit of the scene
1939
+ */
1940
+ unstable_setDesignUnit(designUnit: DesignUnit): void;
1941
+ /**
1942
+ * Returns the design unit of the current scene.
1943
+ * @returns The current design unit.
1944
+ */
1945
+ unstable_getDesignUnit(): DesignUnit;
1356
1946
  }
1357
1947
 
1358
- declare enum SceneLayout {
1359
- Free = 0,
1360
- VerticalStack = 1,
1361
- HorizontalStack = 2
1948
+ /** @public */
1949
+ export declare interface Size2 {
1950
+ width: number;
1951
+ height: number;
1362
1952
  }
1363
1953
 
1364
1954
  /**
1955
+ * - Absolute: Size in absolute design units.
1956
+ * - Percent: Size in relation to the block's parent's size in percent, where 1.0 means 100%.
1957
+ * - Auto: Size is automatically determined
1958
+ *
1365
1959
  * @public
1366
1960
  */
1367
- export declare enum SizeMode {
1368
- /** Size in absolute design units. */
1369
- Absolute = "Absolute",
1370
- /** Size in relation to the block's parent's size in percent, where 1.0 means 100%. */
1371
- Percent = "Percent",
1372
- /** Size is determined by the block's content. */
1373
- Auto = "Auto"
1374
- }
1961
+ export declare type SizeMode = 'Absolute' | 'Percent' | 'Auto';
1375
1962
 
1376
- declare type SpotColor = {
1963
+ /** @public */
1964
+ export declare interface SpotColor {
1377
1965
  name: string;
1378
- rgbApproximation: RGBColor;
1966
+ rgbApproximation: RGBAColor;
1379
1967
  cmykApproximation: CMYKColor;
1380
- };
1381
-
1382
- /**
1383
- * @public
1384
- */
1385
- export declare enum StrokeCornerGeometry {
1386
- Bevel = "Bevel",
1387
- Miter = "Miter",
1388
- Round = "Round"
1389
1968
  }
1390
1969
 
1391
- /**
1392
- * @public
1393
- */
1394
- export declare enum StrokePosition {
1395
- Center = "Center",
1396
- Inner = "Inner",
1397
- Outer = "Outer"
1398
- }
1970
+ /** @public */
1971
+ export declare type StrokeCornerGeometry = 'Bevel' | 'Miter' | 'Round';
1399
1972
 
1400
- /**
1401
- * @public
1402
- */
1403
- export declare enum StrokeStyle {
1404
- Dashed = "Dashed",
1405
- DashedRound = "DashedRound",
1406
- Dotted = "Dotted",
1407
- LongDashed = "LongDashed",
1408
- LongDashedRound = "LongDashedRound",
1409
- Solid = "Solid"
1410
- }
1973
+ /** @public */
1974
+ export declare type StrokePosition = 'Center' | 'Inner' | 'Outer';
1975
+
1976
+ /** @public */
1977
+ export declare type StrokeStyle = 'Dashed' | 'DashedRound' | 'Dotted' | 'LongDashed' | 'LongDashedRound' | 'Solid';
1411
1978
 
1979
+ /** @public */
1980
+ declare type Subscription = number;
1981
+
1982
+ /** @public */
1412
1983
  declare type TemplateDefinition = Preset & {
1984
+ label: string;
1413
1985
  scene: string | URL | (() => Promise<string>);
1414
1986
  thumbnailURL?: string | URL;
1415
1987
  };
1416
1988
 
1417
- declare interface TypeDescription {
1418
- name: string;
1419
- members: Array<TypeMemberDescription>;
1420
- }
1421
-
1989
+ /** @public */
1422
1990
  declare type TypefaceDefinition = Preset & {
1423
1991
  family: string;
1424
1992
  fonts: [
@@ -1430,17 +1998,6 @@ declare type TypefaceDefinition = Preset & {
1430
1998
  ];
1431
1999
  };
1432
2000
 
1433
- declare interface TypeMemberDescription {
1434
- name: string;
1435
- type: string;
1436
- props: Array<TypeProp>;
1437
- }
1438
-
1439
- declare interface TypeProp {
1440
- key: string;
1441
- value: number | string;
1442
- }
1443
-
1444
2001
  /**
1445
2002
  * @public
1446
2003
  */
@@ -1471,29 +2028,35 @@ export declare class VariableAPI {
1471
2028
  remove(key: string): void;
1472
2029
  }
1473
2030
 
2031
+ /** @public */
1474
2032
  declare type VariableDefinition = Preset & {
1475
2033
  value: string | number;
1476
2034
  };
1477
2035
 
2036
+ /** @public */
1478
2037
  declare type Variables = {
1479
2038
  [id: string]: VariableDefinition;
1480
2039
  };
1481
2040
 
1482
- declare interface Vec2 {
2041
+ /** @public */
2042
+ export declare interface Vec2 {
1483
2043
  x: number;
1484
2044
  y: number;
1485
2045
  }
1486
2046
 
1487
- declare interface Vec3 {
2047
+ /** @public */
2048
+ export declare interface Vec3 {
1488
2049
  x: number;
1489
2050
  y: number;
1490
2051
  z: number;
1491
2052
  }
1492
2053
 
1493
- declare interface Vector<T> {
1494
- size: () => number;
1495
- get: (index: number) => T;
1496
- delete: () => void;
2054
+ /** @public */
2055
+ export declare interface Vec4 {
2056
+ x: number;
2057
+ y: number;
2058
+ z: number;
2059
+ w: number;
1497
2060
  }
1498
2061
 
1499
2062
  export { }