@cesdk/engine 1.8.0-alpha.2 → 1.8.0-alpha.5

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
@@ -93,6 +93,7 @@ export declare class AssetAPI {
93
93
  * @param assetResult - A single assetResult of a `findAssets` query.
94
94
  */
95
95
  defaultApplyAsset(assetResult: AssetResult): Promise<void>;
96
+
96
97
  }
97
98
 
98
99
  /**
@@ -359,6 +360,16 @@ declare interface AssetsQueryResult_2 {
359
360
  */
360
361
  export declare type BlendMode = 'PassThrough' | 'Normal' | 'Darken' | 'Multiply' | 'ColorBurn' | 'Lighten' | 'Screen' | 'ColorDodge' | 'Overlay' | 'SoftLight' | 'HardLight' | 'Difference' | 'Exclusion' | 'Hue' | 'Saturation' | 'Color' | 'Luminosity';
361
362
 
363
+ /**
364
+ * Holds Channels for the different properties of a block.
365
+ * Ensures that for each property, only one channel exists.
366
+ * @public
367
+ */
368
+ export declare class Block extends Entity {
369
+ effects: ReadWriteChannelSync<number[]>;
370
+
371
+ }
372
+
362
373
  /**
363
374
  * @public
364
375
  */
@@ -374,6 +385,18 @@ export declare class BlockAPI {
374
385
  * @returns A promise that resolves with the exported image or is rejected with an error.
375
386
  */
376
387
  export(handle: DesignBlockId, mimeType?: MimeType_2, options?: ExportOptions): Promise<Blob>;
388
+ /**
389
+ * Exports a design block element as a file of the given mime type.
390
+ * Performs an internal update to resolve the final layout for the blocks.
391
+ * @param handle - The design block element to export.
392
+ * @param mimeType - The mime type of the output file.
393
+ * @param maskColorR - The red component of the special color mask color.
394
+ * @param maskColorG - The green component of the special color mask color.
395
+ * @param maskColorB - The blue component of the special color mask color.
396
+ * @param options - The options for exporting the block type
397
+ * @returns A promise that resolves with an array of the exported image and mask or is rejected with an error.
398
+ */
399
+ exportWithColorMask(handle: DesignBlockId, mimeType: MimeType_2 | undefined, maskColorR: number, maskColorG: number, maskColorB: number, options?: ExportOptions): Promise<Blob[]>;
377
400
 
378
401
  /**
379
402
  * Loads existing blocks from the given string.
@@ -832,6 +855,20 @@ export declare class BlockAPI {
832
855
  * @returns The value of the property.
833
856
  */
834
857
  getFloat(id: DesignBlockId, property: string): number;
858
+ /**
859
+ * Set a double property of the given design block to the given value.
860
+ * @param id - The block whose property should be set.
861
+ * @param property - The name of the property to set.
862
+ * @param value - The value to set.
863
+ */
864
+ setDouble(id: DesignBlockId, property: string, value: number): void;
865
+ /**
866
+ * Get the value of a double property of the given design block.
867
+ * @param id - The block whose property should be queried.
868
+ * @param property - The name of the property to query.
869
+ * @returns The value of the property.
870
+ */
871
+ getDouble(id: DesignBlockId, property: string): number;
835
872
  /**
836
873
  * Set a string property of the given design block to the given value.
837
874
  * @param id - The block whose property should be set.
@@ -967,6 +1004,16 @@ export declare class BlockAPI {
967
1004
  * @param minScaleRatio - The minimal crop scale ratio to go down to.
968
1005
  */
969
1006
  adjustCropToFillFrame(id: DesignBlockId, minScaleRatio: number): number;
1007
+ /**
1008
+ * Adjusts the crop in order to flip the content along its own horizontal axis.
1009
+ * @param block - The block whose crop should be updated.
1010
+ */
1011
+ flipCropHorizontal(id: DesignBlockId): void;
1012
+ /**
1013
+ * Adjusts the crop in order to flip the content along its own vertical axis.
1014
+ * @param block - The block whose crop should be updated.
1015
+ */
1016
+ flipCropVertical(id: DesignBlockId): void;
970
1017
  /**
971
1018
  * Query if the given block has an opacity.
972
1019
  * @param id - The block to query.
@@ -1578,6 +1625,13 @@ export declare class BlockAPI {
1578
1625
  * @returns whether the key exists.
1579
1626
  */
1580
1627
  hasMetadata(id: DesignBlockId, key: string): boolean;
1628
+ /**
1629
+ * Query all metadata keys that exist on this block.
1630
+ * @param id - The block whose metadata will be accessed.
1631
+ * @returns A list of all metadata keys on this block or an error,
1632
+ * if the block is invalid.
1633
+ */
1634
+ findAllMetadata(id: DesignBlockId): string[];
1581
1635
  /**
1582
1636
  * Remove metadata associated with the key from the given block.
1583
1637
  * If the key does not exist, this method will fail.
@@ -1606,6 +1660,141 @@ export declare class BlockAPI {
1606
1660
  * @returns whether the scope is allowed for the given block.
1607
1661
  */
1608
1662
  isAllowedByScope(id: DesignBlockId, key: string): boolean;
1663
+ /**
1664
+ * Returns whether the block has a duration property.
1665
+ * @param id - The block to query.
1666
+ * @returns true if the block has a duration property.
1667
+ */
1668
+ hasDuration(id: DesignBlockId): boolean;
1669
+ /**
1670
+ * Set the playback duration of the given block in seconds.
1671
+ * The duration defines for how long the block is active in the scene during playback.
1672
+ * The duration is ignored when the scene is not in "Video" mode.
1673
+ * @param id - The block whose duration should be changed.
1674
+ * @param duration - The new duration in seconds.
1675
+ */
1676
+ setDuration(id: DesignBlockId, duration: number): void;
1677
+ /**
1678
+ * Get the playback duration of the given block in seconds.
1679
+ * @param id - The block whose duration should be returned.
1680
+ * @returns The block's duration.
1681
+ */
1682
+ getDuration(id: DesignBlockId): number;
1683
+ /**
1684
+ * Returns whether the block has a time offset property.
1685
+ * @param id - The block to query.
1686
+ * @returns true, if the block has a time offset property.
1687
+ */
1688
+ hasTimeOffset(id: DesignBlockId): boolean;
1689
+ /**
1690
+ * Set the time offset of the given block in the scene.
1691
+ * The time offset defines the point in time at which this block is first active in the scene.
1692
+ * The time offset is not supported for page block or their children.
1693
+ * @param id - The block whose time offset should be changed.
1694
+ * @param offset - The new time offset in seconds.
1695
+ */
1696
+ setTimeOffset(id: DesignBlockId, offset: number): void;
1697
+ /**
1698
+ * Get the time offset of the given block in the scene.
1699
+ * @param id - The block whose time offset should be queried.
1700
+ * @returns the time offset of the block in the scene.
1701
+ */
1702
+ getTimeOffset(id: DesignBlockId): number;
1703
+ /**
1704
+ * Returns whether the block has trim properties.
1705
+ * @param id - The block to query.
1706
+ * @returns true, if the block has trim properties.
1707
+ */
1708
+ hasTrim(id: DesignBlockId): boolean;
1709
+ /**
1710
+ * Set the trim offset of the given block or fill.
1711
+ * Sets the relative time within the fill at which playback of the audio or video clip should begin.
1712
+ * This is a percentage value in the range [0, 1].
1713
+ * @param id - The block whose trim should be updated.
1714
+ * @param offset - The new trim offset.
1715
+ */
1716
+ setTrimOffset(id: DesignBlockId, offset: number): void;
1717
+ /**
1718
+ * Get the trim offset of this block.
1719
+ * @param id - The block whose trim offset should be queried.
1720
+ * @returns the trim offset.
1721
+ */
1722
+ getTrimOffset(id: DesignBlockId): number;
1723
+ /**
1724
+ * Set the trim length of the given block or fill.
1725
+ * The trim length is the percentage of the audio or video clip that should be used for playback.
1726
+ * @param id - The object whose trim length should be updated.
1727
+ * @param length - The new trim length as a percentage of the clip duration in the range [0, 1].
1728
+ */
1729
+ setTrimLength(id: DesignBlockId, length: number): void;
1730
+ /**
1731
+ * Get the trim length of the given block or fill.
1732
+ * @param id - The object whose trim length should be queried.
1733
+ * @returns the trim length of the object.
1734
+ */
1735
+ getTrimLength(id: DesignBlockId): number;
1736
+ /**
1737
+ * Returns the total duration (in seconds) of a scene in video mode.
1738
+ * The duration is defined by all blocks in the scene.
1739
+ * @param scene - The scene whose duration is being queried.
1740
+ * @returns the total scene duration.
1741
+ */
1742
+ getTotalSceneDuration(scene: DesignBlockId): number;
1743
+ /**
1744
+ * Set whether the block should be during active playback.
1745
+ * @param id - The block that should be updated.
1746
+ * @param enabled - Whether the block should be playing its contents.
1747
+ */
1748
+ setPlaying(id: DesignBlockId, enabled: boolean): void;
1749
+ /**
1750
+ * Returns whether the block is currently during active playback.
1751
+ * @param id - The block to query.
1752
+ * @returns whether the block is during playback.
1753
+ */
1754
+ isPlaying(id: DesignBlockId): boolean;
1755
+ /**
1756
+ * Returns whether the block has a playback time property.
1757
+ * @param id - The block to query.
1758
+ * @returns whether the block has a playback time property.
1759
+ */
1760
+ hasPlaybackTime(id: DesignBlockId): boolean;
1761
+ /**
1762
+ * Set the playback time of the given block.
1763
+ * @param id - The block whose playback time should be updated.
1764
+ * @param time - The new playback time of the block in seconds.
1765
+ */
1766
+ setPlaybackTime(id: DesignBlockId, time: number): void;
1767
+ /**
1768
+ * Get the playback time of the given block.
1769
+ * @param id - The block to query.
1770
+ * @returns the playback time of the block in seconds.
1771
+ */
1772
+ getPlaybackTime(id: DesignBlockId): number;
1773
+ /**
1774
+ * Set whether the given block or fill should play
1775
+ * its contents while the rest of the scene remains paused.
1776
+ * Setting this to true for one block will automatically set
1777
+ * it to false on all other blocks.
1778
+ * @param id - The block or fill to update.
1779
+ * @param enabled - Whether the block's playback should progress as time moves on.
1780
+ */
1781
+ setSoloPlaybackEnabled(id: DesignBlockId, enabled: boolean): void;
1782
+ /**
1783
+ * Return whether the given block or fill is currently set to play
1784
+ * its contents while the rest of the scene remains paused.
1785
+ * @param id - The block or fill to query.
1786
+ * @returns Whether solo playback is enabled for this block.
1787
+ */
1788
+ isSoloPlaybackEnabled(id: DesignBlockId): boolean;
1789
+ }
1790
+
1791
+ /**
1792
+ * This maintains a list of Blocks, ensuring that only one Block instance
1793
+ * exists per id.
1794
+ * @public
1795
+ */
1796
+ export declare class BlockChannels extends EntityChannels<Block> {
1797
+ getBlock(id: number): Block;
1609
1798
  }
1610
1799
 
1611
1800
  /** @public */
@@ -1632,6 +1821,33 @@ declare type Callbacks = {
1632
1821
  log?: Logger;
1633
1822
  };
1634
1823
 
1824
+ /**
1825
+ * A Channel represents a reactive data source consisting of three elements:
1826
+ *
1827
+ * * A `subscribe` method to register a callback for values coming from the
1828
+ * data source. Calling this method returns an `unsubscribe` method.
1829
+ * * An (optional) `update` method to update the data source
1830
+ * * An (optional) synchronous `value` method that can be used to retrieve
1831
+ * the current value or a sensible initial value without waiting for a
1832
+ * potentially asynchronous value coming through the stream.
1833
+ * @public
1834
+ */
1835
+ export declare interface Channel<Out, In = Out> {
1836
+ subscribe: Source<Out>;
1837
+ update?: (v: In) => void;
1838
+ value?: () => Out;
1839
+ }
1840
+
1841
+ /**
1842
+ * A {@link Channel} that is guaranteed to have a `value`
1843
+ * @public
1844
+ */
1845
+ export declare interface ChannelSync<Out, In = Out> extends Channel<Out, In> {
1846
+ subscribe: Source<Out>;
1847
+ update?: (v: In) => void;
1848
+ value: () => Out;
1849
+ }
1850
+
1635
1851
  /**
1636
1852
  * All components between 0 and 1
1637
1853
  * @public
@@ -1997,6 +2213,48 @@ export declare class EditorAPI {
1997
2213
  getGlobalScope(key: string): 'Allow' | 'Deny' | 'Defer';
1998
2214
  }
1999
2215
 
2216
+ /**
2217
+ * Holds Channels for the different properties of an effect.
2218
+ * Ensures that for each property, only one channel exists.
2219
+ * @public
2220
+ */
2221
+ export declare class Effect extends Entity {
2222
+ enabled: ReadWriteChannelSync<boolean>;
2223
+
2224
+ }
2225
+
2226
+ /**
2227
+ * This maintains a list of Effects, ensuring that only one Block instance
2228
+ * exists per id.
2229
+ * @public
2230
+ */
2231
+ export declare class EffectChannels extends EntityChannels<Effect> {
2232
+ getEffect(id: number): Effect;
2233
+ }
2234
+
2235
+ /**
2236
+ * @public
2237
+ */
2238
+ export declare class Entity {
2239
+ #private;
2240
+
2241
+
2242
+
2243
+ get id(): number;
2244
+ Int(property: string): ReadWriteChannelSync<number>;
2245
+ Float(property: string): ReadWriteChannelSync<number>;
2246
+ }
2247
+
2248
+ /** @public */
2249
+ export declare class EntityChannels<T extends Entity> {
2250
+ #private;
2251
+
2252
+
2253
+
2254
+ constant<V>(constantValue: V): ReadWriteChannelSync<V>;
2255
+ dispose(): void;
2256
+ }
2257
+
2000
2258
  /**
2001
2259
  * @public
2002
2260
  */
@@ -2140,6 +2398,12 @@ export declare type GradientType = 'Linear' | 'Radial' | 'Conical';
2140
2398
  */
2141
2399
  declare type Groups = string[];
2142
2400
 
2401
+ /**
2402
+ * Will be called by a stream whenever a new value is available.
2403
+ * @public
2404
+ */
2405
+ declare type Handler<T> = (v: T) => void;
2406
+
2143
2407
  /**
2144
2408
  * A hexadecimal color value (RGB or RGBA) that starts with a '#'
2145
2409
  * @example #6686FF or #6686FFFF
@@ -2162,6 +2426,7 @@ export declare class HTMLCreativeEngineCanvasElement extends HTMLElement {
2162
2426
  connectedCallback(): void;
2163
2427
  disconnectedCallback(): void;
2164
2428
 
2429
+
2165
2430
  }
2166
2431
 
2167
2432
  /** @public */
@@ -2273,7 +2538,7 @@ declare type Presets = {
2273
2538
  };
2274
2539
 
2275
2540
  /** @public */
2276
- export declare type PropertyType = 'Bool' | 'Int' | 'Float' | 'String' | 'Color' | 'Enum' | 'Struct';
2541
+ export declare type PropertyType = 'Bool' | 'Int' | 'Float' | 'String' | 'Color' | 'Enum' | 'Struct' | 'Double';
2277
2542
 
2278
2543
  /** @public */
2279
2544
  declare interface QueryData {
@@ -2290,6 +2555,26 @@ declare interface QueryData {
2290
2555
  page: number;
2291
2556
  }
2292
2557
 
2558
+ /**
2559
+ * A {@link Channel} that is guaranteed to have an `update` method.
2560
+ * @public
2561
+ */
2562
+ export declare interface ReadWriteChannel<Out, In = Out> extends Channel<Out, In> {
2563
+ subscribe: Source<Out>;
2564
+ update: (v: In) => void;
2565
+ value?: () => Out;
2566
+ }
2567
+
2568
+ /**
2569
+ * A {@link ReadWriteChannel} that is guaranteed to have a `value`
2570
+ * @public
2571
+ */
2572
+ export declare interface ReadWriteChannelSync<Out, In = Out> extends ChannelSync<Out, In>, ReadWriteChannel<Out, In> {
2573
+ subscribe: Source<Out>;
2574
+ update: (v: In) => void;
2575
+ value: () => Out;
2576
+ }
2577
+
2293
2578
  /**
2294
2579
  * Dispatched on the engine canvas right before the engine will refocus its text
2295
2580
  * input after a blur. Call `preventDefault()` to prevent the refocusing.
@@ -2337,7 +2622,6 @@ export declare type RoleString = 'Creator' | 'Adopter' | 'Viewer' | 'Presenter';
2337
2622
  * @public
2338
2623
  */
2339
2624
  declare type Scene = {
2340
- maskSpotColor?: SpotColor;
2341
2625
  /**
2342
2626
  * The DPI value to use when exporting and when converting between pixels and inches or millimeter units.
2343
2627
  * (In the CESDK, this value is synonymous with PPI).
@@ -2479,6 +2763,17 @@ export declare interface Size2 {
2479
2763
  */
2480
2764
  export declare type SizeMode = 'Absolute' | 'Percent' | 'Auto';
2481
2765
 
2766
+ /**
2767
+ * A stream source.
2768
+ *
2769
+ * This is an ordinary function. Pass a handler to have that handler called by
2770
+ * the source whenever a new value is available.
2771
+ *
2772
+ * Returns a function that unsubscribes the handler from the source
2773
+ * @public
2774
+ */
2775
+ declare type Source<T> = (handler: Handler<T>) => UnsubscribeFn;
2776
+
2482
2777
  /** @public */
2483
2778
  export declare interface SpotColor {
2484
2779
  name: string;
@@ -2515,6 +2810,12 @@ declare type TypefaceDefinition = Preset & {
2515
2810
  }[];
2516
2811
  };
2517
2812
 
2813
+ /**
2814
+ * Invoke to unsubscribe from a stream.
2815
+ * @public
2816
+ */
2817
+ declare type UnsubscribeFn = () => void;
2818
+
2518
2819
  /**
2519
2820
  * @public
2520
2821
  */