@cesdk/node 1.11.0-preview.0 → 1.11.0-preview.2

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/example.js CHANGED
@@ -5,7 +5,8 @@ const CreativeEngine = require('./index.js');
5
5
 
6
6
  const { DesignBlockType, MimeType } = CreativeEngine;
7
7
 
8
- CreativeEngine.init().then((engine) => {
8
+ CreativeEngine.init().then(async (engine) => {
9
+ await engine.addDefaultAssetSources();
9
10
  console.log('Loading scene');
10
11
  engine.scene
11
12
  .loadFromURL(`file://${__dirname}/demo.scene`)
package/index.d.ts CHANGED
@@ -901,6 +901,24 @@ export declare class BlockAPI {
901
901
  * @returns The position and size of the bounding box.
902
902
  */
903
903
  getScreenSpaceBoundingBoxXYWH(ids: DesignBlockId[]): XYWH;
904
+ /**
905
+ * Align multiple blocks horizontally within their bounding box (or group) or a single block to its parent.
906
+ * @param ids - A non-empty array of block ids.
907
+ * @param alignment - How they should be aligned: left, right, or center
908
+ */
909
+ alignHorizontally(ids: DesignBlockId[], horizontalBlockAlignment: HorizontalBlockAlignment): void;
910
+ /**
911
+ * Align multiple blocks vertically within their bounding box (or group) or a single block to its parent.
912
+ * @param ids - A non-empty array of block ids.
913
+ * @param alignment - How they should be aligned: top, bottom, or center
914
+ */
915
+ alignVertically(ids: DesignBlockId[], verticalBlockAlignment: VerticalBlockAlignment): void;
916
+ /**
917
+ * Confirms that a given set of blocks can be aligned.
918
+ * @param ids - A non-empty array of block ids.
919
+ * @returns Whether the blocks can be aligned.
920
+ */
921
+ isAlignable(ids: DesignBlockId[]): boolean;
904
922
  /**
905
923
  * Scales the block and all of its children proportionally around the specified
906
924
  * relative anchor point.
@@ -2216,7 +2234,6 @@ export declare interface Configuration {
2216
2234
  */
2217
2235
  extensions: ConfigTypes.Extensions;
2218
2236
  core: ConfigTypes.Core;
2219
- scene: ConfigTypes.Scene;
2220
2237
  assetSources: ConfigTypes.AssetSources;
2221
2238
  presets: ConfigTypes.Presets;
2222
2239
  variables: ConfigTypes.Variables;
@@ -2289,9 +2306,60 @@ declare class CreativeEngine {
2289
2306
  * @returns An engine instance.
2290
2307
  */
2291
2308
  static init(config?: Partial<Configuration> & OldConfiguration): Promise<CreativeEngine>;
2309
+ /**
2310
+ * Convenience function that registers a set of asset sources containing our
2311
+ * default assets. These are
2312
+ *
2313
+ * - `'ly.img.sticker'` - Various stickers
2314
+ * - `'ly.img.vectorpath'` - Shapes and arrows
2315
+ * - `'ly.img.filter.lut'` - LUT effects of various kinds.
2316
+ * - `'ly.img.filter.duotone'` - LUT effects of various kinds.
2317
+ *
2318
+ * These assets are parsed from the IMG.LY CDN at \{\{base_url\}\}/<id>/content.json, where
2319
+ * `base_url` defaults to 'https://cdn.img.ly/assets/v1'.
2320
+ * Each source is created via `addLocalSource` and populated with the parsed assets. To modify the available
2321
+ * assets, you may either exclude certain IDs via `excludeAssetSourceIds` or alter the sources after creation.
2322
+ */
2323
+ addDefaultAssetSources({ baseURL, excludeAssetSourceIds }?: {
2324
+ /** The source of the asset definitions, must be absolute. Defaults to `'https://cdn.img.ly/assets/v1'`. */
2325
+ baseURL?: string;
2326
+ /** A list of IDs, that will be ignored during load. */
2327
+ excludeAssetSourceIds?: DefaultAssetSourceId[];
2328
+ }): Promise<void>;
2329
+ /**
2330
+ * Convenience function that registers a set of demo asset sources containing our
2331
+ * example assets. These are not to meant to be used in your production code.
2332
+ *
2333
+ * These are
2334
+ *
2335
+ * - `'ly.img.image'` - Sample images
2336
+ * - `'ly.img.image.upload'` - Demo source to upload image assets
2337
+ * - `'ly.img.audio'` - Sample audios
2338
+ * - `'ly.img.audio.upload'` - Demo source to upload audio assets
2339
+ * - `'ly.img.video'` - Sample videos
2340
+ * - `'ly.img.video.upload'` - Demo source to upload video assets
2341
+ */
2342
+ addDemoAssetSources({ excludeAssetSourceIds, sceneMode, withUploadAssetSources }?: {
2343
+ /** A list of IDs, that will be ignored during load */
2344
+ excludeAssetSourceIds?: DemoAssetSourceId[];
2345
+ /** If 'Video' video specific demo asset sources will be loaded as well (default 'Design') */
2346
+ sceneMode?: SceneMode;
2347
+ /** If 'true' asset sources for uploads are added (default false) */
2348
+ withUploadAssetSources?: boolean;
2349
+ }): Promise<void>;
2292
2350
  }
2293
2351
  export default CreativeEngine;
2294
2352
 
2353
+ /**
2354
+ * @public
2355
+ */
2356
+ export declare type DefaultAssetSourceId = 'ly.img.sticker' | 'ly.img.vectorpath' | 'ly.img.filter.lut' | 'ly.img.filter.duotone';
2357
+
2358
+ /**
2359
+ * @public
2360
+ */
2361
+ export declare type DemoAssetSourceId = 'ly.img.image.upload' | 'ly.img.video.upload' | 'ly.img.audio.upload' | 'ly.img.image' | 'ly.img.video' | 'ly.img.audio';
2362
+
2295
2363
  /**
2296
2364
  * A numerical identifier for a design block
2297
2365
  * @public
@@ -2672,7 +2740,7 @@ declare type Extensions = {
2672
2740
  /**
2673
2741
  * @public
2674
2742
  */
2675
- export declare type FillType = 'Solid' | 'Gradient' | 'Video';
2743
+ export declare type FillType = 'Solid' | 'Gradient' | 'Video' | 'Image';
2676
2744
 
2677
2745
  /** @public */
2678
2746
  declare interface FindAssetsQuery {
@@ -2742,6 +2810,15 @@ declare type HexColorString = string;
2742
2810
  */
2743
2811
  export declare type HistoryId = number;
2744
2812
 
2813
+ /**
2814
+ * - Left: The blocks get left aligned.
2815
+ * - Right: The blocks get right aligned.
2816
+ * - Center: The blocks get center aligned.
2817
+ *
2818
+ * @public
2819
+ */
2820
+ export declare type HorizontalBlockAlignment = 'Left' | 'Right' | 'Center';
2821
+
2745
2822
  /**
2746
2823
  * e.g. `en`, `de`, etc.
2747
2824
  * @public
@@ -2764,6 +2841,7 @@ declare enum MimeType_2 {
2764
2841
  Jpeg = "image/jpeg",
2765
2842
  Tga = "image/x-tga",
2766
2843
  Mp4 = "video/mp4",
2844
+ QuickTime = "video/quicktime",
2767
2845
  Binary = "application/octet-stream",
2768
2846
  Pdf = "application/pdf",
2769
2847
  Zip = "application/zip"
@@ -2791,6 +2869,13 @@ export declare interface OldConfiguration {
2791
2869
  * - `setSettingBool('page/title/dimOutOfPageAreas', dim)`
2792
2870
  */
2793
2871
  page?: Page;
2872
+ /**
2873
+ * @deprecated This type definition has been removed
2874
+ * The settings that were configured here can be set via the
2875
+ * BlockApi on the scene block
2876
+ * @public
2877
+ */
2878
+ scene?: Scene;
2794
2879
  }
2795
2880
 
2796
2881
  /**
@@ -2921,23 +3006,26 @@ export declare interface RGBColor {
2921
3006
  export declare type RoleString = 'Creator' | 'Adopter' | 'Viewer' | 'Presenter';
2922
3007
 
2923
3008
  /**
2924
- * Export Settings
3009
+ * @deprecated This type definition is not used anymore and will be removed
3010
+ * in the future. The settings that were configured here can be set via the
3011
+ * BlockApi on the scene block:
3012
+ *
3013
+ * ```ts
3014
+ * engine.block.setInt(sceneId, 'scene/dpi', dpi);
3015
+ * engine.block.setInt(sceneId, 'scene/pixelScaleFactor', factor);
3016
+ * ```
3017
+ *
2925
3018
  * @public
2926
3019
  */
2927
3020
  declare type Scene = {
2928
3021
  /**
2929
- * The DPI value to use when exporting and when converting between pixels and inches or millimeter units.
2930
- * (In the CESDK, this value is synonymous with PPI).
2931
- *
2932
- * This is only relevant for new scenes that are created in the editor. Loaded scenes will use the
2933
- * value stored in their serialization file.
3022
+ * @deprecated Setting this value has no effect. You can change the dpi of the
3023
+ * current scene via `engine.block.setInt(sceneId, 'scene/dpi', dpi)`
2934
3024
  */
2935
3025
  dpi: number;
2936
3026
  /**
2937
- * A scale factor that is applied to the final export resolution.
2938
- *
2939
- * This is only relevant for new scenes that are created in the editor. Loaded scenes will use the
2940
- * value stored in their serialization file.
3027
+ * @deprecated Setting this value has no effect. You can change the dpi of the
3028
+ * current scene via `engine.block.setInt(sceneId, 'scene/pixelScaleFactor', * factor)`
2941
3029
  */
2942
3030
  pixelScaleFactor: number;
2943
3031
  };
@@ -3273,6 +3361,15 @@ export declare interface Vec4 {
3273
3361
  w: number;
3274
3362
  }
3275
3363
 
3364
+ /**
3365
+ * - Top: The blocks get top aligned.
3366
+ * - Bottom: The blocks get bottom aligned.
3367
+ * - Center: The blocks get center aligned.
3368
+ *
3369
+ * @public
3370
+ */
3371
+ export declare type VerticalBlockAlignment = 'Top' | 'Bottom' | 'Center';
3372
+
3276
3373
  /**
3277
3374
  * @public
3278
3375
  */