@cesdk/cesdk-js 1.10.1 → 1.11.0-preview.1

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
@@ -554,17 +554,13 @@ export declare class BlockAPI {
554
554
  /**
555
555
  * Exports a design block as a video file of the given mime type.
556
556
  * Note: The export will run across multiple iterations of the update loop. In each iteration a frame is scheduled for encoding.
557
- * @param block - The design block to export.
558
- * @param timeOffset - The time offset in seconds of the scene's timeline from which the video will start.
559
- * @param duration - The duration in seconds of the final video.
557
+ * @param handle - The design block element to export. Currently, only the scene block is supported.
560
558
  * @param mimeType - The mime type of the output video file.
561
- * @param resolutionWidth - The target video width in pixel.
562
- * @param resolutionHeight - The target video height in pixel.
563
- * @param framerate - The target framerate in Hz.
564
559
  * @param progressCallback - A callback which reports on the progress of the export. It informs the receiver of the current frame index, which currently gets exported and the total frame count.
560
+ * @param options - The options for exporting the video
565
561
  * @returns A promise that resolves with video blob or is rejected with an error.
566
562
  */
567
- exportVideo(handle: DesignBlockId, timeOffset: number, duration: number, mimeType: MimeType_2 | undefined, resolutionWidth: number, resolutionHeight: number, framerate: number, progressCallback: (numberOfRenderedFrames: number, numberOfEncodedFrames: number, totalNumberOfFrames: number) => void): Promise<Blob>;
563
+ exportVideo(handle: DesignBlockId, mimeType: MimeType_2 | undefined, progressCallback: (numberOfRenderedFrames: number, numberOfEncodedFrames: number, totalNumberOfFrames: number) => void, options: VideoExportOptions): Promise<Blob>;
568
564
  /**
569
565
  * Loads existing blocks from the given string.
570
566
  * The blocks are not attached by default and won't be visible until attached to a page or the scene.
@@ -884,7 +880,7 @@ export declare class BlockAPI {
884
880
  /**
885
881
  * Set a block's mode for its width.
886
882
  * @param id - The block to update.
887
- * @param mode - The width mode: absolute, percent or auto.
883
+ * @param mode - The width mode: Absolute, Percent or Auto.
888
884
  */
889
885
  setWidthMode(id: DesignBlockId, mode: SizeMode): void;
890
886
  /**
@@ -896,7 +892,7 @@ export declare class BlockAPI {
896
892
  /**
897
893
  * Set a block's mode for its height.
898
894
  * @param id - The block to update.
899
- * @param mode - The height mode: absolute, percent or auto.
895
+ * @param mode - The height mode: Absolute, Percent or Auto.
900
896
  */
901
897
  setHeightMode(id: DesignBlockId, mode: SizeMode): void;
902
898
  /**
@@ -1023,6 +1019,24 @@ export declare class BlockAPI {
1023
1019
  * @returns The position and size of the bounding box.
1024
1020
  */
1025
1021
  getScreenSpaceBoundingBoxXYWH(ids: DesignBlockId[]): XYWH;
1022
+ /**
1023
+ * Align multiple blocks horizontally within their bounding box (or group) or a single block to its parent.
1024
+ * @param ids - A non-empty array of block ids.
1025
+ * @param alignment - How they should be aligned: left, right, or center
1026
+ */
1027
+ alignHorizontally(ids: DesignBlockId[], horizontalBlockAlignment: HorizontalBlockAlignment): void;
1028
+ /**
1029
+ * Align multiple blocks vertically within their bounding box (or group) or a single block to its parent.
1030
+ * @param ids - A non-empty array of block ids.
1031
+ * @param alignment - How they should be aligned: top, bottom, or center
1032
+ */
1033
+ alignVertically(ids: DesignBlockId[], verticalBlockAlignment: VerticalBlockAlignment): void;
1034
+ /**
1035
+ * Confirms that a given set of blocks can be aligned.
1036
+ * @param ids - A non-empty array of block ids.
1037
+ * @returns Whether the blocks can be aligned.
1038
+ */
1039
+ isAlignable(ids: DesignBlockId[]): boolean;
1026
1040
  /**
1027
1041
  * Scales the block and all of its children proportionally around the specified
1028
1042
  * relative anchor point.
@@ -1184,14 +1198,14 @@ export declare class BlockAPI {
1184
1198
  * @param property - The name of the property to set.
1185
1199
  * @param value - The enum value as string.
1186
1200
  */
1187
- setEnum(id: DesignBlockId, property: string, value: string): void;
1201
+ setEnum<T extends string = string>(id: DesignBlockId, property: string, value: T): void;
1188
1202
  /**
1189
1203
  * Get the value of an enum property of the given design block.
1190
1204
  * @param id - The block whose property should be queried.
1191
1205
  * @param property - The name of the property to query.
1192
1206
  * @returns The value as string.
1193
1207
  */
1194
- getEnum(id: DesignBlockId, property: string): string;
1208
+ getEnum<T extends string = string>(id: DesignBlockId, property: string): T;
1195
1209
  /**
1196
1210
  * Query if the given block has crop properties.
1197
1211
  * @param id - The block to query.
@@ -1723,6 +1737,69 @@ export declare class BlockAPI {
1723
1737
  * @returns The drop shadow's clipping.
1724
1738
  */
1725
1739
  getDropShadowClip(id: DesignBlockId): boolean;
1740
+ /**
1741
+ * Inserts the given text into the selected range of the text block.
1742
+ * @param block - The text block into which to insert the given text.
1743
+ * @param text - The text which should replace the selected range in the block.
1744
+ * @param from - The start index of the UTF-16 range that should be replaced.
1745
+ * If the value is negative, this will fall back to the start of the entire text range.
1746
+ * @param to - The UTF-16 index after the last grapheme that should be replaced by the inserted text.
1747
+ * If `from` and `to` are negative, a this will fall back to the end of the entire text range, so the entire text will be replaced.
1748
+ * If `to` is negative but `from` is greater than or equal to 0, the text will be inserted at the index defined by `from`.
1749
+ */
1750
+ replaceText(id: DesignBlockId, text: string, from?: number, to?: number): void;
1751
+ /**
1752
+ * Removes selected range of text of the given text block.
1753
+ * @param block - The text block from which the selected text should be removed.
1754
+ * @param from - The start index of the UTF-16 range that should be removed.
1755
+ * If the value is negative, this will fall back to the start of the entire text range.
1756
+ * @param to - The UTF-16 index after the last grapheme that should be removed.
1757
+ * If the value is negative, this will fall back to the end of the entire text range.
1758
+ */
1759
+ removeText(id: DesignBlockId, from?: number, to?: number): void;
1760
+ /**
1761
+ * Changes the color of the text in the selected range to the given color.
1762
+ * @param block - The text block whose color should be changed.
1763
+ * @param color - The new color of the selected text range.
1764
+ * @param from - The start index of the UTF-16 range whose color should be changed.
1765
+ * If the value is negative and the block is currently being edited, this will fall back to the start of the current cursor index / selected grapheme range.
1766
+ * If the value is negative and the block is not being edited, this will fall back to the start of the entire text range.
1767
+ * @param to - The UTF-16 index after the last grapheme whose color should be changed.
1768
+ * If the value is negative and the block is currently being edited, this will fall back to the end of the current cursor index / selected grapheme range.
1769
+ * If the value is negative and the block is not being edited, this will fall back to the end of the entire text range.
1770
+ */
1771
+ setTextColor(id: DesignBlockId, color: RGBAColor | SpotColor, from?: number, to?: number): void;
1772
+ /**
1773
+ * Returns the ordered unique list of colors of the text in the selected range.
1774
+ * @param block - The text block whose colors should be returned.
1775
+ * @param from - The start index of the UTF-16 range whose colors should be returned.
1776
+ * If the value is negative, this will fall back to the start of the entire text range.
1777
+ * @param to - The UTF-16 index after the last grapheme whose colors should be returned.
1778
+ * If the value is negative, this will fall back to the end of the entire text range.
1779
+ */
1780
+ getTextColors(id: DesignBlockId, from?: number, to?: number): Array<RGBAColor | SpotColor>;
1781
+ /**
1782
+ * Returns the ordered unique list of font weights of the text in the selected range.
1783
+ * @param block - The text block whose font weights should be returned.
1784
+ * @param from - The start index of the UTF-16 range whose font weights should be returned.
1785
+ * If the value is negative and the block is currently being edited, this will fall back to the start of the current cursor index / selected grapheme range.
1786
+ * If the value is negative and the block is not being edited, this will fall back to the start of the entire text range.
1787
+ * @param to - The UTF-16 index after the last grapheme whose font weights should be returned.
1788
+ * If the value is negative and the block is currently being edited, this will fall back to the end of the current cursor index / selected grapheme range.
1789
+ * If the value is negative and the block is not being edited, this will fall back to the end of the entire text range.
1790
+ */
1791
+ getTextFontWeights(id: DesignBlockId, from?: number, to?: number): FontWeight[];
1792
+ /**
1793
+ * Returns the ordered unique list of font styles of the text in the selected range.
1794
+ * @param block - The text block whose font styles should be returned.
1795
+ * @param from - The start index of the UTF-16 range whose font weights should be returned.
1796
+ * If the value is negative and the block is currently being edited, this will fall back to the start of the current cursor index / selected grapheme range.
1797
+ * If the value is negative and the block is not being edited, this will fall back to the start of the entire text range.
1798
+ * @param to - The UTF-16 index after the last grapheme whose font styles should be returned.
1799
+ * If the value is negative and the block is currently being edited, this will fall back to the end of the current cursor index / selected grapheme range.
1800
+ * If the value is negative and the block is not being edited, this will fall back to the end of the entire text range.
1801
+ */
1802
+ getTextFontStyles(id: DesignBlockId, from?: number, to?: number): FontStyle[];
1726
1803
  /**
1727
1804
  * Query if the given block has fill color properties.
1728
1805
  * @param id - The block to query.
@@ -2274,16 +2351,16 @@ export declare interface CMYKColor {
2274
2351
  * The RGB and CMYK components must all be specified in the range [0-1].
2275
2352
  * @public
2276
2353
  */
2277
- declare type Color = HexColorString | RGBColor | RGBAColor | SpotColor;
2354
+ declare type Color_2 = HexColorString | RGBColor | RGBAColor | SpotColor;
2278
2355
 
2279
2356
  /** @public */
2280
2357
  declare type ColorDefinition = Preset & {
2281
- value: Color;
2358
+ value: Color_2;
2282
2359
  };
2283
2360
 
2284
2361
  /** @public */
2285
2362
  declare type ColorPaletteDefinition = Preset & {
2286
- entries: Color[];
2363
+ entries: Color_2[];
2287
2364
  };
2288
2365
 
2289
2366
  declare namespace ConfigTypes {
@@ -2313,7 +2390,18 @@ export { ConfigTypes }
2313
2390
  * optional and what mandatory. This is Configuration, but `ui` is recursively
2314
2391
  * optional, and all other props are non-recursively optional
2315
2392
  */
2316
- export declare type Configuration = Partial<_RequiredConfiguration>;
2393
+ export declare type Configuration = Partial<_RequiredConfiguration> & OldConfiguration;
2394
+
2395
+ /**
2396
+ * A public interface for controlling several configuration options of the
2397
+ * Creative Editor SDK
2398
+ *
2399
+ * @public
2400
+ */
2401
+ export declare class ConfigurationAPI {
2402
+ #private;
2403
+ setRole(role: RoleString): void;
2404
+ }
2317
2405
 
2318
2406
  /**
2319
2407
  * - Crop: Manual crop.
@@ -2338,7 +2426,7 @@ declare class CreativeEditorSDK {
2338
2426
  /**
2339
2427
  * Convenience function that registers a set of asset sources containing our
2340
2428
  * example assets. These are
2341
- * - `'ly.img.image'` - Sample images
2429
+ *
2342
2430
  * - `'ly.img.sticker'` - Various stickers
2343
2431
  * - `'ly.img.vectorpath'` - Shapes and arrows
2344
2432
  * - `'ly.img.filter.lut'` - LUT effects of various kinds.
@@ -2357,22 +2445,20 @@ declare class CreativeEditorSDK {
2357
2445
  excludeAssetSourceIds?: DefaultAssetSourceId[];
2358
2446
  }): Promise<void>;
2359
2447
  /**
2360
- * Convenience function that registers a set of asset sources containing our
2361
- * example assets. These are
2362
- * - `'ly.img.image'` - Sample images
2363
- * - `'ly.img.sticker'` - Various stickers
2364
- * - `'ly.img.vectorpath'` - Shapes and arrows
2365
- * - `'ly.img.filter.lut'` - LUT effects of various kinds.
2366
- * - `'ly.img.filter.duotone'` - LUT effects of various kinds.
2448
+ * Convenience function that registers a set of demo asset sources containing our
2449
+ * example assets. These are not to meant to be used in your production code.
2367
2450
  *
2368
- * These assets are parsed from the IMG.LY CDN at \{\{base_url\}\}/<id>/content.json, where
2369
- * `base_url` defaults to 'https://cdn.img.ly/assets/v1'.
2370
- * Each source is created via `addLocalSource` and populated with the parsed assets. To modify the available
2371
- * assets, you may either exclude certain IDs via `excludeAssetSourceIds` or alter the sources after creation.
2451
+ * These are
2452
+ *
2453
+ * - `'ly.img.image'` - Sample images
2454
+ * - `'ly.img.image.upload'` - Demo source to upload image assets
2455
+ * - `'ly.img.audio'` - Sample audios
2456
+ * - `'ly.img.audio.upload'` - Demo source to upload audio assets
2457
+ * - `'ly.img.video'` - Sample videos
2458
+ * - `'ly.img.video.upload'` - Demo source to upload video assets
2372
2459
  *
2373
- * @param baseURL - The source of the asset definitions, must be absolute. Defaults to `'https://cdn.img.ly/assets/v1'`.
2374
2460
  * @param excludeAssetSourceIds - A list of IDs, that will be ignored during load.
2375
- * @param sceneMode - if 'Video' video specific demo asset sources will be loaded as well.
2461
+ * @param sceneMode - if 'Video' video specific demo asset sources will be loaded as well. Parsed from global configuration if not set.
2376
2462
  */
2377
2463
  addDemoAssetSources({ excludeAssetSourceIds, sceneMode }?: {
2378
2464
  baseURL?: string;
@@ -2454,6 +2540,23 @@ declare class CreativeEditorSDK {
2454
2540
  unstable_getActivePage(): Promise<number>;
2455
2541
  unstable_onActivePageChanged(callback: (id: number) => void): () => void;
2456
2542
  unstable_focusPage(pageId: number): Promise<void>;
2543
+ /**
2544
+ * Trigger a refetch of the asset source and update the asset library panel with the new items accordingly.
2545
+ *
2546
+ * @param sourceId - The ID or IDs of the asset sources to refetch. If not provided, all asset sources will be refetched.
2547
+ *
2548
+ * @example
2549
+ * // Refetch audio upload asset source
2550
+ * cesdk.refetchAssetSources('ly.img.audio.upload');
2551
+ *
2552
+ * // Refetch video and image upload asset source
2553
+ * cesdk.refetchAssetSources(['ly.img.video.upload', 'ly.img.image.upload']);
2554
+ *
2555
+ * // Refetch all asset sources
2556
+ * cesdk.refetchAssetSources();
2557
+ *
2558
+ */
2559
+ refetchAssetSources(sourceId?: string | string[]): void;
2457
2560
  /**
2458
2561
  * Disposes the editor and engine if no longer needed.
2459
2562
  */
@@ -2495,7 +2598,7 @@ export declare class CreativeEngine {
2495
2598
  * @param config - An optional configuration object.
2496
2599
  * @returns An engine instance.
2497
2600
  */
2498
- static init<C extends Partial<_EngineConfiguration>>(config?: C): Promise<CreativeEngine & (C extends {
2601
+ static init<C extends Partial<_EngineConfiguration> & _OldEngineConfiguration>(config?: C): Promise<CreativeEngine & (C extends {
2499
2602
  readonly canvas: any;
2500
2603
  } ? {
2501
2604
  readonly element: undefined;
@@ -2533,7 +2636,7 @@ export declare class CreativeEngine {
2533
2636
  * - `'ly.img.image.upload'` - Demo source to upload image assets
2534
2637
  * - `'ly.img.audio'` - Sample audios
2535
2638
  * - `'ly.img.audio.upload'` - Demo source to upload audio assets
2536
- * - `'ly.img.video'` - Sample audios
2639
+ * - `'ly.img.video'` - Sample videos
2537
2640
  * - `'ly.img.video.upload'` - Demo source to upload video assets
2538
2641
  *
2539
2642
  * @param excludeAssetSourceIds - A list of IDs, that will be ignored during load.
@@ -2599,8 +2702,11 @@ export declare enum DesignBlockType {
2599
2702
  Group = "//ly.img.ubq/group"
2600
2703
  }
2601
2704
 
2602
- /** @public */
2603
- export declare type DesignUnit = 'mm' | 'px' | 'in';
2705
+ /**
2706
+ * The scene layout determines how the layout stack should layout its pages.
2707
+ * @public
2708
+ */
2709
+ export declare type DesignUnit = 'Pixel' | 'Millimeter' | 'Inch';
2604
2710
 
2605
2711
  /** @public */
2606
2712
  declare interface DockGroup {
@@ -2620,7 +2726,7 @@ export declare class EditorAPI {
2620
2726
  * @param callback - This function is called at the end of the engine update, if the editor state has changed.
2621
2727
  * @returns A method to unsubscribe.
2622
2728
  */
2623
- onStateChanged(callback: () => void): () => void;
2729
+ onStateChanged: (callback: () => void) => (() => void);
2624
2730
  /**
2625
2731
  * Set the edit mode of the editor.
2626
2732
  * An edit mode defines what type of content can currently be edited by the user.
@@ -2706,13 +2812,13 @@ export declare class EditorAPI {
2706
2812
  * @param callback - This function is called at the end of the engine update, if the undo/redo history has been changed.
2707
2813
  * @returns A method to unsubscribe
2708
2814
  */
2709
- onHistoryUpdated(callback: () => void): () => void;
2815
+ onHistoryUpdated: (callback: () => void) => (() => void);
2710
2816
  /**
2711
2817
  * Subscribe to changes to the editor settings.
2712
2818
  * @param callback - This function is called at the end of the engine update, if the editor settings have changed.
2713
2819
  * @returns A method to unsubscribe.
2714
2820
  */
2715
- onSettingsChanged(callback: () => void): () => void;
2821
+ onSettingsChanged: (callback: () => void) => (() => void);
2716
2822
  /**
2717
2823
  * Set a boolean setting.
2718
2824
  * @param keypath - The settings keypath, e.g. `doubleClickToCropEnabled`
@@ -2871,7 +2977,7 @@ export declare class EditorAPI {
2871
2977
  declare namespace _EngineConfigTypes {
2872
2978
  export {
2873
2979
  HexColorString,
2874
- Color,
2980
+ Color_2 as Color,
2875
2981
  AssetSources,
2876
2982
  AssetSource_2 as AssetSource,
2877
2983
  AssetResult_2 as AssetResult,
@@ -2899,15 +3005,14 @@ export { _EngineConfigTypes }
2899
3005
  export declare interface _EngineConfiguration {
2900
3006
  baseURL: string;
2901
3007
  license?: string;
2902
- role: RoleString;
2903
- featureFlags?: Record<string, string | boolean>;
3008
+ featureFlags?: {
3009
+ [flag: string]: boolean | string;
3010
+ };
2904
3011
  /**
2905
3012
  * @deprecated Extensions have been superseded by AssetSources and should no longer be used.
2906
3013
  */
2907
3014
  extensions: _EngineConfigTypes.Extensions;
2908
3015
  core: _EngineConfigTypes.Core;
2909
- scene: _EngineConfigTypes.Scene;
2910
- page: _EngineConfigTypes.Page;
2911
3016
  assetSources: _EngineConfigTypes.AssetSources;
2912
3017
  presets: _EngineConfigTypes.Presets;
2913
3018
  variables: _EngineConfigTypes.Variables;
@@ -2991,7 +3096,7 @@ export declare class EventAPI {
2991
3096
  * @param callback - The event callback. Events are bundled and sent at the end of each engine update.
2992
3097
  * @returns A method to unsubscribe.
2993
3098
  */
2994
- subscribe(blocks: DesignBlockId[], callback: (events: BlockEvent[]) => void): () => void;
3099
+ subscribe: (blocks: DesignBlockId[], callback: (events: BlockEvent[]) => void) => (() => void);
2995
3100
  }
2996
3101
 
2997
3102
  /** @public */
@@ -3034,7 +3139,7 @@ declare type Extensions = {
3034
3139
  /**
3035
3140
  * @public
3036
3141
  */
3037
- export declare type FillType = 'Solid' | 'Gradient' | 'Video';
3142
+ export declare type FillType = 'Solid' | 'Gradient' | 'Video' | 'Image';
3038
3143
 
3039
3144
  /** @public */
3040
3145
  declare interface FindAssetsQuery {
@@ -3119,6 +3224,15 @@ declare type HexColorString = string;
3119
3224
  */
3120
3225
  export declare type HistoryId = number;
3121
3226
 
3227
+ /**
3228
+ * - Left: The blocks get left aligned.
3229
+ * - Right: The blocks get right aligned.
3230
+ * - Center: The blocks get center aligned.
3231
+ *
3232
+ * @public
3233
+ */
3234
+ export declare type HorizontalBlockAlignment = 'Left' | 'Right' | 'Center';
3235
+
3122
3236
  /**
3123
3237
  * A wrapper around a plain canvas
3124
3238
  *
@@ -3187,6 +3301,44 @@ declare enum NavigationPosition {
3187
3301
  Bottom = "bottom"
3188
3302
  }
3189
3303
 
3304
+ /**
3305
+ * Contains configuration keys that have been removed from the actual
3306
+ * configuration, but are still supported publicly
3307
+ * @public
3308
+ */
3309
+ export declare interface OldConfiguration extends _OldEngineConfiguration {
3310
+ }
3311
+
3312
+ /**
3313
+ * Contains configuration keys that have been removed from the actual
3314
+ * configuration, but are still supported publicly
3315
+ * @public
3316
+ */
3317
+ export declare interface _OldEngineConfiguration {
3318
+ /**
3319
+ * @deprecated This config key has been removed.
3320
+ * You can configure a role via `setSettingEnum('role', role)` in the
3321
+ * EditorAPI.
3322
+ */
3323
+ role?: RoleString;
3324
+ /**
3325
+ * @deprecated This config key has been removed completely.
3326
+ * The settings that were configured here can be set via the
3327
+ * following EditorAPI settings:
3328
+ * - `setSettingBool('page/title/show', show)`
3329
+ * - `setSettingString('page/title/fontFileUri', uri)`
3330
+ * - `setSettingBool('page/title/dimOutOfPageAreas', dim)`
3331
+ */
3332
+ page?: Page;
3333
+ /**
3334
+ * @deprecated This type definition has been removed
3335
+ * The settings that were configured here can be set via the
3336
+ * BlockApi on the scene block
3337
+ * @public
3338
+ */
3339
+ scene?: Scene;
3340
+ }
3341
+
3190
3342
  /** @public */
3191
3343
  declare type OnUploadCallback = (file: File, onProgress: (progress: number) => void) => Promise<AssetDefinition>;
3192
3344
 
@@ -3201,7 +3353,15 @@ declare type OnUploadOptions = {
3201
3353
  */
3202
3354
  export declare type Optional<T, K extends keyof T> = Omit<T, K> & Partial<T>;
3203
3355
 
3204
- /** @public */
3356
+ /**
3357
+ * @deprecated This type definition has been removed
3358
+ * The settings that were configured here can be set via the
3359
+ * following EditorAPI settings:
3360
+ * - `setSettingBool('page/title/show', show)`
3361
+ * - `setSettingString('page/title/fontFileUri', uri)`
3362
+ * - `setSettingBool('page/title/dimOutOfPageAreas', dim)`
3363
+ * @public
3364
+ */
3205
3365
  declare type Page = {
3206
3366
  title: {
3207
3367
  /**
@@ -3224,7 +3384,7 @@ declare type Page = {
3224
3384
  declare type PageFormatDefinition = Preset & {
3225
3385
  width: number;
3226
3386
  height: number;
3227
- unit: DesignUnit;
3387
+ unit: 'px' | 'mm' | 'in';
3228
3388
  fixedOrientation?: boolean;
3229
3389
  };
3230
3390
 
@@ -3375,23 +3535,26 @@ export declare type RoleString = 'Creator' | 'Adopter' | 'Viewer' | 'Presenter';
3375
3535
  declare type Scale = 'normal' | 'large';
3376
3536
 
3377
3537
  /**
3378
- * Export Settings
3538
+ * @deprecated This type definition is not used anymore and will be removed
3539
+ * in the future. The settings that were configured here can be set via the
3540
+ * BlockApi on the scene block:
3541
+ *
3542
+ * ```ts
3543
+ * engine.block.setInt(sceneId, 'scene/dpi', dpi);
3544
+ * engine.block.setInt(sceneId, 'scene/pixelScaleFactor', factor);
3545
+ * ```
3546
+ *
3379
3547
  * @public
3380
3548
  */
3381
3549
  declare type Scene = {
3382
3550
  /**
3383
- * The DPI value to use when exporting and when converting between pixels and inches or millimeter units.
3384
- * (In the CESDK, this value is synonymous with PPI).
3385
- *
3386
- * This is only relevant for new scenes that are created in the editor. Loaded scenes will use the
3387
- * value stored in their serialization file.
3551
+ * @deprecated Setting this value has no effect. You can change the dpi of the
3552
+ * current scene via `engine.block.setInt(sceneId, 'scene/dpi', dpi)`
3388
3553
  */
3389
3554
  dpi: number;
3390
3555
  /**
3391
- * A scale factor that is applied to the final export resolution.
3392
- *
3393
- * This is only relevant for new scenes that are created in the editor. Loaded scenes will use the
3394
- * value stored in their serialization file.
3556
+ * @deprecated Setting this value has no effect. You can change the dpi of the
3557
+ * current scene via `engine.block.setInt(sceneId, 'scene/pixelScaleFactor', * factor)`
3395
3558
  */
3396
3559
  pixelScaleFactor: number;
3397
3560
  };
@@ -3445,11 +3608,19 @@ export declare class SceneAPI {
3445
3608
  * Fetching the image may take an arbitrary amount of time, so the scene isn't immediately
3446
3609
  * available.
3447
3610
  * @param url - The image URL.
3448
- * @param dpi - The scenes DPI.
3449
- * @param pixelScaleFactor - The displays pixel scale factor.
3611
+ * @param dpi - The scene's DPI.
3612
+ * @param pixelScaleFactor - The display's pixel scale factor.
3450
3613
  * @returns A promise that resolves with the scene ID on success or rejected with an error otherwise.
3451
3614
  */
3452
3615
  createFromImage(url: string, dpi?: number, pixelScaleFactor?: number, sceneLayout?: SceneLayout, spacing?: number, spacingInScreenSpace?: boolean): Promise<DesignBlockId>;
3616
+ /**
3617
+ * Loads the given video and creates a scene with a single page showing the video.
3618
+ * Fetching the video may take an arbitrary amount of time, so the scene isn't immediately
3619
+ * available.
3620
+ * @param url - The video URL.
3621
+ * @returns A promise that resolves with the scene ID on success or rejected with an error otherwise.
3622
+ */
3623
+ createFromVideo(url: string): Promise<DesignBlockId>;
3453
3624
  /**
3454
3625
  * Return the currently active scene.
3455
3626
  * @returns The scene or null, if none was created yet.
@@ -3478,6 +3649,16 @@ export declare class SceneAPI {
3478
3649
  * @returns The current mode of the scene.
3479
3650
  */
3480
3651
  getMode(): SceneMode;
3652
+ /**
3653
+ * Converts all values of the current scene into the given design unit.
3654
+ * @param designUnit - The new design unit of the scene
3655
+ */
3656
+ setDesignUnit(designUnit: DesignUnit): void;
3657
+ /**
3658
+ * Returns the design unit of the current scene.
3659
+ * @returns The current design unit.
3660
+ */
3661
+ getDesignUnit(): DesignUnit;
3481
3662
  /**
3482
3663
  * Get the sorted list of pages in the scene.
3483
3664
  * @returns The sorted list of pages in the scene.
@@ -3555,23 +3736,13 @@ export declare class SceneAPI {
3555
3736
  * @returns A method to unsubscribe.
3556
3737
  * @privateRemarks This will currently fire on _all_ changes to camera properties
3557
3738
  */
3558
- onZoomLevelChanged(callback: () => void): () => void;
3739
+ onZoomLevelChanged: (callback: () => void) => (() => void);
3559
3740
  /**
3560
3741
  * Subscribe to changes to the active scene rendered by the engine.
3561
3742
  * @param callback - This function is called at the end of the engine update, if the active scene has changed.
3562
3743
  * @returns A method to unsubscribe.
3563
3744
  */
3564
- onActiveChanged(callback: () => void): () => void;
3565
- /**
3566
- * Converts all values of the current scene into the given design unit.
3567
- * @param designUnit - The new design unit of the scene
3568
- */
3569
- unstable_setDesignUnit(designUnit: DesignUnit): void;
3570
- /**
3571
- * Returns the design unit of the current scene.
3572
- * @returns The current design unit.
3573
- */
3574
- unstable_getDesignUnit(): DesignUnit;
3745
+ onActiveChanged: (callback: () => void) => (() => void);
3575
3746
  }
3576
3747
 
3577
3748
  /**
@@ -3628,8 +3799,10 @@ declare type Source<T> = (handler: Handler<T>) => UnsubscribeFn;
3628
3799
  /** @public */
3629
3800
  export declare interface SpotColor {
3630
3801
  name: string;
3631
- rgbApproximation: RGBAColor;
3632
- cmykApproximation: CMYKColor;
3802
+ }
3803
+
3804
+ declare interface SpotColorLookup {
3805
+ getSpotColorRGBA(name: string): [r: number, g: number, b: number, a: number];
3633
3806
  }
3634
3807
 
3635
3808
  /** @public */
@@ -3940,12 +4113,64 @@ declare interface Vec2 {
3940
4113
  y: number;
3941
4114
  }
3942
4115
 
3943
- /** @public */
3944
- declare interface Vec3 {
3945
- x: number;
3946
- y: number;
3947
- z: number;
3948
- }
4116
+ /**
4117
+ * - Top: The blocks get top aligned.
4118
+ * - Bottom: The blocks get bottom aligned.
4119
+ * - Center: The blocks get center aligned.
4120
+ *
4121
+ * @public
4122
+ */
4123
+ export declare type VerticalBlockAlignment = 'Top' | 'Bottom' | 'Center';
4124
+
4125
+ /**
4126
+ * @public
4127
+ */
4128
+ declare type VideoExportOptions = {
4129
+ /**
4130
+ * Determines the encoder feature set and in turn the quality, size and speed of the encoding process.
4131
+ *
4132
+ * @defaultValue 77 (Main)
4133
+ */
4134
+ h264Profile?: number;
4135
+ /**
4136
+ * Controls the H.264 encoding level. This relates to parameters used by the encoder such as bit rate,
4137
+ * timings and motion vectors. Defined by the spec are levels 1.0 up to 6.2. To arrive at an integer value,
4138
+ * the level is multiplied by ten. E.g. to get level 5.2, pass a value of 52.
4139
+ *
4140
+ * @defaultValue 52
4141
+ */
4142
+ h264Level?: number;
4143
+ /**
4144
+ * The time offset in seconds of the scene's timeline from which the video will start.
4145
+ *
4146
+ * @defaultValue 0
4147
+ */
4148
+ timeOffset?: number;
4149
+ /**
4150
+ * The duration in seconds of the final video.
4151
+ *
4152
+ * @defaultValue The duration of the scene.
4153
+ */
4154
+ duration?: number;
4155
+ /**
4156
+ * The target framerate of the exported video in Hz.
4157
+ *
4158
+ * @defaultValue 30
4159
+ */
4160
+ framerate?: number;
4161
+ /**
4162
+ * An optional target width used in conjunction with target height.
4163
+ * If used, the block will be rendered large enough, that it fills the target
4164
+ * size entirely while maintaining its aspect ratio.
4165
+ */
4166
+ targetWidth?: number;
4167
+ /**
4168
+ * An optional target height used in conjunction with target width.
4169
+ * If used, the block will be rendered large enough, that it fills the target
4170
+ * size entirely while maintaining its aspect ratio.
4171
+ */
4172
+ targetHeight?: number;
4173
+ };
3949
4174
 
3950
4175
  /** @public */
3951
4176
  declare enum ViewStyle {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cesdk/cesdk-js",
3
- "version": "1.10.1",
3
+ "version": "1.11.0-preview.1",
4
4
  "main": "./cesdk.umd.js",
5
5
  "types": "./index.d.ts",
6
6
  "homepage": "https://www.img.ly",