@cesdk/cesdk-js 1.16.1 → 1.17.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
@@ -206,7 +206,7 @@ declare type AssetLibraryEntries = AssetLibraryEntry[] | ((currentAssetLibraryEn
206
206
  selectedBlocks: {
207
207
  id: DesignBlockId;
208
208
  blockType: DesignBlockType;
209
- fillType?: FillType;
209
+ fillType?: DesignBlockType;
210
210
  }[];
211
211
  }) => AssetLibraryEntry[]);
212
212
 
@@ -2032,21 +2032,6 @@ export declare class BlockAPI {
2032
2032
  * @param fill - The new fill.
2033
2033
  */
2034
2034
  setFill(id: DesignBlockId, fill: DesignBlockId): void;
2035
- /**
2036
- * Set the fill type of the given design block.
2037
- * @param id - The block whose fill type should be set.
2038
- * @param type - The fill type to set.
2039
- * @returns An empty result on success, an error otherwise.
2040
- * @deprecated Use `createFill`, e.g., with type 'color' and then apply the fill block with `setFill` to the block instead. If the block has a fill, it should be removed with `getFill` and `destroy`.
2041
- */
2042
- setFillType(id: DesignBlockId, fillType: FillType): void;
2043
- /**
2044
- * Get the fill type of the given design block.
2045
- * @param id - The block whose fill type should be queried.
2046
- * @returns The block's fill type or an error.
2047
- * @deprecated Use `getEnum(id, 'fill/type')` instead.
2048
- */
2049
- getFillType(id: DesignBlockId): FillType;
2050
2035
  /**
2051
2036
  * Set the fill color of the given design block.
2052
2037
  * @param id - The block whose fill color should be set.
@@ -2063,100 +2048,6 @@ export declare class BlockAPI {
2063
2048
  * @returns A result holding the fill color or an error.
2064
2049
  */
2065
2050
  getFillSolidColor(id: DesignBlockId): RGBA;
2066
- /**
2067
- * Set the gradient type of the given design block.
2068
- * @param id - The block whose gradient type should be set.
2069
- * @param type - The gradient type.
2070
- * @returns An empty result on success, an error otherwise.
2071
- * @deprecated Use `createFill`, e.g., with '//ly.img.ubq/fill/gradient/linear' and then apply the fill block with `setFill` to the block instead. If the block has a fill, it should be removed with `getFill` and `destroy`.
2072
- */
2073
- setFillGradientType(id: DesignBlockId, gradientType: GradientType): void;
2074
- /**
2075
- * Get the gradient type of the given design block.
2076
- * @param id - The block whose gradient type should be queried.
2077
- * @returns The gradient type.
2078
- * @deprecated Use `getEnum(id, 'fill/gradient/type')` instead.
2079
- */
2080
- getFillGradientType(id: DesignBlockId): GradientType;
2081
- /**
2082
- * Add a gradient color stop on a design block.
2083
- * @param id - The block on which a gradient color stop should be added.
2084
- * @param stop - Where to add a color stop in the range 0 to 1.
2085
- * @param r - The red color component in the range of 0 to 1.
2086
- * @param g - The green color component in the range of 0 to 1.
2087
- * @param b - The blue color component in the range of 0 to 1.
2088
- * @param a - The alpha color component in the range of 0 to 1.
2089
- * @returns An empty result on success, an error otherwise.
2090
- * @deprecated Removed without a direct replacement. Use `block.setFloat(fill, keypath, value)` with key paths 'fill/gradient/linear/startPointX/Y', 'fill/gradient/radial/centerPointX/Y', and 'fill/gradient/conical/centerPointX/Y' to move the control points.
2091
- */
2092
- addFillGradientColorStop(id: DesignBlockId, stop: number, r: number, g: number, b: number, a?: number): void;
2093
- /**
2094
- * Remove a previously gradient color stop on a design block.
2095
- * @param id - The block from which to remove the gradient color stop.
2096
- * @param stop - The stop's position.
2097
- * @returns An empty result on success, an error otherwise.
2098
- * @deprecated Removed without a direct replacement. Use `block.setFloat(fill, keypath, value)` with key paths 'fill/gradient/linear/startPointX/Y', 'fill/gradient/radial/centerPointX/Y', and 'fill/gradient/conical/centerPointX/Y' to move the control points.
2099
- */
2100
- removeFillGradientColorStop(id: DesignBlockId, stop: number): void;
2101
- /**
2102
- * Get the gradient fill color stops of the given design block.
2103
- * @param id - The block whose gradient color stop should be queried.
2104
- * @returns All of the design block's gradient color stops.
2105
- * @deprecated Removed without a direct replacement. Use `block.getFloat(fill, keypath)` with key paths 'fill/gradient/linear/startPointX/Y', 'fill/gradient/radial/centerPointX/Y', and 'fill/gradient/conical/centerPointX/Y' instead.
2106
- */
2107
- getFillGradientColorStops(id: DesignBlockId): GradientstopRGBA[];
2108
- /**
2109
- * Set the gradient fill color stops of the given design block, overwriting previously set color stops.
2110
- * @param id - The block whose gradient color stop should be set.
2111
- * @param stops - The gradient color stops to set.
2112
- * @returns An empty result on success, an error otherwise.
2113
- * @deprecated Removed without a direct replacement. Use `block.setFloat(fill, keypath, value)` with key paths 'fill/gradient/linear/startPointX/Y', 'fill/gradient/radial/centerPointX/Y', and 'fill/gradient/conical/centerPointX/Y' to move the control points.
2114
- */
2115
- setFillGradientColorStops(id: DesignBlockId, stops: GradientstopRGBA[]): void;
2116
- /**
2117
- * Set the position of a gradient's control point.
2118
- * Note that Different gradient types of different control points.
2119
- * @param id - The block whose gradient control point should be set.
2120
- * @param gradientControlPointType - The type of control point.
2121
- * @param x - The horizontal component of the control point.
2122
- * @param y - The vertical component of the control point.
2123
- * @returns true if the control point was set, an error otherwise.
2124
- * @deprecated Use, e.g., `block.setFloat(fill, 'fill/gradient/linear/startPointX', value)` and `startPointY` instead.
2125
- */
2126
- setFillGradientControlPoint(id: DesignBlockId, gradientControlPointType: GradientControlPointType, x: number, y: number): boolean;
2127
- /**
2128
- * Get the horizontal component of a gradient's control point.
2129
- * @param id - The block whose gradient control point should be queried.
2130
- * @param gradientControlPointType - The type of control point.
2131
- * @returns The horizontal component of the control point, an error otherwise.
2132
- * @deprecated Use `block.getFloat(fill, keypath)` with key paths 'fill/gradient/linear/startPointX', 'fill/gradient/radial/centerPointX', and 'fill/gradient/conical/centerPointX' instead.
2133
- */
2134
- getFillGradientControlPointX(id: DesignBlockId, gradientControlPointType: GradientControlPointType): number;
2135
- /**
2136
- * Get the vertical component of a gradient's control point.
2137
- * @param id - The block whose gradient control point should be queried.
2138
- * @param gradientControlPointType - The type of control point.
2139
- * @returns The vertical component of the control point, an error otherwise.
2140
- * @deprecated Use `block.setFloat(fill, keypath, value)` with key paths 'fill/gradient/linear/startPointY', 'fill/gradient/radial/centerPointY', and 'fill/gradient/conical/centerPointY' instead.
2141
- */
2142
- getFillGradientControlPointY(id: DesignBlockId, gradientControlPointType: GradientControlPointType): number;
2143
- /**
2144
- * Set a gradient's radius.
2145
- * Note that Not all gradients have a radius.
2146
- * @param id - The block whose gradient radius should be set.
2147
- * @param radius - The gradient's radius.
2148
- * @returns true if the control point was set, an error otherwise.
2149
- * @deprecated Use, e.g., `block.setFloat(fill, 'fill/gradient/radial/radius', value)` instead.
2150
- */
2151
- setFillGradientRadius(id: DesignBlockId, radius: number): boolean;
2152
- /**
2153
- * Get a gradient's radius.
2154
- * Note that Not all gradients have a radius.
2155
- * @param id - The block whose gradient radius should be queried.
2156
- * @returns the gradient's radius, an error otherwise.
2157
- * @deprecated Use, e.g., `block.getFloat(fill, 'fill/gradient/radial/radius')` instead.
2158
- */
2159
- getFillGradientRadius(id: DesignBlockId): number;
2160
2051
  /**
2161
2052
  * Enable or disable the placeholder function for a block.
2162
2053
  * @param id - The block whose placeholder function should be enabled or disabled.
@@ -2510,6 +2401,12 @@ export declare class BlockAPI {
2510
2401
  * @deprecated Use `generateVideoThumbnailSequence` instead.
2511
2402
  */
2512
2403
  getPageThumbnailAtlas(id: DesignBlockId, numberOfColumns: number, numberOfRows: number, thumbnailHeight: number): Promise<Blob>;
2404
+ /**
2405
+ * Update the pixels of the given pixel stream fill block.
2406
+ * @param id - The pixel stream fill block.
2407
+ * @param buffer - Use pixel data from a canvas or a video element.
2408
+ */
2409
+ setNativePixelBuffer(id: number, buffer: HTMLCanvasElement | HTMLVideoElement): void;
2513
2410
  }
2514
2411
 
2515
2412
  /** @public */
@@ -2893,6 +2790,40 @@ export declare class CreativeEngine {
2893
2790
 
2894
2791
 
2895
2792
 
2793
+ /**
2794
+ * Provide a callback that instantiates a web worker using the `@cesdk/engine`
2795
+ * module as its source. How and where exactly you can find that module is
2796
+ * highly depdendent on your particular setup. Web workers are used to perform
2797
+ * certain expensive tasks, such as video export, in the background
2798
+ *
2799
+ * If no worker factory is provided, the engine will perform long-running
2800
+ * tasks in the main thread.
2801
+ *
2802
+ * @example
2803
+ * In a webpack environment, the implementation of the worker factory could
2804
+ * look like this:
2805
+ *
2806
+ * ```ts
2807
+ * engine._unstable_setWorkerFactory(
2808
+ * () => new Worker(new URL('@cesdk/engine', import.meta.url)))
2809
+ * )
2810
+ * ```
2811
+ *
2812
+ * For more information, consult the webpack documentation at
2813
+ * https://webpack.js.org/guides/web-workers/
2814
+ */
2815
+ unstable_setWorkerFactory(workerFactory: null | (() => Worker)): void;
2816
+ /**
2817
+ * Some browsers exhibit a bug where support for certain video codecs is
2818
+ * offered, but when attempting to decode or encode in these codecs, the
2819
+ * request will simply never return. We detect that situation using a
2820
+ * timeout. To prevent this mechanism from triggering in situations where the
2821
+ * export simply takes long because of a slow device, you can configure the
2822
+ * timeout here.
2823
+ *
2824
+ * @param timeout - Timeout in milliseconds (default: 10 seconds)
2825
+ */
2826
+ unstable_setVideoExportInactivityTimeout(timeout: number): void;
2896
2827
 
2897
2828
  get element(): HTMLCreativeEngineCanvasElement | undefined;
2898
2829
  /**
@@ -3005,7 +2936,7 @@ export declare enum DesignBlockType {
3005
2936
  Camera = "//ly.img.ubq/camera",
3006
2937
  Page = "//ly.img.ubq/page",
3007
2938
  Image = "//ly.img.ubq/image",
3008
- Design = "//ly.img.ubq/design",
2939
+ Graphic = "//ly.img.ubq/graphic",
3009
2940
  Video = "//ly.img.ubq/video",
3010
2941
  VideoFill = "//ly.img.ubq/fill/video",
3011
2942
  ImageFill = "//ly.img.ubq/fill/image",
@@ -3019,7 +2950,11 @@ export declare enum DesignBlockType {
3019
2950
  PolygonShape = "//ly.img.ubq/shapes/polygon",
3020
2951
  EllipseShape = "//ly.img.ubq/shapes/ellipse",
3021
2952
  Group = "//ly.img.ubq/group",
3022
- Cutout = "//ly.img.ubq/cutout"
2953
+ Cutout = "//ly.img.ubq/cutout",
2954
+ ColorFill = "//ly.img.ubq/fill/color",
2955
+ LinearGradientFill = "//ly.img.ubq/fill/gradient/linear",
2956
+ RadialGradientFill = "//ly.img.ubq/fill/gradient/radial",
2957
+ ConicalGradientFill = "//ly.img.ubq/fill/gradient/conical"
3023
2958
  }
3024
2959
 
3025
2960
  /**
@@ -3675,6 +3610,12 @@ export declare type EngineExportOptions = {
3675
3610
  * @defaultValue 0.9
3676
3611
  */
3677
3612
  jpegQuality?: number;
3613
+ /**
3614
+ * The WebP quality to use when encoding to WebP. Valid values are (0-1], higher means better quality.
3615
+ * WebP uses a special lossless encoding that usually produces smaller file sizes than PNG.
3616
+ * Ignored for other encodings. Defaults to 1.0.
3617
+ */
3618
+ webpQuality?: number;
3678
3619
  /**
3679
3620
  * An optional target width used in conjunction with target height.
3680
3621
  * If used, the block will be rendered large enough, that it fills the target
@@ -3714,7 +3655,7 @@ export declare class EventAPI {
3714
3655
  declare type ExportFormat = 'image/png' | 'video/mp4' | 'application/pdf';
3715
3656
 
3716
3657
  /** @public */
3717
- export declare interface ExportOptions extends Pick<EngineExportOptions, 'pngCompressionLevel' | 'jpegQuality' | 'exportPdfWithHighCompatibility'> {
3658
+ export declare interface ExportOptions extends Pick<EngineExportOptions, 'pngCompressionLevel' | 'jpegQuality' | 'webpQuality' | 'exportPdfWithHighCompatibility'> {
3718
3659
  /** The mime type of the exported blob */
3719
3660
  mimeType: MimeType_2;
3720
3661
  /** The pages to export with the selected page as the default */
@@ -3724,6 +3665,7 @@ export declare interface ExportOptions extends Pick<EngineExportOptions, 'pngCom
3724
3665
  /** @public */
3725
3666
  declare interface ExportOptions_2 {
3726
3667
  jpegQuality: number;
3668
+ webpQuality: number;
3727
3669
  pngCompressionLevel: number;
3728
3670
  useTargetSize: boolean;
3729
3671
  targetWidth: number;
@@ -3741,11 +3683,6 @@ declare interface ExportVideoOptions {
3741
3683
  targetHeight: number;
3742
3684
  }
3743
3685
 
3744
- /**
3745
- * @public
3746
- */
3747
- export declare type FillType = 'Solid' | 'Gradient' | 'Video' | 'Image';
3748
-
3749
3686
  /** @public */
3750
3687
  declare interface FindAssetsQuery {
3751
3688
  perPage: number;
@@ -3786,11 +3723,6 @@ export declare interface GradientColorStop {
3786
3723
  stop: number;
3787
3724
  }
3788
3725
 
3789
- /**
3790
- * @public
3791
- */
3792
- export declare type GradientControlPointType = 'Start' | 'End' | 'Center';
3793
-
3794
3726
  /**
3795
3727
  * @public
3796
3728
  */
@@ -3802,11 +3734,6 @@ b: number,
3802
3734
  a: number
3803
3735
  ];
3804
3736
 
3805
- /**
3806
- * @public
3807
- */
3808
- export declare type GradientType = 'Linear' | 'Radial' | 'Conical';
3809
-
3810
3737
  /**
3811
3738
  * Will be called by a stream whenever a new value is available.
3812
3739
  * @public
@@ -3900,6 +3827,7 @@ export declare const LogLevel: {
3900
3827
  declare enum MimeType_2 {
3901
3828
  Png = "image/png",
3902
3829
  Jpeg = "image/jpeg",
3830
+ WebP = "image/webp",
3903
3831
  Tga = "image/x-tga",
3904
3832
  Mp4 = "video/mp4",
3905
3833
  QuickTime = "video/quicktime",
@@ -4315,25 +4243,26 @@ export declare class SceneAPI {
4315
4243
  */
4316
4244
  isZoomAutoFitEnabled(blockOrScene: DesignBlockId): boolean;
4317
4245
  /**
4318
- * Continually ensures the camera position to be within the width and height of a block's axis-aligned bounding box.
4246
+ * Continually ensures the camera position to be within the width and height of the blocks axis-aligned bounding box.
4319
4247
  * Without padding, this results in a tight clamp on the block. With padding, the padded part of the
4320
- * block is ensured to be visible. No more than one block per scene can have camera position clamping enabled.
4248
+ * blocks is ensured to be visible.
4321
4249
  *
4322
- * @param id - The block for which the camera position is adjusted to, usually, the scene or a page.
4250
+ * @param ids - The blocks to which the camera position is adjusted to, usually, the scene or a page.
4323
4251
  * @param paddingLeft - Optional padding in screen pixels to the left of the block.
4324
4252
  * @param paddingTop - Optional padding in screen pixels to the top of the block.
4325
4253
  * @param paddingRight - Optional padding in screen pixels to the right of the block.
4326
4254
  * @param paddingBottom - Optional padding in screen pixels to the bottom of the block.
4327
- * @param scaledPaddingLeft - Optional padding in pixels to the left of the block that scales with the zoom level.
4328
- * @param scaledPaddingTop - Optional padding in pixels to the top of the block that scales with the zoom level.
4329
- * @param scaledPaddingRight - Optional padding in pixels to the right of the block that scales with the zoom level.
4330
- * @param scaledPaddingBottom - Optional padding in pixels to the bottom of the block that scales with the zoom level.
4255
+ * @param scaledPaddingLeft - Optional padding in screen pixels to the left of the block that scales with the zoom level until five times the initial value.
4256
+ * @param scaledPaddingTop - Optional padding in screen pixels to the top of the block that scales with the zoom level until five times the initial value.
4257
+ * @param scaledPaddingRight - Optional padding in screen pixels to the right of the block that scales with the zoom level until five times the initial value.
4258
+ * @param scaledPaddingBottom - Optional padding in screen pixels to the bottom of the block that scales with the zoom level until five times the initial value.
4331
4259
  */
4332
- unstable_enableCameraPositionClamping(id: DesignBlockId, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number, scaledPaddingLeft?: number, scaledPaddingTop?: number, scaledPaddingRight?: number, scaledPaddingBottom?: number): void;
4260
+ unstable_enableCameraPositionClamping(ids: DesignBlockId[], paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number, scaledPaddingLeft?: number, scaledPaddingTop?: number, scaledPaddingRight?: number, scaledPaddingBottom?: number): void;
4333
4261
  /**
4334
4262
  * Disables any previously set position clamping for the current scene.
4263
+ * @param blockOrScene - Optionally, the scene or a block in the scene for which to query the position clamping.
4335
4264
  */
4336
- unstable_disableCameraPositionClamping(): void;
4265
+ unstable_disableCameraPositionClamping(blockOrScene?: number | null): void;
4337
4266
  /**
4338
4267
  * Queries whether position clamping is enabled.
4339
4268
  *
@@ -4345,7 +4274,7 @@ export declare class SceneAPI {
4345
4274
  /**
4346
4275
  * Continually ensures the zoom level of the camera in the active scene to be in the given range.
4347
4276
  *
4348
- * @param id - The block for which the camera zoom limits are adjusted to, usually, the scene or a page.
4277
+ * @param ids - The blocks to which the camera zoom limits are adjusted to, usually, the scene or a page.
4349
4278
  * @param minZoomLimit - The minimum zoom level limit when zooming out, unlimited when negative.
4350
4279
  * @param maxZoomLimit - The maximum zoom level limit when zooming in, unlimited when negative.
4351
4280
  * @param paddingLeft - Optional padding in screen pixels to the left of the block. Only applied when the block is not a camera.
@@ -4354,11 +4283,12 @@ export declare class SceneAPI {
4354
4283
  * @param paddingBottom - Optional padding in screen pixels to the bottom of the block. Only applied when the block is not a camera.
4355
4284
  *
4356
4285
  */
4357
- unstable_enableCameraZoomClamping(id: DesignBlockId, minZoomLimit?: number, maxZoomLimit?: number, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): void;
4286
+ unstable_enableCameraZoomClamping(ids: DesignBlockId[], minZoomLimit?: number, maxZoomLimit?: number, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): void;
4358
4287
  /**
4359
4288
  * Disables any previously set zoom clamping for the current scene.
4289
+ * @param blockOrScene - Optionally, the scene or a block for which to query the zoom clamping.
4360
4290
  */
4361
- unstable_disableCameraZoomClamping(): void;
4291
+ unstable_disableCameraZoomClamping(blockOrScene?: number | null): void;
4362
4292
  /**
4363
4293
  * Queries whether zoom clamping is enabled.
4364
4294
  *
@@ -4638,7 +4568,7 @@ declare namespace UserInterfaceElements {
4638
4568
  UserInterfaceInspectorBlockImage,
4639
4569
  UserInterfaceInspectorBlockVideoFill,
4640
4570
  UserInterfaceInspectorBlockRectShape,
4641
- UserInterfaceInspectorBlockDesign,
4571
+ UserInterfaceInspectorBlockGraphic,
4642
4572
  UserInterfaceInspectorBlockShape,
4643
4573
  UserInterfaceInspector,
4644
4574
  UserInterfaceSettings,
@@ -4710,7 +4640,7 @@ declare interface UserInterfaceInspectorBlock {
4710
4640
  }
4711
4641
 
4712
4642
  /** @public */
4713
- declare interface UserInterfaceInspectorBlockDesign extends UserInterfaceInspectorBlock {
4643
+ declare interface UserInterfaceInspectorBlockGraphic extends UserInterfaceInspectorBlock {
4714
4644
  crop?: UserInterfaceElement | boolean;
4715
4645
  filters?: UserInterfaceElement | boolean;
4716
4646
  adjustments?: UserInterfaceElement | boolean;
@@ -4766,7 +4696,7 @@ declare interface UserInterfaceInspectorBlocks {
4766
4696
  '//ly.img.ubq/shapes/ellipse'?: UserInterfaceInspectorBlockShape;
4767
4697
  '//ly.img.ubq/text'?: UserInterfaceInspectorBlockText;
4768
4698
  '//ly.img.ubq/page'?: UserInterfaceInspectorBlockPage;
4769
- '//ly.img.ubq/design'?: UserInterfaceInspectorBlockDesign;
4699
+ '//ly.img.ubq/graphic'?: UserInterfaceInspectorBlockGraphic;
4770
4700
  }
4771
4701
 
4772
4702
  /** @public */
@@ -4902,6 +4832,10 @@ declare type VideoExportOptions = {
4902
4832
  * size entirely while maintaining its aspect ratio.
4903
4833
  */
4904
4834
  targetHeight?: number;
4835
+ /**
4836
+ * An abortsignal that can be used to cancel the export.
4837
+ */
4838
+ abortSignal?: AbortSignal;
4905
4839
  };
4906
4840
 
4907
4841
  /** @public */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cesdk/cesdk-js",
3
- "version": "1.16.1",
3
+ "version": "1.17.0",
4
4
  "main": "./cesdk.umd.js",
5
5
  "types": "./index.d.ts",
6
6
  "homepage": "https://www.img.ly",