@cesdk/engine 1.10.0-preview.0 → 1.10.0-preview.1

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
@@ -105,7 +105,6 @@ export declare class AssetAPI {
105
105
  */
106
106
  removeAssetFromSource(sourceId: string, assetId: string): void;
107
107
 
108
-
109
108
  /**
110
109
  * Apply an asset result to the active scene.
111
110
  * The default behavior will instantiate a block and configure it according to the asset's properties.
@@ -312,10 +311,8 @@ export declare interface AssetSource {
312
311
  addAsset?(asset: AssetDefinition): void;
313
312
  /**
314
313
  * Removes the given asset from this source.
315
- *
316
- * @returns true if asset was found and removed, and false otherwise
317
314
  */
318
- removeAsset?(assetId: string): Promise<boolean>;
315
+ removeAsset?(assetId: string): void;
319
316
  /**
320
317
  * Generates a list of supported mime types for this source.
321
318
  *
@@ -418,6 +415,7 @@ export declare type BlendMode = 'PassThrough' | 'Normal' | 'Darken' | 'Multiply'
418
415
  */
419
416
  export declare class Block extends Entity {
420
417
  #private;
418
+ get type(): DesignBlockType;
421
419
  effects: ReadWriteChannelSync<number[]>;
422
420
  blur: ReadWriteChannelSync<number>;
423
421
  isBlurEnabled: ReadWriteChannelSync<boolean>;
@@ -442,6 +440,7 @@ export declare class Block extends Entity {
442
440
  height: ReadWriteChannelSync<number>;
443
441
  dimensions: ReadWriteChannelSync<Vec2>;
444
442
  contentFillMode: ReadWriteChannelSync<ContentFillMode>;
443
+ blendMode: ReadWriteChannelSync<BlendMode>;
445
444
  designStyleScope: ReadWriteChannelSync<boolean>;
446
445
  designArrangeScope: ReadWriteChannelSync<boolean>;
447
446
  designArrangeScopeMove: ReadWriteChannelSync<boolean>;
@@ -457,6 +456,12 @@ export declare class Block extends Entity {
457
456
  editorManagePagesScope: ReadWriteChannelSync<boolean>;
458
457
  editorSelectScope: ReadWriteChannelSync<boolean>;
459
458
  editorZoomScope: ReadWriteChannelSync<boolean>;
459
+ boundingBox: ReadOnlyChannelSync<{
460
+ x: number;
461
+ y: number;
462
+ width: number;
463
+ height: number;
464
+ }>;
460
465
 
461
466
 
462
467
  }
@@ -701,6 +706,46 @@ export declare class BlockAPI {
701
706
  * @param mode - The y position mode: absolute, percent or undefined.
702
707
  */
703
708
  setPositionYMode(id: DesignBlockId, mode: PositionMode): void;
709
+ /**
710
+ * Update the block's always-on-top property. If true, this blocks's global sorting order is automatically
711
+ * adjusted to be higher than all other siblings
712
+ * without this property. If more than one block is set to be always-on-top, the child order decides which is on top.
713
+ *
714
+ * @param id - the block to update.
715
+ * @param enabled - whether the block shall be always-on-top.
716
+ */
717
+ setAlwaysOnTop(id: DesignBlockId, enabled: boolean): void;
718
+ /**
719
+ * Query a block's always-on-top property.
720
+ *
721
+ * @param id - the block to query.
722
+ * @returns true if the block is set to be always-on-top, false otherwise.
723
+ */
724
+ isAlwaysOnTop(id: DesignBlockId): boolean;
725
+ /**
726
+ * Updates the sorting order of this block and all of its manually created siblings
727
+ * so that the given block has the highest sorting order.
728
+ * @param id - The id of the block to be given the highest sorting order among its siblings.
729
+ */
730
+ bringToFront(id: DesignBlockId): void;
731
+ /**
732
+ * Updates the sorting order of this block and all of its manually created siblings
733
+ * so that the given block has the lowest sorting order.
734
+ * @param id - The id of the block to be given the lowest sorting order among its siblings.
735
+ */
736
+ sendToBack(id: DesignBlockId): void;
737
+ /**
738
+ * Updates the sorting order of this block and all of its superjacent siblings
739
+ * so that the given block has a higher sorting order than the next superjacent sibling.
740
+ * @param id - The id of the block to be given a higher sorting than the next superjacent sibling.
741
+ */
742
+ bringForward(id: DesignBlockId): void;
743
+ /**
744
+ * Updates the sorting order of this block and all of its manually created and subjacent siblings
745
+ * so that the given block will have a lower sorting order than the next subjacent sibling.
746
+ * @param id - The id of the block to be given a lower sorting order than the next subjacent sibling.
747
+ */
748
+ sendBackward(id: DesignBlockId): void;
704
749
  /**
705
750
  * Query a block's rotation in radians.
706
751
  * @param id - The block to query.
@@ -767,12 +812,6 @@ export declare class BlockAPI {
767
812
  * @returns The current mode for the height: absolute, percent or auto.
768
813
  */
769
814
  getHeightMode(id: DesignBlockId): SizeMode;
770
- /**
771
- * Query a block's content fill mode.
772
- * @param id - The block to query.
773
- * @returns The current mode: crop, cover or contain.
774
- */
775
- getContentFillMode(id: DesignBlockId): ContentFillMode;
776
815
  /**
777
816
  * Update a block's width.
778
817
  * @param id - The block to update.
@@ -797,12 +836,6 @@ export declare class BlockAPI {
797
836
  * @param mode - The height mode: absolute, percent or auto.
798
837
  */
799
838
  setHeightMode(id: DesignBlockId, mode: SizeMode): void;
800
- /**
801
- * Set a block's content fill mode.
802
- * @param id - The block to update.
803
- * @param mode - The content fill mode mode: crop, cover or contain.
804
- */
805
- setContentFillMode(id: DesignBlockId, mode: ContentFillMode): void;
806
839
  /**
807
840
  * Get a block's layout position on the x-axis. The position is only available after an
808
841
  * internal update loop which only occurs if the `features/implicitUpdatesEnabled` setting is set.
@@ -831,6 +864,18 @@ export declare class BlockAPI {
831
864
  * @returns The layout height.
832
865
  */
833
866
  getFrameHeight(id: DesignBlockId): number;
867
+ /**
868
+ * Set a block's content fill mode.
869
+ * @param id - The block to update.
870
+ * @param mode - The content fill mode mode: crop, cover or contain.
871
+ */
872
+ setContentFillMode(id: DesignBlockId, mode: ContentFillMode): void;
873
+ /**
874
+ * Query a block's content fill mode.
875
+ * @param id - The block to query.
876
+ * @returns The current mode: crop, cover or contain.
877
+ */
878
+ getContentFillMode(id: DesignBlockId): ContentFillMode;
834
879
  /**
835
880
  * Duplicates a block including its children.
836
881
  * @param id - The block to duplicate.
@@ -909,6 +954,12 @@ export declare class BlockAPI {
909
954
  * @returns float The height of the axis-aligned bounding box.
910
955
  */
911
956
  getGlobalBoundingBoxHeight(id: DesignBlockId): number;
957
+ /**
958
+ * Get the position and size of the axis-aligned bounding box for the given blocks in screen space.
959
+ * @param ids - The block to query.
960
+ * @returns The position and size of the bounding box.
961
+ */
962
+ getScreenSpaceBoundingBoxXYWH(ids: DesignBlockId[]): XYWH;
912
963
  /**
913
964
  * Scales the block and all of its children proportionally around the specified
914
965
  * relative anchor point.
@@ -2067,6 +2118,15 @@ declare type Callbacks = {
2067
2118
  log?: Logger;
2068
2119
  };
2069
2120
 
2121
+ declare type CameraSettings = {
2122
+ /** Horizontal resolution in physical pixels */
2123
+ width: number;
2124
+ /** Vertical resolution in physical pixels */
2125
+ height: number;
2126
+ /** Physical pixels per CSS pixel */
2127
+ pixelRatio: number;
2128
+ };
2129
+
2070
2130
  /**
2071
2131
  * A Channel represents a reactive data source consisting of three elements:
2072
2132
  *
@@ -2216,6 +2276,7 @@ declare class CreativeEngine {
2216
2276
  scene: SceneAPI;
2217
2277
  variable: VariableAPI;
2218
2278
 
2279
+
2219
2280
  get element(): HTMLCreativeEngineCanvasElement | undefined;
2220
2281
  /**
2221
2282
  * Dispose the engine.
@@ -2233,6 +2294,8 @@ declare class CreativeEngine {
2233
2294
  } : {
2234
2295
  readonly element: HTMLCreativeEngineCanvasElement;
2235
2296
  })>;
2297
+
2298
+
2236
2299
  }
2237
2300
  export default CreativeEngine;
2238
2301
 
@@ -2892,6 +2955,24 @@ declare interface QueryData {
2892
2955
  page: number;
2893
2956
  }
2894
2957
 
2958
+ /**
2959
+ * A Read only {@link Channel}
2960
+ * @public
2961
+ */
2962
+ export declare interface ReadOnlyChannel<Out> extends Omit<Channel<Out>, 'update'> {
2963
+ subscribe: Source<Out>;
2964
+ value?: () => Out;
2965
+ }
2966
+
2967
+ /**
2968
+ * A {@link ReadOnlyChannel} that is guaranteed to have a `value`
2969
+ * @public
2970
+ */
2971
+ export declare interface ReadOnlyChannelSync<Out> extends Omit<ChannelSync<Out>, 'update'>, ReadOnlyChannel<Out> {
2972
+ subscribe: Source<Out>;
2973
+ value: () => Out;
2974
+ }
2975
+
2895
2976
  /**
2896
2977
  * A {@link Channel} that is guaranteed to have an `update` method.
2897
2978
  * @public
@@ -2960,7 +3041,7 @@ export declare type RoleString = 'Creator' | 'Adopter' | 'Viewer' | 'Presenter';
2960
3041
  * @public
2961
3042
  */
2962
3043
  export declare class Scene {
2963
- constructor(ubq: UBQ, blockChannels: BlockChannels);
3044
+
2964
3045
  /**
2965
3046
  * A channel containing the latest Block.
2966
3047
  * Will emit an event when the scene changes
@@ -2968,10 +3049,10 @@ export declare class Scene {
2968
3049
  block: ChannelSync<Block | undefined>;
2969
3050
  mode: ChannelSync<SceneMode | undefined>;
2970
3051
  totalDuration: ChannelSync<number>;
2971
- pages: ChannelSync<DesignBlockId[]> & EngineChannel<DesignBlockId[]>;
3052
+ pages: ChannelSync<DesignBlockId[]>;
2972
3053
  playing: ReadWriteChannelSync<boolean>;
2973
3054
  playbackTime: ReadWriteChannelSync<number>;
2974
- pageDurations: ChannelSync<PageDuration[]> & EngineChannel<PageDuration[]>;
3055
+ pageDurations: ChannelSync<PageDuration[]>;
2975
3056
  }
2976
3057
 
2977
3058
  /**
@@ -3108,6 +3189,47 @@ export declare class SceneAPI {
3108
3189
  * @returns A promise that resolves once the zoom was set or rejects with an error otherwise.
3109
3190
  */
3110
3191
  zoomToBlock(id: DesignBlockId, paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): Promise<void>;
3192
+ /**
3193
+ * Continually adjusts the zoom level to fit the width or height of a block's axis-aligned bounding box.
3194
+ * Only has an effect if the zoom level is not handled by the UI.
3195
+ * Without padding, this results in a tight view on the block.
3196
+ * No more than one block per scene can have zoom auto-fit enabled.
3197
+ * Calling `setZoomLevel` or `zoomToBlock` disables the continuous adjustment.
3198
+ *
3199
+ * @param id - The block for which the zoom is adjusted.
3200
+ * @param axis - The block axis for which the zoom is adjusted.
3201
+ * @param paddingBefore - Optional padding in screen pixels before the block.
3202
+ * @param paddingAfter - Optional padding in screen pixels after the block.
3203
+ */
3204
+ enableZoomAutoFit(id: DesignBlockId, axis: 'Horizontal' | 'Vertical', paddingBefore?: number, paddingAfter?: number): void;
3205
+ /**
3206
+ * Continually adjusts the zoom level to fit the width or height of a block's axis-aligned bounding box.
3207
+ * Only has an effect if the zoom level is not handled by the UI.
3208
+ * Without padding, this results in a tight view on the block.
3209
+ * Calling `setZoomLevel` or `zoomToBlock` disables the continuous adjustment.
3210
+ *
3211
+ * @param id - The block for which the zoom is adjusted.
3212
+ * @param axis - The block axis for which the zoom is adjusted.
3213
+ * @param paddingLeft - Optional padding in screen pixels to the left of the block.
3214
+ * @param paddingTop - Optional padding in screen pixels to the top of the block.
3215
+ * @param paddingRight - Optional padding in screen pixels to the right of the block.
3216
+ * @param paddingBottom - Optional padding in screen pixels to the bottom of the block.
3217
+ */
3218
+ enableZoomAutoFit(id: DesignBlockId, axis: 'Both', paddingLeft?: number, paddingTop?: number, paddingRight?: number, paddingBottom?: number): void;
3219
+ /**
3220
+ * Disables any previously set zoom auto-fit.
3221
+ *
3222
+ * @param blockOrScene - The scene or a block in the scene for which to disable a zoom auto-fit.
3223
+ */
3224
+ disableZoomAutoFit(blockOrScene: DesignBlockId): void;
3225
+ /**
3226
+ * Queries whether zoom auto-fit is enabled.
3227
+ *
3228
+ * @param blockOrScene - The scene or a block in the scene for which to disable a zoom auto-fit.
3229
+ * @returns True if the given block has auto-fit set or the scene contains a block for which auto-fit is set, false
3230
+ * otherwise.
3231
+ */
3232
+ isZoomAutoFitEnabled(blockOrScene: DesignBlockId): boolean;
3111
3233
  /**
3112
3234
  * Subscribe to changes to the zoom level.
3113
3235
  * @param callback - This function is called at the end of the engine update, if the zoom level has changed.
@@ -3154,6 +3276,7 @@ export declare class SelectionChannel implements ReadWriteChannelSync<number[]>
3154
3276
  subscribe: Source<number[]>;
3155
3277
  update: (selectedDesignElements: number[]) => void;
3156
3278
  value: () => number[];
3279
+ blocks: ChannelSync<Block[]>;
3157
3280
 
3158
3281
  private deselectAll;
3159
3282
  private selectAll;
@@ -3208,6 +3331,12 @@ export declare type StrokeStyle = 'Dashed' | 'DashedRound' | 'Dotted' | 'LongDas
3208
3331
  /** @public */
3209
3332
  declare type Subscription = number;
3210
3333
 
3334
+ /**
3335
+ * Checks if the current browser supports necessary technologies to match our supported browsers
3336
+ * @public
3337
+ */
3338
+ export declare function supportsBrowser(): boolean;
3339
+
3211
3340
  /**
3212
3341
  * Checks if the current browser supports video editing
3213
3342
  * @public
@@ -3305,14 +3434,14 @@ export declare interface Vec4 {
3305
3434
  }
3306
3435
 
3307
3436
  /**
3308
- * This channel allows to subscribe/update the current zoom level of the camera.
3437
+ * Describes a rectangle on the screen
3438
+ * - `x` and `y` indicate the position
3439
+ * - `w` and `h` indicate the width and height
3309
3440
  * @public
3310
3441
  */
3311
- export declare class ZoomLevelChannel implements ReadWriteChannelSync<number> {
3312
- subscribe: Source<number>;
3313
- update: (zoomLevel: number) => void;
3314
- value: () => number;
3442
+ export declare type XYWH = [x: number, y: number, w: number, h: number];
3315
3443
 
3316
- }
3444
+ /** @public */
3445
+ export declare type ZoomAutoFitAxis = 'Horizontal' | 'Vertical' | 'Both';
3317
3446
 
3318
3447
  export { }