@adobe/ccweb-add-on-sdk-types 1.8.0 → 1.9.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.8.0",
3
+ "version": "1.9.0",
4
4
  "author": "Adobe",
5
5
  "license": "MIT",
6
6
  "description": "Type definitions for Adobe Creative Cloud Web Add-on SDK.",
@@ -453,22 +453,24 @@ export declare class Editor {
453
453
  *
454
454
  * @param bitmapData - Encoded image data in PNG or JPEG format.
455
455
  */
456
- loadBitmapImage(rendition: Blob): Promise<BitmapImage>;
456
+ loadBitmapImage(bitmapData: Blob): Promise<BitmapImage>;
457
457
  /**
458
- * Convenience helper to create a complete Stroke value given just a subset of its fields. All other fields are
459
- * populated with default values.
458
+ * Convenience helper to create a complete SolidColorStroke value given just a
459
+ * subset of its fields. All other fields are populated with default values.
460
460
  *
461
- * See {@link Stroke} for more details on the `options` fields. Defaults:
461
+ * See {@link SolidColorStroke} for more details on the `options` fields. Defaults:
462
462
  * - `color` has default value {@link DEFAULT_STROKE_COLOR} if none is provided.
463
463
  * - `width` has default value {@link DEFAULT_STROKE_WIDTH} if none is provided.
464
464
  * - `position` has default value `center` if none is provided.
465
465
  * - `dashPattern` has default value [] if none is provided.
466
466
  * - `dashOffset` has default value 0 if none is provided. This field is ignored
467
467
  * if no `dashPattern` was provided.
468
+ * - `type` has default value SolidColorStroke.type if none is provided. This field
469
+ * shouldn't be set to any other value.
468
470
  *
469
471
  * @returns a stroke configured with the given options.
470
472
  */
471
- makeStroke(options?: Partial<Stroke>): Stroke;
473
+ makeStroke(options?: Partial<SolidColorStroke>): SolidColorStroke;
472
474
  /**
473
475
  * @returns a text node with default styles. The text content is initially empty, so the text node will be
474
476
  * invisible until its `text` property is set. Creates point text, so the node's width will automatically
@@ -534,7 +536,8 @@ export declare class ExpressRootNode extends BaseNode {
534
536
 
535
537
  /**
536
538
  * Base interface representing any fill in the scenegraph. See {@link FillableNode}.
537
- * The only fill type currently supported is {@link ColorFill}.
539
+ * Currently, you can only create {@link ColorFill}s, but you might encounter
540
+ * other fill types when reading scenegraph content.
538
541
  */
539
542
  export declare interface Fill {
540
543
  /**
@@ -622,7 +625,6 @@ export declare class GroupNode extends Node implements ContainerNode {
622
625
  */
623
626
  set maskShape(mask: FillableNode | undefined);
624
627
  /**
625
- * @override
626
628
  * Note: If this group has a maskShape, group's bounds are always identical to the maskShape's, regardless of the
627
629
  * group's other content.
628
630
  */
@@ -754,6 +756,9 @@ export declare class LineNode extends StrokableNode {
754
756
  get startArrowHeadType(): ArrowHeadType;
755
757
  /**
756
758
  * The setter sets a default stroke on the line if it did not have one.
759
+ *
760
+ * @throws if the line's stroke is not a SolidColorStroke type.
761
+ * More complex stroke types do not support arrowheads.
757
762
  */
758
763
  set startArrowHeadType(type: ArrowHeadType);
759
764
  /**
@@ -764,6 +769,9 @@ export declare class LineNode extends StrokableNode {
764
769
  get endArrowHeadType(): ArrowHeadType;
765
770
  /**
766
771
  * The setter sets a default stroke on the line if it did not have one.
772
+ *
773
+ * @throws if the line's stroke is not a SolidColorStroke type.
774
+ * More complex stroke types do not support arrowheads.
767
775
  */
768
776
  set endArrowHeadType(type: ArrowHeadType);
769
777
  }
@@ -781,7 +789,7 @@ export declare interface ListItem {}
781
789
  */
782
790
  export declare class MediaContainerNode extends Node {
783
791
  /**
784
- * The rectangular node representing the entire, uncropped bounds of the media (e.g. image or video). The media's position and
792
+ * The rectangular node representing the entire, uncropped bounds of the media (e.g. image, GIFs, or video). The media's position and
785
793
  * rotation can be changed, but it cannot be resized yet via this API. Media types other than images will yield a plain Node object
786
794
  * for now.
787
795
  */
@@ -792,6 +800,14 @@ export declare class MediaContainerNode extends Node {
792
800
  * different shape via this API.
793
801
  */
794
802
  get maskShape(): FillableNode;
803
+ /**
804
+ * Replace existing media inline. The new media is sized to completely fill the bounds of the existing maskShape; if the
805
+ * media's aspect ratio differs from the maskShape's, the media will be cropped by the maskShape on either the left/right
806
+ * or top/bottom edges. Currently only supports images as the new media, but previous media can be of any type.
807
+ *
808
+ * @param media - New content to display. Currently must be a {@link BitmapImage}.
809
+ */
810
+ replaceMedia(media: BitmapImage): void;
795
811
  }
796
812
 
797
813
  /**
@@ -912,7 +928,7 @@ export declare class PageList extends RestrictedItemList<PageNode> {
912
928
  * @param geometry - The size of the new page.
913
929
  *
914
930
  */
915
- addPage(geometry: RectangleGeometry): PageNode;
931
+ addPage(inputGeometry: RectangleGeometry): PageNode;
916
932
  }
917
933
 
918
934
  /**
@@ -1174,23 +1190,16 @@ export declare class SolidColorShapeNode extends Node {
1174
1190
  }
1175
1191
 
1176
1192
  /**
1177
- * Base class for a Node that can have its own stroke.
1193
+ * Represents a solid-color stroke, with optional dashes.
1194
+ *
1195
+ * The most convenient way to create a solid-color stroke is via `Editor.makeStroke()`. This also futureproofs
1196
+ * your code in case any other required fields are added to the Stroke descriptor in the future.
1178
1197
  */
1179
- export declare class StrokableNode extends Node implements IStrokableNode {
1198
+ export declare interface SolidColorStroke extends Stroke {
1180
1199
  /**
1181
- * The stroke applied to the shape, if any.
1200
+ * The stroke type.
1182
1201
  */
1183
- set stroke(stroke: Stroke | undefined);
1184
- get stroke(): Readonly<Stroke> | undefined;
1185
- }
1186
-
1187
- /**
1188
- * Represents a stroke in the scenegraph. See {@link StrokableNode}.
1189
- *
1190
- * The most convenient way to create a stroke is via `Editor.makeStroke()`. This also futureproofs your code in case any
1191
- * other required fields are added to the Stroke descriptor in the future.
1192
- */
1193
- export declare interface Stroke {
1202
+ readonly type: StrokeType.color;
1194
1203
  /**
1195
1204
  * The color of a stroke.
1196
1205
  */
@@ -1216,6 +1225,34 @@ export declare interface Stroke {
1216
1225
  position: StrokePosition;
1217
1226
  }
1218
1227
 
1228
+ /**
1229
+ * SolidColorStroke with 'type' property as optional.
1230
+ */
1231
+ export declare type SolidColorStrokeWithOptionalType = Omit<SolidColorStroke, "type"> &
1232
+ Partial<Pick<SolidColorStroke, "type">>;
1233
+
1234
+ /**
1235
+ * Base class for a Node that can have its own stroke.
1236
+ */
1237
+ export declare class StrokableNode extends Node implements IStrokableNode {
1238
+ /**
1239
+ * The stroke applied to the shape, if any.
1240
+ * Only {@link SolidColorStroke} values are supported by the setter, but the "type" field is optional
1241
+ * for backward compatibility. Throws if another type is provided.
1242
+ */
1243
+ set stroke(stroke: SolidColorStrokeWithOptionalType | undefined);
1244
+ get stroke(): Readonly<Stroke> | undefined;
1245
+ }
1246
+
1247
+ /**
1248
+ * Base interface representing any stroke in the scenegraph. See {@link StrokableNode}.
1249
+ * Currently, you can only create {@link SolidColorStroke}s, but you might encounter
1250
+ * other stroke types when reading from scenegraph content.
1251
+ */
1252
+ export declare interface Stroke {
1253
+ readonly type: StrokeType;
1254
+ }
1255
+
1219
1256
  /**
1220
1257
  * <InlineAlert slots="text" variant="warning"/>
1221
1258
  * *Do not depend on the literal numeric values of these constants*, as they may change. Always reference the enum identifiers in your code.
@@ -1234,6 +1271,21 @@ declare enum StrokePosition {
1234
1271
  */
1235
1272
  export declare class StrokeShapeNode extends StrokableNode {}
1236
1273
 
1274
+ /**
1275
+ * <InlineAlert slots="text" variant="warning"/>
1276
+ * *Do not depend on the literal string values of these constants*, as they may change. Always reference the enum identifiers in your code.
1277
+ *
1278
+ * <InlineAlert slots="text" variant="warning"/>
1279
+ * *Additional stroke types may be added in the future.* If your code has different branches or cases depending on stroke type,
1280
+ * always have a default/fallback case to handle any unknown values you may encounter.
1281
+ */
1282
+ declare enum StrokeType {
1283
+ /**
1284
+ * A solid-color stroke, with optional dashes.
1285
+ */
1286
+ color = "Color"
1287
+ }
1288
+
1237
1289
  /**
1238
1290
  * <InlineAlert slots="text" variant="warning"/>
1239
1291
  * *Do not depend on the literal numeric values of these constants*, as they may change. Always reference the enum identifiers in your code.
@@ -1249,9 +1301,12 @@ declare enum TextAlignment {
1249
1301
  */
1250
1302
  export declare class TextNode extends Node {
1251
1303
  /**
1252
- * The text string of the node
1304
+ * The text string of the node.
1253
1305
  */
1254
1306
  get text(): string;
1307
+ /**
1308
+ * Sets the text content of the text node.
1309
+ */
1255
1310
  set text(textContent: string);
1256
1311
  /**
1257
1312
  * The horizontal text alignment of the text node. Alignment is always the same across this node's entire text content.
package/ui/ui-sdk.d.ts CHANGED
@@ -134,6 +134,10 @@ export declare enum AppEvent {
134
134
  * triggered when the regional format is changed in the application.
135
135
  */
136
136
  formatchange = "formatchange",
137
+ /**
138
+ * triggered when the sdk is reset.
139
+ */
140
+ reset = "reset",
137
141
  /**
138
142
  * triggered when drag is started on the currently dragged element.
139
143
  */
@@ -162,6 +166,7 @@ declare interface AppEventsTypeMap {
162
166
  [AppEvent.themechange]: AppThemeChangeEventData;
163
167
  [AppEvent.localechange]: AppLocaleChangeEventData;
164
168
  [AppEvent.formatchange]: AppFormatChangeEventData;
169
+ [AppEvent.reset]: undefined;
165
170
  [AppEvent.dragstart]: AppDragStartEventData;
166
171
  [AppEvent.dragend]: AppDragEndEventData;
167
172