@cesdk/engine 1.54.0-nightly.20250612 → 1.54.0-rc.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
@@ -19,6 +19,9 @@ export declare type AnimationTypeLonghand = `//ly.img.ubq/animation/${AnimationT
19
19
  */
20
20
  export declare type AnimationTypeShorthand = 'slide' | 'pan' | 'fade' | 'blur' | 'grow' | 'zoom' | 'pop' | 'wipe' | 'baseline' | 'crop_zoom' | 'spin' | 'spin_loop' | 'fade_loop' | 'blur_loop' | 'pulsating_loop' | 'breathing_loop' | 'jump_loop' | 'squeeze_loop' | 'sway_loop' | 'typewriter_text' | 'block_swipe_text' | 'spread_text' | 'merge_text' | 'ken_burns';
21
21
 
22
+ /** @public */
23
+ export declare type ApplicationMimeType = Extract<MimeType_2, 'application/octet-stream' | 'application/pdf' | 'application/zip'>;
24
+
22
25
  /**
23
26
  * Generic asset information
24
27
  * @public
@@ -589,6 +592,16 @@ export declare type AssetTransformPreset = AssetFixedAspectRatio | AssetFreeAspe
589
592
  * @public
590
593
  */
591
594
  export declare type AudioExportOptions = {
595
+ /**
596
+ * The MIME type of the output audio file.
597
+ *
598
+ * @defaultValue 'audio/wav'
599
+ */
600
+ mimeType?: AudioMimeType;
601
+ /**
602
+ * A callback which reports on the progress of the export.
603
+ */
604
+ onProgress?: (numberOfRenderedFrames: number, numberOfEncodedFrames: number, totalNumberOfFrames: number) => void;
592
605
  /**
593
606
  * The time offset in seconds relative to the target block.
594
607
  *
@@ -615,6 +628,9 @@ export declare type AudioExportOptions = {
615
628
  numberOfChannels?: number;
616
629
  };
617
630
 
631
+ /** @public */
632
+ export declare type AudioMimeType = Extract<MimeType_2, 'audio/wav'>;
633
+
618
634
  /**
619
635
  * @public
620
636
  */
@@ -626,6 +642,14 @@ export declare type BlendMode = 'PassThrough' | 'Normal' | 'Darken' | 'Multiply'
626
642
  export declare class BlockAPI {
627
643
  #private;
628
644
 
645
+ /**
646
+ * Exports a design block element as a file of the given mime type.
647
+ * Performs an internal update to resolve the final layout for the blocks.
648
+ * @param handle - The design block element to export.
649
+ * @param options - The options for exporting the block type, including mime type and export settings.
650
+ * @returns A promise that resolves with the exported image or is rejected with an error.
651
+ */
652
+ export(handle: DesignBlockId, options?: ExportOptions): Promise<Blob>;
629
653
  /**
630
654
  * Exports a design block element as a file of the given mime type.
631
655
  * Performs an internal update to resolve the final layout for the blocks.
@@ -633,8 +657,28 @@ export declare class BlockAPI {
633
657
  * @param mimeType - The mime type of the output file.
634
658
  * @param options - The options for exporting the block type
635
659
  * @returns A promise that resolves with the exported image or is rejected with an error.
660
+ * @deprecated Use the new `export` signature instead
661
+ *
662
+ * @example
663
+ * ```typescript
664
+ * // Before migration
665
+ * const blob = await cesdk.block.export(blockId, MimeType.Png, { pngCompressionLevel: 5 })
666
+ * // After migration
667
+ * const blob = await cesdk.block.export(blockId, { mimeType: 'image/png', pngCompressionLevel: 5 })
668
+ * ```
636
669
  */
637
- export(handle: DesignBlockId, mimeType?: MimeType_2, options?: ExportOptions): Promise<Blob>;
670
+ export(handle: DesignBlockId, mimeType?: ExportOptions['mimeType'], options?: Omit<ExportOptions, 'mimeType'>): Promise<Blob>;
671
+ /**
672
+ * Exports a design block element as a file of the given mime type.
673
+ * Performs an internal update to resolve the final layout for the blocks.
674
+ * @param handle - The design block element to export.
675
+ * @param maskColorR - The red component of the special color mask color.
676
+ * @param maskColorG - The green component of the special color mask color.
677
+ * @param maskColorB - The blue component of the special color mask color.
678
+ * @param options - The options for exporting the block type
679
+ * @returns A promise that resolves with an array of the exported image and mask or is rejected with an error.
680
+ */
681
+ exportWithColorMask(handle: DesignBlockId, maskColorR: number, maskColorG: number, maskColorB: number, options?: ExportOptions): Promise<Blob[]>;
638
682
  /**
639
683
  * Exports a design block element as a file of the given mime type.
640
684
  * Performs an internal update to resolve the final layout for the blocks.
@@ -645,27 +689,77 @@ export declare class BlockAPI {
645
689
  * @param maskColorB - The blue component of the special color mask color.
646
690
  * @param options - The options for exporting the block type
647
691
  * @returns A promise that resolves with an array of the exported image and mask or is rejected with an error.
692
+ * @deprecated Use the new `exportWithColorMask` signature instead
693
+ *
694
+ * @example
695
+ * ```typescript
696
+ * // Before migration
697
+ * const blob = await cesdk.block.exportWithColorMask(
698
+ * blockId,
699
+ * MimeType.Png,
700
+ * 0.5,
701
+ * 0,
702
+ * 0,
703
+ * {
704
+ * pngCompressionLevel: 5
705
+ * }
706
+ * );
707
+ * // After migration
708
+ * const blob = await cesdk.block.exportWithColorMask(
709
+ * blockId,
710
+ * 0.5,
711
+ * 0,
712
+ * 0,
713
+ * {
714
+ * mimeType: 'image/png',
715
+ * pngCompressionLevel: 5
716
+ * }
717
+ * );
718
+ * ```
648
719
  */
649
- exportWithColorMask(handle: DesignBlockId, mimeType: MimeType_2 | undefined, maskColorR: number, maskColorG: number, maskColorB: number, options?: ExportOptions): Promise<Blob[]>;
720
+ exportWithColorMask(handle: DesignBlockId, mimeType: ExportOptions['mimeType'] | undefined, maskColorR: number, maskColorG: number, maskColorB: number, options?: Omit<ExportOptions, 'mimeType'>): Promise<Blob[]>;
650
721
  /**
651
722
  * Exports a design block as a video file of the given mime type.
652
723
  * Note: The export will run across multiple iterations of the update loop. In each iteration a frame is scheduled for encoding.
653
724
  * @param handle - The design block element to export. Currently, only page blocks are supported.
654
- * @param mimeType - The mime type of the output video file.
655
- * @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.
656
- * @param options - The options for exporting the video.
725
+ * @param options - The options for exporting the video, including mime type, h264 profile, level, bitrate, time offset, duration, framerate, target width and height.
657
726
  * @returns A promise that resolves with a video blob or is rejected with an error.
658
727
  */
659
- exportVideo(handle: DesignBlockId, mimeType: MimeType_2 | undefined, progressCallback: (numberOfRenderedFrames: number, numberOfEncodedFrames: number, totalNumberOfFrames: number) => void, options: VideoExportOptions): Promise<Blob>;
728
+ exportVideo(handle: DesignBlockId, options?: VideoExportOptions): Promise<Blob>;
729
+ /**
730
+ * Exports a design block as a video file of the given mime type.
731
+ * Note: The export will run across multiple iterations of the update loop. In each iteration a frame is scheduled for encoding.
732
+ * @param handle - The design block element to export. Currently, only page blocks are supported.
733
+ * @param mimeType - The MIME type of the output video file.
734
+ * @param onProgress - A callback which reports on the progress of the export.
735
+ * @param options - The options for exporting the video, including h264 profile, level, bitrate, time offset, duration, framerate, target width and height.
736
+ * @returns A promise that resolves with a video blob or is rejected with an error.
737
+ * @deprecated Use the new `exportVideo` signature instead
738
+ *
739
+ * @example
740
+ * ```typescript
741
+ * // Before migration
742
+ * const blob = await cesdk.block.exportVideo(blockId, 'video/mp4', handleProgress, {
743
+ * targetWidth: 1920,
744
+ * targetHeight: 1080,
745
+ * })
746
+ * // After migration
747
+ * const blob = await cesdk.block.exportVideo(blockId, {
748
+ * mimeType: 'video/mp4',
749
+ * onProgress: handleProgress,
750
+ * targetWidth: 1920,
751
+ * targetHeight: 1080,
752
+ * })
753
+ * ```
754
+ */
755
+ exportVideo(handle: DesignBlockId, mimeType?: VideoExportOptions['mimeType'], progressCallback?: VideoExportOptions['onProgress'], options?: Omit<VideoExportOptions, 'mimeType' | 'onProgress'>): Promise<Blob>;
660
756
  /**
661
757
  * Exports a design block as an audio file of the given mime type.
662
758
  * @param handle - The design block element to export. Currently, only audio blocks are supported.
663
- * @param mimeType - The mime type of the output audio file.
664
- * @param progressCallback - A callback which reports on the progress of the export.
665
- * @param options - The options for exporting the audio.
759
+ * @param options - The options for exporting the audio, including mime type, progress callback, and export settings.
666
760
  * @returns A promise that resolves with an audio blob or is rejected with an error.
667
761
  */
668
- unstable_exportAudio(handle: DesignBlockId, mimeType: MimeType_2 | undefined, progressCallback: (numberOfRenderedFrames: number, numberOfEncodedFrames: number, totalNumberOfFrames: number) => void, options: AudioExportOptions): Promise<Blob>;
762
+ unstable_exportAudio(handle: DesignBlockId, options?: AudioExportOptions): Promise<Blob>;
669
763
  /**
670
764
  * Loads existing blocks from the given string.
671
765
  * The blocks are not attached by default and won't be visible until attached to a page or the scene.
@@ -2491,6 +2585,13 @@ export declare class BlockAPI {
2491
2585
  * @returns The bounding box of the line.
2492
2586
  */
2493
2587
  getTextVisibleLineGlobalBoundingBoxXYWH(id: DesignBlockId, lineIndex: number): XYWH;
2588
+ /**
2589
+ * Returns the text content of the given visible line of the text block.
2590
+ * @param id - The text block whose line content should be returned.
2591
+ * @param lineIndex - The index of the line whose content should be returned.
2592
+ * @returns The text content of the line.
2593
+ */
2594
+ getTextVisibleLineContent(id: DesignBlockId, lineIndex: number): string;
2494
2595
  /**
2495
2596
  * Query if the given block has fill color properties.
2496
2597
  * @param id - The block to query.
@@ -4013,6 +4114,12 @@ declare interface ExportAudioOptions {
4013
4114
  * @public
4014
4115
  */
4015
4116
  export declare type ExportOptions = {
4117
+ /**
4118
+ * The MIME type of the output file.
4119
+ *
4120
+ * @defaultValue 'image/png'
4121
+ */
4122
+ mimeType?: ImageMimeType | Exclude<ApplicationMimeType, 'application/zip'>;
4016
4123
  /**
4017
4124
  * The PNG compression level to use, when exporting to PNG.
4018
4125
  *
@@ -4226,6 +4333,9 @@ export declare interface HTMLCreativeEngineCanvasElement extends HTMLElement {
4226
4333
  clear(): void;
4227
4334
  }
4228
4335
 
4336
+ /** @public */
4337
+ export declare type ImageMimeType = Extract<MimeType_2, 'image/png' | 'image/jpeg' | 'image/webp' | 'image/x-tga'>;
4338
+
4229
4339
  /**
4230
4340
  * Type guard for {@link CMYKColor}
4231
4341
  * @public
@@ -4269,19 +4379,25 @@ export declare const LogLevel: {
4269
4379
  readonly Error: "Error";
4270
4380
  };
4271
4381
 
4382
+ /**
4383
+ * @public
4384
+ * @deprecated Use The `MimeType` string literal types instead.
4385
+ * */
4386
+ declare const MimeType_2: {
4387
+ readonly Png: "image/png";
4388
+ readonly Jpeg: "image/jpeg";
4389
+ readonly WebP: "image/webp";
4390
+ readonly Tga: "image/x-tga";
4391
+ readonly Wav: "audio/wav";
4392
+ readonly Mp4: "video/mp4";
4393
+ readonly QuickTime: "video/quicktime";
4394
+ readonly Binary: "application/octet-stream";
4395
+ readonly Pdf: "application/pdf";
4396
+ readonly Zip: "application/zip";
4397
+ };
4398
+
4272
4399
  /** @public */
4273
- declare enum MimeType_2 {
4274
- Png = "image/png",
4275
- Jpeg = "image/jpeg",
4276
- WebP = "image/webp",
4277
- Tga = "image/x-tga",
4278
- Wav = "audio/wav",
4279
- Mp4 = "video/mp4",
4280
- QuickTime = "video/quicktime",
4281
- Binary = "application/octet-stream",
4282
- Pdf = "application/pdf",
4283
- Zip = "application/zip"
4284
- }
4400
+ declare type MimeType_2 = (typeof MimeType_2)[keyof typeof MimeType_2];
4285
4401
  export { MimeType_2 as MimeType }
4286
4402
 
4287
4403
  /**
@@ -4986,6 +5102,16 @@ export declare type VerticalTextAlignment = 'Top' | 'Bottom' | 'Center';
4986
5102
  * @public
4987
5103
  */
4988
5104
  export declare type VideoExportOptions = {
5105
+ /**
5106
+ * The MIME type of the output video file.
5107
+ *
5108
+ * @defaultValue 'video/mp4'
5109
+ */
5110
+ mimeType?: VideoMimeType;
5111
+ /**
5112
+ * A callback which reports on the progress of the export.
5113
+ */
5114
+ onProgress?: (numberOfRenderedFrames: number, numberOfEncodedFrames: number, totalNumberOfFrames: number) => void;
4989
5115
  /**
4990
5116
  * Determines the encoder feature set and in turn the quality, size and speed of the encoding process.
4991
5117
  *
@@ -5046,6 +5172,9 @@ export declare type VideoExportOptions = {
5046
5172
  abortSignal?: AbortSignal;
5047
5173
  };
5048
5174
 
5175
+ /** @public */
5176
+ export declare type VideoMimeType = Extract<MimeType_2, 'video/mp4' | 'video/quicktime'>;
5177
+
5049
5178
  /**
5050
5179
  * Describes a rectangle on the screen
5051
5180
  * - `x` and `y` indicate the position