@cesdk/cesdk-js 1.77.0-rc.3 → 1.77.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
@@ -362,7 +362,7 @@ export { AssetDefinition }
362
362
  * Asset library entry IDs that can be used with asset library APIs.
363
363
  * Includes built-in entry IDs registered by the SDK, and allows custom entry IDs.
364
364
  */
365
- export declare type AssetEntryId = 'ly.img.templates' | 'ly.img.upload' | 'ly.img.image' | 'ly.img.video' | 'ly.img.audio' | 'ly.img.text' | 'ly.img.vector.shape' | 'ly.img.sticker' | 'ly.img.colors' | 'ly.img.typefaces' | 'ly.img.pagePresets' | 'ly.img.cropPresets' | 'ly.img.library.captionPresets' | 'ly.img.text.presets' | 'ly.img.animations' | 'ly.img.textAnimations' | (string & {});
365
+ export declare type AssetEntryId = 'ly.img.templates' | 'ly.img.upload' | 'ly.img.image' | 'ly.img.video' | 'ly.img.audio' | 'ly.img.text' | 'ly.img.vector.shape' | 'ly.img.sticker' | 'ly.img.colors' | 'ly.img.typefaces' | 'ly.img.pagePresets' | 'ly.img.cropPresets' | 'ly.img.library.captionPresets' | 'ly.img.animations' | 'ly.img.textAnimations' | (string & {});
366
366
 
367
367
  /**
368
368
  * @public
@@ -507,6 +507,19 @@ declare interface AssetLibraryEntryData {
507
507
  canRemove?: boolean | ((sourceId: string) => boolean);
508
508
  }
509
509
 
510
+ /**
511
+ * @public
512
+ * A reference to an asset library entry to display. Either an entry ID, or an object that names the
513
+ * entry plus source IDs to hide for this display only — for example a replace panel that shows a
514
+ * library with a non-applicable source hidden (the text "Styles" panel shows `ly.img.text` but
515
+ * hides its text-combinations source). This per-display `excludeSourceIds` is distinct from the
516
+ * entry's own `includeGroups`/`excludeGroups`, which apply wherever the entry is shown.
517
+ */
518
+ export declare type AssetLibraryEntryInput = AssetEntryId | {
519
+ entry: AssetEntryId;
520
+ excludeSourceIds?: string[];
521
+ };
522
+
510
523
  /**
511
524
  * @public
512
525
  * Interface representing the view configuration for an asset library entry.
@@ -1623,12 +1636,11 @@ export declare interface BuiltinTranslations {
1623
1636
  'libraries.ly.img.crop.presets.label': string;
1624
1637
  'libraries.ly.img.image.label': string;
1625
1638
  'libraries.ly.img.image.upload.label': string;
1626
- 'libraries.ly.img.text.presets.label': string;
1627
- 'libraries.ly.img.text.presets.textStyles.label': string;
1628
- 'libraries.ly.img.text.presets.paragraphDefault.label': string;
1629
- 'libraries.ly.img.text.presets.paragraphElegant.label': string;
1630
- 'libraries.ly.img.text.presets.paragraphModernTech.label': string;
1631
- 'libraries.ly.img.text.presets.curves.label': string;
1639
+ 'libraries.ly.img.text.default.label': string;
1640
+ 'libraries.ly.img.text.elegant.label': string;
1641
+ 'libraries.ly.img.text.modernTech.label': string;
1642
+ 'libraries.ly.img.text.styles.label': string;
1643
+ 'libraries.ly.img.text.curves.label': string;
1632
1644
  'libraries.ly.img.local.label': string;
1633
1645
  'libraries.ly.img.page.presets.facebook.label': string;
1634
1646
  'libraries.ly.img.page.presets.hd-video.label': string;
@@ -1668,10 +1680,8 @@ export declare interface BuiltinTranslations {
1668
1680
  'libraries.ly.img.templates.premium.professional.label': string;
1669
1681
  'libraries.ly.img.templates.premium.socials.label': string;
1670
1682
  'libraries.ly.img.text.components.label': string;
1671
- 'libraries.ly.img.text.headline.label': string;
1672
1683
  'libraries.ly.img.text.label': string;
1673
- 'libraries.ly.img.text.paragraph.label': string;
1674
- 'libraries.ly.img.text.title.label': string;
1684
+ 'libraries.ly.img.text.plain.label': string;
1675
1685
  'libraries.ly.img.textAnimations.ly.img.animations.in.label': string;
1676
1686
  'libraries.ly.img.textAnimations.ly.img.animations.label': string;
1677
1687
  'libraries.ly.img.textAnimations.ly.img.animations.loop.label': string;
@@ -3850,6 +3860,20 @@ export { EngineErrorArg }
3850
3860
 
3851
3861
  export { EngineErrorCode }
3852
3862
 
3863
+ /**
3864
+ * Customer-facing copy resolved from a thrown engine error.
3865
+ *
3866
+ * `message` is the short headline (only set for a structured {@link EngineError});
3867
+ * `description` is the longer body. Either may be absent — callers fall back to
3868
+ * their own contextual copy for whichever half is missing.
3869
+ */
3870
+ export declare interface EngineErrorMessage {
3871
+ /** Short headline. Set only for a {@link EngineError} with a catalog code. */
3872
+ message?: string;
3873
+ /** Longer body: the engine `hint` for catalog errors, else the raw message. */
3874
+ description?: string;
3875
+ }
3876
+
3853
3877
  export { EngineExportOptions }
3854
3878
 
3855
3879
  export { EnginePlugin }
@@ -4952,6 +4976,7 @@ export declare class InternationalizationAPI {
4952
4976
  *
4953
4977
  * @category Localization
4954
4978
  * @param key - A translation key string or an array of translation keys to try in order.
4979
+ * @param options - Optional interpolation values for `{{placeholder}}` tokens in the resolved string.
4955
4980
  * @returns The translated string for the key in the current locale, or the key itself if no translation is found.
4956
4981
  *
4957
4982
  * @example
@@ -4964,9 +4989,42 @@ export declare class InternationalizationAPI {
4964
4989
  * const translation = cesdk.i18n.translate(['specific.save', 'common.save']);
4965
4990
  * // Tries 'specific.save' first, then 'common.save'
4966
4991
  * // Returns the first found translation or "common.save" if neither exists
4992
+ *
4993
+ * // With interpolation values
4994
+ * const translation = cesdk.i18n.translate('error.fileTooLarge', { maxSize: '10MB' });
4967
4995
  * ```
4968
4996
  */
4969
- translate(key: string | string[]): string;
4997
+ translate(key: string | string[], options?: Record<string, unknown>): string;
4998
+ /**
4999
+ * Resolves a thrown engine error into the customer-facing copy the editor's
5000
+ * built-in error dialogs display.
5001
+ *
5002
+ * Use this in your own error handling—a custom `onError`, a toast, or a
5003
+ * headless flow—to show the same localized text without reimplementing the
5004
+ * lookup. For a {@link @cesdk/engine#EngineError} with a catalog
5005
+ * `code` it returns your authored `error.<code>` / `error.<code>.description`
5006
+ * override (registered via {@link setTranslations}), falling back to the
5007
+ * engine's English message and hint when no copy is authored—so the result is
5008
+ * never blank or a raw code. Plain `Error`s return only a `description` (their
5009
+ * message); branch on the structured `code` rather than the message string for
5010
+ * stable handling.
5011
+ *
5012
+ * @category Localization
5013
+ * @param error - The thrown error, typically caught from an engine operation.
5014
+ * @returns The resolved `{ message, description }` copy, or `undefined` when
5015
+ * there is nothing to show.
5016
+ *
5017
+ * @example
5018
+ * ```typescript
5019
+ * try {
5020
+ * await cesdk.engine.scene.loadFromURL(sceneUrl);
5021
+ * } catch (error) {
5022
+ * const copy = cesdk.i18n.localizedEngineErrorMessage(error);
5023
+ * showToast(copy?.message ?? copy?.description ?? 'Something went wrong.');
5024
+ * }
5025
+ * ```
5026
+ */
5027
+ localizedEngineErrorMessage(error: unknown): EngineErrorMessage | undefined;
4970
5028
  }
4971
5029
 
4972
5030
  /**
@@ -5077,9 +5135,9 @@ export declare type KeyboardShortcutContext = {
5077
5135
  * `cesdk.shortcuts` — the editor-facing keyboard shortcut API.
5078
5136
  *
5079
5137
  * A thin wrapper over the engine's `engine.shortcuts` registry that translates
5080
- * the editor-facing KeyboardShortcut (whose `when`/`run` receive
5081
- * `{ cesdk }`) to/from the engine Shortcut (whose callbacks receive
5082
- * `{ engine }`). The `cesdk` instance is closed over here so the engine layer
5138
+ * the editor-facing KeyboardShortcut (whose `when`/`run` receive a context with
5139
+ * `cesdk`) to/from the engine Shortcut (whose callbacks receive a context with
5140
+ * `engine`). The `cesdk` instance is closed over here so the engine layer
5083
5141
  * never needs to know about it.
5084
5142
  *
5085
5143
  * @public
@@ -5100,13 +5158,13 @@ export declare class KeyboardShortcutsAPI {
5100
5158
  */
5101
5159
  set(shortcut: KeyboardShortcut | KeyboardShortcut[]): () => void;
5102
5160
  /**
5103
- * List the keyboard shortcuts matching `options` (`keys` AND `scopes`,
5104
- * glob-matched). Both fields are required and must be non-empty;
5105
- * `{ keys: '*', scopes: '*' }` lists everything. Throws on an empty field.
5161
+ * List the keyboard shortcuts whose scope matches `options.scopes`
5162
+ * (glob-matched). `scopes` is required and must be non-empty; `{ scopes: '*' }`
5163
+ * lists everything. Throws on an empty `scopes`. To find a shortcut by chord
5164
+ * use `get`/`has`.
5106
5165
  * @public
5107
5166
  */
5108
5167
  list(options: {
5109
- keys: string | string[];
5110
5168
  scopes: ShortcutScopeId | ShortcutScopeId[];
5111
5169
  }): KeyboardShortcut[];
5112
5170
  /**
@@ -5120,8 +5178,9 @@ export declare class KeyboardShortcutsAPI {
5120
5178
  }): KeyboardShortcut | undefined;
5121
5179
  /**
5122
5180
  * Remove every keyboard shortcut matching `options` (`keys` AND `scopes`).
5123
- * Both fields are required and must be non-empty; use `'*'` to match all
5124
- * (e.g. `{ keys: 'Mod+s', scopes: '*' }`). Throws on an empty field.
5181
+ * Both fields are required and must be non-empty; use `'*'` to match all
5182
+ * for example, `keys: 'Mod+s'` with `scopes: '*'` removes that chord from
5183
+ * every scope. Throws on an empty field.
5125
5184
  * @public
5126
5185
  */
5127
5186
  remove(options: {
@@ -5168,7 +5227,7 @@ export declare class KeyboardShortcutsAPI {
5168
5227
  * @returns A disposer that stops listening.
5169
5228
  * @public
5170
5229
  */
5171
- setRoot(target?: ShortcutRoot): () => void;
5230
+ setRoot(target: ShortcutRoot): () => void;
5172
5231
  }
5173
5232
 
5174
5233
  /**
@@ -6006,7 +6065,8 @@ export declare interface RemoveResult<A extends UIArea = UIArea> {
6006
6065
 
6007
6066
  /**
6008
6067
  * @public
6009
- * Provides context for replacing asset library entries, including selected blocks and default entry IDs.
6068
+ * Provides context for replacing asset library entries, including the selected blocks and the
6069
+ * default entries (each may carry per-entry source exclusions).
6010
6070
  */
6011
6071
  export declare interface ReplaceAssetLibraryEntriesContext {
6012
6072
  selectedBlocks: {
@@ -6015,7 +6075,7 @@ export declare interface ReplaceAssetLibraryEntriesContext {
6015
6075
  fillType?: FillTypeLonghand;
6016
6076
  supportsShape?: boolean;
6017
6077
  }[];
6018
- defaultEntryIds: string[];
6078
+ defaultEntryIds: AssetLibraryEntryInput[];
6019
6079
  /**
6020
6080
  * The intent of the replacement operation.
6021
6081
  * - `'shape'`: User explicitly wants to replace the shape (e.g., from shape options panel)
@@ -8131,13 +8191,14 @@ export declare class UserInterfaceAPI {
8131
8191
  /**
8132
8192
  * Sets a function that determines which asset library entries to use for replacement operations.
8133
8193
  *
8134
- * The function receives context information (like selected blocks or default entry IDs)
8135
- * and returns the appropriate asset library entry IDs for replacement.
8194
+ * The function receives context (selected blocks, the default entries, the replace intent) and
8195
+ * returns the entries to show. Each entry is either an entry ID, or `{ entry, excludeSourceIds }`
8196
+ * to show that entry with specific sources hidden for this replacement only.
8136
8197
  *
8137
8198
  * @category Asset Library
8138
- * @param replaceAssetLibraryEntries - Function that receives context and returns an array of asset library entry IDs for replacement.
8199
+ * @param replaceAssetLibraryEntries - Function that receives context and returns the asset library entries (IDs, or `{ entry, excludeSourceIds }`) to show when replacing.
8139
8200
  */
8140
- setReplaceAssetLibraryEntries(replaceAssetLibraryEntries: (context: ReplaceAssetLibraryEntriesContext) => AssetEntryId[]): void;
8201
+ setReplaceAssetLibraryEntries(replaceAssetLibraryEntries: (context: ReplaceAssetLibraryEntriesContext) => AssetLibraryEntryInput[]): void;
8141
8202
  /**
8142
8203
  * Gets the current view style of the editor interface.
8143
8204
  *
@@ -8269,6 +8330,7 @@ declare namespace UserInterfaceElements {
8269
8330
  AssetLibraryEntryData,
8270
8331
  AssetLibraryEntry,
8271
8332
  AssetLibraryEntries,
8333
+ AssetLibraryEntryInput,
8272
8334
  ReplaceAssetLibraryEntriesContext,
8273
8335
  UserInterfaceElements_2 as UserInterfaceElements
8274
8336
  }