Skip to content

Commit ead98ad

Browse files
xerxovksiAbhishek Das
andauthored
Release 20250117 (#26)
* New API type definitions * Change list --------- Co-authored-by: Abhishek Das <[email protected]>
1 parent 970d09c commit ead98ad

File tree

4 files changed

+172
-28
lines changed

4 files changed

+172
-28
lines changed
Lines changed: 10 additions & 0 deletions
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": "New API type definitions",
6+
"type": "minor"
7+
}
8+
],
9+
"packageName": "@adobe/ccweb-add-on-sdk-types"
10+
}

packages/wxp-sdk-types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adobe/ccweb-add-on-sdk-types",
3-
"version": "1.10.0",
3+
"version": "1.11.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

Lines changed: 121 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
* SOFTWARE.
2323
********************************************************************************/
2424

25-
/// <reference types="gl-matrix/index.js" />
26-
2725
import { mat2d } from "gl-matrix";
2826

2927
/**
@@ -124,6 +122,7 @@ declare interface ApiModuleExport {
124122
constants: unknown;
125123
colorUtils: ExpressColorUtils;
126124
fonts: ExpressFonts;
125+
viewport: ExpressViewport;
127126
}
128127

129128
/**
@@ -157,7 +156,7 @@ declare enum ArrowHeadType {
157156

158157
/**
159158
* ArtboardList represents an ordered list of ArtboardNodes arranged in a timeline sequence, where they are called "scenes."
160-
* All items in the list are children of a single PageNode.
159+
* All items in the list are children of a single {@link PageNode}.
161160
*
162161
* ArtboardList also provides APIs for adding/removing artboards from the page. ArtboardList is never empty: it is illegal to
163162
* remove the last remaining artboard from the list.
@@ -175,8 +174,11 @@ export declare class ArtboardList extends RestrictedItemList<ArtboardNode> {
175174

176175
/**
177176
* An ArtboardNode represents an artboard object in the scenegraph. All user visual content must be contained on an artboard.
177+
* Artboards are always contained on a {@link PageNode}; when a page contains multiple artboards, the artboards represent
178+
* "scenes" in a linear timeline sequence.
179+
*
180+
* To create new artboards, see {@link ArtboardList.addArtboard}.
178181
*
179-
* When multiple artboards exist on a page, the artboards represent "scenes" in a linear timeline sequence.
180182
* Please note that creating and deleting an artboard in a single frame will crash the editor.
181183
*/
182184
export declare class ArtboardNode extends VisualNode implements IRectangularNode, ContainerNode {
@@ -246,12 +248,28 @@ export declare class AvailableFont extends BaseFont {
246248
* **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`.
247249
*
248250
* @experimental
249-
* Base character styles that can be applied to a range of characters.
251+
* Base character styles that can be applied to any range of characters.
252+
* Excludes font style, which differs between the getter-oriented {@link CharacterStyles} interface and the
253+
* setter-oriented {@link CharacterStylesInput}.
250254
*/
251255
declare interface BaseCharacterStyles {
256+
/**
257+
* Size of the text in points.
258+
*/
252259
fontSize: number;
260+
/**
261+
* Text color.
262+
*/
253263
color: Color;
254-
tracking: number;
264+
/**
265+
* Uniformly adjusts the letter spacing, aka character spacing. Specified as a delta relative to the font's default
266+
* spacing, in units of 1/1000 em: positive values increase the spacing, negative values tighten the spacing, and 0
267+
* leaves spacing at its default.
268+
*/
269+
letterSpacing: number;
270+
/**
271+
* Adds an underline to text.
272+
*/
255273
underline: boolean;
256274
}
257275

@@ -415,7 +433,8 @@ declare enum BlendMode {
415433
* **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`.
416434
*
417435
* @experimental
418-
* Text styles of a range of characters, even a short span like a single word.
436+
* Text styles that can be applied to any range of characters, even a short span like a single word. (Contrast with
437+
* ParagraphStyles, which must be applied to an entire paragraph atomically).
419438
*/
420439
export declare interface CharacterStyles extends BaseCharacterStyles {
421440
font: Font;
@@ -427,7 +446,11 @@ export declare interface CharacterStyles extends BaseCharacterStyles {
427446
* **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`.
428447
*
429448
* @experimental
430-
* Input shape of the applyCharacterStyle API.
449+
* Variant of {@link CharacterStyles} with all style fields optional, used for applyCharacterStyles(). When using that API,
450+
* any fields not specified are left unchanged, preserving the text's existing styles.
451+
*
452+
* If specified, the font must be of the {@link AvailableFont} type – one that is guaranteed to be available for the current
453+
* user to edit with.
431454
*/
432455
export declare interface CharacterStylesInput extends Partial<BaseCharacterStyles> {
433456
font?: AvailableFont;
@@ -439,7 +462,11 @@ export declare interface CharacterStylesInput extends Partial<BaseCharacterStyle
439462
* **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`.
440463
*
441464
* @experimental
442-
* Output shape of the characterStyleRange getter.
465+
* A set of {@link CharacterStyles} along with the range of characters they apply to. Seen in the characterStyleRanges
466+
* getter.
467+
*
468+
* Note that fonts returned by the getter are *not* guaranteed to be ones the user has rights to edit with, even though they
469+
* are visible in the document.
443470
*/
444471
export declare interface CharacterStylesRange extends CharacterStyles, StyleRange {}
445472

@@ -449,7 +476,11 @@ export declare interface CharacterStylesRange extends CharacterStyles, StyleRang
449476
* **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`.
450477
*
451478
* @experimental
452-
* Input shape of the characterStyleRange setter.
479+
* Variant of {@link CharacterStylesRange} with all style fields optional, along with the range of characters they apply to.
480+
* Used for the characterStyleRanges setter. When invoking the setter, any fields not specified are reset to their defaults.
481+
*
482+
* If specified, the font must be of the {@link AvailableFont} type – one that is guaranteed to be available for the current
483+
* user to edit with.
453484
*/
454485
export declare interface CharacterStylesRangeInput extends CharacterStylesInput, StyleRange {}
455486

@@ -559,9 +590,13 @@ export declare class Context {
559590
*/
560591
get selection(): readonly Node[];
561592
/**
562-
* Sets the current selection, automatically ensuring these rules are met:
563-
* - Nodes must be within the current artboard (others are filtered out).
564-
* - A node cannot be selected at the same time as its ancestor (descendants are filtered out).
593+
* Sets the current selection to an array of {@link Node}.
594+
* Accepts a single node as a shortcut for a length-1 array `[node]` or
595+
* `undefined` as a shortcut for `[]`, which clears the selection.
596+
*
597+
* Only node(s) that meet the following criteria can be selected:
598+
* - Nodes must be within the current artboard (nodes outside the active artboard are filtered out).
599+
* - A node cannot be selected if its ancestor is also selected (descendants are filtered out).
565600
* - Locked nodes are filtered out (but will still be included in selectionIncludingNonEditable).
566601
*/
567602
set selection(nodes: Node | readonly Node[] | undefined);
@@ -694,7 +729,7 @@ export declare class Editor {
694729
* render as a gray placeholder on other clients until it has been uploaded to DCX and then downloaded by those clients.
695730
* This local client will act as having unsaved changes until the upload has finished.
696731
*
697-
* @param bitmapData - BitmapImage resource (e.g. returned from loadBitmapImage()).
732+
* @param bitmapData - BitmapImage resource (e.g. returned from {@link loadBitmapImage}).
698733
* @param options - Additional configuration:
699734
* - initialSize - Size the image is displayed at. Must have the same aspect ratio as bitmapData. Defaults to the
700735
* size the image would be created at by a UI drag-drop gesture (typically the image's full size, but scaled down
@@ -782,7 +817,9 @@ export declare enum EditorEvent {
782817
export declare type EditorEventHandler = () => void;
783818

784819
/**
785-
* An EllipseNode represents an ellipse object in the scenegraph.
820+
* An EllipseNode represents an ellipse or circle shape in the scenegraph.
821+
*
822+
* To create new ellipse, see {@link Editor.createEllipse}.
786823
*/
787824
export declare class EllipseNode extends FillableNode {
788825
/**
@@ -834,10 +871,13 @@ declare class ExpressFonts extends Fonts {}
834871
export declare class ExpressRootNode extends BaseNode {
835872
/**
836873
* The pages of the document. All visual content is contained on artboards within the pages.
874+
* To create new pages, see {@link PageList.addPage}.
837875
*/
838876
get pages(): PageList;
839877
}
840878

879+
declare class ExpressViewport extends Viewport {}
880+
841881
/**
842882
* Base interface representing any fill in the scenegraph. See {@link FillableNode}.
843883
* Currently, you can only create {@link ColorFill}s, but you might encounter
@@ -933,6 +973,8 @@ export declare class GridCellNode extends MediaContainerNode {}
933973
/**
934974
* A GridLayoutNode represents a grid layout in the scenegraph. The GridLayoutNode is used to create
935975
* a layout grid that other content can be placed into.
976+
*
977+
* APIs to create a new grid layout are not yet available.
936978
*/
937979
export declare class GridLayoutNode extends Node implements Readonly<IRectangularNode> {
938980
/**
@@ -959,6 +1001,8 @@ export declare class GridLayoutNode extends Node implements Readonly<IRectangula
9591001
/**
9601002
* A GroupNode represents a Group object in the scenegraph, which has a collection of generic children as well as a separate,
9611003
* optional vector mask child.
1004+
*
1005+
* To create new group, see {@link Editor.createGroup}.
9621006
*/
9631007
export declare class GroupNode extends Node implements ContainerNode {
9641008
/**
@@ -997,6 +1041,9 @@ declare interface IFillableNode {
9971041
* ImageRectangleNode is a rectangular node that displays the image media part of a MediaContainerNode. It can only exist
9981042
* within that container parent. Cropping can be adjusted by changing this media's position/rotation (as well as its mask
9991043
* shape sibling node).
1044+
*
1045+
* ImageRectangleNodes cannot be created directly; use {@link Editor.createImageContainer} to create the entire
1046+
* container structure together.
10001047
*/
10011048
export declare class ImageRectangleNode extends Node implements Readonly<IRectangularNode> {
10021049
/**
@@ -1077,7 +1124,9 @@ export declare class ItemList<T extends ListItem> extends RestrictedItemList<T>
10771124
}
10781125

10791126
/**
1080-
* A LineNode represents a simple line object in the scenegraph – a single straight-line segment.
1127+
* A LineNode represents a simple vector line in the scenegraph – a single straight-line segment.
1128+
*
1129+
* To create new lines, see {@link Editor.createLine}.
10811130
*/
10821131
export declare class LineNode extends StrokableNode {
10831132
static readonly DEFAULT_START_X = 0;
@@ -1148,6 +1197,9 @@ export declare interface ListItem {}
11481197
* A MediaContainerNode is a multi-node construct that displays media (such as images or video) with optional cropping and
11491198
* clipping to a shape mask. The underlying media asset is always rectangular, but the final appearance of this node is
11501199
* determined by the maskShape which is not necessarily a rectangle.
1200+
*
1201+
* To create new media container for a bitmap image, see {@link Editor.createImageContainer}. APIs for creating a
1202+
* container with other content, such as videos, are not yet available.
11511203
*/
11521204
export declare class MediaContainerNode extends Node {
11531205
/**
@@ -1276,8 +1328,8 @@ export { Node as Node };
12761328

12771329
/**
12781330
* PageList represents an ordered list of PageNodes, all of which are children of the root node of the document's "scenegraph"
1279-
* artwork tree. A page contains one or more artboards, representing "scenes" in a linear timeline sequence. Those artboards
1280-
* in turn contain all the visual content of the document.
1331+
* artwork tree (see {@link ExpressRootNode}). A page contains one or more artboards, representing "scenes" in a linear timeline
1332+
* sequence. Those artboards in turn contain all the visual content of the document.
12811333
*
12821334
* PageList also provides APIs for adding/removing pages from the document. PageList is never empty: it is illegal to
12831335
* remove the last remaining page from the list.
@@ -1294,12 +1346,16 @@ export declare class PageList extends RestrictedItemList<PageNode> {
12941346
}
12951347

12961348
/**
1297-
* A PageNode represents a page in the document. A page contains one or more artboards, representing "scenes" in a linear
1298-
* timeline sequence. Those artboards in turn contain all the visual content of the document.
1349+
* A PageNode represents a page in the document, a child of the root node of the document's "scenegraph" artwork tree
1350+
* (see {@link ExpressRootNode}). A page contains one or more artboards, representing "scenes" in a linear timeline
1351+
* sequence. Those artboards in turn contain all the visual content of the document.
1352+
*
1353+
* To create new pages, see {@link PageList.addPage}.
12991354
*/
13001355
export declare class PageNode extends BaseNode implements Readonly<IRectangularNode> {
13011356
/**
13021357
* The artboards or "scenes" of a page, ordered by timeline sequence.
1358+
* To create new artboards, see {@link ArtboardList.addArtboard}.
13031359
*/
13041360
get artboards(): ArtboardList;
13051361
/**
@@ -1329,8 +1385,10 @@ export declare class PageNode extends BaseNode implements Readonly<IRectangularN
13291385
}
13301386

13311387
/**
1332-
* A PathNode represents a generic vector path shape in the scenegraph. Paths cannot be created or edited through this API
1388+
* A PathNode represents a generic vector path shape in the scenegraph. Paths cannot be edited through this API
13331389
* yet, only read.
1390+
*
1391+
* To create new paths, see {@link Editor.createPath}.
13341392
*/
13351393
export declare class PathNode extends FillableNode {
13361394
/**
@@ -1419,7 +1477,9 @@ export declare interface RectangleGeometry {
14191477
}
14201478

14211479
/**
1422-
* A RectangleNode represents a rectangle object in the scenegraph.
1480+
* A RectangleNode represents a rectangle shape in the scenegraph.
1481+
*
1482+
* To create new rectangles, see {@link Editor.createRectangle}.
14231483
*/
14241484
export declare class RectangleNode extends FillableNode implements IRectangularNode {
14251485
/**
@@ -1733,7 +1793,13 @@ export declare class TextContentModel {
17331793
* **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`.
17341794
*
17351795
* @experimental
1736-
* The character style ranges of this text content.
1796+
* The character styles applied to different ranges of this text content. When setting character styles, any style
1797+
* properties that are not provided are reset to their defaults (contrast to {@link applyCharacterStyles} which
1798+
* preserves the text's existing styles for any fields not specified). When *getting* styles, all fields are always
1799+
* provided.
1800+
*
1801+
* Note: existing fonts used in the document, returned by this getter, are not guaranteed to be ones the current user
1802+
* has rights to edit with. The *setter* only accepts the AvailableFont type which has been verified to be usable.
17371803
*/
17381804
get characterStyleRanges(): readonly CharacterStylesRange[];
17391805
set characterStyleRanges(styles: readonly CharacterStylesRangeInput[]);
@@ -1743,8 +1809,11 @@ export declare class TextContentModel {
17431809
* **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`.
17441810
*
17451811
* @experimental
1746-
* Apply one or more styles to the characters in the given range, leaving other styles in this range unchanged. Does
1747-
* not modify any styles in the text outside this range.
1812+
* Apply one or more styles to the characters in the given range, leaving any style properties that were not specified
1813+
* unchanged. Does not modify any styles in the text outside this range. Contrast to the {@link characterStyleRanges}
1814+
* setter, which specifies new style range(s) for the entire text at once, and resets any unspecified properties back to
1815+
* default styles.
1816+
17481817
* @param styles - The styles to apply.
17491818
* @param range - The start and length of character sequence to which the styles should be applied.
17501819
* If not specified the styles will be applied to the entire piece of text content flow.
@@ -1761,7 +1830,10 @@ export declare class TextContentModel {
17611830
/**
17621831
* A TextNode represents a text display frame in the scenegraph. It may display an entire piece of text, or sometimes just
17631832
* a subset of longer text that flows across multiple TextNode "frames". Because of this, the TextNode does not directly hold
1764-
* the text content and styles – instead it refers to a {@link TextContentModel}, which may be shared across multiple TextNodes.
1833+
* the text content and styles – instead it refers to a {@link TextContentModel}, which may be shared across multiple TextNode frames.
1834+
*
1835+
* To create new a single-frame piece of text, see {@link Editor.createText}. APIs are not yet available to create
1836+
* multi-frame text flows.
17651837
*/
17661838
export declare class TextNode extends Node {
17671839
/**
@@ -1773,6 +1845,7 @@ export declare class TextNode extends Node {
17731845
* same single {@link TextContentModel}; this can give the impression that the same text is duplicated multiple times when it is
17741846
* not. Use {@link TextContentModel}.id to determine whether a given piece of text content is unique or if it's already been
17751847
* encountered before.
1848+
*
17761849
*/
17771850
get fullContent(): TextContentModel;
17781851
/**
@@ -1883,6 +1956,28 @@ export declare interface UnsupportedTextLayout {
18831956
type: TextType.magicFit | TextType.circular;
18841957
}
18851958

1959+
/**
1960+
* Represents the area of the canvas that is currently visible on-screen.
1961+
*/
1962+
export declare class Viewport {
1963+
/**
1964+
* Adjusts the viewport to make the node's bounds visible on-screen, assuming all bounds are within the artboard bounds.
1965+
* Makes the node's {@link ArtboardNode} or {@link PageNode} visible if they were not already
1966+
* (which may result in {@link Context.selection} being cleared). It is strongly recomended
1967+
* to further draw user's attention to the node by setting it as the {@link Context.selection} following this call.
1968+
*
1969+
* After this call, the value of {@link Context.insertionParent} will always be the node's containing {@link ArtboardNode}.
1970+
*
1971+
* Note that the node might still not appear visible if:
1972+
* - Its animation settings make it invisible at the beginning of the {@link ArtboardNode} "scene".
1973+
* - It is obscured underneath other artwork in the z-order.
1974+
* - It is hidden by a {@link GroupNode}'s mask or similar cropping.
1975+
*/
1976+
bringIntoView(node: VisualNode): void;
1977+
}
1978+
1979+
export declare const viewport: ExpressViewport;
1980+
18861981
/**
18871982
* <InlineAlert slots="text" variant="warning"/>
18881983
*

0 commit comments

Comments
 (0)