@cesdk/node 1.11.0-preview.1 → 1.11.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.
|
Binary file
|
|
Binary file
|
package/example.js
CHANGED
|
@@ -5,7 +5,8 @@ const CreativeEngine = require('./index.js');
|
|
|
5
5
|
|
|
6
6
|
const { DesignBlockType, MimeType } = CreativeEngine;
|
|
7
7
|
|
|
8
|
-
CreativeEngine.init().then((engine) => {
|
|
8
|
+
CreativeEngine.init().then(async (engine) => {
|
|
9
|
+
await engine.addDefaultAssetSources();
|
|
9
10
|
console.log('Loading scene');
|
|
10
11
|
engine.scene
|
|
11
12
|
.loadFromURL(`file://${__dirname}/demo.scene`)
|
package/index.d.ts
CHANGED
|
@@ -1619,6 +1619,51 @@ export declare class BlockAPI {
|
|
|
1619
1619
|
* @returns The drop shadow's clipping.
|
|
1620
1620
|
*/
|
|
1621
1621
|
getDropShadowClip(id: DesignBlockId): boolean;
|
|
1622
|
+
/**
|
|
1623
|
+
* Create a Cutout block.
|
|
1624
|
+
* @param blocks - The blocks whose shape will serve as the basis for the cutout's path.
|
|
1625
|
+
* @returns The handle of the created Cutout.
|
|
1626
|
+
*/
|
|
1627
|
+
createCutoutFromBlocks(ids: DesignBlockId[]): DesignBlockId;
|
|
1628
|
+
/**
|
|
1629
|
+
* Create a Cutout block.
|
|
1630
|
+
* @param path - An SVG string describing a path.
|
|
1631
|
+
* @returns The handle of the created Cutout.
|
|
1632
|
+
*/
|
|
1633
|
+
createCutoutFromPath(path: string): DesignBlockId;
|
|
1634
|
+
/**
|
|
1635
|
+
* Set the cutout's offset from the underlying path.
|
|
1636
|
+
* @param block - The block whose offset should be set.
|
|
1637
|
+
* @param offset - The offset to be set.
|
|
1638
|
+
*/
|
|
1639
|
+
setCutoutOffset(id: DesignBlockId, offset: number): void;
|
|
1640
|
+
/**
|
|
1641
|
+
* Get the cutout's offset from the underlying path.
|
|
1642
|
+
* @param block - The block whose offset should be queried.
|
|
1643
|
+
* @returns The cutout's offset.
|
|
1644
|
+
*/
|
|
1645
|
+
getCutoutOffset(id: DesignBlockId): number;
|
|
1646
|
+
/**
|
|
1647
|
+
* Set the cutout's type.
|
|
1648
|
+
* @param block - The block whose type should be set.
|
|
1649
|
+
* @param type - The type to be set.
|
|
1650
|
+
*/
|
|
1651
|
+
setCutoutType(id: DesignBlockId, type: CutoutType): void;
|
|
1652
|
+
/**
|
|
1653
|
+
* Get the cutout's type.
|
|
1654
|
+
* @param block - The block whose type should be queried.
|
|
1655
|
+
* @returns The cutout's type.
|
|
1656
|
+
*/
|
|
1657
|
+
getCutoutType(id: DesignBlockId): CutoutType;
|
|
1658
|
+
/** Perform a boolean operation on the given Cutout blocks.
|
|
1659
|
+
* The cutout offset of the new block is 0.
|
|
1660
|
+
* The cutout type of the new block is that of the first block.
|
|
1661
|
+
* When performing a `Difference` operation, the first block is the block subtracted from.
|
|
1662
|
+
* @param blocks - The blocks with which to perform to the operation.
|
|
1663
|
+
* @param op - The boolean operation to perform.
|
|
1664
|
+
* @returns The newly created block or an error.
|
|
1665
|
+
*/
|
|
1666
|
+
createCutoutFromOperation(ids: DesignBlockId[], op: CutoutOperation): DesignBlockId;
|
|
1622
1667
|
/**
|
|
1623
1668
|
* Inserts the given text into the selected range of the text block.
|
|
1624
1669
|
* @param block - The text block into which to insert the given text.
|
|
@@ -1655,9 +1700,11 @@ export declare class BlockAPI {
|
|
|
1655
1700
|
* Returns the ordered unique list of colors of the text in the selected range.
|
|
1656
1701
|
* @param block - The text block whose colors should be returned.
|
|
1657
1702
|
* @param from - The start index of the UTF-16 range whose colors should be returned.
|
|
1658
|
-
*
|
|
1703
|
+
* If the value is negative and the block is currently being edited, this will fall back to the start of the current cursor index / selected grapheme range.
|
|
1704
|
+
* If the value is negative and the block is not being edited, this will fall back to the start of the entire text range.
|
|
1659
1705
|
* @param to - The UTF-16 index after the last grapheme whose colors should be returned.
|
|
1660
|
-
*
|
|
1706
|
+
* If the value is negative and the block is currently being edited, this will fall back to the end of the current cursor index / selected grapheme range.
|
|
1707
|
+
* If the value is negative and the block is not being edited, this will fall back to the end of the entire text range.
|
|
1661
1708
|
*/
|
|
1662
1709
|
getTextColors(id: DesignBlockId, from?: number, to?: number): Array<RGBAColor | SpotColor>;
|
|
1663
1710
|
/**
|
|
@@ -1682,6 +1729,29 @@ export declare class BlockAPI {
|
|
|
1682
1729
|
* If the value is negative and the block is not being edited, this will fall back to the end of the entire text range.
|
|
1683
1730
|
*/
|
|
1684
1731
|
getTextFontStyles(id: DesignBlockId, from?: number, to?: number): FontStyle[];
|
|
1732
|
+
/**
|
|
1733
|
+
* Returns the ordered list of text cases of the text in the selected range.
|
|
1734
|
+
* @param block - The text block whose text cases should be returned.
|
|
1735
|
+
* @param from - The start index of the UTF-16 range whose text cases should be returned.
|
|
1736
|
+
* If the value is negative and the block is currently being edited, this will fall back to the start of the current cursor index / selected grapheme range.
|
|
1737
|
+
* If the value is negative and the block is not being edited, this will fall back to the start of the entire text range.
|
|
1738
|
+
* @param to - The UTF-16 index after the last grapheme whose text cases should be returned.
|
|
1739
|
+
* If the value is negative and the block is currently being edited, this will fall back to the end of the current cursor index / selected grapheme range.
|
|
1740
|
+
* If the value is negative and the block is not being edited, this will fall back to the end of the entire text range.
|
|
1741
|
+
*/
|
|
1742
|
+
getTextCases(id: DesignBlockId, from?: number, to?: number): TextCase[];
|
|
1743
|
+
/**
|
|
1744
|
+
* Sets the given text case for the selected range of text.
|
|
1745
|
+
* @param id - The text block whose text case should be changed.
|
|
1746
|
+
* @param textCase - The new text case value.
|
|
1747
|
+
* @param from - The start index of the UTF-16 range whose text cases should be returned.
|
|
1748
|
+
* If the value is negative and the block is currently being edited, this will fall back to the start of the current cursor index / selected grapheme range.
|
|
1749
|
+
* If the value is negative and the block is not being edited, this will fall back to the start of the entire text range.
|
|
1750
|
+
* @param to - The UTF-16 index after the last grapheme whose text cases should be returned.
|
|
1751
|
+
* If the value is negative and the block is currently being edited, this will fall back to the end of the current cursor index / selected grapheme range.
|
|
1752
|
+
* If the value is negative and the block is not being edited, this will fall back to the end of the entire text range.
|
|
1753
|
+
*/
|
|
1754
|
+
setTextCase(id: DesignBlockId, textCase: TextCase, from?: number, to?: number): void;
|
|
1685
1755
|
/**
|
|
1686
1756
|
* Query if the given block has fill color properties.
|
|
1687
1757
|
* @param id - The block to query.
|
|
@@ -2179,26 +2249,32 @@ export declare interface CMYKColor {
|
|
|
2179
2249
|
}
|
|
2180
2250
|
|
|
2181
2251
|
/**
|
|
2182
|
-
*
|
|
2183
|
-
*
|
|
2252
|
+
* @deprecated This type definition has been removed.
|
|
2253
|
+
* Instead of `ConfigTypes.Color`, this can be imported directly as `PaletteColor`.
|
|
2184
2254
|
* @public
|
|
2185
2255
|
*/
|
|
2186
|
-
declare type Color_2 =
|
|
2256
|
+
declare type Color_2 = PaletteColor;
|
|
2187
2257
|
|
|
2188
|
-
/**
|
|
2258
|
+
/**
|
|
2259
|
+
* @deprecated This type definition is not used anymore and will be removed.
|
|
2260
|
+
* @public
|
|
2261
|
+
*/
|
|
2189
2262
|
declare type ColorDefinition = Preset & {
|
|
2190
2263
|
value: Color_2;
|
|
2191
2264
|
};
|
|
2192
2265
|
|
|
2193
|
-
/**
|
|
2266
|
+
/**
|
|
2267
|
+
* @deprecated This type definition is not used anymore and will be removed.
|
|
2268
|
+
* @public
|
|
2269
|
+
*/
|
|
2194
2270
|
declare type ColorPaletteDefinition = Preset & {
|
|
2195
2271
|
entries: Color_2[];
|
|
2196
2272
|
};
|
|
2197
2273
|
|
|
2198
2274
|
declare namespace ConfigTypes {
|
|
2199
2275
|
export {
|
|
2200
|
-
HexColorString,
|
|
2201
2276
|
Color_2 as Color,
|
|
2277
|
+
HexColorString_2 as HexColorString,
|
|
2202
2278
|
AssetSources,
|
|
2203
2279
|
AssetSource_2 as AssetSource,
|
|
2204
2280
|
AssetResult_2 as AssetResult,
|
|
@@ -2306,9 +2382,70 @@ declare class CreativeEngine {
|
|
|
2306
2382
|
* @returns An engine instance.
|
|
2307
2383
|
*/
|
|
2308
2384
|
static init(config?: Partial<Configuration> & OldConfiguration): Promise<CreativeEngine>;
|
|
2385
|
+
/**
|
|
2386
|
+
* Convenience function that registers a set of asset sources containing our
|
|
2387
|
+
* default assets. These are
|
|
2388
|
+
*
|
|
2389
|
+
* - `'ly.img.sticker'` - Various stickers
|
|
2390
|
+
* - `'ly.img.vectorpath'` - Shapes and arrows
|
|
2391
|
+
* - `'ly.img.filter.lut'` - LUT effects of various kinds.
|
|
2392
|
+
* - `'ly.img.filter.duotone'` - LUT effects of various kinds.
|
|
2393
|
+
*
|
|
2394
|
+
* These assets are parsed from the IMG.LY CDN at \{\{base_url\}\}/<id>/content.json, where
|
|
2395
|
+
* `base_url` defaults to 'https://cdn.img.ly/assets/v1'.
|
|
2396
|
+
* Each source is created via `addLocalSource` and populated with the parsed assets. To modify the available
|
|
2397
|
+
* assets, you may either exclude certain IDs via `excludeAssetSourceIds` or alter the sources after creation.
|
|
2398
|
+
*/
|
|
2399
|
+
addDefaultAssetSources({ baseURL, excludeAssetSourceIds }?: {
|
|
2400
|
+
/** The source of the asset definitions, must be absolute. Defaults to `'https://cdn.img.ly/assets/v1'`. */
|
|
2401
|
+
baseURL?: string;
|
|
2402
|
+
/** A list of IDs, that will be ignored during load. */
|
|
2403
|
+
excludeAssetSourceIds?: DefaultAssetSourceId[];
|
|
2404
|
+
}): Promise<void>;
|
|
2405
|
+
/**
|
|
2406
|
+
* Convenience function that registers a set of demo asset sources containing our
|
|
2407
|
+
* example assets. These are not to meant to be used in your production code.
|
|
2408
|
+
*
|
|
2409
|
+
* These are
|
|
2410
|
+
*
|
|
2411
|
+
* - `'ly.img.image'` - Sample images
|
|
2412
|
+
* - `'ly.img.image.upload'` - Demo source to upload image assets
|
|
2413
|
+
* - `'ly.img.audio'` - Sample audios
|
|
2414
|
+
* - `'ly.img.audio.upload'` - Demo source to upload audio assets
|
|
2415
|
+
* - `'ly.img.video'` - Sample videos
|
|
2416
|
+
* - `'ly.img.video.upload'` - Demo source to upload video assets
|
|
2417
|
+
*/
|
|
2418
|
+
addDemoAssetSources({ excludeAssetSourceIds, sceneMode, withUploadAssetSources }?: {
|
|
2419
|
+
/** A list of IDs, that will be ignored during load */
|
|
2420
|
+
excludeAssetSourceIds?: DemoAssetSourceId[];
|
|
2421
|
+
/** If 'Video' video specific demo asset sources will be loaded as well (default 'Design') */
|
|
2422
|
+
sceneMode?: SceneMode;
|
|
2423
|
+
/** If 'true' asset sources for uploads are added (default false) */
|
|
2424
|
+
withUploadAssetSources?: boolean;
|
|
2425
|
+
}): Promise<void>;
|
|
2309
2426
|
}
|
|
2310
2427
|
export default CreativeEngine;
|
|
2311
2428
|
|
|
2429
|
+
/**
|
|
2430
|
+
* @public
|
|
2431
|
+
*/
|
|
2432
|
+
export declare type CutoutOperation = 'Difference' | 'Intersection' | 'Union' | 'XOR';
|
|
2433
|
+
|
|
2434
|
+
/**
|
|
2435
|
+
* @public
|
|
2436
|
+
*/
|
|
2437
|
+
export declare type CutoutType = 'Solid' | 'Dashed';
|
|
2438
|
+
|
|
2439
|
+
/**
|
|
2440
|
+
* @public
|
|
2441
|
+
*/
|
|
2442
|
+
export declare type DefaultAssetSourceId = 'ly.img.sticker' | 'ly.img.vectorpath' | 'ly.img.filter.lut' | 'ly.img.filter.duotone';
|
|
2443
|
+
|
|
2444
|
+
/**
|
|
2445
|
+
* @public
|
|
2446
|
+
*/
|
|
2447
|
+
export declare type DemoAssetSourceId = 'ly.img.image.upload' | 'ly.img.video.upload' | 'ly.img.audio.upload' | 'ly.img.image' | 'ly.img.video' | 'ly.img.audio';
|
|
2448
|
+
|
|
2312
2449
|
/**
|
|
2313
2450
|
* A numerical identifier for a design block
|
|
2314
2451
|
* @public
|
|
@@ -2326,6 +2463,7 @@ export declare enum DesignBlockType {
|
|
|
2326
2463
|
Image = "//ly.img.ubq/image",
|
|
2327
2464
|
Video = "//ly.img.ubq/video",
|
|
2328
2465
|
VideoFill = "//ly.img.ubq/fill/video",
|
|
2466
|
+
ImageFill = "//ly.img.ubq/fill/image",
|
|
2329
2467
|
Audio = "//ly.img.ubq/audio",
|
|
2330
2468
|
Text = "//ly.img.ubq/text",
|
|
2331
2469
|
Sticker = "//ly.img.ubq/sticker",
|
|
@@ -2335,7 +2473,8 @@ export declare enum DesignBlockType {
|
|
|
2335
2473
|
StarShape = "//ly.img.ubq/shapes/star",
|
|
2336
2474
|
PolygonShape = "//ly.img.ubq/shapes/polygon",
|
|
2337
2475
|
EllipseShape = "//ly.img.ubq/shapes/ellipse",
|
|
2338
|
-
Group = "//ly.img.ubq/group"
|
|
2476
|
+
Group = "//ly.img.ubq/group",
|
|
2477
|
+
Cutout = "//ly.img.ubq/cutout"
|
|
2339
2478
|
}
|
|
2340
2479
|
|
|
2341
2480
|
/**
|
|
@@ -2601,6 +2740,19 @@ export declare class EditorAPI {
|
|
|
2601
2740
|
* @returns An empty result on success, an error otherwise.
|
|
2602
2741
|
*/
|
|
2603
2742
|
removeSpotColor(name: string): void;
|
|
2743
|
+
/**
|
|
2744
|
+
* Set the spot color assign to a cutout type.
|
|
2745
|
+
* All cutout blocks of the given type will be immediately assigned that spot color.
|
|
2746
|
+
* @param type - The cutout type.
|
|
2747
|
+
* @param name - The spot color name to assign.
|
|
2748
|
+
*/
|
|
2749
|
+
setSpotColorForCutoutType(type: CutoutType, color: string): void;
|
|
2750
|
+
/**
|
|
2751
|
+
* Get the name of the spot color assigned to a cutout type.
|
|
2752
|
+
* @param type - The cutout type.
|
|
2753
|
+
* @returns The color spot name.
|
|
2754
|
+
*/
|
|
2755
|
+
getSpotColorForCutoutType(type: CutoutType): string;
|
|
2604
2756
|
}
|
|
2605
2757
|
|
|
2606
2758
|
/**
|
|
@@ -2751,7 +2903,14 @@ declare type Groups = string[];
|
|
|
2751
2903
|
* @example #6686FF or #6686FFFF
|
|
2752
2904
|
* @public
|
|
2753
2905
|
*/
|
|
2754
|
-
declare type HexColorString = string;
|
|
2906
|
+
export declare type HexColorString = string;
|
|
2907
|
+
|
|
2908
|
+
/**
|
|
2909
|
+
* @deprecated This type definition has been moved
|
|
2910
|
+
* It can instead be imported directly as `HexColorString`
|
|
2911
|
+
* @public
|
|
2912
|
+
*/
|
|
2913
|
+
declare type HexColorString_2 = HexColorString;
|
|
2755
2914
|
|
|
2756
2915
|
/**
|
|
2757
2916
|
* A numerical identifier for a history stack
|
|
@@ -2790,6 +2949,7 @@ declare enum MimeType_2 {
|
|
|
2790
2949
|
Jpeg = "image/jpeg",
|
|
2791
2950
|
Tga = "image/x-tga",
|
|
2792
2951
|
Mp4 = "video/mp4",
|
|
2952
|
+
QuickTime = "video/quicktime",
|
|
2793
2953
|
Binary = "application/octet-stream",
|
|
2794
2954
|
Pdf = "application/pdf",
|
|
2795
2955
|
Zip = "application/zip"
|
|
@@ -2861,14 +3021,28 @@ export declare interface PageDuration {
|
|
|
2861
3021
|
end: number;
|
|
2862
3022
|
}
|
|
2863
3023
|
|
|
2864
|
-
/**
|
|
3024
|
+
/**
|
|
3025
|
+
* @deprecated This type definition is unused and will be removed
|
|
3026
|
+
* @public
|
|
3027
|
+
*/
|
|
2865
3028
|
declare type PageFormatDefinition = Preset & {
|
|
2866
3029
|
width: number;
|
|
2867
3030
|
height: number;
|
|
2868
|
-
|
|
3031
|
+
/** @deprecated This property is unused and will be removed */
|
|
3032
|
+
dpi?: number;
|
|
3033
|
+
/** @deprecated This property is unused and will be removed */
|
|
3034
|
+
bleedMargin?: number;
|
|
3035
|
+
unit: 'px' | 'mm' | 'in' | DesignUnit;
|
|
2869
3036
|
fixedOrientation?: boolean;
|
|
2870
3037
|
};
|
|
2871
3038
|
|
|
3039
|
+
/**
|
|
3040
|
+
* A color definition for the custom color palette.
|
|
3041
|
+
* The RGB and CMYK components must all be specified in the range [0-1].
|
|
3042
|
+
* @public
|
|
3043
|
+
*/
|
|
3044
|
+
export declare type PaletteColor = HexColorString | RGBColor | RGBAColor | SpotColor;
|
|
3045
|
+
|
|
2872
3046
|
/**
|
|
2873
3047
|
* - Absolute: Position in absolute design units.
|
|
2874
3048
|
* - Percent: Position in relation to the block's parent's size in percent, where 1.0 means 100%.
|
|
@@ -2878,7 +3052,10 @@ declare type PageFormatDefinition = Preset & {
|
|
|
2878
3052
|
*/
|
|
2879
3053
|
export declare type PositionMode = 'Absolute' | 'Percent' | 'Auto';
|
|
2880
3054
|
|
|
2881
|
-
/**
|
|
3055
|
+
/**
|
|
3056
|
+
* @deprecated This type definition is not used anymore and will be removed.
|
|
3057
|
+
* @public
|
|
3058
|
+
*/
|
|
2882
3059
|
declare type Preset = {
|
|
2883
3060
|
meta?: {
|
|
2884
3061
|
default?: boolean;
|
|
@@ -2887,20 +3064,28 @@ declare type Preset = {
|
|
|
2887
3064
|
};
|
|
2888
3065
|
};
|
|
2889
3066
|
|
|
2890
|
-
/**
|
|
3067
|
+
/**
|
|
3068
|
+
* @deprecated This type definition will be removed.
|
|
3069
|
+
* If you need to reference this type in your code,
|
|
3070
|
+
* use `Configuration['presets']` instead of `ConfigTypes.Presets`.
|
|
3071
|
+
* @public
|
|
3072
|
+
*/
|
|
2891
3073
|
declare type Presets = {
|
|
3074
|
+
/**
|
|
3075
|
+
* @deprecated The configuration option `presets.colors` does not exist anymore.
|
|
3076
|
+
*/
|
|
2892
3077
|
colors?: {
|
|
2893
|
-
[id: string]:
|
|
3078
|
+
[id: string]: Color_2;
|
|
2894
3079
|
};
|
|
2895
3080
|
typefaces?: {
|
|
2896
3081
|
[id: string]: TypefaceDefinition;
|
|
2897
3082
|
};
|
|
2898
|
-
pageFormats?: {
|
|
2899
|
-
[id: string]: PageFormatDefinition;
|
|
2900
|
-
};
|
|
2901
3083
|
colorPalettes?: {
|
|
2902
3084
|
[id: string]: ColorPaletteDefinition;
|
|
2903
3085
|
};
|
|
3086
|
+
pageFormats?: {
|
|
3087
|
+
[id: string]: PageFormatDefinition;
|
|
3088
|
+
};
|
|
2904
3089
|
templates?: {
|
|
2905
3090
|
[id: string]: TemplateDefinition;
|
|
2906
3091
|
};
|
|
@@ -3232,14 +3417,23 @@ export declare type StrokeStyle = 'Dashed' | 'DashedRound' | 'Dotted' | 'LongDas
|
|
|
3232
3417
|
declare type Subscription = number;
|
|
3233
3418
|
|
|
3234
3419
|
/** @public */
|
|
3235
|
-
declare type TemplateDefinition =
|
|
3420
|
+
declare type TemplateDefinition = {
|
|
3421
|
+
/** @deprecated The meta field is not used anymore */
|
|
3422
|
+
meta?: Preset['meta'];
|
|
3236
3423
|
label: string;
|
|
3237
3424
|
scene: string | URL | (() => Promise<string>);
|
|
3238
3425
|
thumbnailURL?: string | URL;
|
|
3239
3426
|
};
|
|
3240
3427
|
|
|
3428
|
+
/**
|
|
3429
|
+
* @public
|
|
3430
|
+
*/
|
|
3431
|
+
export declare type TextCase = 'Normal' | 'Uppercase' | 'Lowercase' | 'Titlecase';
|
|
3432
|
+
|
|
3241
3433
|
/** @public */
|
|
3242
|
-
declare type TypefaceDefinition =
|
|
3434
|
+
declare type TypefaceDefinition = {
|
|
3435
|
+
/** @deprecated The meta field is not used anymore */
|
|
3436
|
+
meta?: Preset['meta'];
|
|
3243
3437
|
family: string;
|
|
3244
3438
|
fonts: {
|
|
3245
3439
|
fontURL: string;
|