@cesdk/engine 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
@@ -1859,21 +1859,6 @@ export declare class BlockAPI {
1859
1859
  * @param fill - The new fill.
1860
1860
  */
1861
1861
  setFill(id: DesignBlockId, fill: DesignBlockId): void;
1862
- /**
1863
- * Set the fill type of the given design block.
1864
- * @param id - The block whose fill type should be set.
1865
- * @param type - The fill type to set.
1866
- * @returns An empty result on success, an error otherwise.
1867
- * @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`.
1868
- */
1869
- setFillType(id: DesignBlockId, fillType: FillType): void;
1870
- /**
1871
- * Get the fill type of the given design block.
1872
- * @param id - The block whose fill type should be queried.
1873
- * @returns The block's fill type or an error.
1874
- * @deprecated Use `getEnum(id, 'fill/type')` instead.
1875
- */
1876
- getFillType(id: DesignBlockId): FillType;
1877
1862
  /**
1878
1863
  * Set the fill color of the given design block.
1879
1864
  * @param id - The block whose fill color should be set.
@@ -1890,100 +1875,6 @@ export declare class BlockAPI {
1890
1875
  * @returns A result holding the fill color or an error.
1891
1876
  */
1892
1877
  getFillSolidColor(id: DesignBlockId): RGBA;
1893
- /**
1894
- * Set the gradient type of the given design block.
1895
- * @param id - The block whose gradient type should be set.
1896
- * @param type - The gradient type.
1897
- * @returns An empty result on success, an error otherwise.
1898
- * @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`.
1899
- */
1900
- setFillGradientType(id: DesignBlockId, gradientType: GradientType): void;
1901
- /**
1902
- * Get the gradient type of the given design block.
1903
- * @param id - The block whose gradient type should be queried.
1904
- * @returns The gradient type.
1905
- * @deprecated Use `getEnum(id, 'fill/gradient/type')` instead.
1906
- */
1907
- getFillGradientType(id: DesignBlockId): GradientType;
1908
- /**
1909
- * Add a gradient color stop on a design block.
1910
- * @param id - The block on which a gradient color stop should be added.
1911
- * @param stop - Where to add a color stop in the range 0 to 1.
1912
- * @param r - The red color component in the range of 0 to 1.
1913
- * @param g - The green color component in the range of 0 to 1.
1914
- * @param b - The blue color component in the range of 0 to 1.
1915
- * @param a - The alpha color component in the range of 0 to 1.
1916
- * @returns An empty result on success, an error otherwise.
1917
- * @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.
1918
- */
1919
- addFillGradientColorStop(id: DesignBlockId, stop: number, r: number, g: number, b: number, a?: number): void;
1920
- /**
1921
- * Remove a previously gradient color stop on a design block.
1922
- * @param id - The block from which to remove the gradient color stop.
1923
- * @param stop - The stop's position.
1924
- * @returns An empty result on success, an error otherwise.
1925
- * @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.
1926
- */
1927
- removeFillGradientColorStop(id: DesignBlockId, stop: number): void;
1928
- /**
1929
- * Get the gradient fill color stops of the given design block.
1930
- * @param id - The block whose gradient color stop should be queried.
1931
- * @returns All of the design block's gradient color stops.
1932
- * @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.
1933
- */
1934
- getFillGradientColorStops(id: DesignBlockId): GradientstopRGBA[];
1935
- /**
1936
- * Set the gradient fill color stops of the given design block, overwriting previously set color stops.
1937
- * @param id - The block whose gradient color stop should be set.
1938
- * @param stops - The gradient color stops to set.
1939
- * @returns An empty result on success, an error otherwise.
1940
- * @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.
1941
- */
1942
- setFillGradientColorStops(id: DesignBlockId, stops: GradientstopRGBA[]): void;
1943
- /**
1944
- * Set the position of a gradient's control point.
1945
- * Note that Different gradient types of different control points.
1946
- * @param id - The block whose gradient control point should be set.
1947
- * @param gradientControlPointType - The type of control point.
1948
- * @param x - The horizontal component of the control point.
1949
- * @param y - The vertical component of the control point.
1950
- * @returns true if the control point was set, an error otherwise.
1951
- * @deprecated Use, e.g., `block.setFloat(fill, 'fill/gradient/linear/startPointX', value)` and `startPointY` instead.
1952
- */
1953
- setFillGradientControlPoint(id: DesignBlockId, gradientControlPointType: GradientControlPointType, x: number, y: number): boolean;
1954
- /**
1955
- * Get the horizontal component of a gradient's control point.
1956
- * @param id - The block whose gradient control point should be queried.
1957
- * @param gradientControlPointType - The type of control point.
1958
- * @returns The horizontal component of the control point, an error otherwise.
1959
- * @deprecated Use `block.getFloat(fill, keypath)` with key paths 'fill/gradient/linear/startPointX', 'fill/gradient/radial/centerPointX', and 'fill/gradient/conical/centerPointX' instead.
1960
- */
1961
- getFillGradientControlPointX(id: DesignBlockId, gradientControlPointType: GradientControlPointType): number;
1962
- /**
1963
- * Get the vertical component of a gradient's control point.
1964
- * @param id - The block whose gradient control point should be queried.
1965
- * @param gradientControlPointType - The type of control point.
1966
- * @returns The vertical component of the control point, an error otherwise.
1967
- * @deprecated Use `block.setFloat(fill, keypath, value)` with key paths 'fill/gradient/linear/startPointY', 'fill/gradient/radial/centerPointY', and 'fill/gradient/conical/centerPointY' instead.
1968
- */
1969
- getFillGradientControlPointY(id: DesignBlockId, gradientControlPointType: GradientControlPointType): number;
1970
- /**
1971
- * Set a gradient's radius.
1972
- * Note that Not all gradients have a radius.
1973
- * @param id - The block whose gradient radius should be set.
1974
- * @param radius - The gradient's radius.
1975
- * @returns true if the control point was set, an error otherwise.
1976
- * @deprecated Use, e.g., `block.setFloat(fill, 'fill/gradient/radial/radius', value)` instead.
1977
- */
1978
- setFillGradientRadius(id: DesignBlockId, radius: number): boolean;
1979
- /**
1980
- * Get a gradient's radius.
1981
- * Note that Not all gradients have a radius.
1982
- * @param id - The block whose gradient radius should be queried.
1983
- * @returns the gradient's radius, an error otherwise.
1984
- * @deprecated Use, e.g., `block.getFloat(fill, 'fill/gradient/radial/radius')` instead.
1985
- */
1986
- getFillGradientRadius(id: DesignBlockId): number;
1987
1878
  /**
1988
1879
  * Enable or disable the placeholder function for a block.
1989
1880
  * @param id - The block whose placeholder function should be enabled or disabled.
@@ -2337,6 +2228,12 @@ export declare class BlockAPI {
2337
2228
  * @deprecated Use `generateVideoThumbnailSequence` instead.
2338
2229
  */
2339
2230
  getPageThumbnailAtlas(id: DesignBlockId, numberOfColumns: number, numberOfRows: number, thumbnailHeight: number): Promise<Blob>;
2231
+ /**
2232
+ * Update the pixels of the given pixel stream fill block.
2233
+ * @param id - The pixel stream fill block.
2234
+ * @param buffer - Use pixel data from a canvas or a video element.
2235
+ */
2236
+ setNativePixelBuffer(id: number, buffer: HTMLCanvasElement | HTMLVideoElement): void;
2340
2237
  }
2341
2238
 
2342
2239
  /** @public */
@@ -2762,6 +2659,40 @@ declare class CreativeEngine {
2762
2659
 
2763
2660
 
2764
2661
 
2662
+ /**
2663
+ * Provide a callback that instantiates a web worker using the `@cesdk/engine`
2664
+ * module as its source. How and where exactly you can find that module is
2665
+ * highly depdendent on your particular setup. Web workers are used to perform
2666
+ * certain expensive tasks, such as video export, in the background
2667
+ *
2668
+ * If no worker factory is provided, the engine will perform long-running
2669
+ * tasks in the main thread.
2670
+ *
2671
+ * @example
2672
+ * In a webpack environment, the implementation of the worker factory could
2673
+ * look like this:
2674
+ *
2675
+ * ```ts
2676
+ * engine._unstable_setWorkerFactory(
2677
+ * () => new Worker(new URL('@cesdk/engine', import.meta.url)))
2678
+ * )
2679
+ * ```
2680
+ *
2681
+ * For more information, consult the webpack documentation at
2682
+ * https://webpack.js.org/guides/web-workers/
2683
+ */
2684
+ unstable_setWorkerFactory(workerFactory: null | (() => Worker)): void;
2685
+ /**
2686
+ * Some browsers exhibit a bug where support for certain video codecs is
2687
+ * offered, but when attempting to decode or encode in these codecs, the
2688
+ * request will simply never return. We detect that situation using a
2689
+ * timeout. To prevent this mechanism from triggering in situations where the
2690
+ * export simply takes long because of a slow device, you can configure the
2691
+ * timeout here.
2692
+ *
2693
+ * @param timeout - Timeout in milliseconds (default: 10 seconds)
2694
+ */
2695
+ unstable_setVideoExportInactivityTimeout(timeout: number): void;
2765
2696
 
2766
2697
  get element(): HTMLCreativeEngineCanvasElement | undefined;
2767
2698
  /**
@@ -2877,7 +2808,7 @@ export declare enum DesignBlockType {
2877
2808
  Camera = "//ly.img.ubq/camera",
2878
2809
  Page = "//ly.img.ubq/page",
2879
2810
  Image = "//ly.img.ubq/image",
2880
- Design = "//ly.img.ubq/design",
2811
+ Graphic = "//ly.img.ubq/graphic",
2881
2812
  Video = "//ly.img.ubq/video",
2882
2813
  VideoFill = "//ly.img.ubq/fill/video",
2883
2814
  ImageFill = "//ly.img.ubq/fill/image",
@@ -2891,7 +2822,11 @@ export declare enum DesignBlockType {
2891
2822
  PolygonShape = "//ly.img.ubq/shapes/polygon",
2892
2823
  EllipseShape = "//ly.img.ubq/shapes/ellipse",
2893
2824
  Group = "//ly.img.ubq/group",
2894
- Cutout = "//ly.img.ubq/cutout"
2825
+ Cutout = "//ly.img.ubq/cutout",
2826
+ ColorFill = "//ly.img.ubq/fill/color",
2827
+ LinearGradientFill = "//ly.img.ubq/fill/gradient/linear",
2828
+ RadialGradientFill = "//ly.img.ubq/fill/gradient/radial",
2829
+ ConicalGradientFill = "//ly.img.ubq/fill/gradient/conical"
2895
2830
  }
2896
2831
 
2897
2832
  /**
@@ -3266,6 +3201,12 @@ export declare type ExportOptions = {
3266
3201
  * @defaultValue 0.9
3267
3202
  */
3268
3203
  jpegQuality?: number;
3204
+ /**
3205
+ * The WebP quality to use when encoding to WebP. Valid values are (0-1], higher means better quality.
3206
+ * WebP uses a special lossless encoding that usually produces smaller file sizes than PNG.
3207
+ * Ignored for other encodings. Defaults to 1.0.
3208
+ */
3209
+ webpQuality?: number;
3269
3210
  /**
3270
3211
  * An optional target width used in conjunction with target height.
3271
3212
  * If used, the block will be rendered large enough, that it fills the target
@@ -3289,6 +3230,7 @@ export declare type ExportOptions = {
3289
3230
  /** @public */
3290
3231
  declare interface ExportOptions_2 {
3291
3232
  jpegQuality: number;
3233
+ webpQuality: number;
3292
3234
  pngCompressionLevel: number;
3293
3235
  useTargetSize: boolean;
3294
3236
  targetWidth: number;
@@ -3306,11 +3248,6 @@ declare interface ExportVideoOptions {
3306
3248
  targetHeight: number;
3307
3249
  }
3308
3250
 
3309
- /**
3310
- * @public
3311
- */
3312
- export declare type FillType = 'Solid' | 'Gradient' | 'Video' | 'Image';
3313
-
3314
3251
  /** @public */
3315
3252
  declare interface FindAssetsQuery {
3316
3253
  perPage: number;
@@ -3342,11 +3279,6 @@ export declare interface GradientColorStop {
3342
3279
  stop: number;
3343
3280
  }
3344
3281
 
3345
- /**
3346
- * @public
3347
- */
3348
- export declare type GradientControlPointType = 'Start' | 'End' | 'Center';
3349
-
3350
3282
  /**
3351
3283
  * @public
3352
3284
  */
@@ -3358,11 +3290,6 @@ b: number,
3358
3290
  a: number
3359
3291
  ];
3360
3292
 
3361
- /**
3362
- * @public
3363
- */
3364
- export declare type GradientType = 'Linear' | 'Radial' | 'Conical';
3365
-
3366
3293
  /**
3367
3294
  * Will be called by a stream whenever a new value is available.
3368
3295
  * @public
@@ -3455,6 +3382,7 @@ export declare const LogLevel: {
3455
3382
  declare enum MimeType_2 {
3456
3383
  Png = "image/png",
3457
3384
  Jpeg = "image/jpeg",
3385
+ WebP = "image/webp",
3458
3386
  Tga = "image/x-tga",
3459
3387
  Mp4 = "video/mp4",
3460
3388
  QuickTime = "video/quicktime",
@@ -3774,25 +3702,26 @@ export declare class SceneAPI {
3774
3702
  */
3775
3703
  isZoomAutoFitEnabled(blockOrScene: DesignBlockId): boolean;
3776
3704
  /**
3777
- * Continually ensures the camera position to be within the width and height of a block's axis-aligned bounding box.
3705
+ * Continually ensures the camera position to be within the width and height of the blocks axis-aligned bounding box.
3778
3706
  * Without padding, this results in a tight clamp on the block. With padding, the padded part of the
3779
- * block is ensured to be visible. No more than one block per scene can have camera position clamping enabled.
3707
+ * blocks is ensured to be visible.
3780
3708
  *
3781
- * @param id - The block for which the camera position is adjusted to, usually, the scene or a page.
3709
+ * @param ids - The blocks to which the camera position is adjusted to, usually, the scene or a page.
3782
3710
  * @param paddingLeft - Optional padding in screen pixels to the left of the block.
3783
3711
  * @param paddingTop - Optional padding in screen pixels to the top of the block.
3784
3712
  * @param paddingRight - Optional padding in screen pixels to the right of the block.
3785
3713
  * @param paddingBottom - Optional padding in screen pixels to the bottom of the block.
3786
- * @param scaledPaddingLeft - Optional padding in pixels to the left of the block that scales with the zoom level.
3787
- * @param scaledPaddingTop - Optional padding in pixels to the top of the block that scales with the zoom level.
3788
- * @param scaledPaddingRight - Optional padding in pixels to the right of the block that scales with the zoom level.
3789
- * @param scaledPaddingBottom - Optional padding in pixels to the bottom of the block that scales with the zoom level.
3714
+ * @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.
3715
+ * @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.
3716
+ * @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.
3717
+ * @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.
3790
3718
  */
3791
- unstable_enableCameraPositionClamping(id: DesignBlockId, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number, scaledPaddingLeft?: number, scaledPaddingTop?: number, scaledPaddingRight?: number, scaledPaddingBottom?: number): void;
3719
+ unstable_enableCameraPositionClamping(ids: DesignBlockId[], paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number, scaledPaddingLeft?: number, scaledPaddingTop?: number, scaledPaddingRight?: number, scaledPaddingBottom?: number): void;
3792
3720
  /**
3793
3721
  * Disables any previously set position clamping for the current scene.
3722
+ * @param blockOrScene - Optionally, the scene or a block in the scene for which to query the position clamping.
3794
3723
  */
3795
- unstable_disableCameraPositionClamping(): void;
3724
+ unstable_disableCameraPositionClamping(blockOrScene?: number | null): void;
3796
3725
  /**
3797
3726
  * Queries whether position clamping is enabled.
3798
3727
  *
@@ -3804,7 +3733,7 @@ export declare class SceneAPI {
3804
3733
  /**
3805
3734
  * Continually ensures the zoom level of the camera in the active scene to be in the given range.
3806
3735
  *
3807
- * @param id - The block for which the camera zoom limits are adjusted to, usually, the scene or a page.
3736
+ * @param ids - The blocks to which the camera zoom limits are adjusted to, usually, the scene or a page.
3808
3737
  * @param minZoomLimit - The minimum zoom level limit when zooming out, unlimited when negative.
3809
3738
  * @param maxZoomLimit - The maximum zoom level limit when zooming in, unlimited when negative.
3810
3739
  * @param paddingLeft - Optional padding in screen pixels to the left of the block. Only applied when the block is not a camera.
@@ -3813,11 +3742,12 @@ export declare class SceneAPI {
3813
3742
  * @param paddingBottom - Optional padding in screen pixels to the bottom of the block. Only applied when the block is not a camera.
3814
3743
  *
3815
3744
  */
3816
- unstable_enableCameraZoomClamping(id: DesignBlockId, minZoomLimit?: number, maxZoomLimit?: number, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): void;
3745
+ unstable_enableCameraZoomClamping(ids: DesignBlockId[], minZoomLimit?: number, maxZoomLimit?: number, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): void;
3817
3746
  /**
3818
3747
  * Disables any previously set zoom clamping for the current scene.
3748
+ * @param blockOrScene - Optionally, the scene or a block for which to query the zoom clamping.
3819
3749
  */
3820
- unstable_disableCameraZoomClamping(): void;
3750
+ unstable_disableCameraZoomClamping(blockOrScene?: number | null): void;
3821
3751
  /**
3822
3752
  * Queries whether zoom clamping is enabled.
3823
3753
  *
@@ -4084,6 +4014,10 @@ export declare type VideoExportOptions = {
4084
4014
  * size entirely while maintaining its aspect ratio.
4085
4015
  */
4086
4016
  targetHeight?: number;
4017
+ /**
4018
+ * An abortsignal that can be used to cancel the export.
4019
+ */
4020
+ abortSignal?: AbortSignal;
4087
4021
  };
4088
4022
 
4089
4023
  /**