@cesdk/node 1.9.0-preview.3 → 1.9.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.
|
Binary file
|
|
Binary file
|
package/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare interface Asset {
|
|
|
19
19
|
uri?: string;
|
|
20
20
|
filename?: string;
|
|
21
21
|
vectorPath?: string;
|
|
22
|
+
duration?: string;
|
|
22
23
|
} & Record<string, unknown>;
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -77,6 +78,8 @@ export declare class AssetAPI {
|
|
|
77
78
|
canManageAssets(sourceId: string): boolean;
|
|
78
79
|
|
|
79
80
|
|
|
81
|
+
|
|
82
|
+
|
|
80
83
|
/**
|
|
81
84
|
* Apply an asset result to the active scene.
|
|
82
85
|
* The default behavior will instantiate a block and configure it according to the asset's properties.
|
|
@@ -85,12 +88,25 @@ export declare class AssetAPI {
|
|
|
85
88
|
* @param assetResult - A single assetResult of a `findAssets` query.
|
|
86
89
|
*/
|
|
87
90
|
apply(sourceId: string, assetResult: AssetResult): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Apply an asset result to the given block.
|
|
93
|
+
* @param sourceId - The ID of the asset source.
|
|
94
|
+
* @param assetResult - A single assetResult of a `findAssets` query.
|
|
95
|
+
* @param block - The block the asset should be applied to.
|
|
96
|
+
*/
|
|
97
|
+
applyToBlock(sourceId: string, assetResult: AssetResult, block: DesignBlockId): Promise<void>;
|
|
88
98
|
/**
|
|
89
99
|
* The default implementation for applying an asset to the scene.
|
|
90
100
|
* This implementation is used when no `applyAsset` function is provided to `addSource`.
|
|
91
101
|
* @param assetResult - A single assetResult of a `findAssets` query.
|
|
92
102
|
*/
|
|
93
103
|
defaultApplyAsset(assetResult: AssetResult): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* The default implementation for applying an asset to an existing block.
|
|
106
|
+
* @param assetResult - A single assetResult of a `findAssets` query.
|
|
107
|
+
* @param block - The block to apply the asset result to.
|
|
108
|
+
*/
|
|
109
|
+
defaultApplyAssetToBlock(assetResult: AssetResult, block: DesignBlockId): Promise<void>;
|
|
94
110
|
|
|
95
111
|
}
|
|
96
112
|
|
|
@@ -190,6 +206,7 @@ declare interface AssetResult_2 {
|
|
|
190
206
|
meta?: {
|
|
191
207
|
uri?: string;
|
|
192
208
|
filename?: string;
|
|
209
|
+
duration?: string;
|
|
193
210
|
} & Record<string, unknown>;
|
|
194
211
|
/** The locale of the label and tags */
|
|
195
212
|
locale?: string;
|
|
@@ -262,6 +279,11 @@ export declare interface AssetSource {
|
|
|
262
279
|
* You can override this with custom behavior.
|
|
263
280
|
*/
|
|
264
281
|
applyAsset?: (asset: AssetResult) => Promise<void>;
|
|
282
|
+
/**
|
|
283
|
+
* Apply the given asset result to the given block.
|
|
284
|
+
* You can override this with custom behavior.
|
|
285
|
+
*/
|
|
286
|
+
applyAssetToBlock?: (asset: AssetResult, block: DesignBlockId) => Promise<void>;
|
|
265
287
|
/**
|
|
266
288
|
* Adds the given asset to this source. Throws an error if `canManageAssets`
|
|
267
289
|
* is `false`.
|
|
@@ -282,6 +304,12 @@ export declare interface AssetSource {
|
|
|
282
304
|
* @returns true if asset was found and removed, and false otherwise
|
|
283
305
|
*/
|
|
284
306
|
removeAsset?(assetId: string): Promise<boolean>;
|
|
307
|
+
/**
|
|
308
|
+
* Generates a list of supported mime types for this source.
|
|
309
|
+
*
|
|
310
|
+
* @returns a list of the mime types should be supported by this source
|
|
311
|
+
*/
|
|
312
|
+
getSupportedMimeTypes?(): string[] | undefined;
|
|
285
313
|
}
|
|
286
314
|
|
|
287
315
|
/**
|
|
@@ -296,6 +324,12 @@ declare interface AssetSource_2 {
|
|
|
296
324
|
* You can override this with custom behavior.
|
|
297
325
|
*/
|
|
298
326
|
applyAsset?: (asset: AssetResult_2) => Promise<void>;
|
|
327
|
+
/**
|
|
328
|
+
* Apply the given asset result to the given block.
|
|
329
|
+
* You can override this with custom behavior.
|
|
330
|
+
*/
|
|
331
|
+
applyAssetToBlock?: (asset: AssetResult_2, block: number) => Promise<void>;
|
|
332
|
+
|
|
299
333
|
/** Return every available group */
|
|
300
334
|
getGroups?: () => Promise<string[]>;
|
|
301
335
|
/**
|
|
@@ -316,6 +350,13 @@ declare interface AssetSource_2 {
|
|
|
316
350
|
name: string;
|
|
317
351
|
url?: string;
|
|
318
352
|
};
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Generates a list of supported mime types for this source.
|
|
356
|
+
*
|
|
357
|
+
* @returns a list of the mime types should be supported by this source
|
|
358
|
+
*/
|
|
359
|
+
getSupportedMimeTypes?(): string[] | undefined;
|
|
319
360
|
}
|
|
320
361
|
|
|
321
362
|
/** @public */
|
|
@@ -385,7 +426,20 @@ export declare class BlockAPI {
|
|
|
385
426
|
* @returns A promise that resolves with an array of the exported image and mask or is rejected with an error.
|
|
386
427
|
*/
|
|
387
428
|
exportWithColorMask(handle: DesignBlockId, mimeType: MimeType_2 | undefined, maskColorR: number, maskColorG: number, maskColorB: number, options?: ExportOptions): Promise<Blob[]>;
|
|
388
|
-
|
|
429
|
+
/**
|
|
430
|
+
* Exports a design block as a video file of the given mime type.
|
|
431
|
+
* Note: The export will run across multiple iterations of the update loop. In each iteration a frame is scheduled for encoding.
|
|
432
|
+
* @param block - The design block to export.
|
|
433
|
+
* @param timeOffset - The time offset in seconds of the scene's timeline from which the video will start.
|
|
434
|
+
* @param duration - The duration in seconds of the final video.
|
|
435
|
+
* @param mimeType - The mime type of the output video file.
|
|
436
|
+
* @param resolutionWidth - The target video width in pixel.
|
|
437
|
+
* @param resolutionHeight - The target video height in pixel.
|
|
438
|
+
* @param framerate - The target framerate in Hz.
|
|
439
|
+
* @param progressCallback - A callback which reports on the progress of the export. It informs the receiver of the current frame index, which currently gets exported and the total frame count.
|
|
440
|
+
* @returns A promise that resolves with video blob or is rejected with an error.
|
|
441
|
+
*/
|
|
442
|
+
exportVideo(handle: DesignBlockId, timeOffset: number, duration: number, mimeType: MimeType_2 | undefined, resolutionWidth: number, resolutionHeight: number, framerate: number, progressCallback: (numberOfRenderedFrames: number, numberOfEncodedFrames: number, totalNumberOfFrames: number) => void): Promise<Blob>;
|
|
389
443
|
/**
|
|
390
444
|
* Loads existing blocks from the given string.
|
|
391
445
|
* The blocks are not attached by default and won't be visible until attached to a page or the scene.
|
|
@@ -437,6 +491,12 @@ export declare class BlockAPI {
|
|
|
437
491
|
* @returns An array of block ids.
|
|
438
492
|
*/
|
|
439
493
|
findAllSelected(): DesignBlockId[];
|
|
494
|
+
/**
|
|
495
|
+
* Subscribe to changes in the current set of selected blocks.
|
|
496
|
+
* @param callback - This function is called at the end of the engine update if the selection has changed.
|
|
497
|
+
* @returns A method to unsubscribe.
|
|
498
|
+
*/
|
|
499
|
+
onSelectionChanged(callback: () => void): () => void;
|
|
440
500
|
/**
|
|
441
501
|
* Confirms that a given set of blocks can be grouped together.
|
|
442
502
|
* @param ids - A non-empty array of block ids.
|
|
@@ -900,6 +960,29 @@ export declare class BlockAPI {
|
|
|
900
960
|
* @returns A tuple of channels red, green, blue and alpha in the range of 0 to 1.
|
|
901
961
|
*/
|
|
902
962
|
getColorRGBA(id: DesignBlockId, property: string): RGBA;
|
|
963
|
+
/**
|
|
964
|
+
* Set a color property of the given design block to the given value.
|
|
965
|
+
* @param id - The block whose property should be set.
|
|
966
|
+
* @param property - The name of the property to set.
|
|
967
|
+
* @param name - The name of the spot color.
|
|
968
|
+
* @param tint - The tint factor in the range of 0 to 1.
|
|
969
|
+
* @returns An empty result on success, an error otherwise.
|
|
970
|
+
*/
|
|
971
|
+
setColorSpot(id: DesignBlockId, property: string, name: string, tint?: number): void;
|
|
972
|
+
/**
|
|
973
|
+
* Get the spot color name of a color property of the given design block.
|
|
974
|
+
* @param id - The block whose property should be queried.
|
|
975
|
+
* @param property - The name of the property to query.
|
|
976
|
+
* @returns A result holding the name of the spot color or an error.
|
|
977
|
+
*/
|
|
978
|
+
getColorSpotName(id: DesignBlockId, property: string): string;
|
|
979
|
+
/**
|
|
980
|
+
* Get the spot color tint factor of a color property of the given design block.
|
|
981
|
+
* @param id - The block whose property should be queried.
|
|
982
|
+
* @param property - The name of the property to query.
|
|
983
|
+
* @returns A result holding the tint factor of the spot color or an error.
|
|
984
|
+
*/
|
|
985
|
+
getColorSpotTint(id: DesignBlockId, property: string): number;
|
|
903
986
|
/**
|
|
904
987
|
* Set an enum property of the given design block to the given value.
|
|
905
988
|
* @param id - The block whose property should be set.
|
|
@@ -1804,17 +1887,28 @@ export declare class BlockAPI {
|
|
|
1804
1887
|
/**
|
|
1805
1888
|
* Generate a thumbnail for the given video fill.
|
|
1806
1889
|
* @param id - The video fill.
|
|
1807
|
-
* @
|
|
1890
|
+
* @param thumbnailHeight - The height of a thumbnail. The width will be calculated from the video aspect ratio.
|
|
1891
|
+
* @returns A thumbnail encoded as JPEG.
|
|
1808
1892
|
*/
|
|
1809
|
-
getVideoFillThumbnail(id: DesignBlockId): Promise<Blob>;
|
|
1893
|
+
getVideoFillThumbnail(id: DesignBlockId, thumbnailHeight: number): Promise<Blob>;
|
|
1810
1894
|
/**
|
|
1811
1895
|
* Generate a thumbnail atlas for the given video fill.
|
|
1812
1896
|
* @param id - The video fill.
|
|
1813
1897
|
* @param numberOfColumns - The number of columns to generate.
|
|
1814
1898
|
* @param numberOfRows - The number of rows to generate.
|
|
1899
|
+
* @param thumbnailHeight - The height of a thumbnail. The width will be calculated from the video aspect ratio.
|
|
1815
1900
|
* @returns A thumbnail atlas of the video as JPEG.
|
|
1816
1901
|
*/
|
|
1817
|
-
getVideoFillThumbnailAtlas(id: DesignBlockId, numberOfColumns: number, numberOfRows: number): Promise<Blob>;
|
|
1902
|
+
getVideoFillThumbnailAtlas(id: DesignBlockId, numberOfColumns: number, numberOfRows: number, thumbnailHeight: number): Promise<Blob>;
|
|
1903
|
+
/**
|
|
1904
|
+
* Generate a thumbnail atlas for the given page.
|
|
1905
|
+
* @param id - The page.
|
|
1906
|
+
* @param numberOfColumns - The number of columns to generate.
|
|
1907
|
+
* @param numberOfRows - The number of rows to generate.
|
|
1908
|
+
* @param thumbnailHeight - The height of a thumbnail. The width will be calculated from the page aspect ratio.
|
|
1909
|
+
* @returns A thumbnail atlas of the composition as JPEG.
|
|
1910
|
+
*/
|
|
1911
|
+
getPageThumbnailAtlas(id: DesignBlockId, numberOfColumns: number, numberOfRows: number, thumbnailHeight: number): Promise<Blob>;
|
|
1818
1912
|
}
|
|
1819
1913
|
|
|
1820
1914
|
/** @public */
|
|
@@ -1914,6 +2008,13 @@ export declare interface Configuration {
|
|
|
1914
2008
|
* and always create a webgl1 context.
|
|
1915
2009
|
*/
|
|
1916
2010
|
forceWebGL1?: boolean;
|
|
2011
|
+
/**
|
|
2012
|
+
* Whether the engine should automatically choose an audio output device or
|
|
2013
|
+
* should not output audio at all.
|
|
2014
|
+
*
|
|
2015
|
+
* If not configured the fallback value is 'auto'.
|
|
2016
|
+
*/
|
|
2017
|
+
audioOutput?: 'auto' | 'none';
|
|
1917
2018
|
}
|
|
1918
2019
|
|
|
1919
2020
|
/**
|
|
@@ -1978,6 +2079,7 @@ export declare enum DesignBlockType {
|
|
|
1978
2079
|
Page = "//ly.img.ubq/page",
|
|
1979
2080
|
Image = "//ly.img.ubq/image",
|
|
1980
2081
|
Video = "//ly.img.ubq/video",
|
|
2082
|
+
VideoFill = "//ly.img.ubq/fill/video",
|
|
1981
2083
|
Audio = "//ly.img.ubq/audio",
|
|
1982
2084
|
Text = "//ly.img.ubq/text",
|
|
1983
2085
|
Sticker = "//ly.img.ubq/sticker",
|
|
@@ -2038,6 +2140,28 @@ export declare class EditorAPI {
|
|
|
2038
2140
|
* @returns The text cursor's y position in screen space.
|
|
2039
2141
|
*/
|
|
2040
2142
|
getTextCursorPositionInScreenSpaceY(): number;
|
|
2143
|
+
/**
|
|
2144
|
+
* Create a history which consists of an undo/redo stack for editing operations.
|
|
2145
|
+
* There can be multiple. But only one can be active at a time.
|
|
2146
|
+
* @returns The handle of the created history.
|
|
2147
|
+
*/
|
|
2148
|
+
createHistory(): HistoryId;
|
|
2149
|
+
/**
|
|
2150
|
+
* Destroy the given history, throws an error if the handle doesn't refer to a history.
|
|
2151
|
+
* @param history - The history to destroy.
|
|
2152
|
+
*/
|
|
2153
|
+
destroyHistory(history: HistoryId): void;
|
|
2154
|
+
/**
|
|
2155
|
+
* Mark the given history as active, throws an error if the handle doesn't refer to a history.
|
|
2156
|
+
* All other histories get cleared from the active state. Undo/redo operations only apply to the active history.
|
|
2157
|
+
* @param history - The history to make active.
|
|
2158
|
+
*/
|
|
2159
|
+
setActiveHistory(history: HistoryId): void;
|
|
2160
|
+
/**
|
|
2161
|
+
* Get the handle to the currently active history. If there's none it will be created.
|
|
2162
|
+
* @returns History - The handle of the active history.
|
|
2163
|
+
*/
|
|
2164
|
+
getActiveHistory(): HistoryId;
|
|
2041
2165
|
/**
|
|
2042
2166
|
* Adds a new history state to the stack, if undoable changes were made.
|
|
2043
2167
|
*/
|
|
@@ -2062,6 +2186,13 @@ export declare class EditorAPI {
|
|
|
2062
2186
|
* @returns True if a redo step is available.
|
|
2063
2187
|
*/
|
|
2064
2188
|
canRedo(): boolean;
|
|
2189
|
+
/**
|
|
2190
|
+
* Subscribe to changes to the undo/redo history.
|
|
2191
|
+
*
|
|
2192
|
+
* @param callback - This function is called at the end of the engine update, if the undo/redo history has been changed.
|
|
2193
|
+
* @returns A method to unsubscribe
|
|
2194
|
+
*/
|
|
2195
|
+
onHistoryUpdated(callback: () => void): () => void;
|
|
2065
2196
|
/**
|
|
2066
2197
|
* Subscribe to changes to the editor settings.
|
|
2067
2198
|
* @param callback - This function is called at the end of the engine update, if the editor settings have changed.
|
|
@@ -2183,6 +2314,34 @@ export declare class EditorAPI {
|
|
|
2183
2314
|
* @returns `Allow` if the scope is allowed, `Deny` if it is disallowed, and `Defer` if it is deferred to the block-level.
|
|
2184
2315
|
*/
|
|
2185
2316
|
getGlobalScope(key: string): 'Allow' | 'Deny' | 'Defer';
|
|
2317
|
+
/**
|
|
2318
|
+
* Queries the names of currently set spot colors previously set with `setSpotColorRGB`.
|
|
2319
|
+
* @returns The names of set spot colors.
|
|
2320
|
+
*/
|
|
2321
|
+
findAllSpotColors(): string[];
|
|
2322
|
+
/**
|
|
2323
|
+
* Queries the RGB representation set for a spot color.
|
|
2324
|
+
* If the value of the queried spot color has not been set yet, returns the default RGB representation (of magenta).
|
|
2325
|
+
* The alpha value is always 1.0.
|
|
2326
|
+
* @param name - The name of a spot color.
|
|
2327
|
+
* @returns A result holding a float array of the four color components.
|
|
2328
|
+
*/
|
|
2329
|
+
getSpotColorRGBA(name: string): RGBA;
|
|
2330
|
+
/**
|
|
2331
|
+
* Sets the RGB representation of a spot color.
|
|
2332
|
+
* Use this function to both create a new spot color or update an existing spot color.
|
|
2333
|
+
* @param name - The name of a spot color.
|
|
2334
|
+
* @param r - The red color component in the range of 0 to 1.
|
|
2335
|
+
* @param g - The green color component in the range of 0 to 1.
|
|
2336
|
+
* @param b - The blue color component in the range of 0 to 1.
|
|
2337
|
+
*/
|
|
2338
|
+
setSpotColorRGB(name: string, r: number, g: number, b: number): void;
|
|
2339
|
+
/**
|
|
2340
|
+
* Removes a spot color from the list of set spot colors.
|
|
2341
|
+
* @param name - The name of a spot color.
|
|
2342
|
+
* @returns An empty result on success, an error otherwise.
|
|
2343
|
+
*/
|
|
2344
|
+
removeSpotColor(name: string): void;
|
|
2186
2345
|
}
|
|
2187
2346
|
|
|
2188
2347
|
/**
|
|
@@ -2271,7 +2430,7 @@ declare type Extensions = {
|
|
|
2271
2430
|
/**
|
|
2272
2431
|
* @public
|
|
2273
2432
|
*/
|
|
2274
|
-
export declare type FillType = 'Solid' | 'Gradient';
|
|
2433
|
+
export declare type FillType = 'Solid' | 'Gradient' | 'Video';
|
|
2275
2434
|
|
|
2276
2435
|
/** @public */
|
|
2277
2436
|
declare interface FindAssetsQuery {
|
|
@@ -2335,6 +2494,12 @@ declare type Groups = string[];
|
|
|
2335
2494
|
*/
|
|
2336
2495
|
declare type HexColorString = string;
|
|
2337
2496
|
|
|
2497
|
+
/**
|
|
2498
|
+
* A numerical identifier for a history stack
|
|
2499
|
+
* @public
|
|
2500
|
+
*/
|
|
2501
|
+
export declare type HistoryId = number;
|
|
2502
|
+
|
|
2338
2503
|
/** @public */
|
|
2339
2504
|
declare type ImageDefinition = Preset & {
|
|
2340
2505
|
imageURL: string;
|
|
@@ -2589,6 +2754,11 @@ export declare class SceneAPI {
|
|
|
2589
2754
|
* @returns A Promise that resolves once the template was applied or rejects if there was an error.
|
|
2590
2755
|
*/
|
|
2591
2756
|
applyTemplateFromURL(url: string): Promise<void>;
|
|
2757
|
+
/**
|
|
2758
|
+
* Get the current scene mode.
|
|
2759
|
+
* @returns The current mode of the scene.
|
|
2760
|
+
*/
|
|
2761
|
+
getMode(): SceneMode;
|
|
2592
2762
|
/**
|
|
2593
2763
|
* Sets the zoom level of the active scene.
|
|
2594
2764
|
* Only has an effect if the zoom level is not handled by the UI.
|
|
@@ -2621,6 +2791,12 @@ export declare class SceneAPI {
|
|
|
2621
2791
|
* @privateRemarks This will currently fire on _all_ changes to camera properties
|
|
2622
2792
|
*/
|
|
2623
2793
|
onZoomLevelChanged(callback: () => void): () => void;
|
|
2794
|
+
/**
|
|
2795
|
+
* Subscribe to changes to the active scene rendered by the engine.
|
|
2796
|
+
* @param callback - This function is called at the end of the engine update, if the active scene has changed.
|
|
2797
|
+
* @returns A method to unsubscribe.
|
|
2798
|
+
*/
|
|
2799
|
+
onActiveChanged(callback: () => void): () => void;
|
|
2624
2800
|
/**
|
|
2625
2801
|
* Converts all values of the current scene into the given design unit.
|
|
2626
2802
|
* @param designUnit - The new design unit of the scene
|
|
@@ -2633,9 +2809,18 @@ export declare class SceneAPI {
|
|
|
2633
2809
|
unstable_getDesignUnit(): DesignUnit;
|
|
2634
2810
|
}
|
|
2635
2811
|
|
|
2636
|
-
/**
|
|
2812
|
+
/**
|
|
2813
|
+
* The scene layout determines how the layout stack should layout its pages.
|
|
2814
|
+
* @public
|
|
2815
|
+
*/
|
|
2637
2816
|
export declare type SceneLayout = 'Free' | 'VerticalStack' | 'HorizontalStack' | 'DepthStack';
|
|
2638
2817
|
|
|
2818
|
+
/**
|
|
2819
|
+
* The mode of the scene defines how the editor and playback should behave.
|
|
2820
|
+
* @public
|
|
2821
|
+
*/
|
|
2822
|
+
export declare type SceneMode = 'Design' | 'Video';
|
|
2823
|
+
|
|
2639
2824
|
/** @public */
|
|
2640
2825
|
export declare interface Size2 {
|
|
2641
2826
|
width: number;
|
|
@@ -2658,6 +2843,10 @@ export declare interface SpotColor {
|
|
|
2658
2843
|
cmykApproximation: CMYKColor;
|
|
2659
2844
|
}
|
|
2660
2845
|
|
|
2846
|
+
declare interface SpotColorLookup {
|
|
2847
|
+
getSpotColorRGBA(name: string): [r: number, g: number, b: number, a: number];
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2661
2850
|
/** @public */
|
|
2662
2851
|
export declare type StrokeCornerGeometry = 'Bevel' | 'Miter' | 'Round';
|
|
2663
2852
|
|