@cesdk/cesdk-js 1.28.0 → 1.29.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
@@ -622,13 +622,30 @@ export declare class BlockAPI {
622
622
  * @returns A promise that resolves with a list of handles representing the found blocks or an error.
623
623
  */
624
624
  loadFromString(content: string): Promise<DesignBlockId[]>;
625
+ /**
626
+ * Loads existing blocks from the given URL.
627
+ * The blocks are not attached by default and won't be visible until attached to a page or the scene.
628
+ * The UUID of the loaded blocks is replaced with a new one.
629
+ * @param url - The URL to load the blocks from.
630
+ * @returns A promise that resolves with a list of handles representing the found blocks or an error.
631
+ */
632
+ loadFromArchiveURL(url: string): Promise<DesignBlockId[]>;
625
633
  /**
626
634
  * Saves the given blocks into a string. If given the root of a block hierarchy, e.g. a
627
635
  * page with multiple children, the entire hierarchy is saved.
628
636
  * @param blocks - The blocks to save
629
637
  * @returns A promise that resolves to a string representing the blocks or an error.
630
638
  */
631
- saveToString(blocks: DesignBlockId[]): Promise<string>;
639
+ saveToString(blocks: DesignBlockId[], allowedResourceSchemes?: string[]): Promise<string>;
640
+ /**
641
+ * Saves the given blocks and all of their referenced assets into an archive.
642
+ * The archive contains all assets that were accessible when this function was called.
643
+ * Blocks in the archived scene reference assets relative from to the location of the scene
644
+ * file. These references are resolved when loading such a scene via `loadSceneFromURL`.
645
+ * @param blocks - The blocks to save
646
+ * @returns A promise that resolves with a Blob on success or an error on failure.
647
+ */
648
+ saveToArchive(blocks: DesignBlockId[]): Promise<Blob>;
632
649
  /**
633
650
  * Create a new block, fails if type is unknown.
634
651
  * @param type - The type of the block that shall be created.
@@ -2722,6 +2739,12 @@ export declare type BlurTypeShorthand = 'uniform' | 'linear' | 'mirrored' | 'rad
2722
2739
  */
2723
2740
  export declare type BooleanOperation = 'Difference' | 'Intersection' | 'Union' | 'XOR';
2724
2741
 
2742
+ /** @public */
2743
+ export declare interface Buffer {
2744
+ handle: string;
2745
+ buffer: Uint8Array;
2746
+ }
2747
+
2725
2748
  /**
2726
2749
  * Interface for all available builder. Depending on the context different
2727
2750
  * implementation might be used. A "Button" in the canvas menu might render
@@ -2770,6 +2793,7 @@ declare type Callbacks = {
2770
2793
  onShare?: (s: string) => void | Promise<void>;
2771
2794
  onSave?: (s: string) => void | Promise<void>;
2772
2795
  onLoad?: (() => Promise<string>) | 'upload';
2796
+ onLoadArchive?: (() => Promise<string>) | 'uploadArchive';
2773
2797
  onDownload?: ((s: string) => void | Promise<void>) | 'download';
2774
2798
  onExport?: ((blobs: Blob[], options: ExportOptions) => void | Promise<void>) | 'download';
2775
2799
  onUpload?: OnUploadCallback | 'local' | (Partial<OnUploadOptions> & {
@@ -3783,6 +3807,8 @@ export declare class EditorAPI {
3783
3807
  * @returns The length of the buffer in bytes.
3784
3808
  */
3785
3809
  getBufferLength(uri: string): number;
3810
+
3811
+
3786
3812
  }
3787
3813
 
3788
3814
  /** @public */
@@ -4470,7 +4496,7 @@ declare enum NavigationPosition {
4470
4496
  }
4471
4497
 
4472
4498
  declare interface Notification_2 {
4473
- type?: NotificationType;
4499
+ type?: NotificationType_2;
4474
4500
  message: string;
4475
4501
  duration?: NotificationDuration;
4476
4502
  onDismiss?: () => void;
@@ -4484,7 +4510,7 @@ declare interface Notification_2 {
4484
4510
 
4485
4511
  declare type NotificationDuration = number | 'infinite' | 'short' | 'medium' | 'long';
4486
4512
 
4487
- declare type NotificationType = 'success' | 'error' | 'info' | 'warning' | 'loading';
4513
+ declare type NotificationType_2 = 'success' | 'error' | 'info' | 'warning' | 'loading';
4488
4514
 
4489
4515
  declare interface NumberInputOptions extends InputOptions<number> {
4490
4516
  }
@@ -4739,7 +4765,10 @@ export declare interface _RequiredConfiguration extends Omit<_EngineConfiguratio
4739
4765
  */
4740
4766
  export declare interface _RequiredCreateConfiguration extends Omit<_RequiredConfiguration, 'initialSceneMode' | 'initialSceneString' | 'initialSceneURL' | 'initialImageURL' | 'page' | 'scene' | 'assetSources' | 'variables' | 'presets' | 'callbacks'> {
4741
4767
  callbacks: Callbacks;
4742
- presets: _RequiredConfiguration['presets'];
4768
+ /**
4769
+ * @deprecated This config key is not used anymore and will be removed.
4770
+ */
4771
+ presets: Pick<_RequiredConfiguration['presets'], 'typefaces'>;
4743
4772
  }
4744
4773
 
4745
4774
  /**
@@ -4804,11 +4833,19 @@ export declare class SceneAPI {
4804
4833
  * @returns scene A promise that resolves once the scene was loaded or rejects with an error otherwise.
4805
4834
  */
4806
4835
  loadFromURL(url: string): Promise<DesignBlockId>;
4836
+ /**
4837
+ * Load a previously archived scene from the URL to the scene file.
4838
+ * The scene file will be fetched asynchronously by the engine. This requires continuous `render`
4839
+ * calls on this engines instance.
4840
+ * @param url - The URL of the scene file.
4841
+ * @returns scene A promise that resolves once the scene was loaded or rejects with an error otherwise.
4842
+ */
4843
+ loadFromArchiveURL(url: string): Promise<DesignBlockId>;
4807
4844
  /**
4808
4845
  * Serializes the current scene into a string. Selection is discarded.
4809
4846
  * @returns A promise that resolves with a string on success or an error on failure.
4810
4847
  */
4811
- saveToString(): Promise<string>;
4848
+ saveToString(allowedResourceSchemes?: string[]): Promise<string>;
4812
4849
  /**
4813
4850
  * Saves the current scene and all of its referenced assets into an archive.
4814
4851
  * The archive contains all assets, that were accessible when this function was called.
@@ -5465,6 +5502,34 @@ declare class UserInterfaceAPI {
5465
5502
  * be replaced or even removed completely in future versions.
5466
5503
  */
5467
5504
  unstable_getDockOrder(orderContext?: OrderContext): string[];
5505
+ /**
5506
+ * Defines in what order components are rendered in the inspector bar. The
5507
+ * id in this order refer to registered default components or custom components
5508
+ * registered in `unstable_registerComponent`.
5509
+ *
5510
+ * Different orders can be set depending on different contexts. The context
5511
+ * consists of the edit mode (e.g. `Transform` or `Text`) right now. If no
5512
+ * context is given, the default order is set for the `Transform` edit mode.
5513
+ *
5514
+ * Please be aware that this is experimental right now. This API can change or
5515
+ * be replaced or even removed completely in future versions.
5516
+ */
5517
+ unstable_setInspectorBarOrder(inspectorBarOrder: string[], orderContext?: OrderContext): void;
5518
+ /**
5519
+ * Returns the current order of components that are rendered in the inspector bar.
5520
+ *
5521
+ * The id in this order refer to registered default components or custom components
5522
+ * registered in `unstable_registerComponent`.
5523
+ *
5524
+ * Different orders could have been set depending on different contexts.
5525
+ * The context consists of the edit mode (e.g. `Transform` or `Text`) right now.
5526
+ * If no context is given, the default order (with `Transform` edit mode) is
5527
+ * returned.
5528
+ *
5529
+ * Please be aware that this is experimental right now. This API can change or
5530
+ * be replaced or even removed completely in future versions.
5531
+ */
5532
+ unstable_getInspectorBarOrder(orderContext?: OrderContext): string[];
5468
5533
  /**
5469
5534
  * Defines what in what order components are rendered in the canvas menu. The
5470
5535
  * id in this order refer to registered default components or custom components