@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
package/types.d.ts DELETED
@@ -1,759 +0,0 @@
1
- /* eslint-disable max-classes-per-file */
2
- /* eslint-disable spaced-comment */
3
- import API from './api';
4
-
5
- //#region utils
6
-
7
- export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<T>;
8
-
9
- //#endregion
10
-
11
- //#region ui/utils/color.ts
12
-
13
- // All values in [0-1]
14
- export interface RGBColor {
15
- r: number;
16
- g: number;
17
- b: number;
18
- }
19
-
20
- // All values in [0-1]
21
- export interface HSLColor {
22
- h: number;
23
- s: number;
24
- l: number;
25
- }
26
-
27
- // All values in [0-1]
28
- export interface HSVColor {
29
- h: number;
30
- s: number;
31
- v: number;
32
- }
33
-
34
- //#endregion
35
-
36
- //#region api/types/cesdk/engine
37
-
38
- export const enum DesignUnit {
39
- Pixel = 'px',
40
- Millimeter = 'mm',
41
- Inch = 'in'
42
- }
43
-
44
- export enum LogLevel {
45
- Info = 'Info',
46
- Warning = 'Warning',
47
- Error = 'Error'
48
- }
49
-
50
- export type Logger = (message: string, level: LogLevel) => void;
51
-
52
- export interface AssetElement {
53
- id: string;
54
- name: string;
55
- uri: string;
56
- thumbUri: string;
57
- }
58
-
59
- export interface ImageElement extends AssetElement {
60
- size: {
61
- width: number;
62
- height: number;
63
- };
64
- }
65
-
66
- export interface VectorShapeElement extends ImageElement {
67
- vectorPath: string;
68
- }
69
-
70
- // All components between 0 and 1
71
- export interface RGBAColor {
72
- r: number;
73
- g: number;
74
- b: number;
75
- a: number;
76
- }
77
-
78
- // All components between 0 and 1
79
- export interface CMYKColor {
80
- c: number;
81
- m: number;
82
- y: number;
83
- k: number;
84
- }
85
- //#endregion
86
-
87
- //#region Types
88
-
89
- export type Theme = 'light' | 'dark';
90
-
91
- export type Scale = 'normal' | 'large';
92
-
93
- export type PartialImageElement = Optional<ImageElement, 'size'>;
94
-
95
- export type SpotColor = {
96
- name: string;
97
- rgbApproximation: RGBColor;
98
- cmykApproximation: CMYKColor;
99
- };
100
-
101
- /**
102
- * A hexadecimal color value (RGB or RGBA) that starts with a '#'
103
- * @example #6686FF or #6686FFFF
104
- */
105
- export type HexColorString = string;
106
-
107
- /**
108
- * A color definition for the custom color palette.
109
- * The RGB and CMYK components must all be specified in the range [0-1].
110
- */
111
- export type ColorPaletteColor =
112
- | HexColorString
113
- | RGBColor
114
- | RGBAColor
115
- | SpotColor;
116
-
117
- export type Asset = {
118
- src: string;
119
- };
120
-
121
- export type Assets = {
122
- [id: string]: Asset;
123
- };
124
-
125
- export interface QueryData {
126
- /**
127
- * A query string used for (fuzzy) searching of labels and tags
128
- */
129
- query?: string;
130
-
131
- /**
132
- * The number of results queried. How many assets shall be returned regardless
133
- * of the total number of assets available.
134
- *
135
- * Together with `page` this can be used for pagination.
136
- */
137
- perPage: number;
138
-
139
- /**
140
- * The current page queried for paginated views.
141
- */
142
- page: number;
143
- }
144
-
145
- /**
146
- * Single asset result of a query from the engine.
147
- */
148
- export interface AssetResult {
149
- /**
150
- * A unique id of this asset
151
- */
152
- id: string;
153
-
154
- /**
155
- * E.g. `ly.img.image`
156
- */
157
- type: string;
158
-
159
- /**
160
- * URI to a thumbnail of the asset used e.g. in the content library UI
161
- */
162
- thumbUri: string;
163
-
164
- /**
165
- * Original size of the asset.
166
- */
167
- size: {
168
- width: number;
169
- height: number;
170
- };
171
-
172
- /**
173
- * Asset-specific and custom meta information
174
- */
175
- meta?: { uri?: string; filename?: string } & Record<string, unknown>;
176
-
177
- /**
178
- * The locale of the label and tags
179
- */
180
- locale?: string;
181
-
182
- /**
183
- * The label of the result. Used for description and tooltips.
184
- */
185
- label?: string;
186
-
187
- /**
188
- * The tags of this asset. Used for filtering and free-text searching.
189
- */
190
- tags?: string[];
191
-
192
- /**
193
- * Credits for the artist of the asset
194
- */
195
- credits?: {
196
- name: string;
197
- url?: string;
198
- };
199
-
200
- /**
201
- * License for this asset. Overwrites the source license if present
202
- */
203
- license?: {
204
- name: string;
205
- url?: string;
206
- };
207
- }
208
-
209
- /**
210
- * Return type of a `findAssets` query.
211
- */
212
- export interface AssetsQueryResult {
213
- /**
214
- * The assets in the requested page
215
- */
216
- assets: AssetResult[];
217
-
218
- /**
219
- * The current, requested page
220
- */
221
- currentPage: number;
222
-
223
- /**
224
- * The next page to query if it exists
225
- */
226
- nextPage: number | undefined;
227
-
228
- /**
229
- * How many assets are there in total for the current query regardless of the page
230
- */
231
- total: number;
232
- }
233
-
234
- /**
235
- * API to query for assets
236
- */
237
- export interface AssetSource {
238
- /**
239
- * The asset types returned by this source. Will default to ['ly.img.image'].
240
- */
241
- types?: string[];
242
-
243
- /**
244
- * Find all asset for the given type and the provided query data.
245
- */
246
- findAssets(
247
- type: string,
248
- queryData?: QueryData
249
- ): Promise<AssetsQueryResult | undefined>;
250
-
251
- /**
252
- * Indicates if the asset shall be downloaded to handle the raw data instead
253
- * of an URL reference. Do this if you do not want to depend on
254
- * a service after adding the asset to the scene. If this is your own API
255
- * with your own service, you do not need to set this and avoid downloading /
256
- * re-uploading the assets.
257
- */
258
- downloadAssets?: (asset: AssetResult) => Promise<Blob>;
259
-
260
- /**
261
- * Credits for the source/api
262
- */
263
- credits?: {
264
- name: string;
265
- url?: string;
266
- };
267
-
268
- /**
269
- * General license for all asset from this source
270
- */
271
- license?: {
272
- name: string;
273
- url?: string;
274
- };
275
- }
276
-
277
- export type AssetSources = {
278
- [id: string]: AssetSource;
279
- };
280
-
281
- export type Preset = {
282
- meta?: {
283
- default?: boolean;
284
- library?: string;
285
- categories?: string[];
286
- };
287
- };
288
-
289
- export type VariableDefinition = Preset & {
290
- value: string | number;
291
- };
292
- export type ColorDefinition = Preset & {
293
- value: ColorPaletteColor;
294
- };
295
- export type ColorPaletteDefinition = Preset & {
296
- entries: ColorPaletteColor[];
297
- };
298
-
299
- export type PageFormatDefinition = Preset & {
300
- width: number;
301
- height: number;
302
- unit: DesignUnit;
303
- dpi?: number;
304
- bleedMargin?: number;
305
- };
306
-
307
- export type TemplateDefinition = Preset & {
308
- scene: string | URL | (() => Promise<string>);
309
- thumbnailURL?: string | URL;
310
- };
311
-
312
- export type DuoToneFilterDefinition = {
313
- lookupTableURL: string;
314
- thumbnailURL?: string;
315
- colors: {
316
- light: ColorPaletteColor;
317
- dark: ColorPaletteColor;
318
- };
319
- };
320
-
321
- export type LUTFilterDefinition = {
322
- lookupTableURL: string;
323
- thumbnailURL: string;
324
- horizontalTileCount: number;
325
- verticalTileCount: number;
326
- };
327
-
328
- export type FontWeight =
329
- | 'thin'
330
- | 'extraLight'
331
- | 'Light'
332
- | 'normal'
333
- | 'medium'
334
- | 'semiBold'
335
- | 'bold'
336
- | 'extraBold'
337
- | 'heavy';
338
-
339
- export type FontStyle = 'normal' | 'italic';
340
-
341
- export type TypefaceDefinition = Preset & {
342
- family: string;
343
- fonts: [
344
- {
345
- fontURL: string;
346
- weight: FontWeight;
347
- style: FontStyle;
348
- }
349
- ];
350
- };
351
-
352
- export type ImageDefinition = Preset & {
353
- imageURL: string;
354
- thumbnailURL?: string; // might be moved to general preset Probs
355
- width: number;
356
- height: number;
357
- levelOfDetail?: {
358
- [lod: number]: string;
359
- };
360
- };
361
-
362
- export type Presets = {
363
- colors?: { [id: string]: ColorDefinition };
364
- typefaces?: { [id: string]: TypefaceDefinition };
365
- images?: { [id: string]: ImageDefinition };
366
- pageFormats?: { [id: string]: PageFormatDefinition };
367
- colorPalettes?: { [id: string]: ColorPaletteDefinition };
368
- templates?: { [id: string]: TemplateDefinition };
369
- [type: string]: { [id: string]: Preset } | undefined;
370
- };
371
-
372
- export type Variables = { [id: string]: VariableDefinition };
373
-
374
- /** I18n Settings
375
- * Note: this will append keys and not override keys
376
- */
377
- export type I18n = { [key: string]: I18n | string };
378
-
379
- /** A11 Settings
380
- *
381
- */
382
- export type A11y = {
383
- /**
384
- * The option define a level of heading to start from (in a range 1-6)
385
- */
386
- headingsHierarchyStart: 1 | 2 | 3 | 4 | 5 | 6;
387
- };
388
-
389
- export type Core = {
390
- baseURL: string;
391
- };
392
-
393
- export type Extensions = {
394
- baseURL: string;
395
- entries: string[]; // FIXME Should be URLs
396
- };
397
-
398
- /** Export Settings
399
- *
400
- */
401
- export type Scene = {
402
- maskSpotColor?: SpotColor;
403
- /**
404
- * The DPI value to use when exporting and when converting between pixels and inches or millimeter units.
405
- * (In the CESDK, this value is synonymous with PPI).
406
- *
407
- * This is only relevant for new scenes that are created in the editor. Loaded scenes will use the
408
- * value stored in their serialization file.
409
- */
410
- dpi: number;
411
-
412
- /**
413
- * A scale factor that is applied to the final export resolution.
414
- *
415
- * This is only relevant for new scenes that are created in the editor. Loaded scenes will use the
416
- * value stored in their serialization file.
417
- */
418
- pixelScaleFactor: number;
419
- };
420
-
421
- export type OnUploadCallback = (
422
- file: File,
423
- onProgress: (progress: number) => void
424
- ) => Promise<PartialImageElement>;
425
-
426
- export type OnUploadOptions = {
427
- supportedMimeTypes: string[];
428
- };
429
-
430
- export type Callbacks = {
431
- onBack?: () => void;
432
- onClose?: () => void;
433
-
434
- onSave?: (s: string) => void | Promise<void>;
435
- onLoad?: () => Promise<string>;
436
-
437
- onDownload?: (s: string) => void | Promise<void>;
438
- onExport?: (blobs: Blob[], options: ExportOptions) => void | Promise<void>;
439
-
440
- onUpload?:
441
- | OnUploadCallback
442
- | 'local'
443
- | (Partial<OnUploadOptions> & { callback: OnUploadCallback });
444
-
445
- onUnsupportedBrowser?: () => void;
446
-
447
- log?: Logger;
448
- };
449
-
450
- /**
451
- * Bleed margin configuration options for a single design unit type.
452
- */
453
- export interface BleedMarginOptions {
454
- /**
455
- * The bleed margin options that can be selected from a dropdown in the UI.
456
- * Other bleed margin values can be entered directly using the input field.
457
- */
458
- dropdownOptions: number[];
459
-
460
- /**
461
- * The default bleed margin value.
462
- */
463
- defaultBleedMargin: number;
464
- }
465
-
466
- export interface FontSizeOptions {
467
- /**
468
- * The font size options that can be selected from a dropdown in the UI.
469
- * Other font size values can be entered directly using the input field.
470
- */
471
- dropdownOptions: number[];
472
- }
473
-
474
- export interface UIOptionsForSingleDesignUnit {
475
- bleedMargin: BleedMarginOptions;
476
- }
477
-
478
- export interface UIOptionsPerDesignUnit {
479
- mm: UIOptionsForSingleDesignUnit;
480
- px: UIOptionsForSingleDesignUnit;
481
- in: UIOptionsForSingleDesignUnit;
482
- }
483
-
484
- //#endregion
485
-
486
- //#region userInterface/elements/types
487
-
488
- export enum NavigationPosition {
489
- Top = 'top',
490
- Bottom = 'bottom'
491
- }
492
-
493
- export interface UserInterfaceElement {
494
- show?: boolean;
495
- }
496
-
497
- export interface UserInterfaceInspectorBlocks {
498
- opacity?: UserInterfaceElement | boolean;
499
- transform?: UserInterfaceElement | boolean;
500
-
501
- // Hardcoding the ids in this map for now for easier handling
502
- '//ly.img.ubq/image': UserInterfaceInspectorBlockImage;
503
- '//ly.img.ubq/text': UserInterfaceInspectorBlockText;
504
- }
505
-
506
- // At some point this will extend an element if we have solutions to not show
507
- // inspectors for some blocks.
508
- export interface UserInterfaceInspectorBlock {} // extends UserInterfaceElement {}
509
-
510
- export interface UserInterfaceInspectorBlockText
511
- extends UserInterfaceInspectorBlock {
512
- advanced?: UserInterfaceElement | boolean;
513
- color?: UserInterfaceElement | boolean;
514
- backgroundColor?: UserInterfaceElement | boolean;
515
- }
516
-
517
- export interface UserInterfaceInspectorBlockImage
518
- extends UserInterfaceInspectorBlock {
519
- crop?: UserInterfaceElement | boolean;
520
- filters?: UserInterfaceElement | boolean;
521
- adjustments?: UserInterfaceElement | boolean;
522
- effects?: UserInterfaceElement | boolean;
523
- blur?: UserInterfaceElement | boolean;
524
- }
525
-
526
- export interface UserInterfaceInspector extends UserInterfaceElement {
527
- position?: 'left' | 'right'; // This was simplified from an enum
528
- }
529
-
530
- export interface UserInterfaceSettings extends UserInterfaceElement {}
531
-
532
- export interface UserInterfaceNavigation extends UserInterfaceElement {
533
- position: NavigationPosition;
534
- action?: {
535
- close: UserInterfaceElement | boolean;
536
- back: UserInterfaceElement | boolean;
537
-
538
- save: UserInterfaceElement | boolean;
539
- load: UserInterfaceElement | boolean;
540
-
541
- export: UserInterfaceElement | boolean;
542
- download: UserInterfaceElement | boolean;
543
- };
544
- }
545
-
546
- export interface UserInterfaceElements {
547
- view?: {
548
- adopter?: {
549
- style?: 'default' | 'advanced';
550
- };
551
- };
552
-
553
- panels?: {
554
- inspector?: UserInterfaceInspector | boolean;
555
- settings?: UserInterfaceSettings | boolean;
556
- };
557
-
558
- templates?: UserInterfaceElement | boolean;
559
-
560
- libraries?: {
561
- image?: UserInterfaceElement | boolean;
562
- text?: UserInterfaceElement | boolean;
563
- element?: UserInterfaceElement | boolean;
564
- };
565
-
566
- blocks?: UserInterfaceInspectorBlocks;
567
-
568
- navigation: UserInterfaceNavigation;
569
- }
570
-
571
- //#endregion
572
-
573
- //#region userInterface/types
574
- export interface UserInterface {
575
- baseURL: string;
576
- elements: UserInterfaceElements;
577
- }
578
- //#endregion
579
-
580
- //#region Configuration
581
- export class Configuration {
582
- static initWithDefaults(config: Partial<Configuration>): Configuration;
583
-
584
- extend(update: Partial<Configuration>): Configuration;
585
-
586
- baseURL: string;
587
-
588
- license?: string;
589
-
590
- role: string;
591
-
592
- locale: string;
593
-
594
- theme: Theme;
595
-
596
- devMode: boolean;
597
-
598
- initialSceneString?: string;
599
-
600
- initialSceneURL?: string;
601
-
602
- extensions: Extensions;
603
-
604
- core: Core;
605
-
606
- ui: UserInterface;
607
-
608
- i18n: I18n;
609
-
610
- a11y: A11y;
611
-
612
- scene: Scene;
613
-
614
- assets: Assets;
615
-
616
- assetSources: AssetSources;
617
-
618
- presets: Presets;
619
-
620
- variables: Variables;
621
-
622
- callbacks: Callbacks;
623
-
624
- /**
625
- * The default font used by a text added to the scene. Needs to be the id of
626
- * the font from a extension pack including namespace, e.g.
627
- *
628
- * '//ly.img.cesdk.fonts/roboto_regular'
629
- *
630
- * If not configured the fallback font is used.
631
- */
632
- public defaultFont?: string;
633
- }
634
-
635
- type DeepPartial<T> = {
636
- [P in keyof T]?: DeepPartial<T[P]>;
637
- };
638
-
639
- // Make the properties K of T DeepPartial
640
- type DeepOptional<T, K extends keyof T> = Pick<DeepPartial<T>, K> & Omit<T, K>;
641
-
642
- export type UserConfiguration = Partial<DeepOptional<Configuration, 'ui'>>;
643
-
644
- //#endregion
645
-
646
- //#region packages/api/types/engine.ts
647
-
648
- export interface ExportOptions {
649
- mimeType: 'image/png' | 'image/jpeg';
650
- quality?: number;
651
- pages?: number[];
652
- }
653
-
654
- //#endregion
655
-
656
- //#region CESDK index
657
-
658
- export default class CreativeEditorSDK {
659
- public static Configuration: Configuration;
660
-
661
- public engine: API;
662
-
663
- /**
664
- * Exports one or multiple page(s) as an file in the given mimeType
665
- *
666
- * Please note: the `onExport` callback provided in the configuration will be
667
- * not called. This callback is for exports triggered by an user interaction.
668
- *
669
- * @param {Object} options options for the export
670
- * @param {string} options.mimeType - The mime type of the exported blob.
671
- * @param {string} options.pages [pages] - the pages to export with the selected page as the default.
672
- *
673
- * @returns a promise with a blob of the exported page.
674
- */
675
- export(options: ExportOptions): Promise<Blob[]>;
676
-
677
- /**
678
- * Load a base64 encoded scene.
679
- *
680
- * @returns a promise which resolves if the scene was successfully loaded.
681
- */
682
- load(scene: string): Promise<void>;
683
-
684
- /**
685
- * Save and return a scene as a base64 encoded string.
686
- *
687
- * @return a promise with the scene as a string
688
- */
689
- save(): Promise<string>;
690
-
691
- /**
692
- * Adds or update text variable definition.
693
- *
694
- * Translations can be added inside the custom locale translations under the
695
- * key `variables.${id}.label`.
696
- *
697
- * @typedef {Object} Variable
698
- * @property {string} value the value of the variable
699
- * @param {Object.<string, Variable>} definitions text variable definitions to add or update
700
- *
701
- * @returns a resolved promise if all variables were set successfully.
702
- */
703
- setVariableDefinitions(definitions: {
704
- [id: string]: VariableDefinition;
705
- }): Promise<void>;
706
-
707
- /**
708
- * Adds an image definition which can be used in the image library.
709
- *
710
- * @typedef {Object} ImageElement
711
- * @property {string} imageURL URL to the image
712
- * @property {string} [thumbnailURL] URL to thumbnail of the image
713
- * @property {string} width width of the image
714
- * @property {string} height height of the image
715
- *
716
- * @param {Object.<string, ImageElement>} definitions image definitions
717
- *
718
- * @returns a resolved promise if all images were add successfully
719
- */
720
- setImageDefinitions(definitions: {
721
- [id: string]: ImageDefinition;
722
- }): Promise<void[]>;
723
-
724
- /**
725
- * Adds translations to be used by the editor.
726
- *
727
- * @param {Object.<string, Object>} translations locale to a translation object
728
- *
729
- * @example
730
- * setTranslations({
731
- * en: {
732
- * presets: {
733
- * scene: ...
734
- * }
735
- * }
736
- * })
737
- */
738
- setTranslations(definitions: { [locale: string]: object }): void;
739
-
740
- /**
741
- * Disposes the editor and engine if no longer needed.
742
- */
743
- dispose(): void;
744
-
745
- /**
746
- * Initializes the editor and renders it for the given container.
747
- *
748
- * @param {(string|HTMLElement)} [container] the container to mount the editor as a HTML element or selector
749
- * @param {Object} [configuration] the initial configuration to start the editor
750
- *
751
- * @returns a promise which resolves after the engine is ready to receive further commands on the CreativeEditorSDK instance
752
- */
753
- static init(
754
- container: HTMLDivElement | string,
755
- config?: UserConfiguration
756
- ): Promise<CreativeEditorSDK>;
757
- }
758
-
759
- //#endregion