Skip to content

Commit

Permalink
Merge pull request #46 from AdobeXD/xd-19
Browse files Browse the repository at this point in the history
XD 19 APIs update
  • Loading branch information
pklaschka committed May 20, 2019
2 parents c8459a6 + dac29ac commit 357af6b
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
98 changes: 98 additions & 0 deletions types/interactions.d.ts
Original file line number Diff line number Diff line change
@@ -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<InteractionData> }>;
}

/**
* @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<TransitionData>;
}
}

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;
66 changes: 66 additions & 0 deletions types/scenegraph.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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';
}

/**
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -1208,6 +1273,7 @@ export {
Ellipse,
Line,
Path,
Polygon,
BooleanGroup,
Text,
Group,
Expand Down

0 comments on commit 357af6b

Please sign in to comment.