@cesdk/cesdk-js 1.62.0-nightly.20251010 → 1.62.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
@@ -315,6 +315,24 @@ export { AssetColorProperty }
315
315
 
316
316
  export { AssetDefinition }
317
317
 
318
+ /**
319
+ * @public
320
+ * Asset library entry IDs that can be used with asset library APIs.
321
+ * Includes built-in entry IDs registered by the SDK, and allows custom entry IDs.
322
+ */
323
+ export declare type AssetEntryId = 'ly.img.colors' | 'ly.img.typefaces' | 'ly.img.pagePresets' | 'ly.img.cropPresets' | 'ly.img.library.captionPresets' | 'ly.img.animations' | 'ly.img.textAnimations' | (string & {});
324
+
325
+ /**
326
+ * @public
327
+ * Context provided to the sourceIds callback function.
328
+ * - `cesdk`: The CreativeEditorSDK instance.
329
+ * - `engine`: The CreativeEngine instance.
330
+ */
331
+ declare interface AssetEntrySourceIdsContext {
332
+ cesdk: CreativeEditorSDK;
333
+ engine: CreativeEngine_2;
334
+ }
335
+
318
336
  export { AssetEnumProperty }
319
337
 
320
338
  export { AssetFixedAspectRatio }
@@ -364,7 +382,7 @@ export declare interface AssetLibraryEntry extends AssetLibraryEntryData, AssetL
364
382
  * @public
365
383
  * Interface representing the data configuration for an asset library entry.
366
384
  * - `id`: The unique identifier for the asset library entry.
367
- * - `sourceIds`: An array of source IDs associated with the asset library entry.
385
+ * - `sourceIds`: An array of source IDs associated with the asset library entry, or a function that returns an array of source IDs.
368
386
  * - `sceneMode`: Optional configuration for the scene mode, which can be a `SceneMode`, 'All', or a function returning a `SceneMode` or 'All'.
369
387
  * - `excludeGroups`: Optional array of group IDs to exclude from the asset library entry.
370
388
  * - `includeGroups`: Optional array of group IDs to include in the asset library entry.
@@ -374,7 +392,7 @@ export declare interface AssetLibraryEntry extends AssetLibraryEntryData, AssetL
374
392
  */
375
393
  declare interface AssetLibraryEntryData {
376
394
  id: string;
377
- sourceIds: string[];
395
+ sourceIds: string[] | ((context: AssetEntrySourceIdsContext) => string[]);
378
396
  /**
379
397
  * Marks for what scene mode this entry is fitting. Not setting this
380
398
  * will make the entry available for all scene modes.
@@ -2489,6 +2507,27 @@ declare class CreativeEditorSDK {
2489
2507
 
2490
2508
 
2491
2509
 
2510
+ /**
2511
+ * Registers a callback function to be executed when resetEditor is called.
2512
+ *
2513
+ * @param callback - Function to be called with the cesdk instance when reset occurs
2514
+ * @returns Function to remove the callback from the registry
2515
+ *
2516
+ * @example
2517
+ * ```typescript
2518
+ * const removeCallback = cesdk.onReset((cesdk) => {
2519
+ * console.log('Editor is being reset');
2520
+ * // Custom cleanup/reinitialization logic
2521
+ * });
2522
+ *
2523
+ * // Later, to remove the callback:
2524
+ * removeCallback();
2525
+ * ```
2526
+ *
2527
+ * @category Configuration
2528
+ * @public
2529
+ */
2530
+ onReset(callback: (cesdk: CreativeEditorSDK) => void): () => void;
2492
2531
  /**
2493
2532
  * Convenience function to register a set of our default asset sources.
2494
2533
  *
@@ -2615,6 +2654,23 @@ declare class CreativeEditorSDK {
2615
2654
  * ```
2616
2655
  */
2617
2656
  getBaseURL(): string;
2657
+ /**
2658
+ * Resets the editor to a clean state by disabling all features, clearing UI configurations,
2659
+ * and removing asset sources.
2660
+ *
2661
+ * @example
2662
+ * ```typescript
2663
+ * // Reset the editor to clean state
2664
+ * cesdk.resetEditor();
2665
+ *
2666
+ * // Reconfigure as needed
2667
+ * cesdk.feature.enable('ly.img.navigationBar', true);
2668
+ * cesdk.addDefaultAssetSources();
2669
+ * ```
2670
+ *
2671
+ * @category Configuration
2672
+ */
2673
+ resetEditor(): void;
2618
2674
  /**
2619
2675
  * Save and return a scene as a base64 encoded string.
2620
2676
  *
@@ -4480,13 +4536,214 @@ export declare interface UserInterface {
4480
4536
  hide?: boolean;
4481
4537
  smallViewportOptimization?: boolean;
4482
4538
  /**
4483
- * @deprecated The configuration options `ui.colorPalette` has been deprecated. Please use `ui.colorLibraries` and asset sources instead.
4539
+ * @deprecated Add a local asset source using `cesdk.engine.asset.addLocalSource()` and populate it with color assets,
4540
+ * then use `cesdk.ui.updateAssetLibraryEntry('ly.img.colors', { sourceIds: [...] })` to configure which sources to display.
4541
+ *
4542
+ * @example
4543
+ * ```typescript
4544
+ * // Before (deprecated):
4545
+ * const config = {
4546
+ * ui: {
4547
+ * colorPalette: ['#FF0000', '#00FF00', '#0000FF']
4548
+ * }
4549
+ * };
4550
+ *
4551
+ * // After (recommended):
4552
+ * // Add a local source for custom colors
4553
+ * engine.asset.addLocalSource('my.custom.colors');
4554
+ * engine.asset.addAssetToSource('my.custom.colors', {
4555
+ * id: 'red',
4556
+ * label: { en: 'Red' },
4557
+ * payload: {
4558
+ * color: {
4559
+ * colorSpace: 'sRGB',
4560
+ * r: 1.0,
4561
+ * g: 0.0,
4562
+ * b: 0.0,
4563
+ * a: 1.0
4564
+ * }
4565
+ * }
4566
+ * });
4567
+ * // ... add more colors
4568
+ *
4569
+ * // Update the asset library entry to use your custom source
4570
+ * cesdk.ui.updateAssetLibraryEntry('ly.img.colors', {
4571
+ * sourceIds: ['ly.img.colors.documentColors', 'my.custom.colors']
4572
+ * });
4573
+ * ```
4484
4574
  */
4485
4575
  colorPalette?: PaletteColor[];
4576
+ /**
4577
+ * @deprecated Add asset sources using `cesdk.engine.asset.addAssetSource()` or `cesdk.engine.asset.addLocalSource()`,
4578
+ * then use `cesdk.ui.updateAssetLibraryEntry('ly.img.colors', { sourceIds: [...] })` to configure which sources to display.
4579
+ *
4580
+ * @example
4581
+ * ```typescript
4582
+ * // Before (deprecated):
4583
+ * const config = {
4584
+ * ui: {
4585
+ * colorLibraries: ['ly.img.colors.defaultPalette', 'my.custom.colors']
4586
+ * }
4587
+ * };
4588
+ *
4589
+ * // After (recommended):
4590
+ * // Add a local source for custom colors
4591
+ * engine.asset.addLocalSource('my.custom.colors');
4592
+ * // Add color assets to the source
4593
+ * engine.asset.addAssetToSource('my.custom.colors', {
4594
+ * id: 'custom-color-1',
4595
+ * payload: { color: { colorSpace: 'sRGB', r: 1.0, g: 0.0, b: 0.0 } }
4596
+ * });
4597
+ *
4598
+ * // Update the library entry to use your sources
4599
+ * cesdk.ui.updateAssetLibraryEntry('ly.img.colors', {
4600
+ * sourceIds: ['ly.img.colors.defaultPalette', 'my.custom.colors']
4601
+ * });
4602
+ * ```
4603
+ */
4486
4604
  colorLibraries?: string[];
4605
+ /**
4606
+ * @deprecated Add asset sources using `cesdk.engine.asset.addAssetSource()` or `cesdk.engine.asset.addLocalSource()`,
4607
+ * then use `cesdk.ui.updateAssetLibraryEntry('ly.img.typefaces', { sourceIds: [...] })` to configure which sources to display.
4608
+ *
4609
+ * @example
4610
+ * ```typescript
4611
+ * // Before (deprecated):
4612
+ * const config = {
4613
+ * ui: {
4614
+ * typefaceLibraries: ['ly.img.typeface', 'my.custom.fonts']
4615
+ * }
4616
+ * };
4617
+ *
4618
+ * // After (recommended):
4619
+ * // Add a local source for custom typefaces
4620
+ * engine.asset.addLocalSource('my.custom.fonts');
4621
+ * // Add typeface assets to the source
4622
+ * engine.asset.addAssetToSource('my.custom.fonts', {
4623
+ * id: 'custom-font-1',
4624
+ * meta: { uri: 'https://example.com/font.ttf' }
4625
+ * });
4626
+ *
4627
+ * // Update the library entry to use your sources
4628
+ * cesdk.ui.updateAssetLibraryEntry('ly.img.typefaces', {
4629
+ * sourceIds: ['ly.img.typeface', 'my.custom.fonts']
4630
+ * });
4631
+ * ```
4632
+ */
4487
4633
  typefaceLibraries?: string[];
4634
+ /**
4635
+ * @deprecated Add asset sources using `cesdk.engine.asset.addAssetSource()` or `cesdk.engine.asset.addLocalSource()`,
4636
+ * then use `cesdk.ui.updateAssetLibraryEntry('ly.img.pagePresets', { sourceIds: ... })` to configure which sources to display.
4637
+ *
4638
+ * For dynamic source IDs, use a callback function with the new API: `{ sourceIds: ({ engine }) => [...] }`
4639
+ *
4640
+ * @example
4641
+ * ```typescript
4642
+ * // Before (deprecated):
4643
+ * const config = {
4644
+ * ui: {
4645
+ * pagePresetsLibraries: (engine) => {
4646
+ * const sceneMode = engine.scene.getMode();
4647
+ * return sceneMode === 'Video'
4648
+ * ? ['ly.img.page.presets.video']
4649
+ * : ['ly.img.page.presets'];
4650
+ * }
4651
+ * }
4652
+ * };
4653
+ *
4654
+ * // After (recommended):
4655
+ * // Add a local source for custom page presets
4656
+ * engine.asset.addLocalSource('my.custom.pagePresets');
4657
+ * // Add page preset assets to the source
4658
+ * engine.asset.addAssetToSource('my.custom.pagePresets', {
4659
+ * id: 'custom-preset-1',
4660
+ * payload: { transformPreset: { type: 'FixedSize', width: 800, height: 600 } }
4661
+ * });
4662
+ *
4663
+ * // Update the library entry with dynamic sourceIds
4664
+ * cesdk.ui.updateAssetLibraryEntry('ly.img.pagePresets', {
4665
+ * sourceIds: ({ engine }) => {
4666
+ * const sceneMode = engine.scene.getMode();
4667
+ * return sceneMode === 'Video'
4668
+ * ? ['ly.img.page.presets.video', 'my.custom.pagePresets']
4669
+ * : ['ly.img.page.presets', 'my.custom.pagePresets'];
4670
+ * }
4671
+ * });
4672
+ * ```
4673
+ */
4488
4674
  pagePresetsLibraries?: string[] | ((engine: CreativeEngine_2) => string[]);
4675
+ /**
4676
+ * @deprecated Add asset sources using `cesdk.engine.asset.addAssetSource()` or `cesdk.engine.asset.addLocalSource()`,
4677
+ * then use `cesdk.ui.updateAssetLibraryEntry('ly.img.cropPresets', { sourceIds: ... })` to configure which sources to display.
4678
+ *
4679
+ * For dynamic source IDs, use a callback function with the new API: `{ sourceIds: ({ engine }) => [...] }`
4680
+ *
4681
+ * @example
4682
+ * ```typescript
4683
+ * // Before (deprecated):
4684
+ * const config = {
4685
+ * ui: {
4686
+ * cropPresetsLibraries: ['ly.img.crop.presets']
4687
+ * }
4688
+ * };
4689
+ *
4690
+ * // After (recommended):
4691
+ * // Add a local source for custom crop presets
4692
+ * engine.asset.addLocalSource('my.custom.cropPresets');
4693
+ * // Add crop preset assets to the source
4694
+ * engine.asset.addAssetToSource('my.custom.cropPresets', {
4695
+ * id: 'custom-crop-1',
4696
+ * payload: { transformPreset: { type: 'FixedAspectRatio', width: 16, height: 9 } }
4697
+ * });
4698
+ *
4699
+ * // Update the library entry to use your sources
4700
+ * cesdk.ui.updateAssetLibraryEntry('ly.img.cropPresets', {
4701
+ * sourceIds: ['ly.img.crop.presets', 'my.custom.cropPresets']
4702
+ * });
4703
+ * ```
4704
+ */
4489
4705
  cropPresetsLibraries?: string[] | ((engine: CreativeEngine_2) => string[]);
4706
+ /**
4707
+ * @deprecated Add a local asset source using `cesdk.engine.asset.addLocalSource()` and populate it with page format assets,
4708
+ * then use `cesdk.ui.updateAssetLibraryEntry('ly.img.pagePresets', { sourceIds: [...] })` to configure which sources to display.
4709
+ *
4710
+ * @example
4711
+ * ```typescript
4712
+ * // Before (deprecated):
4713
+ * const config = {
4714
+ * ui: {
4715
+ * pageFormats: {
4716
+ * 'custom-format': {
4717
+ * width: 800,
4718
+ * height: 600,
4719
+ * unit: 'Pixel'
4720
+ * }
4721
+ * }
4722
+ * }
4723
+ * };
4724
+ *
4725
+ * // After (recommended):
4726
+ * // Add a local source for custom page formats
4727
+ * engine.asset.addLocalSource('my.custom.pageFormats');
4728
+ * engine.asset.addAssetToSource('my.custom.pageFormats', {
4729
+ * id: 'custom-format',
4730
+ * label: { en: 'Custom Format' },
4731
+ * payload: {
4732
+ * transformPreset: {
4733
+ * type: 'FixedSize',
4734
+ * width: 800,
4735
+ * height: 600,
4736
+ * designUnit: 'Pixel'
4737
+ * }
4738
+ * }
4739
+ * });
4740
+ *
4741
+ * // Update the asset library entry to use your custom source
4742
+ * cesdk.ui.updateAssetLibraryEntry('ly.img.pagePresets', {
4743
+ * sourceIds: ['my.custom.pageFormats']
4744
+ * });
4745
+ * ```
4746
+ */
4490
4747
  pageFormats?: {
4491
4748
  [id: string]: PageFormatDefinition;
4492
4749
  };
@@ -4953,22 +5210,7 @@ export declare class UserInterfaceAPI {
4953
5210
  */
4954
5211
  removeDockOrderComponent(matcher: OrderComponentMatcher<OrderComponent<DockOrderComponentId>>, orderContext?: OrderContext): {
4955
5212
  removed: number;
4956
- order: DockOrderComponent[]; /**
4957
- * Inserts a component into the render order of the dock area.
4958
- *
4959
- * This method inserts a new dock order component before, after, or to replace a component matching
4960
- * the provided matcher. The matcher can be a function or an object describing the component to match.
4961
- * The location can be 'before', 'after', or 'replace'.
4962
- *
4963
- * The insert API can be used in different contexts (such as edit modes).
4964
- *
4965
- * @category UI Layout
4966
- * @param component - The component ID or configuration to insert.
4967
- * @param matcher - Function or object to match the component to insert relative to.
4968
- * @param location - Where to insert the new component relative to the matched component ('before' or 'after').
4969
- * @param orderContext - Optional context specifying which order to update.
4970
- * @returns The updated dock order array.
4971
- */
5213
+ order: DockOrderComponent[];
4972
5214
  };
4973
5215
  /**
4974
5216
  * Inserts a component into the render order of the dock area.
@@ -5054,22 +5296,7 @@ export declare class UserInterfaceAPI {
5054
5296
  */
5055
5297
  removeInspectorBarOrderComponent(matcher: OrderComponentMatcher<OrderComponent<InspectorBarComponentId>>, orderContext?: OrderContext): {
5056
5298
  removed: number;
5057
- order: OrderComponent<InspectorBarComponentId>[]; /**
5058
- * Inserts a component into the render order of the dock area.
5059
- *
5060
- * This method inserts a new dock order component before, after, or to replace a component matching
5061
- * the provided matcher. The matcher can be a function or an object describing the component to match.
5062
- * The location can be 'before', 'after', or 'replace'.
5063
- *
5064
- * The insert API can be used in different contexts (such as edit modes).
5065
- *
5066
- * @category UI Layout
5067
- * @param component - The component ID or configuration to insert.
5068
- * @param matcher - Function or object to match the component to insert relative to.
5069
- * @param location - Where to insert the new component relative to the matched component ('before' or 'after').
5070
- * @param orderContext - Optional context specifying which order to update.
5071
- * @returns The updated dock order array.
5072
- */
5299
+ order: OrderComponent<InspectorBarComponentId>[];
5073
5300
  };
5074
5301
  /**
5075
5302
  * Inserts a component into the render order of the inspector bar.
@@ -5151,22 +5378,7 @@ export declare class UserInterfaceAPI {
5151
5378
  */
5152
5379
  removeCanvasMenuOrderComponent(matcher: OrderComponentMatcher<OrderComponent<CanvasMenuComponentId>>, orderContext?: OrderContext): {
5153
5380
  removed: number;
5154
- order: OrderComponent<CanvasMenuComponentId>[]; /**
5155
- * Inserts a component into the render order of the dock area.
5156
- *
5157
- * This method inserts a new dock order component before, after, or to replace a component matching
5158
- * the provided matcher. The matcher can be a function or an object describing the component to match.
5159
- * The location can be 'before', 'after', or 'replace'.
5160
- *
5161
- * The insert API can be used in different contexts (such as edit modes).
5162
- *
5163
- * @category UI Layout
5164
- * @param component - The component ID or configuration to insert.
5165
- * @param matcher - Function or object to match the component to insert relative to.
5166
- * @param location - Where to insert the new component relative to the matched component ('before' or 'after').
5167
- * @param orderContext - Optional context specifying which order to update.
5168
- * @returns The updated dock order array.
5169
- */
5381
+ order: OrderComponent<CanvasMenuComponentId>[];
5170
5382
  };
5171
5383
  /**
5172
5384
  * Inserts a component into the render order of the canvas menu.
@@ -5335,22 +5547,7 @@ export declare class UserInterfaceAPI {
5335
5547
  */
5336
5548
  removeCanvasBarOrderComponent(matcher: OrderComponentMatcher<OrderComponent<CanvasBarComponentId>>, position: 'top' | 'bottom', orderContext?: OrderContext): {
5337
5549
  removed: number;
5338
- order: OrderComponent<CanvasBarComponentId>[]; /**
5339
- * Inserts a component into the render order of the dock area.
5340
- *
5341
- * This method inserts a new dock order component before, after, or to replace a component matching
5342
- * the provided matcher. The matcher can be a function or an object describing the component to match.
5343
- * The location can be 'before', 'after', or 'replace'.
5344
- *
5345
- * The insert API can be used in different contexts (such as edit modes).
5346
- *
5347
- * @category UI Layout
5348
- * @param component - The component ID or configuration to insert.
5349
- * @param matcher - Function or object to match the component to insert relative to.
5350
- * @param location - Where to insert the new component relative to the matched component ('before' or 'after').
5351
- * @param orderContext - Optional context specifying which order to update.
5352
- * @returns The updated dock order array.
5353
- */
5550
+ order: OrderComponent<CanvasBarComponentId>[];
5354
5551
  };
5355
5552
  /**
5356
5553
  * Inserts a component into the render order of the canvas bar.
@@ -5390,16 +5587,19 @@ export declare class UserInterfaceAPI {
5390
5587
  *
5391
5588
  * @category Asset Library
5392
5589
  * @param id - The ID of the asset library entry to update.
5393
- * @param assetLibraryEntry - Partial entry properties to merge with the existing entry.
5590
+ * @param assetLibraryEntry - Partial entry properties to merge with the existing entry, or a function that receives the current entry and pre-normalized sourceIds and returns the updated properties.
5394
5591
  */
5395
- updateAssetLibraryEntry(id: string, assetLibraryEntry: Partial<Omit<AssetLibraryEntry, 'id'>>): void;
5592
+ updateAssetLibraryEntry(id: AssetEntryId, assetLibraryEntry: Partial<Omit<AssetLibraryEntry, 'id'>> | ((context: {
5593
+ entry: AssetLibraryEntry;
5594
+ sourceIds: string[];
5595
+ }) => Partial<Omit<AssetLibraryEntry, 'id'>>)): void;
5396
5596
  /**
5397
5597
  * Removes an asset library entry from the available entries.
5398
5598
  *
5399
5599
  * @category Asset Library
5400
5600
  * @param id - The ID of the asset library entry to remove.
5401
5601
  */
5402
- removeAssetLibraryEntry(id: string): void;
5602
+ removeAssetLibraryEntry(id: AssetEntryId): void;
5403
5603
  /**
5404
5604
  * Gets a specific asset library entry by its ID.
5405
5605
  *
@@ -5407,14 +5607,14 @@ export declare class UserInterfaceAPI {
5407
5607
  * @param id - The ID of the asset library entry to retrieve.
5408
5608
  * @returns The asset library entry configuration, or undefined if not found.
5409
5609
  */
5410
- getAssetLibraryEntry(id: string): AssetLibraryEntry | undefined;
5610
+ getAssetLibraryEntry(id: AssetEntryId): AssetLibraryEntry | undefined;
5411
5611
  /**
5412
5612
  * Gets all currently registered asset library entry IDs.
5413
5613
  *
5414
5614
  * @category Asset Library
5415
5615
  * @returns Array of asset library entry IDs.
5416
5616
  */
5417
- findAllAssetLibraryEntries(): string[];
5617
+ findAllAssetLibraryEntries(): AssetEntryId[];
5418
5618
  /**
5419
5619
  * Sets the asset library entries to use for the background track in video scenes.
5420
5620
  *
@@ -5437,7 +5637,7 @@ export declare class UserInterfaceAPI {
5437
5637
  * });
5438
5638
  * ```
5439
5639
  */
5440
- setBackgroundTrackAssetLibraryEntries(backgroundTrackAssetLibraryEntries: string[]): void;
5640
+ setBackgroundTrackAssetLibraryEntries(backgroundTrackAssetLibraryEntries: AssetEntryId[]): void;
5441
5641
  /**
5442
5642
  * Gets the asset library entries configured for the background track in video scenes.
5443
5643
  *
@@ -5447,7 +5647,7 @@ export declare class UserInterfaceAPI {
5447
5647
  * @returns Array of asset library entry IDs configured for the background track.
5448
5648
  * @deprecated The background track entries are now defined via the cesdk.actions API.
5449
5649
  */
5450
- getBackgroundTrackAssetLibraryEntries(): string[];
5650
+ getBackgroundTrackAssetLibraryEntries(): AssetEntryId[];
5451
5651
  /**
5452
5652
  * Sets a function that determines which asset library entries to use for replacement operations.
5453
5653
  *
@@ -5457,7 +5657,7 @@ export declare class UserInterfaceAPI {
5457
5657
  * @category Asset Library
5458
5658
  * @param replaceAssetLibraryEntries - Function that receives context and returns an array of asset library entry IDs for replacement.
5459
5659
  */
5460
- setReplaceAssetLibraryEntries(replaceAssetLibraryEntries: (context: ReplaceAssetLibraryEntriesContext) => string[]): void;
5660
+ setReplaceAssetLibraryEntries(replaceAssetLibraryEntries: (context: ReplaceAssetLibraryEntriesContext) => AssetEntryId[]): void;
5461
5661
  /**
5462
5662
  * Gets the current view style of the editor interface.
5463
5663
  *
@@ -5585,6 +5785,8 @@ declare namespace UserInterfaceElements {
5585
5785
  CustomCardSvgVectorPathBackground,
5586
5786
  CustomCardBackground,
5587
5787
  AssetLibraryEntryView,
5788
+ AssetEntrySourceIdsContext,
5789
+ AssetEntryId,
5588
5790
  AssetLibraryEntryData,
5589
5791
  AssetLibraryEntry,
5590
5792
  AssetLibraryEntries,