@cesdk/node 1.54.0-nightly.20250610 → 1.54.0-nightly.20250613
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/assets/core/{cesdk-v1.54.0-nightly.20250610-FECP2KER.wasm → cesdk-v1.54.0-nightly.20250613-2Z7N7J4S.wasm} +0 -0
- package/example.js +1 -3
- package/index.d.ts +144 -22
- package/index.js +1 -1
- package/package.json +1 -1
- /package/assets/core/{cesdk-v1.54.0-nightly.20250610-44YCFRT6.data → cesdk-v1.54.0-nightly.20250613-44YCFRT6.data} +0 -0
|
Binary file
|
package/example.js
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
const fs = require('fs/promises');
|
|
4
4
|
const CreativeEngine = require('./index.js');
|
|
5
5
|
|
|
6
|
-
const { MimeType } = CreativeEngine;
|
|
7
|
-
|
|
8
6
|
const license = process.env.CESDK_LICENSE;
|
|
9
7
|
|
|
10
8
|
CreativeEngine.init({ license }).then(async (engine) => {
|
|
@@ -15,7 +13,7 @@ CreativeEngine.init({ license }).then(async (engine) => {
|
|
|
15
13
|
.then(() => {
|
|
16
14
|
console.log('Scene loaded, exporting page');
|
|
17
15
|
const [page] = engine.block.findByType('page');
|
|
18
|
-
return engine.block.export(page,
|
|
16
|
+
return engine.block.export(page, { mimeType: 'image/png' });
|
|
19
17
|
})
|
|
20
18
|
.then((blob) => blob.arrayBuffer())
|
|
21
19
|
.then((arrayBuffer) => {
|
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?:
|
|
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:
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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.
|
|
@@ -3931,6 +4025,12 @@ declare interface ExportAudioOptions {
|
|
|
3931
4025
|
* @public
|
|
3932
4026
|
*/
|
|
3933
4027
|
export declare type ExportOptions = {
|
|
4028
|
+
/**
|
|
4029
|
+
* The MIME type of the output file.
|
|
4030
|
+
*
|
|
4031
|
+
* @defaultValue 'image/png'
|
|
4032
|
+
*/
|
|
4033
|
+
mimeType?: ImageMimeType | Exclude<ApplicationMimeType, 'application/zip'>;
|
|
3934
4034
|
/**
|
|
3935
4035
|
* The PNG compression level to use, when exporting to PNG.
|
|
3936
4036
|
*
|
|
@@ -4117,6 +4217,9 @@ export declare type HorizontalBlockAlignment = 'Left' | 'Right' | 'Center';
|
|
|
4117
4217
|
*/
|
|
4118
4218
|
export declare type HorizontalTextAlignment = 'Left' | 'Right' | 'Center';
|
|
4119
4219
|
|
|
4220
|
+
/** @public */
|
|
4221
|
+
export declare type ImageMimeType = Extract<MimeType_2, 'image/png' | 'image/jpeg' | 'image/webp' | 'image/x-tga'>;
|
|
4222
|
+
|
|
4120
4223
|
/**
|
|
4121
4224
|
* Type guard for {@link CMYKColor}
|
|
4122
4225
|
* @public
|
|
@@ -4160,19 +4263,25 @@ export declare const LogLevel: {
|
|
|
4160
4263
|
readonly Error: "Error";
|
|
4161
4264
|
};
|
|
4162
4265
|
|
|
4266
|
+
/**
|
|
4267
|
+
* @public
|
|
4268
|
+
* @deprecated Use The `MimeType` string literal types instead.
|
|
4269
|
+
* */
|
|
4270
|
+
declare const MimeType_2: {
|
|
4271
|
+
readonly Png: "image/png";
|
|
4272
|
+
readonly Jpeg: "image/jpeg";
|
|
4273
|
+
readonly WebP: "image/webp";
|
|
4274
|
+
readonly Tga: "image/x-tga";
|
|
4275
|
+
readonly Wav: "audio/wav";
|
|
4276
|
+
readonly Mp4: "video/mp4";
|
|
4277
|
+
readonly QuickTime: "video/quicktime";
|
|
4278
|
+
readonly Binary: "application/octet-stream";
|
|
4279
|
+
readonly Pdf: "application/pdf";
|
|
4280
|
+
readonly Zip: "application/zip";
|
|
4281
|
+
};
|
|
4282
|
+
|
|
4163
4283
|
/** @public */
|
|
4164
|
-
declare
|
|
4165
|
-
Png = "image/png",
|
|
4166
|
-
Jpeg = "image/jpeg",
|
|
4167
|
-
WebP = "image/webp",
|
|
4168
|
-
Tga = "image/x-tga",
|
|
4169
|
-
Wav = "audio/wav",
|
|
4170
|
-
Mp4 = "video/mp4",
|
|
4171
|
-
QuickTime = "video/quicktime",
|
|
4172
|
-
Binary = "application/octet-stream",
|
|
4173
|
-
Pdf = "application/pdf",
|
|
4174
|
-
Zip = "application/zip"
|
|
4175
|
-
}
|
|
4284
|
+
declare type MimeType_2 = (typeof MimeType_2)[keyof typeof MimeType_2];
|
|
4176
4285
|
export { MimeType_2 as MimeType }
|
|
4177
4286
|
|
|
4178
4287
|
/**
|
|
@@ -4757,6 +4866,16 @@ export declare type VerticalTextAlignment = 'Top' | 'Bottom' | 'Center';
|
|
|
4757
4866
|
* @public
|
|
4758
4867
|
*/
|
|
4759
4868
|
export declare type VideoExportOptions = {
|
|
4869
|
+
/**
|
|
4870
|
+
* The MIME type of the output video file.
|
|
4871
|
+
*
|
|
4872
|
+
* @defaultValue 'video/mp4'
|
|
4873
|
+
*/
|
|
4874
|
+
mimeType?: VideoMimeType;
|
|
4875
|
+
/**
|
|
4876
|
+
* A callback which reports on the progress of the export.
|
|
4877
|
+
*/
|
|
4878
|
+
onProgress?: (numberOfRenderedFrames: number, numberOfEncodedFrames: number, totalNumberOfFrames: number) => void;
|
|
4760
4879
|
/**
|
|
4761
4880
|
* Determines the encoder feature set and in turn the quality, size and speed of the encoding process.
|
|
4762
4881
|
*
|
|
@@ -4817,6 +4936,9 @@ export declare type VideoExportOptions = {
|
|
|
4817
4936
|
abortSignal?: AbortSignal;
|
|
4818
4937
|
};
|
|
4819
4938
|
|
|
4939
|
+
/** @public */
|
|
4940
|
+
export declare type VideoMimeType = Extract<MimeType_2, 'video/mp4' | 'video/quicktime'>;
|
|
4941
|
+
|
|
4820
4942
|
/**
|
|
4821
4943
|
* Describes a rectangle on the screen
|
|
4822
4944
|
* - `x` and `y` indicate the position
|