@cesdk/cesdk-js 1.7.0 → 1.8.0-alpha.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.
package/index.d.ts CHANGED
@@ -23,7 +23,7 @@ export declare class API {
23
23
  * Generic asset information
24
24
  * @public
25
25
  */
26
- declare interface Asset {
26
+ export declare interface Asset {
27
27
  /**
28
28
  * Is a combination of source id, extension pack id (optional), type and asset id
29
29
  * e.g. "extension://ly.img.cesdk.images.samples/ly.img.image/sample.1"
@@ -53,7 +53,7 @@ export declare class AssetAPI {
53
53
  * Adds a custom asset source. Its ID has to be unique.
54
54
  * @param source - The asset source.
55
55
  */
56
- addSource(source: AssetSource_2): void;
56
+ addSource(source: AssetSource): void;
57
57
  /**
58
58
  * Removes an asset source with the given ID.
59
59
  * @param id - The ID to refer to the asset source.
@@ -70,7 +70,7 @@ export declare class AssetAPI {
70
70
  * @param query - All the options to filter the search results by.
71
71
  * @returns The search results.
72
72
  */
73
- findAssets(sourceId: string, query: AssetQueryData): Promise<AssetsQueryResult_2>;
73
+ findAssets(sourceId: string, query: AssetQueryData): Promise<AssetsQueryResult>;
74
74
  /**
75
75
  * Queries the asset source's groups for a certain asset type.
76
76
  * @param id - The ID of the asset source.
@@ -96,6 +96,8 @@ export declare class AssetAPI {
96
96
  url: string | undefined;
97
97
  } | undefined;
98
98
  canManageAssets(sourceId: string): boolean;
99
+
100
+
99
101
  /**
100
102
  * Apply an asset result to the active scene.
101
103
  * The default behavior will instantiate a block and configure it according to the asset's properties.
@@ -103,14 +105,20 @@ export declare class AssetAPI {
103
105
  * @param sourceId - The ID of the asset source.
104
106
  * @param assetResult - A single assetResult of a `findAssets` query.
105
107
  */
106
- apply(sourceId: string, assetResult: AssetResult_2): Promise<void>;
108
+ apply(sourceId: string, assetResult: AssetResult): Promise<void>;
109
+ /**
110
+ * The default implementation for applying an asset to the scene.
111
+ * This implementation is used when no `applyAsset` function is provided to `addSource`.
112
+ * @param assetResult - A single assetResult of a `findAssets` query.
113
+ */
114
+ defaultApplyAsset(assetResult: AssetResult): Promise<void>;
107
115
  }
108
116
 
109
117
  /**
110
118
  * Definition of an assets used if an asset is added to an asset source.
111
119
  * @public
112
120
  */
113
- declare interface AssetDefinition extends Asset {
121
+ export declare interface AssetDefinition extends Asset {
114
122
  /**
115
123
  * Label used to display in aria-label and as a tooltip.
116
124
  * Will be also searched in a query and should be localized
@@ -189,22 +197,22 @@ declare interface AssetLibraryEntryView {
189
197
  /**
190
198
  * Overwrite the label of a card for a specific asset result
191
199
  */
192
- cardLabel?: (assetResult: AssetResult_2) => string | undefined;
200
+ cardLabel?: (assetResult: AssetResult) => string | undefined;
193
201
  /**
194
202
  * Add custom styles to a card for a specific asset result
195
203
  */
196
- cardStyle?: (assetResult: AssetResult_2) => Record<string, string | undefined>;
204
+ cardStyle?: (assetResult: AssetResult) => Record<string, string | undefined>;
197
205
  /**
198
206
  * Add custom styles to a label for a specific asset result
199
207
  */
200
- cardLabelStyle?: (assetResult: AssetResult_2) => Record<string, string | undefined>;
208
+ cardLabelStyle?: (assetResult: AssetResult) => Record<string, string | undefined>;
201
209
  }
202
210
 
203
211
  /**
204
212
  * Defines a request for querying assets
205
213
  * @public
206
214
  */
207
- declare interface AssetQueryData {
215
+ export declare interface AssetQueryData {
208
216
  /** A query string used for (fuzzy) searching of labels and tags */
209
217
  query?: string;
210
218
  /** The current page queried for paginated views. */
@@ -234,7 +242,36 @@ declare interface AssetQueryData {
234
242
  * Single asset result of a query from the engine.
235
243
  * @public
236
244
  */
237
- declare interface AssetResult {
245
+ export declare interface AssetResult extends Asset {
246
+ /** The locale of the label and tags */
247
+ locale?: Locale;
248
+ /** The label of the result. Used for description and tooltips. */
249
+ label?: string;
250
+ /** The tags of this asset. Used for filtering and free-text searching. */
251
+ tags?: string[];
252
+
253
+ /** Credits for the artist of the asset */
254
+ credits?: {
255
+ name: string;
256
+ url?: string;
257
+ };
258
+ /** License for this asset. Overwrites the source license if present */
259
+ license?: {
260
+ name: string;
261
+ url?: string;
262
+ };
263
+ /** UTM parameters for the links inside the credits */
264
+ utm?: {
265
+ source?: string;
266
+ medium?: string;
267
+ };
268
+ }
269
+
270
+ /**
271
+ * Single asset result of a query from the engine.
272
+ * @public
273
+ */
274
+ declare interface AssetResult_2 {
238
275
  /** A unique id of this asset */
239
276
  id: string;
240
277
  /** URI to a thumbnail of the asset used e.g. in the content library UI */
@@ -270,84 +307,21 @@ declare interface AssetResult {
270
307
  };
271
308
  }
272
309
 
273
- /**
274
- * Single asset result of a query from the engine.
275
- * @public
276
- */
277
- declare interface AssetResult_2 extends Asset {
278
- /** The locale of the label and tags */
279
- locale?: Locale;
280
- /** The label of the result. Used for description and tooltips. */
281
- label?: string;
282
- /** The tags of this asset. Used for filtering and free-text searching. */
283
- tags?: string[];
284
-
285
- /** Credits for the artist of the asset */
286
- credits?: {
287
- name: string;
288
- url?: string;
289
- };
290
- /** License for this asset. Overwrites the source license if present */
291
- license?: {
292
- name: string;
293
- url?: string;
294
- };
295
- /** UTM parameters for the links inside the credits */
296
- utm?: {
297
- source?: string;
298
- medium?: string;
299
- };
300
- }
301
-
302
310
  /** @public */
303
311
  declare interface AssetResultContext {
304
312
  sourceId: string;
305
313
  createdByRole: string;
306
314
  }
307
315
 
308
- /**
309
- * API to query for assets
310
- * @public
311
- */
312
- declare interface AssetSource {
313
- /** Find all asset for the given type and the provided query data. */
314
- findAssets(queryData?: QueryData): Promise<AssetsQueryResult | undefined>;
315
- /**
316
- * Apply the given asset result to the active scene.
317
- * You can override this with custom behavior.
318
- */
319
- applyAsset?: (asset: AssetResult) => Promise<void>;
320
- /** Return every available group */
321
- getGroups?: () => Promise<string[]>;
322
- /**
323
- * Indicates if the asset shall be downloaded to handle the raw data instead
324
- * of an URL reference. Do this if you do not want to depend on
325
- * a service after adding the asset to the scene. If this is your own API
326
- * with your own service, you do not need to set this and avoid downloading /
327
- * re-uploading the assets.
328
- */
329
- downloadAssets?: (asset: AssetResult) => Promise<Blob>;
330
- /** Credits for the source/api */
331
- credits?: {
332
- name: string;
333
- url?: string;
334
- };
335
- /** General license for all asset from this source */
336
- license?: {
337
- name: string;
338
- url?: string;
339
- };
340
- }
341
-
342
316
  /**
343
317
  * A source of assets
344
318
  * @public
345
319
  */
346
- declare interface AssetSource_2 {
320
+ export declare interface AssetSource {
347
321
  /** The unique id of the API */
348
322
  id: string;
349
323
  /** Find all asset for the given type and the provided query data. */
350
- findAssets(queryData: AssetQueryData): Promise<AssetsQueryResult_2>;
324
+ findAssets(queryData: AssetQueryData): Promise<AssetsQueryResult>;
351
325
  /** Return every available group */
352
326
  getGroups?: () => Promise<string[]>;
353
327
  /** Credits for the source/api */
@@ -367,11 +341,11 @@ declare interface AssetSource_2 {
367
341
  * with your own service, you do not need to set this and avoid downloading /
368
342
  * re-uploading the assets.
369
343
  */
370
- downloadAssets?: (asset: AssetResult_2) => Promise<Blob>;
344
+ downloadAssets?: (asset: AssetResult) => Promise<Blob>;
371
345
  /**
372
346
  * @returns the asset or undefined if no asset with the given id could be found
373
347
  */
374
- getAsset(id: string): Promise<AssetResult_2 | undefined>;
348
+ getAsset?(id: string): Promise<AssetResult | undefined>;
375
349
  /**
376
350
  * Can the source add, update and remove assets dynamically? If `false`
377
351
  * methods like `addAsset` `updateAsset` and `removeAsset` will throw an
@@ -382,39 +356,73 @@ declare interface AssetSource_2 {
382
356
  * Apply the given asset result to the active scene.
383
357
  * You can override this with custom behavior.
384
358
  */
385
- applyAsset?: (asset: AssetResult_2) => Promise<void>;
359
+ applyAsset?: (asset: AssetResult) => Promise<void>;
386
360
  /**
387
361
  * Adds the given asset to this source. Throws an error if `canManageAssets`
388
362
  * is `false`.
389
363
  *
390
364
  * @returns the id of the added asset
391
365
  */
392
- addAsset(asset: AssetDefinition): Promise<string>;
366
+ addAsset?(asset: AssetDefinition): Promise<string>;
393
367
  /**
394
368
  * Updates the asset of this source. Throws an error if `canManageAssets`
395
369
  * is `false` or no asset with the given id could not be found.
396
370
  *
397
371
  * @returns the id of the added asset
398
372
  */
399
- updateAsset(assetId: string, asset: AssetDefinition): Promise<void>;
373
+ updateAsset?(assetId: string, asset: AssetDefinition): Promise<void>;
400
374
  /**
401
375
  * Removes the given asset from this source.
402
376
  *
403
377
  * @returns true if asset was found and removed, and false otherwise
404
378
  */
405
- removeAsset(assetId: string): Promise<boolean>;
379
+ removeAsset?(assetId: string): Promise<boolean>;
380
+ }
381
+
382
+ /**
383
+ * API to query for assets
384
+ * @public
385
+ */
386
+ declare interface AssetSource_2 {
387
+ /** Find all asset for the given type and the provided query data. */
388
+ findAssets(queryData?: QueryData): Promise<AssetsQueryResult_2 | undefined>;
389
+ /**
390
+ * Apply the given asset result to the active scene.
391
+ * You can override this with custom behavior.
392
+ */
393
+ applyAsset?: (asset: AssetResult_2) => Promise<void>;
394
+ /** Return every available group */
395
+ getGroups?: () => Promise<string[]>;
396
+ /**
397
+ * Indicates if the asset shall be downloaded to handle the raw data instead
398
+ * of an URL reference. Do this if you do not want to depend on
399
+ * a service after adding the asset to the scene. If this is your own API
400
+ * with your own service, you do not need to set this and avoid downloading /
401
+ * re-uploading the assets.
402
+ */
403
+ downloadAssets?: (asset: AssetResult_2) => Promise<Blob>;
404
+ /** Credits for the source/api */
405
+ credits?: {
406
+ name: string;
407
+ url?: string;
408
+ };
409
+ /** General license for all asset from this source */
410
+ license?: {
411
+ name: string;
412
+ url?: string;
413
+ };
406
414
  }
407
415
 
408
416
  /** @public */
409
417
  declare type AssetSources = {
410
- [id: string]: AssetSource;
418
+ [id: string]: AssetSource_2;
411
419
  };
412
420
 
413
421
  /**
414
422
  * Return type of a `findAssets` query.
415
423
  * @public
416
424
  */
417
- declare interface AssetsQueryResult {
425
+ export declare interface AssetsQueryResult {
418
426
  /** The assets in the requested page */
419
427
  assets: AssetResult[];
420
428
  /** The current, requested page */
@@ -461,9 +469,6 @@ declare interface BleedMarginOptions {
461
469
  */
462
470
  export declare type BlendMode = 'PassThrough' | 'Normal' | 'Darken' | 'Multiply' | 'ColorBurn' | 'Lighten' | 'Screen' | 'ColorDodge' | 'Overlay' | 'SoftLight' | 'HardLight' | 'Difference' | 'Exclusion' | 'Hue' | 'Saturation' | 'Color' | 'Luminosity';
463
471
 
464
- /** @public */
465
- declare type Block = number;
466
-
467
472
  /**
468
473
  * @public
469
474
  */
@@ -478,7 +483,7 @@ export declare class BlockAPI {
478
483
  * @param options - The options for exporting the block type
479
484
  * @returns A promise that resolves with the exported image or is rejected with an error.
480
485
  */
481
- export(handle: DesignBlockId, mimeType?: MimeType_2, options?: ExportOptions_2): Promise<Blob>;
486
+ export(handle: DesignBlockId, mimeType?: MimeType_2, options?: EngineExportOptions): Promise<Blob>;
482
487
 
483
488
  /**
484
489
  * Loads existing blocks from the given string.
@@ -1713,17 +1718,9 @@ export declare class BlockAPI {
1713
1718
  isAllowedByScope(id: DesignBlockId, key: string): boolean;
1714
1719
  }
1715
1720
 
1716
- /**
1717
- * @public
1718
- */
1719
- export declare type BlockEvent = {
1720
- block: DesignBlockId;
1721
- type: 'Created' | 'Updated' | 'Destroyed';
1722
- };
1723
-
1724
1721
  /** @public */
1725
- declare interface BlockEvent_2 {
1726
- block: Block;
1722
+ export declare interface BlockEvent {
1723
+ block: DesignBlockId;
1727
1724
  type: 'Created' | 'Updated' | 'Destroyed';
1728
1725
  }
1729
1726
 
@@ -2140,6 +2137,13 @@ export declare class EditorAPI {
2140
2137
  * @param resolver - Custom resolution function.
2141
2138
  */
2142
2139
  setURIResolver(resolver: (URI: string) => string): void;
2140
+ /**
2141
+ * This is the default implementation for the URI resolver.
2142
+ * It resolves the given path relative to the `ubq://basePath` setting.
2143
+ * @param relativePath - The relative path that should be resolved.
2144
+ * @returns The resolved absolute URI.
2145
+ */
2146
+ defaultURIResolver(relativePath: string): string;
2143
2147
  /**
2144
2148
  * Resolves the given path.
2145
2149
  * If a custom resolver has been set with `setURIResolver`, it invokes it with the given path.
@@ -2168,9 +2172,9 @@ declare namespace _EngineConfigTypes {
2168
2172
  HexColorString,
2169
2173
  Color,
2170
2174
  AssetSources,
2171
- AssetSource,
2172
- AssetResult,
2173
- AssetsQueryResult,
2175
+ AssetSource_2 as AssetSource,
2176
+ AssetResult_2 as AssetResult,
2177
+ AssetsQueryResult_2 as AssetsQueryResult,
2174
2178
  QueryData,
2175
2179
  Preset,
2176
2180
  VariableDefinition,
@@ -2219,33 +2223,7 @@ export declare interface _EngineConfiguration {
2219
2223
  /**
2220
2224
  * @public
2221
2225
  */
2222
- export declare class EventAPI {
2223
- #private;
2224
-
2225
- /**
2226
- * Subscribe to block life-cycle events.
2227
- * @param blocks - A list of blocks to filter events by. If the list is empty, events for every block are sent.
2228
- * @param callback - The event callback. Events are bundled and sent at the end of each engine update.
2229
- * @returns A method to unsubscribe.
2230
- */
2231
- subscribe(blocks: DesignBlockId[], callback: (events: BlockEvent[]) => void): () => void;
2232
- }
2233
-
2234
- /** @public */
2235
- declare type ExportFormat = 'image/png' | 'video/mp4' | 'application/pdf';
2236
-
2237
- /** @public */
2238
- export declare interface ExportOptions extends Pick<ExportOptions_2, 'pngCompressionLevel' | 'jpegQuality'> {
2239
- /** The mime type of the exported blob */
2240
- mimeType: MimeType_2;
2241
- /** The pages to export with the selected page as the default */
2242
- pages?: number[];
2243
- }
2244
-
2245
- /**
2246
- * @public
2247
- */
2248
- declare type ExportOptions_2 = {
2226
+ export declare type EngineExportOptions = {
2249
2227
  /**
2250
2228
  * The PNG compression level to use, when exporting to PNG.
2251
2229
  *
@@ -2276,15 +2254,48 @@ declare type ExportOptions_2 = {
2276
2254
  * size entirely while maintaining its aspect ratio.
2277
2255
  */
2278
2256
  targetHeight?: number;
2257
+ /**
2258
+ * Export the PDF document with a higher compatibility to different PDF viewers.
2259
+ * Bitmap images and some effects like gradients will be rasterized with the DPI
2260
+ * setting instead of embedding them directly.
2261
+ */
2262
+ exportPdfWithHighCompatibility?: boolean;
2279
2263
  };
2280
2264
 
2265
+ /**
2266
+ * @public
2267
+ */
2268
+ export declare class EventAPI {
2269
+ #private;
2270
+
2271
+ /**
2272
+ * Subscribe to block life-cycle events.
2273
+ * @param blocks - A list of blocks to filter events by. If the list is empty, events for every block are sent.
2274
+ * @param callback - The event callback. Events are bundled and sent at the end of each engine update.
2275
+ * @returns A method to unsubscribe.
2276
+ */
2277
+ subscribe(blocks: DesignBlockId[], callback: (events: BlockEvent[]) => void): () => void;
2278
+ }
2279
+
2280
+ /** @public */
2281
+ declare type ExportFormat = 'image/png' | 'video/mp4' | 'application/pdf';
2282
+
2283
+ /** @public */
2284
+ export declare interface ExportOptions extends Pick<EngineExportOptions, 'pngCompressionLevel' | 'jpegQuality' | 'exportPdfWithHighCompatibility'> {
2285
+ /** The mime type of the exported blob */
2286
+ mimeType: MimeType_2;
2287
+ /** The pages to export with the selected page as the default */
2288
+ pages?: number[];
2289
+ }
2290
+
2281
2291
  /** @public */
2282
- declare interface ExportOptions_3 {
2292
+ declare interface ExportOptions_2 {
2283
2293
  jpegQuality: number;
2284
2294
  pngCompressionLevel: number;
2285
2295
  useTargetSize: boolean;
2286
2296
  targetWidth: number;
2287
2297
  targetHeight: number;
2298
+ exportPdfWithHighCompatibility: boolean;
2288
2299
  }
2289
2300
 
2290
2301
  /** @public */
@@ -2480,6 +2491,7 @@ declare type PageFormatDefinition = Preset & {
2480
2491
  unit: DesignUnit;
2481
2492
  dpi?: number;
2482
2493
  bleedMargin?: number;
2494
+ fixedOrientation?: boolean;
2483
2495
  };
2484
2496
 
2485
2497
  /** @public */
@@ -2807,6 +2819,7 @@ export declare interface UserInterface {
2807
2819
 
2808
2820
  /** @public */
2809
2821
  declare interface UserInterfaceAssetLibrary extends UserInterfaceElement {
2822
+ position?: PanelPosition;
2810
2823
  }
2811
2824
 
2812
2825
  /** @public */
@@ -2831,6 +2844,7 @@ declare namespace UserInterfaceElements {
2831
2844
  UserInterfaceElement,
2832
2845
  UserInterfaceInspectorBlocks,
2833
2846
  UserInterfaceInspectorBlock,
2847
+ UserInterfaceInspectorBlockPage,
2834
2848
  UserInterfaceInspectorBlockText,
2835
2849
  UserInterfaceInspectorBlockImage,
2836
2850
  UserInterfaceInspector,
@@ -2912,12 +2926,19 @@ declare interface UserInterfaceInspectorBlockImage extends UserInterfaceInspecto
2912
2926
  blur?: UserInterfaceElement | boolean;
2913
2927
  }
2914
2928
 
2929
+ /** @public */
2930
+ declare interface UserInterfaceInspectorBlockPage extends UserInterfaceInspectorBlock {
2931
+ format?: UserInterfaceElement | boolean;
2932
+ manage?: UserInterfaceElement | boolean;
2933
+ }
2934
+
2915
2935
  /** @public */
2916
2936
  declare interface UserInterfaceInspectorBlocks {
2917
2937
  opacity?: UserInterfaceElement | boolean;
2918
2938
  transform?: UserInterfaceElement | boolean;
2919
2939
  '//ly.img.ubq/image'?: UserInterfaceInspectorBlockImage;
2920
2940
  '//ly.img.ubq/text'?: UserInterfaceInspectorBlockText;
2941
+ '//ly.img.ubq/page'?: UserInterfaceInspectorBlockPage;
2921
2942
  }
2922
2943
 
2923
2944
  /** @public */
package/index.html CHANGED
@@ -32,11 +32,7 @@
32
32
  },
33
33
  ui: {
34
34
  elements: {
35
- view: {
36
- adopter: {
37
- style: 'default'
38
- }
39
- },
35
+ view: 'default',
40
36
  panels: {
41
37
  settings: true
42
38
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cesdk/cesdk-js",
3
- "version": "1.7.0",
3
+ "version": "1.8.0-alpha.0",
4
4
  "main": "./cesdk.umd.js",
5
5
  "types": "./index.d.ts",
6
6
  "homepage": "https://www.img.ly",