Skip to content

Commit d2f9049

Browse files
authored
Merge pull request #40 from AdobeXD/xd-15
Xd 15
2 parents 8dc6a6a + c5faebf commit d2f9049

File tree

5 files changed

+554
-391
lines changed

5 files changed

+554
-391
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adobexd/typings",
3-
"version": "14.0.0",
3+
"version": "15.0.0",
44
"typings": "./types/index.d.ts",
55
"description": "Typings for Adobe XD CC",
66
"repository": {

types/application.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Color, SceneNode} from "./scenegraph";
1+
import {SceneNode} from "./scenegraph";
22

33
/**
44
* All rendition settings fields are required (for a given rendition type) unless otherwise specified.

types/assets.d.ts

+169
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
/**
2+
* Represents the document styles listed in the Assets panel. Styles can be added and removed manually by the user, so there's no guarantee that these styles are currently used anywhere in the document's content.
3+
* **Since: ** XD 15
4+
*/
5+
export module assets {
6+
/**
7+
* Type of gradient color element: linear gradient or radial gradient
8+
*/
9+
export enum GradientType {
10+
LINEAR,
11+
RADIAL
12+
}
13+
14+
/**
15+
* Assets library entry representing a solid color.
16+
*/
17+
type ColorAsset = {
18+
/**
19+
* Name of the Assets entry, if it is explicitly named. (The UI shows an auto-generated label for any unnamed assets).
20+
*/
21+
name?: string;
22+
23+
/**
24+
* Color of the asset
25+
*/
26+
color: Color;
27+
}
28+
29+
/**
30+
* Assets library entry representing a linear or radial gradient.
31+
*/
32+
type GradientAsset = {
33+
/**
34+
* Name of the Assets entry, if it is explicitly named. (The UI shows an auto-generated label for any unnamed assets).
35+
*/
36+
name?: string;
37+
/**
38+
* Either `GradientType.LINEAR` or `GradientType.RADIAL`
39+
*/
40+
gradientType: GradientType;
41+
/**
42+
* 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.
43+
*/
44+
colorStops: Array<{ stop: number, color: Color }>
45+
}
46+
47+
/**
48+
* Assets library entry representing a set of text character styles.
49+
*/
50+
type CharacterStyleAsset = {
51+
/**
52+
* Name of the Assets entry, if it is explicitly named. (The UI shows an auto-generated label for any unnamed assets).
53+
*/
54+
name?: string;
55+
/**
56+
* Object containing the style properties
57+
*/
58+
style: CharacterStyle;
59+
}
60+
61+
/**
62+
* Character style properties. See documentation for the Text node type for more details.
63+
*/
64+
type CharacterStyle = {
65+
/**
66+
* the font family
67+
*/
68+
fontFamily: string;
69+
/**
70+
* the style of the font
71+
*/
72+
fontStyle: string;
73+
/**
74+
* the size of the font
75+
*/
76+
fontSize: number;
77+
/**
78+
* the Color of the font fill
79+
*/
80+
fill: Color;
81+
/**
82+
* the character spacing
83+
*/
84+
charSpacing: number;
85+
/**
86+
* the line spacing
87+
*/
88+
lineSpacing: number;
89+
/**
90+
* whether underline is turned on
91+
*/
92+
underline: boolean;
93+
}
94+
95+
/**
96+
* The collection of colors and gradients saved in this document's Asset library
97+
*/
98+
declare static class colors {
99+
/**
100+
* Get a list of all color/gradient assets, in the order they appear in the Assets panel.
101+
*
102+
* The list may contain a mix of solid Color assets and/or gradient assets. If there are no color/gradient assets, an empty array is returned.
103+
*
104+
* @example
105+
* var assets = require("assets"),
106+
* allColors = assets.colors.get();
107+
*
108+
*/
109+
public static get(): Array<ColorAsset | GradientAsset>;
110+
111+
/**
112+
* Add color/gradient assets to the collection.
113+
*
114+
* The list may contain a mix of solid Color assets and/or gradient assets. Items are not added if a duplicate color/gradient already exists in the collection, *regardless of its name*.
115+
* @param colorAssets The color assets
116+
* @returns {number} number of assets added (may be less than requested if duplicates already exist)
117+
*/
118+
public static add(colorAssets: Color | ColorAsset | LinearGradientFill | RadialGradientFill | GradientAsset | Array<Color | ColorAsset | LinearGradientFill | RadialGradientFill | GradientAsset>): number;
119+
120+
/**
121+
* Delete color/gradient assets from the collection.
122+
*
123+
* The list may contain a mix of solid Color assets and/or gradient assets. Assets with the same color/gradient are removed even if their names differ. Assets that already don't exist in the collection are silently ignored. Typically you will pass asset objects returned from `get()` directly to this function.
124+
*
125+
* @param colorAssets The color assets
126+
* @returns {number} number of assets deleted (may be less than requested if some didn't exist)
127+
*/
128+
public static delete(colorAssets: Color | ColorAsset | LinearGradientFill | RadialGradientFill | GradientAsset | Array<Color | ColorAsset | LinearGradientFill | RadialGradientFill | GradientAsset>): number;
129+
}
130+
131+
/**
132+
* The collection of character styles saved in this document's Assets library.
133+
*/
134+
declare static class characterStyles {
135+
/**
136+
* Get a list of all character style assets, in the order they appear in the Assets panel.
137+
*
138+
* If there are no character style assets, an empty array is returned.
139+
*
140+
* @example
141+
* var assets = require("assets"),
142+
* allCharacterStyles = assets.characterStyles.get();
143+
*
144+
*/
145+
public static get(): Array<CharacterStyleAsset>;
146+
147+
/**
148+
* Add one or more character style assets to the collection.
149+
*
150+
* Items are not added if a duplicate character style already exists in the collection, regardless of its name. All character style properties must be fully specified (no properties are optional).
151+
*
152+
* @param charStyleAssets The character style assets
153+
* @returns {number} number of assets added (may be less than requested if duplicates already exist)
154+
*/
155+
public static add(charStyleAssets: CharacterStyleAsset | Array<CharacterStyleAsset>): number;
156+
157+
/**
158+
* Delete one or more character style assets from the collection.
159+
*
160+
* Assets with the same character style are removed even if their names differ. Assets that already don't exist in the collection are silently ignored. All character style properties must be fully specified (no properties are optional). Typically you will pass asset objects returned from `get()` directly to this function.
161+
*
162+
* @returns {number} number of assets deleted (may be less than requested if some didn't exist)
163+
* @param charStyleAssets The character styles
164+
*/
165+
public static delete(charStyleAssets: CharacterStyleAsset | Array<CharacterStyleAsset>): number;
166+
}
167+
168+
169+
}

0 commit comments

Comments
 (0)