@cesdk/engine 1.31.0-rc.3 → 1.32.0-rc.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
@@ -42,6 +42,8 @@ export declare interface Asset {
42
42
  export declare class AssetAPI {
43
43
  #private;
44
44
 
45
+
46
+
45
47
  /**
46
48
  * Adds a custom asset source. Its ID has to be unique.
47
49
  * @param source - The asset source.
@@ -132,6 +134,7 @@ export declare class AssetAPI {
132
134
  * @param block - The block the asset should be applied to.
133
135
  */
134
136
  applyToBlock(sourceId: string, assetResult: AssetResult, block: DesignBlockId): Promise<void>;
137
+ unstable_applyProperty(sourceId: string, assetResult: AssetResult, property: AssetProperty): Promise<void>;
135
138
  /**
136
139
  * The default implementation for applying an asset to the scene.
137
140
  * This implementation is used when no `applyAsset` function is provided to `addSource`.
@@ -156,9 +159,31 @@ export declare class AssetAPI {
156
159
  * @returns A method to unsubscribe.
157
160
  */
158
161
  onAssetSourceRemoved: (callback: (sourceID: string) => void) => (() => void);
162
+ /**
163
+ * Register a callback to be called every time an asset source's contents are changed.
164
+ * @param callback - The function that is called whenever an asset source is updated.
165
+ * @returns A method to unsubscribe.
166
+ */
167
+ onAssetSourceUpdated: (callback: (sourceID: string) => void) => (() => void);
168
+ /**
169
+ * Notifies the engine that the contents of an asset source changed.
170
+ * @param sourceID - The asset source whose contents changed.
171
+ */
172
+ assetSourceContentsChanged(sourceID: string): void;
159
173
 
160
174
  }
161
175
 
176
+ /**
177
+ * Asset boolean property definition
178
+ * @public
179
+ */
180
+ export declare interface AssetBooleanProperty {
181
+ property: string;
182
+ type: 'Boolean';
183
+ value: boolean;
184
+ defaultValue: boolean;
185
+ }
186
+
162
187
  /**
163
188
  * Asset Color payload CMYK representation
164
189
  * @public
@@ -177,6 +202,17 @@ export declare interface AssetCMYKColor {
177
202
  */
178
203
  export declare type AssetColor = AssetRGBColor | AssetCMYKColor | AssetSpotColor;
179
204
 
205
+ /**
206
+ * Asset color property definition
207
+ * @public
208
+ */
209
+ export declare interface AssetColorProperty {
210
+ property: string;
211
+ type: 'Color';
212
+ value: AssetColor;
213
+ defaultValue: AssetColor;
214
+ }
215
+
180
216
  /**
181
217
  * Definition of an asset used if an asset is added to an asset source.
182
218
  * @public
@@ -196,6 +232,18 @@ export declare interface AssetDefinition extends Asset {
196
232
  tags?: Record<Locale, string[]>;
197
233
  }
198
234
 
235
+ /**
236
+ * Asset enum property definition
237
+ * @public
238
+ */
239
+ export declare interface AssetEnumProperty {
240
+ property: string;
241
+ type: 'Enum';
242
+ value: string;
243
+ defaultValue: string;
244
+ options: string[];
245
+ }
246
+
199
247
  /**
200
248
  * An asset can be member of multiple groups. Groups have a semantic meaning
201
249
  * used to build and group UIs exploring the assets, e.g.sections in the
@@ -232,6 +280,20 @@ export declare type AssetMetaData = {
232
280
  blurType?: BlurType;
233
281
  } & Record<string, unknown>;
234
282
 
283
+ /**
284
+ * Asset number property definition
285
+ * @public
286
+ */
287
+ export declare interface AssetNumberProperty {
288
+ property: string;
289
+ type: 'Integer' | 'Float' | 'Double';
290
+ value: number;
291
+ defaultValue: number;
292
+ min: number;
293
+ max: number;
294
+ step: number;
295
+ }
296
+
235
297
  /**
236
298
  * Asset payload
237
299
  * @public
@@ -240,8 +302,15 @@ export declare interface AssetPayload {
240
302
  color?: AssetColor;
241
303
  sourceSet?: Source[];
242
304
  typeface?: Typeface;
305
+ properties?: AssetProperty[];
243
306
  }
244
307
 
308
+ /**
309
+ * Asset property for payload
310
+ * @public
311
+ */
312
+ export declare type AssetProperty = AssetBooleanProperty | AssetColorProperty | AssetEnumProperty | AssetNumberProperty | AssetStringProperty;
313
+
245
314
  /**
246
315
  * Defines a request for querying assets
247
316
  * @public
@@ -280,6 +349,10 @@ export declare interface AssetQueryData {
280
349
  * If empty, the assets are sorted by the index.
281
350
  */
282
351
  sortKey?: string;
352
+ /**
353
+ * Sort assets that are marked as active first.
354
+ */
355
+ sortActiveFirst?: boolean;
283
356
  }
284
357
 
285
358
  /**
@@ -293,6 +366,8 @@ export declare interface AssetResult extends Asset {
293
366
  label?: string;
294
367
  /** The tags of this asset. Used for filtering and free-text searching. */
295
368
  tags?: string[];
369
+ /** If the asset is marked as active, i.e., used in a currently selected element. */
370
+ active?: boolean;
296
371
  /** Credits for the artist of the asset */
297
372
  credits?: {
298
373
  name: string;
@@ -422,6 +497,17 @@ export declare interface AssetsQueryResult<T extends AssetResult = AssetResult>
422
497
 
423
498
  declare type _AssetsQueryResult = AssetsQueryResult;
424
499
 
500
+ /**
501
+ * Asset string property definition
502
+ * @public
503
+ */
504
+ export declare interface AssetStringProperty {
505
+ property: string;
506
+ type: 'String';
507
+ value: string;
508
+ defaultValue: string;
509
+ }
510
+
425
511
  /**
426
512
  * @public
427
513
  */
@@ -2768,7 +2854,7 @@ export declare type BlockState = BlockStateError | BlockStatePending | BlockStat
2768
2854
  /** @public There's an error preventing rendering. */
2769
2855
  export declare interface BlockStateError {
2770
2856
  type: 'Error';
2771
- error: 'AudioDecoding' | 'FileDecoding' | 'FileFetch' | 'Unknown' | 'VideoDecoding';
2857
+ error: 'AudioDecoding' | 'ImageDecoding' | 'FileFetch' | 'Unknown' | 'VideoDecoding';
2772
2858
  }
2773
2859
 
2774
2860
  /** @public There is an ongoing operation on the block. Rendering may be affected. */
@@ -2918,6 +3004,8 @@ export declare interface CompleteAssetResult extends AssetResult {
2918
3004
  context: {
2919
3005
  sourceId: string;
2920
3006
  };
3007
+ /** This is optional in `AssetResult` but always present here */
3008
+ active: boolean;
2921
3009
  }
2922
3010
 
2923
3011
  /**
@@ -3240,22 +3328,9 @@ declare class CreativeEngine {
3240
3328
 
3241
3329
 
3242
3330
  /**
3243
- * Add a plugin to the engine. If a plugin URL is provided, the plugin will be
3244
- * loaded from that URL. Otherwise, the argument is expected to be a valid plugin
3245
- *
3246
- * A plugin can have the following methods:
3247
- * - `initialize` - Called once when the plugin is added to the engine
3248
- * - `update` - Called every frame
3249
- *
3250
- * PLEASE NOTE: Only Plugins provded via URL will be executed in the worker, e.g.
3251
- * during the video export the update method will be called.
3252
- *
3253
- * Please be aware that this is experimental right now. This API can change or
3254
- * be replaced or even removed completely in future versions.
3331
+ * Adds and initializes a plugin to the engine.
3255
3332
  */
3256
- unstable_addPlugin(plugin: EnginePlugin & {
3257
- url?: string;
3258
- }): Promise<void>;
3333
+ addPlugin(plugin: EnginePlugin): void;
3259
3334
  /**
3260
3335
  * Some browsers exhibit a bug where support for certain video codecs is
3261
3336
  * offered, but when attempting to decode or encode in these codecs, the
@@ -3268,6 +3343,7 @@ declare class CreativeEngine {
3268
3343
  */
3269
3344
  unstable_setVideoExportInactivityTimeout(timeout: number): void;
3270
3345
 
3346
+
3271
3347
  /**
3272
3348
  * Install the mousewheel event handler for the CreativeEngine on a different
3273
3349
  * element than the canvas.
@@ -3341,7 +3417,6 @@ declare class CreativeEngine {
3341
3417
  }): Promise<void>;
3342
3418
 
3343
3419
 
3344
-
3345
3420
  }
3346
3421
  export default CreativeEngine;
3347
3422
 
@@ -3411,6 +3486,9 @@ export declare type DesignBlockTypeShorthand = 'scene' | 'stack' | 'camera' | 'p
3411
3486
  */
3412
3487
  export declare type DesignUnit = 'Pixel' | 'Millimeter' | 'Inch';
3413
3488
 
3489
+ /** @public */
3490
+ export declare type EditMode = 'Transform' | 'Crop' | 'Text' | 'Playback' | 'Trim' | (string & {});
3491
+
3414
3492
  /**
3415
3493
  * @public
3416
3494
  */
@@ -3432,15 +3510,15 @@ export declare class EditorAPI {
3432
3510
  * Set the edit mode of the editor.
3433
3511
  * An edit mode defines what type of content can currently be edited by the user.
3434
3512
  * Hint: the initial edit mode is "Transform".
3435
- * @param mode - "Transform", "Crop", "Text", "Playback", or a custom value.
3513
+ * @param mode - "Transform", "Crop", "Text", "Playback", "Trim" or a custom value.
3436
3514
  */
3437
- setEditMode(mode: 'Transform' | 'Crop' | 'Text' | 'Playback' | string): void;
3515
+ setEditMode(mode: EditMode): void;
3438
3516
  /**
3439
3517
  * Get the current edit mode of the editor.
3440
3518
  * An edit mode defines what type of content can currently be edited by the user.
3441
- * @returns "Transform", "Crop", "Text", "Playback", or a custom value.
3519
+ * @returns "Transform", "Crop", "Text", "Playback", "Trim" or a custom value.
3442
3520
  */
3443
- getEditMode(): 'Transform' | 'Crop' | 'Text' | 'Playback' | string;
3521
+ getEditMode(): EditMode;
3444
3522
  /**
3445
3523
  * Get the type of cursor that should be displayed by the application.
3446
3524
  * @returns The cursor type.
@@ -3845,6 +3923,14 @@ export declare class EditorAPI {
3845
3923
  getBufferLength(uri: string): number;
3846
3924
 
3847
3925
 
3926
+ /**
3927
+ * Returns the mimetype of the resources at the given URI.
3928
+ * If the resource is not already downloaded, this function will download it.
3929
+ * @param uri - The URI of the resource.
3930
+ * @returns The mimetype of the resource.
3931
+ * @throws An error if the resource could not be downloaded or the mimetype could not be determined.
3932
+ */
3933
+ getMimeType(uri: string): Promise<string>;
3848
3934
  }
3849
3935
 
3850
3936
  /**
@@ -3870,10 +3956,23 @@ export declare type EffectTypeShorthand = 'adjustments' | 'cross_cut' | 'dot_pat
3870
3956
 
3871
3957
  /** @public */
3872
3958
  export declare interface EnginePlugin {
3873
- initialize?: (context: PluginContext) => void;
3874
- update?: (context: PluginContext) => void;
3959
+ name: string;
3960
+ version: string;
3961
+ initialize: (context: EnginePluginContext) => void;
3875
3962
  }
3876
3963
 
3964
+ /** @public */
3965
+ export declare type EnginePluginContext = {
3966
+ engine: {
3967
+ asset: AssetAPI;
3968
+ block: BlockAPI;
3969
+ scene: SceneAPI;
3970
+ editor: EditorAPI;
3971
+ event: EventAPI;
3972
+ variable: VariableAPI;
3973
+ };
3974
+ };
3975
+
3877
3976
  /**
3878
3977
  * @public
3879
3978
  */
@@ -4013,6 +4112,7 @@ declare interface FindAssetsQuery {
4013
4112
  locale: string;
4014
4113
  sortingOrder: SortingOrder;
4015
4114
  sortKey: string;
4115
+ sortActiveFirst: boolean;
4016
4116
  }
4017
4117
 
4018
4118
  /** @public */
@@ -4117,6 +4217,24 @@ export declare interface HTMLCreativeEngineCanvasElement extends HTMLElement {
4117
4217
  clear(): void;
4118
4218
  }
4119
4219
 
4220
+ /**
4221
+ * Type guard for {@link CMYKColor}
4222
+ * @public
4223
+ */
4224
+ export declare function isCMYKColor(color: Color): color is CMYKColor;
4225
+
4226
+ /**
4227
+ * Type guard for {@link RGBAColor}
4228
+ * @public
4229
+ */
4230
+ export declare function isRGBAColor(color: Color): color is RGBAColor;
4231
+
4232
+ /**
4233
+ * Type guard for {@link SpotColor}
4234
+ * @public
4235
+ */
4236
+ export declare function isSpotColor(color: Color): color is SpotColor;
4237
+
4120
4238
  /**
4121
4239
  * e.g. `en`, `de`, etc.
4122
4240
  * @public
@@ -4203,15 +4321,6 @@ export declare interface PageDuration {
4203
4321
  */
4204
4322
  export declare type PaletteColor = HexColorString | RGBColor | RGBAColor | SpotColor;
4205
4323
 
4206
- declare type PluginContext = {
4207
- asset: AssetAPI;
4208
- block: BlockAPI;
4209
- scene: SceneAPI;
4210
- editor: EditorAPI;
4211
- event: EventAPI;
4212
- variable: VariableAPI;
4213
- };
4214
-
4215
4324
  /**
4216
4325
  * - Absolute: Position in absolute design units.
4217
4326
  * - Percent: Position in relation to the block's parent's size in percent, where 1.0 means 100%.
@@ -4605,7 +4714,7 @@ export declare type SceneMode = 'Design' | 'Video';
4605
4714
  /**
4606
4715
  * @public
4607
4716
  */
4608
- export declare type Scope = 'text/edit' | 'text/character' | 'fill/change' | 'fill/changeType' | 'stroke/change' | 'shape/change' | 'layer/move' | 'layer/resize' | 'layer/rotate' | 'layer/flip' | 'layer/crop' | 'layer/opacity' | 'layer/blendMode' | 'layer/visibility' | 'layer/clipping' | 'appearance/adjustments' | 'appearance/filter' | 'appearance/effect' | 'appearance/blur' | 'appearance/shadow' | 'lifecycle/destroy' | 'lifecycle/duplicate' | 'editor/add' | 'editor/select';
4717
+ export declare type Scope = 'text/edit' | 'text/character' | 'fill/change' | 'fill/changeType' | 'stroke/change' | 'shape/change' | 'layer/move' | 'layer/resize' | 'layer/rotate' | 'layer/flip' | 'layer/crop' | 'layer/opacity' | 'layer/blendMode' | 'layer/visibility' | 'layer/clipping' | 'appearance/adjustments' | 'appearance/filter' | 'appearance/effect' | 'appearance/blur' | 'appearance/shadow' | 'appearance/animation' | 'lifecycle/destroy' | 'lifecycle/duplicate' | 'editor/add' | 'editor/select';
4609
4718
 
4610
4719
  /** @public */
4611
4720
  export declare type SettingsBool = 'controlGizmo/showCropHandles' | 'controlGizmo/showCropScaleHandles' | 'controlGizmo/showResizeHandles' | 'controlGizmo/showRotateHandles' | 'controlGizmo/showScaleHandles' | 'doubleClickToCropEnabled' | 'features/singlePageModeEnabled' | 'features/pageCarouselEnabled' | 'mouse/enableScroll' | 'mouse/enableZoom' | 'checkScopesInAPIs' | 'page/dimOutOfPageAreas' | 'page/title/appendPageName' | 'page/title/show' | 'page/title/showOnSinglePage' | 'page/title/showPageTitleTemplate' | 'placeholderControls/showButton' | 'placeholderControls/showOverlay' | 'blockAnimations/enabled' | 'showBuildVersion' | 'touch/dragStartCanSelect' | 'touch/singlePointPanning';
@@ -4825,14 +4934,6 @@ export declare interface Vec3 {
4825
4934
  z: number;
4826
4935
  }
4827
4936
 
4828
- /** @public */
4829
- export declare interface Vec4 {
4830
- x: number;
4831
- y: number;
4832
- z: number;
4833
- w: number;
4834
- }
4835
-
4836
4937
  /**
4837
4938
  * - Top: The blocks get top aligned.
4838
4939
  * - Bottom: The blocks get bottom aligned.