@cesdk/engine 1.9.2 → 1.10.0-preview.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -6,21 +6,24 @@
6
6
  */
7
7
  export declare interface Asset {
8
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"
9
+ * The unique id of this asset.
11
10
  */
12
11
  id: string;
13
- /** E.g. `ly.img.image` */
14
12
  /** Groups of the asset. */
15
13
  groups?: Groups;
16
- /** URI to a thumbnail of the asset used e.g. in the content library UI */
17
- thumbUri: string;
18
-
19
14
  /** Asset-specific and custom meta information */
20
15
  meta?: {
16
+ /** The mime type of this asset or the data behind the asset's uri. */
17
+ mimeType?: string;
18
+ /** The type id of the design block that should be created from this asset. */
19
+ blockType?: string;
21
20
  uri?: string;
21
+ thumbUri?: string;
22
+ previewUri?: string;
22
23
  filename?: string;
23
24
  vectorPath?: string;
25
+ width?: number;
26
+ height?: number;
24
27
  duration?: string;
25
28
  } & Record<string, unknown>;
26
29
  }
@@ -36,6 +39,16 @@ export declare class AssetAPI {
36
39
  * @param source - The asset source.
37
40
  */
38
41
  addSource(source: AssetSource): void;
42
+ /**
43
+ * Adds a local asset source. Its ID has to be unique.
44
+ * @param source - The asset source.
45
+ * @param supportedMimeTypes - The mime types of assets that are allowed to be added to this local source.
46
+ * @param applyAsset - An optional callback that can be used to override the default behavior of applying a given
47
+ * asset result to the active scene.
48
+ * @param applyAssetToBlock - An optional callback that can be used to override the default behavior of applying
49
+ * an asset result to a given block.
50
+ */
51
+ addLocalSource(id: string, supportedMimeTypes?: string[], applyAsset?: (asset: AssetResult) => Promise<DesignBlockId | undefined>, applyAssetToBlock?: (asset: AssetResult, block: DesignBlockId) => Promise<void>): void;
39
52
  /**
40
53
  * Removes an asset source with the given ID.
41
54
  * @param id - The ID to refer to the asset source.
@@ -59,6 +72,7 @@ export declare class AssetAPI {
59
72
  * @returns The asset groups.
60
73
  */
61
74
  getGroups(id: string): Promise<string[]>;
75
+ getSupportedMimeTypes(sourceId: string): string[];
62
76
  /**
63
77
  * Queries the asset source's credits info.
64
78
  * @param sourceId - The ID of the asset source.
@@ -78,8 +92,18 @@ export declare class AssetAPI {
78
92
  url: string | undefined;
79
93
  } | undefined;
80
94
  canManageAssets(sourceId: string): boolean;
81
-
82
-
95
+ /**
96
+ * Adds the given asset to a local asset source.
97
+ * @param sourceId - The local asset source ID that the asset should be added to.
98
+ * @param asset - The asset to be added to the asset source.
99
+ */
100
+ addAssetToSource(sourceId: string, asset: AssetDefinition): void;
101
+ /**
102
+ * Removes the specified asset from its local asset source.
103
+ * @param sourceId - The id of the local asset source that currently contains the asset.
104
+ * @param assetId - The id of the asset to be removed.
105
+ */
106
+ removeAssetFromSource(sourceId: string, assetId: string): void;
83
107
 
84
108
 
85
109
  /**
@@ -89,7 +113,7 @@ export declare class AssetAPI {
89
113
  * @param sourceId - The ID of the asset source.
90
114
  * @param assetResult - A single assetResult of a `findAssets` query.
91
115
  */
92
- apply(sourceId: string, assetResult: AssetResult): Promise<void>;
116
+ apply(sourceId: string, assetResult: AssetResult): Promise<DesignBlockId | undefined>;
93
117
  /**
94
118
  * Apply an asset result to the given block.
95
119
  * @param sourceId - The ID of the asset source.
@@ -102,7 +126,7 @@ export declare class AssetAPI {
102
126
  * This implementation is used when no `applyAsset` function is provided to `addSource`.
103
127
  * @param assetResult - A single assetResult of a `findAssets` query.
104
128
  */
105
- defaultApplyAsset(assetResult: AssetResult): Promise<void>;
129
+ defaultApplyAsset(assetResult: AssetResult): Promise<DesignBlockId | undefined>;
106
130
  /**
107
131
  * The default implementation for applying an asset to an existing block.
108
132
  * @param assetResult - A single assetResult of a `findAssets` query.
@@ -113,7 +137,7 @@ export declare class AssetAPI {
113
137
  }
114
138
 
115
139
  /**
116
- * Definition of an assets used if an asset is added to an asset source.
140
+ * Definition of an asset used if an asset is added to an asset source.
117
141
  * @public
118
142
  */
119
143
  export declare interface AssetDefinition extends Asset {
@@ -197,13 +221,6 @@ export declare interface AssetResult extends Asset {
197
221
  declare interface AssetResult_2 {
198
222
  /** A unique id of this asset */
199
223
  id: string;
200
- /** URI to a thumbnail of the asset used e.g. in the content library UI */
201
- thumbUri: string;
202
- /** Original size of the asset. */
203
- size: {
204
- width: number;
205
- height: number;
206
- };
207
224
  /** Asset-specific and custom meta information */
208
225
  meta?: {
209
226
  uri?: string;
@@ -271,16 +288,17 @@ export declare interface AssetSource {
271
288
  */
272
289
  getAsset?(id: string): Promise<AssetResult | undefined>;
273
290
  /**
274
- * Can the source add, update and remove assets dynamically? If `false`
275
- * methods like `addAsset` `updateAsset` and `removeAsset` will throw an
291
+ * Can the source add and remove assets dynamically? If `false`
292
+ * methods like `addAsset` and `removeAsset` will throw an
276
293
  * error.
277
294
  */
278
295
  canManageAssets?: boolean;
279
296
  /**
280
297
  * Apply the given asset result to the active scene.
281
298
  * You can override this with custom behavior.
299
+ * @returns the id of a new block if one was created from the asset.
282
300
  */
283
- applyAsset?: (asset: AssetResult) => Promise<void>;
301
+ applyAsset?: (asset: AssetResult) => Promise<DesignBlockId | undefined>;
284
302
  /**
285
303
  * Apply the given asset result to the given block.
286
304
  * You can override this with custom behavior.
@@ -290,16 +308,8 @@ export declare interface AssetSource {
290
308
  * Adds the given asset to this source. Throws an error if `canManageAssets`
291
309
  * is `false`.
292
310
  *
293
- * @returns the id of the added asset
294
- */
295
- addAsset?(asset: AssetDefinition): Promise<string>;
296
- /**
297
- * Updates the asset of this source. Throws an error if `canManageAssets`
298
- * is `false` or no asset with the given id could not be found.
299
- *
300
- * @returns the id of the added asset
301
311
  */
302
- updateAsset?(assetId: string, asset: AssetDefinition): Promise<void>;
312
+ addAsset?(asset: AssetDefinition): void;
303
313
  /**
304
314
  * Removes the given asset from this source.
305
315
  *
@@ -325,7 +335,7 @@ declare interface AssetSource_2 {
325
335
  * Apply the given asset result to the active scene.
326
336
  * You can override this with custom behavior.
327
337
  */
328
- applyAsset?: (asset: AssetResult_2) => Promise<void>;
338
+ applyAsset?: (asset: AssetResult_2) => Promise<DesignBlockId | undefined>;
329
339
  /**
330
340
  * Apply the given asset result to the given block.
331
341
  * You can override this with custom behavior.
@@ -417,20 +427,36 @@ export declare class Block extends Entity {
417
427
  playing: ReadWriteChannelSync<boolean>;
418
428
  playbackTime: ReadWriteChannelSync<number>;
419
429
  selection: ReadWriteChannelSync<boolean>;
420
- sceneMode: ReadWriteChannelSync<SceneMode>;
421
430
  duration: ReadWriteChannelSync<number>;
422
- totalSceneDuration: ReadWriteChannelSync<number>;
423
431
  name: ReadWriteChannelSync<string>;
424
- audioMuted: ReadWriteChannelSync<boolean>;
425
- videoMuted: ReadWriteChannelSync<boolean>;
426
432
  avResourceTotalDuration: ReadWriteChannelSync<number>;
427
433
  timeOffset: ReadWriteChannelSync<number>;
428
434
  cropTranslationX: ReadWriteChannelSync<number>;
429
435
  cropTranslationY: ReadWriteChannelSync<number>;
430
436
  cropTranslation: ReadWriteChannelSync<Vec2>;
437
+ cropScaleRatio: ReadWriteChannelSync<number>;
438
+ cropRotation: ReadWriteChannelSync<number>;
439
+ cropScaleX: ReadWriteChannelSync<number>;
440
+ cropScaleY: ReadWriteChannelSync<number>;
431
441
  width: ReadWriteChannelSync<number>;
432
442
  height: ReadWriteChannelSync<number>;
433
443
  dimensions: ReadWriteChannelSync<Vec2>;
444
+ contentFillMode: ReadWriteChannelSync<ContentFillMode>;
445
+ designStyleScope: ReadWriteChannelSync<boolean>;
446
+ designArrangeScope: ReadWriteChannelSync<boolean>;
447
+ designArrangeScopeMove: ReadWriteChannelSync<boolean>;
448
+ designArrangeScopeResize: ReadWriteChannelSync<boolean>;
449
+ designArrangeScopeRotate: ReadWriteChannelSync<boolean>;
450
+ designArrangeScopeFlip: ReadWriteChannelSync<boolean>;
451
+ contentReplaceScope: ReadWriteChannelSync<boolean>;
452
+ lifecycleDestroyScope: ReadWriteChannelSync<boolean>;
453
+ lifecycleDuplicateScope: ReadWriteChannelSync<boolean>;
454
+ editorAddScope: ReadWriteChannelSync<boolean>;
455
+ editorInspectScope: ReadWriteChannelSync<boolean>;
456
+ editorPresentScope: ReadWriteChannelSync<boolean>;
457
+ editorManagePagesScope: ReadWriteChannelSync<boolean>;
458
+ editorSelectScope: ReadWriteChannelSync<boolean>;
459
+ editorZoomScope: ReadWriteChannelSync<boolean>;
434
460
 
435
461
 
436
462
  }
@@ -479,6 +505,7 @@ export declare class BlockAPI {
479
505
  /**
480
506
  * Loads existing blocks from the given string.
481
507
  * The blocks are not attached by default and won't be visible until attached to a page or the scene.
508
+ * The UUID of the loaded blocks is replaced with a new one.
482
509
  * @param content - A string representing the given blocks.
483
510
  * @returns A promise that resolves with a list of handles representing the found blocks or an error.
484
511
  */
@@ -502,13 +529,17 @@ export declare class BlockAPI {
502
529
  * @returns The created fill's handle.
503
530
  */
504
531
  createFill(type: string): DesignBlockId;
505
-
506
532
  /**
507
533
  * Get the type of the given block, fails if the block is invalid.
508
534
  * @param id - The block to query.
509
535
  * @returns The blocks type.
510
536
  */
511
537
  getType(id: DesignBlockId): DesignBlockType;
538
+ /**
539
+ * Selects the given block and deselects all other blocks.
540
+ * @param id - The block to be selected.
541
+ */
542
+ select(id: DesignBlockId): void;
512
543
  /**
513
544
  * Update the selection state of a block.
514
545
  * Fails for invalid blocks.
@@ -773,15 +804,29 @@ export declare class BlockAPI {
773
804
  */
774
805
  setContentFillMode(id: DesignBlockId, mode: ContentFillMode): void;
775
806
  /**
776
- * Get a block's layout width. The layout width is only available after an
777
- * internal update loop, which may not happen immediately.
807
+ * Get a block's layout position on the x-axis. The position is only available after an
808
+ * internal update loop which only occurs if the `features/implicitUpdatesEnabled` setting is set.
809
+ * @param id - The block to query.
810
+ * @returns The layout position on the x-axis.
811
+ */
812
+ getFrameX(id: DesignBlockId): number;
813
+ /**
814
+ * Get a block's layout position on the y-axis. The position is only available after an
815
+ * internal update loop which only occurs if the `features/implicitUpdatesEnabled` setting is set.
816
+ * @param id - The block to query.
817
+ * @returns The layout position on the y-axis.
818
+ */
819
+ getFrameY(id: DesignBlockId): number;
820
+ /**
821
+ * Get a block's layout width. The width is only available after an
822
+ * internal update loop which only occurs if the `features/implicitUpdatesEnabled` setting is set.
778
823
  * @param id - The block to query.
779
824
  * @returns The layout width.
780
825
  */
781
826
  getFrameWidth(id: DesignBlockId): number;
782
827
  /**
783
- * Get a block's layout height. The layout height is only available after an
784
- * internal update loop, which may not happen immediately.
828
+ * Get a block's layout height. The height is only available after an
829
+ * internal update loop which only occurs if the `features/implicitUpdatesEnabled` setting is set.
785
830
  * @param id - The block to query.
786
831
  * @returns The layout height.
787
832
  */
@@ -1908,6 +1953,48 @@ export declare class BlockAPI {
1908
1953
  * @returns Whether solo playback is enabled for this block.
1909
1954
  */
1910
1955
  isSoloPlaybackEnabled(id: DesignBlockId): boolean;
1956
+ /**
1957
+ * Returns whether the block supports a playback control.
1958
+ * @param block - The block to query.
1959
+ * @returns Whether the block has playback control.
1960
+ */
1961
+ hasPlaybackControl(id: DesignBlockId): boolean;
1962
+ /**
1963
+ * Set whether the block should start from the beginning again or stop.
1964
+ * @param block - The block or video fill to update.
1965
+ * @param looping - Whether the block should loop to the beginning or stop.
1966
+ */
1967
+ setLooping(id: DesignBlockId, looping: boolean): void;
1968
+ /**
1969
+ * Query whether the block is looping.
1970
+ * @param block - The block to query.
1971
+ * @returns Whether the block is looping.
1972
+ */
1973
+ isLooping(id: DesignBlockId): boolean;
1974
+ /**
1975
+ * Set whether the audio of the block is muted.
1976
+ * @param block - The block or video fill to update.
1977
+ * @param muted - Whether the audio should be muted.
1978
+ */
1979
+ setMuted(id: DesignBlockId, muted: boolean): void;
1980
+ /**
1981
+ * Query whether the block is muted.
1982
+ * @param block - The block to query.
1983
+ * @returns Whether the block is muted.
1984
+ */
1985
+ isMuted(id: DesignBlockId): boolean;
1986
+ /**
1987
+ * Set the audio volume of the given block.
1988
+ * @param block - The block or video fill to update.
1989
+ * @param volume - The desired volume with a range of [0, 1].
1990
+ */
1991
+ setVolume(id: DesignBlockId, volume: number): void;
1992
+ /**
1993
+ * Get the audio volume of the given block.
1994
+ * @param block - The block to query.
1995
+ * @returns The volume with a range of [0, 1].
1996
+ */
1997
+ getVolume(id: DesignBlockId): number;
1911
1998
  /**
1912
1999
  * Begins loading the required audio and video resource for the given video fill or audio block.
1913
2000
  * @param id - The video fill or audio block whose resource should be loaded.
@@ -1987,8 +2074,7 @@ declare type Callbacks = {
1987
2074
  * data source. Calling this method returns an `unsubscribe` method.
1988
2075
  * * An (optional) `update` method to update the data source
1989
2076
  * * An (optional) synchronous `value` method that can be used to retrieve
1990
- * the current value or a sensible initial value without waiting for a
1991
- * potentially asynchronous value coming through the stream.
2077
+ * the current value.
1992
2078
  * @public
1993
2079
  */
1994
2080
  export declare interface Channel<Out, In = Out> {
@@ -1998,7 +2084,7 @@ export declare interface Channel<Out, In = Out> {
1998
2084
  }
1999
2085
 
2000
2086
  /**
2001
- * A {@link Channel} that is guaranteed to have a `value`
2087
+ * A {@link Channel} that is guaranteed to have a `value` method
2002
2088
  * @public
2003
2089
  */
2004
2090
  export declare interface ChannelSync<Out, In = Out> extends Channel<Out, In> {
@@ -2056,7 +2142,7 @@ declare namespace ConfigTypes {
2056
2142
  Variables,
2057
2143
  Core,
2058
2144
  Extensions,
2059
- Scene,
2145
+ Scene_2 as Scene,
2060
2146
  Page,
2061
2147
  Callbacks
2062
2148
  }
@@ -2378,6 +2464,16 @@ export declare class EditorAPI {
2378
2464
  * @returns The value as string.
2379
2465
  */
2380
2466
  getSettingEnum(keypath: string): string;
2467
+ /**
2468
+ * Get the currently available memory in bytes.
2469
+ * @returns The currently available memory in bytes.
2470
+ */
2471
+ getAvailableMemory(): number;
2472
+ /**
2473
+ * Get the current memory usage of the engine in bytes.
2474
+ * @returns The current memory usage in bytes.
2475
+ */
2476
+ getUsedMemory(): number;
2381
2477
  /**
2382
2478
  * Sets a custom URI resolver.
2383
2479
  * This function can be called more than once. Subsequent calls will overwrite previous calls.
@@ -2474,6 +2570,7 @@ export declare class Entity {
2474
2570
  get id(): number;
2475
2571
  Int(property: string): ReadWriteChannelSync<number>;
2476
2572
  Float(property: string): ReadWriteChannelSync<number>;
2573
+ Bool(property: string): ReadWriteChannelSync<boolean>;
2477
2574
  }
2478
2575
 
2479
2576
  /** @public */
@@ -2482,7 +2579,6 @@ export declare class EntityChannels<T extends Entity> {
2482
2579
 
2483
2580
 
2484
2581
 
2485
- constant<V>(constantValue: V): ReadWriteChannelSync<V>;
2486
2582
  dispose(): void;
2487
2583
  }
2488
2584
 
@@ -2720,6 +2816,14 @@ declare type Page = {
2720
2816
  dimOutOfPageAreas?: boolean;
2721
2817
  };
2722
2818
 
2819
+ /** @public */
2820
+ export declare interface PageDuration {
2821
+ pageId: DesignBlockId;
2822
+ duration: number;
2823
+ start: number;
2824
+ end: number;
2825
+ }
2826
+
2723
2827
  /** @public */
2724
2828
  declare type PageFormatDefinition = Preset & {
2725
2829
  width: number;
@@ -2799,7 +2903,7 @@ export declare interface ReadWriteChannel<Out, In = Out> extends Channel<Out, In
2799
2903
  }
2800
2904
 
2801
2905
  /**
2802
- * A {@link ReadWriteChannel} that is guaranteed to have a `value`
2906
+ * A {@link ReadWriteChannel} that is guaranteed to have a `value` and an `update` method
2803
2907
  * @public
2804
2908
  */
2805
2909
  export declare interface ReadWriteChannelSync<Out, In = Out> extends ChannelSync<Out, In>, ReadWriteChannel<Out, In> {
@@ -2850,11 +2954,31 @@ export declare interface RGBColor {
2850
2954
  /** @public */
2851
2955
  export declare type RoleString = 'Creator' | 'Adopter' | 'Viewer' | 'Presenter';
2852
2956
 
2957
+ /**
2958
+ * Contains channels for scene-specific information that are valid through
2959
+ * scene changes.
2960
+ * @public
2961
+ */
2962
+ export declare class Scene {
2963
+ constructor(ubq: UBQ, blockChannels: BlockChannels);
2964
+ /**
2965
+ * A channel containing the latest Block.
2966
+ * Will emit an event when the scene changes
2967
+ */
2968
+ block: ChannelSync<Block | undefined>;
2969
+ mode: ChannelSync<SceneMode | undefined>;
2970
+ totalDuration: ChannelSync<number>;
2971
+ pages: ChannelSync<DesignBlockId[]> & EngineChannel<DesignBlockId[]>;
2972
+ playing: ReadWriteChannelSync<boolean>;
2973
+ playbackTime: ReadWriteChannelSync<number>;
2974
+ pageDurations: ChannelSync<PageDuration[]> & EngineChannel<PageDuration[]>;
2975
+ }
2976
+
2853
2977
  /**
2854
2978
  * Export Settings
2855
2979
  * @public
2856
2980
  */
2857
- declare type Scene = {
2981
+ declare type Scene_2 = {
2858
2982
  /**
2859
2983
  * The DPI value to use when exporting and when converting between pixels and inches or millimeter units.
2860
2984
  * (In the CESDK, this value is synonymous with PPI).
@@ -2954,6 +3078,11 @@ export declare class SceneAPI {
2954
3078
  * @returns The current mode of the scene.
2955
3079
  */
2956
3080
  getMode(): SceneMode;
3081
+ /**
3082
+ * Get the sorted list of pages in the scene.
3083
+ * @returns The sorted list of pages in the scene.
3084
+ */
3085
+ getPages(): DesignBlockId[];
2957
3086
  /**
2958
3087
  * Sets the zoom level of the active scene.
2959
3088
  * Only has an effect if the zoom level is not handled by the UI.
@@ -3023,11 +3152,11 @@ export declare type SceneMode = 'Design' | 'Video';
3023
3152
  export declare class SelectionChannel implements ReadWriteChannelSync<number[]> {
3024
3153
  #private;
3025
3154
  subscribe: Source<number[]>;
3155
+ update: (selectedDesignElements: number[]) => void;
3156
+ value: () => number[];
3026
3157
 
3027
3158
  private deselectAll;
3028
3159
  private selectAll;
3029
- update: (selectedDesignElements: number[]) => void;
3030
- value: () => number[];
3031
3160
  }
3032
3161
 
3033
3162
  /** @public */
@@ -3180,11 +3309,10 @@ export declare interface Vec4 {
3180
3309
  * @public
3181
3310
  */
3182
3311
  export declare class ZoomLevelChannel implements ReadWriteChannelSync<number> {
3183
- #private;
3184
3312
  subscribe: Source<number>;
3185
-
3186
3313
  update: (zoomLevel: number) => void;
3187
3314
  value: () => number;
3315
+
3188
3316
  }
3189
3317
 
3190
3318
  export { }