@adobe/ccweb-add-on-sdk-types 1.2.0 → 1.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/ccweb-add-on-sdk-types",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "author": "Adobe",
5
5
  "license": "MIT",
6
6
  "description": "Type definitions for Adobe Creative Cloud Web Add-on SDK.",
@@ -14,6 +14,25 @@
14
14
  "typings"
15
15
  ],
16
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
+ ]
34
+ }
35
+ },
17
36
  "types": "index.d.ts",
18
37
  "repository": {
19
38
  "url": "https://github.com/adobe/create-ccweb-add-on"
@@ -126,20 +126,28 @@ export declare class BaseNode {
126
126
  */
127
127
  get type(): SceneNodeType;
128
128
  /**
129
- * The node's parent. Undefined if the node is an orphan, or if the node is the artwork root.
129
+ * The node's parent. The parent chain will eventually reach ExpressRootNode for all nodes that are part of the document
130
+ * content.
131
+ *
132
+ * Nodes that have been deleted are "orphaned," with a parent chain that terminates in `undefined` without reaching the
133
+ * root node. Such nodes cannot be selected, so it is unlikely to encounter one unless you retain a reference to a node
134
+ * that was part of the document content earlier. Deleted nodes can be reattached to the scenegraph, e.g. via Undo.
130
135
  */
131
136
  get parent(): BaseNode | undefined;
132
137
  /**
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.
138
+ * Removes the node from its parent - effectively deleting it, if the node is not re-added to another parent before the
139
+ * document is closed.
140
+ *
141
+ * If parent is a basic ContainerNode, this is equivalent to `node.parent.children.remove(node)`. For nodes with other
142
+ * child "slots," removes the child from whichever slot it resides in, if possible. Throws if the slot does not permit
143
+ * removal. No-op if node is already an orphan.
136
144
  */
137
145
  removeFromParent(): void;
138
146
  }
139
147
 
140
148
  /**
141
- * Represents a bitmap image resource. Can be displayed in the document by creating a MediaContainerNode structure via
142
- * {@link Editor.createImageContainer}.
149
+ * Represents a bitmap image resource. Use {@link Editor.loadBitmapImage} to create a BitmapImage, and then {@link Editor.createImageContainer}
150
+ * to display it in the document by creating a MediaContainerNode structure.
143
151
  */
144
152
  export declare interface BitmapImage {
145
153
  /**
@@ -197,7 +205,7 @@ declare enum BlendMode {
197
205
  }
198
206
 
199
207
  /**
200
- * Represents an RGBA color.
208
+ * Represents an RGBA color value.
201
209
  */
202
210
  export declare interface Color {
203
211
  /**
@@ -220,6 +228,8 @@ export declare interface Color {
220
228
 
221
229
  /**
222
230
  * Represents a solid-color fill.
231
+ *
232
+ * The most convenient way to create a stroke is via `Editor.makeColorFill()`.
223
233
  */
224
234
  export declare interface ColorFill extends Fill {
225
235
  /**
@@ -237,30 +247,31 @@ export declare interface ColorFill extends Fill {
237
247
  */
238
248
  export declare class ColorUtils {
239
249
  /**
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).
250
+ * Create a new color object with the given RGBA values.
251
+ * @param red - The red channel, from 0 - 1.
252
+ * @param green - The green channel, from 0 - 1.
253
+ * @param blue - The blue channel, from 0 - 1.
254
+ * @param alpha - Optional alpha channel, from 0 - 1. Defaults to 1 (opaque).
255
+ * @returns A new color object.
246
256
  */
247
257
  fromRGB(red: number, green: number, blue: number, alpha?: number): Color;
258
+ /**
259
+ * Create a new color object given a partial color object where the alpha field may be missing.
260
+ * @param color - Partial color object. Alpha defaults to 1 (opaque).
261
+ * @returns A new color object with all fields present.
262
+ */
248
263
  fromRGB(color: { red: number; green: number; blue: number; alpha?: number }): Color;
249
264
  /**
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.
265
+ * Create a new color from its equivalent RGBA hex representation. Can specify in 6 digits (RRGGBB) or 8 digits
266
+ * (RRGGBBAA), uppercase or lowercase, with or without leading "#". Alpha defaults to FF (100% opaque) if ommitted.
253
267
  *
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.
268
+ * @param hex - The color represented as a hexadecimal string.
269
+ * @returns A new color value matching the given hex string.
270
+ * @throws if the hex string cannot be parsed.
257
271
  */
258
272
  fromHex(hex: string): Color;
259
273
  /**
260
274
  * 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
275
  */
265
276
  toHex(color: Color): string;
266
277
  }
@@ -268,7 +279,7 @@ export declare class ColorUtils {
268
279
  export declare const colorUtils: ExpressColorUtils;
269
280
 
270
281
  /**
271
- * A ComplexShapeNode is complex prepackaged shape that appears as a leaf node in the UI, even if it is composed
282
+ * A ComplexShapeNode is a complex prepackaged shape that appears as a leaf node in the UI, even if it is composed
272
283
  * of multiple separate paths.
273
284
  */
274
285
  export declare class ComplexShapeNode extends FillableNode {}
@@ -316,7 +327,9 @@ export declare class Context {
316
327
  */
317
328
  get hasSelection(): boolean;
318
329
  /**
319
- * @returns the preferred parent to insert newly added content into.
330
+ * @returns the preferred parent to insert newly added content into (i.e., the location content would get inserted if a
331
+ * user were to Paste or use the Shapes panel in the UI). This will vary depending on the user's current selection and
332
+ * other UI state.
320
333
  */
321
334
  get insertionParent(): ContainerNode;
322
335
  }
@@ -383,10 +396,13 @@ export declare class Editor {
383
396
  * Creates a bitmap image resource in the document, which can be displayed in the scenegraph by passing it to {@link createImageContainer}
384
397
  * to create a MediaContainerNode. The same BitmapImage can be used to create multiple MediaContainerNodes.
385
398
  *
386
- * Note: image resources that are unused will be automatically cleaned up after the document is closed.
399
+ * Because the resulting BitmapImage is returned asynchronously, to use it you must schedule an edit lambda to run at a
400
+ * safe later time in order to call {@link createImageContainer}. See {@link queueAsyncEdit}.
401
+ *
402
+ * Further async steps to upload image resource data may continue in the background after this call's Promise resolves,
403
+ * but the resulting BitmapImage can be used right away (via the queue API noted above). The local client will act as
404
+ * having unsaved changes until all the upload steps have finished.
387
405
  *
388
- * Async steps to upload image resource data continue in the background after this call's Promise resolves, but the BitmapImage
389
- * return value can be used immediately. The local client will act as having unsaved changes until the upload has finished.
390
406
  * @param bitmapData - Encoded image data in PNG or JPEG format.
391
407
  */
392
408
  loadBitmapImage(bitmapData: Blob): Promise<BitmapImage>;
@@ -483,7 +499,11 @@ declare class ExpressColorUtils extends ColorUtils {}
483
499
  declare class ExpressEditor extends Editor {}
484
500
 
485
501
  /**
486
- * An ExpressRootNode represents the root node of the document's "scenegraph" artwork tree.
502
+ * An ExpressRootNode represents the root node of the document's "scenegraph" artwork tree. The root contains a collection
503
+ * of {@link pages}. Each page contains one or more artboards, arranged in a timeline sequence. All the visual content of
504
+ * the document lies within those artboards.
505
+ *
506
+ * The parent of ExpressRootNode is undefined, since it is the root of the document tree.
487
507
  */
488
508
  export declare class ExpressRootNode extends BaseNode {
489
509
  /**
@@ -494,6 +514,7 @@ export declare class ExpressRootNode extends BaseNode {
494
514
 
495
515
  /**
496
516
  * Base interface representing any fill in the scenegraph. See {@link FillableNode}.
517
+ * The only fill type currently supported is {@link ColorFill}.
497
518
  */
498
519
  export declare interface Fill {
499
520
  /**
@@ -516,6 +537,9 @@ export declare class FillableNode extends StrokableNode implements IFillableNode
516
537
  /**
517
538
  * <InlineAlert slots="text" variant="warning"/>
518
539
  * *Do not depend on the literal numeric values of these constants*, as they may change. Always reference the enum identifiers in your code.
540
+ *
541
+ * The fill rule, aka "winding rule," specifies how the interior area of a path is determined in cases where the path is
542
+ * self-intersecting or contains separate, nested closed loops.
519
543
  */
520
544
  declare enum FillRule {
521
545
  nonZero = 0,
@@ -1104,6 +1128,9 @@ export declare class StrokableNode extends Node implements IStrokableNode {
1104
1128
 
1105
1129
  /**
1106
1130
  * Represents a stroke in the scenegraph. See {@link StrokableNode}.
1131
+ *
1132
+ * The most convenient way to create a stroke is via `Editor.makeStroke()`. This also futureproofs your code in case any
1133
+ * other required fields are added to the Stroke descriptor in the future.
1107
1134
  */
1108
1135
  export declare interface Stroke {
1109
1136
  /**