Skip to content

Commit 0c31ea9

Browse files
xerxovksiAbhishek Das
and
Abhishek Das
authored
Release 20240909 (#22)
* replaceMedia() API * Change logs --------- Co-authored-by: Abhishek Das <[email protected]>
1 parent fc126c2 commit 0c31ea9

File tree

5 files changed

+102
-32
lines changed

5 files changed

+102
-32
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@adobe/ccweb-add-on-sdk-types",
5+
"comment": "Add replaceMedia() API",
6+
"type": "minor"
7+
}
8+
],
9+
"packageName": "@adobe/ccweb-add-on-sdk-types"
10+
}

packages/wxp-sdk-types/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adobe/ccweb-add-on-sdk-types",
3-
"version": "1.8.0",
3+
"version": "1.9.0",
44
"author": "Adobe",
55
"license": "MIT",
66
"description": "Type definitions for Adobe Creative Cloud Web Add-on SDK.",

packages/wxp-sdk-types/sandbox/express-document-sdk.d.ts

+79-24
Original file line numberDiff line numberDiff line change
@@ -453,22 +453,24 @@ export declare class Editor {
453453
*
454454
* @param bitmapData - Encoded image data in PNG or JPEG format.
455455
*/
456-
loadBitmapImage(rendition: Blob): Promise<BitmapImage>;
456+
loadBitmapImage(bitmapData: Blob): Promise<BitmapImage>;
457457
/**
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.
460460
*
461-
* See {@link Stroke} for more details on the `options` fields. Defaults:
461+
* See {@link SolidColorStroke} for more details on the `options` fields. Defaults:
462462
* - `color` has default value {@link DEFAULT_STROKE_COLOR} if none is provided.
463463
* - `width` has default value {@link DEFAULT_STROKE_WIDTH} if none is provided.
464464
* - `position` has default value `center` if none is provided.
465465
* - `dashPattern` has default value [] if none is provided.
466466
* - `dashOffset` has default value 0 if none is provided. This field is ignored
467467
* 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.
468470
*
469471
* @returns a stroke configured with the given options.
470472
*/
471-
makeStroke(options?: Partial<Stroke>): Stroke;
473+
makeStroke(options?: Partial<SolidColorStroke>): SolidColorStroke;
472474
/**
473475
* @returns a text node with default styles. The text content is initially empty, so the text node will be
474476
* 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 {
534536

535537
/**
536538
* 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.
538541
*/
539542
export declare interface Fill {
540543
/**
@@ -622,7 +625,6 @@ export declare class GroupNode extends Node implements ContainerNode {
622625
*/
623626
set maskShape(mask: FillableNode | undefined);
624627
/**
625-
* @override
626628
* Note: If this group has a maskShape, group's bounds are always identical to the maskShape's, regardless of the
627629
* group's other content.
628630
*/
@@ -754,6 +756,9 @@ export declare class LineNode extends StrokableNode {
754756
get startArrowHeadType(): ArrowHeadType;
755757
/**
756758
* 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.
757762
*/
758763
set startArrowHeadType(type: ArrowHeadType);
759764
/**
@@ -764,6 +769,9 @@ export declare class LineNode extends StrokableNode {
764769
get endArrowHeadType(): ArrowHeadType;
765770
/**
766771
* 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.
767775
*/
768776
set endArrowHeadType(type: ArrowHeadType);
769777
}
@@ -781,7 +789,7 @@ export declare interface ListItem {}
781789
*/
782790
export declare class MediaContainerNode extends Node {
783791
/**
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
785793
* rotation can be changed, but it cannot be resized yet via this API. Media types other than images will yield a plain Node object
786794
* for now.
787795
*/
@@ -792,6 +800,14 @@ export declare class MediaContainerNode extends Node {
792800
* different shape via this API.
793801
*/
794802
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;
795811
}
796812

797813
/**
@@ -912,7 +928,7 @@ export declare class PageList extends RestrictedItemList<PageNode> {
912928
* @param geometry - The size of the new page.
913929
*
914930
*/
915-
addPage(geometry: RectangleGeometry): PageNode;
931+
addPage(inputGeometry: RectangleGeometry): PageNode;
916932
}
917933

918934
/**
@@ -1174,23 +1190,16 @@ export declare class SolidColorShapeNode extends Node {
11741190
}
11751191

11761192
/**
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.
11781197
*/
1179-
export declare class StrokableNode extends Node implements IStrokableNode {
1198+
export declare interface SolidColorStroke extends Stroke {
11801199
/**
1181-
* The stroke applied to the shape, if any.
1200+
* The stroke type.
11821201
*/
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;
11941203
/**
11951204
* The color of a stroke.
11961205
*/
@@ -1216,6 +1225,34 @@ export declare interface Stroke {
12161225
position: StrokePosition;
12171226
}
12181227

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+
12191256
/**
12201257
* <InlineAlert slots="text" variant="warning"/>
12211258
* *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 {
12341271
*/
12351272
export declare class StrokeShapeNode extends StrokableNode {}
12361273

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+
12371289
/**
12381290
* <InlineAlert slots="text" variant="warning"/>
12391291
* *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 {
12491301
*/
12501302
export declare class TextNode extends Node {
12511303
/**
1252-
* The text string of the node
1304+
* The text string of the node.
12531305
*/
12541306
get text(): string;
1307+
/**
1308+
* Sets the text content of the text node.
1309+
*/
12551310
set text(textContent: string);
12561311
/**
12571312
* The horizontal text alignment of the text node. Alignment is always the same across this node's entire text content.

packages/wxp-sdk-types/ui/ui-sdk.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ export declare enum AppEvent {
134134
* triggered when the regional format is changed in the application.
135135
*/
136136
formatchange = "formatchange",
137+
/**
138+
* triggered when the sdk is reset.
139+
*/
140+
reset = "reset",
137141
/**
138142
* triggered when drag is started on the currently dragged element.
139143
*/
@@ -162,6 +166,7 @@ declare interface AppEventsTypeMap {
162166
[AppEvent.themechange]: AppThemeChangeEventData;
163167
[AppEvent.localechange]: AppLocaleChangeEventData;
164168
[AppEvent.formatchange]: AppFormatChangeEventData;
169+
[AppEvent.reset]: undefined;
165170
[AppEvent.dragstart]: AppDragStartEventData;
166171
[AppEvent.dragend]: AppDragEndEventData;
167172

rush.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -19,43 +19,43 @@
1919
"packageName": "@adobe/ccweb-add-on-manifest",
2020
"projectFolder": "packages/add-on-manifest",
2121
"reviewCategory": "production",
22-
"shouldPublish": true
22+
"shouldPublish": false
2323
},
2424
{
2525
"packageName": "@adobe/ccweb-add-on-core",
2626
"projectFolder": "packages/wxp-core",
2727
"reviewCategory": "production",
28-
"shouldPublish": true
28+
"shouldPublish": false
2929
},
3030
{
3131
"packageName": "@adobe/create-ccweb-add-on",
3232
"projectFolder": "packages/create-ccweb-add-on",
3333
"reviewCategory": "production",
34-
"shouldPublish": true
34+
"shouldPublish": false
3535
},
3636
{
3737
"packageName": "@adobe/ccweb-add-on-scaffolder",
3838
"projectFolder": "packages/wxp-add-on-scaffolder",
3939
"reviewCategory": "production",
40-
"shouldPublish": true
40+
"shouldPublish": false
4141
},
4242
{
4343
"packageName": "@adobe/ccweb-add-on-scripts",
4444
"projectFolder": "packages/wxp-scripts",
4545
"reviewCategory": "production",
46-
"shouldPublish": true
46+
"shouldPublish": false
4747
},
4848
{
4949
"packageName": "@adobe/ccweb-add-on-ssl",
5050
"projectFolder": "packages/wxp-ssl",
5151
"reviewCategory": "production",
52-
"shouldPublish": true
52+
"shouldPublish": false
5353
},
5454
{
5555
"packageName": "@adobe/ccweb-add-on-analytics",
5656
"projectFolder": "packages/wxp-analytics",
5757
"reviewCategory": "production",
58-
"shouldPublish": true
58+
"shouldPublish": false
5959
},
6060
{
6161
"packageName": "@adobe/ccweb-add-on-sdk-types",

0 commit comments

Comments
 (0)