@cesdk/engine 1.14.0-rc.1 → 1.15.0-rc.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
@@ -19,6 +19,9 @@ export declare interface Asset {
19
19
  mimeType?: string;
20
20
  /** The type id of the design block that should be created from this asset. */
21
21
  blockType?: string;
22
+ fillType?: string;
23
+ shapeType?: string;
24
+ kind?: string;
22
25
  uri?: string;
23
26
  thumbUri?: string;
24
27
  previewUri?: string;
@@ -417,6 +420,19 @@ export declare class BlockAPI {
417
420
  * @returns The blocks type.
418
421
  */
419
422
  getType(id: DesignBlockId): DesignBlockType;
423
+ /**
424
+ * Get the kind of the given block, fails if the block is invalid.
425
+ * @param id - The block to query.
426
+ * @returns The block's kind.
427
+ */
428
+ getKind(id: DesignBlockId): string;
429
+ /**
430
+ * Set the kind of the given block, fails if the block is invalid.
431
+ * @param id - The block whose kind should be changed.
432
+ * @param kind - The new kind.
433
+ * @returns The block's kind.
434
+ */
435
+ setKind(id: DesignBlockId, kind: string): void;
420
436
  /**
421
437
  * Selects the given block and deselects all other blocks.
422
438
  * @param id - The block to be selected.
@@ -445,16 +461,16 @@ export declare class BlockAPI {
445
461
  * @param callback - This function is called at the end of the engine update if the selection has changed.
446
462
  * @returns A method to unsubscribe.
447
463
  */
448
- onSelectionChanged(callback: () => void): () => void;
464
+ onSelectionChanged: (callback: () => void) => (() => void);
449
465
  /**
450
466
  * Subscribe to block click events.
451
467
  * @param callback - This function is called at the end of the engine update if a block has been clicked.
452
468
  * @returns A method to unsubscribe.
453
469
  */
454
- onClicked(callback: (id: DesignBlockId) => void): () => void;
470
+ onClicked: (callback: (id: DesignBlockId) => void) => (() => void);
455
471
  /**
456
472
  * Confirms that a given set of blocks can be grouped together.
457
- * @param ids - A non-empty array of block ids.
473
+ * @param ids - An array of block ids.
458
474
  * @returns Whether the blocks can be grouped together.
459
475
  */
460
476
  isGroupable(ids: DesignBlockId[]): boolean;
@@ -509,6 +525,12 @@ export declare class BlockAPI {
509
525
  * @returns A list of block ids.
510
526
  */
511
527
  findByType(type: DesignBlockType): DesignBlockId[];
528
+ /**
529
+ * Finds all blocks with the given kind.
530
+ * @param type - The kind to search for.
531
+ * @returns A list of block ids.
532
+ */
533
+ findByKind(kind: DesignBlockType): DesignBlockId[];
512
534
  /**
513
535
  * Return all blocks currently known to the engine.
514
536
  * @returns A list of block ids.
@@ -888,7 +910,7 @@ export declare class BlockAPI {
888
910
  alignVertically(ids: DesignBlockId[], verticalBlockAlignment: VerticalBlockAlignment): void;
889
911
  /**
890
912
  * Confirms that a given set of blocks can be aligned.
891
- * @param ids - A non-empty array of block ids.
913
+ * @param ids - An array of block ids.
892
914
  * @returns Whether the blocks can be aligned.
893
915
  */
894
916
  isAlignable(ids: DesignBlockId[]): boolean;
@@ -905,7 +927,7 @@ export declare class BlockAPI {
905
927
  distributeVertically(ids: DesignBlockId[]): void;
906
928
  /**
907
929
  * Confirms that a given set of blocks can be distributed.
908
- * @param ids - A non-empty array of block ids.
930
+ * @param ids - An array of block ids.
909
931
  * @returns Whether the blocks can be distributed.
910
932
  */
911
933
  isDistributable(ids: DesignBlockId[]): boolean;
@@ -1484,60 +1506,6 @@ export declare class BlockAPI {
1484
1506
  * @returns The stroke join geometry.
1485
1507
  */
1486
1508
  getStrokeCornerGeometry(id: DesignBlockId): StrokeCornerGeometry;
1487
- /**
1488
- * Query if the given block has outline properties.
1489
- * @param id - The block to query.
1490
- * @returns true, if the block has outline properties.
1491
- * @deprecated Use `hasStroke`.
1492
- */
1493
- hasOutline(id: DesignBlockId): boolean;
1494
- /**
1495
- * Set the outline color of the given design block.
1496
- * @param id - The block whose outline color should be set.
1497
- * @param color - The outline color to be set, a tuple of
1498
- * @param r - The red color component in the range of 0 to 1.
1499
- * @param g - The green color component in the range of 0 to 1.
1500
- * @param b - The blue color component in the range of 0 to 1.
1501
- * @param a - The alpha color component in the range of 0 to 1.
1502
- * @deprecated Use `setStrokeColorRGBA`.
1503
- */
1504
- setOutlineColorRGBA(id: DesignBlockId, r: number, g: number, b: number, a?: number): void;
1505
- /**
1506
- * Get the outline color of the given design block.
1507
- * @param id - The block whose outline color should be queried.
1508
- * @returns The outline color.
1509
- * @deprecated Use `getStrokeColorRGBA`.
1510
- */
1511
- getOutlineColorRGBA(id: DesignBlockId): RGBA;
1512
- /**
1513
- * Enable or disable the outline of the given design block.
1514
- * @param id - The block whose outline should be enabled or disabled.
1515
- * @param enabled - If true, the outline will be enabled.
1516
- * @deprecated Use `setStrokeEnabled`.
1517
- */
1518
- setOutlineEnabled(id: DesignBlockId, enabled: boolean): void;
1519
- /**
1520
- * Query if the outline of the given design block is enabled.
1521
- * @param id - The block whose outline state should be queried.
1522
- * @returns True, if outline is enabled.
1523
- * @deprecated Use `isStrokeEnabled`.
1524
- */
1525
- isOutlineEnabled(id: DesignBlockId): boolean;
1526
- /**
1527
- * Set the outline width of the given design block.
1528
- * @param id - The block whose outline width should be set.
1529
- * @param width - The outline width to be set.
1530
- * @deprecated Use `setStrokeWidth`.
1531
- */
1532
- setOutlineWidth(id: DesignBlockId, width: number): void;
1533
- /**
1534
- * Get the outline width of the given design block.
1535
- * @param id - The block whose outline width should be queried.
1536
- * @returns The outline width.
1537
- * @deprecated Use the Stroke function
1538
- * @deprecated Use `getStrokeWidth`.
1539
- */
1540
- getOutlineWidth(id: DesignBlockId): number;
1541
1509
  /**
1542
1510
  * Query if the given block has a drop shadow property.
1543
1511
  * @param id - The block to query.
@@ -1632,41 +1600,25 @@ export declare class BlockAPI {
1632
1600
  */
1633
1601
  getDropShadowClip(id: DesignBlockId): boolean;
1634
1602
  /**
1635
- * Create a Cutout block.
1603
+ * Creates a cutout whose path will be the contour of the given blocks.
1604
+ * The cutout path for each element is derived from one two ways:
1605
+ * - Blocks that have already have a vector path (shapes, SVG-based text or stickers).
1606
+ * - Blocks that don't have a vector path are vectorized and then, optionally, simplified to eliminate jaggedness
1607
+ * (images).
1636
1608
  * @param blocks - The blocks whose shape will serve as the basis for the cutout's path.
1637
- * @returns The handle of the created Cutout.
1609
+ * @param vectorizeDistanceThreshold - The maximum number of pixels by which the cutout's path can deviate from the
1610
+ * original contour.
1611
+ * @param simplifyDistanceThreshold - The maximum number of pixels by which the simplified cutout path can deviate from
1612
+ * the cutout contour. If 0, no simplification step is performed.
1613
+ * @returns The newly created block or an error.
1638
1614
  */
1639
- createCutoutFromBlocks(ids: DesignBlockId[]): DesignBlockId;
1615
+ createCutoutFromBlocks(ids: DesignBlockId[], vectorizeDistanceThreshold?: number, simplifyDistanceThreshold?: number): DesignBlockId;
1640
1616
  /**
1641
1617
  * Create a Cutout block.
1642
1618
  * @param path - An SVG string describing a path.
1643
- * @returns The handle of the created Cutout.
1619
+ * @returns The newly created block or an error.
1644
1620
  */
1645
1621
  createCutoutFromPath(path: string): DesignBlockId;
1646
- /**
1647
- * Set the cutout's offset from the underlying path.
1648
- * @param block - The block whose offset should be set.
1649
- * @param offset - The offset to be set.
1650
- */
1651
- setCutoutOffset(id: DesignBlockId, offset: number): void;
1652
- /**
1653
- * Get the cutout's offset from the underlying path.
1654
- * @param block - The block whose offset should be queried.
1655
- * @returns The cutout's offset.
1656
- */
1657
- getCutoutOffset(id: DesignBlockId): number;
1658
- /**
1659
- * Set the cutout's type.
1660
- * @param block - The block whose type should be set.
1661
- * @param type - The type to be set.
1662
- */
1663
- setCutoutType(id: DesignBlockId, type: CutoutType): void;
1664
- /**
1665
- * Get the cutout's type.
1666
- * @param block - The block whose type should be queried.
1667
- * @returns The cutout's type.
1668
- */
1669
- getCutoutType(id: DesignBlockId): CutoutType;
1670
1622
  /** Perform a boolean operation on the given Cutout blocks.
1671
1623
  * The cutout offset of the new block is 0.
1672
1624
  * The cutout type of the new block is that of the first block.
@@ -1957,13 +1909,6 @@ export declare class BlockAPI {
1957
1909
  * @returns the enabled state of the placeholder behavior.
1958
1910
  */
1959
1911
  isPlaceholderBehaviorEnabled(id: DesignBlockId): boolean;
1960
- /**
1961
- * Query if the given block shows placeholder content.
1962
- * @param id - The block to query.
1963
- * @returns true, if the block shows placeholder content.
1964
- * @deprecated Use placeholder controls functions.
1965
- */
1966
- showsPlaceholderContent(id: DesignBlockId): boolean;
1967
1912
  /**
1968
1913
  * Checks whether the block supports placeholder controls.
1969
1914
  * @param block - The block to query.
@@ -2689,6 +2634,8 @@ declare class CreativeEngine {
2689
2634
  variable: VariableAPI;
2690
2635
 
2691
2636
 
2637
+
2638
+
2692
2639
  get element(): HTMLCreativeEngineCanvasElement | undefined;
2693
2640
  /**
2694
2641
  * Dispose the engine.
@@ -2739,7 +2686,9 @@ declare class CreativeEngine {
2739
2686
  * - `'ly.img.video'` - Sample videos
2740
2687
  * - `'ly.img.video.upload'` - Demo source to upload video assets
2741
2688
  */
2742
- addDemoAssetSources({ excludeAssetSourceIds, sceneMode, withUploadAssetSources }?: {
2689
+ addDemoAssetSources({ baseURL, excludeAssetSourceIds, sceneMode, withUploadAssetSources }?: {
2690
+ /** The source of the demo asset definitions, must be absolute. Defaults to `'https://cdn.img.ly/assets/demo/v1'`. */
2691
+ baseURL?: string;
2743
2692
  /** A list of IDs, that will be ignored during load */
2744
2693
  excludeAssetSourceIds?: DemoAssetSourceId[];
2745
2694
  /** If 'Video' video specific demo asset sources will be loaded as well (default 'Design') */
@@ -2749,6 +2698,7 @@ declare class CreativeEngine {
2749
2698
  }): Promise<void>;
2750
2699
 
2751
2700
 
2701
+
2752
2702
  }
2753
2703
  export default CreativeEngine;
2754
2704
 
@@ -3006,6 +2956,23 @@ export declare class EditorAPI {
3006
2956
  * @returns The value as string.
3007
2957
  */
3008
2958
  getSettingEnum<T extends keyof SettingsEnum>(keypath: T): SettingsEnum[T];
2959
+ /**
2960
+ * Get the possible enum options for a given enum setting.
2961
+ * @param keypath - The settings keypath, e.g. `role`.
2962
+ * @returns The possible enum options as strings.
2963
+ */
2964
+ getSettingEnumOptions<T extends keyof SettingsEnum>(keypath: T): string[];
2965
+ /**
2966
+ * Returns a list of all the settings available.
2967
+ * @returns A list of settings keypaths.
2968
+ */
2969
+ findAllSettings(): string[];
2970
+ /**
2971
+ * Returns the type of a setting.
2972
+ * @param keypath - The settings keypath, e.g. `role`.
2973
+ * @returns The setting type.
2974
+ */
2975
+ getSettingType(keypath: string): SettingType;
3009
2976
  /**
3010
2977
  * Get the currently available memory in bytes.
3011
2978
  * @returns The currently available memory in bytes.
@@ -3658,7 +3625,7 @@ export declare type SceneLayout = 'Free' | 'VerticalStack' | 'HorizontalStack' |
3658
3625
  export declare type SceneMode = 'Design' | 'Video';
3659
3626
 
3660
3627
  /** @public */
3661
- export declare type SettingsBool = 'doubleClickToCropEnabled' | 'features/aiImageMattingEnabled' | 'features/aiImageMattingStagingEnabled' | 'features/aiInpaintingEnabled' | 'features/aiSmartCropEnabled' | 'features/aiSuperResolutionEnabled' | 'features/effectsEnabled' | 'features/hspSelectiveAdjustmentsEnabled' | 'features/layerListEnabled' | 'features/singlePageModeEnabled' | 'features/templatingEnabled' | 'page/dimOutOfPageAreas' | 'page/title/show' | 'placeholderControls/showButton' | 'placeholderControls/showOverlay' | 'showBuildVersion' | 'touch/dragStartCanSelect' | 'touch/singlePointPanning' | 'trackActivePage' | ArbitraryString;
3628
+ export declare type SettingsBool = 'doubleClickToCropEnabled' | 'features/effectsEnabled' | 'features/hspSelectiveAdjustmentsEnabled' | 'features/layerListEnabled' | 'features/singlePageModeEnabled' | 'features/templatingEnabled' | 'page/dimOutOfPageAreas' | 'page/title/show' | 'placeholderControls/showButton' | 'placeholderControls/showOverlay' | 'showBuildVersion' | 'touch/dragStartCanSelect' | 'touch/singlePointPanning' | 'trackActivePage' | ArbitraryString;
3662
3629
 
3663
3630
  /** @public */
3664
3631
  export declare type SettingsColorRGBA = 'clearColor' | 'errorStateColor' | 'highlightColor' | 'page/title/color' | 'placeholderHighlightColor' | 'progressColor' | ArbitraryString;
@@ -3671,10 +3638,13 @@ export declare type SettingsEnum = {
3671
3638
  };
3672
3639
 
3673
3640
  /** @public */
3674
- export declare type SettingsFloat = 'positionSnappingThreshold';
3641
+ export declare type SettingsFloat = 'positionSnappingThreshold' | ArbitraryString;
3642
+
3643
+ /** @public */
3644
+ export declare type SettingsString = 'basePath' | 'license' | 'page/title/fontFileUri' | ArbitraryString;
3675
3645
 
3676
3646
  /** @public */
3677
- export declare type SettingsString = 'ai/apiStagingUrl' | 'ai/apiUrl' | 'ai/backendUrl' | 'basePath' | 'license' | 'page/title/fontFileUri' | ArbitraryString;
3647
+ export declare type SettingType = 'Bool' | 'Int' | 'Float' | 'String' | 'Color' | 'Enum';
3678
3648
 
3679
3649
  /** @public */
3680
3650
  export declare interface Size2 {