@cesdk/cesdk-js 1.4.5 → 1.5.0

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.
Files changed (123) hide show
  1. package/.browserslistrc +4 -4
  2. package/ThirdPartyLicenses.md +59 -256
  3. package/assets/core/cesdk.data +0 -0
  4. package/assets/core/cesdk.wasm +0 -0
  5. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_ad1920_5_5_128.png +0 -0
  6. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_ancient_5_5_128.png +0 -0
  7. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_bw_5_5_128.png +0 -0
  8. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_chestnut_8_8_512.png +0 -0
  9. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_classic_5_5_128.png +0 -0
  10. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_colla_5_5_128.png +0 -0
  11. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_colorful_5_5_128.png +0 -0
  12. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_cottoncandy_5_5_128.png +0 -0
  13. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_creamy_5_5_128.png +0 -0
  14. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_dusty_5_5_128.png +0 -0
  15. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_fixie_8_8_512.png +0 -0
  16. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_flat_black_8_8_512.png +0 -0
  17. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_food_5_5_128.png +0 -0
  18. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_fridge_8_8_512.png +0 -0
  19. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_glam_5_5_128.png +0 -0
  20. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_gobblin_5_5_128.png +0 -0
  21. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_golden_5_5_128.png +0 -0
  22. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_green_gap_5_5_128.png +0 -0
  23. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_greyed_5_5_128.png +0 -0
  24. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_hard_stuff_8_8_512.png +0 -0
  25. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_highcarb_5_5_128.png +0 -0
  26. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_highcontrast_5_5_128.png +0 -0
  27. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_identity_5_5_128.png +0 -0
  28. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_inferno_8_8_512.png +0 -0
  29. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_joran_5_5_128.png +0 -0
  30. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_k1_5_5_128.png +0 -0
  31. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_k6_5_5_128.png +0 -0
  32. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_kalmen_5_5_128.png +0 -0
  33. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_keen_5_5_128.png +0 -0
  34. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_lemon_5_5_128.png +0 -0
  35. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_levante_5_5_128.png +0 -0
  36. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_litho_5_5_128.png +0 -0
  37. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_lomo100_5_5_128.png +0 -0
  38. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_low_fire_5_5_128.png +0 -0
  39. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_lucid_5_5_128.png +0 -0
  40. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_mellow_8_8_512.png +0 -0
  41. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_moss_5_5_128.png +0 -0
  42. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_neat_5_5_128.png +0 -0
  43. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_oldtimer_8_8_512.png +0 -0
  44. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_pale_5_5_128.png +0 -0
  45. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_pebble_5_5_128.png +0 -0
  46. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_pitched_5_5_128.png +0 -0
  47. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_polaroid_5_5_128.png +0 -0
  48. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_polasx_5_5_128.png +0 -0
  49. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_pro400_5_5_128.png +0 -0
  50. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_pumpkin_5_5_128.png +0 -0
  51. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_quozi_5_5_128.png +0 -0
  52. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_sepia_5_5_128.png +0 -0
  53. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_settled_5_5_128.png +0 -0
  54. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_seventies_5_5_128.png +0 -0
  55. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_snappy_5_5_128.png +0 -0
  56. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_soft_5_5_128.png +0 -0
  57. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_softly_5_5_128.png +0 -0
  58. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_solanus_5_5_128.png +0 -0
  59. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_steel_5_5_128.png +0 -0
  60. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_summer_5_5_128.png +0 -0
  61. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_sunny_70s_8_8_512.png +0 -0
  62. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_sunrise_5_5_128.png +0 -0
  63. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_tender_5_5_128.png +0 -0
  64. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_twilight_5_5_128.png +0 -0
  65. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_weathered_5_5_128.png +0 -0
  66. package/assets/extensions/ly.img.cesdk.filters.lut/LUTs/imgly_lut_zephyr_5_5_128.png +0 -0
  67. package/assets/extensions/ly.img.cesdk.fonts/fonts/imgly_font_abril_fatface_regular.ttf +0 -0
  68. package/assets/extensions/ly.img.cesdk.fonts/fonts/imgly_font_bungee_inline.ttf +0 -0
  69. package/assets/extensions/ly.img.cesdk.fonts/fonts/imgly_font_kumar_one_outline.otf +0 -0
  70. package/assets/extensions/ly.img.cesdk.fonts/fonts/imgly_font_permanent_marker.ttf +0 -0
  71. package/assets/extensions/ly.img.cesdk.fonts/fonts/imgly_font_petit_formal_script.ttf +0 -0
  72. package/assets/extensions/ly.img.cesdk.fonts/fonts/imgly_font_ultra.ttf +0 -0
  73. package/assets/extensions/ly.img.cesdk.fonts/manifest.json +2 -2
  74. package/assets/extensions/ly.img.cesdk.stickers.openmoji/genmoji.mjs +1 -108
  75. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/manifest.json +199 -0
  76. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/frame.png +0 -0
  77. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/halfcircle.png +0 -0
  78. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/organic1.png +0 -0
  79. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/organic2.png +0 -0
  80. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/organic3.png +0 -0
  81. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/organic4.png +0 -0
  82. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/organicdot1.png +0 -0
  83. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/organicdot2.png +0 -0
  84. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/quartercircle-outline.png +0 -0
  85. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/quartercircle.png +0 -0
  86. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/rectanglemask.png +0 -0
  87. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/roundmask.png +0 -0
  88. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/splash1.png +0 -0
  89. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/splash2.png +0 -0
  90. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/splash3.png +0 -0
  91. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/splash4.png +0 -0
  92. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/wiggle.png +0 -0
  93. package/assets/extensions/ly.img.cesdk.vectorpaths.abstract/thumbnails/ziczac.png +0 -0
  94. package/assets/extensions/ly.img.fonts/README.md +3 -0
  95. package/assets/extensions/ly.img.fonts/fonts/SupplyMono-Light-Web/Font-EULA.pdf +0 -0
  96. package/assets/extensions/ly.img.fonts/fonts/SupplyMono-Light-Web/Supply-Light.eot +0 -0
  97. package/assets/extensions/ly.img.fonts/fonts/SupplyMono-Light-Web/Supply-Light.otf +0 -0
  98. package/assets/extensions/ly.img.fonts/fonts/SupplyMono-Light-Web/Supply-Light.ttf +0 -0
  99. package/assets/extensions/ly.img.fonts/fonts/SupplyMono-Light-Web/Supply-Light.woff +0 -0
  100. package/assets/extensions/ly.img.fonts/fonts/SupplyMono-Light-Web/Supply-Light.woff2 +0 -0
  101. package/assets/extensions/ly.img.fonts/fonts/SupplyMono-Regular-Web/Font-EULA.pdf +0 -0
  102. package/assets/extensions/ly.img.fonts/fonts/SupplyMono-Regular-Web/Supply-Regular.eot +0 -0
  103. package/assets/extensions/ly.img.fonts/fonts/SupplyMono-Regular-Web/Supply-Regular.otf +0 -0
  104. package/assets/extensions/ly.img.fonts/fonts/SupplyMono-Regular-Web/Supply-Regular.ttf +0 -0
  105. package/assets/extensions/ly.img.fonts/fonts/SupplyMono-Regular-Web/Supply-Regular.woff +0 -0
  106. package/assets/extensions/ly.img.fonts/fonts/SupplyMono-Regular-Web/Supply-Regular.woff2 +0 -0
  107. package/assets/extensions/ly.img.fonts/manifest.json +24 -0
  108. package/assets/extensions/ly.img.fonts/preview.png +0 -0
  109. package/assets/i18n/de.json +76 -9
  110. package/assets/i18n/en.json +92 -25
  111. package/assets/ui/stylesheets/cesdk.css +40 -41
  112. package/cesdk-engine.umd.d.ts +1494 -38
  113. package/cesdk-engine.umd.js +1 -2
  114. package/cesdk.umd.js +1 -1
  115. package/index.d.ts +1798 -0
  116. package/index.html +3 -24
  117. package/package.json +2 -2
  118. package/BlockAPI.d.ts +0 -785
  119. package/SceneAPI.d.ts +0 -52
  120. package/VariableAPI.d.ts +0 -27
  121. package/api.d.ts +0 -11
  122. package/assets/extensions/ly.img.cesdk.fonts/fonts/imgly_font_kumar_one_outline.ttf +0 -0
  123. package/types.d.ts +0 -759
@@ -1,38 +1,1494 @@
1
- import BlockAPI, { PropertyType } from './BlockAPI';
2
- import SceneAPI from './SceneAPI';
3
- import VariableAPI from './VariableAPI';
4
- import { UserConfiguration } from './types';
5
-
6
- export { PropertyType };
7
-
8
- /**
9
- * A headless implementation that just initializes & exposes the Document API
10
- */
11
- export default class CreativeEngine {
12
- static PropertyType: typeof PropertyType;
13
-
14
- block: BlockAPI;
15
-
16
- scene: SceneAPI;
17
-
18
- variable: VariableAPI;
19
-
20
- private constructor(...args: unknown[]);
21
-
22
- /**
23
- * Dispose the engine.
24
- */
25
- dispose(): void;
26
-
27
- /**
28
- * Initialize a `CreativeEngine` using the given `canvas` element and an optional config.
29
- * @param config A configuration object.
30
- * @param canvas The canvas to use for drawing. Optional, if no canvas is provided,
31
- * the engine works with an internal offscreen-canvas.
32
- * @returns An engine instance.
33
- */
34
- static init(
35
- config?: UserConfiguration,
36
- canvas?: HTMLCanvasElement
37
- ): Promise<CreativeEngine>;
38
- }
1
+ declare type Asset = {
2
+ src: string;
3
+ };
4
+
5
+ /**
6
+ * Single asset result of a query from the engine.
7
+ */
8
+ declare interface AssetResult {
9
+ /**
10
+ * A unique id of this asset
11
+ */
12
+ id: string;
13
+ /**
14
+ * E.g. `ly.img.image`
15
+ */
16
+ type: string;
17
+ /**
18
+ * URI to a thumbnail of the asset used e.g. in the content library UI
19
+ */
20
+ thumbUri: string;
21
+ /**
22
+ * Original size of the asset.
23
+ */
24
+ size: {
25
+ width: number;
26
+ height: number;
27
+ };
28
+ /**
29
+ * Asset-specific and custom meta information
30
+ */
31
+ meta?: {
32
+ uri?: string;
33
+ filename?: string;
34
+ } & Record<string, unknown>;
35
+ /**
36
+ * The locale of the label and tags
37
+ */
38
+ locale?: string;
39
+ /**
40
+ * The label of the result. Used for description and tooltips.
41
+ */
42
+ label?: string;
43
+ /**
44
+ * The tags of this asset. Used for filtering and free-text searching.
45
+ */
46
+ tags?: string[];
47
+ context: {
48
+ sourceId: string;
49
+ };
50
+ /**
51
+ * Credits for the artist of the asset
52
+ */
53
+ credits?: {
54
+ name: string;
55
+ url?: string;
56
+ };
57
+ /**
58
+ * License for this asset. Overwrites the source license if present
59
+ */
60
+ license?: {
61
+ name: string;
62
+ url?: string;
63
+ };
64
+ }
65
+
66
+ declare type Assets = {
67
+ [id: string]: Asset;
68
+ };
69
+
70
+ /**
71
+ * API to query for assets
72
+ */
73
+ declare interface AssetSource {
74
+ /**
75
+ * The asset types returned by this source. Will default to ['ly.img.image'].
76
+ */
77
+ types?: string[];
78
+ /**
79
+ * Find all asset for the given type and the provided query data.
80
+ */
81
+ findAssets(type: string, queryData?: QueryData): Promise<AssetsQueryResult | undefined>;
82
+ /**
83
+ * Indicates if the asset shall be downloaded to handle the raw data instead
84
+ * of an URL reference. Do this if you do not want to depend on
85
+ * a service after adding the asset to the scene. If this is your own API
86
+ * with your own service, you do not need to set this and avoid downloading /
87
+ * re-uploading the assets.
88
+ */
89
+ downloadAssets?: (asset: AssetResult) => Promise<Blob>;
90
+ /**
91
+ * Credits for the source/api
92
+ */
93
+ credits?: {
94
+ name: string;
95
+ url?: string;
96
+ };
97
+ /**
98
+ * General license for all asset from this source
99
+ */
100
+ license?: {
101
+ name: string;
102
+ url?: string;
103
+ };
104
+ }
105
+
106
+ declare type AssetSources = {
107
+ [id: string]: AssetSource;
108
+ };
109
+
110
+ /**
111
+ * Return type of a `findAssets` query.
112
+ */
113
+ declare interface AssetsQueryResult {
114
+ /**
115
+ * The assets in the requested page
116
+ */
117
+ assets: AssetResult[];
118
+ /**
119
+ * The current, requested page
120
+ */
121
+ currentPage: number;
122
+ /**
123
+ * The next page to query if it exists
124
+ */
125
+ nextPage: number | undefined;
126
+ /**
127
+ * How many assets are there in total for the current query regardless of the page
128
+ */
129
+ total: number;
130
+ }
131
+
132
+ declare type Block = number;
133
+
134
+ /**
135
+ * @public
136
+ */
137
+ export declare class BlockAPI {
138
+ #private;
139
+
140
+ /**
141
+ * Exports a design block element as a file of the given mime type.
142
+ * Performs an internal update to resolve the final layout for the blocks.
143
+ * @param handle - The design block element to export.
144
+ * @param mimeType - The mime type of the output file.
145
+ * @returns A promise that resolves with the exported image or is rejected with an error.
146
+ */
147
+ export(handle: DesignBlockId, mimeType?: MimeType_2): Promise<Blob>;
148
+ /**
149
+ * Loads existing blocks from the given string.
150
+ * The blocks are not attached by default and won't be visible until attached to a page or the scene.
151
+ * @param content - A string representing the given blocks.
152
+ * @returns A promise that resolves with a list of handles representing the found blocks or an error.
153
+ */
154
+ loadFromString(content: string): Promise<DesignBlockId[]>;
155
+ /**
156
+ * Saves the given blocks into a string. If given the root of a block hierarchy, e.g. a
157
+ * page with multiple children, the entire hierarchy is saved.
158
+ * @param blocks - The blocks to save
159
+ * @returns A promise that resolves to a string representing the blocks or an error.
160
+ */
161
+ saveToString(blocks: DesignBlockId[]): Promise<string>;
162
+ /**
163
+ * Create a new block, fails if type is unknown.
164
+ * @param type - The type of the block that shall be created.
165
+ * @returns The created blocks handle.
166
+ */
167
+ create(type: DesignElementType): DesignBlockId;
168
+ /**
169
+
170
+ * Get the type of the given block, fails if the block is invalid.
171
+ * @param id - The block to query.
172
+ * @returns The blocks type.
173
+ */
174
+ getType(id: DesignBlockId): DesignElementType;
175
+ /**
176
+ * Update the selection state of a block.
177
+ * Fails for invalid blocks.
178
+ * @param id - The block to query.
179
+ * @param selected - Whether or not the block should be selected.
180
+ */
181
+ setSelected(id: DesignBlockId, selected: boolean): void;
182
+ /**
183
+ * Get the selected state of a block.
184
+ * @param id - The block to query.
185
+ * @returns True if the block is selected, false otherwise.
186
+ */
187
+ isSelected(id: DesignBlockId): boolean;
188
+ /**
189
+ * Get all currently selected blocks.
190
+ * @returns An array of block ids.
191
+ */
192
+ findAllSelected(): DesignBlockId[];
193
+ /**
194
+ * Confirms that a given set of blocks can be grouped together.
195
+ * @param ids - A non-empty array of block ids.
196
+ * @returns Whether the blocks can be grouped together.
197
+ */
198
+ isGroupable(ids: DesignBlockId[]): boolean;
199
+ /**
200
+ * Group blocks together.
201
+ * @param ids - A non-empty array of block ids.
202
+ * @returns The block id of the created group.
203
+ */
204
+ group(ids: DesignBlockId[]): DesignBlockId;
205
+ /**
206
+ * Ungroups a group.
207
+ * @param id - The group id from a previous call to `group`.
208
+ */
209
+ ungroup(id: DesignBlockId): void;
210
+ /**
211
+ * Changes selection from selected group to a block within that group.
212
+ * Nothing happens if `group` is not a group.
213
+ * @param id - The group id from a previous call to `group`.
214
+ */
215
+ enterGroup(id: DesignBlockId): void;
216
+ /**
217
+ * Changes selection from a group's selected block to that group.
218
+ * Nothing happens if the `id` is not part of a group.
219
+ * @param id - A block id.
220
+ */
221
+ exitGroup(id: DesignBlockId): void;
222
+ /**
223
+ * Update a block's name.
224
+ * @param id - The block to update.
225
+ * @param name - The name to set.
226
+ */
227
+ setName(id: DesignBlockId, name: string): void;
228
+ /**
229
+ * Get a block's name.
230
+ * @param id - The block to update.
231
+ */
232
+ getName(id: DesignBlockId): string;
233
+ /**
234
+ * Finds all blocks with the given name.
235
+ * @param name - The name to search for.
236
+ * @returns A list of block ids.
237
+ */
238
+ findByName(name: string): DesignBlockId[];
239
+ /**
240
+ * Finds all blocks with the given type.
241
+ * @param type - The type to search for.
242
+ * @returns A list of block ids.
243
+ */
244
+ findByType(type: DesignElementType): DesignBlockId[];
245
+ /**
246
+ * Return all blocks currently known to the engine.
247
+ * @returns A list of block ids.
248
+ */
249
+ findAll(): DesignBlockId[];
250
+ /**
251
+ * Query a block's visibility.
252
+ * @param id - The block to query.
253
+ * @returns True if visible, false otherwise.
254
+ */
255
+ isVisible(id: DesignBlockId): boolean;
256
+ /**
257
+ * Update a block's visibility.
258
+ * @param id - The block to update.
259
+ * @param visible - Whether the block shall be visible.
260
+ */
261
+ setVisible(id: DesignBlockId, visible: boolean): void;
262
+ /**
263
+ * Query a block's clipped state. If true, the block should clip
264
+ * its contents to its frame.
265
+ * @param id - The block to query.
266
+ * @returns True if clipped, false otherwise.
267
+ */
268
+ isClipped(id: DesignBlockId): boolean;
269
+ /**
270
+ * Update a block's clipped state.
271
+ * @param id - The block to update.
272
+ * @param clipped - Whether the block should clips its contents to its frame.
273
+ */
274
+ setClipped(id: DesignBlockId, clipped: boolean): void;
275
+ /**
276
+ * Query a block's x position.
277
+ * @param id - The block to query.
278
+ * @returns The value of the x position.
279
+ */
280
+ getPositionX(id: DesignBlockId): number;
281
+ /**
282
+ * Query a block's mode for its x position.
283
+ * @param id - The block to query.
284
+ * @returns The current mode for the x position: absolute, percent or undefined.
285
+ */
286
+ getPositionXMode(id: DesignBlockId): PositionMode;
287
+ /**
288
+ * Query a block's y position.
289
+ * @param id - The block to query.
290
+ * @returns The value of the y position.
291
+ */
292
+ getPositionY(id: DesignBlockId): number;
293
+ /**
294
+ * Query a block's mode for its y position.
295
+ * @param id - The block to query.
296
+ * @returns The current mode for the y position: absolute, percent or undefined.
297
+ */
298
+ getPositionYMode(id: DesignBlockId): PositionMode;
299
+ /**
300
+ * Update a block's x position.
301
+ * The position refers to the block's local space, relative to its parent with the origin at the top left.
302
+ * @param id - The block to update.
303
+ * @param value - The value of the x position.
304
+ */
305
+ setPositionX(id: DesignBlockId, value: number): void;
306
+ /**
307
+ * Set a block's mode for its x position.
308
+ * @param id - The block to update.
309
+ * @param mode - The x position mode: absolute, percent or undefined.
310
+ */
311
+ setPositionXMode(id: DesignBlockId, mode: PositionMode): void;
312
+ /**
313
+ * Update a block's y position.
314
+ * The position refers to the block's local space, relative to its parent with the origin at the top left.
315
+ * @param id - The block to update.
316
+ * @param value - The value of the y position.
317
+ */
318
+ setPositionY(id: DesignBlockId, value: number): void;
319
+ /**
320
+ * Set a block's mode for its y position.
321
+ * @param id - The block to update.
322
+ * @param mode - The y position mode: absolute, percent or undefined.
323
+ */
324
+ setPositionYMode(id: DesignBlockId, mode: PositionMode): void;
325
+ /**
326
+ * Query a block's rotation in radians.
327
+ * @param id - The block to query.
328
+ * @returns The block's rotation around its center in radians.
329
+ */
330
+ getRotation(id: DesignBlockId): number;
331
+ /**
332
+ * Update a block's rotation.
333
+ * @param id - The block to update.
334
+ * @param radians - The new rotation in radians. Rotation is applied around the block's center.
335
+ */
336
+ setRotation(id: DesignBlockId, radians: number): void;
337
+ /**
338
+ * Query a block's horizontal flip state.
339
+ * @param id - The block to query.
340
+ * @returns A boolean indicating for whether the block is flipped in the queried direction
341
+ */
342
+ getFlipHorizontal(id: DesignBlockId): boolean;
343
+ /**
344
+ * Query a block's vertical flip state.
345
+ * @param id - The block to query.
346
+ * @returns A boolean indicating for whether the block is flipped in the queried direction
347
+ */
348
+ getFlipVertical(id: DesignBlockId): boolean;
349
+ /**
350
+ * Update a block's horizontal flip.
351
+ * @param id - The block to update.
352
+ * @param horizontal - Whether the block should be flipped along its x-axis.
353
+ */
354
+ setFlipHorizontal(id: DesignBlockId, flip: boolean): void;
355
+ /**
356
+ * Update a block's vertical flip.
357
+ * @param id - The block to update.
358
+ * @param vertical - Whether the block should be flipped along its y-axis.
359
+ */
360
+ setFlipVertical(id: DesignBlockId, flip: boolean): void;
361
+ /**
362
+ * Query a block's width.
363
+ * @param id - The block to query.
364
+ * @returns The value of the block's width.
365
+ */
366
+ getWidth(id: DesignBlockId): number;
367
+ /**
368
+ * Query a block's mode for its width.
369
+ * @param id - The block to query.
370
+ * @returns The current mode for the width: absolute, percent or auto.
371
+ */
372
+ getWidthMode(id: DesignBlockId): SizeMode;
373
+ /**
374
+ * Query a block's height.
375
+ * @param id - The block to query.
376
+ * @returns The value of the block's height.
377
+ */
378
+ getHeight(id: DesignBlockId): number;
379
+ /**
380
+ * Query a block's mode for its height.
381
+ * @param id - The block to query.
382
+ * @returns The current mode for the height: absolute, percent or auto.
383
+ */
384
+ getHeightMode(id: DesignBlockId): SizeMode;
385
+ /**
386
+ * Update a block's width.
387
+ * @param id - The block to update.
388
+ * @param value - The new width of the block.
389
+ */
390
+ setWidth(id: DesignBlockId, value: number): void;
391
+ /**
392
+ * Set a block's mode for its width.
393
+ * @param id - The block to update.
394
+ * @param mode - The width mode: absolute, percent or auto.
395
+ */
396
+ setWidthMode(id: DesignBlockId, mode: SizeMode): void;
397
+ /**
398
+ * Update a block's height.
399
+ * @param id - The block to update.
400
+ * @param value - The new height of the block.
401
+ */
402
+ setHeight(id: DesignBlockId, value: number): void;
403
+ /**
404
+ * Set a block's mode for its height.
405
+ * @param id - The block to update.
406
+ * @param mode - The height mode: absolute, percent or auto.
407
+ */
408
+ setHeightMode(id: DesignBlockId, mode: SizeMode): void;
409
+ /**
410
+ * Get a block's layouted width. The layouted width is only available after an
411
+ * internal update loop, which may not happen immediately.
412
+ * @param id - The block to query.
413
+ * @returns The layouted width.
414
+ */
415
+ getFrameWidth(id: DesignBlockId): number;
416
+ /**
417
+ * Get a block's layouted height. The layouted height is only available after an
418
+ * internal update loop, which may not happen immediately.
419
+ * @param id - The block to query.
420
+ * @returns The layouted height.
421
+ */
422
+ getFrameHeight(id: DesignBlockId): number;
423
+ /**
424
+ * Duplicates a block including its children.
425
+ * @param id - The block to duplicate.
426
+ * @returns The handle of the duplicate.
427
+ */
428
+ duplicate(id: DesignBlockId): DesignBlockId;
429
+ /**
430
+ * Destroys a block.
431
+ * @param id - The block to destroy.
432
+ */
433
+ destroy(id: DesignBlockId): void;
434
+ /**
435
+ * Check if a block is valid. A block becomes invalid once it has been destroyed.
436
+ * @param id - The block to query.
437
+ * @returns True, if the block is valid.
438
+ */
439
+ isValid(id: DesignBlockId): boolean;
440
+ /**
441
+ * Query a block's parent.
442
+ * @param id - The block to query.
443
+ * @returns The parent's handle.
444
+ */
445
+ getParent(id: DesignBlockId): DesignBlockId;
446
+ /**
447
+ * Get all children of the given block. Children
448
+ * are sorted in their rendering order: Last child is rendered
449
+ * in front of other children.
450
+ * @param id - The block to query.
451
+ * @returns A list of block ids.
452
+ */
453
+ getChildren(id: DesignBlockId): DesignBlockId[];
454
+ /**
455
+ * Insert a new or existing child at a certain position in the parent's children.
456
+ * @param parent - The block whose children should be updated.
457
+ * @param child - The child to insert. Can be an existing child of `parent`.
458
+ * @param index - The index to insert or move to.
459
+ */
460
+ insertChild(parent: DesignBlockId, child: DesignBlockId, index: number): void;
461
+ /**
462
+ * Appends a new or existing child to a block's children.
463
+ * @param parent - The block whose children should be updated.
464
+ * @param child - The child to insert. Can be an existing child of `parent`.
465
+ */
466
+ appendChild(parent: DesignBlockId, child: DesignBlockId): void;
467
+ /** Checks whether the given block references any variables. Doesn't check the block's children.
468
+ *
469
+ * @param id - The block to inspect.
470
+ * @returns true if the block references variables and false otherwise.
471
+ */
472
+ referencesAnyVariables(id: DesignBlockId): boolean;
473
+ /**
474
+ * Get the x position of the block's axis-aligned bounding box in the scene's global coordinate space.
475
+ * The scene's global coordinate space has its origin at the top left.
476
+ * @param id - The block whose bounding box should be calculated.
477
+ * @returns float The x coordinate of the position of the axis-aligned bounding box.
478
+ */
479
+ getGlobalBoundingBoxX(id: DesignBlockId): number;
480
+ /**
481
+ * Get the y position of the block's axis-aligned bounding box in the scene's global coordinate space.
482
+ * The scene's global coordinate space has its origin at the top left.
483
+ * @param id - The block whose bounding box should be calculated.
484
+ * @returns float The y coordinate of the position of the axis-aligned bounding box.
485
+ */
486
+ getGlobalBoundingBoxY(id: DesignBlockId): number;
487
+ /**
488
+ * Get the width of the block's axis-aligned bounding box in the scene's global coordinate space.
489
+ * The scene's global coordinate space has its origin at the top left.
490
+ * @param id - The block whose bounding box should be calculated.
491
+ * @returns float The width of the axis-aligned bounding box.
492
+ */
493
+ getGlobalBoundingBoxWidth(id: DesignBlockId): number;
494
+ /**
495
+ * Get the height of the block's axis-aligned bounding box in the scene's global coordinate space.
496
+ * The scene's global coordinate space has its origin at the top left.
497
+ * @param id - The block whose bounding box should be calculated.
498
+ * @returns float The height of the axis-aligned bounding box.
499
+ */
500
+ getGlobalBoundingBoxHeight(id: DesignBlockId): number;
501
+ /**
502
+ * Get all available properties of a block.
503
+ * @param id - The block whose properties should be queried.
504
+ * @returns A list of the property names.
505
+ */
506
+ findAllProperties(id: DesignBlockId): string[];
507
+ /**
508
+ * Get the type of a property given its name.
509
+ * @param property - The name of the property whose type should be queried.
510
+ * @returns The property type.
511
+ */
512
+ getPropertyType(property: string): PropertyType;
513
+ /**
514
+ * Get all the possible values of an enum given an enum property.
515
+ * @param enumProperty - The name of the property whose enum values should be queried.
516
+ * @returns A list of the enum value names as string.
517
+ */
518
+ getEnumValues<T = string>(enumProperty: string): T[];
519
+ /**
520
+ * Set a bool property of the given design block to the given value.
521
+ * @param id - The block whose property should be set.
522
+ * @param property - The name of the property to set.
523
+ * @param value - The value to set.
524
+ */
525
+ setBool(id: DesignBlockId, property: string, value: boolean): void;
526
+ /**
527
+ * Get the value of a bool property of the given design block.
528
+ * @param id - The block whose property should be queried.
529
+ * @param property - The name of the property to query.
530
+ * @returns The value of the property.
531
+ */
532
+ getBool(id: DesignBlockId, property: string): boolean;
533
+ /**
534
+ * Set an int property of the given design block to the given value.
535
+ * @param id - The block whose property should be set.
536
+ * @param property - The name of the property to set.
537
+ * @param value - The value to set.
538
+ */
539
+ setInt(id: DesignBlockId, property: string, value: number): void;
540
+ /**
541
+ * Get the value of an int property of the given design block.
542
+ * @param id - The block whose property should be queried.
543
+ * @param property - The name of the property to query.
544
+ * @returns The value of the property.
545
+ */
546
+ getInt(id: DesignBlockId, property: string): number;
547
+ /**
548
+ * Set a float property of the given design block to the given value.
549
+ * @param id - The block whose property should be set.
550
+ * @param property - The name of the property to set.
551
+ * @param value - The value to set.
552
+ */
553
+ setFloat(id: DesignBlockId, property: string, value: number): void;
554
+ /**
555
+ * Get the value of a float property of the given design block.
556
+ * @param id - The block whose property should be queried.
557
+ * @param property - The name of the property to query.
558
+ * @returns The value of the property.
559
+ */
560
+ getFloat(id: DesignBlockId, property: string): number;
561
+ /**
562
+ * Set a string property of the given design block to the given value.
563
+ * @param id - The block whose property should be set.
564
+ * @param property - The name of the property to set.
565
+ * @param value - The value to set.
566
+ */
567
+ setString(id: DesignBlockId, property: string, value: string): void;
568
+ /**
569
+ * Get the value of a string property of the given design block.
570
+ * @param id - The block whose property should be queried.
571
+ * @param property - The name of the property to query.
572
+ * @returns The value of the property.
573
+ */
574
+ getString(id: DesignBlockId, property: string): string;
575
+ /**
576
+ * Set a color property of the given design block to the given value.
577
+ * @param id - The block whose property should be set.
578
+ * @param property - The name of the property to set.
579
+ * @param r - The red color component in the range of 0 to 1.
580
+ * @param g - The green color component in the range of 0 to 1.
581
+ * @param b - The blue color component in the range of 0 to 1.
582
+ * @param a - The alpha color component in the range of 0 to 1.
583
+ */
584
+ setColorRGBA(id: DesignBlockId, property: string, r: number, g: number, b: number, a: number): void;
585
+ /**
586
+ * Get the value of a string property of the given design block.
587
+ * @param id - The block whose property should be queried.
588
+ * @param property - The name of the property to query.
589
+ * @returns A tuple of channels red, green, blue and alpha in the range of 0 to 1.
590
+ */
591
+ getColorRGBA(id: DesignBlockId, property: string): RGBA;
592
+ /**
593
+ * Set an enum property of the given design block to the given value.
594
+ * @param block - The block whose property should be set.
595
+ * @param property - The name of the property to set.
596
+ * @param value - The enum value as string.
597
+ */
598
+ setEnum(id: DesignBlockId, property: string, value: string): void;
599
+ /**
600
+ * Get the value of an enum property of the given design block.
601
+ * @param block - The block whose property should be queried.
602
+ * @param property - The name of the property to query.
603
+ * @returns The value as string.
604
+ */
605
+ getEnum(id: DesignBlockId, property: string): string;
606
+ /**
607
+ * Query if the given block has crop properties.
608
+ * @param id - The block to query.
609
+ * @returns true, if the block has crop properties.
610
+ */
611
+ hasCrop(id: DesignBlockId): boolean;
612
+ /**
613
+ * Set the crop scale in x direction of the given design block.
614
+ * @param id - The block whose crop should be set.
615
+ * @param scaleX - The scale in x direction.
616
+ */
617
+ setCropScaleX(id: DesignBlockId, scaleX: number): void;
618
+ /**
619
+ * Set the crop scale in y direction of the given design block.
620
+ * @param id - The block whose crop should be set.
621
+ * @param scaleY - The scale in y direction.
622
+ */
623
+ setCropScaleY(id: DesignBlockId, scaleY: number): void;
624
+ /**
625
+ * Set the crop rotation of the given design block.
626
+ * @param id - The block whose crop should be set.
627
+ * @param rotation - The rotation in radians.
628
+ */
629
+ setCropRotation(id: DesignBlockId, rotation: number): void;
630
+ /**
631
+ * Set the crop translation in x direction of the given design block.
632
+ * @param id - The block whose crop should be set.
633
+ * @param translationY - The translation in x direction.
634
+ */
635
+ setCropTranslationX(id: DesignBlockId, translationX: number): void;
636
+ /**
637
+ * Set the crop translation in y direction of the given design block.
638
+ * @param id - The block whose crop should be set.
639
+ * @param translationY - The translation in y direction.
640
+ */
641
+ setCropTranslationY(id: DesignBlockId, translationY: number): void;
642
+ /**
643
+ * Resets the manually set crop of the given design block.
644
+ * The block's content fill mode is set to 'cover'.
645
+ * @param id - The block whose crop should be reset.
646
+ */
647
+ resetCrop(id: DesignBlockId): void;
648
+ /**
649
+ * Get the crop scale on the x axis of the given design block.
650
+ * @param id - The block whose scale should be queried.
651
+ * @returns The scale on the x axis.
652
+ */
653
+ getCropScaleX(id: DesignBlockId): number;
654
+ /**
655
+ * Get the crop scale on the y axis of the given design block.
656
+ * @param id - The block whose scale should be queried.
657
+ * @returns The scale on the y axis.
658
+ */
659
+ getCropScaleY(id: DesignBlockId): number;
660
+ /**
661
+ * Get the crop rotation of the given design block.
662
+ * @param id - The block whose crop rotation should be queried.
663
+ * @returns The crop rotation.
664
+ */
665
+ getCropRotation(id: DesignBlockId): number;
666
+ /**
667
+ * Get the crop translation on the x axis of the given design block.
668
+ * @param id - The block whose translation should be queried.
669
+ * @returns The translation on the x axis.
670
+ */
671
+ getCropTranslationX(id: DesignBlockId): number;
672
+ /**
673
+ * Get the crop translation on the y axis of the given design block.
674
+ * @param id - The block whose translation should be queried.
675
+ * @returns The translation on the y axis.
676
+ */
677
+ getCropTranslationY(id: DesignBlockId): number;
678
+ /**
679
+ * Query if the given block has an opacity.
680
+ * @param id - The block to query.
681
+ * @returns true, if the block has an opcity.
682
+ */
683
+ hasOpacity(id: DesignBlockId): boolean;
684
+ /**
685
+ * Set the opacity of the given design block.
686
+ * @param id - The block whose opacity should be set.
687
+ * @param opacity - The opacity to be set. The valid range is 0 to 1.
688
+ */
689
+ setOpacity(id: DesignBlockId, opacity: number): void;
690
+ /**
691
+ * Get the opacity of the given design block.
692
+ * @param id - The block whose opacity should be queried.
693
+ * @returns The opacity.
694
+ */
695
+ getOpacity(id: DesignBlockId): number;
696
+ /**
697
+ * Query if the given block has fill color properties.
698
+ * @param id - The block to query.
699
+ * @returns true, if the block has fill color properties.
700
+ */
701
+ hasFillColor(id: DesignBlockId): boolean;
702
+ /**
703
+ * Set the fill color of the given design block.
704
+ * @param id - The block whose fill color should be set.
705
+ * @param color - The fill color to be set, a tuple of
706
+ * @param r - The red color component in the range of 0 to 1.
707
+ * @param g - The green color component in the range of 0 to 1.
708
+ * @param b - The blue color component in the range of 0 to 1.
709
+ * @param a - The alpha color component in the range of 0 to 1.
710
+ */
711
+ setFillColorRGBA(id: DesignBlockId, r: number, g: number, b: number, a: number): void;
712
+ /**
713
+ * Get the fill color of the given design block.
714
+ * @param id - The block whose fill color should be queried.
715
+ * @returns The fill color.
716
+ */
717
+ getFillColorRGBA(id: DesignBlockId): RGBA;
718
+ /**
719
+ * Enable or disable the fill of the given design block.
720
+ * @param id - The block whose fill should be enabled or disabled.
721
+ * @param enabled - If true, the fill will be enabled.
722
+ */
723
+ setFillColorEnabled(id: DesignBlockId, enabled: boolean): void;
724
+ /**
725
+ * Query if the fill of the given design block is enabled.
726
+ * @param id - The block whose fill state should be queried.
727
+ * @returns True, if fill is enabled.
728
+ */
729
+ isFillColorEnabled(id: DesignBlockId): boolean;
730
+ /**
731
+ * Query if the given block has background color properties.
732
+ * @param id - The block to query.
733
+ * @returns true, if the block has background color properties.
734
+ */
735
+ hasBackgroundColor(id: DesignBlockId): boolean;
736
+ /**
737
+ * Set the background color of the given design block.
738
+ * @param id - The block whose background color should be set.
739
+ * @param color - The background color to be set, a tuple of
740
+ * @param r - The red color component in the range of 0 to 1.
741
+ * @param g - The green color component in the range of 0 to 1.
742
+ * @param b - The blue color component in the range of 0 to 1.
743
+ * @param a - The alpha color component in the range of 0 to 1.
744
+ */
745
+ setBackgroundColorRGBA(id: DesignBlockId, r: number, g: number, b: number, a: number): void;
746
+ /**
747
+ * Get the background color of the given design block.
748
+ * @param id - The block whose background color should be queried.
749
+ * @returns The background color.
750
+ */
751
+ getBackgroundColorRGBA(id: DesignBlockId): RGBA;
752
+ /**
753
+ * Enable or disable the background of the given design block.
754
+ * @param id - The block whose background should be enabled or disabled.
755
+ * @param enabled - If true, the background will be enabled.
756
+ */
757
+ setBackgroundColorEnabled(id: DesignBlockId, enabled: boolean): void;
758
+ /**
759
+ * Query if the background of the given design block is enabled.
760
+ * @param id - The block whose background state should be queried.
761
+ * @returns True, if background is enabled.
762
+ */
763
+ isBackgroundColorEnabled(id: DesignBlockId): boolean;
764
+ /**
765
+ * Query if the given block has a stroke property.
766
+ * @param id - The block to query.
767
+ * @returns True if the block has a stroke property.
768
+ */
769
+ hasStroke(id: DesignBlockId): boolean;
770
+ /**
771
+ * Enable or disable the stroke of the given design block.
772
+ * @param id - The block whose stroke should be enabled or disabled.
773
+ * @param enabled - If true, the stroke will be enabled.
774
+ */
775
+ setStrokeEnabled(id: DesignBlockId, enabled: boolean): void;
776
+ /**
777
+ * Query if the stroke of the given design block is enabled.
778
+ * @param id - The block whose stroke state should be queried.
779
+ * @returns True if the block's stroke is enabled.
780
+ */
781
+ isStrokeEnabled(id: DesignBlockId): boolean;
782
+ /**
783
+ * Set the stroke color of the given design block.
784
+ * @param id - The block whose stroke color should be set.
785
+ * @param r - The red color component in the range of 0 to 1.
786
+ * @param g - The green color component in the range of 0 to 1.
787
+ * @param b - The blue color component in the range of 0 to 1.
788
+ * @param a - The alpha color component in the range of 0 to 1.
789
+ */
790
+ setStrokeColorRGBA(id: DesignBlockId, r: number, g: number, b: number, a: number): void;
791
+ /**
792
+ * Get the stroke color of the given design block.
793
+ * @param id - The block whose background color should be queried.
794
+ * @returns The background color.
795
+ */
796
+ getStrokeColorRGBA(id: DesignBlockId): RGBA;
797
+ /**
798
+ * Set the stroke width of the given design block.
799
+ * @param id - The block whose stroke width should be set.
800
+ * @param width - The stroke width to be set.
801
+ */
802
+ setStrokeWidth(id: DesignBlockId, width: number): void;
803
+ /**
804
+ * Get the stroke width of the given design block.
805
+ * @param id - The block whose stroke width should be queried.
806
+ * @returns The stroke's width.
807
+ */
808
+ getStrokeWidth(id: DesignBlockId): number;
809
+ /**
810
+ * Set the stroke style of the given design block.
811
+ * @param id - The block whose stroke style should be set.
812
+ * @param style - The stroke style to be set.
813
+ */
814
+ setStrokeStyle(id: DesignBlockId, style: StrokeStyle): void;
815
+ /**
816
+ * Get the stroke style of the given design block.
817
+ * @param id - The block whose stroke style should be queried.
818
+ * @returns The stroke's style.
819
+ */
820
+ getStrokeStyle(id: DesignBlockId): StrokeStyle;
821
+ /**
822
+ * Set the stroke position of the given design block.
823
+ * @param id - The block whose stroke position should be set.
824
+ * @param position - The stroke position to be set.
825
+ */
826
+ setStrokePosition(id: DesignBlockId, position: StrokePosition): void;
827
+ /**
828
+ * Get the stroke position of the given design block.
829
+ * @param id - The block whose stroke position should be queried.
830
+ * @returns The stroke position.
831
+ */
832
+ getStrokePosition(id: DesignBlockId): StrokePosition;
833
+ /**
834
+ * Set the stroke corner geometry of the given design block.
835
+ * @param id - The block whose stroke join geometry should be set.
836
+ * @param cornerGeometry - The stroke join geometry to be set.
837
+ */
838
+ setStrokeCornerGeometry(id: DesignBlockId, cornerGeometry: StrokeCornerGeometry): void;
839
+ /**
840
+ * Get the stroke corner geometry of the given design block.
841
+ * @param id - The block whose stroke join geometry should be queried.
842
+ * @returns The stroke join geometry.
843
+ */
844
+ getStrokeCornerGeometry(id: DesignBlockId): StrokeCornerGeometry;
845
+ /**
846
+ * Query if the given block has outline properties.
847
+ * @param id - The block to query.
848
+ * @returns true, if the block has outline properties.
849
+ * @deprecated Use `hasStroke`.
850
+ */
851
+ hasOutline(id: DesignBlockId): boolean;
852
+ /**
853
+ * Set the outline color of the given design block.
854
+ * @param id - The block whose outline color should be set.
855
+ * @param color - The outline color to be set, a tuple of
856
+ * @param r - The red color component in the range of 0 to 1.
857
+ * @param g - The green color component in the range of 0 to 1.
858
+ * @param b - The blue color component in the range of 0 to 1.
859
+ * @param a - The alpha color component in the range of 0 to 1.
860
+ * @deprecated Use `setStrokeColorRGBA`.
861
+ */
862
+ setOutlineColorRGBA(id: DesignBlockId, r: number, g: number, b: number, a: number): void;
863
+ /**
864
+ * Get the outline color of the given design block.
865
+ * @param id - The block whose outline color should be queried.
866
+ * @returns The outline color.
867
+ * @deprecated Use `getStrokeColorRGBA`.
868
+ */
869
+ getOutlineColorRGBA(id: DesignBlockId): RGBA;
870
+ /**
871
+ * Enable or disable the outline of the given design block.
872
+ * @param id - The block whose outline should be enabled or disabled.
873
+ * @param enabled - If true, the outline will be enabled.
874
+ * @deprecated Use `setStrokeEnabled`.
875
+ */
876
+ setOutlineEnabled(id: DesignBlockId, enabled: boolean): void;
877
+ /**
878
+ * Query if the outline of the given design block is enabled.
879
+ * @param id - The block whose outline state should be queried.
880
+ * @returns True, if outline is enabled.
881
+ * @deprecated Use `isStrokeEnabled`.
882
+ */
883
+ isOutlineEnabled(id: DesignBlockId): boolean;
884
+ /**
885
+ * Set the outline width of the given design block.
886
+ * @param id - The block whose outline width should be set.
887
+ * @param width - The outline width to be set.
888
+ * @deprecated Use `setStrokeWidth`.
889
+ */
890
+ setOutlineWidth(id: DesignBlockId, width: number): void;
891
+ /**
892
+ * Get the outline width of the given design block.
893
+ * @param id - The block whose outline width should be queried.
894
+ * @returns The outline width.
895
+ * @deprecated Use the Stroke function
896
+ * @deprecated Use `getStrokeWidth`.
897
+ */
898
+ getOutlineWidth(id: DesignBlockId): number;
899
+ }
900
+
901
+ /**
902
+ * @public
903
+ */
904
+ export declare type BlockEvent = {
905
+ block: DesignBlockId;
906
+ type: 'Created' | 'Updated' | 'Destroyed';
907
+ };
908
+
909
+ declare interface BlockEvent_2 {
910
+ block: Block;
911
+ type: 'Created' | 'Updated' | 'Destroyed';
912
+ }
913
+
914
+ declare type Callbacks = {
915
+ log?: Logger;
916
+ };
917
+
918
+ /** All components between 0 and 1 */
919
+ declare interface CMYKColor {
920
+ c: number;
921
+ m: number;
922
+ y: number;
923
+ k: number;
924
+ }
925
+
926
+ declare type ColorDefinition = Preset & {
927
+ value: ColorPaletteColor;
928
+ };
929
+
930
+ /**
931
+ * A color definition for the custom color palette.
932
+ * The RGB and CMYK components must all be specified in the range [0-1].
933
+ */
934
+ declare type ColorPaletteColor = HexColorString | RGBColor | RGBAColor | SpotColor;
935
+
936
+ declare type ColorPaletteDefinition = Preset & {
937
+ entries: ColorPaletteColor[];
938
+ };
939
+
940
+ declare type Command = {
941
+ identifier: string;
942
+ argumentTypes: string[];
943
+ returnType: string;
944
+ };
945
+
946
+ /**
947
+ * @public
948
+ */
949
+ export declare type Configuration = Partial<_Configuration>;
950
+
951
+ /**
952
+ * @public
953
+ */
954
+ export declare interface _Configuration {
955
+ baseURL: string;
956
+ license?: string;
957
+ role: string;
958
+ featureFlags?: Record<string, string | boolean>;
959
+ extensions: Extensions;
960
+ core: Core;
961
+ scene: Scene;
962
+ page: Page;
963
+ assets: Assets;
964
+ assetSources: AssetSources;
965
+ presets: Presets;
966
+ variables: Variables;
967
+ callbacks: Callbacks;
968
+ /**
969
+ * The default font used by a text added to the scene. Needs to be the id of
970
+ * the font from a extension pack including namespace, e.g.
971
+ *
972
+ * '//ly.img.cesdk.fonts/roboto_regular'
973
+ *
974
+ * If not configured the fallback font is used.
975
+ */
976
+ defaultFont?: string;
977
+ }
978
+
979
+ declare type Core = {
980
+ baseURL: string;
981
+ };
982
+
983
+ declare interface CreateSceneOptions {
984
+ layout: SceneLayout;
985
+ }
986
+
987
+ /**
988
+ * A headless implementation that just initializes & exposes the Document API
989
+ *
990
+ * @public
991
+ */
992
+ declare class CreativeEngine {
993
+ #private;
994
+ static PositionMode: typeof PositionMode;
995
+ static SizeMode: typeof SizeMode;
996
+ static PropertyType: typeof PropertyType;
997
+ block: BlockAPI;
998
+ scene: SceneAPI;
999
+ variable: VariableAPI;
1000
+
1001
+ event: EventAPI;
1002
+
1003
+ /**
1004
+ * Dispose the engine.
1005
+ */
1006
+ dispose(): void;
1007
+ /**
1008
+ * Initialize a `CreativeEngine` using the given `canvas` element and an optional config.
1009
+ * @param config - A configuration object.
1010
+ * @param canvas - The canvas to use for drawing. Optional, if no canvas is provided,
1011
+ * the engine works with an internal offscreen-canvas.
1012
+ * @returns An engine instance.
1013
+ */
1014
+ static init(config?: Configuration, canvas?: HTMLCanvasElement): Promise<CreativeEngine>;
1015
+ }
1016
+ export default CreativeEngine;
1017
+
1018
+ /**
1019
+ * A numerical identifier for a design block
1020
+ * @public
1021
+ */
1022
+ export declare type DesignBlockId = number;
1023
+
1024
+ /**
1025
+ * @public
1026
+ */
1027
+ export declare enum DesignElementType {
1028
+ Scene = "//ly.img.ubq/scene",
1029
+ Camera = "//ly.img.ubq/camera",
1030
+ Page = "//ly.img.ubq/page",
1031
+ Image = "//ly.img.ubq/image",
1032
+ Video = "//ly.img.ubq/video",
1033
+ Text = "//ly.img.ubq/text",
1034
+ Sticker = "//ly.img.ubq/sticker",
1035
+ VectorPath = "//ly.img.ubq/vector_path",
1036
+ RectShape = "//ly.img.ubq/shapes/rect",
1037
+ LineShape = "//ly.img.ubq/shapes/line",
1038
+ StarShape = "//ly.img.ubq/shapes/star",
1039
+ PolygonShape = "//ly.img.ubq/shapes/polygon",
1040
+ EllipseShape = "//ly.img.ubq/shapes/ellipse",
1041
+ Group = "//ly.img.ubq/group"
1042
+ }
1043
+
1044
+ declare enum DesignUnit {
1045
+ Pixel = "px",
1046
+ Millimeter = "mm",
1047
+ Inch = "in"
1048
+ }
1049
+
1050
+ /**
1051
+ * @public
1052
+ */
1053
+ export declare class EventAPI {
1054
+ #private;
1055
+
1056
+ /**
1057
+ * Subscribe to block life-cycle events.
1058
+ * @param blocks - A list of blocks to filter events by. If the list is empty, events for every block are sent.
1059
+ * @param callback - The event callback. Events are bundled and sent at the end of each engine update.
1060
+ * @returns A method to unsubscribe.
1061
+ */
1062
+ subscribe(blocks: DesignBlockId[], callback: (events: BlockEvent[]) => void): () => void;
1063
+ }
1064
+
1065
+ declare type EventSubscription = number;
1066
+
1067
+ declare interface ExportOptions {
1068
+ jpegQuality: number;
1069
+ pngCompressionLevel: number;
1070
+ useTargetSize: boolean;
1071
+ targetWidth: number;
1072
+ targetHeight: number;
1073
+ }
1074
+
1075
+ declare type Extensions = {
1076
+ baseURL: string;
1077
+ entries: string[];
1078
+ };
1079
+
1080
+ declare interface Flip {
1081
+ horizontal: boolean;
1082
+ vertical: boolean;
1083
+ }
1084
+
1085
+ declare type FontStyle = 'normal' | 'italic';
1086
+
1087
+ declare type FontWeight = 'thin' | 'extraLight' | 'Light' | 'normal' | 'medium' | 'semiBold' | 'bold' | 'extraBold' | 'heavy';
1088
+
1089
+ /**
1090
+ * A hexadecimal color value (RGB or RGBA) that starts with a '#'
1091
+ * @example #6686FF or #6686FFFF
1092
+ */
1093
+ declare type HexColorString = string;
1094
+
1095
+ declare type ImageDefinition = Preset & {
1096
+ imageURL: string;
1097
+ thumbnailURL?: string;
1098
+ width: number;
1099
+ height: number;
1100
+ levelOfDetail?: {
1101
+ [lod: number]: string;
1102
+ };
1103
+ };
1104
+
1105
+ declare type Logger = (message: string, level: LogLevel) => void;
1106
+
1107
+ declare enum LogLevel {
1108
+ Info = "Info",
1109
+ Warning = "Warning",
1110
+ Error = "Error"
1111
+ }
1112
+
1113
+ /** @public */
1114
+ declare enum MimeType_2 {
1115
+ Png = "image/png",
1116
+ Jpeg = "image/jpeg",
1117
+ Tga = "image/x-tga",
1118
+ Binary = "application/octet-stream",
1119
+ Pdf = "application/pdf",
1120
+ Zip = "application/zip"
1121
+ }
1122
+ export { MimeType_2 as MimeType }
1123
+
1124
+ declare interface NotificationEvent {
1125
+ type: NotificationType;
1126
+ i18n: string;
1127
+ }
1128
+
1129
+ declare enum NotificationType {
1130
+ Information = 0,
1131
+ Warning = 1,
1132
+ Error = 2
1133
+ }
1134
+
1135
+ declare type Page = {
1136
+ title: {
1137
+ /**
1138
+ * Whether newly created pages should show a title.
1139
+ */
1140
+ show?: boolean;
1141
+ /**
1142
+ * The font file to use to render the page titles.
1143
+ */
1144
+ fontFileUri?: string;
1145
+ };
1146
+ /**
1147
+ * Whether the opacity of the region outside of all
1148
+ * pages should be reduced.
1149
+ */
1150
+ dimOutOfPageAreas?: boolean;
1151
+ };
1152
+
1153
+ declare type PageFormatDefinition = Preset & {
1154
+ width: number;
1155
+ height: number;
1156
+ unit: DesignUnit;
1157
+ dpi?: number;
1158
+ bleedMargin?: number;
1159
+ };
1160
+
1161
+ /**
1162
+ * @public
1163
+ */
1164
+ export declare enum PositionMode {
1165
+ /** Position in absolute design units. */
1166
+ Absolute = "Absolute",
1167
+ /** Position in relation to the block's parent's size in percent, where 1.0 means 100%. */
1168
+ Percent = "Percent",
1169
+ /** Position is automatically determined. */
1170
+ Undefined = "Auto"
1171
+ }
1172
+
1173
+ declare type Preset = {
1174
+ meta?: {
1175
+ default?: boolean;
1176
+ library?: string;
1177
+ categories?: string[];
1178
+ };
1179
+ };
1180
+
1181
+ declare type Presets = {
1182
+ colors?: {
1183
+ [id: string]: ColorDefinition;
1184
+ };
1185
+ typefaces?: {
1186
+ [id: string]: TypefaceDefinition;
1187
+ };
1188
+ images?: {
1189
+ [id: string]: ImageDefinition;
1190
+ };
1191
+ pageFormats?: {
1192
+ [id: string]: PageFormatDefinition;
1193
+ };
1194
+ colorPalettes?: {
1195
+ [id: string]: ColorPaletteDefinition;
1196
+ };
1197
+ templates?: {
1198
+ [id: string]: TemplateDefinition;
1199
+ };
1200
+ };
1201
+
1202
+ /**
1203
+ * @public
1204
+ */
1205
+ export declare enum PropertyType {
1206
+ Bool = "Bool",
1207
+ Int = "Int",
1208
+ Float = "Float",
1209
+ String = "String",
1210
+ Color = "Color",
1211
+ Enum = "Enum",
1212
+ Struct = "Struct"
1213
+ }
1214
+
1215
+ /**
1216
+ * Please read this before you change anything in this file.
1217
+ *
1218
+ * Types in here are a sub-set of the types in `api/asset.ts` and are meant to be
1219
+ * exposed publicly.
1220
+ *
1221
+ * We do not use the types from `asset.ts` directly to handle (copy&paste) the
1222
+ * syncing of the public type declarations and what we actually use in the config.
1223
+ * This makes it easier to ensure that the customer is using the correct types and
1224
+ * any missmatch between this and the `asset.ts` file will be shown by our
1225
+ * type-checker.
1226
+ *
1227
+ * PLEASE NOTE: If you change anything in here, make the according changes in
1228
+ * the `release/types.d.ts` file.
1229
+ */
1230
+ declare interface QueryData {
1231
+ /**
1232
+ * A query string used for (fuzzy) searching of labels and tags
1233
+ */
1234
+ query?: string;
1235
+ /**
1236
+ * The number of results queried. How many assets shall be returned regardless
1237
+ * of the total number of assets available.
1238
+ *
1239
+ * Together with `page` this can be used for pagination.
1240
+ */
1241
+ perPage: number;
1242
+ /**
1243
+ * The current page queried for paginated views.
1244
+ */
1245
+ page: number;
1246
+ }
1247
+
1248
+ declare type RGBA = [r: number, g: number, b: number, a: number];
1249
+
1250
+ /** All components between 0 and 1 */
1251
+ declare interface RGBAColor {
1252
+ r: number;
1253
+ g: number;
1254
+ b: number;
1255
+ a: number;
1256
+ }
1257
+
1258
+ /** All components between 0 and 1 */
1259
+ declare interface RGBColor {
1260
+ r: number;
1261
+ g: number;
1262
+ b: number;
1263
+ }
1264
+
1265
+ /**
1266
+ * Enum for the engine-internal numerical representations of the roles
1267
+ */
1268
+ declare const enum Role {
1269
+ Creator = 0,
1270
+ Adopter = 1,
1271
+ Viewer = 2,
1272
+ Presenter = 3
1273
+ }
1274
+
1275
+ /** Export Settings
1276
+ *
1277
+ */
1278
+ declare type Scene = {
1279
+ maskSpotColor?: SpotColor;
1280
+ /**
1281
+ * The DPI value to use when exporting and when converting between pixels and inches or millimeter units.
1282
+ * (In the CESDK, this value is synonymous with PPI).
1283
+ *
1284
+ * This is only relevant for new scenes that are created in the editor. Loaded scenes will use the
1285
+ * value stored in their serialization file.
1286
+ */
1287
+ dpi: number;
1288
+ /**
1289
+ * A scale factor that is applied to the final export resolution.
1290
+ *
1291
+ * This is only relevant for new scenes that are created in the editor. Loaded scenes will use the
1292
+ * value stored in their serialization file.
1293
+ */
1294
+ pixelScaleFactor: number;
1295
+ };
1296
+
1297
+ /**
1298
+ * @public
1299
+ */
1300
+ export declare class SceneAPI {
1301
+ #private;
1302
+
1303
+ /**
1304
+ * Load the contents of a scene file.
1305
+ * @param sceneContent - The scene file contents, a base64 string.
1306
+ * @returns A handle to the loaded scene.
1307
+ */
1308
+ loadFromString(sceneContent: string): Promise<DesignBlockId>;
1309
+ /**
1310
+ * Load a scene from the URL to the scene file.
1311
+ * The scene file will be fetched asynchronously by the engine. This requires continous `render`
1312
+ * calls on this engines instance.
1313
+ * @param url - The URL of the scene file.
1314
+ * @returns scene A promise that resolves once the scene was loaded or rejects with an error otherwise.
1315
+ */
1316
+ loadFromURL(url: string): Promise<DesignBlockId>;
1317
+ /**
1318
+ * Serializes the current scene into a string. Selection is discarded.
1319
+ * @returns A promise that resolves with a string on success or an error on failure.
1320
+ */
1321
+ saveToString(): Promise<string>;
1322
+ /**
1323
+ * Saves the current scene and all of its referenced assets into an archive.
1324
+ * The archive contains all assets, that were accessible when this function was called.
1325
+ * Blocks in the archived scene reference assets relative from to the location of the scene
1326
+ * file. These references are resolved when loading such a scene via `loadSceneFromURL`.
1327
+ *
1328
+ * @returns A promise that resolves with a Blob on success or an error on failure.
1329
+ */
1330
+ saveToArchive(): Promise<Blob>;
1331
+ /**
1332
+ * Create a new scene, along with its own camera.
1333
+ * @returns The scenes handle.
1334
+ */
1335
+ create(): DesignBlockId;
1336
+ /**
1337
+ * Loads the given image and creates a scene with a single page showing the image.
1338
+ * Fetching the image may take an arbitrary amount of time, so the scene isn't immediately
1339
+ * available.
1340
+ * @param url - The image URL.
1341
+ * @param dpi - The scenes DPI.
1342
+ * @param pixelScaleFactor - The displays pixel scale factor.
1343
+ * @returns A promise that resolves with the scene ID on success or rejected with an error otherwise.
1344
+ */
1345
+ createFromImage(url: string, dpi?: number, pixelScaleFactor?: number): Promise<DesignBlockId>;
1346
+ /**
1347
+ * Return the currently active scene.
1348
+ * @returns The scene or null, if none was created yet.
1349
+ */
1350
+ get(): DesignBlockId | null;
1351
+ }
1352
+
1353
+ declare enum SceneLayout {
1354
+ Free = 0,
1355
+ VerticalStack = 1,
1356
+ HorizontalStack = 2
1357
+ }
1358
+
1359
+ /**
1360
+ * @public
1361
+ */
1362
+ export declare enum SizeMode {
1363
+ /** Size in absolute design units. */
1364
+ Absolute = "Absolute",
1365
+ /** Size in relation to the block's parent's size in percent, where 1.0 means 100%. */
1366
+ Percent = "Percent",
1367
+ /** Size is determined by the block's content. */
1368
+ Auto = "Auto"
1369
+ }
1370
+
1371
+ declare type SpotColor = {
1372
+ name: string;
1373
+ rgbApproximation: RGBColor;
1374
+ cmykApproximation: CMYKColor;
1375
+ };
1376
+
1377
+ /**
1378
+ * @public
1379
+ */
1380
+ export declare enum StrokeCornerGeometry {
1381
+ Bevel = "Bevel",
1382
+ Miter = "Miter",
1383
+ Round = "Round"
1384
+ }
1385
+
1386
+ /**
1387
+ * @public
1388
+ */
1389
+ export declare enum StrokePosition {
1390
+ Center = "Center",
1391
+ Inner = "Inner",
1392
+ Outer = "Outer"
1393
+ }
1394
+
1395
+ /**
1396
+ * @public
1397
+ */
1398
+ export declare enum StrokeStyle {
1399
+ Dashed = "Dashed",
1400
+ DashedRound = "DashedRound",
1401
+ Dotted = "Dotted",
1402
+ LongDashed = "LongDashed",
1403
+ LongDashedRound = "LongDashedRound",
1404
+ Solid = "Solid"
1405
+ }
1406
+
1407
+ declare type TemplateDefinition = Preset & {
1408
+ scene: string | URL | (() => Promise<string>);
1409
+ thumbnailURL?: string | URL;
1410
+ };
1411
+
1412
+ declare interface TypeDescription {
1413
+ name: string;
1414
+ members: Array<TypeMemberDescription>;
1415
+ }
1416
+
1417
+ declare type TypefaceDefinition = Preset & {
1418
+ family: string;
1419
+ fonts: [
1420
+ {
1421
+ fontURL: string;
1422
+ weight: FontWeight;
1423
+ style: FontStyle;
1424
+ }
1425
+ ];
1426
+ };
1427
+
1428
+ declare interface TypeMemberDescription {
1429
+ name: string;
1430
+ type: string;
1431
+ props: Array<TypeProp>;
1432
+ }
1433
+
1434
+ declare interface TypeProp {
1435
+ key: string;
1436
+ value: number | string;
1437
+ }
1438
+
1439
+ /**
1440
+ * @public
1441
+ */
1442
+ export declare class VariableAPI {
1443
+ #private;
1444
+
1445
+ /**
1446
+ * Get all text variables currently stored in the engine.
1447
+ * @returns Return a list of variable names
1448
+ */
1449
+ findAll(): string[];
1450
+ /**
1451
+ * Set a text variable.
1452
+ * @param key - The variable's key.
1453
+ * @param value - The text to replace the variable with.
1454
+ */
1455
+ setString(key: string, value: string): void;
1456
+ /**
1457
+ * Set a text variable.
1458
+ * @param key - The variable's key.
1459
+ * @returns The text value of the variable.
1460
+ */
1461
+ getString(key: string): string;
1462
+ /**
1463
+ * Destroy a text variable.
1464
+ * @param key - The variable's key.
1465
+ */
1466
+ remove(key: string): void;
1467
+ }
1468
+
1469
+ declare type VariableDefinition = Preset & {
1470
+ value: string | number;
1471
+ };
1472
+
1473
+ declare type Variables = {
1474
+ [id: string]: VariableDefinition;
1475
+ };
1476
+
1477
+ declare interface Vec2 {
1478
+ x: number;
1479
+ y: number;
1480
+ }
1481
+
1482
+ declare interface Vec3 {
1483
+ x: number;
1484
+ y: number;
1485
+ z: number;
1486
+ }
1487
+
1488
+ declare interface Vector<T> {
1489
+ size: () => number;
1490
+ get: (index: number) => T;
1491
+ delete: () => void;
1492
+ }
1493
+
1494
+ export { }