@adobe/ccweb-add-on-sdk-types 1.21.0 → 1.23.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/ccweb-add-on-sdk-types",
3
- "version": "1.21.0",
3
+ "version": "1.23.0",
4
4
  "author": "Adobe",
5
5
  "license": "MIT",
6
6
  "description": "Type definitions for Adobe Creative Cloud Web Add-on SDK.",
@@ -85,6 +85,7 @@ declare namespace ApiConstants {
85
85
  TextScriptStyle,
86
86
  EditorEvent,
87
87
  VisualEffectType,
88
+ TextStyleSource,
88
89
  ParagraphListType,
89
90
  OrderedListNumbering
90
91
  };
@@ -265,10 +266,12 @@ declare interface BaseCharacterStyles {
265
266
  */
266
267
  underline: boolean;
267
268
  /**
268
- * URL for the hyperlink.
269
- * A link can be removed by setting it to undefined
269
+ * A URL hyperlink. Character ranges with a link are underlined *by default*, unless these styles explicitly specify
270
+ * `underline: false`.
271
+ *
272
+ * To remove a link from existing text, explicitly specify `link: ""` in {@link TextContentModel.applyCharacterStyles}.
270
273
  */
271
- link: string | undefined;
274
+ link?: string;
272
275
  /**
273
276
  * Sets a superscript or subscript style.
274
277
  */
@@ -394,15 +397,15 @@ declare interface BaseParagraphStyles {
394
397
  * Represents a bitmap image resource. Use {@link Editor.loadBitmapImage} to create a BitmapImage, and then {@link Editor.createImageContainer}
395
398
  * to display it in the document by creating a MediaContainerNode structure.
396
399
  */
397
- export declare interface BitmapImage {
400
+ export declare class BitmapImage {
398
401
  /**
399
402
  * Original width of the bitmap in pixels.
400
403
  */
401
- readonly width: number;
404
+ get width(): number;
402
405
  /**
403
406
  * Original height of the bitmap in pixels.
404
407
  */
405
- readonly height: number;
408
+ get height(): number;
406
409
  }
407
410
 
408
411
  /**
@@ -447,7 +450,8 @@ declare enum BlendMode {
447
450
  hue = 14,
448
451
  saturation = 15,
449
452
  color = 16,
450
- luminosity = 17
453
+ luminosity = 17,
454
+ accumulate = 18
451
455
  }
452
456
 
453
457
  /**
@@ -938,11 +942,11 @@ export declare class Fonts {
938
942
  export declare const fonts: ExpressFonts;
939
943
 
940
944
  /**
941
- * A GridCellNode represents the MediaContainerNode aspect of a grid cell. Unlike other MediaContainerNodes,
942
- * GridCellNodes cannot be translated or rotated directly. This implementation translates and rotates the
943
- * MediaRectangle child of the GridCellNode when those actions are applied.
945
+ * A GridCellNode represents the media aspect of a grid cell. Unlike MediaContainerNodes, grid cells cannot be
946
+ * translated or rotated directly and can't modify a mask shape. This implementation translates and rotates the
947
+ * media rectangle child when those actions are applied.
944
948
  */
945
- export declare class GridCellNode extends MediaContainerNode {
949
+ export declare class GridCellNode extends Node implements IMediaContainerNode {
946
950
  /**
947
951
  * <InlineAlert slots="text" variant="warning"/>
948
952
  *
@@ -953,7 +957,11 @@ export declare class GridCellNode extends MediaContainerNode {
953
957
  * Use the parent grid container instead.
954
958
  *
955
959
  */
956
- clone(): never;
960
+ cloneInPlace(): never;
961
+ get allChildren(): Readonly<Iterable<Node>>;
962
+ get mediaRectangle(): ImageRectangleNode | UnknownMediaRectangleNode;
963
+ replaceMedia(media: BitmapImage): void;
964
+ get maskShape(): ReadOnlyMask;
957
965
  }
958
966
 
959
967
  /**
@@ -968,7 +976,7 @@ export declare class GridLayoutNode extends Node implements IRectangularNode {
968
976
  * Grid Cells are ordered by the y and then x position of their top left corner, i.e. left to right and top to bottom.
969
977
  * The children cannot be added or removed.
970
978
  */
971
- get allChildren(): Readonly<Iterable<Node>>;
979
+ get allChildren(): Readonly<Iterable<GridCellNode>>;
972
980
  /**
973
981
  * The background fill of the GridLayout.
974
982
  */
@@ -1040,6 +1048,72 @@ declare interface IFillableNode {
1040
1048
  */
1041
1049
  export declare class ImageRectangleNode extends MediaRectangleNode {}
1042
1050
 
1051
+ /**
1052
+ * Interface for nodes that contain media.
1053
+ */
1054
+ export declare interface IMediaContainerNode {
1055
+ /**
1056
+ * The rectangular node representing the entire, uncropped bounds of the media (e.g. image, GIFs, or video). The media's position and
1057
+ * rotation can be changed, but it cannot be resized yet via this API. Media types other than images will yield an UnknownMediaRectangleNode
1058
+ * object for now.
1059
+ * @privateRemarks
1060
+ * Future: for resizing, see HZ-17885 & HZ-12247; for other media types, see HZ-15896.
1061
+ */
1062
+ get mediaRectangle(): ImageRectangleNode | UnknownMediaRectangleNode;
1063
+ /**
1064
+ * Replace existing media inline. The new media is sized to completely fill the bounds of the existing maskShape; if the
1065
+ * media's aspect ratio differs from the maskShape's, the media will be cropped by the maskShape on either the left/right
1066
+ * or top/bottom edges. Currently only supports images as the new media, but previous media can be of any type.
1067
+ *
1068
+ * @param media - New content to display. Currently must be a {@link BitmapImage}.
1069
+ */
1070
+ replaceMedia(media: BitmapImage): void;
1071
+ /**
1072
+ * A read-only view of the mask shape used for cropping/clipping the media.
1073
+ */
1074
+ get maskShape(): INodeBounds;
1075
+ }
1076
+
1077
+ /**
1078
+ * An interface for the bounds of a {@link Node}.
1079
+ */
1080
+ export declare interface INodeBounds extends IVisualNodeBounds {
1081
+ /**
1082
+ * An axis-aligned box in the parent’s coordinate space encompassing the node’s layout bounds (its
1083
+ * {@link boundsLocal}, as transformed by its position and rotation relative to the parent). If the node has
1084
+ * rotation, the top-left of its boundsLocal box (aligned to its own axes) is not necessarily located at the
1085
+ * top-left of the boundsInParent box (since it's aligned to the parent's axes). This value is well-defined
1086
+ * even for an orphan node with no parent.
1087
+ */
1088
+ get boundsInParent(): Readonly<Rect>;
1089
+ /**
1090
+ * The translation of the node along its parent's axes. This is identical to the translation component of
1091
+ * `transformMatrix`. It is often simpler to set a node's position using `setPositionInParent` than by
1092
+ * setting translation directly.
1093
+ */
1094
+ get translation(): Readonly<Point>;
1095
+ /**
1096
+ * The node's local rotation angle in degrees, relative to its parent's axes. Use `setRotationInParent` to
1097
+ * change rotation by rotating around a defined centerpoint.
1098
+ */
1099
+ get rotation(): number;
1100
+ /**
1101
+ * The node's total rotation angle in degrees, relative to the overall global view of the document – including any
1102
+ * cumulative rotation from the node's parent containers.
1103
+ */
1104
+ get rotationInScreen(): number;
1105
+ /**
1106
+ * The node's transform matrix relative to its parent.
1107
+ */
1108
+ get transformMatrix(): mat2d;
1109
+ /**
1110
+ * Convert the node's {@link boundsLocal} to an axis-aligned bounding box in the coordinate space of the target
1111
+ * node. Both nodes must share the same {@link visualRoot}, but can lie anywhere within that subtree
1112
+ * relative to one another (the target node need not be an ancestor of this node, nor vice versa).
1113
+ */
1114
+ boundsInNode(targetNode: VisualNode): Readonly<Rect>;
1115
+ }
1116
+
1043
1117
  /**
1044
1118
  * Interface for nodes with width and height properties.
1045
1119
  */
@@ -1103,6 +1177,37 @@ export declare class ItemList<T extends ListItem> extends RestrictedItemList<T>
1103
1177
  insertAfter(newItem: T, after: T): void;
1104
1178
  }
1105
1179
 
1180
+ /**
1181
+ * An interface for the bounds of a {@link VisualNode}.
1182
+ */
1183
+ export declare interface IVisualNodeBounds {
1184
+ /**
1185
+ * The bounding box of the node, expressed in the node's local coordinate space (which may be shifted or rotated
1186
+ * relative to its parent). Generally matches the selection outline seen in the UI, encompassing the vector path
1187
+ * "spine" of the shape as well as its stroke, but excluding effects such as shadows.
1188
+ *
1189
+ * The top-left corner of the bounding box corresponds to the visual top-left corner of the node, but this value is
1190
+ * *not* necessarily (0,0) – this is especially true for Text and Path nodes.
1191
+ */
1192
+ get boundsLocal(): Readonly<Rect>;
1193
+ /**
1194
+ * Position of the node's centerpoint in its own local coordinate space, i.e. the center of the boundsLocal box.
1195
+ */
1196
+ get centerPointLocal(): Readonly<Point>;
1197
+ /**
1198
+ * Position of the node's top-left corner in its own local coordinate space, equal to (boundsLocal.x,
1199
+ * boundsLocal.y). If the node is rotated, this is not the same as the top-left corner of
1200
+ * boundsInParent.
1201
+ */
1202
+ get topLeftLocal(): Readonly<Point>;
1203
+ /**
1204
+ * Convert a point given in the node’s local coordinate space to a point in the coordinate space of the target node.
1205
+ * Both nodes must share the same {@link visualRoot}, but can lie anywhere within that subtree relative to one
1206
+ * another (the target node need not be an ancestor of this node, nor vice versa).
1207
+ */
1208
+ localPointInNode(localPoint: Point, targetNode: VisualNode): Readonly<Point>;
1209
+ }
1210
+
1106
1211
  /**
1107
1212
  * A LineNode represents a simple vector line in the scenegraph – a single straight-line segment.
1108
1213
  *
@@ -1181,12 +1286,7 @@ export declare interface ListItem {}
1181
1286
  * To create new media container for a bitmap image, see {@link Editor.createImageContainer}. APIs for creating a
1182
1287
  * container with other content, such as videos, are not yet available.
1183
1288
  */
1184
- export declare class MediaContainerNode extends Node {
1185
- /**
1186
- * The rectangular node representing the entire, uncropped bounds of the media (e.g. image, GIFs, or video). The media's position and
1187
- * rotation can be changed, but it cannot be resized yet via this API. Media types other than images will yield an UnknownMediaRectangleNode
1188
- * object for now.
1189
- */
1289
+ export declare class MediaContainerNode extends Node implements IMediaContainerNode {
1190
1290
  get mediaRectangle(): ImageRectangleNode | UnknownMediaRectangleNode;
1191
1291
  /**
1192
1292
  * The mask used for cropping/clipping the media. The bounds of this shape are entire visible bounds of the container.
@@ -1194,13 +1294,6 @@ export declare class MediaContainerNode extends Node {
1194
1294
  * different shape via this API.
1195
1295
  */
1196
1296
  get maskShape(): FillableNode;
1197
- /**
1198
- * Replace existing media inline. The new media is sized to completely fill the bounds of the existing maskShape; if the
1199
- * media's aspect ratio differs from the maskShape's, the media will be cropped by the maskShape on either the left/right
1200
- * or top/bottom edges. Currently only supports images as the new media, but previous media can be of any type.
1201
- *
1202
- * @param media - New content to display. Currently must be a {@link BitmapImage}.
1203
- */
1204
1297
  replaceMedia(media: BitmapImage): void;
1205
1298
  }
1206
1299
 
@@ -1238,7 +1331,7 @@ export declare abstract class MediaRectangleNode extends Node implements Readonl
1238
1331
  * Clone the entire parent MediaContainerNode instead.
1239
1332
  *
1240
1333
  */
1241
- clone(): never;
1334
+ cloneInPlace(): never;
1242
1335
  }
1243
1336
 
1244
1337
  /**
@@ -1247,9 +1340,9 @@ export declare abstract class MediaRectangleNode extends Node implements Readonl
1247
1340
  * minimal VisualNode or BaseNode. As a general rule, if you can click or drag an object with the select/move
1248
1341
  * tool in the UI, then it extends from Node.
1249
1342
  *
1250
- * A Node’s parent is always a VisualContentNode but may not be another Node (e.g. if the parent is an ArtboardNode)
1343
+ * A Node’s parent is always a {@link VisualNode}, but it might not be another Node (e.g. if the parent is an ArtboardNode).
1251
1344
  */
1252
- declare class Node extends VisualNode {
1345
+ declare class Node extends VisualNode implements INodeBounds {
1253
1346
  /**
1254
1347
  * Returns a read-only list of all children of the node. General-purpose content containers such as ArtboardNode or
1255
1348
  * GroupNode also provide a mutable {@link ContainerNode.children} list. Other nodes with a more specific structure can
@@ -1259,25 +1352,8 @@ declare class Node extends VisualNode {
1259
1352
  * The children of a Node are always other Node classes (never the more minimal BaseNode).
1260
1353
  */
1261
1354
  get allChildren(): Readonly<Iterable<Node>>;
1262
- /**
1263
- * An axis-aligned box in the parent’s coordinate space encompassing the node’s layout bounds (its
1264
- * {@link boundsLocal}, as transformed by its position and rotation relative to the parent). If the node has
1265
- * rotation, the top-left of its boundsLocal box (aligned to its own axes) is not necessarily located at the
1266
- * top-left of the boundsInParent box (since it's aligned to the parent's axes). This value is well-defined
1267
- * even for an orphan node with no parent.
1268
- */
1269
1355
  get boundsInParent(): Readonly<Rect>;
1270
- /**
1271
- * Convert the node's {@link boundsLocal} to an axis-aligned bounding box in the coordinate space of the target
1272
- * node. Both nodes must share the same {@link visualRoot}, but can lie anywhere within that subtree
1273
- * relative to one another (the target node need not be an ancestor of this node, nor vice versa).
1274
- */
1275
1356
  boundsInNode(targetNode: VisualNode): Readonly<Rect>;
1276
- /**
1277
- * The translation of the node along its parent's axes. This is identical to the translation component of
1278
- * `transformMatrix`. It is often simpler to set a node's position using `setPositionInParent` than by
1279
- * setting translation directly.
1280
- */
1281
1357
  get translation(): Readonly<Point>;
1282
1358
  set translation(value: Point);
1283
1359
  /**
@@ -1295,10 +1371,6 @@ declare class Node extends VisualNode {
1295
1371
  * ```
1296
1372
  */
1297
1373
  setPositionInParent(parentPoint: Point, localRegistrationPoint: Point): void;
1298
- /**
1299
- * The node's local rotation angle in degrees, relative to its parent's axes. Use `setRotationInParent` to
1300
- * change rotation by rotating around a defined centerpoint.
1301
- */
1302
1374
  get rotation(): number;
1303
1375
  /**
1304
1376
  * Set the node’s rotation angle relative to its parent to exactly the given value, keeping the given point in the
@@ -1310,29 +1382,23 @@ declare class Node extends VisualNode {
1310
1382
  * @example
1311
1383
  * Rotate the rectangle 45 degrees clockwise around its centerpoint:
1312
1384
  * ```
1313
- * rectangle.setRotationInParent(45, { x: rectangle.width / 2, y: rectangle.height / 2 });
1385
+ * rectangle.setRotationInParent(45, rectangle.centerPointLocal);
1314
1386
  * ```
1315
1387
  */
1316
1388
  setRotationInParent(angleInDegrees: number, localRotationPoint: Point): void;
1317
- /**
1318
- * The node's total rotation angle in degrees, relative to the overall global view of the document – including any
1319
- * cumulative rotation from the node's parent containers.
1320
- */
1321
1389
  get rotationInScreen(): number;
1322
1390
  /**
1323
1391
  * The node's opacity, from 0.0 to 1.0
1324
1392
  */
1325
1393
  get opacity(): number;
1326
1394
  set opacity(opacity: number);
1327
- /**
1328
- * The node's transform matrix relative to its parent.
1329
- */
1330
1395
  get transformMatrix(): mat2d;
1331
1396
  /**
1332
1397
  * The node's lock/unlock state. Locked nodes are excluded from the selection (see {@link Context.selection}), and
1333
- * cannot be edited by the user in the UI unless they are unlocked first. Operations on locked nodes using the API
1334
- * are permitted. However, please consider if modifying a locked node would align with user expectations
1335
- * before using the API to make changes to locked nodes.
1398
+ * cannot be edited by the user in the UI unless they are unlocked first. It is still possible to mutate locked nodes
1399
+ * at the model level using these APIs. However, please consider if modifying a locked node would align with user
1400
+ * expectations before doing so.
1401
+ *
1336
1402
  */
1337
1403
  get locked(): boolean;
1338
1404
  set locked(locked: boolean);
@@ -1348,7 +1414,15 @@ declare class Node extends VisualNode {
1348
1414
  * **IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`.
1349
1415
  *
1350
1416
  * @experimental
1351
- * Changes the width to the given value and the height to the given width multiplied by the aspect ratio.
1417
+ * Changes the width to the given value by visually *scaling* the entire content larger or smaller on both axes to
1418
+ * preserve its existing aspect ratio, keeping its top-left corner ({@link topLeftLocal}) at a fixed location.
1419
+ *
1420
+ * Scaling changes the size of visual styling elements such as stroke width, corner detailing, and font size.
1421
+ * Contrast this to *resizing* operations (such as {@link resizeToFitWithin}), which adjust the bounding box of an
1422
+ * element while trying to preserve the existing size of visual detailing such as strokes, corners, and fonts.
1423
+ *
1424
+ * Rescaling becomes baked into the updated values of fields such as stroke weight, rectangle width, etc. (it is not
1425
+ * a separate, persistent scale factor multiplier).
1352
1426
  */
1353
1427
  rescaleProportionalToWidth(width: number): void;
1354
1428
  /**
@@ -1357,7 +1431,8 @@ declare class Node extends VisualNode {
1357
1431
  * **IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`.
1358
1432
  *
1359
1433
  * @experimental
1360
- * Changes the height to the given value and the width to the given height multiplied by the aspect ratio.
1434
+ * Changes the height to the given value by visually *scaling* the entire content larger or smaller on both axes to
1435
+ * preserve its existing aspect ratio. See {@link rescaleProportionalToWidth} documentation for additional explanation.
1361
1436
  */
1362
1437
  rescaleProportionalToHeight(height: number): void;
1363
1438
  /**
@@ -1366,9 +1441,17 @@ declare class Node extends VisualNode {
1366
1441
  * **IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`.
1367
1442
  *
1368
1443
  * @experimental
1369
- * Resizes the node to fit within a box with the given dimensions.
1444
+ * Resizes the node to fit entirely *within* a box of the given dimensions, keeping its top-left corner ({@link topLeftLocal})
1445
+ * at a fixed location. Nodes with a fixed aspect ratio may leave unused space on one axis as a result, but nodes
1446
+ * with flexible aspect ratio will be resized to the exact box size specified.
1370
1447
  *
1371
- * If the node doesn't have a fixed aspect ratio then this will resize the node to the given width and height.
1448
+ * Resizing attempts to preserve the existing size of visual styling elements such as stroke width, corner detailing,
1449
+ * and font size as much as possible. Contrast with *rescaling* (such as {@link rescaleProportionalToWidth}), which
1450
+ * always changes the size of visual detailing in exact proportion to the change in overall bounding box size. This
1451
+ * API may still produce *some* degree of rescaling if necessary for certain shapes with fixed corner/edge detailing
1452
+ * to fit the box better.
1453
+ *
1454
+ * @see resizeToCover
1372
1455
  */
1373
1456
  resizeToFitWithin(width: number, height: number): void;
1374
1457
  /**
@@ -1377,9 +1460,12 @@ declare class Node extends VisualNode {
1377
1460
  * **IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`.
1378
1461
  *
1379
1462
  * @experimental
1380
- * Resizes the node to cover a box with the given dimensions.
1463
+ * Resizes the node to completely *cover* a box of the given dimensions, keeping its top-left corner ({@link topLeftLocal})
1464
+ * at a fixed location. Nodes with a fixed aspect ratio may extend outside the box on one axis as a result, but
1465
+ * nodes with flexible aspect ratio will be resized to the exact box size specified. See {@link resizeToFitWithin}
1466
+ * documentation for additional explanation.
1381
1467
  *
1382
- * If the node doesn't have a fixed aspect ratio then this will resize the node to the given width and height.
1468
+ * @see resizeToFitWithin
1383
1469
  */
1384
1470
  resizeToCover(width: number, height: number): void;
1385
1471
  /**
@@ -1388,9 +1474,12 @@ declare class Node extends VisualNode {
1388
1474
  * **IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`.
1389
1475
  *
1390
1476
  * @experimental
1391
- * Creates an orphaned copy of this node, including all persistent attributes and descendants.
1477
+ * Creates a copy of this node and its entire subtree of descendants.
1478
+ *
1479
+ * The node must be attached to a page as the copy will be added as a sibling.
1480
+ *
1392
1481
  */
1393
- clone(): typeof this;
1482
+ cloneInPlace(): typeof this;
1394
1483
  }
1395
1484
  export { Node as Node };
1396
1485
 
@@ -1655,6 +1744,26 @@ export declare class ReadOnlyItemList<T extends ListItem> {
1655
1744
  toArray(): readonly T[];
1656
1745
  }
1657
1746
 
1747
+ /**
1748
+ * A read-only view of a mask shape.
1749
+ */
1750
+ export declare class ReadOnlyMask implements INodeBounds {
1751
+ /**
1752
+ * The type of {@link ReadOnlyMask}.
1753
+ */
1754
+ get type(): "ReadOnlyMask";
1755
+ get boundsLocal(): Readonly<Rect>;
1756
+ get centerPointLocal(): Readonly<Point>;
1757
+ get topLeftLocal(): Readonly<Point>;
1758
+ localPointInNode(localPoint: Point, targetNode: VisualNode): Readonly<Point>;
1759
+ get boundsInParent(): Readonly<Rect>;
1760
+ boundsInNode(targetNode: VisualNode): Readonly<Rect>;
1761
+ get translation(): Readonly<Point>;
1762
+ get rotation(): number;
1763
+ get rotationInScreen(): number;
1764
+ get transformMatrix(): mat2d;
1765
+ }
1766
+
1658
1767
  export declare interface Rect {
1659
1768
  x: number;
1660
1769
  y: number;
@@ -1864,7 +1973,7 @@ export declare type SolidColorStrokeWithOptionalType = Omit<SolidColorStroke, "t
1864
1973
 
1865
1974
  /**
1866
1975
  * A StandaloneTextNode represents a text display frame in the scenegraph. It displays an entire piece of text.
1867
- * The StandaloneTextNode does not directly hold the text content and styles – instead it refers to a {@link TextContentModel}.
1976
+ * The StandaloneTextNode does not directly hold the text content and styles – instead it refers to a {@link TextNodeContentModel}.
1868
1977
  *
1869
1978
  * To create new a single-frame piece of text, see {@link Editor.createText}.
1870
1979
  */
@@ -1975,11 +2084,10 @@ declare enum TextAlignment {
1975
2084
  }
1976
2085
 
1977
2086
  /**
1978
- * Represents a complete piece of text content, which may be contained within a single {@link StandaloneTextNode} *or*
1979
- * split across multiple {@link ThreadedTextNode} frames for display.
2087
+ * TextContentModel is an abstract base class representing a complete piece of text content.
1980
2088
  * Use this model to get or modify the text string and the style ranges applied to it.
1981
2089
  */
1982
- export declare class TextContentModel {
2090
+ export declare abstract class TextContentModel {
1983
2091
  /**
1984
2092
  * <InlineAlert slots="text" variant="warning"/>
1985
2093
  *
@@ -1994,19 +2102,77 @@ export declare class TextContentModel {
1994
2102
  * Comparing two models using `===` will always fail.
1995
2103
  */
1996
2104
  get id(): string;
1997
- /**
1998
- * Get ordered list of all {@link TextNode}s that display this text content in the scenegraph. The text content
1999
- * starts in the first {@link ThreadedTextNode} "frame", and then flows into the second node once it has filled the first one. The ending of the
2000
- * text content may not be visible at all, if the last {@link ThreadedTextNode} "frame" is not large enough to accommodate it.
2001
- *
2002
- * If there are multiple {@link ThreadedTextNode}s, all of them must be configured to use {@link AreaTextLayout}.
2003
- */
2004
- get allTextNodes(): Readonly<Iterable<TextNode>>;
2005
2105
  /**
2006
2106
  * The complete text string, which may span multiple {@link ThreadedTextNode} "frames" in the scenegraph.
2007
2107
  */
2008
2108
  get text(): string;
2009
2109
  set text(textContent: string);
2110
+ /**
2111
+ * <InlineAlert slots="text" variant="warning"/>
2112
+ *
2113
+ * **IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`.
2114
+ *
2115
+ * @experimental
2116
+ * Appends a new text string to the end of the text content.
2117
+ *
2118
+ * @param newText - The text to append.
2119
+ * @throws if the existing text contains fonts unavailable to the current user. See {@link hasUnavailableFonts}.
2120
+ */
2121
+ appendText(newText: string): void;
2122
+ /**
2123
+ * <InlineAlert slots="text" variant="warning"/>
2124
+ *
2125
+ * **IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`.
2126
+ *
2127
+ * @experimental
2128
+ * Inserts a new text string into the text content at the specified index.
2129
+ *
2130
+ * @param newText - The text to insert.
2131
+ * @param index - The index at which to insert the new text.
2132
+ * @param style - Style to use for the new text: either directly provides a style to use, or indicates which
2133
+ * existing text to match the style of. Default: `beforeInsertionPoint`.
2134
+ * @throws if the existing text contains fonts unavailable to the current user. See {@link hasUnavailableFonts}.
2135
+ */
2136
+ insertText(
2137
+ newText: string,
2138
+ index: number,
2139
+ style?: CharacterStylesInput | TextStyleSource.beforeInsertionPoint | TextStyleSource.afterInsertionPoint
2140
+ ): void;
2141
+ /**
2142
+ * <InlineAlert slots="text" variant="warning"/>
2143
+ *
2144
+ * **IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`.
2145
+ *
2146
+ * @experimental
2147
+ * Replaces a range of text with a new text string.
2148
+ *
2149
+ * @param newText - The text to replace the range with.
2150
+ * @param replaceRange - The range of text to replace.
2151
+ * @param style - Style to use for the new text: either directly provides a style to use, or indicates which
2152
+ * existing text to match the style of. Default: `firstReplacedCharacter`.
2153
+ * @throws if the existing text contains fonts unavailable to the current user. See {@link hasUnavailableFonts}.
2154
+ */
2155
+ replaceText(
2156
+ newText: string,
2157
+ replaceRange: TextRange,
2158
+ style?:
2159
+ | CharacterStylesInput
2160
+ | TextStyleSource.beforeInsertionPoint
2161
+ | TextStyleSource.afterInsertionPoint
2162
+ | TextStyleSource.firstReplacedCharacter
2163
+ ): void;
2164
+ /**
2165
+ * <InlineAlert slots="text" variant="warning"/>
2166
+ *
2167
+ * **IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`.
2168
+ *
2169
+ * @experimental
2170
+ * Deletes a range of text from the content.
2171
+ *
2172
+ * @param range - The range of text to delete.
2173
+ * @throws if the existing text contains fonts unavailable to the current user. See {@link hasUnavailableFonts}.
2174
+ */
2175
+ deleteText(range: TextRange): void;
2010
2176
  /**
2011
2177
  * The character styles are applied to different ranges of this text content. When setting character styles, any style
2012
2178
  * properties that are not provided are reset to their defaults (contrast to {@link applyCharacterStyles} which
@@ -2126,7 +2292,7 @@ declare enum TextLayout {
2126
2292
  /**
2127
2293
  * TextNode is an abstract base class representing text displayed in the scenegraph, regardless of whether it's a fully
2128
2294
  * self-contained {@link StandaloneTextNode} or one {@link ThreadedTextNode} "frame" of multiple in a larger flow. The
2129
- * APIs on TextNode and its {@link TextContentModel} allow you to generically work with text without needing to know
2295
+ * APIs on TextNode and its {@link TextNodeContentModel} allow you to generically work with text without needing to know
2130
2296
  * which of those subtypes you are dealing with.
2131
2297
  */
2132
2298
  export declare abstract class TextNode extends Node {
@@ -2179,12 +2345,12 @@ export declare abstract class TextNode extends Node {
2179
2345
  * fixed-size frame using {@link AreaTextLayout} does not fit all the (remaining) text.
2180
2346
  *
2181
2347
  * Note: When traversing the scenegraph in search of text content, bear in mind that multiple TextNodes may refer to the
2182
- * same single {@link TextContentModel}; this can give the impression that the same text is duplicated multiple times when it is
2183
- * not. Use {@link TextContentModel}.id to determine whether a given piece of text content is unique or if it's already been
2348
+ * same single {@link TextNodeContentModel}; this can give the impression that the same text is duplicated multiple times when it is
2349
+ * not. Use {@link TextNodeContentModel}.id to determine whether a given piece of text content is unique or if it's already been
2184
2350
  * encountered before.
2185
2351
  *
2186
2352
  */
2187
- get fullContent(): TextContentModel;
2353
+ get fullContent(): TextNodeContentModel;
2188
2354
  /**
2189
2355
  * Helper method to determine if the text is standalone.
2190
2356
  */
@@ -2204,14 +2370,14 @@ export declare abstract class TextNode extends Node {
2204
2370
  * The text string content which is partially *or* fully displayed in this TextNode "frame."
2205
2371
  * WARNING: If a piece of text content flows across several TextNodes, *each* TextNode's `text` getter will return
2206
2372
  * the *entire* text content string.
2207
- * @deprecated - Use the text getter on {@link TextContentModel} instead. Access it via `TextNode.fullContent.text`.
2373
+ * @deprecated - Use the text getter on {@link TextNodeContentModel} instead. Access it via `TextNode.fullContent.text`.
2208
2374
  */
2209
2375
  get text(): string;
2210
2376
  /**
2211
2377
  * Sets the text content of the TextNode.
2212
2378
  * WARNING: If a piece of text content flows across several TextNodes,
2213
2379
  * *each* TextNode's `text` setter will sets the *entire* text content string.
2214
- * @deprecated - Use the text setter on {@link TextContentModel} instead. Access it via `TextNode.fullContent.text`.
2380
+ * @deprecated - Use the text setter on {@link TextNodeContentModel} instead. Access it via `TextNode.fullContent.text`.
2215
2381
  */
2216
2382
  set text(textContent: string);
2217
2383
  /**
@@ -2235,9 +2401,25 @@ export declare abstract class TextNode extends Node {
2235
2401
  }
2236
2402
 
2237
2403
  /**
2238
- * A range of text in a {@link TextContentModel}.
2404
+ * Represents a complete piece of text content, which may be contained within a single {@link StandaloneTextNode} *or*
2405
+ * split across multiple {@link ThreadedTextNode} frames for display.
2406
+ * Use this model to get or modify the text string and the style ranges applied to it.
2407
+ */
2408
+ export declare class TextNodeContentModel extends TextContentModel {
2409
+ /**
2410
+ * Get ordered list of all {@link TextNode}s that display this text content in the scenegraph. The text content
2411
+ * starts in the first {@link ThreadedTextNode} "frame", and then flows into the second node once it has filled the first one. The ending of the
2412
+ * text content may not be visible at all, if the last {@link ThreadedTextNode} "frame" is not large enough to accommodate it.
2413
+ *
2414
+ * If there are multiple {@link ThreadedTextNode}s, all of them must be configured to use {@link AreaTextLayout}.
2415
+ */
2416
+ get allTextNodes(): Readonly<Iterable<TextNode>>;
2417
+ }
2418
+
2419
+ /**
2420
+ * A range of text in a {@link TextContentModel}, specified in characters.
2239
2421
  */
2240
- declare interface TextRange {
2422
+ export declare interface TextRange {
2241
2423
  start: number;
2242
2424
  length: number;
2243
2425
  }
@@ -2254,23 +2436,45 @@ export declare enum TextScriptStyle {
2254
2436
  subscript = 2
2255
2437
  }
2256
2438
 
2439
+ /**
2440
+ * <InlineAlert slots="text" variant="warning"/>
2441
+ *
2442
+ * **IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`.
2443
+ *
2444
+ * @experimental
2445
+ * Indicates which existing text to match the style of when inserting new text or replacing text.
2446
+ */
2447
+ export declare enum TextStyleSource {
2448
+ /**
2449
+ * Use style of the character just before the insertion point, *unless* that character is not on the same line (same
2450
+ * paragraph) in which case falls back to afterInsertionPoint behavior. This generally matches the style a user would
2451
+ * get in the UI if they place their cursor at this insertion point.
2452
+ */
2453
+ beforeInsertionPoint = 0,
2454
+ /**
2455
+ * Use style of the character just after the insertion point (which is always on the same line/paragraph, since lines end
2456
+ * with a `\n` character; an insertion point past this is inserting on the next line). If there is no character after the
2457
+ * insertion point, the insertion point is at the end of the text (appending) and the style of the previous character is
2458
+ * used instead. This option is useful when *pre*pending to an existing block of text.
2459
+ */
2460
+ afterInsertionPoint = 1,
2461
+ /**
2462
+ * When replacing existing text, use the style of the first character in the replaced text. This may feel more
2463
+ * predictable to users than the styles on either side of the replaced text. E.g. if replacing a single word one-to-one
2464
+ * with a new word, and the replaced word has a style unique to the text on either side of it, one may expect the new
2465
+ * text to match that original word's style.
2466
+ */
2467
+ firstReplacedCharacter = 2
2468
+ }
2469
+
2257
2470
  /**
2258
2471
  * A ThreadedTextNode represents a text display frame in the scenegraph. It is a subset of longer text that flows across
2259
2472
  * multiple TextNode "frames". Because of this, the TextNode does not directly hold the text content and styles –
2260
- * instead it refers to a {@link TextContentModel}, which may be shared across multiple ThreadedTextNode frames.
2473
+ * instead it refers to a {@link TextNodeContentModel}, which may be shared across multiple ThreadedTextNode frames.
2261
2474
  *
2262
2475
  * APIs are not yet available to create multi-frame text flows.
2263
2476
  */
2264
2477
  export declare class ThreadedTextNode extends TextNode {
2265
- /**
2266
- * <InlineAlert slots="text" variant="warning"/>
2267
- *
2268
- * **IMPORTANT:** This is currently ***experimental only*** and should not be used in any add-ons you will be distributing until it has been declared stable. To use it, you will first need to set the `experimentalApis` flag to `true` in the [`requirements`](../../../manifest/index.md#requirements) section of the `manifest.json`.
2269
- *
2270
- * @experimental
2271
- * Always throws as it's not possible to clone only a single "frame" of threaded text.
2272
- */
2273
- clone(): never;
2274
2478
  get nextTextNode(): ThreadedTextNode | undefined;
2275
2479
  get layout(): Readonly<AreaTextLayout>;
2276
2480
  /**
@@ -2389,7 +2593,7 @@ declare enum VisualEffectType {
2389
2593
  *
2390
2594
  * Some VisualNodes might have a non-visual parent such as a PageNode.
2391
2595
  */
2392
- export declare class VisualNode extends BaseNode {
2596
+ export declare class VisualNode extends BaseNode implements IVisualNodeBounds {
2393
2597
  /**
2394
2598
  * The highest ancestor that still has visual presence in the document. Typically an Artboard, but for orphaned
2395
2599
  * content, it will be the root of the deleted content (which might be this node itself).
@@ -2399,30 +2603,9 @@ export declare class VisualNode extends BaseNode {
2399
2603
  * meaningful comparison or conversion between the bounds or coordinate spaces of such nodes.
2400
2604
  */
2401
2605
  get visualRoot(): VisualNode;
2402
- /**
2403
- * The bounding box of the node, expressed in the node's local coordinate space (which may be shifted or rotated
2404
- * relative to its parent). Generally matches the selection outline seen in the UI, encompassing the vector path
2405
- * "spine" of the shape as well as its stroke, but excluding effects such as shadows.
2406
- *
2407
- * The top-left corner of the bounding box corresponds to the visual top-left corner of the node, but this value is
2408
- * *not* necessarily (0,0) – this is especially true for Text and Path nodes.
2409
- */
2410
2606
  get boundsLocal(): Readonly<Rect>;
2411
- /**
2412
- * Position of the node's centerpoint in its own local coordinate space, i.e. the center of the boundsLocal box.
2413
- */
2414
2607
  get centerPointLocal(): Readonly<Point>;
2415
- /**
2416
- * Position of the node's top-left corner in its own local coordinate space, equal to (boundsLocal.x,
2417
- * boundsLocal.y). If the node is rotated, this is not the same as the top-left corner of
2418
- * boundsInParent.
2419
- */
2420
2608
  get topLeftLocal(): Readonly<Point>;
2421
- /**
2422
- * Convert a point given in the node’s local coordinate space to a point in the coordinate space of the target node.
2423
- * Both nodes must share the same {@link visualRoot}, but can lie anywhere within that subtree relative to one
2424
- * another (the target node need not be an ancestor of this node, nor vice versa).
2425
- */
2426
2609
  localPointInNode(localPoint: Point, targetNode: VisualNode): Readonly<Point>;
2427
2610
  }
2428
2611
 
@@ -23,6 +23,6 @@
23
23
  ********************************************************************************/
24
24
 
25
25
  export * from "./express-document-sdk.js";
26
- export * from "./global.js";
26
+ export type * from "./global.js";
27
27
  export * from "./add-on-sdk-document-sandbox.js";
28
28
  export { default } from "./add-on-sdk-document-sandbox.js";
package/ui/ui-sdk.d.ts CHANGED
@@ -887,7 +887,7 @@ export declare type DisableDragToDocument = () => void;
887
887
  */
888
888
  declare interface Document_2 {
889
889
  /**
890
- * Add image/Ps/Ai files to the current page
890
+ * Add image/PSD/AI assets to the current page
891
891
  */
892
892
  addImage(blob: Blob, attributes?: MediaAttributes, importAddOnData?: ImportAddOnData): Promise<void>;
893
893
  /**
@@ -1012,6 +1012,10 @@ export declare interface DragCompletionData {
1012
1012
  * Media info
1013
1013
  */
1014
1014
  attributes?: MediaAttributes & SourceMimeTypeInfo;
1015
+ /**
1016
+ * Add-on specific metadata to attach to the imported asset.
1017
+ */
1018
+ importAddOnData?: ImportAddOnData;
1015
1019
  }
1016
1020
 
1017
1021
  /**
@@ -1150,7 +1154,11 @@ export declare enum EntrypointType {
1150
1154
  /**
1151
1155
  * Contextual bulk create entrypoint type.
1152
1156
  */
1153
- CONTEXTUAL_BULK_CREATE = "contextual.bulk-create"
1157
+ CONTEXTUAL_BULK_CREATE = "contextual.bulk-create",
1158
+ /**
1159
+ * Import hub entrypoint type.
1160
+ */
1161
+ IMPORT_HUB = "import-hub"
1154
1162
  }
1155
1163
 
1156
1164
  export declare interface Field {
@@ -1227,19 +1235,22 @@ export declare enum FrameRate {
1227
1235
  }
1228
1236
 
1229
1237
  /**
1230
- * Represents the add-on data for a node.
1238
+ * Represents add-on-specific data that can be attached to imported media assets (nodes).
1239
+ * This data provides a way for add-ons to store custom metadata with imported assets across multiple import APIs.
1231
1240
  * Note: This support is not present for PSD/AI assets.
1232
1241
  */
1233
1242
  export declare interface ImportAddOnData {
1234
1243
  /**
1235
- * The node add-on data which will persist on the image frame even if the image content is replaced with a
1236
- * different one. This data can be accessed later via the MediaContainerNode.addOnData API.
1244
+ * Node-specific add-on data that persists with the individual asset container.
1245
+ * This data remains attached to the container node even when the asset content is replaced.
1246
+ * This data can be accessed later via document sandbox MediaContainerNode.addOnData API.
1237
1247
  */
1238
1248
  nodeAddOnData?: Record<string, string>;
1239
1249
  /**
1240
- * The media add-on data which will reset if the image is replaced with a different one. All copies of the
1241
- * same image in the document will share the same mediaAddOnData. This data can be accessed later via the
1242
- * MediaRectangleNode.mediaAddOnData API.
1250
+ * Media-specific add-on data that is tied to the actual asset content.
1251
+ * This data is shared across all copies of the same asset throughout the document
1252
+ * and will be reset if the asset content is replaced with different media.
1253
+ * This data can be accessed later via document sandbox MediaRectangleNode.mediaAddOnData API.
1243
1254
  */
1244
1255
  mediaAddOnData?: Record<string, string>;
1245
1256
  }
@@ -1741,6 +1752,13 @@ export declare interface PngRenditionOptions extends RenditionOptions {
1741
1752
  fileSizeLimitUnit?: FileSizeLimitUnit;
1742
1753
  }
1743
1754
 
1755
+ export declare interface PptxRenditionOptions extends RenditionOptions {
1756
+ /**
1757
+ * PPTX rendition format
1758
+ */
1759
+ format: RenditionFormat.pptx;
1760
+ }
1761
+
1744
1762
  /**
1745
1763
  * @experimental - Experimental API
1746
1764
  * Options for running print quality check
@@ -1874,7 +1892,11 @@ export declare enum RenditionFormat {
1874
1892
  /**
1875
1893
  * PDF format
1876
1894
  */
1877
- pdf = "application/pdf"
1895
+ pdf = "application/pdf",
1896
+ /**
1897
+ * PPTX format
1898
+ */
1899
+ pptx = "application/vnd.openxmlformats-officedocument.presentationml.presentation"
1878
1900
  }
1879
1901
 
1880
1902
  /**