@cesdk/cesdk-js 1.4.0-alpha.4 → 1.4.0-alpha.5
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/BlockAPI.d.ts +23 -3
- package/PropertyAPI.d.ts +359 -0
- package/SceneAPI.d.ts +1 -1
- package/api.d.ts +3 -0
- package/assets/core/cesdk.data +0 -0
- package/assets/core/cesdk.wasm +0 -0
- package/assets/i18n/de-x-swisspost.json +484 -0
- package/assets/i18n/de.json +775 -1409
- package/assets/i18n/en-x-swisspost.json +658 -0
- package/assets/i18n/en.json +845 -1473
- package/assets/i18n/fr.json +484 -0
- package/assets/i18n/it.json +484 -0
- package/assets/templates/cesdk_collage_1.scene +1 -1
- package/assets/templates/cesdk_instagram_photo_1.scene +1 -1
- package/assets/templates/cesdk_instagram_story_1.scene +1 -1
- package/assets/templates/cesdk_postcard_1.scene +1 -1
- package/assets/templates/cesdk_postcard_2.scene +1 -1
- package/assets/templates/cesdk_poster_1.scene +1 -1
- package/assets/templates/cesdk_presentation_1.scene +1 -1
- package/cesdk-engine.umd.d.ts +7 -0
- package/cesdk-engine.umd.js +1 -1
- package/cesdk.umd.js +1 -1
- package/package.json +1 -1
package/BlockAPI.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
type Vec2 = { x: number; y: number };
|
|
2
2
|
type DesignElementId = number;
|
|
3
3
|
type DesignElementType = string;
|
|
4
|
-
type MimeType =
|
|
4
|
+
type MimeType =
|
|
5
|
+
| 'image/png'
|
|
6
|
+
| 'image/jpeg'
|
|
7
|
+
| 'image/x-tga'
|
|
8
|
+
| 'application/octet-stream';
|
|
5
9
|
type Size = number; // | 'auto';
|
|
6
10
|
type Size2 = {
|
|
7
11
|
width: Size;
|
|
@@ -13,10 +17,26 @@ export default class BlockAPI {
|
|
|
13
17
|
* Exports a design block element as a file of the given mime type.
|
|
14
18
|
* Performs an internal update to resolve the final layout for the blocks.
|
|
15
19
|
* @param handle The design block element to export.
|
|
16
|
-
* @param mimeType The mime type of the output file.
|
|
20
|
+
* @param mimeType The mime type of the output file. Defaults to 'image/png'
|
|
17
21
|
* @returns A promise that resolves with the exported image or is rejected with an error.
|
|
18
22
|
*/
|
|
19
|
-
export(handle: DesignElementId, mimeType
|
|
23
|
+
export(handle: DesignElementId, mimeType?: MimeType): Promise<Blob>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Loads existing blocks from the given string.
|
|
27
|
+
* The blocks are not attached by default and won't be visible until attached to a page or the scene.
|
|
28
|
+
* @param content A string representing the given blocks.
|
|
29
|
+
* @returns A promise that resolves with a list of handles representing the found blocks or an error.
|
|
30
|
+
*/
|
|
31
|
+
loadFromString(content: string): Promise<DesignElementId[]>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Saves the given blocks into a string. If given the root of a block hierarchy, e.g. a
|
|
35
|
+
* page with multiple children, the entire hierarchy is saved.
|
|
36
|
+
* @param blocks
|
|
37
|
+
* @returns A promise that resolves to a string representing the blocks or an error.
|
|
38
|
+
*/
|
|
39
|
+
saveToString(blocks: DesignElementId[]): Promise<string>;
|
|
20
40
|
|
|
21
41
|
/**
|
|
22
42
|
* Create a new block, fails if type is unknown.
|
package/PropertyAPI.d.ts
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
type DesignBlockId = number;
|
|
2
|
+
type RGBA = [r: number, g: number, b: number, a: number];
|
|
3
|
+
type Size2 = {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
};
|
|
7
|
+
type Crop = {
|
|
8
|
+
scaleX: number;
|
|
9
|
+
scaleY: number;
|
|
10
|
+
rotation: number;
|
|
11
|
+
translationX: number;
|
|
12
|
+
translationY: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export enum PropertyType {
|
|
16
|
+
Bool = 'Bool',
|
|
17
|
+
Int = 'Int',
|
|
18
|
+
Float = 'Float',
|
|
19
|
+
String = 'String',
|
|
20
|
+
Color = 'Color',
|
|
21
|
+
Size = 'Size',
|
|
22
|
+
Enum = 'Enum',
|
|
23
|
+
Struct = 'Struct'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default class PropertyAPI {
|
|
27
|
+
/**
|
|
28
|
+
* Get all available properties of a block.
|
|
29
|
+
* @param id The block whose properties should be queried.
|
|
30
|
+
* @returns A list of the property names.
|
|
31
|
+
*/
|
|
32
|
+
findAll(id: DesignBlockId): string[];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Get the type of a property given its name.
|
|
36
|
+
* @param property The name of the property whose type should be queried.
|
|
37
|
+
* @returns The property type.
|
|
38
|
+
*/
|
|
39
|
+
getType(property: string): PropertyType;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Get all the possible values of an enum given an enum property.
|
|
43
|
+
* @param enumProperty The name of the property whose enum values should be queried.
|
|
44
|
+
* @returns A list of the enum value names as string.
|
|
45
|
+
*/
|
|
46
|
+
getEnumValues<T = string>(enumProperty: string): T[];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Set a bool property of the given design block to the given value.
|
|
50
|
+
* @param id The block whose property should be set.
|
|
51
|
+
* @param property The name of the property to set.
|
|
52
|
+
* @param value The value to set.
|
|
53
|
+
*/
|
|
54
|
+
setBool(id: DesignBlockId, property: string, value: boolean): void;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Get the value of a bool property of the given design block.
|
|
58
|
+
* @param id The block whose property should be queried.
|
|
59
|
+
* @param property The name of the property to query.
|
|
60
|
+
* @returns The value of the property.
|
|
61
|
+
*/
|
|
62
|
+
getBool(id: DesignBlockId, property: string): boolean;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Set an int property of the given design block to the given value.
|
|
66
|
+
* @param id The block whose property should be set.
|
|
67
|
+
* @param property The name of the property to set.
|
|
68
|
+
* @param value The value to set.
|
|
69
|
+
*/
|
|
70
|
+
setInt(id: DesignBlockId, property: string, value: number): void;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Get the value of an int property of the given design block.
|
|
74
|
+
* @param id The block whose property should be queried.
|
|
75
|
+
* @param property The name of the property to query.
|
|
76
|
+
* @returns The value of the property.
|
|
77
|
+
*/
|
|
78
|
+
getInt(id: DesignBlockId, property: string): number;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Set a float property of the given design block to the given value.
|
|
82
|
+
* @param id The block whose property should be set.
|
|
83
|
+
* @param property The name of the property to set.
|
|
84
|
+
* @param value The value to set.
|
|
85
|
+
*/
|
|
86
|
+
setFloat(id: DesignBlockId, property: string, value: number): void;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Get the value of a float property of the given design block.
|
|
90
|
+
* @param id The block whose property should be queried.
|
|
91
|
+
* @param property The name of the property to query.
|
|
92
|
+
* @returns The value of the property.
|
|
93
|
+
*/
|
|
94
|
+
getFloat(id: DesignBlockId, property: string): number;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Set a string property of the given design block to the given value.
|
|
98
|
+
* @param id The block whose property should be set.
|
|
99
|
+
* @param property The name of the property to set.
|
|
100
|
+
* @param value The value to set.
|
|
101
|
+
*/
|
|
102
|
+
setString(id: DesignBlockId, property: string, value: string): void;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Get the value of a string property of the given design block.
|
|
106
|
+
* @param id The block whose property should be queried.
|
|
107
|
+
* @param property The name of the property to query.
|
|
108
|
+
* @returns The value of the property.
|
|
109
|
+
*/
|
|
110
|
+
getString(id: DesignBlockId, property: string): string;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Set a color property of the given design block to the given value.
|
|
114
|
+
* @param id The block whose property should be set.
|
|
115
|
+
* @param property The name of the property to set.
|
|
116
|
+
* @param color A tuple of channels red, green, blue and alpha in the range 0 to 1.
|
|
117
|
+
*/
|
|
118
|
+
setColorRGBA(id: DesignBlockId, property: string, color: RGBA): void;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Get the value of a string property of the given design block.
|
|
122
|
+
* @param id The block whose property should be queried.
|
|
123
|
+
* @param property The name of the property to query.
|
|
124
|
+
* @returns The value of the property.
|
|
125
|
+
*/
|
|
126
|
+
getColorRGBA(id: DesignBlockId, property: string): RGBA;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Set a size property's width of the given design block to the given value.
|
|
130
|
+
* @param id The block whose property should be set.
|
|
131
|
+
* @param property The name of the property to set.
|
|
132
|
+
* @param value The width to set to.
|
|
133
|
+
*/
|
|
134
|
+
setSize2Width(id: DesignBlockId, property: string, value: number);
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Set a size property's height of the given design block to the given value.
|
|
138
|
+
* @param id The block whose property should be set.
|
|
139
|
+
* @param property The name of the property to set.
|
|
140
|
+
* @param value The height to set to.
|
|
141
|
+
*/
|
|
142
|
+
setSize2Height(id: DesignBlockId, property: string, value: number): void;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Get the value of a size property of the given design block.
|
|
146
|
+
* @param id The block whose property should be queried.
|
|
147
|
+
* @param property The name of the property to query.
|
|
148
|
+
* @returns The value of the property.
|
|
149
|
+
*/
|
|
150
|
+
getSize2(id: DesignBlockId, property: string): Size2;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Set an enum property of the given design block to the given value.
|
|
154
|
+
* @param block The block whose property should be set.
|
|
155
|
+
* @param property The name of the property to set.
|
|
156
|
+
* @param value The enum value as string.
|
|
157
|
+
*/
|
|
158
|
+
setEnum(id: DesignBlockId, property: string, value: string): void;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Get the value of an enum property of the given design block.
|
|
162
|
+
* @param block The block whose property should be queried.
|
|
163
|
+
* @param property The name of the property to query.
|
|
164
|
+
* @returns The value as string.
|
|
165
|
+
*/
|
|
166
|
+
getEnum(id: DesignBlockId, property: string): string;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Query if the given block has crop properties.
|
|
170
|
+
* @param id The block to query.
|
|
171
|
+
* @returns true, if the block has crop properties.
|
|
172
|
+
*/
|
|
173
|
+
hasCrop(id: DesignBlockId): boolean;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Set the crop scale in x direction of the given design block.
|
|
177
|
+
* @param id The block whose crop should be set.
|
|
178
|
+
* @param scaleX The scale in x direction.
|
|
179
|
+
*/
|
|
180
|
+
setCropScaleX(id: DesignBlockId, scaleX: number): void;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Set the crop scale in y direction of the given design block.
|
|
184
|
+
* @param id The block whose crop should be set.
|
|
185
|
+
* @param scaleY The scale in y direction.
|
|
186
|
+
*/
|
|
187
|
+
setCropScaleY(id: DesignBlockId, scaleY: number): void;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Set the crop rotation of the given design block.
|
|
191
|
+
* @param id The block whose crop should be set.
|
|
192
|
+
* @param rotation The rotation in radians.
|
|
193
|
+
*/
|
|
194
|
+
setCropRotation(id: DesignBlockId, rotation: number): void;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Set the crop translation in x direction of the given design block.
|
|
198
|
+
* @param id The block whose crop should be set.
|
|
199
|
+
* @param translationY The translation in x direction.
|
|
200
|
+
*/
|
|
201
|
+
setCropTranslationX(id: DesignBlockId, translationX: number): void;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Set the crop translation in y direction of the given design block.
|
|
205
|
+
* @param id The block whose crop should be set.
|
|
206
|
+
* @param translationY The translation in y direction.
|
|
207
|
+
*/
|
|
208
|
+
setCropTranslationY(id: DesignBlockId, translationY: number): void;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Get the crop of the given design block.
|
|
212
|
+
* @param id The block whose crop should be queried.
|
|
213
|
+
* @returns An object with crop properties of scale, rotation and translation.
|
|
214
|
+
*/
|
|
215
|
+
getCrop(id: DesignBlockId): Crop;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Query if the given block has an opacity.
|
|
219
|
+
* @param id The block to query.
|
|
220
|
+
* @returns true, if the block has an opcity.
|
|
221
|
+
*/
|
|
222
|
+
hasOpacity(id: DesignBlockId): boolean;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Set the opacity of the given design block.
|
|
226
|
+
* @param id The block whose opacity should be set.
|
|
227
|
+
* @param opacity The opacity to be set. The valid range is 0 to 1.
|
|
228
|
+
*/
|
|
229
|
+
setOpacity(id: DesignBlockId, opacity: number): void;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Get the opacity of the given design block.
|
|
233
|
+
* @param id The block whose opacity should be queried.
|
|
234
|
+
* @param opacity The opacity.
|
|
235
|
+
*/
|
|
236
|
+
getOpacity(id: DesignBlockId): number;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Query if the given block has fill color properties.
|
|
240
|
+
* @param id The block to query.
|
|
241
|
+
* @returns true, if the block has fill color properties.
|
|
242
|
+
*/
|
|
243
|
+
hasFillColor(id: DesignBlockId): boolean;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Set the fill color of the given design block.
|
|
247
|
+
* @param id The block whose fill color should be set.
|
|
248
|
+
* @param color The fill color to be set, a tuple of
|
|
249
|
+
* red, green, blue and alpha in the range of 0 to 1.
|
|
250
|
+
*/
|
|
251
|
+
setFillColorRGBA(id: DesignBlockId, color: RGBA): void;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Get the fill color of the given design block.
|
|
255
|
+
* @param id The block whose fill color should be queried.
|
|
256
|
+
* @returns The fill color.
|
|
257
|
+
*/
|
|
258
|
+
getFillColorRGBA(id: DesignBlockId): RGBA;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Enable or disable the fill of the given design block.
|
|
262
|
+
* @param id The block whose fill should be enabled or disabled.
|
|
263
|
+
* @param enabled If true, the fill will be enabled.
|
|
264
|
+
*/
|
|
265
|
+
setFillColorEnabled(id: DesignBlockId, enabled: boolean): void;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Query if the fill of the given design block is enabled.
|
|
269
|
+
* @param id The block whose fill state should be queried.
|
|
270
|
+
* @returns True, if fill is enabled.
|
|
271
|
+
*/
|
|
272
|
+
isFillColorEnabled(id: DesignBlockId): boolean;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Query if the given block has background color properties.
|
|
276
|
+
* @param id The block to query.
|
|
277
|
+
* @returns true, if the block has background color properties.
|
|
278
|
+
*/
|
|
279
|
+
hasBackgroundColor(id: DesignBlockId): boolean;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Set the background color of the given design block.
|
|
283
|
+
* @param id The block whose background color should be set.
|
|
284
|
+
* @param color The background color to be set, a tuple of
|
|
285
|
+
* red, green, blue and alpha in the range of 0 to 1.
|
|
286
|
+
*/
|
|
287
|
+
setBackgroundColorRGBA(id: DesignBlockId, color: RGBA): void;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Get the background color of the given design block.
|
|
291
|
+
* @param id The block whose background color should be queried.
|
|
292
|
+
* @returns The background color.
|
|
293
|
+
*/
|
|
294
|
+
getBackgroundColorRGBA(id: DesignBlockId): RGBA;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Enable or disable the background of the given design block.
|
|
298
|
+
* @param id The block whose background should be enabled or disabled.
|
|
299
|
+
* @param enabled If true, the background will be enabled.
|
|
300
|
+
*/
|
|
301
|
+
setBackgroundColorEnabled(id: DesignBlockId, enabled: boolean): void;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Query if the background of the given design block is enabled.
|
|
305
|
+
* @param id The block whose background state should be queried.
|
|
306
|
+
* @returns True, if background is enabled.
|
|
307
|
+
*/
|
|
308
|
+
isBackgroundColorEnabled(id: DesignBlockId): boolean;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Query if the given block has outline properties.
|
|
312
|
+
* @param id The block to query.
|
|
313
|
+
* @returns true, if the block has outline properties.
|
|
314
|
+
*/
|
|
315
|
+
hasOutline(id: DesignBlockId): boolean;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Set the outline color of the given design block.
|
|
319
|
+
* @param id The block whose outline color should be set.
|
|
320
|
+
* @param color The outline color to be set, a tuple of
|
|
321
|
+
* red, green, blue and alpha in the range of 0 to 1.
|
|
322
|
+
*/
|
|
323
|
+
setOutlineColorRGBA(id: DesignBlockId, color: RGBA): void;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Get the outline color of the given design block.
|
|
327
|
+
* @param id The block whose outline color should be queried.
|
|
328
|
+
* @returns The outline color.
|
|
329
|
+
*/
|
|
330
|
+
getOutlineColorRGBA(id: DesignBlockId): RGBA;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Enable or disable the outline of the given design block.
|
|
334
|
+
* @param id The block whose outline should be enabled or disabled.
|
|
335
|
+
* @param enabled If true, the outline will be enabled.
|
|
336
|
+
*/
|
|
337
|
+
setOutlineEnabled(id: DesignBlockId, enabled: boolean): void;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Query if the outline of the given design block is enabled.
|
|
341
|
+
* @param id The block whose outline state should be queried.
|
|
342
|
+
* @returns True, if outline is enabled.
|
|
343
|
+
*/
|
|
344
|
+
isOutlineEnabled(id: DesignBlockId): boolean;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Set the outline width of the given design block.
|
|
348
|
+
* @param id The block whose outline width should be set.
|
|
349
|
+
* @param width The outline width to be set.
|
|
350
|
+
*/
|
|
351
|
+
setOutlineWidth(id: DesignBlockId, width: number): void;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Get the outline width of the given design block.
|
|
355
|
+
* @param id The block whose outline width should be queried.
|
|
356
|
+
* @returns The outline width.
|
|
357
|
+
*/
|
|
358
|
+
getOutlineWidth(id: DesignBlockId): number;
|
|
359
|
+
}
|
package/SceneAPI.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export default class SceneAPI {
|
|
|
6
6
|
* @param sceneContent The scene file contents, a base64 string.
|
|
7
7
|
* @returns A handle to the loaded scene.
|
|
8
8
|
*/
|
|
9
|
-
loadFromString(sceneContent: string): DesignBlockId
|
|
9
|
+
loadFromString(sceneContent: string): Promise<DesignBlockId>;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Load a scene from the URL to the scene file.
|
package/api.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import BlockAPI from './BlockAPI';
|
|
2
2
|
import SceneAPI from './SceneAPI';
|
|
3
|
+
import PropertyAPI from './PropertyAPI';
|
|
3
4
|
import VariableAPI from './VariableAPI';
|
|
4
5
|
|
|
5
6
|
export default class API {
|
|
@@ -7,5 +8,7 @@ export default class API {
|
|
|
7
8
|
|
|
8
9
|
scene: SceneAPI;
|
|
9
10
|
|
|
11
|
+
property: PropertyAPI;
|
|
12
|
+
|
|
10
13
|
variable: VariableAPI;
|
|
11
14
|
}
|
package/assets/core/cesdk.data
CHANGED
|
Binary file
|
package/assets/core/cesdk.wasm
CHANGED
|
Binary file
|