@cesdk/engine 1.8.0-alpha.3 → 1.8.0-alpha.4

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
@@ -359,6 +359,16 @@ declare interface AssetsQueryResult_2 {
359
359
  */
360
360
  export declare type BlendMode = 'PassThrough' | 'Normal' | 'Darken' | 'Multiply' | 'ColorBurn' | 'Lighten' | 'Screen' | 'ColorDodge' | 'Overlay' | 'SoftLight' | 'HardLight' | 'Difference' | 'Exclusion' | 'Hue' | 'Saturation' | 'Color' | 'Luminosity';
361
361
 
362
+ /**
363
+ * Holds Channels for the different properties of a block.
364
+ * Ensures that for each property, only one channel exists.
365
+ * @public
366
+ */
367
+ export declare class Block extends Entity {
368
+ effects: ReadWriteChannelSync<number[]>;
369
+
370
+ }
371
+
362
372
  /**
363
373
  * @public
364
374
  */
@@ -374,6 +384,18 @@ export declare class BlockAPI {
374
384
  * @returns A promise that resolves with the exported image or is rejected with an error.
375
385
  */
376
386
  export(handle: DesignBlockId, mimeType?: MimeType_2, options?: ExportOptions): Promise<Blob>;
387
+ /**
388
+ * Exports a design block element as a file of the given mime type.
389
+ * Performs an internal update to resolve the final layout for the blocks.
390
+ * @param handle - The design block element to export.
391
+ * @param mimeType - The mime type of the output file.
392
+ * @param maskColorR - The red component of the special color mask color.
393
+ * @param maskColorG - The green component of the special color mask color.
394
+ * @param maskColorB - The blue component of the special color mask color.
395
+ * @param options - The options for exporting the block type
396
+ * @returns A promise that resolves with an array of the exported image and mask or is rejected with an error.
397
+ */
398
+ exportWithColorMask(handle: DesignBlockId, mimeType: MimeType_2 | undefined, maskColorR: number, maskColorG: number, maskColorB: number, options?: ExportOptions): Promise<Blob[]>;
377
399
 
378
400
  /**
379
401
  * Loads existing blocks from the given string.
@@ -832,6 +854,20 @@ export declare class BlockAPI {
832
854
  * @returns The value of the property.
833
855
  */
834
856
  getFloat(id: DesignBlockId, property: string): number;
857
+ /**
858
+ * Set a double property of the given design block to the given value.
859
+ * @param id - The block whose property should be set.
860
+ * @param property - The name of the property to set.
861
+ * @param value - The value to set.
862
+ */
863
+ setDouble(id: DesignBlockId, property: string, value: number): void;
864
+ /**
865
+ * Get the value of a double property of the given design block.
866
+ * @param id - The block whose property should be queried.
867
+ * @param property - The name of the property to query.
868
+ * @returns The value of the property.
869
+ */
870
+ getDouble(id: DesignBlockId, property: string): number;
835
871
  /**
836
872
  * Set a string property of the given design block to the given value.
837
873
  * @param id - The block whose property should be set.
@@ -1606,6 +1642,141 @@ export declare class BlockAPI {
1606
1642
  * @returns whether the scope is allowed for the given block.
1607
1643
  */
1608
1644
  isAllowedByScope(id: DesignBlockId, key: string): boolean;
1645
+ /**
1646
+ * Returns whether the block has a duration property.
1647
+ * @param id - The block to query.
1648
+ * @returns true if the block has a duration property.
1649
+ */
1650
+ hasDuration(id: DesignBlockId): boolean;
1651
+ /**
1652
+ * Set the playback duration of the given block in seconds.
1653
+ * The duration defines for how long the block is active in the scene during playback.
1654
+ * The duration is ignored when the scene is not in "Video" mode.
1655
+ * @param id - The block whose duration should be changed.
1656
+ * @param duration - The new duration in seconds.
1657
+ */
1658
+ setDuration(id: DesignBlockId, duration: number): void;
1659
+ /**
1660
+ * Get the playback duration of the given block in seconds.
1661
+ * @param id - The block whose duration should be returned.
1662
+ * @returns The block's duration.
1663
+ */
1664
+ getDuration(id: DesignBlockId): number;
1665
+ /**
1666
+ * Returns whether the block has a time offset property.
1667
+ * @param id - The block to query.
1668
+ * @returns true, if the block has a time offset property.
1669
+ */
1670
+ hasTimeOffset(id: DesignBlockId): boolean;
1671
+ /**
1672
+ * Set the time offset of the given block in the scene.
1673
+ * The time offset defines the point in time at which this block is first active in the scene.
1674
+ * The time offset is not supported for page block or their children.
1675
+ * @param id - The block whose time offset should be changed.
1676
+ * @param offset - The new time offset in seconds.
1677
+ */
1678
+ setTimeOffset(id: DesignBlockId, offset: number): void;
1679
+ /**
1680
+ * Get the time offset of the given block in the scene.
1681
+ * @param id - The block whose time offset should be queried.
1682
+ * @returns the time offset of the block in the scene.
1683
+ */
1684
+ getTimeOffset(id: DesignBlockId): number;
1685
+ /**
1686
+ * Returns whether the block has trim properties.
1687
+ * @param id - The block to query.
1688
+ * @returns true, if the block has trim properties.
1689
+ */
1690
+ hasTrim(id: DesignBlockId): boolean;
1691
+ /**
1692
+ * Set the trim offset of the given block or fill.
1693
+ * Sets the relative time within the fill at which playback of the audio or video clip should begin.
1694
+ * This is a percentage value in the range [0, 1].
1695
+ * @param id - The block whose trim should be updated.
1696
+ * @param offset - The new trim offset.
1697
+ */
1698
+ setTrimOffset(id: DesignBlockId, offset: number): void;
1699
+ /**
1700
+ * Get the trim offset of this block.
1701
+ * @param id - The block whose trim offset should be queried.
1702
+ * @returns the trim offset.
1703
+ */
1704
+ getTrimOffset(id: DesignBlockId): number;
1705
+ /**
1706
+ * Set the trim length of the given block or fill.
1707
+ * The trim length is the percentage of the audio or video clip that should be used for playback.
1708
+ * @param id - The object whose trim length should be updated.
1709
+ * @param length - The new trim length as a percentage of the clip duration in the range [0, 1].
1710
+ */
1711
+ setTrimLength(id: DesignBlockId, length: number): void;
1712
+ /**
1713
+ * Get the trim length of the given block or fill.
1714
+ * @param id - The object whose trim length should be queried.
1715
+ * @returns the trim length of the object.
1716
+ */
1717
+ getTrimLength(id: DesignBlockId): number;
1718
+ /**
1719
+ * Returns the total duration (in seconds) of a scene in video mode.
1720
+ * The duration is defined by all blocks in the scene.
1721
+ * @param scene - The scene whose duration is being queried.
1722
+ * @returns the total scene duration.
1723
+ */
1724
+ getTotalSceneDuration(scene: DesignBlockId): number;
1725
+ /**
1726
+ * Set whether the block should be during active playback.
1727
+ * @param id - The block that should be updated.
1728
+ * @param enabled - Whether the block should be playing its contents.
1729
+ */
1730
+ setPlaying(id: DesignBlockId, enabled: boolean): void;
1731
+ /**
1732
+ * Returns whether the block is currently during active playback.
1733
+ * @param id - The block to query.
1734
+ * @returns whether the block is during playback.
1735
+ */
1736
+ isPlaying(id: DesignBlockId): boolean;
1737
+ /**
1738
+ * Returns whether the block has a playback time property.
1739
+ * @param id - The block to query.
1740
+ * @returns whether the block has a playback time property.
1741
+ */
1742
+ hasPlaybackTime(id: DesignBlockId): boolean;
1743
+ /**
1744
+ * Set the playback time of the given block.
1745
+ * @param id - The block whose playback time should be updated.
1746
+ * @param time - The new playback time of the block in seconds.
1747
+ */
1748
+ setPlaybackTime(id: DesignBlockId, time: number): void;
1749
+ /**
1750
+ * Get the playback time of the given block.
1751
+ * @param id - The block to query.
1752
+ * @returns the playback time of the block in seconds.
1753
+ */
1754
+ getPlaybackTime(id: DesignBlockId): number;
1755
+ /**
1756
+ * Set whether the given block or fill should play
1757
+ * its contents while the rest of the scene remains paused.
1758
+ * Setting this to true for one block will automatically set
1759
+ * it to false on all other blocks.
1760
+ * @param id - The block or fill to update.
1761
+ * @param enabled - Whether the block's playback should progress as time moves on.
1762
+ */
1763
+ setSoloPlaybackEnabled(id: DesignBlockId, enabled: boolean): void;
1764
+ /**
1765
+ * Return whether the given block or fill is currently set to play
1766
+ * its contents while the rest of the scene remains paused.
1767
+ * @param id - The block or fill to query.
1768
+ * @returns Whether solo playback is enabled for this block.
1769
+ */
1770
+ isSoloPlaybackEnabled(id: DesignBlockId): boolean;
1771
+ }
1772
+
1773
+ /**
1774
+ * This maintains a list of Blocks, ensuring that only one Block instance
1775
+ * exists per id.
1776
+ * @public
1777
+ */
1778
+ export declare class BlockChannels extends EntityChannels<Block> {
1779
+ getBlock(id: number): Block;
1609
1780
  }
1610
1781
 
1611
1782
  /** @public */
@@ -1632,6 +1803,33 @@ declare type Callbacks = {
1632
1803
  log?: Logger;
1633
1804
  };
1634
1805
 
1806
+ /**
1807
+ * A Channel represents a reactive data source consisting of three elements:
1808
+ *
1809
+ * * A `subscribe` method to register a callback for values coming from the
1810
+ * data source. Calling this method returns an `unsubscribe` method.
1811
+ * * An (optional) `update` method to update the data source
1812
+ * * An (optional) synchronous `value` method that can be used to retrieve
1813
+ * the current value or a sensible initial value without waiting for a
1814
+ * potentially asynchronous value coming through the stream.
1815
+ * @public
1816
+ */
1817
+ export declare interface Channel<Out, In = Out> {
1818
+ subscribe: Source<Out>;
1819
+ update?: (v: In) => void;
1820
+ value?: () => Out;
1821
+ }
1822
+
1823
+ /**
1824
+ * A {@link Channel} that is guaranteed to have a `value`
1825
+ * @public
1826
+ */
1827
+ export declare interface ChannelSync<Out, In = Out> extends Channel<Out, In> {
1828
+ subscribe: Source<Out>;
1829
+ update?: (v: In) => void;
1830
+ value: () => Out;
1831
+ }
1832
+
1635
1833
  /**
1636
1834
  * All components between 0 and 1
1637
1835
  * @public
@@ -1997,6 +2195,48 @@ export declare class EditorAPI {
1997
2195
  getGlobalScope(key: string): 'Allow' | 'Deny' | 'Defer';
1998
2196
  }
1999
2197
 
2198
+ /**
2199
+ * Holds Channels for the different properties of an effect.
2200
+ * Ensures that for each property, only one channel exists.
2201
+ * @public
2202
+ */
2203
+ export declare class Effect extends Entity {
2204
+ enabled: ReadWriteChannelSync<boolean>;
2205
+
2206
+ }
2207
+
2208
+ /**
2209
+ * This maintains a list of Effects, ensuring that only one Block instance
2210
+ * exists per id.
2211
+ * @public
2212
+ */
2213
+ export declare class EffectChannels extends EntityChannels<Effect> {
2214
+ getEffect(id: number): Effect;
2215
+ }
2216
+
2217
+ /**
2218
+ * @public
2219
+ */
2220
+ export declare class Entity {
2221
+ #private;
2222
+
2223
+
2224
+
2225
+ get id(): number;
2226
+ Int(property: string): ReadWriteChannelSync<number>;
2227
+ Float(property: string): ReadWriteChannelSync<number>;
2228
+ }
2229
+
2230
+ /** @public */
2231
+ export declare class EntityChannels<T extends Entity> {
2232
+ #private;
2233
+
2234
+
2235
+
2236
+ constant<V>(constantValue: V): ReadWriteChannelSync<V>;
2237
+ dispose(): void;
2238
+ }
2239
+
2000
2240
  /**
2001
2241
  * @public
2002
2242
  */
@@ -2140,6 +2380,12 @@ export declare type GradientType = 'Linear' | 'Radial' | 'Conical';
2140
2380
  */
2141
2381
  declare type Groups = string[];
2142
2382
 
2383
+ /**
2384
+ * Will be called by a stream whenever a new value is available.
2385
+ * @public
2386
+ */
2387
+ declare type Handler<T> = (v: T) => void;
2388
+
2143
2389
  /**
2144
2390
  * A hexadecimal color value (RGB or RGBA) that starts with a '#'
2145
2391
  * @example #6686FF or #6686FFFF
@@ -2273,7 +2519,7 @@ declare type Presets = {
2273
2519
  };
2274
2520
 
2275
2521
  /** @public */
2276
- export declare type PropertyType = 'Bool' | 'Int' | 'Float' | 'String' | 'Color' | 'Enum' | 'Struct';
2522
+ export declare type PropertyType = 'Bool' | 'Int' | 'Float' | 'String' | 'Color' | 'Enum' | 'Struct' | 'Double';
2277
2523
 
2278
2524
  /** @public */
2279
2525
  declare interface QueryData {
@@ -2290,6 +2536,26 @@ declare interface QueryData {
2290
2536
  page: number;
2291
2537
  }
2292
2538
 
2539
+ /**
2540
+ * A {@link Channel} that is guaranteed to have an `update` method.
2541
+ * @public
2542
+ */
2543
+ export declare interface ReadWriteChannel<Out, In = Out> extends Channel<Out, In> {
2544
+ subscribe: Source<Out>;
2545
+ update: (v: In) => void;
2546
+ value?: () => Out;
2547
+ }
2548
+
2549
+ /**
2550
+ * A {@link ReadWriteChannel} that is guaranteed to have a `value`
2551
+ * @public
2552
+ */
2553
+ export declare interface ReadWriteChannelSync<Out, In = Out> extends ChannelSync<Out, In>, ReadWriteChannel<Out, In> {
2554
+ subscribe: Source<Out>;
2555
+ update: (v: In) => void;
2556
+ value: () => Out;
2557
+ }
2558
+
2293
2559
  /**
2294
2560
  * Dispatched on the engine canvas right before the engine will refocus its text
2295
2561
  * input after a blur. Call `preventDefault()` to prevent the refocusing.
@@ -2337,7 +2603,6 @@ export declare type RoleString = 'Creator' | 'Adopter' | 'Viewer' | 'Presenter';
2337
2603
  * @public
2338
2604
  */
2339
2605
  declare type Scene = {
2340
- maskSpotColor?: SpotColor;
2341
2606
  /**
2342
2607
  * The DPI value to use when exporting and when converting between pixels and inches or millimeter units.
2343
2608
  * (In the CESDK, this value is synonymous with PPI).
@@ -2479,6 +2744,17 @@ export declare interface Size2 {
2479
2744
  */
2480
2745
  export declare type SizeMode = 'Absolute' | 'Percent' | 'Auto';
2481
2746
 
2747
+ /**
2748
+ * A stream source.
2749
+ *
2750
+ * This is an ordinary function. Pass a handler to have that handler called by
2751
+ * the source whenever a new value is available.
2752
+ *
2753
+ * Returns a function that unsubscribes the handler from the source
2754
+ * @public
2755
+ */
2756
+ declare type Source<T> = (handler: Handler<T>) => UnsubscribeFn;
2757
+
2482
2758
  /** @public */
2483
2759
  export declare interface SpotColor {
2484
2760
  name: string;
@@ -2515,6 +2791,12 @@ declare type TypefaceDefinition = Preset & {
2515
2791
  }[];
2516
2792
  };
2517
2793
 
2794
+ /**
2795
+ * Invoke to unsubscribe from a stream.
2796
+ * @public
2797
+ */
2798
+ declare type UnsubscribeFn = () => void;
2799
+
2518
2800
  /**
2519
2801
  * @public
2520
2802
  */