diff --git a/package.json b/package.json index 9b1caaf..1ca9379 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adobexd/typings", - "version": "15.0.0", + "version": "19.0.0", "typings": "./types/index.d.ts", "description": "Typings for Adobe XD CC", "repository": { diff --git a/types/interactions.d.ts b/types/interactions.d.ts new file mode 100644 index 0000000..06eebc6 --- /dev/null +++ b/types/interactions.d.ts @@ -0,0 +1,98 @@ +import {Artboard, SceneNode} from "./scenegraph"; + +/** + * The `interactions` module represents all document interactions. + * + * **Since:** XD 19 + * + * @example ```javascript + * // Get the home Artboard + const home = interactions.homeArtboard; + console.log(`Home artboard name: ${home.name} guid: ${home.guid}`); + + // Get all of the document interactions + const allInter = interactions.allInteractions; + allInter.forEach(inter => { + console.log(`triggerNode guid: ${inter.triggerNode.guid}`); + console.log(`triggerNode Name: ${inter.triggerNode.name}`); + console.log(JSON.stringify(inter.interactions, null, 2)); +}) + ``` + */ +declare class interactions { + /** + * The home artboard of the interaction model. This is a special designation indicating this is the first artboard to display in a shared prototype. + */ + public static readonly homeArtboard?: Artboard; + + /** + * Get all interactions by serializing the document interactions to JSON. An array of all the interactions is returned. + */ + public static readonly allInteractions: Array<{ triggerNode: SceneNode, interactions: Array }>; +} + +/** + * @example ```javascript + * { + trigger: { + type: 'tap' + }, + action: { + type: 'goToArtboard', + destination: + Artboard ('iPhone 6/7/8') { + width: 375, height: 667 + global X,Y: 1040, -14 + parent: RootNode + children: [Group, Group, Group] + fill: ffffffff + }, + preserveScrollPosition: false, + transition: [transitionData] + } +} + * ``` + */ +type InteractionData = { + trigger: { + /** + * Possible values: `tap`, `voice`, `time`, `drag` + */ + type: 'tap' | 'voice' | 'time' | 'drag' + } + + action: { + /** + * Possible values: `goToArtboard`, `overlay`, `speak`, `goBack` + */ + type: 'goToArtboard' | 'overlay' | 'speak' | 'goBack'; + /** + * The destination scenegraph node + */ + destination: SceneNode; + + /** + * Fixed scroll position indicator + */ + preserveScrollPosition: boolean; + + /** + * Data about transitions triggered by `trigger` + */ + transition: Array; + } +} + +type TransitionData = { + /** + * Possible values: `autoAnimateĀ“, `dissolve`, `push`, `slide`, `none` + */ + type: 'autoAnimate' | 'dissolve' | 'push' | 'slide' | 'none'; + + /** + * Possible values: `linear`, `ease-in`, `ease-out`, `ease-in-out`, `wind-up`, `bounce`, `snap` + */ + easing: 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'wind-up' | 'bounce' | 'snap'; +} + +export = interactions; diff --git a/types/scenegraph.d.ts b/types/scenegraph.d.ts index 4c9c271..9bede1c 100644 --- a/types/scenegraph.d.ts +++ b/types/scenegraph.d.ts @@ -811,6 +811,49 @@ declare class Path extends GraphicNode { public pathData: string; } +/** + * Polygon leaf node shape. + * + * @example ```javascript + *let polygon = new Polygon(); + polygon.width = 100; + polygon.height = 25; + polygon.fill = new Color("red"); + polygon.cornerCount = 5; + polygon.setAllCornerRadii(10); + selection.insertionParent.addChild(polygon); + selection.items = [polygon]; + * ``` + */ +declare class Polygon extends GraphicNode { + public width: number; + public height: number; + /** + * Number of vertices of a polygon. + */ + public cornerCount: number; + + /** + * True if any of the Polygon's corners is rounded (corner radius > 0). + */ + public readonly hasRoundedCorners: boolean; + + /** + * To set all corners to the same value, use setAllCornerRadii. + * + * All numbers must be >= 0 + * + * @default [0,0,...,0] + */ + public cornerRadii: number[]; + + /** + * Set the rounding radius of all corners of the Polygon to the same value. + * @param {number} radius The radius that'll get used for all corners + */ + public setAllCornerRadii(radius: number): void; +} + /** * BooleanGroup container node - although it has fill/stroke/etc. properties like a leaf shape node, it is a container with children. Its visual appearance is determined by generating a path via a nondestructive boolean operation on all its childrenā€™s paths. * @@ -980,6 +1023,23 @@ declare class Text extends GraphicNode { * Always false for point text. For area text, true if the text does not fit in the content box and its bottom is being clipped. */ public readonly clippedByArea: boolean; + + /** + * **Since:** XD 19 + * + * Set strikethrough across all style ranges, or get the strikethrough of the last style range (strikethrough of all the text if one range covers all the text). + * @default false + */ + public strikethrough: boolean; + + /** + * **Since:** XD 19 + * + * Set textTransform ("none" or "uppercase" or "lowercase" or "titlecase") across all style ranges, or get the textTransform of the last style range. + * + * @default 'none' + */ + public textTransform: 'none' | 'uppercase' | 'lowercase' | 'titlecase'; } /** @@ -1035,6 +1095,11 @@ declare class SymbolInstance extends SceneNode { */ public readonly symbolId: string; + /** + * Reports if this symbol is a master symbol or not. + */ + public readonly isMaster: boolean; + /** * Adds a child node to this container node. You can only add leaf nodes this way; to create structured subtrees of content, use commands. * @param {SceneNode} node Child to add @@ -1208,6 +1273,7 @@ export { Ellipse, Line, Path, + Polygon, BooleanGroup, Text, Group,