diff --git a/README.md b/README.md index 1a38540..8e8d8fd 100644 --- a/README.md +++ b/README.md @@ -30,3 +30,8 @@ You may also take a look at the `tsconfig.json` file contained in this repositor ## One last thing These type declarations track the contents of the official documentation. If an issue with the type declarations stems from an issue with the official documentation, then the type declaration files will be fixed once the issue is addressed in the documentation. This is intentional so as to keep the type declarations both maintainable and in sync with the documentation. + +A few notable exceptions include: +- `scenegraph.SceneNode` and `scenegraph.RootNode`, are documented as classes, but implemented as interfaces (in the TypeScript-sense, i.e., without a constructor), which is how they get declared in the typings +- To avoid ambiguity with the *DOM* `Selection` type, the interface [`Selection`](https://adobexdplatform.com/plugin-docs/reference/selection.html) is implemented under the name `XDSelection` (in the global namespace), here. +- The `LinearGradient` type is incorrectly documented as [`LinearGradientFill`](https://adobexdplatform.com/plugin-docs/reference/LinearGradientFill.html). This is implemented "the right way" in the typings. diff --git a/package.json b/package.json index 357fa40..f982b63 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adobexd/typings", - "version": "22.0.0", + "version": "25.0.0", "typings": "./types/index.d.ts", "description": "Typings for Adobe XD CC", "repository": { diff --git a/types/assets.d.ts b/types/assets.d.ts index b376d45..91e5fe8 100644 --- a/types/assets.d.ts +++ b/types/assets.d.ts @@ -1,5 +1,5 @@ declare module 'assets' { - import {Color, LinearGradientFill, RadialGradientFill} from "scenegraph"; + import {Color, LinearGradient, RadialGradient} from "scenegraph"; /** * Type of gradient color element: linear gradient or radial gradient @@ -37,7 +37,7 @@ declare module 'assets' { */ gradientType: GradientType; /** - * Array of color stops used in the gradient, where stop >= 0 and <= 1, and the values are strictly increasing. Same format as the colorStops property of a LinearGradientFill object. + * Array of color stops used in the gradient, where stop >= 0 and <= 1, and the values are strictly increasing. Same format as the colorStops property of a LinearGradient object. */ colorStops: Array<{ stop: number, color: Color }> } @@ -132,7 +132,7 @@ declare module 'assets' { * @param colorAssets The color assets * @returns {number} number of assets added (may be less than requested if duplicates already exist) */ - add(colorAssets: Color | ColorAsset | LinearGradientFill | RadialGradientFill | GradientAsset | Array): number; + add(colorAssets: Color | ColorAsset | LinearGradient | RadialGradient | GradientAsset | Array): number; /** * Delete color/gradient assets from the collection. @@ -142,7 +142,7 @@ declare module 'assets' { * @param colorAssets The color assets * @returns {number} number of assets deleted (may be less than requested if some didn't exist) */ - delete(colorAssets: Color | ColorAsset | LinearGradientFill | RadialGradientFill | GradientAsset | Array): number; + delete(colorAssets: Color | ColorAsset | LinearGradient | RadialGradient | GradientAsset | Array): number; } /** diff --git a/types/scenegraph.d.ts b/types/scenegraph.d.ts index e056498..bbad14d 100644 --- a/types/scenegraph.d.ts +++ b/types/scenegraph.d.ts @@ -207,7 +207,7 @@ declare module 'scenegraph' { clone(): Color; } - export class LinearGradientFill { + export class LinearGradient { /** * Array of objects representing each color and its position along the gradient line. The position (stop value) is a number 0.0 - 1.0. */ @@ -234,14 +234,14 @@ declare module 'scenegraph' { endY: number; /** - * Create a new LinearGradientFill instance. + * Create a new LinearGradient instance. */ constructor(); /** * Returns a copy of this instance. */ - clone(): LinearGradientFill; + clone(): LinearGradient; /** * Returns an array of [startX, startY, endX, endY]. @@ -259,9 +259,9 @@ declare module 'scenegraph' { } /** - * **The RadialGradientFill type is not documented and its API may change. Plugins currently cannot modify or otherwise work with radial gradients.** + * **The RadialGradient type is not documented and its API may change. Plugins currently cannot modify or otherwise work with radial gradients.** */ - export class RadialGradientFill { + export class RadialGradient { // TODO: Waiting for documentation to arrive } @@ -612,8 +612,8 @@ declare module 'scenegraph' { fill: | null | Color - | LinearGradientFill - | RadialGradientFill + | LinearGradient + | RadialGradient | ImageFill; /** @@ -1355,7 +1355,7 @@ declare module 'scenegraph' { * **Since:** XD 14 * Object representing the current selection state and edit context. Also available as the first argument passed to your plugin command handler function. */ - export const selection: SceneNodeList; + export const selection: XDSelection; /** * **Since:** XD 14