@cesdk/cesdk-js 1.77.0-rc.3 → 1.77.0-rc.4
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.77.0-rc.3-TVWCBQP4.wasm → cesdk-v1.77.0-rc.4-XBQOCY46.wasm} +0 -0
- package/assets/core/{worker-host-v1.77.0-rc.3.js → worker-host-v1.77.0-rc.4.js} +1 -1
- package/assets/i18n/de.json +82 -0
- package/assets/i18n/en.json +82 -0
- package/cesdk.umd.js +1 -1
- package/index.d.ts +57 -8
- package/index.js +1 -1
- package/package.json +2 -2
- /package/assets/core/{cesdk-v1.77.0-rc.3-MLEZSZ4D.data → cesdk-v1.77.0-rc.4-MLEZSZ4D.data} +0 -0
package/index.d.ts
CHANGED
|
@@ -3850,6 +3850,20 @@ export { EngineErrorArg }
|
|
|
3850
3850
|
|
|
3851
3851
|
export { EngineErrorCode }
|
|
3852
3852
|
|
|
3853
|
+
/**
|
|
3854
|
+
* Customer-facing copy resolved from a thrown engine error.
|
|
3855
|
+
*
|
|
3856
|
+
* `message` is the short headline (only set for a structured {@link EngineError});
|
|
3857
|
+
* `description` is the longer body. Either may be absent — callers fall back to
|
|
3858
|
+
* their own contextual copy for whichever half is missing.
|
|
3859
|
+
*/
|
|
3860
|
+
export declare interface EngineErrorMessage {
|
|
3861
|
+
/** Short headline. Set only for a {@link EngineError} with a catalog code. */
|
|
3862
|
+
message?: string;
|
|
3863
|
+
/** Longer body: the engine `hint` for catalog errors, else the raw message. */
|
|
3864
|
+
description?: string;
|
|
3865
|
+
}
|
|
3866
|
+
|
|
3853
3867
|
export { EngineExportOptions }
|
|
3854
3868
|
|
|
3855
3869
|
export { EnginePlugin }
|
|
@@ -4952,6 +4966,7 @@ export declare class InternationalizationAPI {
|
|
|
4952
4966
|
*
|
|
4953
4967
|
* @category Localization
|
|
4954
4968
|
* @param key - A translation key string or an array of translation keys to try in order.
|
|
4969
|
+
* @param options - Optional interpolation values for `{{placeholder}}` tokens in the resolved string.
|
|
4955
4970
|
* @returns The translated string for the key in the current locale, or the key itself if no translation is found.
|
|
4956
4971
|
*
|
|
4957
4972
|
* @example
|
|
@@ -4964,9 +4979,42 @@ export declare class InternationalizationAPI {
|
|
|
4964
4979
|
* const translation = cesdk.i18n.translate(['specific.save', 'common.save']);
|
|
4965
4980
|
* // Tries 'specific.save' first, then 'common.save'
|
|
4966
4981
|
* // Returns the first found translation or "common.save" if neither exists
|
|
4982
|
+
*
|
|
4983
|
+
* // With interpolation values
|
|
4984
|
+
* const translation = cesdk.i18n.translate('error.fileTooLarge', { maxSize: '10MB' });
|
|
4985
|
+
* ```
|
|
4986
|
+
*/
|
|
4987
|
+
translate(key: string | string[], options?: Record<string, unknown>): string;
|
|
4988
|
+
/**
|
|
4989
|
+
* Resolves a thrown engine error into the customer-facing copy the editor's
|
|
4990
|
+
* built-in error dialogs display.
|
|
4991
|
+
*
|
|
4992
|
+
* Use this in your own error handling—a custom `onError`, a toast, or a
|
|
4993
|
+
* headless flow—to show the same localized text without reimplementing the
|
|
4994
|
+
* lookup. For a {@link @cesdk/engine#EngineError} with a catalog
|
|
4995
|
+
* `code` it returns your authored `error.<code>` / `error.<code>.description`
|
|
4996
|
+
* override (registered via {@link setTranslations}), falling back to the
|
|
4997
|
+
* engine's English message and hint when no copy is authored—so the result is
|
|
4998
|
+
* never blank or a raw code. Plain `Error`s return only a `description` (their
|
|
4999
|
+
* message); branch on the structured `code` rather than the message string for
|
|
5000
|
+
* stable handling.
|
|
5001
|
+
*
|
|
5002
|
+
* @category Localization
|
|
5003
|
+
* @param error - The thrown error, typically caught from an engine operation.
|
|
5004
|
+
* @returns The resolved `{ message, description }` copy, or `undefined` when
|
|
5005
|
+
* there is nothing to show.
|
|
5006
|
+
*
|
|
5007
|
+
* @example
|
|
5008
|
+
* ```typescript
|
|
5009
|
+
* try {
|
|
5010
|
+
* await cesdk.engine.scene.loadFromURL(sceneUrl);
|
|
5011
|
+
* } catch (error) {
|
|
5012
|
+
* const copy = cesdk.i18n.localizedEngineErrorMessage(error);
|
|
5013
|
+
* showToast(copy?.message ?? copy?.description ?? 'Something went wrong.');
|
|
5014
|
+
* }
|
|
4967
5015
|
* ```
|
|
4968
5016
|
*/
|
|
4969
|
-
|
|
5017
|
+
localizedEngineErrorMessage(error: unknown): EngineErrorMessage | undefined;
|
|
4970
5018
|
}
|
|
4971
5019
|
|
|
4972
5020
|
/**
|
|
@@ -5077,9 +5125,9 @@ export declare type KeyboardShortcutContext = {
|
|
|
5077
5125
|
* `cesdk.shortcuts` — the editor-facing keyboard shortcut API.
|
|
5078
5126
|
*
|
|
5079
5127
|
* A thin wrapper over the engine's `engine.shortcuts` registry that translates
|
|
5080
|
-
* the editor-facing KeyboardShortcut (whose `when`/`run` receive
|
|
5081
|
-
* `
|
|
5082
|
-
* `
|
|
5128
|
+
* the editor-facing KeyboardShortcut (whose `when`/`run` receive a context with
|
|
5129
|
+
* `cesdk`) to/from the engine Shortcut (whose callbacks receive a context with
|
|
5130
|
+
* `engine`). The `cesdk` instance is closed over here so the engine layer
|
|
5083
5131
|
* never needs to know about it.
|
|
5084
5132
|
*
|
|
5085
5133
|
* @public
|
|
@@ -5101,8 +5149,8 @@ export declare class KeyboardShortcutsAPI {
|
|
|
5101
5149
|
set(shortcut: KeyboardShortcut | KeyboardShortcut[]): () => void;
|
|
5102
5150
|
/**
|
|
5103
5151
|
* List the keyboard shortcuts matching `options` (`keys` AND `scopes`,
|
|
5104
|
-
* glob-matched). Both fields are required and must be non-empty;
|
|
5105
|
-
* `
|
|
5152
|
+
* glob-matched). Both fields are required and must be non-empty; using `'*'`
|
|
5153
|
+
* for both `keys` and `scopes` lists everything. Throws on an empty field.
|
|
5106
5154
|
* @public
|
|
5107
5155
|
*/
|
|
5108
5156
|
list(options: {
|
|
@@ -5120,8 +5168,9 @@ export declare class KeyboardShortcutsAPI {
|
|
|
5120
5168
|
}): KeyboardShortcut | undefined;
|
|
5121
5169
|
/**
|
|
5122
5170
|
* Remove every keyboard shortcut matching `options` (`keys` AND `scopes`).
|
|
5123
|
-
* Both fields are required and must be non-empty; use `'*'` to match all
|
|
5124
|
-
*
|
|
5171
|
+
* Both fields are required and must be non-empty; use `'*'` to match all —
|
|
5172
|
+
* for example, `keys: 'Mod+s'` with `scopes: '*'` removes that chord from
|
|
5173
|
+
* every scope. Throws on an empty field.
|
|
5125
5174
|
* @public
|
|
5126
5175
|
*/
|
|
5127
5176
|
remove(options: {
|