@cesdk/engine 1.7.0-alpha.1 → 1.7.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.
- package/assets/core/cesdk.data +0 -0
- package/assets/core/cesdk.wasm +0 -0
- package/index.d.ts +208 -55
- package/index.js +1 -1
- package/package.json +1 -1
package/assets/core/cesdk.data
CHANGED
|
Binary file
|
package/assets/core/cesdk.wasm
CHANGED
|
Binary file
|
package/index.d.ts
CHANGED
|
@@ -25,34 +25,77 @@ export declare interface Asset {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* API to query for assets.
|
|
29
|
-
*
|
|
30
|
-
* Could be remote or local.
|
|
31
|
-
*
|
|
32
|
-
* @typeParam QData - The shape of queries made against this API
|
|
33
28
|
* @public
|
|
34
29
|
*/
|
|
35
|
-
export declare
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
30
|
+
export declare class AssetAPI {
|
|
31
|
+
#private;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Adds a custom asset source. Its ID has to be unique.
|
|
35
|
+
* @param source - The asset source.
|
|
36
|
+
*/
|
|
37
|
+
addSource(source: AssetSource): void;
|
|
38
|
+
/**
|
|
39
|
+
* Removes an asset source with the given ID.
|
|
40
|
+
* @param id - The ID to refer to the asset source.
|
|
41
|
+
*/
|
|
42
|
+
removeSource(id: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Finds all registered asset sources.
|
|
45
|
+
* @returns A list with the IDs of all registered asset sources.
|
|
46
|
+
*/
|
|
47
|
+
findAllSources(): string[];
|
|
48
|
+
/**
|
|
49
|
+
* Finds all asset sources which support the given asset type.
|
|
50
|
+
* @returns A list of the IDs of the supported asset sources.
|
|
51
|
+
*/
|
|
52
|
+
findSourcesByType(type: string): string[];
|
|
53
|
+
/**
|
|
54
|
+
* Finds assets of a given type in a specific asset source.
|
|
55
|
+
* @param id - The ID of the asset source.
|
|
56
|
+
* @param type - The asset type to look for.
|
|
57
|
+
* @param query - All the options to filter the search results by.
|
|
58
|
+
* @returns The search results.
|
|
59
|
+
*/
|
|
60
|
+
findAssetsInSource(id: string, type: string, query: AssetQueryData): Promise<AssetsQueryResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Queries the asset source's groups for a certain asset type.
|
|
63
|
+
* @param id - The ID of the asset source.
|
|
64
|
+
* @param type - The asset type to filter by.
|
|
65
|
+
* @returns The asset groups.
|
|
66
|
+
*/
|
|
67
|
+
getGroupsInSource(id: string, type: string): Promise<string[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Queries the asset source's supported asset types.
|
|
70
|
+
* @param id - The ID of the asset source.
|
|
71
|
+
* @returns A list of the asset source's supported types.
|
|
72
|
+
*/
|
|
73
|
+
getTypesInSource(id: string): string[];
|
|
74
|
+
/**
|
|
75
|
+
* Checks whether the asset source supports the given asset type.
|
|
76
|
+
* @param id - The ID of the asset source.
|
|
77
|
+
* @param type - The asset type to check.
|
|
78
|
+
* @returns A boolean indicating whether the type is supported.
|
|
79
|
+
*/
|
|
80
|
+
hasTypeInSource(id: string, type: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Queries the asset source's credits info.
|
|
83
|
+
* @param id - The ID of the asset source.
|
|
84
|
+
* @returns The asset source's credits info consisting of a name and an optional URL.
|
|
85
|
+
*/
|
|
86
|
+
getSourceCredits(id: string): {
|
|
48
87
|
name: string;
|
|
49
|
-
url
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
|
|
88
|
+
url: string | undefined;
|
|
89
|
+
} | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Queries the asset source's license info.
|
|
92
|
+
* @param id - The ID of the asset source.
|
|
93
|
+
* @returns The asset source's license info consisting of a name and an optional URL.
|
|
94
|
+
*/
|
|
95
|
+
getSourceLicense(id: string): {
|
|
53
96
|
name: string;
|
|
54
|
-
url
|
|
55
|
-
};
|
|
97
|
+
url: string | undefined;
|
|
98
|
+
} | undefined;
|
|
56
99
|
}
|
|
57
100
|
|
|
58
101
|
/**
|
|
@@ -81,6 +124,8 @@ export declare interface AssetDefinition extends Asset {
|
|
|
81
124
|
export declare interface AssetQueryData {
|
|
82
125
|
/** A query string used for (fuzzy) searching of labels and tags */
|
|
83
126
|
query?: string;
|
|
127
|
+
/** The current page queried for paginated views. */
|
|
128
|
+
page: number;
|
|
84
129
|
/**
|
|
85
130
|
* Tags are searched with the query parameter, but this search is fuzzy.
|
|
86
131
|
* If one needs to get assets with exactly the tag (from a tag cloud or filter)
|
|
@@ -102,21 +147,6 @@ export declare interface AssetQueryData {
|
|
|
102
147
|
perPage: number;
|
|
103
148
|
}
|
|
104
149
|
|
|
105
|
-
/**
|
|
106
|
-
* The registry of all available assets and sources registered in the engine.
|
|
107
|
-
* @public
|
|
108
|
-
*/
|
|
109
|
-
export declare interface AssetRegistry {
|
|
110
|
-
/** Returns all sources available in the engine */
|
|
111
|
-
getSources(type?: string): AssetSource[];
|
|
112
|
-
/** Returns a source with the given id or undefined if not found */
|
|
113
|
-
getSource(id: string): AssetSource | undefined;
|
|
114
|
-
/** Adds a source to this registry. */
|
|
115
|
-
addSource(source: AssetSource): void;
|
|
116
|
-
/** Removes a source from this registry. */
|
|
117
|
-
removeSource(id: string): void;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
150
|
/**
|
|
121
151
|
* Single asset result of a query from the engine.
|
|
122
152
|
* @public
|
|
@@ -188,17 +218,52 @@ declare interface AssetResult_2 {
|
|
|
188
218
|
};
|
|
189
219
|
}
|
|
190
220
|
|
|
221
|
+
/** @public */
|
|
222
|
+
declare interface AssetResultContext {
|
|
223
|
+
sourceId: string;
|
|
224
|
+
createdByRole: string;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
declare interface AssetResultCredits {
|
|
228
|
+
name: string;
|
|
229
|
+
url: string;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
declare interface AssetResultLicense {
|
|
233
|
+
name: string;
|
|
234
|
+
url: string;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
declare interface AssetResultUtm {
|
|
238
|
+
source: string;
|
|
239
|
+
medium: string;
|
|
240
|
+
}
|
|
241
|
+
|
|
191
242
|
/**
|
|
192
243
|
* A source of assets
|
|
193
244
|
* @public
|
|
194
245
|
*/
|
|
195
|
-
export declare interface AssetSource
|
|
196
|
-
/**
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
246
|
+
export declare interface AssetSource {
|
|
247
|
+
/** The unique id of the API */
|
|
248
|
+
id: string;
|
|
249
|
+
/** Find all asset for the given type and the provided query data. */
|
|
250
|
+
findAssets(type: string, queryData: AssetQueryData): Promise<AssetsQueryResult>;
|
|
251
|
+
/** For a given type return every available group */
|
|
252
|
+
getGroups: (type: string) => Promise<string[]>;
|
|
253
|
+
/** Return all registered/available types */
|
|
254
|
+
getTypes: () => string[];
|
|
255
|
+
/** The given type is registered. */
|
|
256
|
+
hasType: (type: string) => boolean;
|
|
257
|
+
/** Credits for the source/api */
|
|
258
|
+
credits?: {
|
|
259
|
+
name: string;
|
|
260
|
+
url?: string;
|
|
261
|
+
};
|
|
262
|
+
/** General license for all asset from this source */
|
|
263
|
+
license?: {
|
|
264
|
+
name: string;
|
|
265
|
+
url?: string;
|
|
266
|
+
};
|
|
202
267
|
/**
|
|
203
268
|
* Indicates if the asset shall be downloaded to handle the raw data instead
|
|
204
269
|
* of an URL reference. Do this if you do not want to depend on
|
|
@@ -211,6 +276,12 @@ export declare interface AssetSource extends AssetAPI<PaginatedAssetQueryData> {
|
|
|
211
276
|
* @returns the asset or undefined if no asset with the given id could be found
|
|
212
277
|
*/
|
|
213
278
|
getAsset(id: string): Promise<AssetResult | undefined>;
|
|
279
|
+
/**
|
|
280
|
+
* Can the source add, update and remove assets dynamically? If `false`
|
|
281
|
+
* methods like `addAsset` `updateAsset` and `removeAsset` will throw an
|
|
282
|
+
* error.
|
|
283
|
+
*/
|
|
284
|
+
canManageAssets?: boolean;
|
|
214
285
|
/**
|
|
215
286
|
* Adds the given asset to this source. Throws an error if `canManageAssets`
|
|
216
287
|
* is `false`.
|
|
@@ -316,9 +387,10 @@ export declare class BlockAPI {
|
|
|
316
387
|
* Performs an internal update to resolve the final layout for the blocks.
|
|
317
388
|
* @param handle - The design block element to export.
|
|
318
389
|
* @param mimeType - The mime type of the output file.
|
|
390
|
+
* @param options - The options for exporting the block type
|
|
319
391
|
* @returns A promise that resolves with the exported image or is rejected with an error.
|
|
320
392
|
*/
|
|
321
|
-
export(handle: DesignBlockId, mimeType?: MimeType_2): Promise<Blob>;
|
|
393
|
+
export(handle: DesignBlockId, mimeType?: MimeType_2, options?: ExportOptions): Promise<Blob>;
|
|
322
394
|
|
|
323
395
|
/**
|
|
324
396
|
* Loads existing blocks from the given string.
|
|
@@ -1392,7 +1464,7 @@ declare class CreativeEngine {
|
|
|
1392
1464
|
scene: SceneAPI;
|
|
1393
1465
|
variable: VariableAPI;
|
|
1394
1466
|
editor: EditorAPI;
|
|
1395
|
-
|
|
1467
|
+
asset: AssetAPI;
|
|
1396
1468
|
event: EventAPI;
|
|
1397
1469
|
|
|
1398
1470
|
/**
|
|
@@ -1632,8 +1704,44 @@ export declare class EventAPI {
|
|
|
1632
1704
|
subscribe(blocks: DesignBlockId[], callback: (events: BlockEvent[]) => void): () => void;
|
|
1633
1705
|
}
|
|
1634
1706
|
|
|
1707
|
+
/**
|
|
1708
|
+
* @public
|
|
1709
|
+
*/
|
|
1710
|
+
export declare type ExportOptions = {
|
|
1711
|
+
/**
|
|
1712
|
+
* The PNG compression level to use, when exporting to PNG.
|
|
1713
|
+
*
|
|
1714
|
+
* Valid values are 0 to 9, higher means smaller, but slower.
|
|
1715
|
+
* Quality is not affected.
|
|
1716
|
+
* Ignored for other encodings.
|
|
1717
|
+
* @defaultValue 5.
|
|
1718
|
+
*/
|
|
1719
|
+
pngCompressionLevel?: number;
|
|
1720
|
+
/**
|
|
1721
|
+
* The JPEG quality to use when encoding to JPEG.
|
|
1722
|
+
*
|
|
1723
|
+
* Valid values are (0-1], higher means better quality.
|
|
1724
|
+
* Ignored for other encodings.
|
|
1725
|
+
*
|
|
1726
|
+
* @defaultValue 0.9
|
|
1727
|
+
*/
|
|
1728
|
+
jpegQuality?: number;
|
|
1729
|
+
/**
|
|
1730
|
+
* An optional target width used in conjunction with target height.
|
|
1731
|
+
* If used, the block will be rendered large enough, that it fills the target
|
|
1732
|
+
* size entirely while maintaining its aspect ratio.
|
|
1733
|
+
*/
|
|
1734
|
+
targetWidth?: number;
|
|
1735
|
+
/**
|
|
1736
|
+
* An optional target height used in conjunction with target width.
|
|
1737
|
+
* If used, the block will be rendered large enough, that it fills the target
|
|
1738
|
+
* size entirely while maintaining its aspect ratio.
|
|
1739
|
+
*/
|
|
1740
|
+
targetHeight?: number;
|
|
1741
|
+
};
|
|
1742
|
+
|
|
1635
1743
|
/** @public */
|
|
1636
|
-
declare interface
|
|
1744
|
+
declare interface ExportOptions_2 {
|
|
1637
1745
|
jpegQuality: number;
|
|
1638
1746
|
pngCompressionLevel: number;
|
|
1639
1747
|
useTargetSize: boolean;
|
|
@@ -1662,6 +1770,50 @@ declare type Extensions = {
|
|
|
1662
1770
|
*/
|
|
1663
1771
|
export declare type FillType = 'Solid' | 'Gradient';
|
|
1664
1772
|
|
|
1773
|
+
declare interface FindAssetResult {
|
|
1774
|
+
id: string;
|
|
1775
|
+
type: string;
|
|
1776
|
+
groups: Vector<string>;
|
|
1777
|
+
thumbUri: string;
|
|
1778
|
+
width: number;
|
|
1779
|
+
height: number;
|
|
1780
|
+
meta: UnorderedMap<string, string>;
|
|
1781
|
+
locale: string;
|
|
1782
|
+
label: string;
|
|
1783
|
+
tags: Vector<string>;
|
|
1784
|
+
context: AssetResultContext;
|
|
1785
|
+
credits: AssetResultCredits;
|
|
1786
|
+
license: AssetResultLicense;
|
|
1787
|
+
utm: AssetResultUtm;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
declare interface FindAssetsQuery {
|
|
1791
|
+
perPage: number;
|
|
1792
|
+
page: number;
|
|
1793
|
+
query: string;
|
|
1794
|
+
tags: string[];
|
|
1795
|
+
groups: string[];
|
|
1796
|
+
excludeGroups: string[];
|
|
1797
|
+
locale: string;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
declare interface FindAssetsQueryCpp {
|
|
1801
|
+
perPage: number;
|
|
1802
|
+
page: number;
|
|
1803
|
+
query: string;
|
|
1804
|
+
tags: Vector<string>;
|
|
1805
|
+
groups: Vector<string>;
|
|
1806
|
+
excludeGroups: Vector<string>;
|
|
1807
|
+
locale: string;
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
declare interface FindAssetsResult {
|
|
1811
|
+
assets: Vector<FindAssetResult>;
|
|
1812
|
+
currentPage: number;
|
|
1813
|
+
nextPage: number;
|
|
1814
|
+
total: number;
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1665
1817
|
/** @public */
|
|
1666
1818
|
declare interface Flip {
|
|
1667
1819
|
horizontal: boolean;
|
|
@@ -1780,12 +1932,6 @@ declare type PageFormatDefinition = Preset & {
|
|
|
1780
1932
|
bleedMargin?: number;
|
|
1781
1933
|
};
|
|
1782
1934
|
|
|
1783
|
-
/** @public */
|
|
1784
|
-
export declare interface PaginatedAssetQueryData extends AssetQueryData {
|
|
1785
|
-
/** The current page queried for paginated views. */
|
|
1786
|
-
page: number;
|
|
1787
|
-
}
|
|
1788
|
-
|
|
1789
1935
|
/**
|
|
1790
1936
|
* - Absolute: Position in absolute design units.
|
|
1791
1937
|
* - Percent: Position in relation to the block's parent's size in percent, where 1.0 means 100%.
|
|
@@ -2031,6 +2177,13 @@ declare type TypefaceDefinition = Preset & {
|
|
|
2031
2177
|
}[];
|
|
2032
2178
|
};
|
|
2033
2179
|
|
|
2180
|
+
declare interface UnorderedMap<K, V> {
|
|
2181
|
+
size: () => number;
|
|
2182
|
+
get: (key: K) => V;
|
|
2183
|
+
set: (key: K, value: V) => void;
|
|
2184
|
+
keys: () => Vector<K>;
|
|
2185
|
+
}
|
|
2186
|
+
|
|
2034
2187
|
/**
|
|
2035
2188
|
* @public
|
|
2036
2189
|
*/
|