@adobe/ccweb-add-on-sdk-types 1.0.0 → 1.1.1
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 -2
- package/{add-on-script-sdk.d.ts → add-on-sandbox-sdk.d.ts} +6 -6
- package/index.d.ts +1 -1
- package/package.json +10 -2
- package/sandbox/add-on-sdk-document-sandbox.d.ts +236 -0
- package/{script/express.d.ts → sandbox/express-document-sdk.d.ts} +372 -179
- package/{script → sandbox}/global.d.ts +6 -7
- package/{script → sandbox}/index.d.ts +3 -3
- package/ui/ui-sdk.d.ts +241 -11
- package/script/script-sdk.d.ts +0 -101
|
@@ -25,33 +25,13 @@
|
|
|
25
25
|
import { mat2d } from "gl-matrix";
|
|
26
26
|
|
|
27
27
|
declare namespace ApiConstants {
|
|
28
|
-
export {
|
|
29
|
-
SceneNodeTypeValueID,
|
|
30
|
-
BlendModeValue,
|
|
31
|
-
FillTypeValue,
|
|
32
|
-
ArrowHeadType,
|
|
33
|
-
TextAlignmentValue,
|
|
34
|
-
FillRuleValue,
|
|
35
|
-
StrokePositionValue
|
|
36
|
-
};
|
|
28
|
+
export { SceneNodeType, BlendMode, FillType, ArrowHeadType, TextAlignment, FillRule, StrokePosition };
|
|
37
29
|
}
|
|
38
30
|
|
|
39
31
|
declare interface ApiModuleExport {
|
|
40
32
|
editor: ExpressEditor;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
declare interface ApiUtils {
|
|
46
|
-
/**
|
|
47
|
-
* Create a new Color. All color components should be in a 0 - 1 range.
|
|
48
|
-
*
|
|
49
|
-
* @param red - The red component in a range from 0 - 1.
|
|
50
|
-
* @param green - The green component in a range from 0 - 1.
|
|
51
|
-
* @param blue - The blue component in a range from 0 - 1.
|
|
52
|
-
* @param alpha - (optional) The alpha component in a range from 0 - 1. Defaults to 1 (fully opaque).
|
|
53
|
-
*/
|
|
54
|
-
createColor(red: number, green: number, blue: number, alpha?: number): Color;
|
|
33
|
+
constants: unknown;
|
|
34
|
+
colorUtils: ExpressColorUtils;
|
|
55
35
|
}
|
|
56
36
|
|
|
57
37
|
/**
|
|
@@ -76,21 +56,13 @@ declare enum ArrowHeadType {
|
|
|
76
56
|
* ArtboardList also provides APIs for adding/removing artboards from the page. ArtboardList is never empty: it is illegal to
|
|
77
57
|
* remove the last remaining artboard from the list.
|
|
78
58
|
*/
|
|
79
|
-
export declare class ArtboardList extends
|
|
59
|
+
export declare class ArtboardList extends RestrictedItemList<ArtboardNode> {
|
|
80
60
|
/**
|
|
81
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
|
|
82
62
|
* artboard background is set to default fill color {@link DEFAULT_ARTBOARD_FILL_COLOR}.
|
|
83
63
|
* @returns the newly added artboard.
|
|
84
64
|
*/
|
|
85
65
|
addArtboard(): ArtboardNode;
|
|
86
|
-
/**
|
|
87
|
-
* Remove the items from the list.
|
|
88
|
-
*
|
|
89
|
-
* @throws An error if any of the items are not in the list or if removing the
|
|
90
|
-
* items would cause the list to be empty. If one of these errors occurs, the list
|
|
91
|
-
* is not modified.
|
|
92
|
-
*/
|
|
93
|
-
remove(...items: ArtboardNode[]): void;
|
|
94
66
|
}
|
|
95
67
|
|
|
96
68
|
/**
|
|
@@ -98,7 +70,20 @@ export declare class ArtboardList extends ReadOnlyItemList<ArtboardNode> {
|
|
|
98
70
|
*
|
|
99
71
|
* When multiple artboards exist on a page, the artboards represent "scenes" in a linear timeline sequence.
|
|
100
72
|
*/
|
|
101
|
-
export declare class ArtboardNode extends
|
|
73
|
+
export declare class ArtboardNode extends BaseNode implements IRectangularNode, ContainerNode {
|
|
74
|
+
/**
|
|
75
|
+
* Returns a read-only list of all children of the node. General-purpose content containers such as ArtboardNode or
|
|
76
|
+
* GroupNode also provide a mutable {@link ContainerNode.children} list. Other nodes with a more specific structure can
|
|
77
|
+
* hold children in various discrete "slots"; this `allChildren` list includes *all* such children and reflects their
|
|
78
|
+
* overall display z-order.
|
|
79
|
+
*
|
|
80
|
+
* The children of an Artboard are always other Node classes (never the more minimal BaseNode).
|
|
81
|
+
*/
|
|
82
|
+
get allChildren(): Readonly<Iterable<Node>>;
|
|
83
|
+
/**
|
|
84
|
+
* The node's children. Use the methods on this ItemList object to get, add, and remove children.
|
|
85
|
+
*/
|
|
86
|
+
get children(): ItemList<Node>;
|
|
102
87
|
/**
|
|
103
88
|
* The node's parent. Undefined if the node is an orphan.
|
|
104
89
|
*/
|
|
@@ -112,14 +97,44 @@ export declare class ArtboardNode extends ContainerNode implements IRectangularN
|
|
|
112
97
|
*/
|
|
113
98
|
get height(): number;
|
|
114
99
|
/**
|
|
115
|
-
* The background fill of the artboard.
|
|
100
|
+
* The background fill of the artboard. Artboards must always have a fill.
|
|
116
101
|
*/
|
|
117
|
-
get fill(): Fill
|
|
102
|
+
get fill(): Readonly<Fill>;
|
|
118
103
|
set fill(fill: Fill);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* A "node" represents an object in the scenegraph, the document's visual content tree. This base class includes only the
|
|
108
|
+
* most fundamental nonvisual properties that even nodes near the top of the document structure share (such as PageNode).
|
|
109
|
+
* The more tangible visual content typically extends the richer Node class which extends BaseNode with additional
|
|
110
|
+
* properties.
|
|
111
|
+
*/
|
|
112
|
+
export declare class BaseNode {
|
|
113
|
+
/**
|
|
114
|
+
* Returns a read-only list of all children of the node. General-purpose content containers such as ArtboardNode or
|
|
115
|
+
* GroupNode also provide a mutable {@link ContainerNode.children} list. Other nodes with a more specific structure can
|
|
116
|
+
* hold children in various discrete "slots"; this `allChildren` list includes *all* such children and reflects their
|
|
117
|
+
* overall display z-order.
|
|
118
|
+
*
|
|
119
|
+
* Although BaseNode's allChildren may yield other BaseNodes, the subclasses Node and ArtboardNode override allChildren
|
|
120
|
+
* to guarantee all their children are full-fledged Node instances.
|
|
121
|
+
*/
|
|
122
|
+
get allChildren(): Readonly<Iterable<BaseNode>>;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The node's type.
|
|
126
|
+
*/
|
|
127
|
+
get type(): SceneNodeType;
|
|
128
|
+
/**
|
|
129
|
+
* The node's parent. Undefined if the node is an orphan, or if the node is the artwork root.
|
|
130
|
+
*/
|
|
131
|
+
get parent(): BaseNode | undefined;
|
|
119
132
|
/**
|
|
120
|
-
*
|
|
133
|
+
* Removes the node from its parent - for a basic ContainerNode, this is equivalent to `node.parent.children.remove(node)`.
|
|
134
|
+
* For nodes with other slots, removes the child from whichever slot it resides in, if possible. Throws if the slot does
|
|
135
|
+
* not support removal. Also throws if node is the artwork root. No-op if node is already an orphan.
|
|
121
136
|
*/
|
|
122
|
-
|
|
137
|
+
removeFromParent(): void;
|
|
123
138
|
}
|
|
124
139
|
|
|
125
140
|
/**
|
|
@@ -146,7 +161,7 @@ export declare interface BitmapImage {
|
|
|
146
161
|
* If a node is inside a container whose blend mode anything other than {@link passThrough}, then the node's blend mode only
|
|
147
162
|
* interacts with other siblings within the same container. See documentation below for details.
|
|
148
163
|
*/
|
|
149
|
-
declare enum
|
|
164
|
+
declare enum BlendMode {
|
|
150
165
|
/**
|
|
151
166
|
* This blend mode only applies to container nodes with children; for leaf nodes, it is treated the same as `normal`.
|
|
152
167
|
*
|
|
@@ -182,33 +197,25 @@ declare enum BlendModeValue {
|
|
|
182
197
|
}
|
|
183
198
|
|
|
184
199
|
/**
|
|
185
|
-
* Represents
|
|
200
|
+
* Represents an RGBA color.
|
|
186
201
|
*/
|
|
187
|
-
export declare
|
|
202
|
+
export declare interface Color {
|
|
188
203
|
/**
|
|
189
204
|
* The red channel in range from 0 - 1.
|
|
190
205
|
*/
|
|
191
|
-
|
|
206
|
+
red: number;
|
|
192
207
|
/**
|
|
193
208
|
* The green channel in range from 0 - 1.
|
|
194
209
|
*/
|
|
195
|
-
|
|
210
|
+
green: number;
|
|
196
211
|
/**
|
|
197
212
|
* The blue channel in range from 0 - 1.
|
|
198
213
|
*/
|
|
199
|
-
|
|
214
|
+
blue: number;
|
|
200
215
|
/**
|
|
201
216
|
* The alpha channel in range from 0 - 1.
|
|
202
217
|
*/
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* This color's color space. Currently only sRGB is supported.
|
|
206
|
-
*/
|
|
207
|
-
get colorSpace(): ColorSpace;
|
|
208
|
-
/**
|
|
209
|
-
* Get the color in 8-digit hex "#RRGGBBAA" format.
|
|
210
|
-
*/
|
|
211
|
-
getHex(): string;
|
|
218
|
+
alpha: number;
|
|
212
219
|
}
|
|
213
220
|
|
|
214
221
|
/**
|
|
@@ -218,28 +225,65 @@ export declare interface ColorFill extends Fill {
|
|
|
218
225
|
/**
|
|
219
226
|
* The fill type.
|
|
220
227
|
*/
|
|
221
|
-
readonly type:
|
|
228
|
+
readonly type: FillType.color;
|
|
222
229
|
/**
|
|
223
230
|
* The fill color.
|
|
224
231
|
*/
|
|
225
|
-
|
|
232
|
+
color: Color;
|
|
226
233
|
}
|
|
227
234
|
|
|
228
235
|
/**
|
|
229
|
-
*
|
|
236
|
+
* Utility methods for working with color values.
|
|
230
237
|
*/
|
|
231
|
-
export declare
|
|
232
|
-
|
|
238
|
+
export declare class ColorUtils {
|
|
239
|
+
/**
|
|
240
|
+
* Create a new Color. All color components should be in a 0 - 1 range.
|
|
241
|
+
*
|
|
242
|
+
* @param redOrPartialColor - The red component in a range from 0 - 1; or Partial Color object having alpha component as partial.
|
|
243
|
+
* @param green - The green component in a range from 0 - 1.
|
|
244
|
+
* @param blue - The blue component in a range from 0 - 1.
|
|
245
|
+
* @param alpha - (optional) The alpha component in a range from 0 - 1. Defaults to 1 (fully opaque).
|
|
246
|
+
*/
|
|
247
|
+
fromRGB(red: number, green: number, blue: number, alpha?: number): Color;
|
|
248
|
+
fromRGB(color: { red: number; green: number; blue: number; alpha?: number }): Color;
|
|
249
|
+
/**
|
|
250
|
+
* Create a new color from its equivalent RGBA hex representation. Currently only
|
|
251
|
+
* supports formats "#RRGGBBAA" or "RRGGBBAA". If the hex value is invalid, this
|
|
252
|
+
* method will return transparent black.
|
|
253
|
+
*
|
|
254
|
+
* @param hex - The color in hex representation.
|
|
255
|
+
* @returns A new color matching the given hex representation, or transparent black if
|
|
256
|
+
* the hex string cannot be parsed.
|
|
257
|
+
*/
|
|
258
|
+
fromHex(hex: string): Color;
|
|
259
|
+
/**
|
|
260
|
+
* Get the color in 8-digit hex "#RRGGBBAA" format.
|
|
261
|
+
* @privateRemarks
|
|
262
|
+
* Future: Since this format is only valid for the sRGB color space, if the color is in another color space once other
|
|
263
|
+
* spaces are supported, the value return here would be a lossy conversion.
|
|
264
|
+
*/
|
|
265
|
+
toHex(color: Color): string;
|
|
233
266
|
}
|
|
234
267
|
|
|
235
|
-
export declare const
|
|
268
|
+
export declare const colorUtils: ExpressColorUtils;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* A ComplexShapeNode is complex prepackaged shape that appears as a leaf node in the UI, even if it is composed
|
|
272
|
+
* of multiple separate paths.
|
|
273
|
+
*/
|
|
274
|
+
export declare class ComplexShapeNode extends FillableNode {}
|
|
275
|
+
|
|
276
|
+
export declare const constants: typeof ApiConstants;
|
|
236
277
|
|
|
237
278
|
/**
|
|
238
|
-
*
|
|
279
|
+
* Interface for any node that contains an entirely generic collection of children. Some ContainerNode classes may host
|
|
239
280
|
* *additional* children in other specific "slots," such as background or mask layers; and non-ContainerNode classes may
|
|
240
281
|
* also hold children in specified "slots." Use {@link Node.allChildren} for read access to children regardless of node type.
|
|
282
|
+
*
|
|
283
|
+
* Some ContainerNode classes may be full-fledged Node subclasses (such as Group), while others may be a subclass of the
|
|
284
|
+
* more minimal BaseNode (such as Artboard).
|
|
241
285
|
*/
|
|
242
|
-
export declare
|
|
286
|
+
export declare interface ContainerNode extends BaseNode {
|
|
243
287
|
/**
|
|
244
288
|
* The node's children. Use the methods on this ItemList object to get, add, and remove children.
|
|
245
289
|
*/
|
|
@@ -254,6 +298,13 @@ export declare class Context {
|
|
|
254
298
|
* @returns the current selection. Nodes that are locked or otherwise non-editable are never included in the selection.
|
|
255
299
|
*/
|
|
256
300
|
get selection(): readonly Node[];
|
|
301
|
+
/**
|
|
302
|
+
* Sets the current selection, automatically ensuring these rules are met:
|
|
303
|
+
* - Nodes must be within the current artboard (others are filtered out).
|
|
304
|
+
* - A node cannot be selected at the same time as its ancestor (descendants are filtered out).
|
|
305
|
+
* - Locked nodes are filtered out (but will still be included in selectionIncludingNonEditable).
|
|
306
|
+
*/
|
|
307
|
+
set selection(nodes: Node | readonly Node[] | undefined);
|
|
257
308
|
/**
|
|
258
309
|
* @returns the current selection *and* any locked nodes the user has attempted to select at the same time. This can
|
|
259
310
|
* happen for example if the user clicks on a locked node or if the user drags a selection marquee that overlaps
|
|
@@ -283,12 +334,12 @@ export declare class Editor {
|
|
|
283
334
|
*/
|
|
284
335
|
get documentRoot(): ExpressRootNode;
|
|
285
336
|
/**
|
|
286
|
-
* @returns an ellipse node with default x/y radii, and
|
|
337
|
+
* @returns an ellipse node with default x/y radii, a black fill, and no initial stroke.
|
|
287
338
|
* Transform values default to 0.
|
|
288
339
|
*/
|
|
289
340
|
createEllipse(): EllipseNode;
|
|
290
341
|
/**
|
|
291
|
-
* @returns a rectangle node with default width and height, and
|
|
342
|
+
* @returns a rectangle node with default width and height, a black fill, and no initial stroke.
|
|
292
343
|
* Transform values default to 0.
|
|
293
344
|
*/
|
|
294
345
|
createRectangle(): RectangleNode;
|
|
@@ -302,10 +353,10 @@ export declare class Editor {
|
|
|
302
353
|
*/
|
|
303
354
|
createGroup(): GroupNode;
|
|
304
355
|
/**
|
|
356
|
+
* Convenience helper to create a complete ColorFill value given just its color.
|
|
305
357
|
* @param color - The color to use for the fill.
|
|
306
|
-
* @returns a solid color fill.
|
|
307
358
|
*/
|
|
308
|
-
|
|
359
|
+
makeColorFill(color: Color): ColorFill;
|
|
309
360
|
/**
|
|
310
361
|
* Creates a bitmap image, represented as a multi-node MediaContainerNode structure. Always creates a "full-frame,"
|
|
311
362
|
* uncropped image initially, but cropping can be changed after it is created by modifying the properties of the
|
|
@@ -340,27 +391,62 @@ export declare class Editor {
|
|
|
340
391
|
*/
|
|
341
392
|
loadBitmapImage(bitmapData: Blob): Promise<BitmapImage>;
|
|
342
393
|
/**
|
|
343
|
-
*
|
|
394
|
+
* Convenience helper to create a complete Stroke value given just a subset of its fields. All other fields are
|
|
395
|
+
* populated with default values.
|
|
396
|
+
*
|
|
397
|
+
* See {@link Stroke} for more details on the `options` fields. Defaults:
|
|
344
398
|
* - `color` has default value {@link DEFAULT_STROKE_COLOR} if none is provided.
|
|
345
399
|
* - `width` has default value {@link DEFAULT_STROKE_WIDTH} if none is provided.
|
|
346
|
-
* - `
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
* - `dashOffset` has default value 0 if none is provided. This options field is ignored
|
|
400
|
+
* - `position` has default value `center` if none is provided.
|
|
401
|
+
* - `dashPattern` has default value [] if none is provided.
|
|
402
|
+
* - `dashOffset` has default value 0 if none is provided. This field is ignored
|
|
350
403
|
* if no `dashPattern` was provided.
|
|
351
404
|
*
|
|
352
|
-
* The stroke's `position` field cannot be specified via options yet because only
|
|
353
|
-
* {@link StrokePositionValue.center} is supported.
|
|
354
|
-
*
|
|
355
405
|
* @returns a stroke configured with the given options.
|
|
356
406
|
*/
|
|
357
|
-
|
|
407
|
+
makeStroke(options?: Partial<Stroke>): Stroke;
|
|
358
408
|
/**
|
|
359
409
|
* @returns a text node with default styles. The text content is initially empty, so the text node will be
|
|
360
410
|
* invisible until its `text` property is set. Creates point text, so the node's width will automatically
|
|
361
411
|
* adjust to accommodate whatever text is set.
|
|
362
412
|
*/
|
|
363
413
|
createText(): TextNode;
|
|
414
|
+
/**
|
|
415
|
+
* Enqueues a function to be run at a later time when edits to the user's document may be performed. You can always edit
|
|
416
|
+
* the document immediately when invoked in response to your add-on's UI code. However, if you delay to await an
|
|
417
|
+
* asynchronous operation such as {@link loadBitmapImage}, any edits following this pause must be scheduled using
|
|
418
|
+
* queueAsyncEdit(). This ensures the edit is properly tracked for saving and undo.
|
|
419
|
+
*
|
|
420
|
+
* The delay before your edit function is executed is typically just a few milliseconds, so it will appear instantaneous
|
|
421
|
+
* to users. However, note that queueAsyncEdit() will return *before* your function has been run.
|
|
422
|
+
* If you need to trigger any code after the edit has been performed, either include this in the lambda you are enqueuing
|
|
423
|
+
* or await the Promise returned by queueAsyncEdit().
|
|
424
|
+
*
|
|
425
|
+
* Generally, calling any setter or method is treated as an edit; but simple getters may be safely called at any time.
|
|
426
|
+
*
|
|
427
|
+
* Example of typical usage:
|
|
428
|
+
* ```javascript
|
|
429
|
+
* // Assume insertImage() is called from your UI code, and given a Blob containing image data
|
|
430
|
+
* async function insertImage(blob) {
|
|
431
|
+
* // This function was invoked from the UI iframe, so we can make any edits we want synchronously here.
|
|
432
|
+
* // Initially load the bitmap - an async operation
|
|
433
|
+
* const bitmapImage = await editor.loadBitmapImage(blob);
|
|
434
|
+
*
|
|
435
|
+
* // Execution doesn't arrive at this line until an async delay, due to the Promise 'await' above
|
|
436
|
+
*
|
|
437
|
+
* // Further edits need to be queued to run at a safe time
|
|
438
|
+
* editor.queueAsyncEdit(() => {
|
|
439
|
+
* // Create scenenode to display the image, and add it to the current artboard
|
|
440
|
+
* const mediaContainer = editor.createImageContainer(bitmapImage);
|
|
441
|
+
* editor.context.insertionParent.children.append(mediaContainer);
|
|
442
|
+
* });
|
|
443
|
+
* }
|
|
444
|
+
* ```
|
|
445
|
+
*
|
|
446
|
+
* @param lambda - a function which edits the document model.
|
|
447
|
+
* @returns a Promise that resolves when the lambda has finished running, or rejects if the lambda throws an error.
|
|
448
|
+
*/
|
|
449
|
+
queueAsyncEdit(lambda: () => void): Promise<void>;
|
|
364
450
|
}
|
|
365
451
|
|
|
366
452
|
export declare const editor: ExpressEditor;
|
|
@@ -392,12 +478,14 @@ export declare class EllipseNode extends FillableNode {
|
|
|
392
478
|
declare const expressApiModule: ApiModuleExport;
|
|
393
479
|
export default expressApiModule;
|
|
394
480
|
|
|
481
|
+
declare class ExpressColorUtils extends ColorUtils {}
|
|
482
|
+
|
|
395
483
|
declare class ExpressEditor extends Editor {}
|
|
396
484
|
|
|
397
485
|
/**
|
|
398
486
|
* An ExpressRootNode represents the root node of the document's "scenegraph" artwork tree.
|
|
399
487
|
*/
|
|
400
|
-
export declare class ExpressRootNode extends
|
|
488
|
+
export declare class ExpressRootNode extends BaseNode {
|
|
401
489
|
/**
|
|
402
490
|
* The pages of the document. All visual content is contained on artboards within the pages.
|
|
403
491
|
*/
|
|
@@ -411,7 +499,7 @@ export declare interface Fill {
|
|
|
411
499
|
/**
|
|
412
500
|
* The fill type.
|
|
413
501
|
*/
|
|
414
|
-
readonly type:
|
|
502
|
+
readonly type: FillType;
|
|
415
503
|
}
|
|
416
504
|
|
|
417
505
|
/**
|
|
@@ -419,16 +507,17 @@ export declare interface Fill {
|
|
|
419
507
|
*/
|
|
420
508
|
export declare class FillableNode extends StrokableNode implements IFillableNode {
|
|
421
509
|
/**
|
|
422
|
-
*
|
|
510
|
+
* The fill applied to the shape, if any.
|
|
423
511
|
*/
|
|
424
|
-
get
|
|
512
|
+
get fill(): Readonly<Fill> | undefined;
|
|
513
|
+
set fill(fill: Fill | undefined);
|
|
425
514
|
}
|
|
426
515
|
|
|
427
516
|
/**
|
|
428
517
|
* <InlineAlert slots="text" variant="warning"/>
|
|
429
518
|
* *Do not depend on the literal numeric values of these constants*, as they may change. Always reference the enum identifiers in your code.
|
|
430
519
|
*/
|
|
431
|
-
declare enum
|
|
520
|
+
declare enum FillRule {
|
|
432
521
|
nonZero = 0,
|
|
433
522
|
evenOdd = 1
|
|
434
523
|
}
|
|
@@ -441,16 +530,36 @@ declare enum FillRuleValue {
|
|
|
441
530
|
* *Additional fill types may be added in the future.* If your code has different branches or cases depending on fill type,
|
|
442
531
|
* always have a default/fallback case to handle any unknown values you may encounter.
|
|
443
532
|
*/
|
|
444
|
-
declare enum
|
|
533
|
+
declare enum FillType {
|
|
445
534
|
/** A solid color fill. */
|
|
446
535
|
color = "Color"
|
|
447
536
|
}
|
|
448
537
|
|
|
538
|
+
/**
|
|
539
|
+
* A GridLayoutNode represents a grid layout in the scenegraph. The GridLayoutNode is used to
|
|
540
|
+
* create a layout grid that other content can be placed into.
|
|
541
|
+
*/
|
|
542
|
+
export declare class GridLayoutNode extends Node implements IRectangularNode {
|
|
543
|
+
/**
|
|
544
|
+
* The width of the node.
|
|
545
|
+
*/
|
|
546
|
+
get width(): number;
|
|
547
|
+
/**
|
|
548
|
+
* The height of the node.
|
|
549
|
+
*/
|
|
550
|
+
get height(): number;
|
|
551
|
+
/**
|
|
552
|
+
* The background fill of the GridLayout.
|
|
553
|
+
*/
|
|
554
|
+
get fill(): Readonly<Fill>;
|
|
555
|
+
set fill(fill: Fill);
|
|
556
|
+
}
|
|
557
|
+
|
|
449
558
|
/**
|
|
450
559
|
* A GroupNode represents a Group object in the scenegraph, which has a collection of generic children as well as a separate,
|
|
451
560
|
* optional vector mask child.
|
|
452
561
|
*/
|
|
453
|
-
export declare class GroupNode extends ContainerNode {
|
|
562
|
+
export declare class GroupNode extends Node implements ContainerNode {
|
|
454
563
|
/**
|
|
455
564
|
* The Group's regular children. Does not include the maskShape if one is present.
|
|
456
565
|
* Use the methods on this ItemList object to get, add, and remove children.
|
|
@@ -463,7 +572,7 @@ export declare class GroupNode extends ContainerNode {
|
|
|
463
572
|
*/
|
|
464
573
|
get maskShape(): FillableNode | undefined;
|
|
465
574
|
/**
|
|
466
|
-
* If set to a vector shape, adds a mask or replaces the
|
|
575
|
+
* If set to a vector shape, adds a mask or replaces the existing mask on this Group.
|
|
467
576
|
* If set to undefined, removes any mask that was previously set on this Group.
|
|
468
577
|
* @throws if the given node type cannot be used as a vector mask.
|
|
469
578
|
*/
|
|
@@ -471,11 +580,11 @@ export declare class GroupNode extends ContainerNode {
|
|
|
471
580
|
}
|
|
472
581
|
|
|
473
582
|
/**
|
|
474
|
-
* Interface for {@link FillableNode} *and* any other nodes with a similar `
|
|
475
|
-
* FillableNode class.
|
|
583
|
+
* Interface for {@link FillableNode} *and* any other nodes with a similar `fill` property that do not directly inherit from
|
|
584
|
+
* the FillableNode class.
|
|
476
585
|
*/
|
|
477
586
|
declare interface IFillableNode {
|
|
478
|
-
|
|
587
|
+
fill: Fill | undefined;
|
|
479
588
|
}
|
|
480
589
|
|
|
481
590
|
/**
|
|
@@ -507,11 +616,11 @@ declare interface IRectangularNode {
|
|
|
507
616
|
}
|
|
508
617
|
|
|
509
618
|
/**
|
|
510
|
-
* Interface for {@link StrokableNode} *and* any other nodes with a similar `
|
|
511
|
-
* the StrokableNode class. (See {@link ArtboardNode}, for example).
|
|
619
|
+
* Interface for {@link StrokableNode} *and* any other nodes with a similar `stroke` property that do not directly inherit
|
|
620
|
+
* from the StrokableNode class. (See {@link ArtboardNode}, for example).
|
|
512
621
|
*/
|
|
513
622
|
declare interface IStrokableNode {
|
|
514
|
-
|
|
623
|
+
stroke: Stroke | undefined;
|
|
515
624
|
}
|
|
516
625
|
|
|
517
626
|
/**
|
|
@@ -523,17 +632,12 @@ declare interface IStrokableNode {
|
|
|
523
632
|
*
|
|
524
633
|
* This class is used in different places for various types of items, including Nodes, Fills, and Strokes.
|
|
525
634
|
*/
|
|
526
|
-
export declare class ItemList<T extends ListItem> extends
|
|
635
|
+
export declare class ItemList<T extends ListItem> extends RestrictedItemList<T> {
|
|
527
636
|
/**
|
|
528
637
|
* Add one or more items to the end of the list. The last argument will become the last item in this list. Items are
|
|
529
638
|
* removed from their previous parent, if any – or if an item is already in *this* list, its index is simply changed.
|
|
530
639
|
*/
|
|
531
640
|
append(...items: T[]): void;
|
|
532
|
-
/**
|
|
533
|
-
* Remove one or more items from this list. The items need not be contiguous.
|
|
534
|
-
* Throws without performing any removals if any item is not a member of this list.
|
|
535
|
-
*/
|
|
536
|
-
remove(...items: T[]): void;
|
|
537
641
|
/**
|
|
538
642
|
* Remove all items from this list. No-op if list is already empty.
|
|
539
643
|
*/
|
|
@@ -568,8 +672,8 @@ export declare class LineNode extends StrokableNode {
|
|
|
568
672
|
static readonly DEFAULT_END_Y = 100;
|
|
569
673
|
/**
|
|
570
674
|
* Set the start and end points of the line in its local coordinate space (which may
|
|
571
|
-
* differ from its parent's coordinate space based on `
|
|
572
|
-
* `
|
|
675
|
+
* differ from its parent's coordinate space based on `transformMatrix`, i.e.
|
|
676
|
+
* `rotation` and `translation`). The values passed in may be normalized
|
|
573
677
|
* by this setter, shifting the node's translation and counter-shifting the start/end
|
|
574
678
|
* points. Therefore, the start/end getters may return values different from the values
|
|
575
679
|
* you passed into this setter, even though the line's visual bounds and appearance are
|
|
@@ -593,31 +697,23 @@ export declare class LineNode extends StrokableNode {
|
|
|
593
697
|
*/
|
|
594
698
|
get endY(): number;
|
|
595
699
|
/**
|
|
596
|
-
* The shape encapsulating the start of a line.
|
|
597
|
-
* depends on the first available stroke's weight and color assigned to the node.
|
|
598
|
-
* Removal of all strokes on this line leads to the arrowhead's removal.
|
|
700
|
+
* The shape encapsulating the start of a line.
|
|
599
701
|
*
|
|
600
|
-
*
|
|
601
|
-
* or no arrowhead on the first stroke of the line.
|
|
702
|
+
* Returns {@link ArrowHeadType.none} if there is no stroke on the line.
|
|
602
703
|
*/
|
|
603
704
|
get startArrowHeadType(): ArrowHeadType;
|
|
604
705
|
/**
|
|
605
|
-
* The setter
|
|
606
|
-
* and updates the arrowhead on only the first stroke of the line.
|
|
706
|
+
* The setter sets a default stroke on the line if it did not have one.
|
|
607
707
|
*/
|
|
608
708
|
set startArrowHeadType(type: ArrowHeadType);
|
|
609
709
|
/**
|
|
610
|
-
* The shape encapsulating the end of a line.
|
|
611
|
-
* depends on the first available stroke's weight and color assigned to the node.
|
|
612
|
-
* Removal of all strokes on this line leads to the arrowhead's removal.
|
|
710
|
+
* The shape encapsulating the end of a line.
|
|
613
711
|
*
|
|
614
|
-
*
|
|
615
|
-
* or no arrowhead on the first stroke of the line.
|
|
712
|
+
* Returns {@link ArrowHeadType.none} if there is no stroke on the line.
|
|
616
713
|
*/
|
|
617
714
|
get endArrowHeadType(): ArrowHeadType;
|
|
618
715
|
/**
|
|
619
|
-
* The setter
|
|
620
|
-
* and updates the arrowhead on only the first stroke of the line.
|
|
716
|
+
* The setter sets a default stroke on the line if it did not have one.
|
|
621
717
|
*/
|
|
622
718
|
set endArrowHeadType(type: ArrowHeadType);
|
|
623
719
|
}
|
|
@@ -649,53 +745,70 @@ export declare class MediaContainerNode extends Node {
|
|
|
649
745
|
}
|
|
650
746
|
|
|
651
747
|
/**
|
|
652
|
-
* A Node represents an object in the scenegraph, the document's visual content tree.
|
|
748
|
+
* A Node represents an object in the scenegraph, the document's visual content tree. Most tangible visual content is a
|
|
749
|
+
* subclass of Node, but note that some abstract top-level structural nodes (such as PageNode) only extend the more minimal
|
|
750
|
+
* BaseNode. As a general rule, if you can click or drag an object with the select/move tool in the UI, then it extends
|
|
751
|
+
* from Node.
|
|
653
752
|
*/
|
|
654
|
-
declare class Node {
|
|
753
|
+
declare class Node extends BaseNode {
|
|
655
754
|
/**
|
|
656
755
|
* Returns a read-only list of all children of the node. General-purpose content containers such as ArtboardNode or
|
|
657
756
|
* GroupNode also provide a mutable {@link ContainerNode.children} list. Other nodes with a more specific structure can
|
|
658
757
|
* hold children in various discrete "slots"; this `allChildren` list includes *all* such children and reflects their
|
|
659
758
|
* overall display z-order.
|
|
759
|
+
*
|
|
760
|
+
* The children of a Node are always other Node classes (never the more minimal BaseNode).
|
|
660
761
|
*/
|
|
661
762
|
get allChildren(): Readonly<Iterable<Node>>;
|
|
662
|
-
|
|
663
|
-
/**
|
|
664
|
-
* The node's type.
|
|
665
|
-
*/
|
|
666
|
-
get type(): SceneNodeTypeValueID;
|
|
667
763
|
/**
|
|
668
|
-
* The translation of the node along its parent's
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
set
|
|
677
|
-
/**
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
*
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
*
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
764
|
+
* The translation of the node along its parent's axes. This is identical to the translation component of
|
|
765
|
+
* `transformMatrix`. It is often simpler to set a node's position using `setPositionInParent` than by
|
|
766
|
+
* setting translation directly.
|
|
767
|
+
*/
|
|
768
|
+
get translation(): Readonly<{
|
|
769
|
+
x: number;
|
|
770
|
+
y: number;
|
|
771
|
+
}>;
|
|
772
|
+
set translation(value: { x: number; y: number });
|
|
773
|
+
/**
|
|
774
|
+
* Move the node so the given `localRegistrationPoint` in its local coordinates is placed at the given
|
|
775
|
+
* `parentPoint` in its parent's coordinates (taking into account any rotation on this node, etc.).
|
|
776
|
+
* @param parentPoint - Point in this node's parent's coordinate space to move `localRegistrationPoint` to
|
|
777
|
+
* @param localRegistrationPoint - Point in this node's local coordinate space to align with `parentPoint`
|
|
778
|
+
* @example
|
|
779
|
+
* Center a rectangle within its parent artboard:
|
|
780
|
+
* ```
|
|
781
|
+
* rectangle.setPositionInParent(
|
|
782
|
+
* { x: artboard.width / 2, y: artboard.height / 2 },
|
|
783
|
+
* { x: rectangle.width / 2, y: rectangle.height / 2 }
|
|
784
|
+
* );
|
|
785
|
+
* ```
|
|
786
|
+
*/
|
|
787
|
+
setPositionInParent(parentPoint: Point, localRegistrationPoint: Point): void;
|
|
788
|
+
/**
|
|
789
|
+
* The node's local rotation angle in degrees, relative to its parent's axes. Use `setRotationInParent` to
|
|
790
|
+
* change rotation by rotating around a defined centerpoint.
|
|
791
|
+
*/
|
|
792
|
+
get rotation(): number;
|
|
793
|
+
/**
|
|
794
|
+
* Set the node’s rotation angle relative to its parent to exactly the given value, keeping the given point in the
|
|
795
|
+
* node’s local coordinate space at a fixed location within the parent. Disregards any rotation the node may already
|
|
796
|
+
* have had. The angle set here may not be the absolute rotation angle seen on screen, if the parent or other
|
|
797
|
+
* ancestors have any rotation of their own.
|
|
798
|
+
* @param angleInDegrees - Angle in degrees.
|
|
799
|
+
* @param localRotationPoint - Point to rotate around, in node's local coordinates.
|
|
800
|
+
* @example
|
|
801
|
+
* Rotate the rectangle 45 degrees clockwise around its centerpoint:
|
|
802
|
+
* ```
|
|
803
|
+
* rectangle.setRotationInParent(45, { x: rectangle.width / 2, y: rectangle.height / 2 });
|
|
804
|
+
* ```
|
|
805
|
+
*/
|
|
806
|
+
setRotationInParent(angleInDegrees: number, localRotationPoint: Point): void;
|
|
807
|
+
/**
|
|
808
|
+
* The node's total rotation angle in degrees, relative to the overall global view of the document – including any
|
|
809
|
+
* cumulative rotation from the node's parent containers.
|
|
810
|
+
*/
|
|
811
|
+
get rotationInScreen(): number;
|
|
699
812
|
/**
|
|
700
813
|
* The node's opacity, from 0.0 to 1.0
|
|
701
814
|
*/
|
|
@@ -704,11 +817,7 @@ declare class Node {
|
|
|
704
817
|
/**
|
|
705
818
|
* The node's transform matrix relative to its parent.
|
|
706
819
|
*/
|
|
707
|
-
get
|
|
708
|
-
/**
|
|
709
|
-
* The node's absolute (global) transform matrix.
|
|
710
|
-
*/
|
|
711
|
-
get absoluteTransform(): mat2d;
|
|
820
|
+
get transformMatrix(): mat2d;
|
|
712
821
|
/**
|
|
713
822
|
* The node's lock/unlock state. Locked nodes are excluded from the selection (see {@link Context.selection}), and
|
|
714
823
|
* cannot be edited by the user unless they are unlocked first.
|
|
@@ -717,10 +826,10 @@ declare class Node {
|
|
|
717
826
|
set locked(locked: boolean);
|
|
718
827
|
/**
|
|
719
828
|
* Blend mode determines how a node is composited onto the content below it. The default value is
|
|
720
|
-
* {@link
|
|
829
|
+
* {@link BlendMode.normal} for most nodes, and {@link BlendMode.passThrough} for GroupNodes.
|
|
721
830
|
*/
|
|
722
|
-
get blendMode():
|
|
723
|
-
set blendMode(value:
|
|
831
|
+
get blendMode(): BlendMode;
|
|
832
|
+
set blendMode(value: BlendMode);
|
|
724
833
|
}
|
|
725
834
|
export { Node as Node };
|
|
726
835
|
|
|
@@ -732,7 +841,7 @@ export { Node as Node };
|
|
|
732
841
|
* PageList also provides APIs for adding/removing pages from the document. PageList is never empty: it is illegal to
|
|
733
842
|
* remove the last remaining page from the list.
|
|
734
843
|
*/
|
|
735
|
-
export declare class PageList extends
|
|
844
|
+
export declare class PageList extends RestrictedItemList<PageNode> {
|
|
736
845
|
/**
|
|
737
846
|
* Create a new page containing a single empty artboard, and add it to the end of the list. The artboard is configured
|
|
738
847
|
* with the same defaults as in {@link ArtboardList.addArtboard}. The page's artboard becomes the default target for
|
|
@@ -746,7 +855,7 @@ export declare class PageList extends ReadOnlyItemList<PageNode> {
|
|
|
746
855
|
* A PageNode represents a page in the document. A page contains one or more artboards, representing "scenes" in a linear
|
|
747
856
|
* timeline sequence. Those artboards in turn contain all the visual content of the document.
|
|
748
857
|
*/
|
|
749
|
-
export declare class PageNode extends
|
|
858
|
+
export declare class PageNode extends BaseNode implements Readonly<IRectangularNode> {
|
|
750
859
|
/**
|
|
751
860
|
* The artboards or "scenes" of a page, ordered by timeline sequence.
|
|
752
861
|
*/
|
|
@@ -768,6 +877,32 @@ export declare class PageNode extends Node implements Readonly<IRectangularNode>
|
|
|
768
877
|
set name(name: string | undefined);
|
|
769
878
|
}
|
|
770
879
|
|
|
880
|
+
/**
|
|
881
|
+
* A PathNode represents a generic vector path shape in the scenegraph. Paths cannot be created or edited through this API
|
|
882
|
+
* yet, only read.
|
|
883
|
+
*/
|
|
884
|
+
export declare class PathNode extends FillableNode {
|
|
885
|
+
/**
|
|
886
|
+
* The path definition as an SVG string. The path data is read-only and cannot be modified via this API yet.
|
|
887
|
+
* Example: "M 0 0 L 10 15".
|
|
888
|
+
*/
|
|
889
|
+
get path(): string;
|
|
890
|
+
/**
|
|
891
|
+
* The fill rule specifies how the interior area of a path is determined in cases where the path is self-intersecting or
|
|
892
|
+
* has multiple disjoint parts. This value is read-only and cannot be modified via this API yet.
|
|
893
|
+
*/
|
|
894
|
+
get fillRule(): FillRule;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
/**
|
|
898
|
+
* Represents a 2D position.
|
|
899
|
+
* @public
|
|
900
|
+
*/
|
|
901
|
+
export declare interface Point {
|
|
902
|
+
x: number;
|
|
903
|
+
y: number;
|
|
904
|
+
}
|
|
905
|
+
|
|
771
906
|
/**
|
|
772
907
|
* ReadOnlyItemList represents an ordered list of API objects, representing items that are all children of the
|
|
773
908
|
* same parent node. (The reverse is not necessarily true, however: this list might not include all
|
|
@@ -788,6 +923,11 @@ export declare class ReadOnlyItemList<T extends ListItem> {
|
|
|
788
923
|
* Last item in this list, or undefined if list is empty.
|
|
789
924
|
*/
|
|
790
925
|
get last(): T | undefined;
|
|
926
|
+
/**
|
|
927
|
+
* Get index of item in list.
|
|
928
|
+
* @returns index number, or -1 if item isn't in this list.
|
|
929
|
+
*/
|
|
930
|
+
indexOf(item: T): number;
|
|
791
931
|
/**
|
|
792
932
|
* Returns item at the given index, or undefined if index is out of range.
|
|
793
933
|
* @param index - Zero-based index
|
|
@@ -875,6 +1015,35 @@ export declare class RectangleNode extends FillableNode implements IRectangularN
|
|
|
875
1015
|
setUniformCornerRadius(radius: number): void;
|
|
876
1016
|
}
|
|
877
1017
|
|
|
1018
|
+
/**
|
|
1019
|
+
* Base for ItemLists that have restricted behavior on how items are added to the list,
|
|
1020
|
+
* but allow items to be removed and reordered. Subclasses like ItemList may add more
|
|
1021
|
+
* capabilities, however.
|
|
1022
|
+
*/
|
|
1023
|
+
declare class RestrictedItemList<T extends ListItem> extends ReadOnlyItemList<T> {
|
|
1024
|
+
/**
|
|
1025
|
+
* Remove the items from the list. The items need not be contiguous.
|
|
1026
|
+
* @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.
|
|
1027
|
+
*/
|
|
1028
|
+
remove(...items: T[]): void;
|
|
1029
|
+
/**
|
|
1030
|
+
* Move `item` so it is immediately before `before` in this list: places `item` at the index that `before` used
|
|
1031
|
+
* to occupy. Depending on the position in the list `item` originally occupied, some other items in the list may
|
|
1032
|
+
* shift to higher or lower indices as a result. No-op if both arguments are the same item.
|
|
1033
|
+
*
|
|
1034
|
+
* @throws An error if either argument is not contained in this list.
|
|
1035
|
+
*/
|
|
1036
|
+
moveBefore(item: T, before: T): void;
|
|
1037
|
+
/**
|
|
1038
|
+
* Move `item` so it is immediately after `after` in this list: places `item` at the index one higher than `after`.
|
|
1039
|
+
* Depending on the position in the list `item` originally occupied, some other items in the list may shift to higher
|
|
1040
|
+
* or lower indices as a result. No-op if both arguments are the same item.
|
|
1041
|
+
*
|
|
1042
|
+
* @throws An error if either argument is not contained in this list.
|
|
1043
|
+
*/
|
|
1044
|
+
moveAfter(item: T, after: T): void;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
878
1047
|
/**
|
|
879
1048
|
* <InlineAlert slots="text" variant="warning"/>
|
|
880
1049
|
* *Do not depend on the literal string values of these constants*, as they may change. Always reference the enum identifiers in your code.
|
|
@@ -883,7 +1052,7 @@ export declare class RectangleNode extends FillableNode implements IRectangularN
|
|
|
883
1052
|
* *Additional node types may be added in the future.* If your code has different branches or cases depending on node type,
|
|
884
1053
|
* always have a default/fallback case to handle any unknown values you may encounter.
|
|
885
1054
|
*/
|
|
886
|
-
declare enum
|
|
1055
|
+
declare enum SceneNodeType {
|
|
887
1056
|
line = "Line",
|
|
888
1057
|
rectangle = "Rectangle",
|
|
889
1058
|
ellipse = "Ellipse",
|
|
@@ -899,52 +1068,67 @@ declare enum SceneNodeTypeValueID {
|
|
|
899
1068
|
/** Type of MediaContainerNode's "media rectangle" child when it is holding an image */
|
|
900
1069
|
imageRectangle = "ImageRectangle",
|
|
901
1070
|
/** Type of PageNode */
|
|
902
|
-
page = "Page"
|
|
1071
|
+
page = "Page",
|
|
1072
|
+
/** Type of ComplexShapeNode, representing a complex prepackaged shape with fill and stroke, that appears as a leaf node in the UI */
|
|
1073
|
+
complexShape = "ComplexShape",
|
|
1074
|
+
/** Type of SolidColorShapeNode, representing a solid-color prepackaged shape that appears as a leaf node in the UI */
|
|
1075
|
+
solidColorShape = "SolidColorShape",
|
|
1076
|
+
/** Type of StrokeShapeNode, representing a stroke-only prepackaged shape that appears as a leaf node in the UI */
|
|
1077
|
+
strokeShape = "StrokeShape",
|
|
1078
|
+
/** Type of GridLayoutNode represents a grid layout in the scenegraph used to create a layout grid that other content can be placed into */
|
|
1079
|
+
gridLayout = "GridLayout"
|
|
903
1080
|
}
|
|
904
1081
|
|
|
905
1082
|
/**
|
|
906
|
-
*
|
|
1083
|
+
* A SolidColorShapeNode is a prepackaged shape with a single color property that appears as a leaf node in the UI, even if it
|
|
1084
|
+
* is composed of multiple separate paths.
|
|
907
1085
|
*/
|
|
908
|
-
export declare class
|
|
909
|
-
static DEFAULT_STROKE_WIDTH: number;
|
|
1086
|
+
export declare class SolidColorShapeNode extends Node {
|
|
910
1087
|
/**
|
|
911
|
-
*
|
|
1088
|
+
* The color of the single color shape.
|
|
912
1089
|
*/
|
|
913
|
-
get
|
|
1090
|
+
get color(): Readonly<Color> | undefined;
|
|
1091
|
+
set color(color: Color | undefined);
|
|
914
1092
|
}
|
|
915
1093
|
|
|
916
1094
|
/**
|
|
917
|
-
*
|
|
1095
|
+
* Base class for a Node that can have its own stroke.
|
|
918
1096
|
*/
|
|
919
|
-
export declare
|
|
1097
|
+
export declare class StrokableNode extends Node implements IStrokableNode {
|
|
920
1098
|
/**
|
|
921
|
-
* The
|
|
1099
|
+
* The stroke applied to the shape, if any.
|
|
922
1100
|
*/
|
|
923
|
-
|
|
1101
|
+
get stroke(): Readonly<Stroke> | undefined;
|
|
1102
|
+
set stroke(stroke: Stroke | undefined);
|
|
924
1103
|
}
|
|
925
1104
|
|
|
926
1105
|
/**
|
|
927
|
-
*
|
|
1106
|
+
* Represents a stroke in the scenegraph. See {@link StrokableNode}.
|
|
928
1107
|
*/
|
|
929
|
-
export declare interface
|
|
1108
|
+
export declare interface Stroke {
|
|
930
1109
|
/**
|
|
931
1110
|
* The color of a stroke.
|
|
932
1111
|
*/
|
|
933
|
-
|
|
1112
|
+
color: Color;
|
|
934
1113
|
/**
|
|
935
1114
|
* The thickness of a stroke. Must be from {@link MIN_STROKE_WIDTH} to {@link MAX_STROKE_WIDTH}.
|
|
936
1115
|
*/
|
|
937
|
-
|
|
1116
|
+
width: number;
|
|
938
1117
|
/**
|
|
939
1118
|
* If empty, this is a solid stroke.
|
|
940
1119
|
* If non-empty, the values alternate between length of a rendered and blank segment,
|
|
941
1120
|
* repeated along the length of the stroke. The first value represents the first solid segment.
|
|
1121
|
+
* Array must be of even length. Values cannot be negative.
|
|
942
1122
|
*/
|
|
943
|
-
|
|
1123
|
+
dashPattern: number[];
|
|
944
1124
|
/**
|
|
945
1125
|
* Number of pixels the beginning of dash pattern should be offset along the stroke.
|
|
946
1126
|
*/
|
|
947
|
-
|
|
1127
|
+
dashOffset: number;
|
|
1128
|
+
/**
|
|
1129
|
+
* The position of the stroke relative to the outline of the shape.
|
|
1130
|
+
*/
|
|
1131
|
+
position: StrokePosition;
|
|
948
1132
|
}
|
|
949
1133
|
|
|
950
1134
|
/**
|
|
@@ -953,17 +1137,23 @@ export declare interface StrokeOptions {
|
|
|
953
1137
|
*
|
|
954
1138
|
* A stroke's {@link Stroke.position} determines how the thickness of the stroke is aligned along a shape's path outline.
|
|
955
1139
|
*/
|
|
956
|
-
declare enum
|
|
1140
|
+
declare enum StrokePosition {
|
|
957
1141
|
center = 0,
|
|
958
1142
|
inside = 1,
|
|
959
1143
|
outside = 2
|
|
960
1144
|
}
|
|
961
1145
|
|
|
1146
|
+
/**
|
|
1147
|
+
* A StrokeShapeNode is prepackaged shape that has a single stroke property and appears as a leaf node in the UI, even
|
|
1148
|
+
* if it is composed of multiple separate paths.
|
|
1149
|
+
*/
|
|
1150
|
+
export declare class StrokeShapeNode extends StrokableNode {}
|
|
1151
|
+
|
|
962
1152
|
/**
|
|
963
1153
|
* <InlineAlert slots="text" variant="warning"/>
|
|
964
1154
|
* *Do not depend on the literal numeric values of these constants*, as they may change. Always reference the enum identifiers in your code.
|
|
965
1155
|
*/
|
|
966
|
-
declare enum
|
|
1156
|
+
declare enum TextAlignment {
|
|
967
1157
|
left = 1,
|
|
968
1158
|
right = 2,
|
|
969
1159
|
center = 3
|
|
@@ -981,10 +1171,13 @@ export declare class TextNode extends Node {
|
|
|
981
1171
|
/**
|
|
982
1172
|
* The horizontal text alignment of the text node. Alignment is always the same across this node's entire text content.
|
|
983
1173
|
*/
|
|
984
|
-
get textAlignment():
|
|
985
|
-
set textAlignment(alignment:
|
|
1174
|
+
get textAlignment(): TextAlignment;
|
|
1175
|
+
set textAlignment(alignment: TextAlignment);
|
|
986
1176
|
}
|
|
987
1177
|
|
|
988
|
-
|
|
1178
|
+
/**
|
|
1179
|
+
* An UnknownNode is a node with limited support and therefore treated as a leaf node.
|
|
1180
|
+
*/
|
|
1181
|
+
export declare class UnknownNode extends Node {}
|
|
989
1182
|
|
|
990
1183
|
export {};
|