@cesdk/engine 1.7.0 → 1.8.0-alpha.2
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.
|
File without changes
|
|
Binary file
|
package/index.d.ts
CHANGED
|
@@ -77,6 +77,8 @@ export declare class AssetAPI {
|
|
|
77
77
|
url: string | undefined;
|
|
78
78
|
} | undefined;
|
|
79
79
|
canManageAssets(sourceId: string): boolean;
|
|
80
|
+
|
|
81
|
+
|
|
80
82
|
/**
|
|
81
83
|
* Apply an asset result to the active scene.
|
|
82
84
|
* The default behavior will instantiate a block and configure it according to the asset's properties.
|
|
@@ -85,6 +87,12 @@ export declare class AssetAPI {
|
|
|
85
87
|
* @param assetResult - A single assetResult of a `findAssets` query.
|
|
86
88
|
*/
|
|
87
89
|
apply(sourceId: string, assetResult: AssetResult): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* The default implementation for applying an asset to the scene.
|
|
92
|
+
* This implementation is used when no `applyAsset` function is provided to `addSource`.
|
|
93
|
+
* @param assetResult - A single assetResult of a `findAssets` query.
|
|
94
|
+
*/
|
|
95
|
+
defaultApplyAsset(assetResult: AssetResult): Promise<void>;
|
|
88
96
|
}
|
|
89
97
|
|
|
90
98
|
/**
|
|
@@ -243,7 +251,7 @@ export declare interface AssetSource {
|
|
|
243
251
|
/**
|
|
244
252
|
* @returns the asset or undefined if no asset with the given id could be found
|
|
245
253
|
*/
|
|
246
|
-
getAsset(id: string): Promise<AssetResult | undefined>;
|
|
254
|
+
getAsset?(id: string): Promise<AssetResult | undefined>;
|
|
247
255
|
/**
|
|
248
256
|
* Can the source add, update and remove assets dynamically? If `false`
|
|
249
257
|
* methods like `addAsset` `updateAsset` and `removeAsset` will throw an
|
|
@@ -261,20 +269,20 @@ export declare interface AssetSource {
|
|
|
261
269
|
*
|
|
262
270
|
* @returns the id of the added asset
|
|
263
271
|
*/
|
|
264
|
-
addAsset(asset: AssetDefinition): Promise<string>;
|
|
272
|
+
addAsset?(asset: AssetDefinition): Promise<string>;
|
|
265
273
|
/**
|
|
266
274
|
* Updates the asset of this source. Throws an error if `canManageAssets`
|
|
267
275
|
* is `false` or no asset with the given id could not be found.
|
|
268
276
|
*
|
|
269
277
|
* @returns the id of the added asset
|
|
270
278
|
*/
|
|
271
|
-
updateAsset(assetId: string, asset: AssetDefinition): Promise<void>;
|
|
279
|
+
updateAsset?(assetId: string, asset: AssetDefinition): Promise<void>;
|
|
272
280
|
/**
|
|
273
281
|
* Removes the given asset from this source.
|
|
274
282
|
*
|
|
275
283
|
* @returns true if asset was found and removed, and false otherwise
|
|
276
284
|
*/
|
|
277
|
-
removeAsset(assetId: string): Promise<boolean>;
|
|
285
|
+
removeAsset?(assetId: string): Promise<boolean>;
|
|
278
286
|
}
|
|
279
287
|
|
|
280
288
|
/**
|
|
@@ -351,9 +359,6 @@ declare interface AssetsQueryResult_2 {
|
|
|
351
359
|
*/
|
|
352
360
|
export declare type BlendMode = 'PassThrough' | 'Normal' | 'Darken' | 'Multiply' | 'ColorBurn' | 'Lighten' | 'Screen' | 'ColorDodge' | 'Overlay' | 'SoftLight' | 'HardLight' | 'Difference' | 'Exclusion' | 'Hue' | 'Saturation' | 'Color' | 'Luminosity';
|
|
353
361
|
|
|
354
|
-
/** @public */
|
|
355
|
-
declare type Block = number;
|
|
356
|
-
|
|
357
362
|
/**
|
|
358
363
|
* @public
|
|
359
364
|
*/
|
|
@@ -1603,17 +1608,9 @@ export declare class BlockAPI {
|
|
|
1603
1608
|
isAllowedByScope(id: DesignBlockId, key: string): boolean;
|
|
1604
1609
|
}
|
|
1605
1610
|
|
|
1606
|
-
/**
|
|
1607
|
-
* @public
|
|
1608
|
-
*/
|
|
1609
|
-
export declare type BlockEvent = {
|
|
1610
|
-
block: DesignBlockId;
|
|
1611
|
-
type: 'Created' | 'Updated' | 'Destroyed';
|
|
1612
|
-
};
|
|
1613
|
-
|
|
1614
1611
|
/** @public */
|
|
1615
|
-
declare interface
|
|
1616
|
-
block:
|
|
1612
|
+
export declare interface BlockEvent {
|
|
1613
|
+
block: DesignBlockId;
|
|
1617
1614
|
type: 'Created' | 'Updated' | 'Destroyed';
|
|
1618
1615
|
}
|
|
1619
1616
|
|
|
@@ -1744,21 +1741,40 @@ declare class CreativeEngine {
|
|
|
1744
1741
|
scene: SceneAPI;
|
|
1745
1742
|
variable: VariableAPI;
|
|
1746
1743
|
|
|
1744
|
+
get element(): HTMLCreativeEngineCanvasElement | undefined;
|
|
1747
1745
|
/**
|
|
1748
1746
|
* Dispose the engine.
|
|
1749
1747
|
*/
|
|
1750
1748
|
dispose(): void;
|
|
1751
1749
|
/**
|
|
1752
1750
|
* Initialize a `CreativeEngine` using the given `canvas` element and an optional config.
|
|
1753
|
-
* @param config -
|
|
1751
|
+
* @param config - An optional configuration object.
|
|
1754
1752
|
* @param canvas - The canvas to use for drawing. Optional, if no canvas is provided,
|
|
1755
1753
|
* the engine works with an internal offscreen-canvas.
|
|
1756
1754
|
* @returns An engine instance.
|
|
1757
1755
|
*/
|
|
1758
|
-
static init(config?: Partial<Configuration
|
|
1756
|
+
static init(config?: Partial<Configuration>): Promise<CreativeEngine & {
|
|
1757
|
+
readonly element: HTMLCreativeEngineCanvasElement;
|
|
1758
|
+
}>;
|
|
1759
|
+
static init(config: Partial<Configuration> | undefined, canvas: HTMLCanvasElement | OffscreenCanvas): Promise<CreativeEngine & {
|
|
1760
|
+
readonly element: undefined;
|
|
1761
|
+
}>;
|
|
1759
1762
|
}
|
|
1760
1763
|
export default CreativeEngine;
|
|
1761
1764
|
|
|
1765
|
+
/**
|
|
1766
|
+
* Dispatched on the engine canvas when the text input has been blurred.
|
|
1767
|
+
* Call `preventDefault()` to disallow this and refocus the engine text input.
|
|
1768
|
+
* @public
|
|
1769
|
+
*/
|
|
1770
|
+
export declare interface CursorEvent extends CustomEvent<string> {
|
|
1771
|
+
readonly type: 'cesdk-cursor';
|
|
1772
|
+
/** Contains the cursor style */
|
|
1773
|
+
readonly detail: string;
|
|
1774
|
+
/** If default is prevented, the Creative Engine won't apply the cursor style to itself. */
|
|
1775
|
+
preventDefault(): void;
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1762
1778
|
/**
|
|
1763
1779
|
* A numerical identifier for a design block
|
|
1764
1780
|
* @public
|
|
@@ -1951,6 +1967,13 @@ export declare class EditorAPI {
|
|
|
1951
1967
|
* @param resolver - Custom resolution function.
|
|
1952
1968
|
*/
|
|
1953
1969
|
setURIResolver(resolver: (URI: string) => string): void;
|
|
1970
|
+
/**
|
|
1971
|
+
* This is the default implementation for the URI resolver.
|
|
1972
|
+
* It resolves the given path relative to the `ubq://basePath` setting.
|
|
1973
|
+
* @param relativePath - The relative path that should be resolved.
|
|
1974
|
+
* @returns The resolved absolute URI.
|
|
1975
|
+
*/
|
|
1976
|
+
defaultURIResolver(relativePath: string): string;
|
|
1954
1977
|
/**
|
|
1955
1978
|
* Resolves the given path.
|
|
1956
1979
|
* If a custom resolver has been set with `setURIResolver`, it invokes it with the given path.
|
|
@@ -2023,6 +2046,12 @@ export declare type ExportOptions = {
|
|
|
2023
2046
|
* size entirely while maintaining its aspect ratio.
|
|
2024
2047
|
*/
|
|
2025
2048
|
targetHeight?: number;
|
|
2049
|
+
/**
|
|
2050
|
+
* Export the PDF document with a higher compatibility to different PDF viewers.
|
|
2051
|
+
* Bitmap images and some effects like gradients will be rasterized with the DPI
|
|
2052
|
+
* setting instead of embedding them directly.
|
|
2053
|
+
*/
|
|
2054
|
+
exportPdfWithHighCompatibility?: boolean;
|
|
2026
2055
|
};
|
|
2027
2056
|
|
|
2028
2057
|
/** @public */
|
|
@@ -2032,6 +2061,7 @@ declare interface ExportOptions_2 {
|
|
|
2032
2061
|
useTargetSize: boolean;
|
|
2033
2062
|
targetWidth: number;
|
|
2034
2063
|
targetHeight: number;
|
|
2064
|
+
exportPdfWithHighCompatibility: boolean;
|
|
2035
2065
|
}
|
|
2036
2066
|
|
|
2037
2067
|
/** @public */
|
|
@@ -2117,6 +2147,23 @@ declare type Groups = string[];
|
|
|
2117
2147
|
*/
|
|
2118
2148
|
declare type HexColorString = string;
|
|
2119
2149
|
|
|
2150
|
+
/**
|
|
2151
|
+
* A wrapper around a plain canvas
|
|
2152
|
+
*
|
|
2153
|
+
* The idea is to shield the user from the weird semantics of changing width
|
|
2154
|
+
* and height of a canvas by making this a opaque block element instead and
|
|
2155
|
+
* managing the internal render resolution of the canvas dynamically
|
|
2156
|
+
*
|
|
2157
|
+
* @public
|
|
2158
|
+
*/
|
|
2159
|
+
export declare class HTMLCreativeEngineCanvasElement extends HTMLElement {
|
|
2160
|
+
#private;
|
|
2161
|
+
constructor();
|
|
2162
|
+
connectedCallback(): void;
|
|
2163
|
+
disconnectedCallback(): void;
|
|
2164
|
+
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2120
2167
|
/** @public */
|
|
2121
2168
|
declare type ImageDefinition = Preset & {
|
|
2122
2169
|
imageURL: string;
|
|
@@ -2182,6 +2229,7 @@ declare type PageFormatDefinition = Preset & {
|
|
|
2182
2229
|
unit: DesignUnit;
|
|
2183
2230
|
dpi?: number;
|
|
2184
2231
|
bleedMargin?: number;
|
|
2232
|
+
fixedOrientation?: boolean;
|
|
2185
2233
|
};
|
|
2186
2234
|
|
|
2187
2235
|
/**
|