@adobe/ccweb-add-on-sdk-types 1.3.0 → 1.5.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/README.md +2 -5
- package/package.json +55 -55
- package/sandbox/express-document-sdk.d.ts +171 -69
- package/ui/ui-sdk.d.ts +113 -11
package/README.md
CHANGED
|
@@ -10,11 +10,8 @@ This package exports type definitions for [@adobe/create-ccweb-add-on](https://w
|
|
|
10
10
|
|
|
11
11
|
## Usage Notes
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
This package contains Add-on SDK type definitions. However, in itself this package is unusable. You must install [@types/adobe\_\_ccweb-add-on-sdk](https://www.npmjs.com/package/@types/adobe__ccweb-add-on-sdk) instead, to use the Add-on SDK type definitions in your Add-on project.
|
|
14
14
|
|
|
15
|
-
-
|
|
16
|
-
- [add-on-sandbox-sdk.d.ts](https://github.com/adobe/create-ccweb-add-on/blob/main/packages/wxp-sdk-types/add-on-sandbox-sdk.d.ts)
|
|
17
|
-
|
|
18
|
-
However, if you are installing this package on your existing add-on project, ensure to include the above type definition files in your `src` directory.
|
|
15
|
+
For add-on projects created using [@adobe/create-ccweb-add-on](https://www.npmjs.com/package/@adobe/create-ccweb-add-on), [@types/adobe\_\_ccweb-add-on-sdk](https://www.npmjs.com/package/@types/adobe__ccweb-add-on-sdk) is pre-installed.
|
|
19
16
|
|
|
20
17
|
For more information about developing Adobe Express add-ons, check out the [documentation](https://developer.adobe.com/express/add-ons/).
|
package/package.json
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"types": "index.d.ts",
|
|
37
|
-
"repository": {
|
|
38
|
-
"url": "https://github.com/adobe/create-ccweb-add-on"
|
|
39
|
-
},
|
|
40
|
-
"scripts": {
|
|
41
|
-
"clean": "",
|
|
42
|
-
"ibuild": "",
|
|
43
|
-
"build": "",
|
|
44
|
-
"build:release": "",
|
|
45
|
-
"test": ""
|
|
46
|
-
},
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"tslib": "2.4.0",
|
|
49
|
-
"gl-matrix": "3.3.0"
|
|
50
|
-
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@types/node": "16.11.62",
|
|
53
|
-
"prettier": "2.8.0",
|
|
54
|
-
"ts-node": "10.9.1",
|
|
55
|
-
"typescript": "4.8.4"
|
|
2
|
+
"name": "@adobe/ccweb-add-on-sdk-types",
|
|
3
|
+
"version": "1.5.0",
|
|
4
|
+
"author": "Adobe",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "Type definitions for Adobe Creative Cloud Web Add-on SDK.",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"adobe",
|
|
9
|
+
"creative cloud web",
|
|
10
|
+
"express",
|
|
11
|
+
"add-on",
|
|
12
|
+
"typescript",
|
|
13
|
+
"sdk",
|
|
14
|
+
"typings"
|
|
15
|
+
],
|
|
16
|
+
"main": "",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": "./index.d.ts",
|
|
19
|
+
"./iframe-ui": "./ui/ui-sdk.d.ts",
|
|
20
|
+
"./express-document-sdk": "./sandbox/express-document-sdk.d.ts",
|
|
21
|
+
"./add-on-sdk-document-sandbox": "./sandbox/add-on-sdk-document-sandbox.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"typesVersions": {
|
|
24
|
+
"*": {
|
|
25
|
+
"iframe-ui": [
|
|
26
|
+
"./ui/ui-sdk.d.ts"
|
|
27
|
+
],
|
|
28
|
+
"express-document-sdk": [
|
|
29
|
+
"./sandbox/express-document-sdk.d.ts"
|
|
30
|
+
],
|
|
31
|
+
"add-on-sdk-document-sandbox": [
|
|
32
|
+
"./sandbox/add-on-sdk-document-sandbox.d.ts"
|
|
33
|
+
]
|
|
56
34
|
}
|
|
57
|
-
}
|
|
35
|
+
},
|
|
36
|
+
"types": "index.d.ts",
|
|
37
|
+
"repository": {
|
|
38
|
+
"url": "https://github.com/adobe/create-ccweb-add-on"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"tslib": "2.4.0",
|
|
42
|
+
"gl-matrix": "3.3.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "16.11.62",
|
|
46
|
+
"prettier": "2.8.0",
|
|
47
|
+
"ts-node": "10.9.1",
|
|
48
|
+
"typescript": "4.8.4"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"clean": "",
|
|
52
|
+
"ibuild": "",
|
|
53
|
+
"build": "",
|
|
54
|
+
"build:release": "",
|
|
55
|
+
"test": ""
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -59,7 +59,9 @@ declare enum ArrowHeadType {
|
|
|
59
59
|
export declare class ArtboardList extends RestrictedItemList<ArtboardNode> {
|
|
60
60
|
/**
|
|
61
61
|
* Create a new artboard and add it to the end of the list. The artboard size is the same as others on this page. The
|
|
62
|
-
* artboard background is set to default fill color {@link DEFAULT_ARTBOARD_FILL_COLOR}.
|
|
62
|
+
* artboard background is set to default fill color {@link DEFAULT_ARTBOARD_FILL_COLOR}. The new artboard becomes the
|
|
63
|
+
* default target for newly inserted content (see insertionParent) and the timeline advances to show this artboard
|
|
64
|
+
* in the current viewport.
|
|
63
65
|
* @returns the newly added artboard.
|
|
64
66
|
*/
|
|
65
67
|
addArtboard(): ArtboardNode;
|
|
@@ -70,7 +72,7 @@ export declare class ArtboardList extends RestrictedItemList<ArtboardNode> {
|
|
|
70
72
|
*
|
|
71
73
|
* When multiple artboards exist on a page, the artboards represent "scenes" in a linear timeline sequence.
|
|
72
74
|
*/
|
|
73
|
-
export declare class ArtboardNode extends
|
|
75
|
+
export declare class ArtboardNode extends VisualNode implements IRectangularNode, ContainerNode {
|
|
74
76
|
/**
|
|
75
77
|
* Returns a read-only list of all children of the node. General-purpose content containers such as ArtboardNode or
|
|
76
78
|
* GroupNode also provide a mutable {@link ContainerNode.children} list. Other nodes with a more specific structure can
|
|
@@ -84,6 +86,11 @@ export declare class ArtboardNode extends BaseNode implements IRectangularNode,
|
|
|
84
86
|
* The node's children. Use the methods on this ItemList object to get, add, and remove children.
|
|
85
87
|
*/
|
|
86
88
|
get children(): ItemList<Node>;
|
|
89
|
+
/**
|
|
90
|
+
* The background fill of the artboard. Artboards must always have a fill.
|
|
91
|
+
*/
|
|
92
|
+
set fill(fill: Fill);
|
|
93
|
+
get fill(): Readonly<Fill>;
|
|
87
94
|
/**
|
|
88
95
|
* The node's parent. Undefined if the node is an orphan.
|
|
89
96
|
*/
|
|
@@ -96,11 +103,6 @@ export declare class ArtboardNode extends BaseNode implements IRectangularNode,
|
|
|
96
103
|
* The height of the artboard.
|
|
97
104
|
*/
|
|
98
105
|
get height(): number;
|
|
99
|
-
/**
|
|
100
|
-
* The background fill of the artboard. Artboards must always have a fill.
|
|
101
|
-
*/
|
|
102
|
-
get fill(): Readonly<Fill>;
|
|
103
|
-
set fill(fill: Fill);
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
/**
|
|
@@ -110,6 +112,11 @@ export declare class ArtboardNode extends BaseNode implements IRectangularNode,
|
|
|
110
112
|
* properties.
|
|
111
113
|
*/
|
|
112
114
|
export declare class BaseNode {
|
|
115
|
+
/**
|
|
116
|
+
* A unique identifier for this node that stays the same when the file is closed & reopened, or if the node is
|
|
117
|
+
* moved to a different part of the document.
|
|
118
|
+
*/
|
|
119
|
+
get id(): string;
|
|
113
120
|
/**
|
|
114
121
|
* Returns a read-only list of all children of the node. General-purpose content containers such as ArtboardNode or
|
|
115
122
|
* GroupNode also provide a mutable {@link ContainerNode.children} list. Other nodes with a more specific structure can
|
|
@@ -120,7 +127,6 @@ export declare class BaseNode {
|
|
|
120
127
|
* to guarantee all their children are full-fledged Node instances.
|
|
121
128
|
*/
|
|
122
129
|
get allChildren(): Readonly<Iterable<BaseNode>>;
|
|
123
|
-
|
|
124
130
|
/**
|
|
125
131
|
* The node's type.
|
|
126
132
|
*/
|
|
@@ -292,9 +298,9 @@ export declare const constants: typeof ApiConstants;
|
|
|
292
298
|
* also hold children in specified "slots." Use {@link Node.allChildren} for read access to children regardless of node type.
|
|
293
299
|
*
|
|
294
300
|
* Some ContainerNode classes may be full-fledged Node subclasses (such as Group), while others may be a subclass of the
|
|
295
|
-
* more minimal
|
|
301
|
+
* more minimal VisualNode (such as Artboard).
|
|
296
302
|
*/
|
|
297
|
-
export declare interface ContainerNode extends
|
|
303
|
+
export declare interface ContainerNode extends VisualNode {
|
|
298
304
|
/**
|
|
299
305
|
* The node's children. Use the methods on this ItemList object to get, add, and remove children.
|
|
300
306
|
*/
|
|
@@ -332,12 +338,52 @@ export declare class Context {
|
|
|
332
338
|
* other UI state.
|
|
333
339
|
*/
|
|
334
340
|
get insertionParent(): ContainerNode;
|
|
341
|
+
/**
|
|
342
|
+
* @returns The currently viewed page.
|
|
343
|
+
*/
|
|
344
|
+
get currentPage(): PageNode;
|
|
335
345
|
}
|
|
336
346
|
|
|
337
347
|
/**
|
|
338
348
|
* Entry point for APIs that read or modify the document's content.
|
|
339
349
|
*/
|
|
340
350
|
export declare class Editor {
|
|
351
|
+
/**
|
|
352
|
+
* Enqueues a function to be run at a later time when edits to the user's document may be performed. You can always edit
|
|
353
|
+
* the document immediately when invoked in response to your add-on's UI code. However, if you delay to await an
|
|
354
|
+
* asynchronous operation such as {@link loadBitmapImage}, any edits following this pause must be scheduled using
|
|
355
|
+
* queueAsyncEdit(). This ensures the edit is properly tracked for saving and undo.
|
|
356
|
+
*
|
|
357
|
+
* The delay before your edit function is executed is typically just a few milliseconds, so it will appear instantaneous
|
|
358
|
+
* to users. However, note that queueAsyncEdit() will return *before* your function has been run.
|
|
359
|
+
* If you need to trigger any code after the edit has been performed, either include this in the lambda you are enqueuing
|
|
360
|
+
* or await the Promise returned by queueAsyncEdit().
|
|
361
|
+
*
|
|
362
|
+
* Generally, calling any setter or method is treated as an edit; but simple getters may be safely called at any time.
|
|
363
|
+
*
|
|
364
|
+
* Example of typical usage:
|
|
365
|
+
* ```javascript
|
|
366
|
+
* // Assume insertImage() is called from your UI code, and given a Blob containing image data
|
|
367
|
+
* async function insertImage(blob) {
|
|
368
|
+
* // This function was invoked from the UI iframe, so we can make any edits we want synchronously here.
|
|
369
|
+
* // Initially load the bitmap - an async operation
|
|
370
|
+
* const bitmapImage = await editor.loadBitmapImage(blob);
|
|
371
|
+
*
|
|
372
|
+
* // Execution doesn't arrive at this line until an async delay, due to the Promise 'await' above
|
|
373
|
+
*
|
|
374
|
+
* // Further edits need to be queued to run at a safe time
|
|
375
|
+
* editor.queueAsyncEdit(() => {
|
|
376
|
+
* // Create scenenode to display the image, and add it to the current artboard
|
|
377
|
+
* const mediaContainer = editor.createImageContainer(bitmapImage);
|
|
378
|
+
* editor.context.insertionParent.children.append(mediaContainer);
|
|
379
|
+
* });
|
|
380
|
+
* }
|
|
381
|
+
* ```
|
|
382
|
+
*
|
|
383
|
+
* @param lambda - a function which edits the document model.
|
|
384
|
+
* @returns a Promise that resolves when the lambda has finished running, or rejects if the lambda throws an error.
|
|
385
|
+
*/
|
|
386
|
+
queueAsyncEdit(lambda: () => void): Promise<void>;
|
|
341
387
|
/**
|
|
342
388
|
* User's current selection context
|
|
343
389
|
*/
|
|
@@ -376,7 +422,7 @@ export declare class Editor {
|
|
|
376
422
|
* container's mediaRectangle and maskShape children.
|
|
377
423
|
*
|
|
378
424
|
* Image creation involves some asynchronous steps. The image will be visible in this client almost instantly, but will
|
|
379
|
-
* render as a gray placeholder on other clients until it has been uploaded to
|
|
425
|
+
* render as a gray placeholder on other clients until it has been uploaded to DCX and then downloaded by those clients.
|
|
380
426
|
* This local client will act as having unsaved changes until the upload has finished.
|
|
381
427
|
*
|
|
382
428
|
* @param bitmapData - BitmapImage resource (e.g. returned from loadBitmapImage()).
|
|
@@ -405,7 +451,7 @@ export declare class Editor {
|
|
|
405
451
|
*
|
|
406
452
|
* @param bitmapData - Encoded image data in PNG or JPEG format.
|
|
407
453
|
*/
|
|
408
|
-
loadBitmapImage(
|
|
454
|
+
loadBitmapImage(rendition: Blob): Promise<BitmapImage>;
|
|
409
455
|
/**
|
|
410
456
|
* Convenience helper to create a complete Stroke value given just a subset of its fields. All other fields are
|
|
411
457
|
* populated with default values.
|
|
@@ -428,41 +474,13 @@ export declare class Editor {
|
|
|
428
474
|
*/
|
|
429
475
|
createText(): TextNode;
|
|
430
476
|
/**
|
|
431
|
-
*
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
* The delay before your edit function is executed is typically just a few milliseconds, so it will appear instantaneous
|
|
437
|
-
* to users. However, note that queueAsyncEdit() will return *before* your function has been run.
|
|
438
|
-
* If you need to trigger any code after the edit has been performed, either include this in the lambda you are enqueuing
|
|
439
|
-
* or await the Promise returned by queueAsyncEdit().
|
|
440
|
-
*
|
|
441
|
-
* Generally, calling any setter or method is treated as an edit; but simple getters may be safely called at any time.
|
|
442
|
-
*
|
|
443
|
-
* Example of typical usage:
|
|
444
|
-
* ```javascript
|
|
445
|
-
* // Assume insertImage() is called from your UI code, and given a Blob containing image data
|
|
446
|
-
* async function insertImage(blob) {
|
|
447
|
-
* // This function was invoked from the UI iframe, so we can make any edits we want synchronously here.
|
|
448
|
-
* // Initially load the bitmap - an async operation
|
|
449
|
-
* const bitmapImage = await editor.loadBitmapImage(blob);
|
|
450
|
-
*
|
|
451
|
-
* // Execution doesn't arrive at this line until an async delay, due to the Promise 'await' above
|
|
452
|
-
*
|
|
453
|
-
* // Further edits need to be queued to run at a safe time
|
|
454
|
-
* editor.queueAsyncEdit(() => {
|
|
455
|
-
* // Create scenenode to display the image, and add it to the current artboard
|
|
456
|
-
* const mediaContainer = editor.createImageContainer(bitmapImage);
|
|
457
|
-
* editor.context.insertionParent.children.append(mediaContainer);
|
|
458
|
-
* });
|
|
459
|
-
* }
|
|
460
|
-
* ```
|
|
461
|
-
*
|
|
462
|
-
* @param lambda - a function which edits the document model.
|
|
463
|
-
* @returns a Promise that resolves when the lambda has finished running, or rejects if the lambda throws an error.
|
|
477
|
+
* @returns a path node with a default stroke and no initial fill.
|
|
478
|
+
* @param path - a string representing any [SVG path element](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths).
|
|
479
|
+
* Note that the path data will be normalized, and therefore the `path` getter may return a different SVG string from the path creation input.
|
|
480
|
+
* For example, "M 10 80 Q 52.5 10, 95 80 T 180 80" becomes "M 10 80 C 38.33 33.33 66.67 33.33 95 80...".
|
|
481
|
+
* Throws if the input is empty or is not legal SVG path syntax.
|
|
464
482
|
*/
|
|
465
|
-
|
|
483
|
+
createPath(path: string): PathNode;
|
|
466
484
|
}
|
|
467
485
|
|
|
468
486
|
export declare const editor: ExpressEditor;
|
|
@@ -530,8 +548,8 @@ export declare class FillableNode extends StrokableNode implements IFillableNode
|
|
|
530
548
|
/**
|
|
531
549
|
* The fill applied to the shape, if any.
|
|
532
550
|
*/
|
|
533
|
-
get fill(): Readonly<Fill> | undefined;
|
|
534
551
|
set fill(fill: Fill | undefined);
|
|
552
|
+
get fill(): Readonly<Fill> | undefined;
|
|
535
553
|
}
|
|
536
554
|
|
|
537
555
|
/**
|
|
@@ -560,10 +578,15 @@ declare enum FillType {
|
|
|
560
578
|
}
|
|
561
579
|
|
|
562
580
|
/**
|
|
563
|
-
* A GridLayoutNode represents a grid layout in the scenegraph. The GridLayoutNode is used to
|
|
564
|
-
*
|
|
581
|
+
* A GridLayoutNode represents a grid layout in the scenegraph. The GridLayoutNode is used to create
|
|
582
|
+
* a layout grid that other content can be placed into.
|
|
565
583
|
*/
|
|
566
|
-
export declare class GridLayoutNode extends Node implements IRectangularNode {
|
|
584
|
+
export declare class GridLayoutNode extends Node implements Readonly<IRectangularNode> {
|
|
585
|
+
/**
|
|
586
|
+
* The background fill of the GridLayout.
|
|
587
|
+
*/
|
|
588
|
+
set fill(fill: Fill);
|
|
589
|
+
get fill(): Readonly<Fill>;
|
|
567
590
|
/**
|
|
568
591
|
* The width of the node.
|
|
569
592
|
*/
|
|
@@ -572,11 +595,6 @@ export declare class GridLayoutNode extends Node implements IRectangularNode {
|
|
|
572
595
|
* The height of the node.
|
|
573
596
|
*/
|
|
574
597
|
get height(): number;
|
|
575
|
-
/**
|
|
576
|
-
* The background fill of the GridLayout.
|
|
577
|
-
*/
|
|
578
|
-
get fill(): Readonly<Fill>;
|
|
579
|
-
set fill(fill: Fill);
|
|
580
598
|
}
|
|
581
599
|
|
|
582
600
|
/**
|
|
@@ -601,6 +619,12 @@ export declare class GroupNode extends Node implements ContainerNode {
|
|
|
601
619
|
* @throws if the given node type cannot be used as a vector mask.
|
|
602
620
|
*/
|
|
603
621
|
set maskShape(mask: FillableNode | undefined);
|
|
622
|
+
/**
|
|
623
|
+
* @override
|
|
624
|
+
* Note: If this group has a maskShape, group's bounds are always identical to the maskShape's, regardless of the
|
|
625
|
+
* group's other content.
|
|
626
|
+
*/
|
|
627
|
+
get boundsLocal(): Readonly<Rect>;
|
|
604
628
|
}
|
|
605
629
|
|
|
606
630
|
/**
|
|
@@ -770,11 +794,13 @@ export declare class MediaContainerNode extends Node {
|
|
|
770
794
|
|
|
771
795
|
/**
|
|
772
796
|
* A Node represents an object in the scenegraph, the document's visual content tree. Most tangible visual content is a
|
|
773
|
-
* subclass of Node, but note that some abstract top-level structural nodes (such as PageNode) only extend the more
|
|
774
|
-
* BaseNode. As a general rule, if you can click or drag an object with the select/move
|
|
775
|
-
* from Node.
|
|
797
|
+
* subclass of Node, but note that some abstract top-level structural nodes (such as PageNode) only extend the more
|
|
798
|
+
* minimal VisualNode or BaseNode. As a general rule, if you can click or drag an object with the select/move
|
|
799
|
+
* tool in the UI, then it extends from Node.
|
|
800
|
+
*
|
|
801
|
+
* A Node’s parent is always a VisualContentNode but may not be another Node (e.g. if the parent is an ArtboardNode)
|
|
776
802
|
*/
|
|
777
|
-
declare class Node extends
|
|
803
|
+
declare class Node extends VisualNode {
|
|
778
804
|
/**
|
|
779
805
|
* Returns a read-only list of all children of the node. General-purpose content containers such as ArtboardNode or
|
|
780
806
|
* GroupNode also provide a mutable {@link ContainerNode.children} list. Other nodes with a more specific structure can
|
|
@@ -784,16 +810,27 @@ declare class Node extends BaseNode {
|
|
|
784
810
|
* The children of a Node are always other Node classes (never the more minimal BaseNode).
|
|
785
811
|
*/
|
|
786
812
|
get allChildren(): Readonly<Iterable<Node>>;
|
|
813
|
+
/**
|
|
814
|
+
* An axis-aligned box in the parent’s coordinate space encompassing the node’s layout bounds (its
|
|
815
|
+
* {@link boundsLocal}, as transformed by its position and rotation relative to the parent). If the node has
|
|
816
|
+
* rotation, the top-left of its boundsLocal box (aligned to its own axes) is not necessarily located at the
|
|
817
|
+
* top-left of the boundsInParent box (since it's aligned to the parent's axes). This value is well-defined
|
|
818
|
+
* even for an orphan node with no parent.
|
|
819
|
+
*/
|
|
820
|
+
get boundsInParent(): Readonly<Rect>;
|
|
821
|
+
/**
|
|
822
|
+
* Convert the node's {@link boundsLocal} to an axis-aligned bounding box in the coordinate space of the target
|
|
823
|
+
* node. Both nodes must share the same {@link visualRoot}, but can lie anywhere within that subtree
|
|
824
|
+
* relative to one another (the target node need not be an ancestor of this node, nor vice versa).
|
|
825
|
+
*/
|
|
826
|
+
boundsInNode(targetNode: VisualNode): Readonly<Rect>;
|
|
787
827
|
/**
|
|
788
828
|
* The translation of the node along its parent's axes. This is identical to the translation component of
|
|
789
829
|
* `transformMatrix`. It is often simpler to set a node's position using `setPositionInParent` than by
|
|
790
830
|
* setting translation directly.
|
|
791
831
|
*/
|
|
792
|
-
get translation(): Readonly<
|
|
793
|
-
|
|
794
|
-
y: number;
|
|
795
|
-
}>;
|
|
796
|
-
set translation(value: { x: number; y: number });
|
|
832
|
+
get translation(): Readonly<Point>;
|
|
833
|
+
set translation(value: Point);
|
|
797
834
|
/**
|
|
798
835
|
* Move the node so the given `localRegistrationPoint` in its local coordinates is placed at the given
|
|
799
836
|
* `parentPoint` in its parent's coordinates (taking into account any rotation on this node, etc.).
|
|
@@ -818,7 +855,7 @@ declare class Node extends BaseNode {
|
|
|
818
855
|
* Set the node’s rotation angle relative to its parent to exactly the given value, keeping the given point in the
|
|
819
856
|
* node’s local coordinate space at a fixed location within the parent. Disregards any rotation the node may already
|
|
820
857
|
* have had. The angle set here may not be the absolute rotation angle seen on screen, if the parent or other
|
|
821
|
-
* ancestors have
|
|
858
|
+
* ancestors also have rotation of their own.
|
|
822
859
|
* @param angleInDegrees - Angle in degrees.
|
|
823
860
|
* @param localRotationPoint - Point to rotate around, in node's local coordinates.
|
|
824
861
|
* @example
|
|
@@ -871,6 +908,7 @@ export declare class PageList extends RestrictedItemList<PageNode> {
|
|
|
871
908
|
* with the same defaults as in {@link ArtboardList.addArtboard}. The page's artboard becomes the default target for
|
|
872
909
|
* newly inserted content ({@link Context.insertionParent}) and the viewport switches to display this artboard.
|
|
873
910
|
* @param geometry - The size of the new page.
|
|
911
|
+
*
|
|
874
912
|
*/
|
|
875
913
|
addPage(geometry: RectangleGeometry): PageNode;
|
|
876
914
|
}
|
|
@@ -899,6 +937,15 @@ export declare class PageNode extends BaseNode implements Readonly<IRectangularN
|
|
|
899
937
|
*/
|
|
900
938
|
get name(): string | undefined;
|
|
901
939
|
set name(name: string | undefined);
|
|
940
|
+
/**
|
|
941
|
+
* Clones this page, all artboards within it, and all content within those artboards. The cloned page is the same size
|
|
942
|
+
* as the original. Adds the new page immediately after this one in the pages list. The first artboard in the cloned
|
|
943
|
+
* page becomes the default target for newly inserted content ({@link Context.insertionParent}) and the viewport
|
|
944
|
+
* switches to display this artboard.
|
|
945
|
+
* @returns the cloned page.
|
|
946
|
+
*
|
|
947
|
+
*/
|
|
948
|
+
cloneInPlace(): PageNode;
|
|
902
949
|
}
|
|
903
950
|
|
|
904
951
|
/**
|
|
@@ -908,19 +955,20 @@ export declare class PageNode extends BaseNode implements Readonly<IRectangularN
|
|
|
908
955
|
export declare class PathNode extends FillableNode {
|
|
909
956
|
/**
|
|
910
957
|
* The path definition as an SVG string. The path data is read-only and cannot be modified via this API yet.
|
|
911
|
-
*
|
|
958
|
+
* Note that the path data will be normalized, and therefore the `path` getter may return a different SVG string from the path creation input.
|
|
959
|
+
* For example, "M 10 80 Q 52.5 10, 95 80 T 180 80" becomes "M 10 80 C 38.33 33.33 66.67 33.33 95 80...".
|
|
912
960
|
*/
|
|
913
961
|
get path(): string;
|
|
914
962
|
/**
|
|
915
963
|
* The fill rule specifies how the interior area of a path is determined in cases where the path is self-intersecting or
|
|
916
|
-
* has multiple disjoint parts.
|
|
964
|
+
* has multiple disjoint parts. The default value is nonZero.
|
|
917
965
|
*/
|
|
918
966
|
get fillRule(): FillRule;
|
|
967
|
+
set fillRule(rule: FillRule);
|
|
919
968
|
}
|
|
920
969
|
|
|
921
970
|
/**
|
|
922
971
|
* Represents a 2D position.
|
|
923
|
-
* @public
|
|
924
972
|
*/
|
|
925
973
|
export declare interface Point {
|
|
926
974
|
x: number;
|
|
@@ -967,6 +1015,13 @@ export declare class ReadOnlyItemList<T extends ListItem> {
|
|
|
967
1015
|
toArray(): Readonly<T[]>;
|
|
968
1016
|
}
|
|
969
1017
|
|
|
1018
|
+
declare interface Rect {
|
|
1019
|
+
x: number;
|
|
1020
|
+
y: number;
|
|
1021
|
+
width: number;
|
|
1022
|
+
height: number;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
970
1025
|
export declare interface RectangleGeometry {
|
|
971
1026
|
width: number;
|
|
972
1027
|
height: number;
|
|
@@ -1047,6 +1102,7 @@ export declare class RectangleNode extends FillableNode implements IRectangularN
|
|
|
1047
1102
|
declare class RestrictedItemList<T extends ListItem> extends ReadOnlyItemList<T> {
|
|
1048
1103
|
/**
|
|
1049
1104
|
* Remove the items from the list. The items need not be contiguous.
|
|
1105
|
+
*
|
|
1050
1106
|
* @throws If any of the items are not in the list, or if it is illegal to remove any of the items from this parent.
|
|
1051
1107
|
*/
|
|
1052
1108
|
remove(...items: T[]): void;
|
|
@@ -1122,8 +1178,8 @@ export declare class StrokableNode extends Node implements IStrokableNode {
|
|
|
1122
1178
|
/**
|
|
1123
1179
|
* The stroke applied to the shape, if any.
|
|
1124
1180
|
*/
|
|
1125
|
-
get stroke(): Readonly<Stroke> | undefined;
|
|
1126
1181
|
set stroke(stroke: Stroke | undefined);
|
|
1182
|
+
get stroke(): Readonly<Stroke> | undefined;
|
|
1127
1183
|
}
|
|
1128
1184
|
|
|
1129
1185
|
/**
|
|
@@ -1207,4 +1263,50 @@ export declare class TextNode extends Node {
|
|
|
1207
1263
|
*/
|
|
1208
1264
|
export declare class UnknownNode extends Node {}
|
|
1209
1265
|
|
|
1266
|
+
/**
|
|
1267
|
+
* A "node" represents an object in the scenegraph, the document's visual content tree. This class represents any node
|
|
1268
|
+
* that can be visually perceived in the content. Most visual content is a subclass of the richer Node class which extends
|
|
1269
|
+
* VisualNode with more properties, but the overall ArtboardNode container only supports the VisualNode APIs
|
|
1270
|
+
* (and higher-level more abstract containers like PageNode extend only the minimal BaseNode class).
|
|
1271
|
+
*
|
|
1272
|
+
* Some VisualNodes might have a non-visual parent such as a PageNode.
|
|
1273
|
+
*/
|
|
1274
|
+
export declare class VisualNode extends BaseNode {
|
|
1275
|
+
/**
|
|
1276
|
+
* The highest ancestor that still has visual presence in the document. Typically an Artboard, but for orphaned
|
|
1277
|
+
* content, it will be the root of the deleted content (which might be this node itself).
|
|
1278
|
+
*
|
|
1279
|
+
* Nodes that are both in the same visualRoot subtree lie within the same "visual space" of the document's
|
|
1280
|
+
* structure. Nodes that are in different visual roots have no spatial relation to one another; there is no
|
|
1281
|
+
* meaningful comparison or conversion between the bounds or coordinate spaces of such nodes.
|
|
1282
|
+
*/
|
|
1283
|
+
get visualRoot(): VisualNode;
|
|
1284
|
+
/**
|
|
1285
|
+
* The bounding box of the node, expressed in the node's local coordinate space (which may be shifted or rotated
|
|
1286
|
+
* relative to its parent). Generally matches the selection outline seen in the UI, encompassing the vector path
|
|
1287
|
+
* "spine" of the shape as well as its stroke, but excluding effects such as shadows.
|
|
1288
|
+
*
|
|
1289
|
+
* The top-left corner of the bounding box corresponds to the visual top-left corner of the node, but this value is
|
|
1290
|
+
* *not* necessarily (0,0) – this is especially true for Text and Path nodes.
|
|
1291
|
+
*/
|
|
1292
|
+
get boundsLocal(): Readonly<Rect>;
|
|
1293
|
+
/**
|
|
1294
|
+
* Position of the node's centerpoint in its own local coordinate space, i.e. the center of the boundsLocal
|
|
1295
|
+
* box.
|
|
1296
|
+
*/
|
|
1297
|
+
get centerPointLocal(): Readonly<Point>;
|
|
1298
|
+
/**
|
|
1299
|
+
* Position of the node's top-left corner in its own local coordinate space, equal to (boundsLocal.x,
|
|
1300
|
+
* boundsLocal.y). If the node is rotated, this is not the same as the top-left corner of
|
|
1301
|
+
* boundsInParent.
|
|
1302
|
+
*/
|
|
1303
|
+
get topLeftLocal(): Readonly<Point>;
|
|
1304
|
+
/**
|
|
1305
|
+
* Convert a point given in the node’s local coordinate space to a point in the coordinate space of the target node.
|
|
1306
|
+
* Both nodes must share the same {@link visualRoot}, but can lie anywhere within that subtree relative to one
|
|
1307
|
+
* another (the target node need not be an ancestor of this node, nor vice versa).
|
|
1308
|
+
*/
|
|
1309
|
+
localPointInNode(localPoint: Point, targetNode: VisualNode): Readonly<Point>;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1210
1312
|
export {};
|
package/ui/ui-sdk.d.ts
CHANGED
|
@@ -226,7 +226,6 @@ declare interface ApplicationBase {
|
|
|
226
226
|
showModalDialog(dialogOptions: CustomDialogOptions): Promise<CustomDialogResult>;
|
|
227
227
|
|
|
228
228
|
/**
|
|
229
|
-
* @experimental - Experimental API
|
|
230
229
|
* Triggers/Starts the in-app monetization upgrade flow
|
|
231
230
|
* @returns if the user is premium user or not
|
|
232
231
|
*/
|
|
@@ -467,6 +466,7 @@ declare namespace Constants {
|
|
|
467
466
|
ButtonType,
|
|
468
467
|
RuntimeType,
|
|
469
468
|
BleedUnit,
|
|
469
|
+
VideoResolution,
|
|
470
470
|
AuthorizationStatus
|
|
471
471
|
};
|
|
472
472
|
}
|
|
@@ -482,7 +482,6 @@ export declare interface CurrentUser {
|
|
|
482
482
|
userId(): Promise<string>;
|
|
483
483
|
|
|
484
484
|
/**
|
|
485
|
-
* @experimental - Experimental API
|
|
486
485
|
* @returns if the current user is a premium user
|
|
487
486
|
*/
|
|
488
487
|
isPremiumUser(): Promise<boolean>;
|
|
@@ -596,9 +595,9 @@ export declare type DisableDragToDocument = () => void;
|
|
|
596
595
|
*/
|
|
597
596
|
declare interface Document_2 {
|
|
598
597
|
/**
|
|
599
|
-
* Add image/gif to the current page
|
|
598
|
+
* Add image/gif/Ps/Ai files to the current page
|
|
600
599
|
*/
|
|
601
|
-
addImage(blob: Blob): Promise<void>;
|
|
600
|
+
addImage(blob: Blob, attributes?: MediaAttributes): Promise<void>;
|
|
602
601
|
/**
|
|
603
602
|
* Add video to the current page
|
|
604
603
|
*/
|
|
@@ -612,7 +611,6 @@ declare interface Document_2 {
|
|
|
612
611
|
*/
|
|
613
612
|
createRenditions(renditionOptions: RenditionOptions, renditionIntent?: RenditionIntent): Promise<Rendition[]>;
|
|
614
613
|
/**
|
|
615
|
-
* @experimental - Experimental API
|
|
616
614
|
* Get metadata of all or range of pages of the document
|
|
617
615
|
*/
|
|
618
616
|
getPagesMetadata(options: PageMetadataOptions): Promise<PageMetadata[]>;
|
|
@@ -754,8 +752,8 @@ export declare interface JpgRenditionOptions extends RenditionOptions {
|
|
|
754
752
|
* Requested size
|
|
755
753
|
*/
|
|
756
754
|
requestedSize?: {
|
|
757
|
-
width
|
|
758
|
-
height
|
|
755
|
+
width?: number;
|
|
756
|
+
height?: number;
|
|
759
757
|
};
|
|
760
758
|
}
|
|
761
759
|
|
|
@@ -827,6 +825,21 @@ export declare interface MediaAttributes {
|
|
|
827
825
|
title: string;
|
|
828
826
|
}
|
|
829
827
|
|
|
828
|
+
export declare interface Mp4RenditionOptions extends RenditionOptions {
|
|
829
|
+
/**
|
|
830
|
+
* mp4 rendition format
|
|
831
|
+
*/
|
|
832
|
+
format: RenditionFormat.mp4;
|
|
833
|
+
/**
|
|
834
|
+
* Video resolution
|
|
835
|
+
*/
|
|
836
|
+
resolution?: VideoResolution;
|
|
837
|
+
/**
|
|
838
|
+
* Custom Resolution (in pixel)
|
|
839
|
+
*/
|
|
840
|
+
customResolution?: number;
|
|
841
|
+
}
|
|
842
|
+
|
|
830
843
|
/**
|
|
831
844
|
* OAuth 2.0 middleware for handling user sign-in.
|
|
832
845
|
*/
|
|
@@ -912,15 +925,78 @@ export declare interface PageRendition extends Rendition {
|
|
|
912
925
|
metadata: PageMetadata;
|
|
913
926
|
}
|
|
914
927
|
|
|
928
|
+
/**
|
|
929
|
+
* Represents a PDF Page box
|
|
930
|
+
*/
|
|
931
|
+
export declare interface PdfPageBox {
|
|
932
|
+
/**
|
|
933
|
+
* Margins for a box
|
|
934
|
+
*/
|
|
935
|
+
margins: PdfPageBoxMargins;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* All the PDF Page boxes (MediaBox, BleedBox, CropBox, TrimBox)
|
|
940
|
+
*/
|
|
941
|
+
export declare interface PdfPageBoxes {
|
|
942
|
+
/**
|
|
943
|
+
* Media box
|
|
944
|
+
*/
|
|
945
|
+
mediaBox?: PdfPageBox;
|
|
946
|
+
/**
|
|
947
|
+
* Bleed box
|
|
948
|
+
*/
|
|
949
|
+
bleedBox?: PdfPageBox;
|
|
950
|
+
/**
|
|
951
|
+
* Crop box
|
|
952
|
+
*/
|
|
953
|
+
cropBox?: PdfPageBox;
|
|
954
|
+
/**
|
|
955
|
+
* Trim box
|
|
956
|
+
*/
|
|
957
|
+
trimBox?: PdfPageBox;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* Margins for a PDF page box
|
|
962
|
+
*/
|
|
963
|
+
export declare interface PdfPageBoxMargins {
|
|
964
|
+
/**
|
|
965
|
+
* Top margin
|
|
966
|
+
*/
|
|
967
|
+
top?: Bleed;
|
|
968
|
+
/**
|
|
969
|
+
* Bottom margin
|
|
970
|
+
*/
|
|
971
|
+
bottom?: Bleed;
|
|
972
|
+
/**
|
|
973
|
+
* Left margin
|
|
974
|
+
*/
|
|
975
|
+
left?: Bleed;
|
|
976
|
+
/**
|
|
977
|
+
* Right margin
|
|
978
|
+
*/
|
|
979
|
+
right?: Bleed;
|
|
980
|
+
}
|
|
981
|
+
|
|
915
982
|
export declare interface PdfRenditionOptions extends RenditionOptions {
|
|
916
983
|
/**
|
|
917
984
|
* PDF rendition format
|
|
918
985
|
*/
|
|
919
986
|
format: RenditionFormat.pdf;
|
|
920
987
|
/**
|
|
921
|
-
* Bleed for the page.
|
|
988
|
+
* Bleed for the page.
|
|
989
|
+
* If bleed is defined, then CropBox and TrimBox will be the size of the express document. BleedBox and MediaBox will be equal to each other,
|
|
990
|
+
* and they will expand on all sides (left, top, right, bottom) with the amount/unit specified by bleed.
|
|
991
|
+
* If undefined, then no bleed (zero).
|
|
922
992
|
*/
|
|
923
993
|
bleed?: Bleed;
|
|
994
|
+
/**
|
|
995
|
+
* Exposes ability to customize each PDF Page Box (MediaBox, BleedBox, CropBox, TrimBox) dimensions,
|
|
996
|
+
* by defining how much it should expand on each side beyond the express document page size.
|
|
997
|
+
* If pageBoxes are defined, then PdfRenditionOptions.bleed is ignored.
|
|
998
|
+
*/
|
|
999
|
+
pageBoxes?: PdfPageBoxes;
|
|
924
1000
|
}
|
|
925
1001
|
|
|
926
1002
|
export declare interface PngRenditionOptions extends RenditionOptions {
|
|
@@ -938,8 +1014,8 @@ export declare interface PngRenditionOptions extends RenditionOptions {
|
|
|
938
1014
|
* Requested size
|
|
939
1015
|
*/
|
|
940
1016
|
requestedSize?: {
|
|
941
|
-
width
|
|
942
|
-
height
|
|
1017
|
+
width?: number;
|
|
1018
|
+
height?: number;
|
|
943
1019
|
};
|
|
944
1020
|
}
|
|
945
1021
|
|
|
@@ -1070,7 +1146,11 @@ export declare enum RenditionIntent {
|
|
|
1070
1146
|
/**
|
|
1071
1147
|
* Intent to preview the content
|
|
1072
1148
|
*/
|
|
1073
|
-
preview = "preview"
|
|
1149
|
+
preview = "preview",
|
|
1150
|
+
/**
|
|
1151
|
+
* Intent to export and print the content
|
|
1152
|
+
*/
|
|
1153
|
+
print = "print"
|
|
1074
1154
|
}
|
|
1075
1155
|
|
|
1076
1156
|
export declare interface RenditionOptions {
|
|
@@ -1226,4 +1306,26 @@ export declare enum Variant {
|
|
|
1226
1306
|
custom = "custom"
|
|
1227
1307
|
}
|
|
1228
1308
|
|
|
1309
|
+
/**
|
|
1310
|
+
* Video resolution options for the mp4 renditions
|
|
1311
|
+
*/
|
|
1312
|
+
export declare enum VideoResolution {
|
|
1313
|
+
/**
|
|
1314
|
+
* SD 480p video resolution
|
|
1315
|
+
*/
|
|
1316
|
+
sd480p = "480p",
|
|
1317
|
+
/**
|
|
1318
|
+
* HD 720p video resolution
|
|
1319
|
+
*/
|
|
1320
|
+
hd720p = "720p",
|
|
1321
|
+
/**
|
|
1322
|
+
* FHD 1080p video resolution
|
|
1323
|
+
*/
|
|
1324
|
+
fhd1080p = "1080p",
|
|
1325
|
+
/**
|
|
1326
|
+
* Custom video resolution
|
|
1327
|
+
*/
|
|
1328
|
+
custom = "custom"
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1229
1331
|
export {};
|