@cesdk/engine 1.62.0-nightly.20251007 → 1.62.0-nightly.20251009
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-v1.62.0-nightly.20251007-RLV7JFHE.wasm → cesdk-v1.62.0-nightly.20251009-JLIQVVYG.wasm} +0 -0
- package/assets/core/{worker-host-v1.62.0-nightly.20251007.js → worker-host-v1.62.0-nightly.20251009.js} +1 -1
- package/index.d.ts +45 -12
- package/index.js +1 -1
- package/package.json +1 -1
- /package/assets/core/{cesdk-v1.62.0-nightly.20251007-44YCFRT6.data → cesdk-v1.62.0-nightly.20251009-44YCFRT6.data} +0 -0
package/index.d.ts
CHANGED
|
@@ -128,6 +128,24 @@ export declare type AnimationTypeShorthand = 'slide' | 'pan' | 'fade' | 'blur' |
|
|
|
128
128
|
*/
|
|
129
129
|
export declare type ApplicationMimeType = Extract<MimeType_2, 'application/octet-stream' | 'application/pdf' | 'application/zip'>;
|
|
130
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Options for applying an asset to the scene.
|
|
133
|
+
* @public
|
|
134
|
+
*/
|
|
135
|
+
export declare interface ApplyAssetOptions {
|
|
136
|
+
/**
|
|
137
|
+
* How the asset should be placed in the scene.
|
|
138
|
+
* - 'clip': Foreground clip placed at playhead
|
|
139
|
+
* - 'overlay': Background overlay placed on background track
|
|
140
|
+
*/
|
|
141
|
+
clipType?: 'clip' | 'overlay';
|
|
142
|
+
/**
|
|
143
|
+
* Additional custom context options.
|
|
144
|
+
* Allows passing arbitrary data to middleware for custom placement logic.
|
|
145
|
+
*/
|
|
146
|
+
[key: string]: unknown;
|
|
147
|
+
}
|
|
148
|
+
|
|
131
149
|
/**
|
|
132
150
|
* Generic asset information
|
|
133
151
|
* @public
|
|
@@ -179,12 +197,17 @@ export declare class AssetAPI {
|
|
|
179
197
|
/**
|
|
180
198
|
* Register middleware that intercepts asset application to scenes.
|
|
181
199
|
*
|
|
182
|
-
* The middleware function receives the source ID, asset result,
|
|
200
|
+
* The middleware function receives the source ID, asset result, the original apply function,
|
|
201
|
+
* and a context object containing options about how the asset should be applied.
|
|
183
202
|
* It can perform custom logic before, after, or instead of the default asset application.
|
|
184
203
|
*
|
|
185
204
|
* @example
|
|
186
205
|
* ```ts
|
|
187
|
-
* engine.asset.
|
|
206
|
+
* engine.asset.registerApplyMiddleware(async (sourceId, assetResult, apply, context) => {
|
|
207
|
+
* // Access context to determine placement intent
|
|
208
|
+
* console.log('Clip type:', context.clipType); // 'clip', 'overlay', or undefined
|
|
209
|
+
* console.log('Custom data:', context.myCustomField); // Access custom fields
|
|
210
|
+
*
|
|
188
211
|
* // do something before applying the asset
|
|
189
212
|
* // You still have the choice to call apply or skip it
|
|
190
213
|
* const blockId = await apply(sourceId, assetResult);
|
|
@@ -193,12 +216,11 @@ export declare class AssetAPI {
|
|
|
193
216
|
* })
|
|
194
217
|
* ```
|
|
195
218
|
*
|
|
196
|
-
* @category
|
|
219
|
+
* @category Asset Application
|
|
197
220
|
* @param middleware - The middleware function that is called before applying the asset.
|
|
198
221
|
* @returns A function that can be used to remove the middleware.
|
|
199
|
-
* @experimental This API is experimental and may change or be removed in future versions.
|
|
200
222
|
*/
|
|
201
|
-
|
|
223
|
+
registerApplyMiddleware(middleware: (sourceId: string, assetResult: AssetResult, apply: AssetAPI['apply'], context: ApplyAssetOptions) => Promise<DesignBlockId | undefined>): VoidFunction;
|
|
202
224
|
/**
|
|
203
225
|
* Register middleware that intercepts asset application to specific blocks.
|
|
204
226
|
*
|
|
@@ -207,7 +229,7 @@ export declare class AssetAPI {
|
|
|
207
229
|
*
|
|
208
230
|
* @example
|
|
209
231
|
* ```ts
|
|
210
|
-
* engine.asset.
|
|
232
|
+
* engine.asset.registerApplyToBlockMiddleware(async (sourceId, assetResult, block, applyToBlock) => {
|
|
211
233
|
* // do something before applying the asset
|
|
212
234
|
* // You still have the choice to call applyToBlock or skip it
|
|
213
235
|
* await applyToBlock(sourceId, assetResult, block);
|
|
@@ -215,12 +237,11 @@ export declare class AssetAPI {
|
|
|
215
237
|
* })
|
|
216
238
|
* ```
|
|
217
239
|
*
|
|
218
|
-
* @category
|
|
240
|
+
* @category Asset Application
|
|
219
241
|
* @param middleware - The middleware function that is called before applying the asset.
|
|
220
242
|
* @returns A function that can be used to remove the middleware.
|
|
221
|
-
* @experimental This API is experimental and may change or be removed in future versions.
|
|
222
243
|
*/
|
|
223
|
-
|
|
244
|
+
registerApplyToBlockMiddleware(middleware: (sourceId: string, assetResult: AssetResult, block: DesignBlockId, applyToBlock: AssetAPI['applyToBlock']) => Promise<void>): VoidFunction;
|
|
224
245
|
/**
|
|
225
246
|
* Add a custom asset source with unique ID.
|
|
226
247
|
*
|
|
@@ -525,18 +546,30 @@ export declare class AssetAPI {
|
|
|
525
546
|
* Apply an asset to the active scene.
|
|
526
547
|
*
|
|
527
548
|
* Creates a new block configured according to the asset's properties and adds it to the scene.
|
|
528
|
-
* The behavior can be customized by providing an `applyAsset` function when registering the asset source
|
|
549
|
+
* The behavior can be customized by providing an `applyAsset` function when registering the asset source,
|
|
550
|
+
* or by passing context options to guide middleware behavior.
|
|
529
551
|
*
|
|
552
|
+
* @example
|
|
530
553
|
* ```javascript
|
|
554
|
+
* // Default behavior
|
|
531
555
|
* await engine.asset.apply('asset-source-id', assetResult.assets[0]);
|
|
532
556
|
* ```
|
|
533
557
|
*
|
|
558
|
+
* @example
|
|
559
|
+
* ```javascript
|
|
560
|
+
* // Background overlay placement
|
|
561
|
+
* await engine.asset.apply('asset-source-id', assetResult.assets[0], {
|
|
562
|
+
* clipType: 'overlay'
|
|
563
|
+
* });
|
|
564
|
+
* ```
|
|
565
|
+
*
|
|
534
566
|
* @category Asset Application
|
|
535
567
|
* @param sourceId - The ID of the asset source.
|
|
536
568
|
* @param assetResult - A single asset result from a `findAssets` query.
|
|
569
|
+
* @param options - Optional configuration for asset application.
|
|
537
570
|
* @returns Promise resolving to the created block ID, or undefined if no block was created.
|
|
538
571
|
*/
|
|
539
|
-
apply(sourceId: string, assetResult: AssetResult): Promise<DesignBlockId | undefined>;
|
|
572
|
+
apply(sourceId: string, assetResult: AssetResult, options?: ApplyAssetOptions): Promise<DesignBlockId | undefined>;
|
|
540
573
|
/**
|
|
541
574
|
* Apply an asset to a specific block.
|
|
542
575
|
*
|
|
@@ -5271,10 +5304,10 @@ export declare class BlockAPI {
|
|
|
5271
5304
|
* This is useful for organizing content in video scenes where you want
|
|
5272
5305
|
* certain elements to be part of the background layer.
|
|
5273
5306
|
* The background track is the track that determines the page duration.
|
|
5307
|
+
* If no background track exists, one will be created automatically.
|
|
5274
5308
|
*
|
|
5275
5309
|
* @category Helper
|
|
5276
5310
|
* @param block - The ID of the block to move to the background track
|
|
5277
|
-
* @throws Error if no background track is found
|
|
5278
5311
|
*/
|
|
5279
5312
|
moveToBackgroundTrack(block: DesignBlockId): void;
|
|
5280
5313
|
}
|