-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.d.ts
424 lines (390 loc) · 13.7 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
/*
Generated by typeshare 1.5.0
*/
/** [Figma documentation](https://www.figma.com/developers/api#color-type) */
export interface Color {
r: number;
g: number;
b: number;
a: number;
}
/** [Figma documentation](https://www.figma.com/developers/api#component-type) */
export interface Component {
key: string;
name: string;
description: string;
}
export enum EffectType {
InnerShadow = "INNER_SHADOW",
DropShadow = "DROP_SHADOW",
LayerBlur = "LAYER_BLUR",
BackgroundBlur = "BACKGROUND_BLUR",
}
/** [Figma documentation](https://www.figma.com/developers/api#vector-type) */
export interface Vector {
x: number;
y: number;
}
/**
* A visual effect such as a shadow or blur
*
* [Figma documentation](https://www.figma.com/developers/api#effect-type)
*/
export interface Effect {
/** Type of effect */
type: EffectType;
/** Is the effect active? */
visible: boolean;
/** The color of the shadow */
color?: Color;
/** How far the shadow is projected in the x and y directions */
offset?: Vector;
/** How far the shadow spreads */
spread?: number;
}
/** Node type indicates what kind of node you are working with: for example, a FRAME node versus a RECTANGLE node. A node can have additional properties associated with it depending on its node type. */
export enum NodeType {
Document = "DOCUMENT",
Canvas = "CANVAS",
Frame = "FRAME",
Group = "GROUP",
Vector = "VECTOR",
BooleanOperation = "BOOLEAN_OPERATION",
Star = "STAR",
Line = "LINE",
Ellipse = "ELLIPSE",
RegularPolygon = "REGULAR_POLYGON",
Rectangle = "RECTANGLE",
Text = "TEXT",
Slice = "SLICE",
Component = "COMPONENT",
ComponentSet = "COMPONENT_SET",
Instance = "INSTANCE",
Sticky = "STICKY",
ShapeWithText = "SHAPE_WITH_TEXT",
Connector = "CONNECTOR",
Section = "SECTION",
}
export enum PaintType {
Solid = "SOLID",
GradientLinear = "GRADIENT_LINEAR",
GradientRadial = "GRADIENT_RADIAL",
GradientAngular = "GRADIENT_ANGULAR",
GradientDiamond = "GRADIENT_DIAMOND",
Image = "IMAGE",
}
/**
* how layer blends with layers below
*
* [Figma documentation](https://www.figma.com/developers/api#blendmode-type)
*/
export enum BlendMode {
PassThrough = "PASS_THROUGH",
Normal = "NORMAL",
Darken = "DARKEN",
Multiply = "MULTIPLY",
LinearBurn = "LINEAR_BURN",
ColorBurn = "COLOR_BURN",
Lighten = "LIGHTEN",
Screen = "SCREEN",
LinearDodge = "LINEAR_DODGE",
ColorDodge = "COLOR_DODGE",
Overlay = "OVERLAY",
SoftLight = "SOFT_LIGHT",
HardLight = "HARD_LIGHT",
Difference = "DIFFERENCE",
Exclusion = "EXCLUSION",
Hue = "HUE",
Saturation = "SATURATION",
Color = "COLOR",
Luminosity = "LUMINOSITY",
}
/**
* A solid color, gradient, or image texture that can be applied as fills or strokes
*
* [Figma documentation](https://www.figma.com/developers/api#paint-type)
*/
export interface Paint {
type: PaintType;
/** Is the paint enabled? */
visible?: boolean;
/** Overall opacity of paint (colors within the paint can also have opacity values which would blend with this) */
opacity?: number;
/** Solid color of the paint */
color?: Color;
/** How this node blends with nodes behind it in the scene */
blend_mode?: BlendMode;
/** This field contains three vectors, each of which are a position in normalized object space (normalized object space is if the top left corner of the bounding box of the object is (0, 0) and the bottom right is (1,1)). The first position corresponds to the start of the gradient (value 0 for the purposes of calculating gradient stops), the second position is the end of the gradient (value 1), and the third handle position determines the width of the gradient. See image examples below: */
gradient_handle_positions?: [Vector, Vector, Vector];
}
/** Individual stroke weights */
export interface StrokeWeights {
/** The top stroke weight */
top: number;
/** The right stroke weight */
right: number;
/** The bottom stroke weight */
bottom: number;
/** The left stroke weight */
left: number;
}
export enum StrokeAlign {
/** stroke drawn inside the shape boundary */
Inside = "INSIDE",
/** stroke drawn outside the shape boundary */
Outside = "OUTSIDE",
/** stroke drawn centered along the shape boundary */
Center = "CENTER",
}
/**
* Animation easing curves
*
* [Figma documentation](https://www.figma.com/developers/api#easingtype-type)
*/
export enum EasingType {
/** Ease in with an animation curve similar to CSS ease-in */
EaseIn = "EASE_IN",
/** Ease out with an animation curve similar to CSS ease-out */
EaseOut = "EASE_OUT",
/** Ease in and then out with an animation curve similar to CSS ease-in-out */
EaseInAndOut = "EASE_IN_AND_OUT",
/** No easing, similar to CSS linear */
Linear = "LINEAR",
EaseInBack = "EASE_IN_BACK",
EaseOutBack = "EASE_OUT_BACK",
EaseInAndOutBack = "EASE_IN_AND_OUT_BACK",
CustomBezier = "CUSTOM_BEZIER",
Gentle = "GENTLE",
Quick = "QUICK",
Bouncy = "BOUNCY",
Slow = "SLOW",
CustomSpring = "CUSTOM_SPRING",
}
/** [Figma documentation](https://www.figma.com/developers/api#rectangle-type) */
export interface Rectangle {
x?: number;
y?: number;
width?: number;
height?: number;
}
export enum AxisSizingMode {
Fixed = "FIXED",
Auto = "AUTO",
}
export enum PrimaryAxisAlignItems {
Min = "MIN",
Center = "CENTER",
Max = "MAX",
SpaceBetween = "SPACE_BETWEEN",
}
export enum CounterAxisAlignItems {
Min = "MIN",
Center = "CENTER",
Max = "MAX",
Baseline = "BASELINE",
}
export enum LayoutPositioning {
Absolute = "ABSOLUTE",
}
export enum LayoutMode {
None = "NONE",
Horizontal = "HORIZONTAL",
Vertical = "VERTICAL",
}
export interface Styles {
fill?: string;
text?: string;
stroke?: string;
effect?: string;
}
export enum TextCase {
Upper = "UPPER",
Lower = "LOWER",
Title = "TITLE",
SmallCaps = "SMALL_CAPS",
SmallCapsForced = "SMALL_CAPS_FORCED",
}
export enum TextDecoration {
Strikethrough = "STRIKETHROUGH",
Underline = "UNDERLINE",
}
export enum TextAutoResize {
Height = "HEIGHT",
WidthAndHeight = "WIDTH_AND_HEIGHT",
/** The text will be shortened and trailing text will be replaced with "…" if the text contents is larger than the bounds */
Truncate = "TRUNCATE",
}
/** Type of hyperlink */
export enum HyperlinkType {
Url = "URL",
Node = "NODE",
}
export interface Hyperlink {
type?: HyperlinkType;
/** URL being linked to, if URL type */
url?: string;
/** ID of frame hyperlink points to, if NODE type */
nodeId?: string;
}
/**
* Metadata for character formatting
*
* [Figma documentation](https://www.figma.com/developers/api#typestyle-type)
*/
export interface TypeStyle {
/** Font family of text (standard name) */
fontFamily: string;
/** Space between paragraphs in px, 0 if not present */
paragraphSpacing?: number;
/** Whether or not text is italicized */
italic?: boolean;
/** Numeric font weight */
fontWeight: number;
/** Font size in px */
fontSize: number;
/** Text casing applied to the node, default is the original casing */
textCase?: TextCase;
/** Text decoration applied to the node, default is none */
textDecoration?: TextDecoration;
/** Dimensions along which text will auto resize, default is that the text does not auto-resize */
textAutoResize?: TextAutoResize;
/** Link to a URL or frame */
hyperlink?: Hyperlink;
/** Line height in px */
lineHeightPx: number;
}
export enum LayoutConstraintVertical {
/** Node is laid out relative to top of the containing frame */
Top = "TOP",
/** Node is laid out relative to bottom of the containing frame */
Bottom = "BOTTOM",
/** Node is vertically centered relative to containing frame */
Center = "CENTER",
/** Both top and bottom of node are constrained relative to containing frame (node stretches with frame) */
TopBottom = "TOP_BOTTOM",
/** Node scales vertically with containing frame */
Scale = "SCALE",
}
export enum LayoutConstraintHorizontal {
/** Node is laid out relative to left of the containing frame */
Left = "LEFT",
/** Node is laid out relative to right of the containing frame */
Right = "RIGHT",
/** Node is horizontally centered relative to containing frame */
Center = "CENTER",
/** Both left and right of node are constrained relative to containing frame (node stretches with frame) */
LeftRight = "LEFT_RIGHT",
/** Node scales horizontally with containing frame */
Scale = "SCALE",
}
/** Layout constraint relative to containing Frame */
export interface LayoutConstraint {
vertical: LayoutConstraintVertical;
horizontal: LayoutConstraintHorizontal;
}
export enum LayoutAlign {
Inherit = "INHERIT",
Stretch = "STRETCH",
Min = "MIN",
Center = "CENTER",
Max = "MAX",
}
/** [Figma documentation](https://www.figma.com/developers/api#node-types) */
export interface Node {
/** A string uniquely identifying this node within the document. */
id: string;
/** The name given to the node by the user in the tool. */
name: string;
/** Whether or not the node is visible on the canvas. */
visible?: boolean;
/** The type of the node */
type: NodeType;
/** An array of nodes that are direct children of this node */
children?: Node[];
/** Background color of the canvas */
backgroundColor?: Color;
/** An array of fill paints applied to the node */
fills?: Paint[];
/** An array of stroke paints applied to the node */
strokes?: Paint[];
/** The weight of strokes on the node */
strokeWeight?: number;
/** An object including the top, bottom, left, and right stroke weights. Only returned if individual stroke weights are used. */
individualStrokeWeights?: StrokeWeights;
/** Position of stroke relative to vector outline */
strokeAlign?: StrokeAlign;
/** An array of floating point numbers describing the pattern of dash length and gap lengths that the vector path follows. For example a value of [1, 2] indicates that the path has a dash of length 1 followed by a gap of length 2, repeated. */
strokeDashes?: number[];
/** Radius of each corner of the node if a single radius is set for all corners */
cornerRadius?: number;
/** Array of length 4 of the radius of each corner of the node, starting in the top left and proceeding clockwise */
rectangleCornerRadii?: [number, number, number, number];
/** The duration of the prototyping transition on this node (in milliseconds) */
transitionDuration?: number;
/** The easing curve used in the prototyping transition on this node */
transitionEasing?: EasingType;
/** Opacity of the node */
opacity?: number;
/** Bounding box of the node in absolute space coordinates */
absoluteBoundingBox?: Rectangle;
/** The bounds of the rendered node in the file in absolute space coordinates */
absoluteRenderBounds?: Rectangle;
/** Whether the primary axis has a fixed length (determined by the user) or an automatic length (determined by the layout engine). This property is only applicable for auto-layout frames. */
primaryAxisSizingMode?: AxisSizingMode;
/** Whether the counter axis has a fixed length (determined by the user) or an automatic length (determined by the layout engine). This property is only applicable for auto-layout frames. */
counterAxisSizingMode?: AxisSizingMode;
/** Determines how the auto-layout frame’s children should be aligned in the primary axis direction. This property is only applicable for auto-layout frames. */
primaryAxisAlignItems?: PrimaryAxisAlignItems;
/** Determines how the auto-layout frame’s children should be aligned in the counter axis direction. This property is only applicable for auto-layout frames. */
counterAxisAlignItems?: CounterAxisAlignItems;
/** The distance between children of the frame. Can be negative. This property is only applicable for auto-layout frames. */
itemSpacing?: number;
/** Determines whether a layer's size and position should be determined by auto-layout settings or manually adjustable. */
layoutPositioning?: LayoutPositioning;
/** Whether this layer uses auto-layout to position its children. */
layoutMode?: LayoutMode;
/** The padding between the left border of the frame and its children. This property is only applicable for auto-layout frames. */
paddingLeft?: number;
/** The padding between the right border of the frame and its children. This property is only applicable for auto-layout frames. */
paddingRight?: number;
/** The padding between the top border of the frame and its children. This property is only applicable for auto-layout frames. */
paddingTop?: number;
/** The padding between the bottom border of the frame and its children. This property is only applicable for auto-layout frames. */
paddingBottom?: number;
/** An array of effects attached to this node */
effects?: Effect[];
/** A mapping of a StyleType to style ID of styles present on this node. The style ID can be used to look up more information about the style in the top-level styles field. */
styles?: Styles;
/** Text contained within a text box */
characters?: string;
/** Style of text including font family and weight */
style?: TypeStyle;
/** Horizontal and vertical layout contraints for node */
constraints?: LayoutConstraint;
/** Determines if the layer should stretch along the parent’s counter axis. This property is only provided for direct children of auto-layout frames. */
layoutAlign?: LayoutAlign;
/** This property is applicable only for direct children of auto-layout frames, ignored otherwise. Determines whether a layer should stretch along the parent’s primary axis. A 0 corresponds to a fixed size and 1 corresponds to stretch */
layoutGrow?: number;
}
export enum StyleType {
Fill = "FILL",
Text = "TEXT",
Effect = "EFFECT",
Grid = "GRID",
}
/** [Figma documentation](https://www.figma.com/developers/api#style-type) */
export interface Style {
key: string;
name: string;
description: string;
remote: boolean;
styleType: StyleType;
}
export interface File {
document: Node;
components: Record<string, Component>;
styles: Record<string, Style>;
name: string;
schemaVersion: number;
version: string;
}