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