@cesdk/engine 1.6.2 → 1.7.0-alpha.1
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/assets/core/cesdk.wasm +0 -0
- package/index.d.ts +2095 -2060
- package/index.js +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,2060 +1,2095 @@
|
|
|
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
|
-
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 {
|
|
63
|
-
/**
|
|
64
|
-
* Label used to display in aria-label and as a tooltip.
|
|
65
|
-
* Will be also searched in a query and should be localized
|
|
66
|
-
*/
|
|
67
|
-
label?: Record<Locale, string>;
|
|
68
|
-
/**
|
|
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`.
|
|
73
|
-
*/
|
|
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;
|
|
84
|
-
/**
|
|
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.
|
|
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. */
|
|
161
|
-
size: {
|
|
162
|
-
width: number;
|
|
163
|
-
height: number;
|
|
164
|
-
};
|
|
165
|
-
/** Asset-specific and custom meta information */
|
|
166
|
-
meta?: {
|
|
167
|
-
uri?: string;
|
|
168
|
-
filename?: string;
|
|
169
|
-
} & Record<string, unknown>;
|
|
170
|
-
/** The locale of the label and tags */
|
|
171
|
-
locale?: string;
|
|
172
|
-
/** The label of the result. Used for description and tooltips. */
|
|
173
|
-
label?: string;
|
|
174
|
-
/** The tags of this asset. Used for filtering and free-text searching. */
|
|
175
|
-
tags?: string[];
|
|
176
|
-
context: {
|
|
177
|
-
sourceId: string;
|
|
178
|
-
};
|
|
179
|
-
/** Credits for the artist of the asset */
|
|
180
|
-
credits?: {
|
|
181
|
-
name: string;
|
|
182
|
-
url?: string;
|
|
183
|
-
};
|
|
184
|
-
/** License for this asset. Overwrites the source license if present */
|
|
185
|
-
license?: {
|
|
186
|
-
name: string;
|
|
187
|
-
url?: string;
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* A source of assets
|
|
193
|
-
* @public
|
|
194
|
-
*/
|
|
195
|
-
export declare interface AssetSource extends AssetAPI<PaginatedAssetQueryData> {
|
|
196
|
-
/**
|
|
197
|
-
* Can the source add, update and remove assets dynamically? If `false`
|
|
198
|
-
* methods like `addAsset` `updateAsset` and `removeAsset` will throw and
|
|
199
|
-
* error.
|
|
200
|
-
*/
|
|
201
|
-
canManageAssets?: boolean;
|
|
202
|
-
/**
|
|
203
|
-
* Indicates if the asset shall be downloaded to handle the raw data instead
|
|
204
|
-
* of an URL reference. Do this if you do not want to depend on
|
|
205
|
-
* a service after adding the asset to the scene. If this is your own API
|
|
206
|
-
* with your own service, you do not need to set this and avoid downloading /
|
|
207
|
-
* re-uploading the assets.
|
|
208
|
-
*/
|
|
209
|
-
downloadAssets?: (asset: AssetResult) => Promise<Blob>;
|
|
210
|
-
/**
|
|
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.
|
|
251
|
-
*/
|
|
252
|
-
downloadAssets?: (asset: AssetResult_2) => Promise<Blob>;
|
|
253
|
-
/** Credits for the source/api */
|
|
254
|
-
credits?: {
|
|
255
|
-
name: string;
|
|
256
|
-
url?: string;
|
|
257
|
-
};
|
|
258
|
-
/** General license for all asset from this source */
|
|
259
|
-
license?: {
|
|
260
|
-
name: string;
|
|
261
|
-
url?: string;
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/** @public */
|
|
266
|
-
declare type AssetSources = {
|
|
267
|
-
[id: string]: AssetSource_2;
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Return type of a `findAssets` query.
|
|
272
|
-
* @public
|
|
273
|
-
*/
|
|
274
|
-
export declare interface AssetsQueryResult {
|
|
275
|
-
/** The assets in the requested page */
|
|
276
|
-
assets: AssetResult[];
|
|
277
|
-
/** The current, requested page */
|
|
278
|
-
currentPage: number;
|
|
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 */
|
|
297
|
-
total: number;
|
|
298
|
-
}
|
|
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 */
|
|
306
|
-
declare type Block = number;
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* @public
|
|
310
|
-
*/
|
|
311
|
-
export declare class BlockAPI {
|
|
312
|
-
#private;
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Exports a design block element as a file of the given mime type.
|
|
316
|
-
* Performs an internal update to resolve the final layout for the blocks.
|
|
317
|
-
* @param handle - The design block element to export.
|
|
318
|
-
* @param mimeType - The mime type of the output file.
|
|
319
|
-
* @returns A promise that resolves with the exported image or is rejected with an error.
|
|
320
|
-
*/
|
|
321
|
-
export(handle: DesignBlockId, mimeType?: MimeType_2): Promise<Blob>;
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Loads existing blocks from the given string.
|
|
325
|
-
* The blocks are not attached by default and won't be visible until attached to a page or the scene.
|
|
326
|
-
* @param content - A string representing the given blocks.
|
|
327
|
-
* @returns A promise that resolves with a list of handles representing the found blocks or an error.
|
|
328
|
-
*/
|
|
329
|
-
loadFromString(content: string): Promise<DesignBlockId[]>;
|
|
330
|
-
/**
|
|
331
|
-
* Saves the given blocks into a string. If given the root of a block hierarchy, e.g. a
|
|
332
|
-
* page with multiple children, the entire hierarchy is saved.
|
|
333
|
-
* @param blocks - The blocks to save
|
|
334
|
-
* @returns A promise that resolves to a string representing the blocks or an error.
|
|
335
|
-
*/
|
|
336
|
-
saveToString(blocks: DesignBlockId[]): Promise<string>;
|
|
337
|
-
/**
|
|
338
|
-
* Create a new block, fails if type is unknown.
|
|
339
|
-
* @param type - The type of the block that shall be created.
|
|
340
|
-
* @returns The created blocks handle.
|
|
341
|
-
*/
|
|
342
|
-
create(type: DesignBlockType): DesignBlockId;
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Get the type of the given block, fails if the block is invalid.
|
|
346
|
-
* @param id - The block to query.
|
|
347
|
-
* @returns The blocks type.
|
|
348
|
-
*/
|
|
349
|
-
getType(id: DesignBlockId): DesignBlockType;
|
|
350
|
-
/**
|
|
351
|
-
* Update the selection state of a block.
|
|
352
|
-
* Fails for invalid blocks.
|
|
353
|
-
* @param id - The block to query.
|
|
354
|
-
* @param selected - Whether or not the block should be selected.
|
|
355
|
-
*/
|
|
356
|
-
setSelected(id: DesignBlockId, selected: boolean): void;
|
|
357
|
-
/**
|
|
358
|
-
* Get the selected state of a block.
|
|
359
|
-
* @param id - The block to query.
|
|
360
|
-
* @returns True if the block is selected, false otherwise.
|
|
361
|
-
*/
|
|
362
|
-
isSelected(id: DesignBlockId): boolean;
|
|
363
|
-
/**
|
|
364
|
-
* Get all currently selected blocks.
|
|
365
|
-
* @returns An array of block ids.
|
|
366
|
-
*/
|
|
367
|
-
findAllSelected(): DesignBlockId[];
|
|
368
|
-
/**
|
|
369
|
-
* Confirms that a given set of blocks can be grouped together.
|
|
370
|
-
* @param ids - A non-empty array of block ids.
|
|
371
|
-
* @returns Whether the blocks can be grouped together.
|
|
372
|
-
*/
|
|
373
|
-
isGroupable(ids: DesignBlockId[]): boolean;
|
|
374
|
-
/**
|
|
375
|
-
* Group blocks together.
|
|
376
|
-
* @param ids - A non-empty array of block ids.
|
|
377
|
-
* @returns The block id of the created group.
|
|
378
|
-
*/
|
|
379
|
-
group(ids: DesignBlockId[]): DesignBlockId;
|
|
380
|
-
/**
|
|
381
|
-
* Ungroups a group.
|
|
382
|
-
* @param id - The group id from a previous call to `group`.
|
|
383
|
-
*/
|
|
384
|
-
ungroup(id: DesignBlockId): void;
|
|
385
|
-
/**
|
|
386
|
-
* Changes selection from selected group to a block within that group.
|
|
387
|
-
* Nothing happens if `group` is not a group.
|
|
388
|
-
* @param id - The group id from a previous call to `group`.
|
|
389
|
-
*/
|
|
390
|
-
enterGroup(id: DesignBlockId): void;
|
|
391
|
-
/**
|
|
392
|
-
* Changes selection from a group's selected block to that group.
|
|
393
|
-
* Nothing happens if the `id` is not part of a group.
|
|
394
|
-
* @param id - A block id.
|
|
395
|
-
*/
|
|
396
|
-
exitGroup(id: DesignBlockId): void;
|
|
397
|
-
/**
|
|
398
|
-
* Update a block's name.
|
|
399
|
-
* @param id - The block to update.
|
|
400
|
-
* @param name - The name to set.
|
|
401
|
-
*/
|
|
402
|
-
setName(id: DesignBlockId, name: string): void;
|
|
403
|
-
/**
|
|
404
|
-
* Get a block's name.
|
|
405
|
-
* @param id - The block to update.
|
|
406
|
-
*/
|
|
407
|
-
getName(id: DesignBlockId): string;
|
|
408
|
-
/**
|
|
409
|
-
* Finds all blocks with the given name.
|
|
410
|
-
* @param name - The name to search for.
|
|
411
|
-
* @returns A list of block ids.
|
|
412
|
-
*/
|
|
413
|
-
findByName(name: string): DesignBlockId[];
|
|
414
|
-
/**
|
|
415
|
-
* Finds all blocks with the given type.
|
|
416
|
-
* @param type - The type to search for.
|
|
417
|
-
* @returns A list of block ids.
|
|
418
|
-
*/
|
|
419
|
-
findByType(type: DesignBlockType): DesignBlockId[];
|
|
420
|
-
/**
|
|
421
|
-
* Return all blocks currently known to the engine.
|
|
422
|
-
* @returns A list of block ids.
|
|
423
|
-
*/
|
|
424
|
-
findAll(): DesignBlockId[];
|
|
425
|
-
/**
|
|
426
|
-
* Return all placeholder blocks in the current scene.
|
|
427
|
-
* @returns A list of block ids.
|
|
428
|
-
*/
|
|
429
|
-
findAllPlaceholders(): DesignBlockId[];
|
|
430
|
-
/**
|
|
431
|
-
* Query a block's visibility.
|
|
432
|
-
* @param id - The block to query.
|
|
433
|
-
* @returns True if visible, false otherwise.
|
|
434
|
-
*/
|
|
435
|
-
isVisible(id: DesignBlockId): boolean;
|
|
436
|
-
/**
|
|
437
|
-
* Update a block's visibility.
|
|
438
|
-
* @param id - The block to update.
|
|
439
|
-
* @param visible - Whether the block shall be visible.
|
|
440
|
-
*/
|
|
441
|
-
setVisible(id: DesignBlockId, visible: boolean): void;
|
|
442
|
-
/**
|
|
443
|
-
* Query a block's clipped state. If true, the block should clip
|
|
444
|
-
* its contents to its frame.
|
|
445
|
-
* @param id - The block to query.
|
|
446
|
-
* @returns True if clipped, false otherwise.
|
|
447
|
-
*/
|
|
448
|
-
isClipped(id: DesignBlockId): boolean;
|
|
449
|
-
/**
|
|
450
|
-
* Update a block's clipped state.
|
|
451
|
-
* @param id - The block to update.
|
|
452
|
-
* @param clipped - Whether the block should clips its contents to its frame.
|
|
453
|
-
*/
|
|
454
|
-
setClipped(id: DesignBlockId, clipped: boolean): void;
|
|
455
|
-
/**
|
|
456
|
-
* Query a block's x position.
|
|
457
|
-
* @param id - The block to query.
|
|
458
|
-
* @returns The value of the x position.
|
|
459
|
-
*/
|
|
460
|
-
getPositionX(id: DesignBlockId): number;
|
|
461
|
-
/**
|
|
462
|
-
* Query a block's mode for its x position.
|
|
463
|
-
* @param id - The block to query.
|
|
464
|
-
* @returns The current mode for the x position: absolute, percent or undefined.
|
|
465
|
-
*/
|
|
466
|
-
getPositionXMode(id: DesignBlockId): PositionMode;
|
|
467
|
-
/**
|
|
468
|
-
* Query a block's y position.
|
|
469
|
-
* @param id - The block to query.
|
|
470
|
-
* @returns The value of the y position.
|
|
471
|
-
*/
|
|
472
|
-
getPositionY(id: DesignBlockId): number;
|
|
473
|
-
/**
|
|
474
|
-
* Query a block's mode for its y position.
|
|
475
|
-
* @param id - The block to query.
|
|
476
|
-
* @returns The current mode for the y position: absolute, percent or undefined.
|
|
477
|
-
*/
|
|
478
|
-
getPositionYMode(id: DesignBlockId): PositionMode;
|
|
479
|
-
/**
|
|
480
|
-
* Update a block's x position.
|
|
481
|
-
* The position refers to the block's local space, relative to its parent with the origin at the top left.
|
|
482
|
-
* @param id - The block to update.
|
|
483
|
-
* @param value - The value of the x position.
|
|
484
|
-
*/
|
|
485
|
-
setPositionX(id: DesignBlockId, value: number): void;
|
|
486
|
-
/**
|
|
487
|
-
* Set a block's mode for its x position.
|
|
488
|
-
* @param id - The block to update.
|
|
489
|
-
* @param mode - The x position mode: absolute, percent or undefined.
|
|
490
|
-
*/
|
|
491
|
-
setPositionXMode(id: DesignBlockId, mode: PositionMode): void;
|
|
492
|
-
/**
|
|
493
|
-
* Update a block's y position.
|
|
494
|
-
* The position refers to the block's local space, relative to its parent with the origin at the top left.
|
|
495
|
-
* @param id - The block to update.
|
|
496
|
-
* @param value - The value of the y position.
|
|
497
|
-
*/
|
|
498
|
-
setPositionY(id: DesignBlockId, value: number): void;
|
|
499
|
-
/**
|
|
500
|
-
* Set a block's mode for its y position.
|
|
501
|
-
* @param id - The block to update.
|
|
502
|
-
* @param mode - The y position mode: absolute, percent or undefined.
|
|
503
|
-
*/
|
|
504
|
-
setPositionYMode(id: DesignBlockId, mode: PositionMode): void;
|
|
505
|
-
/**
|
|
506
|
-
* Query a block's rotation in radians.
|
|
507
|
-
* @param id - The block to query.
|
|
508
|
-
* @returns The block's rotation around its center in radians.
|
|
509
|
-
*/
|
|
510
|
-
getRotation(id: DesignBlockId): number;
|
|
511
|
-
/**
|
|
512
|
-
* Update a block's rotation.
|
|
513
|
-
* @param id - The block to update.
|
|
514
|
-
* @param radians - The new rotation in radians. Rotation is applied around the block's center.
|
|
515
|
-
*/
|
|
516
|
-
setRotation(id: DesignBlockId, radians: number): void;
|
|
517
|
-
/**
|
|
518
|
-
* Query a block's horizontal flip state.
|
|
519
|
-
* @param id - The block to query.
|
|
520
|
-
* @returns A boolean indicating for whether the block is flipped in the queried direction
|
|
521
|
-
*/
|
|
522
|
-
getFlipHorizontal(id: DesignBlockId): boolean;
|
|
523
|
-
/**
|
|
524
|
-
* Query a block's vertical flip state.
|
|
525
|
-
* @param id - The block to query.
|
|
526
|
-
* @returns A boolean indicating for whether the block is flipped in the queried direction
|
|
527
|
-
*/
|
|
528
|
-
getFlipVertical(id: DesignBlockId): boolean;
|
|
529
|
-
/**
|
|
530
|
-
* Update a block's horizontal flip.
|
|
531
|
-
* @param id - The block to update.
|
|
532
|
-
* @param flip - If the flip should be enabled.
|
|
533
|
-
*/
|
|
534
|
-
setFlipHorizontal(id: DesignBlockId, flip: boolean): void;
|
|
535
|
-
/**
|
|
536
|
-
* Update a block's vertical flip.
|
|
537
|
-
* @param id - The block to update.
|
|
538
|
-
* @param flip - If the flip should be enabled.
|
|
539
|
-
*/
|
|
540
|
-
setFlipVertical(id: DesignBlockId, flip: boolean): void;
|
|
541
|
-
/**
|
|
542
|
-
* Query
|
|
543
|
-
* @param id - The block to query.
|
|
544
|
-
* @returns
|
|
545
|
-
*/
|
|
546
|
-
|
|
547
|
-
/**
|
|
548
|
-
* Query
|
|
549
|
-
* @param id - The block to query.
|
|
550
|
-
* @returns
|
|
551
|
-
*/
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* Query a block's
|
|
555
|
-
* @param id - The block to query.
|
|
556
|
-
* @returns The value of the block's
|
|
557
|
-
*/
|
|
558
|
-
|
|
559
|
-
/**
|
|
560
|
-
* Query a block's mode for its
|
|
561
|
-
* @param id - The block to query.
|
|
562
|
-
* @returns The current mode for the
|
|
563
|
-
*/
|
|
564
|
-
|
|
565
|
-
/**
|
|
566
|
-
* Query a block's
|
|
567
|
-
* @param id - The block to query.
|
|
568
|
-
* @returns The
|
|
569
|
-
*/
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
*
|
|
573
|
-
* @param id - The block to
|
|
574
|
-
* @
|
|
575
|
-
*/
|
|
576
|
-
|
|
577
|
-
/**
|
|
578
|
-
*
|
|
579
|
-
* @param id - The block to
|
|
580
|
-
* @
|
|
581
|
-
*/
|
|
582
|
-
|
|
583
|
-
/**
|
|
584
|
-
* Update a block's
|
|
585
|
-
* @param id - The block to update.
|
|
586
|
-
* @param value - The new
|
|
587
|
-
*/
|
|
588
|
-
|
|
589
|
-
/**
|
|
590
|
-
* Set a block's mode for its
|
|
591
|
-
* @param id - The block to update.
|
|
592
|
-
* @param mode - The
|
|
593
|
-
*/
|
|
594
|
-
|
|
595
|
-
/**
|
|
596
|
-
*
|
|
597
|
-
* @param id - The block to update.
|
|
598
|
-
* @param
|
|
599
|
-
*/
|
|
600
|
-
|
|
601
|
-
/**
|
|
602
|
-
*
|
|
603
|
-
*
|
|
604
|
-
* @param
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
*
|
|
610
|
-
*
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
*
|
|
617
|
-
* @
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
*
|
|
623
|
-
* @param id - The block to
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
*
|
|
629
|
-
* @
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
*
|
|
635
|
-
* @
|
|
636
|
-
*/
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
*
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
*
|
|
655
|
-
* @
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
*
|
|
661
|
-
* @param
|
|
662
|
-
* @
|
|
663
|
-
*/
|
|
664
|
-
|
|
665
|
-
/**
|
|
666
|
-
*
|
|
667
|
-
*
|
|
668
|
-
* @param
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
*
|
|
674
|
-
*
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
*
|
|
681
|
-
* The
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
*
|
|
688
|
-
* The
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
*
|
|
700
|
-
*
|
|
701
|
-
* @param
|
|
702
|
-
* @
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
*
|
|
710
|
-
*
|
|
711
|
-
*
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
*
|
|
716
|
-
* @param
|
|
717
|
-
*
|
|
718
|
-
*/
|
|
719
|
-
|
|
720
|
-
/**
|
|
721
|
-
* Get all
|
|
722
|
-
* @param
|
|
723
|
-
* @returns A list of the
|
|
724
|
-
*/
|
|
725
|
-
|
|
726
|
-
/**
|
|
727
|
-
*
|
|
728
|
-
* @param
|
|
729
|
-
* @
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
*
|
|
735
|
-
* @
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
*
|
|
742
|
-
* @param
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
*
|
|
749
|
-
* @
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
*
|
|
756
|
-
* @param
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
*
|
|
763
|
-
* @
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
*
|
|
770
|
-
* @param
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
*
|
|
777
|
-
* @
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
*
|
|
784
|
-
* @param
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
*
|
|
789
|
-
* @param
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
*
|
|
796
|
-
* @
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
*
|
|
801
|
-
* @param
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
*
|
|
808
|
-
* @
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
*
|
|
815
|
-
* @param
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
*
|
|
821
|
-
* @param
|
|
822
|
-
* @
|
|
823
|
-
*/
|
|
824
|
-
|
|
825
|
-
/**
|
|
826
|
-
*
|
|
827
|
-
* @param id - The block
|
|
828
|
-
* @
|
|
829
|
-
*/
|
|
830
|
-
|
|
831
|
-
/**
|
|
832
|
-
* Set the crop
|
|
833
|
-
* @param id - The block whose crop should be set.
|
|
834
|
-
* @param
|
|
835
|
-
*/
|
|
836
|
-
|
|
837
|
-
/**
|
|
838
|
-
* Set the crop
|
|
839
|
-
* @param id - The block whose crop should be set.
|
|
840
|
-
* @param
|
|
841
|
-
*/
|
|
842
|
-
|
|
843
|
-
/**
|
|
844
|
-
* Set the crop
|
|
845
|
-
* @param id - The block whose crop should be set.
|
|
846
|
-
* @param
|
|
847
|
-
*/
|
|
848
|
-
|
|
849
|
-
/**
|
|
850
|
-
*
|
|
851
|
-
* The block
|
|
852
|
-
* @param
|
|
853
|
-
*/
|
|
854
|
-
|
|
855
|
-
/**
|
|
856
|
-
*
|
|
857
|
-
* @param id - The block whose
|
|
858
|
-
* @
|
|
859
|
-
*/
|
|
860
|
-
|
|
861
|
-
/**
|
|
862
|
-
*
|
|
863
|
-
*
|
|
864
|
-
* @
|
|
865
|
-
*/
|
|
866
|
-
|
|
867
|
-
/**
|
|
868
|
-
* Get the crop
|
|
869
|
-
* @param id - The block whose
|
|
870
|
-
* @returns The
|
|
871
|
-
*/
|
|
872
|
-
|
|
873
|
-
/**
|
|
874
|
-
* Get the crop
|
|
875
|
-
* @param id - The block whose
|
|
876
|
-
* @returns The
|
|
877
|
-
*/
|
|
878
|
-
|
|
879
|
-
/**
|
|
880
|
-
* Get the crop
|
|
881
|
-
* @param id - The block whose
|
|
882
|
-
* @returns The
|
|
883
|
-
*/
|
|
884
|
-
|
|
885
|
-
/**
|
|
886
|
-
*
|
|
887
|
-
* @param id - The block
|
|
888
|
-
* @returns
|
|
889
|
-
*/
|
|
890
|
-
|
|
891
|
-
/**
|
|
892
|
-
*
|
|
893
|
-
* @param id - The block whose
|
|
894
|
-
* @
|
|
895
|
-
*/
|
|
896
|
-
|
|
897
|
-
/**
|
|
898
|
-
*
|
|
899
|
-
* @param id - The block
|
|
900
|
-
* @returns
|
|
901
|
-
*/
|
|
902
|
-
|
|
903
|
-
/**
|
|
904
|
-
* Set the
|
|
905
|
-
* @param id - The block whose
|
|
906
|
-
* @param
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
*
|
|
912
|
-
* @
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
*
|
|
918
|
-
* @
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
*
|
|
924
|
-
* @param
|
|
925
|
-
* @
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
*
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
*
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
*
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
*
|
|
946
|
-
* @param
|
|
947
|
-
* @
|
|
948
|
-
*/
|
|
949
|
-
|
|
950
|
-
/**
|
|
951
|
-
*
|
|
952
|
-
* @param id - The block
|
|
953
|
-
* @returns
|
|
954
|
-
*/
|
|
955
|
-
|
|
956
|
-
/**
|
|
957
|
-
*
|
|
958
|
-
* @param id - The block whose
|
|
959
|
-
* @param
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
*
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
*
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
*
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
*
|
|
980
|
-
* @param
|
|
981
|
-
* @
|
|
982
|
-
*/
|
|
983
|
-
|
|
984
|
-
/**
|
|
985
|
-
*
|
|
986
|
-
* @param id - The block
|
|
987
|
-
* @returns
|
|
988
|
-
*/
|
|
989
|
-
|
|
990
|
-
/**
|
|
991
|
-
* Enable or disable the
|
|
992
|
-
* @param id - The block whose
|
|
993
|
-
* @param enabled - If true, the
|
|
994
|
-
*/
|
|
995
|
-
|
|
996
|
-
/**
|
|
997
|
-
* Query if the
|
|
998
|
-
* @param id - The block whose
|
|
999
|
-
* @returns True if
|
|
1000
|
-
*/
|
|
1001
|
-
|
|
1002
|
-
/**
|
|
1003
|
-
*
|
|
1004
|
-
* @param id - The block
|
|
1005
|
-
* @
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
*
|
|
1025
|
-
* @param
|
|
1026
|
-
* @
|
|
1027
|
-
*/
|
|
1028
|
-
|
|
1029
|
-
/**
|
|
1030
|
-
*
|
|
1031
|
-
* @param id - The block whose
|
|
1032
|
-
* @
|
|
1033
|
-
*/
|
|
1034
|
-
|
|
1035
|
-
/**
|
|
1036
|
-
*
|
|
1037
|
-
* @param id - The block whose stroke
|
|
1038
|
-
* @
|
|
1039
|
-
*/
|
|
1040
|
-
|
|
1041
|
-
/**
|
|
1042
|
-
*
|
|
1043
|
-
* @param id - The block whose stroke
|
|
1044
|
-
* @
|
|
1045
|
-
*/
|
|
1046
|
-
|
|
1047
|
-
/**
|
|
1048
|
-
*
|
|
1049
|
-
* @param id - The block whose stroke
|
|
1050
|
-
* @
|
|
1051
|
-
*/
|
|
1052
|
-
|
|
1053
|
-
/**
|
|
1054
|
-
*
|
|
1055
|
-
* @param id - The block whose stroke
|
|
1056
|
-
* @
|
|
1057
|
-
*/
|
|
1058
|
-
|
|
1059
|
-
/**
|
|
1060
|
-
*
|
|
1061
|
-
* @param id - The block whose stroke
|
|
1062
|
-
* @
|
|
1063
|
-
*/
|
|
1064
|
-
|
|
1065
|
-
/**
|
|
1066
|
-
*
|
|
1067
|
-
* @param id - The block
|
|
1068
|
-
* @returns
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
*
|
|
1074
|
-
* @param
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
*
|
|
1079
|
-
* @param
|
|
1080
|
-
* @
|
|
1081
|
-
*/
|
|
1082
|
-
|
|
1083
|
-
/**
|
|
1084
|
-
*
|
|
1085
|
-
* @param id - The block
|
|
1086
|
-
* @returns
|
|
1087
|
-
* @deprecated Use `
|
|
1088
|
-
*/
|
|
1089
|
-
|
|
1090
|
-
/**
|
|
1091
|
-
*
|
|
1092
|
-
* @param id - The block whose outline should be
|
|
1093
|
-
* @param
|
|
1094
|
-
* @
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
*
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
*
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
*
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
*
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
*
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
*
|
|
1133
|
-
* @
|
|
1134
|
-
* @
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
*
|
|
1140
|
-
* @
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
*
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
*
|
|
1153
|
-
* @
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
*
|
|
1158
|
-
* @
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
*
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
*
|
|
1171
|
-
* @
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
*
|
|
1176
|
-
* @
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
*
|
|
1182
|
-
* @
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
*
|
|
1187
|
-
* @param
|
|
1188
|
-
* @
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
*
|
|
1194
|
-
* @param
|
|
1195
|
-
* @returns
|
|
1196
|
-
*/
|
|
1197
|
-
|
|
1198
|
-
/**
|
|
1199
|
-
*
|
|
1200
|
-
* @param id - The block
|
|
1201
|
-
* @
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
*
|
|
1206
|
-
* @
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
*
|
|
1213
|
-
*
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
*
|
|
1218
|
-
* @
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
*
|
|
1224
|
-
* @param
|
|
1225
|
-
* @
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
*
|
|
1231
|
-
*
|
|
1232
|
-
* @
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
*
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
*
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
*
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
/**
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
*
|
|
1452
|
-
* @returns
|
|
1453
|
-
*/
|
|
1454
|
-
|
|
1455
|
-
/**
|
|
1456
|
-
*
|
|
1457
|
-
*
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
*
|
|
1486
|
-
*/
|
|
1487
|
-
|
|
1488
|
-
/**
|
|
1489
|
-
*
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
*
|
|
1495
|
-
* @returns
|
|
1496
|
-
*/
|
|
1497
|
-
|
|
1498
|
-
/**
|
|
1499
|
-
*
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
*
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
*
|
|
1513
|
-
* @
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
*
|
|
1519
|
-
* @
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
*
|
|
1526
|
-
* @
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
*
|
|
1532
|
-
* @
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
*
|
|
1539
|
-
* @
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
*
|
|
1545
|
-
* @
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
*
|
|
1552
|
-
* @
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
*
|
|
1558
|
-
* @
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
*
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
*
|
|
1579
|
-
* @param
|
|
1580
|
-
* @
|
|
1581
|
-
*/
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
*
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
/**
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
*/
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
*/
|
|
1672
|
-
declare type
|
|
1673
|
-
|
|
1674
|
-
/**
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
* @public
|
|
1695
|
-
*/
|
|
1696
|
-
declare type
|
|
1697
|
-
|
|
1698
|
-
/**
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
}
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
}
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
* @public
|
|
1866
|
-
*/
|
|
1867
|
-
export declare
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
*
|
|
1886
|
-
*
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
*
|
|
1892
|
-
*
|
|
1893
|
-
*
|
|
1894
|
-
*
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
*
|
|
1907
|
-
* @param
|
|
1908
|
-
* @
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
*
|
|
1915
|
-
* @
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
*
|
|
1921
|
-
*
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
*
|
|
1929
|
-
*
|
|
1930
|
-
*
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
*
|
|
1943
|
-
* @
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
/**
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
/**
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
}
|
|
1988
|
-
|
|
1989
|
-
/**
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
};
|
|
2033
|
-
|
|
2034
|
-
/**
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
/**
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
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
|
+
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 {
|
|
63
|
+
/**
|
|
64
|
+
* Label used to display in aria-label and as a tooltip.
|
|
65
|
+
* Will be also searched in a query and should be localized
|
|
66
|
+
*/
|
|
67
|
+
label?: Record<Locale, string>;
|
|
68
|
+
/**
|
|
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`.
|
|
73
|
+
*/
|
|
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;
|
|
84
|
+
/**
|
|
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.
|
|
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. */
|
|
161
|
+
size: {
|
|
162
|
+
width: number;
|
|
163
|
+
height: number;
|
|
164
|
+
};
|
|
165
|
+
/** Asset-specific and custom meta information */
|
|
166
|
+
meta?: {
|
|
167
|
+
uri?: string;
|
|
168
|
+
filename?: string;
|
|
169
|
+
} & Record<string, unknown>;
|
|
170
|
+
/** The locale of the label and tags */
|
|
171
|
+
locale?: string;
|
|
172
|
+
/** The label of the result. Used for description and tooltips. */
|
|
173
|
+
label?: string;
|
|
174
|
+
/** The tags of this asset. Used for filtering and free-text searching. */
|
|
175
|
+
tags?: string[];
|
|
176
|
+
context: {
|
|
177
|
+
sourceId: string;
|
|
178
|
+
};
|
|
179
|
+
/** Credits for the artist of the asset */
|
|
180
|
+
credits?: {
|
|
181
|
+
name: string;
|
|
182
|
+
url?: string;
|
|
183
|
+
};
|
|
184
|
+
/** License for this asset. Overwrites the source license if present */
|
|
185
|
+
license?: {
|
|
186
|
+
name: string;
|
|
187
|
+
url?: string;
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* A source of assets
|
|
193
|
+
* @public
|
|
194
|
+
*/
|
|
195
|
+
export declare interface AssetSource extends AssetAPI<PaginatedAssetQueryData> {
|
|
196
|
+
/**
|
|
197
|
+
* Can the source add, update and remove assets dynamically? If `false`
|
|
198
|
+
* methods like `addAsset` `updateAsset` and `removeAsset` will throw and
|
|
199
|
+
* error.
|
|
200
|
+
*/
|
|
201
|
+
canManageAssets?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Indicates if the asset shall be downloaded to handle the raw data instead
|
|
204
|
+
* of an URL reference. Do this if you do not want to depend on
|
|
205
|
+
* a service after adding the asset to the scene. If this is your own API
|
|
206
|
+
* with your own service, you do not need to set this and avoid downloading /
|
|
207
|
+
* re-uploading the assets.
|
|
208
|
+
*/
|
|
209
|
+
downloadAssets?: (asset: AssetResult) => Promise<Blob>;
|
|
210
|
+
/**
|
|
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.
|
|
251
|
+
*/
|
|
252
|
+
downloadAssets?: (asset: AssetResult_2) => Promise<Blob>;
|
|
253
|
+
/** Credits for the source/api */
|
|
254
|
+
credits?: {
|
|
255
|
+
name: string;
|
|
256
|
+
url?: string;
|
|
257
|
+
};
|
|
258
|
+
/** General license for all asset from this source */
|
|
259
|
+
license?: {
|
|
260
|
+
name: string;
|
|
261
|
+
url?: string;
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** @public */
|
|
266
|
+
declare type AssetSources = {
|
|
267
|
+
[id: string]: AssetSource_2;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Return type of a `findAssets` query.
|
|
272
|
+
* @public
|
|
273
|
+
*/
|
|
274
|
+
export declare interface AssetsQueryResult {
|
|
275
|
+
/** The assets in the requested page */
|
|
276
|
+
assets: AssetResult[];
|
|
277
|
+
/** The current, requested page */
|
|
278
|
+
currentPage: number;
|
|
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 */
|
|
297
|
+
total: number;
|
|
298
|
+
}
|
|
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 */
|
|
306
|
+
declare type Block = number;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* @public
|
|
310
|
+
*/
|
|
311
|
+
export declare class BlockAPI {
|
|
312
|
+
#private;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Exports a design block element as a file of the given mime type.
|
|
316
|
+
* Performs an internal update to resolve the final layout for the blocks.
|
|
317
|
+
* @param handle - The design block element to export.
|
|
318
|
+
* @param mimeType - The mime type of the output file.
|
|
319
|
+
* @returns A promise that resolves with the exported image or is rejected with an error.
|
|
320
|
+
*/
|
|
321
|
+
export(handle: DesignBlockId, mimeType?: MimeType_2): Promise<Blob>;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Loads existing blocks from the given string.
|
|
325
|
+
* The blocks are not attached by default and won't be visible until attached to a page or the scene.
|
|
326
|
+
* @param content - A string representing the given blocks.
|
|
327
|
+
* @returns A promise that resolves with a list of handles representing the found blocks or an error.
|
|
328
|
+
*/
|
|
329
|
+
loadFromString(content: string): Promise<DesignBlockId[]>;
|
|
330
|
+
/**
|
|
331
|
+
* Saves the given blocks into a string. If given the root of a block hierarchy, e.g. a
|
|
332
|
+
* page with multiple children, the entire hierarchy is saved.
|
|
333
|
+
* @param blocks - The blocks to save
|
|
334
|
+
* @returns A promise that resolves to a string representing the blocks or an error.
|
|
335
|
+
*/
|
|
336
|
+
saveToString(blocks: DesignBlockId[]): Promise<string>;
|
|
337
|
+
/**
|
|
338
|
+
* Create a new block, fails if type is unknown.
|
|
339
|
+
* @param type - The type of the block that shall be created.
|
|
340
|
+
* @returns The created blocks handle.
|
|
341
|
+
*/
|
|
342
|
+
create(type: DesignBlockType): DesignBlockId;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Get the type of the given block, fails if the block is invalid.
|
|
346
|
+
* @param id - The block to query.
|
|
347
|
+
* @returns The blocks type.
|
|
348
|
+
*/
|
|
349
|
+
getType(id: DesignBlockId): DesignBlockType;
|
|
350
|
+
/**
|
|
351
|
+
* Update the selection state of a block.
|
|
352
|
+
* Fails for invalid blocks.
|
|
353
|
+
* @param id - The block to query.
|
|
354
|
+
* @param selected - Whether or not the block should be selected.
|
|
355
|
+
*/
|
|
356
|
+
setSelected(id: DesignBlockId, selected: boolean): void;
|
|
357
|
+
/**
|
|
358
|
+
* Get the selected state of a block.
|
|
359
|
+
* @param id - The block to query.
|
|
360
|
+
* @returns True if the block is selected, false otherwise.
|
|
361
|
+
*/
|
|
362
|
+
isSelected(id: DesignBlockId): boolean;
|
|
363
|
+
/**
|
|
364
|
+
* Get all currently selected blocks.
|
|
365
|
+
* @returns An array of block ids.
|
|
366
|
+
*/
|
|
367
|
+
findAllSelected(): DesignBlockId[];
|
|
368
|
+
/**
|
|
369
|
+
* Confirms that a given set of blocks can be grouped together.
|
|
370
|
+
* @param ids - A non-empty array of block ids.
|
|
371
|
+
* @returns Whether the blocks can be grouped together.
|
|
372
|
+
*/
|
|
373
|
+
isGroupable(ids: DesignBlockId[]): boolean;
|
|
374
|
+
/**
|
|
375
|
+
* Group blocks together.
|
|
376
|
+
* @param ids - A non-empty array of block ids.
|
|
377
|
+
* @returns The block id of the created group.
|
|
378
|
+
*/
|
|
379
|
+
group(ids: DesignBlockId[]): DesignBlockId;
|
|
380
|
+
/**
|
|
381
|
+
* Ungroups a group.
|
|
382
|
+
* @param id - The group id from a previous call to `group`.
|
|
383
|
+
*/
|
|
384
|
+
ungroup(id: DesignBlockId): void;
|
|
385
|
+
/**
|
|
386
|
+
* Changes selection from selected group to a block within that group.
|
|
387
|
+
* Nothing happens if `group` is not a group.
|
|
388
|
+
* @param id - The group id from a previous call to `group`.
|
|
389
|
+
*/
|
|
390
|
+
enterGroup(id: DesignBlockId): void;
|
|
391
|
+
/**
|
|
392
|
+
* Changes selection from a group's selected block to that group.
|
|
393
|
+
* Nothing happens if the `id` is not part of a group.
|
|
394
|
+
* @param id - A block id.
|
|
395
|
+
*/
|
|
396
|
+
exitGroup(id: DesignBlockId): void;
|
|
397
|
+
/**
|
|
398
|
+
* Update a block's name.
|
|
399
|
+
* @param id - The block to update.
|
|
400
|
+
* @param name - The name to set.
|
|
401
|
+
*/
|
|
402
|
+
setName(id: DesignBlockId, name: string): void;
|
|
403
|
+
/**
|
|
404
|
+
* Get a block's name.
|
|
405
|
+
* @param id - The block to update.
|
|
406
|
+
*/
|
|
407
|
+
getName(id: DesignBlockId): string;
|
|
408
|
+
/**
|
|
409
|
+
* Finds all blocks with the given name.
|
|
410
|
+
* @param name - The name to search for.
|
|
411
|
+
* @returns A list of block ids.
|
|
412
|
+
*/
|
|
413
|
+
findByName(name: string): DesignBlockId[];
|
|
414
|
+
/**
|
|
415
|
+
* Finds all blocks with the given type.
|
|
416
|
+
* @param type - The type to search for.
|
|
417
|
+
* @returns A list of block ids.
|
|
418
|
+
*/
|
|
419
|
+
findByType(type: DesignBlockType): DesignBlockId[];
|
|
420
|
+
/**
|
|
421
|
+
* Return all blocks currently known to the engine.
|
|
422
|
+
* @returns A list of block ids.
|
|
423
|
+
*/
|
|
424
|
+
findAll(): DesignBlockId[];
|
|
425
|
+
/**
|
|
426
|
+
* Return all placeholder blocks in the current scene.
|
|
427
|
+
* @returns A list of block ids.
|
|
428
|
+
*/
|
|
429
|
+
findAllPlaceholders(): DesignBlockId[];
|
|
430
|
+
/**
|
|
431
|
+
* Query a block's visibility.
|
|
432
|
+
* @param id - The block to query.
|
|
433
|
+
* @returns True if visible, false otherwise.
|
|
434
|
+
*/
|
|
435
|
+
isVisible(id: DesignBlockId): boolean;
|
|
436
|
+
/**
|
|
437
|
+
* Update a block's visibility.
|
|
438
|
+
* @param id - The block to update.
|
|
439
|
+
* @param visible - Whether the block shall be visible.
|
|
440
|
+
*/
|
|
441
|
+
setVisible(id: DesignBlockId, visible: boolean): void;
|
|
442
|
+
/**
|
|
443
|
+
* Query a block's clipped state. If true, the block should clip
|
|
444
|
+
* its contents to its frame.
|
|
445
|
+
* @param id - The block to query.
|
|
446
|
+
* @returns True if clipped, false otherwise.
|
|
447
|
+
*/
|
|
448
|
+
isClipped(id: DesignBlockId): boolean;
|
|
449
|
+
/**
|
|
450
|
+
* Update a block's clipped state.
|
|
451
|
+
* @param id - The block to update.
|
|
452
|
+
* @param clipped - Whether the block should clips its contents to its frame.
|
|
453
|
+
*/
|
|
454
|
+
setClipped(id: DesignBlockId, clipped: boolean): void;
|
|
455
|
+
/**
|
|
456
|
+
* Query a block's x position.
|
|
457
|
+
* @param id - The block to query.
|
|
458
|
+
* @returns The value of the x position.
|
|
459
|
+
*/
|
|
460
|
+
getPositionX(id: DesignBlockId): number;
|
|
461
|
+
/**
|
|
462
|
+
* Query a block's mode for its x position.
|
|
463
|
+
* @param id - The block to query.
|
|
464
|
+
* @returns The current mode for the x position: absolute, percent or undefined.
|
|
465
|
+
*/
|
|
466
|
+
getPositionXMode(id: DesignBlockId): PositionMode;
|
|
467
|
+
/**
|
|
468
|
+
* Query a block's y position.
|
|
469
|
+
* @param id - The block to query.
|
|
470
|
+
* @returns The value of the y position.
|
|
471
|
+
*/
|
|
472
|
+
getPositionY(id: DesignBlockId): number;
|
|
473
|
+
/**
|
|
474
|
+
* Query a block's mode for its y position.
|
|
475
|
+
* @param id - The block to query.
|
|
476
|
+
* @returns The current mode for the y position: absolute, percent or undefined.
|
|
477
|
+
*/
|
|
478
|
+
getPositionYMode(id: DesignBlockId): PositionMode;
|
|
479
|
+
/**
|
|
480
|
+
* Update a block's x position.
|
|
481
|
+
* The position refers to the block's local space, relative to its parent with the origin at the top left.
|
|
482
|
+
* @param id - The block to update.
|
|
483
|
+
* @param value - The value of the x position.
|
|
484
|
+
*/
|
|
485
|
+
setPositionX(id: DesignBlockId, value: number): void;
|
|
486
|
+
/**
|
|
487
|
+
* Set a block's mode for its x position.
|
|
488
|
+
* @param id - The block to update.
|
|
489
|
+
* @param mode - The x position mode: absolute, percent or undefined.
|
|
490
|
+
*/
|
|
491
|
+
setPositionXMode(id: DesignBlockId, mode: PositionMode): void;
|
|
492
|
+
/**
|
|
493
|
+
* Update a block's y position.
|
|
494
|
+
* The position refers to the block's local space, relative to its parent with the origin at the top left.
|
|
495
|
+
* @param id - The block to update.
|
|
496
|
+
* @param value - The value of the y position.
|
|
497
|
+
*/
|
|
498
|
+
setPositionY(id: DesignBlockId, value: number): void;
|
|
499
|
+
/**
|
|
500
|
+
* Set a block's mode for its y position.
|
|
501
|
+
* @param id - The block to update.
|
|
502
|
+
* @param mode - The y position mode: absolute, percent or undefined.
|
|
503
|
+
*/
|
|
504
|
+
setPositionYMode(id: DesignBlockId, mode: PositionMode): void;
|
|
505
|
+
/**
|
|
506
|
+
* Query a block's rotation in radians.
|
|
507
|
+
* @param id - The block to query.
|
|
508
|
+
* @returns The block's rotation around its center in radians.
|
|
509
|
+
*/
|
|
510
|
+
getRotation(id: DesignBlockId): number;
|
|
511
|
+
/**
|
|
512
|
+
* Update a block's rotation.
|
|
513
|
+
* @param id - The block to update.
|
|
514
|
+
* @param radians - The new rotation in radians. Rotation is applied around the block's center.
|
|
515
|
+
*/
|
|
516
|
+
setRotation(id: DesignBlockId, radians: number): void;
|
|
517
|
+
/**
|
|
518
|
+
* Query a block's horizontal flip state.
|
|
519
|
+
* @param id - The block to query.
|
|
520
|
+
* @returns A boolean indicating for whether the block is flipped in the queried direction
|
|
521
|
+
*/
|
|
522
|
+
getFlipHorizontal(id: DesignBlockId): boolean;
|
|
523
|
+
/**
|
|
524
|
+
* Query a block's vertical flip state.
|
|
525
|
+
* @param id - The block to query.
|
|
526
|
+
* @returns A boolean indicating for whether the block is flipped in the queried direction
|
|
527
|
+
*/
|
|
528
|
+
getFlipVertical(id: DesignBlockId): boolean;
|
|
529
|
+
/**
|
|
530
|
+
* Update a block's horizontal flip.
|
|
531
|
+
* @param id - The block to update.
|
|
532
|
+
* @param flip - If the flip should be enabled.
|
|
533
|
+
*/
|
|
534
|
+
setFlipHorizontal(id: DesignBlockId, flip: boolean): void;
|
|
535
|
+
/**
|
|
536
|
+
* Update a block's vertical flip.
|
|
537
|
+
* @param id - The block to update.
|
|
538
|
+
* @param flip - If the flip should be enabled.
|
|
539
|
+
*/
|
|
540
|
+
setFlipVertical(id: DesignBlockId, flip: boolean): void;
|
|
541
|
+
/**
|
|
542
|
+
* Query if the given block has a content fill mode.
|
|
543
|
+
* @param id - The block to query.
|
|
544
|
+
* @returns true, if the block has a content fill mode.
|
|
545
|
+
*/
|
|
546
|
+
hasContentFillMode(id: DesignBlockId): boolean;
|
|
547
|
+
/**
|
|
548
|
+
* Query if the given block shows placeholder content.
|
|
549
|
+
* @param id - The block to query.
|
|
550
|
+
* @returns true, if the block shows placeholder content.
|
|
551
|
+
*/
|
|
552
|
+
hasPlaceholderContent(id: DesignBlockId): boolean;
|
|
553
|
+
/**
|
|
554
|
+
* Query a block's width.
|
|
555
|
+
* @param id - The block to query.
|
|
556
|
+
* @returns The value of the block's width.
|
|
557
|
+
*/
|
|
558
|
+
getWidth(id: DesignBlockId): number;
|
|
559
|
+
/**
|
|
560
|
+
* Query a block's mode for its width.
|
|
561
|
+
* @param id - The block to query.
|
|
562
|
+
* @returns The current mode for the width: absolute, percent or auto.
|
|
563
|
+
*/
|
|
564
|
+
getWidthMode(id: DesignBlockId): SizeMode;
|
|
565
|
+
/**
|
|
566
|
+
* Query a block's height.
|
|
567
|
+
* @param id - The block to query.
|
|
568
|
+
* @returns The value of the block's height.
|
|
569
|
+
*/
|
|
570
|
+
getHeight(id: DesignBlockId): number;
|
|
571
|
+
/**
|
|
572
|
+
* Query a block's mode for its height.
|
|
573
|
+
* @param id - The block to query.
|
|
574
|
+
* @returns The current mode for the height: absolute, percent or auto.
|
|
575
|
+
*/
|
|
576
|
+
getHeightMode(id: DesignBlockId): SizeMode;
|
|
577
|
+
/**
|
|
578
|
+
* Query a block's content fill mode.
|
|
579
|
+
* @param id - The block to query.
|
|
580
|
+
* @returns The current mode: crop, cover or contain.
|
|
581
|
+
*/
|
|
582
|
+
getContentFillMode(id: DesignBlockId): ContentFillMode;
|
|
583
|
+
/**
|
|
584
|
+
* Update a block's width.
|
|
585
|
+
* @param id - The block to update.
|
|
586
|
+
* @param value - The new width of the block.
|
|
587
|
+
*/
|
|
588
|
+
setWidth(id: DesignBlockId, value: number): void;
|
|
589
|
+
/**
|
|
590
|
+
* Set a block's mode for its width.
|
|
591
|
+
* @param id - The block to update.
|
|
592
|
+
* @param mode - The width mode: absolute, percent or auto.
|
|
593
|
+
*/
|
|
594
|
+
setWidthMode(id: DesignBlockId, mode: SizeMode): void;
|
|
595
|
+
/**
|
|
596
|
+
* Update a block's height.
|
|
597
|
+
* @param id - The block to update.
|
|
598
|
+
* @param value - The new height of the block.
|
|
599
|
+
*/
|
|
600
|
+
setHeight(id: DesignBlockId, value: number): void;
|
|
601
|
+
/**
|
|
602
|
+
* Set a block's mode for its height.
|
|
603
|
+
* @param id - The block to update.
|
|
604
|
+
* @param mode - The height mode: absolute, percent or auto.
|
|
605
|
+
*/
|
|
606
|
+
setHeightMode(id: DesignBlockId, mode: SizeMode): void;
|
|
607
|
+
/**
|
|
608
|
+
* Set a block's content fill mode.
|
|
609
|
+
* @param id - The block to update.
|
|
610
|
+
* @param mode - The content fill mode mode: crop, cover or contain.
|
|
611
|
+
*/
|
|
612
|
+
setContentFillMode(id: DesignBlockId, mode: ContentFillMode): void;
|
|
613
|
+
/**
|
|
614
|
+
* Get a block's layout width. The layout width is only available after an
|
|
615
|
+
* internal update loop, which may not happen immediately.
|
|
616
|
+
* @param id - The block to query.
|
|
617
|
+
* @returns The layout width.
|
|
618
|
+
*/
|
|
619
|
+
getFrameWidth(id: DesignBlockId): number;
|
|
620
|
+
/**
|
|
621
|
+
* Get a block's layout height. The layout height is only available after an
|
|
622
|
+
* internal update loop, which may not happen immediately.
|
|
623
|
+
* @param id - The block to query.
|
|
624
|
+
* @returns The layout height.
|
|
625
|
+
*/
|
|
626
|
+
getFrameHeight(id: DesignBlockId): number;
|
|
627
|
+
/**
|
|
628
|
+
* Duplicates a block including its children.
|
|
629
|
+
* @param id - The block to duplicate.
|
|
630
|
+
* @returns The handle of the duplicate.
|
|
631
|
+
*/
|
|
632
|
+
duplicate(id: DesignBlockId): DesignBlockId;
|
|
633
|
+
/**
|
|
634
|
+
* Destroys a block.
|
|
635
|
+
* @param id - The block to destroy.
|
|
636
|
+
*/
|
|
637
|
+
destroy(id: DesignBlockId): void;
|
|
638
|
+
/**
|
|
639
|
+
* Check if a block is valid. A block becomes invalid once it has been destroyed.
|
|
640
|
+
* @param id - The block to query.
|
|
641
|
+
* @returns True, if the block is valid.
|
|
642
|
+
*/
|
|
643
|
+
isValid(id: DesignBlockId): boolean;
|
|
644
|
+
/**
|
|
645
|
+
* Query a block's parent.
|
|
646
|
+
* @param id - The block to query.
|
|
647
|
+
* @returns The parent's handle or null if the block has no parent.
|
|
648
|
+
*/
|
|
649
|
+
getParent(id: DesignBlockId): DesignBlockId | null;
|
|
650
|
+
/**
|
|
651
|
+
* Get all children of the given block. Children
|
|
652
|
+
* are sorted in their rendering order: Last child is rendered
|
|
653
|
+
* in front of other children.
|
|
654
|
+
* @param id - The block to query.
|
|
655
|
+
* @returns A list of block ids.
|
|
656
|
+
*/
|
|
657
|
+
getChildren(id: DesignBlockId): DesignBlockId[];
|
|
658
|
+
/**
|
|
659
|
+
* Insert a new or existing child at a certain position in the parent's children.
|
|
660
|
+
* @param parent - The block whose children should be updated.
|
|
661
|
+
* @param child - The child to insert. Can be an existing child of `parent`.
|
|
662
|
+
* @param index - The index to insert or move to.
|
|
663
|
+
*/
|
|
664
|
+
insertChild(parent: DesignBlockId, child: DesignBlockId, index: number): void;
|
|
665
|
+
/**
|
|
666
|
+
* Appends a new or existing child to a block's children.
|
|
667
|
+
* @param parent - The block whose children should be updated.
|
|
668
|
+
* @param child - The child to insert. Can be an existing child of `parent`.
|
|
669
|
+
*/
|
|
670
|
+
appendChild(parent: DesignBlockId, child: DesignBlockId): void;
|
|
671
|
+
/** Checks whether the given block references any variables. Doesn't check the block's children.
|
|
672
|
+
*
|
|
673
|
+
* @param id - The block to inspect.
|
|
674
|
+
* @returns true if the block references variables and false otherwise.
|
|
675
|
+
*/
|
|
676
|
+
referencesAnyVariables(id: DesignBlockId): boolean;
|
|
677
|
+
/**
|
|
678
|
+
* Get the x position of the block's axis-aligned bounding box in the scene's global coordinate space.
|
|
679
|
+
* The scene's global coordinate space has its origin at the top left.
|
|
680
|
+
* @param id - The block whose bounding box should be calculated.
|
|
681
|
+
* @returns float The x coordinate of the position of the axis-aligned bounding box.
|
|
682
|
+
*/
|
|
683
|
+
getGlobalBoundingBoxX(id: DesignBlockId): number;
|
|
684
|
+
/**
|
|
685
|
+
* Get the y position of the block's axis-aligned bounding box in the scene's global coordinate space.
|
|
686
|
+
* The scene's global coordinate space has its origin at the top left.
|
|
687
|
+
* @param id - The block whose bounding box should be calculated.
|
|
688
|
+
* @returns float The y coordinate of the position of the axis-aligned bounding box.
|
|
689
|
+
*/
|
|
690
|
+
getGlobalBoundingBoxY(id: DesignBlockId): number;
|
|
691
|
+
/**
|
|
692
|
+
* Get the width of the block's axis-aligned bounding box in the scene's global coordinate space.
|
|
693
|
+
* The scene's global coordinate space has its origin at the top left.
|
|
694
|
+
* @param id - The block whose bounding box should be calculated.
|
|
695
|
+
* @returns float The width of the axis-aligned bounding box.
|
|
696
|
+
*/
|
|
697
|
+
getGlobalBoundingBoxWidth(id: DesignBlockId): number;
|
|
698
|
+
/**
|
|
699
|
+
* Get the height of the block's axis-aligned bounding box in the scene's global coordinate space.
|
|
700
|
+
* The scene's global coordinate space has its origin at the top left.
|
|
701
|
+
* @param id - The block whose bounding box should be calculated.
|
|
702
|
+
* @returns float The height of the axis-aligned bounding box.
|
|
703
|
+
*/
|
|
704
|
+
getGlobalBoundingBoxHeight(id: DesignBlockId): number;
|
|
705
|
+
/**
|
|
706
|
+
* Scales the block and all of its children proportionally around the specified
|
|
707
|
+
* relative anchor point.
|
|
708
|
+
*
|
|
709
|
+
* This updates the position, size and style properties (e.g. stroke width) of
|
|
710
|
+
* the block and its children.
|
|
711
|
+
*
|
|
712
|
+
* @param id - The block that should be scaled.
|
|
713
|
+
* @param scale - The scale factor to be applied to the current properties of the block.
|
|
714
|
+
* @param anchorX - The relative position along the width of the block around which the
|
|
715
|
+
* scaling should occur. (0 = left edge, 0.5 = center, 1 = right edge)
|
|
716
|
+
* @param anchorY - The relative position along the height of the block around which the
|
|
717
|
+
* scaling should occur. (0 = top edge, 0.5 = center, 1 = bottom edge)
|
|
718
|
+
*/
|
|
719
|
+
scale(id: DesignBlockId, scale: number, anchorX?: number, anchorY?: number): void;
|
|
720
|
+
/**
|
|
721
|
+
* Get all available properties of a block.
|
|
722
|
+
* @param id - The block whose properties should be queried.
|
|
723
|
+
* @returns A list of the property names.
|
|
724
|
+
*/
|
|
725
|
+
findAllProperties(id: DesignBlockId): string[];
|
|
726
|
+
/**
|
|
727
|
+
* Get the type of a property given its name.
|
|
728
|
+
* @param property - The name of the property whose type should be queried.
|
|
729
|
+
* @returns The property type.
|
|
730
|
+
*/
|
|
731
|
+
getPropertyType(property: string): PropertyType;
|
|
732
|
+
/**
|
|
733
|
+
* Get all the possible values of an enum given an enum property.
|
|
734
|
+
* @param enumProperty - The name of the property whose enum values should be queried.
|
|
735
|
+
* @returns A list of the enum value names as string.
|
|
736
|
+
*/
|
|
737
|
+
getEnumValues<T = string>(enumProperty: string): T[];
|
|
738
|
+
/**
|
|
739
|
+
* Set a bool property of the given design block to the given value.
|
|
740
|
+
* @param id - The block whose property should be set.
|
|
741
|
+
* @param property - The name of the property to set.
|
|
742
|
+
* @param value - The value to set.
|
|
743
|
+
*/
|
|
744
|
+
setBool(id: DesignBlockId, property: string, value: boolean): void;
|
|
745
|
+
/**
|
|
746
|
+
* Get the value of a bool property of the given design block.
|
|
747
|
+
* @param id - The block whose property should be queried.
|
|
748
|
+
* @param property - The name of the property to query.
|
|
749
|
+
* @returns The value of the property.
|
|
750
|
+
*/
|
|
751
|
+
getBool(id: DesignBlockId, property: string): boolean;
|
|
752
|
+
/**
|
|
753
|
+
* Set an int property of the given design block to the given value.
|
|
754
|
+
* @param id - The block whose property should be set.
|
|
755
|
+
* @param property - The name of the property to set.
|
|
756
|
+
* @param value - The value to set.
|
|
757
|
+
*/
|
|
758
|
+
setInt(id: DesignBlockId, property: string, value: number): void;
|
|
759
|
+
/**
|
|
760
|
+
* Get the value of an int property of the given design block.
|
|
761
|
+
* @param id - The block whose property should be queried.
|
|
762
|
+
* @param property - The name of the property to query.
|
|
763
|
+
* @returns The value of the property.
|
|
764
|
+
*/
|
|
765
|
+
getInt(id: DesignBlockId, property: string): number;
|
|
766
|
+
/**
|
|
767
|
+
* Set a float property of the given design block to the given value.
|
|
768
|
+
* @param id - The block whose property should be set.
|
|
769
|
+
* @param property - The name of the property to set.
|
|
770
|
+
* @param value - The value to set.
|
|
771
|
+
*/
|
|
772
|
+
setFloat(id: DesignBlockId, property: string, value: number): void;
|
|
773
|
+
/**
|
|
774
|
+
* Get the value of a float property of the given design block.
|
|
775
|
+
* @param id - The block whose property should be queried.
|
|
776
|
+
* @param property - The name of the property to query.
|
|
777
|
+
* @returns The value of the property.
|
|
778
|
+
*/
|
|
779
|
+
getFloat(id: DesignBlockId, property: string): number;
|
|
780
|
+
/**
|
|
781
|
+
* Set a string property of the given design block to the given value.
|
|
782
|
+
* @param id - The block whose property should be set.
|
|
783
|
+
* @param property - The name of the property to set.
|
|
784
|
+
* @param value - The value to set.
|
|
785
|
+
*/
|
|
786
|
+
setString(id: DesignBlockId, property: string, value: string): void;
|
|
787
|
+
/**
|
|
788
|
+
* Get the value of a string property of the given design block.
|
|
789
|
+
* @param id - The block whose property should be queried.
|
|
790
|
+
* @param property - The name of the property to query.
|
|
791
|
+
* @returns The value of the property.
|
|
792
|
+
*/
|
|
793
|
+
getString(id: DesignBlockId, property: string): string;
|
|
794
|
+
/**
|
|
795
|
+
* Set a color property of the given design block to the given value.
|
|
796
|
+
* @param id - The block whose property should be set.
|
|
797
|
+
* @param property - The name of the property to set.
|
|
798
|
+
* @param r - The red color component in the range of 0 to 1.
|
|
799
|
+
* @param g - The green color component in the range of 0 to 1.
|
|
800
|
+
* @param b - The blue color component in the range of 0 to 1.
|
|
801
|
+
* @param a - The alpha color component in the range of 0 to 1.
|
|
802
|
+
*/
|
|
803
|
+
setColorRGBA(id: DesignBlockId, property: string, r: number, g: number, b: number, a?: number): void;
|
|
804
|
+
/**
|
|
805
|
+
* Get the value of a string property of the given design block.
|
|
806
|
+
* @param id - The block whose property should be queried.
|
|
807
|
+
* @param property - The name of the property to query.
|
|
808
|
+
* @returns A tuple of channels red, green, blue and alpha in the range of 0 to 1.
|
|
809
|
+
*/
|
|
810
|
+
getColorRGBA(id: DesignBlockId, property: string): RGBA;
|
|
811
|
+
/**
|
|
812
|
+
* Set an enum property of the given design block to the given value.
|
|
813
|
+
* @param id - The block whose property should be set.
|
|
814
|
+
* @param property - The name of the property to set.
|
|
815
|
+
* @param value - The enum value as string.
|
|
816
|
+
*/
|
|
817
|
+
setEnum(id: DesignBlockId, property: string, value: string): void;
|
|
818
|
+
/**
|
|
819
|
+
* Get the value of an enum property of the given design block.
|
|
820
|
+
* @param id - The block whose property should be queried.
|
|
821
|
+
* @param property - The name of the property to query.
|
|
822
|
+
* @returns The value as string.
|
|
823
|
+
*/
|
|
824
|
+
getEnum(id: DesignBlockId, property: string): string;
|
|
825
|
+
/**
|
|
826
|
+
* Query if the given block has crop properties.
|
|
827
|
+
* @param id - The block to query.
|
|
828
|
+
* @returns true, if the block has crop properties.
|
|
829
|
+
*/
|
|
830
|
+
hasCrop(id: DesignBlockId): boolean;
|
|
831
|
+
/**
|
|
832
|
+
* Set the crop scale in x direction of the given design block.
|
|
833
|
+
* @param id - The block whose crop should be set.
|
|
834
|
+
* @param scaleX - The scale in x direction.
|
|
835
|
+
*/
|
|
836
|
+
setCropScaleX(id: DesignBlockId, scaleX: number): void;
|
|
837
|
+
/**
|
|
838
|
+
* Set the crop scale in y direction of the given design block.
|
|
839
|
+
* @param id - The block whose crop should be set.
|
|
840
|
+
* @param scaleY - The scale in y direction.
|
|
841
|
+
*/
|
|
842
|
+
setCropScaleY(id: DesignBlockId, scaleY: number): void;
|
|
843
|
+
/**
|
|
844
|
+
* Set the crop rotation of the given design block.
|
|
845
|
+
* @param id - The block whose crop should be set.
|
|
846
|
+
* @param rotation - The rotation in radians.
|
|
847
|
+
*/
|
|
848
|
+
setCropRotation(id: DesignBlockId, rotation: number): void;
|
|
849
|
+
/**
|
|
850
|
+
* Set the crop translation in x direction of the given design block.
|
|
851
|
+
* @param id - The block whose crop should be set.
|
|
852
|
+
* @param translationY - The translation in y direction.
|
|
853
|
+
*/
|
|
854
|
+
setCropTranslationX(id: DesignBlockId, translationX: number): void;
|
|
855
|
+
/**
|
|
856
|
+
* Set the crop translation in y direction of the given design block.
|
|
857
|
+
* @param id - The block whose crop should be set.
|
|
858
|
+
* @param translationY - The translation in y direction.
|
|
859
|
+
*/
|
|
860
|
+
setCropTranslationY(id: DesignBlockId, translationY: number): void;
|
|
861
|
+
/**
|
|
862
|
+
* Resets the manually set crop of the given design block.
|
|
863
|
+
* The block's content fill mode is set to 'cover'.
|
|
864
|
+
* @param id - The block whose crop should be reset.
|
|
865
|
+
*/
|
|
866
|
+
resetCrop(id: DesignBlockId): void;
|
|
867
|
+
/**
|
|
868
|
+
* Get the crop scale on the x axis of the given design block.
|
|
869
|
+
* @param id - The block whose scale should be queried.
|
|
870
|
+
* @returns The scale on the x axis.
|
|
871
|
+
*/
|
|
872
|
+
getCropScaleX(id: DesignBlockId): number;
|
|
873
|
+
/**
|
|
874
|
+
* Get the crop scale on the y axis of the given design block.
|
|
875
|
+
* @param id - The block whose scale should be queried.
|
|
876
|
+
* @returns The scale on the y axis.
|
|
877
|
+
*/
|
|
878
|
+
getCropScaleY(id: DesignBlockId): number;
|
|
879
|
+
/**
|
|
880
|
+
* Get the crop rotation of the given design block.
|
|
881
|
+
* @param id - The block whose crop rotation should be queried.
|
|
882
|
+
* @returns The crop rotation.
|
|
883
|
+
*/
|
|
884
|
+
getCropRotation(id: DesignBlockId): number;
|
|
885
|
+
/**
|
|
886
|
+
* Get the crop translation on the x axis of the given design block.
|
|
887
|
+
* @param id - The block whose translation should be queried.
|
|
888
|
+
* @returns The translation on the x axis.
|
|
889
|
+
*/
|
|
890
|
+
getCropTranslationX(id: DesignBlockId): number;
|
|
891
|
+
/**
|
|
892
|
+
* Get the crop translation on the y axis of the given design block.
|
|
893
|
+
* @param id - The block whose translation should be queried.
|
|
894
|
+
* @returns The translation on the y axis.
|
|
895
|
+
*/
|
|
896
|
+
getCropTranslationY(id: DesignBlockId): number;
|
|
897
|
+
/**
|
|
898
|
+
* Query if the given block has an opacity.
|
|
899
|
+
* @param id - The block to query.
|
|
900
|
+
* @returns true, if the block has an opacity.
|
|
901
|
+
*/
|
|
902
|
+
hasOpacity(id: DesignBlockId): boolean;
|
|
903
|
+
/**
|
|
904
|
+
* Set the opacity of the given design block.
|
|
905
|
+
* @param id - The block whose opacity should be set.
|
|
906
|
+
* @param opacity - The opacity to be set. The valid range is 0 to 1.
|
|
907
|
+
*/
|
|
908
|
+
setOpacity(id: DesignBlockId, opacity: number): void;
|
|
909
|
+
/**
|
|
910
|
+
* Get the opacity of the given design block.
|
|
911
|
+
* @param id - The block whose opacity should be queried.
|
|
912
|
+
* @returns The opacity.
|
|
913
|
+
*/
|
|
914
|
+
getOpacity(id: DesignBlockId): number;
|
|
915
|
+
/**
|
|
916
|
+
* Query if the given block has a blend mode.
|
|
917
|
+
* @param id - The block to query.
|
|
918
|
+
* @returns true, if the block has a blend mode.
|
|
919
|
+
*/
|
|
920
|
+
hasBlendMode(id: DesignBlockId): boolean;
|
|
921
|
+
/**
|
|
922
|
+
* Set the blend mode of the given design block.
|
|
923
|
+
* @param id - The block whose blend mode should be set.
|
|
924
|
+
* @param blendMode - The blend mode to be set.
|
|
925
|
+
* @returns
|
|
926
|
+
*/
|
|
927
|
+
setBlendMode(id: DesignBlockId, blendMode: BlendMode): void;
|
|
928
|
+
/**
|
|
929
|
+
* Get the blend mode of the given design block.
|
|
930
|
+
* @param id - The block whose blend mode should be queried.
|
|
931
|
+
* @returns The blend mode.
|
|
932
|
+
*/
|
|
933
|
+
getBlendMode(id: DesignBlockId): BlendMode;
|
|
934
|
+
/**
|
|
935
|
+
* Query if the given block has fill color properties.
|
|
936
|
+
* @param id - The block to query.
|
|
937
|
+
* @returns true, if the block has fill color properties.
|
|
938
|
+
*/
|
|
939
|
+
hasFillColor(id: DesignBlockId): boolean;
|
|
940
|
+
/**
|
|
941
|
+
* Set the fill color of the given design block.
|
|
942
|
+
* @param id - The block whose fill color should be set.
|
|
943
|
+
* @param color - The fill color to be set, a tuple of
|
|
944
|
+
* @param r - The red color component in the range of 0 to 1.
|
|
945
|
+
* @param g - The green color component in the range of 0 to 1.
|
|
946
|
+
* @param b - The blue color component in the range of 0 to 1.
|
|
947
|
+
* @param a - The alpha color component in the range of 0 to 1.
|
|
948
|
+
*/
|
|
949
|
+
setFillColorRGBA(id: DesignBlockId, r: number, g: number, b: number, a?: number): void;
|
|
950
|
+
/**
|
|
951
|
+
* Get the fill color of the given design block.
|
|
952
|
+
* @param id - The block whose fill color should be queried.
|
|
953
|
+
* @returns The fill color.
|
|
954
|
+
*/
|
|
955
|
+
getFillColorRGBA(id: DesignBlockId): RGBA;
|
|
956
|
+
/**
|
|
957
|
+
* Enable or disable the fill of the given design block.
|
|
958
|
+
* @param id - The block whose fill should be enabled or disabled.
|
|
959
|
+
* @param enabled - If true, the fill will be enabled.
|
|
960
|
+
*/
|
|
961
|
+
setFillColorEnabled(id: DesignBlockId, enabled: boolean): void;
|
|
962
|
+
/**
|
|
963
|
+
* Query if the fill of the given design block is enabled.
|
|
964
|
+
* @param id - The block whose fill state should be queried.
|
|
965
|
+
* @returns True, if fill is enabled.
|
|
966
|
+
*/
|
|
967
|
+
isFillColorEnabled(id: DesignBlockId): boolean;
|
|
968
|
+
/**
|
|
969
|
+
* Query if the given block has background color properties.
|
|
970
|
+
* @param id - The block to query.
|
|
971
|
+
* @returns true, if the block has background color properties.
|
|
972
|
+
*/
|
|
973
|
+
hasBackgroundColor(id: DesignBlockId): boolean;
|
|
974
|
+
/**
|
|
975
|
+
* Set the background color of the given design block.
|
|
976
|
+
* @param id - The block whose background color should be set.
|
|
977
|
+
* @param color - The background color to be set, a tuple of
|
|
978
|
+
* @param r - The red color component in the range of 0 to 1.
|
|
979
|
+
* @param g - The green color component in the range of 0 to 1.
|
|
980
|
+
* @param b - The blue color component in the range of 0 to 1.
|
|
981
|
+
* @param a - The alpha color component in the range of 0 to 1.
|
|
982
|
+
*/
|
|
983
|
+
setBackgroundColorRGBA(id: DesignBlockId, r: number, g: number, b: number, a?: number): void;
|
|
984
|
+
/**
|
|
985
|
+
* Get the background color of the given design block.
|
|
986
|
+
* @param id - The block whose background color should be queried.
|
|
987
|
+
* @returns The background color.
|
|
988
|
+
*/
|
|
989
|
+
getBackgroundColorRGBA(id: DesignBlockId): RGBA;
|
|
990
|
+
/**
|
|
991
|
+
* Enable or disable the background of the given design block.
|
|
992
|
+
* @param id - The block whose background should be enabled or disabled.
|
|
993
|
+
* @param enabled - If true, the background will be enabled.
|
|
994
|
+
*/
|
|
995
|
+
setBackgroundColorEnabled(id: DesignBlockId, enabled: boolean): void;
|
|
996
|
+
/**
|
|
997
|
+
* Query if the background of the given design block is enabled.
|
|
998
|
+
* @param id - The block whose background state should be queried.
|
|
999
|
+
* @returns True, if background is enabled.
|
|
1000
|
+
*/
|
|
1001
|
+
isBackgroundColorEnabled(id: DesignBlockId): boolean;
|
|
1002
|
+
/**
|
|
1003
|
+
* Query if the given block has a stroke property.
|
|
1004
|
+
* @param id - The block to query.
|
|
1005
|
+
* @returns True if the block has a stroke property.
|
|
1006
|
+
*/
|
|
1007
|
+
hasStroke(id: DesignBlockId): boolean;
|
|
1008
|
+
/**
|
|
1009
|
+
* Enable or disable the stroke of the given design block.
|
|
1010
|
+
* @param id - The block whose stroke should be enabled or disabled.
|
|
1011
|
+
* @param enabled - If true, the stroke will be enabled.
|
|
1012
|
+
*/
|
|
1013
|
+
setStrokeEnabled(id: DesignBlockId, enabled: boolean): void;
|
|
1014
|
+
/**
|
|
1015
|
+
* Query if the stroke of the given design block is enabled.
|
|
1016
|
+
* @param id - The block whose stroke state should be queried.
|
|
1017
|
+
* @returns True if the block's stroke is enabled.
|
|
1018
|
+
*/
|
|
1019
|
+
isStrokeEnabled(id: DesignBlockId): boolean;
|
|
1020
|
+
/**
|
|
1021
|
+
* Set the stroke color of the given design block.
|
|
1022
|
+
* @param id - The block whose stroke color should be set.
|
|
1023
|
+
* @param r - The red color component in the range of 0 to 1.
|
|
1024
|
+
* @param g - The green color component in the range of 0 to 1.
|
|
1025
|
+
* @param b - The blue color component in the range of 0 to 1.
|
|
1026
|
+
* @param a - The alpha color component in the range of 0 to 1.
|
|
1027
|
+
*/
|
|
1028
|
+
setStrokeColorRGBA(id: DesignBlockId, r: number, g: number, b: number, a?: number): void;
|
|
1029
|
+
/**
|
|
1030
|
+
* Get the stroke color of the given design block.
|
|
1031
|
+
* @param id - The block whose background color should be queried.
|
|
1032
|
+
* @returns The background color.
|
|
1033
|
+
*/
|
|
1034
|
+
getStrokeColorRGBA(id: DesignBlockId): RGBA;
|
|
1035
|
+
/**
|
|
1036
|
+
* Set the stroke width of the given design block.
|
|
1037
|
+
* @param id - The block whose stroke width should be set.
|
|
1038
|
+
* @param width - The stroke width to be set.
|
|
1039
|
+
*/
|
|
1040
|
+
setStrokeWidth(id: DesignBlockId, width: number): void;
|
|
1041
|
+
/**
|
|
1042
|
+
* Get the stroke width of the given design block.
|
|
1043
|
+
* @param id - The block whose stroke width should be queried.
|
|
1044
|
+
* @returns The stroke's width.
|
|
1045
|
+
*/
|
|
1046
|
+
getStrokeWidth(id: DesignBlockId): number;
|
|
1047
|
+
/**
|
|
1048
|
+
* Set the stroke style of the given design block.
|
|
1049
|
+
* @param id - The block whose stroke style should be set.
|
|
1050
|
+
* @param style - The stroke style to be set.
|
|
1051
|
+
*/
|
|
1052
|
+
setStrokeStyle(id: DesignBlockId, style: StrokeStyle): void;
|
|
1053
|
+
/**
|
|
1054
|
+
* Get the stroke style of the given design block.
|
|
1055
|
+
* @param id - The block whose stroke style should be queried.
|
|
1056
|
+
* @returns The stroke's style.
|
|
1057
|
+
*/
|
|
1058
|
+
getStrokeStyle(id: DesignBlockId): StrokeStyle;
|
|
1059
|
+
/**
|
|
1060
|
+
* Set the stroke position of the given design block.
|
|
1061
|
+
* @param id - The block whose stroke position should be set.
|
|
1062
|
+
* @param position - The stroke position to be set.
|
|
1063
|
+
*/
|
|
1064
|
+
setStrokePosition(id: DesignBlockId, position: StrokePosition): void;
|
|
1065
|
+
/**
|
|
1066
|
+
* Get the stroke position of the given design block.
|
|
1067
|
+
* @param id - The block whose stroke position should be queried.
|
|
1068
|
+
* @returns The stroke position.
|
|
1069
|
+
*/
|
|
1070
|
+
getStrokePosition(id: DesignBlockId): StrokePosition;
|
|
1071
|
+
/**
|
|
1072
|
+
* Set the stroke corner geometry of the given design block.
|
|
1073
|
+
* @param id - The block whose stroke join geometry should be set.
|
|
1074
|
+
* @param cornerGeometry - The stroke join geometry to be set.
|
|
1075
|
+
*/
|
|
1076
|
+
setStrokeCornerGeometry(id: DesignBlockId, cornerGeometry: StrokeCornerGeometry): void;
|
|
1077
|
+
/**
|
|
1078
|
+
* Get the stroke corner geometry of the given design block.
|
|
1079
|
+
* @param id - The block whose stroke join geometry should be queried.
|
|
1080
|
+
* @returns The stroke join geometry.
|
|
1081
|
+
*/
|
|
1082
|
+
getStrokeCornerGeometry(id: DesignBlockId): StrokeCornerGeometry;
|
|
1083
|
+
/**
|
|
1084
|
+
* Query if the given block has outline properties.
|
|
1085
|
+
* @param id - The block to query.
|
|
1086
|
+
* @returns true, if the block has outline properties.
|
|
1087
|
+
* @deprecated Use `hasStroke`.
|
|
1088
|
+
*/
|
|
1089
|
+
hasOutline(id: DesignBlockId): boolean;
|
|
1090
|
+
/**
|
|
1091
|
+
* Set the outline color of the given design block.
|
|
1092
|
+
* @param id - The block whose outline color should be set.
|
|
1093
|
+
* @param color - The outline color to be set, a tuple of
|
|
1094
|
+
* @param r - The red color component in the range of 0 to 1.
|
|
1095
|
+
* @param g - The green color component in the range of 0 to 1.
|
|
1096
|
+
* @param b - The blue color component in the range of 0 to 1.
|
|
1097
|
+
* @param a - The alpha color component in the range of 0 to 1.
|
|
1098
|
+
* @deprecated Use `setStrokeColorRGBA`.
|
|
1099
|
+
*/
|
|
1100
|
+
setOutlineColorRGBA(id: DesignBlockId, r: number, g: number, b: number, a?: number): void;
|
|
1101
|
+
/**
|
|
1102
|
+
* Get the outline color of the given design block.
|
|
1103
|
+
* @param id - The block whose outline color should be queried.
|
|
1104
|
+
* @returns The outline color.
|
|
1105
|
+
* @deprecated Use `getStrokeColorRGBA`.
|
|
1106
|
+
*/
|
|
1107
|
+
getOutlineColorRGBA(id: DesignBlockId): RGBA;
|
|
1108
|
+
/**
|
|
1109
|
+
* Enable or disable the outline of the given design block.
|
|
1110
|
+
* @param id - The block whose outline should be enabled or disabled.
|
|
1111
|
+
* @param enabled - If true, the outline will be enabled.
|
|
1112
|
+
* @deprecated Use `setStrokeEnabled`.
|
|
1113
|
+
*/
|
|
1114
|
+
setOutlineEnabled(id: DesignBlockId, enabled: boolean): void;
|
|
1115
|
+
/**
|
|
1116
|
+
* Query if the outline of the given design block is enabled.
|
|
1117
|
+
* @param id - The block whose outline state should be queried.
|
|
1118
|
+
* @returns True, if outline is enabled.
|
|
1119
|
+
* @deprecated Use `isStrokeEnabled`.
|
|
1120
|
+
*/
|
|
1121
|
+
isOutlineEnabled(id: DesignBlockId): boolean;
|
|
1122
|
+
/**
|
|
1123
|
+
* Set the outline width of the given design block.
|
|
1124
|
+
* @param id - The block whose outline width should be set.
|
|
1125
|
+
* @param width - The outline width to be set.
|
|
1126
|
+
* @deprecated Use `setStrokeWidth`.
|
|
1127
|
+
*/
|
|
1128
|
+
setOutlineWidth(id: DesignBlockId, width: number): void;
|
|
1129
|
+
/**
|
|
1130
|
+
* Get the outline width of the given design block.
|
|
1131
|
+
* @param id - The block whose outline width should be queried.
|
|
1132
|
+
* @returns The outline width.
|
|
1133
|
+
* @deprecated Use the Stroke function
|
|
1134
|
+
* @deprecated Use `getStrokeWidth`.
|
|
1135
|
+
*/
|
|
1136
|
+
getOutlineWidth(id: DesignBlockId): number;
|
|
1137
|
+
/**
|
|
1138
|
+
* Query if the given block has fill color properties.
|
|
1139
|
+
* @param id - The block to query.
|
|
1140
|
+
* @returns true, if the block has fill color properties, an error otherwise.
|
|
1141
|
+
*/
|
|
1142
|
+
hasFill(id: DesignBlockId): boolean;
|
|
1143
|
+
/**
|
|
1144
|
+
* Query if the fill of the given design block is enabled.
|
|
1145
|
+
* @param id - The block whose fill state should be queried.
|
|
1146
|
+
* @returns A result holding the fill state or an error.
|
|
1147
|
+
*/
|
|
1148
|
+
isFillEnabled(id: DesignBlockId): boolean;
|
|
1149
|
+
/**
|
|
1150
|
+
* Enable or disable the fill of the given design block.
|
|
1151
|
+
* @param id - The block whose fill should be enabled or disabled.
|
|
1152
|
+
* @param enabled - If true, the fill will be enabled.
|
|
1153
|
+
* @returns An empty result on success, an error otherwise.
|
|
1154
|
+
*/
|
|
1155
|
+
setFillEnabled(id: DesignBlockId, enabled: boolean): void;
|
|
1156
|
+
/**
|
|
1157
|
+
* Set the fill type of the given design block.
|
|
1158
|
+
* @param id - The block whose fill type should be set.
|
|
1159
|
+
* @param type - The fill type to set.
|
|
1160
|
+
* @returns An empty result on success, an error otherwise.
|
|
1161
|
+
*/
|
|
1162
|
+
setFillType(id: DesignBlockId, fillType: FillType): void;
|
|
1163
|
+
/**
|
|
1164
|
+
* Get the fill type of the given design block.
|
|
1165
|
+
* @param id - The block whose fill type should be queried.
|
|
1166
|
+
* @returns The block's fill type or an error.
|
|
1167
|
+
*/
|
|
1168
|
+
getFillType(id: DesignBlockId): FillType;
|
|
1169
|
+
/**
|
|
1170
|
+
* Set the fill color of the given design block.
|
|
1171
|
+
* @param id - The block whose fill color should be set.
|
|
1172
|
+
* @param r - The red color component in the range of 0 to 1.
|
|
1173
|
+
* @param g - The green color component in the range of 0 to 1.
|
|
1174
|
+
* @param b - The blue color component in the range of 0 to 1.
|
|
1175
|
+
* @param a - The alpha color component in the range of 0 to 1.
|
|
1176
|
+
* @returns An empty result on success, an error otherwise.
|
|
1177
|
+
*/
|
|
1178
|
+
setFillSolidColor(id: DesignBlockId, r: number, g: number, b: number, a?: number): void;
|
|
1179
|
+
/**
|
|
1180
|
+
* Get the fill color of the given design block.
|
|
1181
|
+
* @param id - The block whose fill color should be queried.
|
|
1182
|
+
* @returns A result holding the fill color or an error.
|
|
1183
|
+
*/
|
|
1184
|
+
getFillSolidColor(id: DesignBlockId): RGBA;
|
|
1185
|
+
/**
|
|
1186
|
+
* Set the gradient type of the given design block.
|
|
1187
|
+
* @param id - The block whose gradient type should be set.
|
|
1188
|
+
* @param type - The gradient type.
|
|
1189
|
+
* @returns An empty result on success, an error otherwise.
|
|
1190
|
+
*/
|
|
1191
|
+
setFillGradientType(id: DesignBlockId, gradientType: GradientType): void;
|
|
1192
|
+
/**
|
|
1193
|
+
* Get the gradient type of the given design block.
|
|
1194
|
+
* @param id - The block whose gradient type should be queried.
|
|
1195
|
+
* @returns The gradient type.
|
|
1196
|
+
*/
|
|
1197
|
+
getFillGradientType(id: DesignBlockId): GradientType;
|
|
1198
|
+
/**
|
|
1199
|
+
* Add a gradient color stop on a design block.
|
|
1200
|
+
* @param id - The block on which a gradient color stop should be added.
|
|
1201
|
+
* @param stop - Where to add a color stop in the range 0 to 1.
|
|
1202
|
+
* @param r - The red color component in the range of 0 to 1.
|
|
1203
|
+
* @param g - The green color component in the range of 0 to 1.
|
|
1204
|
+
* @param b - The blue color component in the range of 0 to 1.
|
|
1205
|
+
* @param a - The alpha color component in the range of 0 to 1.
|
|
1206
|
+
* @returns An empty result on success, an error otherwise.
|
|
1207
|
+
*/
|
|
1208
|
+
addFillGradientColorStop(id: DesignBlockId, stop: number, r: number, g: number, b: number, a?: number): void;
|
|
1209
|
+
/**
|
|
1210
|
+
* Remove a previously gradient color stop on a design block.
|
|
1211
|
+
* @param id - The block from which to remove the gradient color stop.
|
|
1212
|
+
* @param stop - The stop's position.
|
|
1213
|
+
* @returns An empty result on success, an error otherwise.
|
|
1214
|
+
*/
|
|
1215
|
+
removeFillGradientColorStop(id: DesignBlockId, stop: number): void;
|
|
1216
|
+
/**
|
|
1217
|
+
* Get the gradient fill color stops of the given design block.
|
|
1218
|
+
* @param id - The block whose gradient color stop should be queried.
|
|
1219
|
+
* @returns All of the design block's gradient color stops.
|
|
1220
|
+
*/
|
|
1221
|
+
getFillGradientColorStops(id: DesignBlockId): GradientstopRGBA[];
|
|
1222
|
+
/**
|
|
1223
|
+
* Set the gradient fill color stops of the given design block, overwriting previously set color stops.
|
|
1224
|
+
* @param id - The block whose gradient color stop should be set.
|
|
1225
|
+
* @param stops - The gradient color stops to set.
|
|
1226
|
+
* @returns An empty result on success, an error otherwise.
|
|
1227
|
+
*/
|
|
1228
|
+
setFillGradientColorStops(id: DesignBlockId, stops: GradientstopRGBA[]): void;
|
|
1229
|
+
/**
|
|
1230
|
+
* Set the position of a gradient's control point.
|
|
1231
|
+
* Note that Different gradient types of different control points.
|
|
1232
|
+
* @param id - The block whose gradient control point should be set.
|
|
1233
|
+
* @param gradientControlPointType - The type of control point.
|
|
1234
|
+
* @param x - The horizontal component of the control point.
|
|
1235
|
+
* @param y - The vertical component of the control point.
|
|
1236
|
+
* @returns true if the control point was set, an error otherwise.
|
|
1237
|
+
*/
|
|
1238
|
+
setFillGradientControlPoint(id: DesignBlockId, gradientControlPointType: GradientControlPointType, x: number, y: number): boolean;
|
|
1239
|
+
/**
|
|
1240
|
+
* Get the horizontal component of a gradient's control point.
|
|
1241
|
+
* @param id - The block whose gradient control point should be queried.
|
|
1242
|
+
* @param gradientControlPointType - The type of control point.
|
|
1243
|
+
* @returns The horizontal component of the control point, an error otherwise.
|
|
1244
|
+
*/
|
|
1245
|
+
getFillGradientControlPointX(id: DesignBlockId, gradientControlPointType: GradientControlPointType): number;
|
|
1246
|
+
/**
|
|
1247
|
+
* Get the vertical component of a gradient's control point.
|
|
1248
|
+
* @param id - The block whose gradient control point should be queried.
|
|
1249
|
+
* @param gradientControlPointType - The type of control point.
|
|
1250
|
+
* @returns The vertical component of the control point, an error otherwise.
|
|
1251
|
+
*/
|
|
1252
|
+
getFillGradientControlPointY(id: DesignBlockId, gradientControlPointType: GradientControlPointType): number;
|
|
1253
|
+
/**
|
|
1254
|
+
* Set a gradient's radius.
|
|
1255
|
+
* Note that Not all gradients have a radius.
|
|
1256
|
+
* @param id - The block whose gradient radius should be set.
|
|
1257
|
+
* @param radius - The gradient's radius.
|
|
1258
|
+
* @returns true if the control point was set, an error otherwise.
|
|
1259
|
+
*/
|
|
1260
|
+
setFillGradientRadius(id: DesignBlockId, radius: number): boolean;
|
|
1261
|
+
/**
|
|
1262
|
+
* Get a gradient's radius.
|
|
1263
|
+
* Note that Not all gradients have a radius.
|
|
1264
|
+
* @param id - The block whose gradient radius should be queried.
|
|
1265
|
+
* @returns the gradient's radius, an error otherwise.
|
|
1266
|
+
*/
|
|
1267
|
+
getFillGradientRadius(id: DesignBlockId): number;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
/**
|
|
1271
|
+
* @public
|
|
1272
|
+
*/
|
|
1273
|
+
export declare type BlockEvent = {
|
|
1274
|
+
block: DesignBlockId;
|
|
1275
|
+
type: 'Created' | 'Updated' | 'Destroyed';
|
|
1276
|
+
};
|
|
1277
|
+
|
|
1278
|
+
/** @public */
|
|
1279
|
+
declare interface BlockEvent_2 {
|
|
1280
|
+
block: Block;
|
|
1281
|
+
type: 'Created' | 'Updated' | 'Destroyed';
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
/** @public */
|
|
1285
|
+
declare type Callbacks = {
|
|
1286
|
+
log?: Logger;
|
|
1287
|
+
};
|
|
1288
|
+
|
|
1289
|
+
/**
|
|
1290
|
+
* All components between 0 and 1
|
|
1291
|
+
* @public
|
|
1292
|
+
*/
|
|
1293
|
+
export declare interface CMYKColor {
|
|
1294
|
+
c: number;
|
|
1295
|
+
m: number;
|
|
1296
|
+
y: number;
|
|
1297
|
+
k: number;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
/**
|
|
1301
|
+
* A color definition for the custom color palette.
|
|
1302
|
+
* The RGB and CMYK components must all be specified in the range [0-1].
|
|
1303
|
+
* @public
|
|
1304
|
+
*/
|
|
1305
|
+
declare type Color_2 = HexColorString | RGBColor | RGBAColor | SpotColor;
|
|
1306
|
+
|
|
1307
|
+
/** @public */
|
|
1308
|
+
declare type ColorDefinition = Preset & {
|
|
1309
|
+
value: Color_2;
|
|
1310
|
+
};
|
|
1311
|
+
|
|
1312
|
+
/** @public */
|
|
1313
|
+
declare type ColorPaletteDefinition = Preset & {
|
|
1314
|
+
entries: Color_2[];
|
|
1315
|
+
};
|
|
1316
|
+
|
|
1317
|
+
declare namespace ConfigTypes {
|
|
1318
|
+
export {
|
|
1319
|
+
HexColorString,
|
|
1320
|
+
Color_2 as Color,
|
|
1321
|
+
AssetSources,
|
|
1322
|
+
AssetSource_2 as AssetSource,
|
|
1323
|
+
AssetResult_2 as AssetResult,
|
|
1324
|
+
AssetsQueryResult_2 as AssetsQueryResult,
|
|
1325
|
+
QueryData,
|
|
1326
|
+
Preset,
|
|
1327
|
+
VariableDefinition,
|
|
1328
|
+
ColorDefinition,
|
|
1329
|
+
ColorPaletteDefinition,
|
|
1330
|
+
PageFormatDefinition,
|
|
1331
|
+
TemplateDefinition,
|
|
1332
|
+
TypefaceDefinition,
|
|
1333
|
+
ImageDefinition,
|
|
1334
|
+
Presets,
|
|
1335
|
+
Variables,
|
|
1336
|
+
Core,
|
|
1337
|
+
Extensions,
|
|
1338
|
+
Scene,
|
|
1339
|
+
Page,
|
|
1340
|
+
Callbacks
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
export { ConfigTypes }
|
|
1344
|
+
|
|
1345
|
+
/** @public */
|
|
1346
|
+
export declare interface Configuration {
|
|
1347
|
+
baseURL: string;
|
|
1348
|
+
license?: string;
|
|
1349
|
+
role: RoleString;
|
|
1350
|
+
featureFlags?: Record<string, string | boolean>;
|
|
1351
|
+
extensions: ConfigTypes.Extensions;
|
|
1352
|
+
core: ConfigTypes.Core;
|
|
1353
|
+
scene: ConfigTypes.Scene;
|
|
1354
|
+
page: ConfigTypes.Page;
|
|
1355
|
+
assetSources: ConfigTypes.AssetSources;
|
|
1356
|
+
presets: ConfigTypes.Presets;
|
|
1357
|
+
variables: ConfigTypes.Variables;
|
|
1358
|
+
callbacks: ConfigTypes.Callbacks;
|
|
1359
|
+
/**
|
|
1360
|
+
* The default font used by a text added to the scene. Needs to be the id of
|
|
1361
|
+
* the font from a extension pack including namespace, e.g.
|
|
1362
|
+
*
|
|
1363
|
+
* '//ly.img.cesdk.fonts/roboto_regular'
|
|
1364
|
+
*
|
|
1365
|
+
* If not configured the fallback font is used.
|
|
1366
|
+
*/
|
|
1367
|
+
defaultFont?: string;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
/**
|
|
1371
|
+
* - Crop: Manual crop.
|
|
1372
|
+
* - Cover: Automatically cover the entire frame.
|
|
1373
|
+
* - Contain: Automatically contain content inside frame.
|
|
1374
|
+
*
|
|
1375
|
+
* @public
|
|
1376
|
+
*/
|
|
1377
|
+
export declare type ContentFillMode = 'Crop' | 'Cover' | 'Contain';
|
|
1378
|
+
|
|
1379
|
+
/** @public */
|
|
1380
|
+
declare type Core = {
|
|
1381
|
+
baseURL: string;
|
|
1382
|
+
};
|
|
1383
|
+
|
|
1384
|
+
/**
|
|
1385
|
+
* A headless implementation that just initializes & exposes the Document API
|
|
1386
|
+
*
|
|
1387
|
+
* @public
|
|
1388
|
+
*/
|
|
1389
|
+
declare class CreativeEngine {
|
|
1390
|
+
#private;
|
|
1391
|
+
block: BlockAPI;
|
|
1392
|
+
scene: SceneAPI;
|
|
1393
|
+
variable: VariableAPI;
|
|
1394
|
+
editor: EditorAPI;
|
|
1395
|
+
|
|
1396
|
+
event: EventAPI;
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* Dispose the engine.
|
|
1400
|
+
*/
|
|
1401
|
+
dispose(): void;
|
|
1402
|
+
/**
|
|
1403
|
+
* Initialize a `CreativeEngine` using the given `canvas` element and an optional config.
|
|
1404
|
+
* @param config - A configuration object.
|
|
1405
|
+
* @param canvas - The canvas to use for drawing. Optional, if no canvas is provided,
|
|
1406
|
+
* the engine works with an internal offscreen-canvas.
|
|
1407
|
+
* @returns An engine instance.
|
|
1408
|
+
*/
|
|
1409
|
+
static init(config?: Partial<Configuration>, canvas?: HTMLCanvasElement | OffscreenCanvas): Promise<CreativeEngine>;
|
|
1410
|
+
}
|
|
1411
|
+
export default CreativeEngine;
|
|
1412
|
+
|
|
1413
|
+
/**
|
|
1414
|
+
* A numerical identifier for a design block
|
|
1415
|
+
* @public
|
|
1416
|
+
*/
|
|
1417
|
+
export declare type DesignBlockId = number;
|
|
1418
|
+
|
|
1419
|
+
/**
|
|
1420
|
+
* @public
|
|
1421
|
+
*/
|
|
1422
|
+
export declare enum DesignBlockType {
|
|
1423
|
+
Scene = "//ly.img.ubq/scene",
|
|
1424
|
+
Stack = "//ly.img.ubq/stack",
|
|
1425
|
+
Camera = "//ly.img.ubq/camera",
|
|
1426
|
+
Page = "//ly.img.ubq/page",
|
|
1427
|
+
Image = "//ly.img.ubq/image",
|
|
1428
|
+
Video = "//ly.img.ubq/video",
|
|
1429
|
+
Text = "//ly.img.ubq/text",
|
|
1430
|
+
Sticker = "//ly.img.ubq/sticker",
|
|
1431
|
+
VectorPath = "//ly.img.ubq/vector_path",
|
|
1432
|
+
RectShape = "//ly.img.ubq/shapes/rect",
|
|
1433
|
+
LineShape = "//ly.img.ubq/shapes/line",
|
|
1434
|
+
StarShape = "//ly.img.ubq/shapes/star",
|
|
1435
|
+
PolygonShape = "//ly.img.ubq/shapes/polygon",
|
|
1436
|
+
EllipseShape = "//ly.img.ubq/shapes/ellipse",
|
|
1437
|
+
Group = "//ly.img.ubq/group"
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
/** @public */
|
|
1441
|
+
export declare type DesignUnit = 'mm' | 'px' | 'in';
|
|
1442
|
+
|
|
1443
|
+
/**
|
|
1444
|
+
* @public
|
|
1445
|
+
*/
|
|
1446
|
+
export declare class EditorAPI {
|
|
1447
|
+
#private;
|
|
1448
|
+
|
|
1449
|
+
/**
|
|
1450
|
+
* Subscribe to changes to the editor state.
|
|
1451
|
+
* @param callback - This function is called at the end of the engine update, if the editor state has changed.
|
|
1452
|
+
* @returns A method to unsubscribe.
|
|
1453
|
+
*/
|
|
1454
|
+
onStateChanged(callback: () => void): () => void;
|
|
1455
|
+
/**
|
|
1456
|
+
* Set the edit mode of the editor.
|
|
1457
|
+
* An edit mode defines what type of content can currently be edited by the user.
|
|
1458
|
+
* Hint: the initial edit mode is "Transform".
|
|
1459
|
+
* @param mode - "Transform", "Crop", "Text", or a custom value.
|
|
1460
|
+
*/
|
|
1461
|
+
setEditMode(mode: 'Transform' | 'Crop' | 'Text' | string): void;
|
|
1462
|
+
/**
|
|
1463
|
+
* Get the current edit mode of the editor.
|
|
1464
|
+
* An edit mode defines what type of content can currently be edited by the user.
|
|
1465
|
+
* @returns "Transform", "Crop", "Text", or a custom value.
|
|
1466
|
+
*/
|
|
1467
|
+
getEditMode(): 'Transform' | 'Crop' | 'Text' | string;
|
|
1468
|
+
/**
|
|
1469
|
+
* Get the type of cursor that should be displayed by the application.
|
|
1470
|
+
* @returns The cursor type.
|
|
1471
|
+
*/
|
|
1472
|
+
getCursorType(): 'Arrow' | 'Move' | 'MoveNotPermitted' | 'Resize' | 'Rotate' | 'Text';
|
|
1473
|
+
/**
|
|
1474
|
+
* Get the rotation with which to render the mouse cursor.
|
|
1475
|
+
* @returns The angle in radians.
|
|
1476
|
+
*/
|
|
1477
|
+
getCursorRotation(): number;
|
|
1478
|
+
/**
|
|
1479
|
+
* Get the current text cursor's x position in screen space.
|
|
1480
|
+
* @returns The text cursor's x position in screen space.
|
|
1481
|
+
*/
|
|
1482
|
+
getTextCursorPositionInScreenSpaceX(): number;
|
|
1483
|
+
/**
|
|
1484
|
+
* Get the current text cursor's y position in screen space.
|
|
1485
|
+
* @returns The text cursor's y position in screen space.
|
|
1486
|
+
*/
|
|
1487
|
+
getTextCursorPositionInScreenSpaceY(): number;
|
|
1488
|
+
/**
|
|
1489
|
+
* Sets the zoom level of the scene.
|
|
1490
|
+
* @param zoomLevel - The new zoom level.
|
|
1491
|
+
*/
|
|
1492
|
+
setZoomLevel(zoomLevel?: number): void;
|
|
1493
|
+
/**
|
|
1494
|
+
* Query a camera zoom level.
|
|
1495
|
+
* @returns The zoom level of the block's (main) camera.
|
|
1496
|
+
*/
|
|
1497
|
+
getZoomLevel(): number;
|
|
1498
|
+
/**
|
|
1499
|
+
* Adds a new history state to the stack, if undoable changes were made.
|
|
1500
|
+
*/
|
|
1501
|
+
addUndoStep(): void;
|
|
1502
|
+
/**
|
|
1503
|
+
* Undo one step in the history if an undo step is available.
|
|
1504
|
+
*/
|
|
1505
|
+
undo(): void;
|
|
1506
|
+
/**
|
|
1507
|
+
* Redo one step in the history if a redo step is available.
|
|
1508
|
+
*/
|
|
1509
|
+
redo(): void;
|
|
1510
|
+
/**
|
|
1511
|
+
* If an undo step is available.
|
|
1512
|
+
*
|
|
1513
|
+
* @returns True if an undo step is available.
|
|
1514
|
+
*/
|
|
1515
|
+
canUndo(): boolean;
|
|
1516
|
+
/**
|
|
1517
|
+
* If a redo step is available.
|
|
1518
|
+
*
|
|
1519
|
+
* @returns True if a redo step is available.
|
|
1520
|
+
*/
|
|
1521
|
+
canRedo(): boolean;
|
|
1522
|
+
/**
|
|
1523
|
+
* Set a boolean setting.
|
|
1524
|
+
* @param keypath - The settings keypath, e.g. `ubq://doubleClickToCropEnabled`
|
|
1525
|
+
* @param value - The value to set.
|
|
1526
|
+
* @throws An error, if the keypath is invalid.
|
|
1527
|
+
*/
|
|
1528
|
+
setSettingBool(keypath: string, value: boolean): void;
|
|
1529
|
+
/**
|
|
1530
|
+
* Get a boolean setting.
|
|
1531
|
+
* @param keypath - The settings keypath, e.g. `ubq://doubleClickToCropEnabled`
|
|
1532
|
+
* @throws An error, if the keypath is invalid.
|
|
1533
|
+
*/
|
|
1534
|
+
getSettingBool(keypath: string): boolean;
|
|
1535
|
+
/**
|
|
1536
|
+
* Set an integer setting.
|
|
1537
|
+
* @param keypath - The settings keypath.
|
|
1538
|
+
* @param value - The value to set.
|
|
1539
|
+
* @throws An error, if the keypath is invalid.
|
|
1540
|
+
*/
|
|
1541
|
+
setSettingInt(keypath: string, value: number): void;
|
|
1542
|
+
/**
|
|
1543
|
+
* Get an integer setting.
|
|
1544
|
+
* @param keypath - The settings keypath.
|
|
1545
|
+
* @throws An error, if the keypath is invalid.
|
|
1546
|
+
*/
|
|
1547
|
+
getSettingInt(keypath: string): number;
|
|
1548
|
+
/**
|
|
1549
|
+
* Set a float setting.
|
|
1550
|
+
* @param keypath - The settings keypath, e.g. `ubq://positionSnappingThreshold`
|
|
1551
|
+
* @param value - The value to set.
|
|
1552
|
+
* @throws An error, if the keypath is invalid.
|
|
1553
|
+
*/
|
|
1554
|
+
setSettingFloat(keypath: string, value: number): void;
|
|
1555
|
+
/**
|
|
1556
|
+
* Get a float setting.
|
|
1557
|
+
* @param keypath - The settings keypath, e.g. `ubq://positionSnappingThreshold`
|
|
1558
|
+
* @throws An error, if the keypath is invalid.
|
|
1559
|
+
*/
|
|
1560
|
+
getSettingFloat(keypath: string): number;
|
|
1561
|
+
/**
|
|
1562
|
+
* Set a string setting.
|
|
1563
|
+
* @param keypath - The settings keypath, e.g. `ubq://license`
|
|
1564
|
+
* @param value - The value to set.
|
|
1565
|
+
* @throws An error, if the keypath is invalid.
|
|
1566
|
+
*/
|
|
1567
|
+
setSettingString(keypath: string, value: string): void;
|
|
1568
|
+
/**
|
|
1569
|
+
* Get a string setting.
|
|
1570
|
+
* @param keypath - The settings keypath, e.g. `ubq://license`
|
|
1571
|
+
* @throws An error, if the keypath is invalid.
|
|
1572
|
+
*/
|
|
1573
|
+
getSettingString(keypath: string): string;
|
|
1574
|
+
/**
|
|
1575
|
+
* Set a color setting.
|
|
1576
|
+
* @param keypath - The settings keypath, e.g. `ubq://highlightColor`.
|
|
1577
|
+
* @param r - The red color component in the range of 0 to 1.
|
|
1578
|
+
* @param g - The green color component in the range of 0 to 1.
|
|
1579
|
+
* @param b - The blue color component in the range of 0 to 1.
|
|
1580
|
+
* @param a - The alpha color component in the range of 0 to 1.
|
|
1581
|
+
*/
|
|
1582
|
+
setSettingColorRGBA(keypath: string, r: number, g: number, b: number, a?: number): void;
|
|
1583
|
+
/**
|
|
1584
|
+
* Get a color setting.
|
|
1585
|
+
* @param keypath - The settings keypath, e.g. `ubq://highlightColor`.
|
|
1586
|
+
* @returns A tuple of channels red, green, blue and alpha in the range of 0 to 1.
|
|
1587
|
+
*/
|
|
1588
|
+
getSettingColorRGBA(keypath: string): RGBA;
|
|
1589
|
+
/**
|
|
1590
|
+
* Set an enum setting.
|
|
1591
|
+
* @param keypath - The settings keypath, e.g. `ubq://role`.
|
|
1592
|
+
* @param value - The enum value as string.
|
|
1593
|
+
*/
|
|
1594
|
+
setSettingEnum(keypath: string, value: string): void;
|
|
1595
|
+
/**
|
|
1596
|
+
* Get an enum setting.
|
|
1597
|
+
* @param keypath - The settings keypath, e.g. `ubq://role`.
|
|
1598
|
+
* @returns The value as string.
|
|
1599
|
+
*/
|
|
1600
|
+
getSettingEnum(keypath: string): string;
|
|
1601
|
+
/**
|
|
1602
|
+
* Sets a custom URI resolver.
|
|
1603
|
+
* This function can be called more than once. Subsequent calls will overwrite previous calls.
|
|
1604
|
+
* To remove a previously set resolver, pass the value `null`.
|
|
1605
|
+
* The given function must return an absolute path with a scheme.
|
|
1606
|
+
* @param resolver - Custom resolution function.
|
|
1607
|
+
*/
|
|
1608
|
+
setURIResolver(resolver: (URI: string) => string): void;
|
|
1609
|
+
/**
|
|
1610
|
+
* Resolves the given path.
|
|
1611
|
+
* If a custom resolver has been set with `setURIResolver`, it invokes it with the given path.
|
|
1612
|
+
* Else, it resolves it as relative to the `ubq://basePath` setting.
|
|
1613
|
+
* This performs NO validation of whether a file exists at the specified location.
|
|
1614
|
+
* @param relativePath - A relative path string
|
|
1615
|
+
* @returns The resolved absolute uri or an error if an invalid path was given.
|
|
1616
|
+
*/
|
|
1617
|
+
getAbsoluteURI(relativePath: string): string;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
/**
|
|
1621
|
+
* @public
|
|
1622
|
+
*/
|
|
1623
|
+
export declare class EventAPI {
|
|
1624
|
+
#private;
|
|
1625
|
+
|
|
1626
|
+
/**
|
|
1627
|
+
* Subscribe to block life-cycle events.
|
|
1628
|
+
* @param blocks - A list of blocks to filter events by. If the list is empty, events for every block are sent.
|
|
1629
|
+
* @param callback - The event callback. Events are bundled and sent at the end of each engine update.
|
|
1630
|
+
* @returns A method to unsubscribe.
|
|
1631
|
+
*/
|
|
1632
|
+
subscribe(blocks: DesignBlockId[], callback: (events: BlockEvent[]) => void): () => void;
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
/** @public */
|
|
1636
|
+
declare interface ExportOptions {
|
|
1637
|
+
jpegQuality: number;
|
|
1638
|
+
pngCompressionLevel: number;
|
|
1639
|
+
useTargetSize: boolean;
|
|
1640
|
+
targetWidth: number;
|
|
1641
|
+
targetHeight: number;
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
/** @public */
|
|
1645
|
+
declare interface ExportVideoOptions {
|
|
1646
|
+
h264Profile: number;
|
|
1647
|
+
h264Level: number;
|
|
1648
|
+
framerate: number;
|
|
1649
|
+
useTargetSize: boolean;
|
|
1650
|
+
targetWidth: number;
|
|
1651
|
+
targetHeight: number;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
/** @public */
|
|
1655
|
+
declare type Extensions = {
|
|
1656
|
+
baseURL: string;
|
|
1657
|
+
entries: string[];
|
|
1658
|
+
};
|
|
1659
|
+
|
|
1660
|
+
/**
|
|
1661
|
+
* @public
|
|
1662
|
+
*/
|
|
1663
|
+
export declare type FillType = 'Solid' | 'Gradient';
|
|
1664
|
+
|
|
1665
|
+
/** @public */
|
|
1666
|
+
declare interface Flip {
|
|
1667
|
+
horizontal: boolean;
|
|
1668
|
+
vertical: boolean;
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
/** @public */
|
|
1672
|
+
export declare type FontStyle = 'normal' | 'italic';
|
|
1673
|
+
|
|
1674
|
+
/** @public */
|
|
1675
|
+
export declare type FontWeight = 'thin' | 'extraLight' | 'Light' | 'normal' | 'medium' | 'semiBold' | 'bold' | 'extraBold' | 'heavy';
|
|
1676
|
+
|
|
1677
|
+
/**
|
|
1678
|
+
* @public
|
|
1679
|
+
*/
|
|
1680
|
+
export declare type GradientControlPointType = 'Start' | 'End' | 'Center';
|
|
1681
|
+
|
|
1682
|
+
/**
|
|
1683
|
+
* @public
|
|
1684
|
+
*/
|
|
1685
|
+
export declare type GradientstopRGBA = [
|
|
1686
|
+
stop: number,
|
|
1687
|
+
r: number,
|
|
1688
|
+
g: number,
|
|
1689
|
+
b: number,
|
|
1690
|
+
a: number
|
|
1691
|
+
];
|
|
1692
|
+
|
|
1693
|
+
/**
|
|
1694
|
+
* @public
|
|
1695
|
+
*/
|
|
1696
|
+
export declare type GradientType = 'Linear' | 'Radial' | 'Conical';
|
|
1697
|
+
|
|
1698
|
+
/**
|
|
1699
|
+
* An asset can be member of multiple groups. Groups have a semantic meaning
|
|
1700
|
+
* used to build and group UIs exploring the assets, e.g.sections in the
|
|
1701
|
+
* content library, or for things like topics in Unsplash for instance.
|
|
1702
|
+
*
|
|
1703
|
+
* Tags in comparison have are more loosely hold meaning used for extended
|
|
1704
|
+
* searching/filtering.
|
|
1705
|
+
* @public
|
|
1706
|
+
*/
|
|
1707
|
+
declare type Groups = string[];
|
|
1708
|
+
|
|
1709
|
+
/**
|
|
1710
|
+
* A hexadecimal color value (RGB or RGBA) that starts with a '#'
|
|
1711
|
+
* @example #6686FF or #6686FFFF
|
|
1712
|
+
* @public
|
|
1713
|
+
*/
|
|
1714
|
+
declare type HexColorString = string;
|
|
1715
|
+
|
|
1716
|
+
/** @public */
|
|
1717
|
+
declare type ImageDefinition = Preset & {
|
|
1718
|
+
imageURL: string;
|
|
1719
|
+
thumbnailURL?: string;
|
|
1720
|
+
width: number;
|
|
1721
|
+
height: number;
|
|
1722
|
+
levelOfDetail?: {
|
|
1723
|
+
[lod: number]: string;
|
|
1724
|
+
};
|
|
1725
|
+
};
|
|
1726
|
+
|
|
1727
|
+
/**
|
|
1728
|
+
* e.g. `en`, `de`, etc.
|
|
1729
|
+
* @public
|
|
1730
|
+
*/
|
|
1731
|
+
declare type Locale = string;
|
|
1732
|
+
|
|
1733
|
+
/** @public */
|
|
1734
|
+
export declare type Logger = (message: string, level: LogLevel) => void;
|
|
1735
|
+
|
|
1736
|
+
/** @public */
|
|
1737
|
+
export declare enum LogLevel {
|
|
1738
|
+
Info = "Info",
|
|
1739
|
+
Warning = "Warning",
|
|
1740
|
+
Error = "Error"
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
/** @public */
|
|
1744
|
+
declare enum MimeType_2 {
|
|
1745
|
+
Png = "image/png",
|
|
1746
|
+
Jpeg = "image/jpeg",
|
|
1747
|
+
Tga = "image/x-tga",
|
|
1748
|
+
Mp4 = "video/mp4",
|
|
1749
|
+
Binary = "application/octet-stream",
|
|
1750
|
+
Pdf = "application/pdf",
|
|
1751
|
+
Zip = "application/zip"
|
|
1752
|
+
}
|
|
1753
|
+
export { MimeType_2 as MimeType }
|
|
1754
|
+
|
|
1755
|
+
/** @public */
|
|
1756
|
+
declare type Page = {
|
|
1757
|
+
title: {
|
|
1758
|
+
/**
|
|
1759
|
+
* Whether newly created pages should show a title.
|
|
1760
|
+
*/
|
|
1761
|
+
show?: boolean;
|
|
1762
|
+
/**
|
|
1763
|
+
* The font file to use to render the page titles.
|
|
1764
|
+
*/
|
|
1765
|
+
fontFileUri?: string;
|
|
1766
|
+
};
|
|
1767
|
+
/**
|
|
1768
|
+
* Whether the opacity of the region outside of all
|
|
1769
|
+
* pages should be reduced.
|
|
1770
|
+
*/
|
|
1771
|
+
dimOutOfPageAreas?: boolean;
|
|
1772
|
+
};
|
|
1773
|
+
|
|
1774
|
+
/** @public */
|
|
1775
|
+
declare type PageFormatDefinition = Preset & {
|
|
1776
|
+
width: number;
|
|
1777
|
+
height: number;
|
|
1778
|
+
unit: DesignUnit;
|
|
1779
|
+
dpi?: number;
|
|
1780
|
+
bleedMargin?: number;
|
|
1781
|
+
};
|
|
1782
|
+
|
|
1783
|
+
/** @public */
|
|
1784
|
+
export declare interface PaginatedAssetQueryData extends AssetQueryData {
|
|
1785
|
+
/** The current page queried for paginated views. */
|
|
1786
|
+
page: number;
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
/**
|
|
1790
|
+
* - Absolute: Position in absolute design units.
|
|
1791
|
+
* - Percent: Position in relation to the block's parent's size in percent, where 1.0 means 100%.
|
|
1792
|
+
* - Auto: Position is automatically determined
|
|
1793
|
+
*
|
|
1794
|
+
* @public
|
|
1795
|
+
*/
|
|
1796
|
+
export declare type PositionMode = 'Absolute' | 'Percent' | 'Auto';
|
|
1797
|
+
|
|
1798
|
+
/** @public */
|
|
1799
|
+
declare type Preset = {
|
|
1800
|
+
meta?: {
|
|
1801
|
+
default?: boolean;
|
|
1802
|
+
library?: string;
|
|
1803
|
+
categories?: string[];
|
|
1804
|
+
};
|
|
1805
|
+
};
|
|
1806
|
+
|
|
1807
|
+
/** @public */
|
|
1808
|
+
declare type Presets = {
|
|
1809
|
+
colors?: {
|
|
1810
|
+
[id: string]: ColorDefinition;
|
|
1811
|
+
};
|
|
1812
|
+
typefaces?: {
|
|
1813
|
+
[id: string]: TypefaceDefinition;
|
|
1814
|
+
};
|
|
1815
|
+
images?: {
|
|
1816
|
+
[id: string]: ImageDefinition;
|
|
1817
|
+
};
|
|
1818
|
+
pageFormats?: {
|
|
1819
|
+
[id: string]: PageFormatDefinition;
|
|
1820
|
+
};
|
|
1821
|
+
colorPalettes?: {
|
|
1822
|
+
[id: string]: ColorPaletteDefinition;
|
|
1823
|
+
};
|
|
1824
|
+
templates?: {
|
|
1825
|
+
[id: string]: TemplateDefinition;
|
|
1826
|
+
};
|
|
1827
|
+
};
|
|
1828
|
+
|
|
1829
|
+
/** @public */
|
|
1830
|
+
export declare type PropertyType = 'Bool' | 'Int' | 'Float' | 'String' | 'Color' | 'Enum' | 'Struct';
|
|
1831
|
+
|
|
1832
|
+
/** @public */
|
|
1833
|
+
declare interface QueryData {
|
|
1834
|
+
/** A query string used for (fuzzy) searching of labels and tags */
|
|
1835
|
+
query?: string;
|
|
1836
|
+
/**
|
|
1837
|
+
* The number of results queried. How many assets shall be returned regardless
|
|
1838
|
+
* of the total number of assets available.
|
|
1839
|
+
*
|
|
1840
|
+
* Together with `page` this can be used for pagination.
|
|
1841
|
+
*/
|
|
1842
|
+
perPage: number;
|
|
1843
|
+
/** The current page queried for paginated views. */
|
|
1844
|
+
page: number;
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
/**
|
|
1848
|
+
* @public
|
|
1849
|
+
*/
|
|
1850
|
+
export declare type RGBA = [r: number, g: number, b: number, a: number];
|
|
1851
|
+
|
|
1852
|
+
/**
|
|
1853
|
+
* All components between 0 and 1
|
|
1854
|
+
* @public
|
|
1855
|
+
*/
|
|
1856
|
+
export declare interface RGBAColor {
|
|
1857
|
+
r: number;
|
|
1858
|
+
g: number;
|
|
1859
|
+
b: number;
|
|
1860
|
+
a: number;
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
/**
|
|
1864
|
+
* All components between 0 and 1
|
|
1865
|
+
* @public
|
|
1866
|
+
*/
|
|
1867
|
+
export declare interface RGBColor {
|
|
1868
|
+
r: number;
|
|
1869
|
+
g: number;
|
|
1870
|
+
b: number;
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
/** @public */
|
|
1874
|
+
export declare type RoleString = 'Creator' | 'Adopter' | 'Viewer' | 'Presenter';
|
|
1875
|
+
|
|
1876
|
+
/**
|
|
1877
|
+
* Export Settings
|
|
1878
|
+
* @public
|
|
1879
|
+
*/
|
|
1880
|
+
declare type Scene = {
|
|
1881
|
+
maskSpotColor?: SpotColor;
|
|
1882
|
+
/**
|
|
1883
|
+
* The DPI value to use when exporting and when converting between pixels and inches or millimeter units.
|
|
1884
|
+
* (In the CESDK, this value is synonymous with PPI).
|
|
1885
|
+
*
|
|
1886
|
+
* This is only relevant for new scenes that are created in the editor. Loaded scenes will use the
|
|
1887
|
+
* value stored in their serialization file.
|
|
1888
|
+
*/
|
|
1889
|
+
dpi: number;
|
|
1890
|
+
/**
|
|
1891
|
+
* A scale factor that is applied to the final export resolution.
|
|
1892
|
+
*
|
|
1893
|
+
* This is only relevant for new scenes that are created in the editor. Loaded scenes will use the
|
|
1894
|
+
* value stored in their serialization file.
|
|
1895
|
+
*/
|
|
1896
|
+
pixelScaleFactor: number;
|
|
1897
|
+
};
|
|
1898
|
+
|
|
1899
|
+
/**
|
|
1900
|
+
* @public
|
|
1901
|
+
*/
|
|
1902
|
+
export declare class SceneAPI {
|
|
1903
|
+
#private;
|
|
1904
|
+
|
|
1905
|
+
/**
|
|
1906
|
+
* Load the contents of a scene file.
|
|
1907
|
+
* @param sceneContent - The scene file contents, a base64 string.
|
|
1908
|
+
* @returns A handle to the loaded scene.
|
|
1909
|
+
*/
|
|
1910
|
+
loadFromString(sceneContent: string): Promise<DesignBlockId>;
|
|
1911
|
+
/**
|
|
1912
|
+
* Load a scene from the URL to the scene file.
|
|
1913
|
+
* The scene file will be fetched asynchronously by the engine. This requires continuous `render`
|
|
1914
|
+
* calls on this engines instance.
|
|
1915
|
+
* @param url - The URL of the scene file.
|
|
1916
|
+
* @returns scene A promise that resolves once the scene was loaded or rejects with an error otherwise.
|
|
1917
|
+
*/
|
|
1918
|
+
loadFromURL(url: string): Promise<DesignBlockId>;
|
|
1919
|
+
/**
|
|
1920
|
+
* Serializes the current scene into a string. Selection is discarded.
|
|
1921
|
+
* @returns A promise that resolves with a string on success or an error on failure.
|
|
1922
|
+
*/
|
|
1923
|
+
saveToString(): Promise<string>;
|
|
1924
|
+
/**
|
|
1925
|
+
* Saves the current scene and all of its referenced assets into an archive.
|
|
1926
|
+
* The archive contains all assets, that were accessible when this function was called.
|
|
1927
|
+
* Blocks in the archived scene reference assets relative from to the location of the scene
|
|
1928
|
+
* file. These references are resolved when loading such a scene via `loadSceneFromURL`.
|
|
1929
|
+
*
|
|
1930
|
+
* @returns A promise that resolves with a Blob on success or an error on failure.
|
|
1931
|
+
*/
|
|
1932
|
+
saveToArchive(): Promise<Blob>;
|
|
1933
|
+
/**
|
|
1934
|
+
* Create a new scene, along with its own camera.
|
|
1935
|
+
* @returns The scenes handle.
|
|
1936
|
+
*/
|
|
1937
|
+
create(): DesignBlockId;
|
|
1938
|
+
/**
|
|
1939
|
+
* Loads the given image and creates a scene with a single page showing the image.
|
|
1940
|
+
* Fetching the image may take an arbitrary amount of time, so the scene isn't immediately
|
|
1941
|
+
* available.
|
|
1942
|
+
* @param url - The image URL.
|
|
1943
|
+
* @param dpi - The scenes DPI.
|
|
1944
|
+
* @param pixelScaleFactor - The displays pixel scale factor.
|
|
1945
|
+
* @returns A promise that resolves with the scene ID on success or rejected with an error otherwise.
|
|
1946
|
+
*/
|
|
1947
|
+
createFromImage(url: string, dpi?: number, pixelScaleFactor?: number): Promise<DesignBlockId>;
|
|
1948
|
+
/**
|
|
1949
|
+
* Return the currently active scene.
|
|
1950
|
+
* @returns The scene or null, if none was created yet.
|
|
1951
|
+
*/
|
|
1952
|
+
get(): DesignBlockId | null;
|
|
1953
|
+
/**
|
|
1954
|
+
* Applies the contents of the given template scene to the currently loaded scene.
|
|
1955
|
+
* This loads the template scene while keeping the design unit and page dimensions
|
|
1956
|
+
* of the current scene. Page contents remain centered when the pages are resized
|
|
1957
|
+
* to fit the new dimensions.
|
|
1958
|
+
* @param content - The template scene file contents, a base64 string.
|
|
1959
|
+
* @returns A Promise that resolves once the template was applied or rejects if there was an error.
|
|
1960
|
+
*/
|
|
1961
|
+
applyTemplateFromString(content: string): Promise<void>;
|
|
1962
|
+
/**
|
|
1963
|
+
* Applies the contents of the given template scene to the currently loaded scene.
|
|
1964
|
+
* This loads the template scene while keeping the design unit and page dimensions
|
|
1965
|
+
* of the current scene. Page contents remain centered when the pages are resized
|
|
1966
|
+
* to fit the new dimensions.
|
|
1967
|
+
* @param url - The url to the template scene file.
|
|
1968
|
+
* @returns A Promise that resolves once the template was applied or rejects if there was an error.
|
|
1969
|
+
*/
|
|
1970
|
+
applyTemplateFromURL(url: string): Promise<void>;
|
|
1971
|
+
/**
|
|
1972
|
+
* Converts all values of the current scene into the given design unit.
|
|
1973
|
+
* @param designUnit - The new design unit of the scene
|
|
1974
|
+
*/
|
|
1975
|
+
unstable_setDesignUnit(designUnit: DesignUnit): void;
|
|
1976
|
+
/**
|
|
1977
|
+
* Returns the design unit of the current scene.
|
|
1978
|
+
* @returns The current design unit.
|
|
1979
|
+
*/
|
|
1980
|
+
unstable_getDesignUnit(): DesignUnit;
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
/** @public */
|
|
1984
|
+
export declare interface Size2 {
|
|
1985
|
+
width: number;
|
|
1986
|
+
height: number;
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
/**
|
|
1990
|
+
* - Absolute: Size in absolute design units.
|
|
1991
|
+
* - Percent: Size in relation to the block's parent's size in percent, where 1.0 means 100%.
|
|
1992
|
+
* - Auto: Size is automatically determined
|
|
1993
|
+
*
|
|
1994
|
+
* @public
|
|
1995
|
+
*/
|
|
1996
|
+
export declare type SizeMode = 'Absolute' | 'Percent' | 'Auto';
|
|
1997
|
+
|
|
1998
|
+
/** @public */
|
|
1999
|
+
export declare interface SpotColor {
|
|
2000
|
+
name: string;
|
|
2001
|
+
rgbApproximation: RGBAColor;
|
|
2002
|
+
cmykApproximation: CMYKColor;
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
/** @public */
|
|
2006
|
+
export declare type StrokeCornerGeometry = 'Bevel' | 'Miter' | 'Round';
|
|
2007
|
+
|
|
2008
|
+
/** @public */
|
|
2009
|
+
export declare type StrokePosition = 'Center' | 'Inner' | 'Outer';
|
|
2010
|
+
|
|
2011
|
+
/** @public */
|
|
2012
|
+
export declare type StrokeStyle = 'Dashed' | 'DashedRound' | 'Dotted' | 'LongDashed' | 'LongDashedRound' | 'Solid';
|
|
2013
|
+
|
|
2014
|
+
/** @public */
|
|
2015
|
+
declare type Subscription = number;
|
|
2016
|
+
|
|
2017
|
+
/** @public */
|
|
2018
|
+
declare type TemplateDefinition = Preset & {
|
|
2019
|
+
label: string;
|
|
2020
|
+
scene: string | URL | (() => Promise<string>);
|
|
2021
|
+
thumbnailURL?: string | URL;
|
|
2022
|
+
};
|
|
2023
|
+
|
|
2024
|
+
/** @public */
|
|
2025
|
+
declare type TypefaceDefinition = Preset & {
|
|
2026
|
+
family: string;
|
|
2027
|
+
fonts: {
|
|
2028
|
+
fontURL: string;
|
|
2029
|
+
weight: FontWeight;
|
|
2030
|
+
style: FontStyle;
|
|
2031
|
+
}[];
|
|
2032
|
+
};
|
|
2033
|
+
|
|
2034
|
+
/**
|
|
2035
|
+
* @public
|
|
2036
|
+
*/
|
|
2037
|
+
export declare class VariableAPI {
|
|
2038
|
+
#private;
|
|
2039
|
+
|
|
2040
|
+
/**
|
|
2041
|
+
* Get all text variables currently stored in the engine.
|
|
2042
|
+
* @returns Return a list of variable names
|
|
2043
|
+
*/
|
|
2044
|
+
findAll(): string[];
|
|
2045
|
+
/**
|
|
2046
|
+
* Set a text variable.
|
|
2047
|
+
* @param key - The variable's key.
|
|
2048
|
+
* @param value - The text to replace the variable with.
|
|
2049
|
+
*/
|
|
2050
|
+
setString(key: string, value: string): void;
|
|
2051
|
+
/**
|
|
2052
|
+
* Set a text variable.
|
|
2053
|
+
* @param key - The variable's key.
|
|
2054
|
+
* @returns The text value of the variable.
|
|
2055
|
+
*/
|
|
2056
|
+
getString(key: string): string;
|
|
2057
|
+
/**
|
|
2058
|
+
* Destroy a text variable.
|
|
2059
|
+
* @param key - The variable's key.
|
|
2060
|
+
*/
|
|
2061
|
+
remove(key: string): void;
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
/** @public */
|
|
2065
|
+
declare type VariableDefinition = Preset & {
|
|
2066
|
+
value: string | number;
|
|
2067
|
+
};
|
|
2068
|
+
|
|
2069
|
+
/** @public */
|
|
2070
|
+
declare type Variables = {
|
|
2071
|
+
[id: string]: VariableDefinition;
|
|
2072
|
+
};
|
|
2073
|
+
|
|
2074
|
+
/** @public */
|
|
2075
|
+
export declare interface Vec2 {
|
|
2076
|
+
x: number;
|
|
2077
|
+
y: number;
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
/** @public */
|
|
2081
|
+
export declare interface Vec3 {
|
|
2082
|
+
x: number;
|
|
2083
|
+
y: number;
|
|
2084
|
+
z: number;
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
/** @public */
|
|
2088
|
+
export declare interface Vec4 {
|
|
2089
|
+
x: number;
|
|
2090
|
+
y: number;
|
|
2091
|
+
z: number;
|
|
2092
|
+
w: number;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
export { }
|