UNPKG

35.3 kBTypeScriptView Raw
1export interface Global {
2 /** a string uniquely identifying this node within the document */
3 readonly id: string;
4 /** the name given to the node by the user in the tool. */
5 readonly name: string;
6 /** whether or not the node is visible on the canvas */
7 readonly visible?: boolean;
8 /** the type of the node, refer to table below for details */
9 readonly type: NodeType;
10 /** data written by plugins that is visible only to the plugin that wrote it. Requires the `pluginData` to include the ID of the plugin. */
11 readonly pluginData?: any;
12 /** data written by plugins that is visible to all plugins. Requires the `pluginData` parameter to include the string "shared". */
13 readonly sharedPluginData?: any;
14}
15/**
16 * Styles can be one of the following types
17 */
18export type StyleType = 'FILL' | 'TEXT' | 'EFFECT' | 'GRID';
19/**
20 * the above styles can be used in the following ways
21 */
22export type StyleKeyType = 'fill' | 'stroke' | 'effect' | 'grid' | 'text' | 'background';
23export type StylesObject = {
24 [key in StyleKeyType]: Record<key, string>;
25}[StyleKeyType];
26export type ScaleMode = 'FILL' | 'FIT' | 'TILE' | 'STRETCH';
27export type PaintTypeSolid = 'SOLID';
28export type PaintTypeGradient = 'GRADIENT_LINEAR' | 'GRADIENT_RADIAL' | 'GRADIENT_ANGULAR' | 'GRADIENT_DIAMOND';
29export type PaintTypeImage = 'IMAGE' | 'EMOJI';
30export type TextType = 'TEXT';
31export type PaintType = PaintTypeSolid | PaintTypeGradient | PaintTypeImage;
32/**
33 * how the layer blends with layers below
34 */
35export type BlendMode = 'PASS_THROUGH' /** (Only applicable to objects with children) */ | 'NORMAL'
36/** Darken: */
37 | 'DARKEN' | 'MULTIPLY' | 'LINEAR_BURN' | 'COLOR_BURN'
38/** Lighten: */
39 | 'LIGHTEN' | 'SCREEN' | 'LINEAR_DODGE' | 'COLOR_DODGE'
40/** Contrast: */
41 | 'OVERLAY' | 'SOFT_LIGHT' | 'HARD_LIGHT'
42/** Inversion: */
43 | 'DIFFERENCE' | 'EXCLUSION'
44/** Component: */
45 | 'HUE' | 'SATURATION' | 'COLOR' | 'LUMINOSITY';
46export type EasingType = 'EASE_IN' /** Ease in with an animation curve similar to CSS ease-in */ | 'EASE_OUT' /** Ease out with an animation curve similar to CSS ease-out */ | 'EASE_IN_AND_OUT'; /** Ease in and then out with an animation curve similar to CSS ease-in-out */
47export type RoleType = 'viewer' | 'editor' | 'owner';
48export type NodeType = 'DOCUMENT' | 'CANVAS' | 'FRAME' | 'GROUP' | 'VECTOR' | 'BOOLEAN_OPERATION' | 'STAR' | 'LINE' | 'ELLIPSE' | 'REGULAR_POLYGON' | 'RECTANGLE' | 'TEXT' | 'SLICE' | 'COMPONENT' | 'COMPONENT_SET' | 'INSTANCE';
49export type Node = Document | Canvas | Frame | Group | Vector | BooleanOperation | Star | Line | Ellipse | RegularPolygon | Rectangle | Text | Slice | Component | ComponentSet | Instance;
50/** Node Properties */
51/** The root node */
52export interface Document extends Global {
53 readonly type: 'DOCUMENT';
54 /** An array of canvases attached to the document */
55 readonly children: ReadonlyArray<Node>;
56}
57/** Represents a single page */
58export interface Canvas extends Global {
59 readonly type: 'CANVAS';
60 /** An array of top level layers on the canvas */
61 readonly children: ReadonlyArray<Node>;
62 /** Background color of the canvas */
63 readonly backgroundColor: Color;
64 /** Node ID that corresponds to the start frame for prototypes */
65 readonly prototypeStartNodeID: string | null;
66 /** An array of export settings representing images to export from the canvas */
67 readonly exportSettings?: ReadonlyArray<ExportSetting>;
68}
69export interface FrameBase extends Global {
70 /** An array of nodes that are direct children of this node */
71 readonly children: ReadonlyArray<Node>;
72 /** Background of the node. This is deprecated, as backgrounds for frames are now in the fills field. */
73 readonly background: ReadonlyArray<Paint>;
74 /** Background color of the node. This is deprecated, as frames now support more than a solid color as a fills. Please use the fills field instead. */
75 readonly backgroundColor: Color;
76 /**
77 * An array of fill paints applied to the node
78 * @default []
79 */
80 readonly fills: ReadonlyArray<Paint>;
81 /**
82 * An array of stroke paints applied to the node
83 * @default []
84 */
85 readonly strokes: ReadonlyArray<Paint>;
86 /** The weight of strokes on the node */
87 readonly strokeWeight: number;
88 /**
89 * Position of stroke relative to vector outline, as a string enum
90 * "INSIDE": stroke drawn inside the shape boundary
91 * "OUTSIDE": stroke drawn outside the shape boundary
92 * "CENTER": stroke drawn centered along the shape boundary
93 */
94 readonly strokeAlign: 'INSIDE' | 'OUTSIDE' | 'CENTER';
95 /**
96 * Radius of each corner of the frame if a single radius is set for all
97 * corners
98 */
99 readonly cornerRadius?: number;
100 /**
101 * Array of length 4 of the radius of each corner of the frame, starting
102 * in the top left and proceeding clockwise
103 */
104 readonly rectangleCornerRadii?: readonly [number, number, number, number];
105 /**
106 * An array of export settings representing images to export from node
107 * @default []
108 */
109 readonly exportSettings?: ReadonlyArray<ExportSetting>;
110 /**
111 * How this node blends with nodes behind it in the scene
112 * (see blend mode section for more details)
113 */
114 readonly blendMode: BlendMode;
115 /**
116 * Keep height and width constrained to same ratio
117 * @default false
118 */
119 readonly preserveRatio?: boolean;
120 /** Horizontal and vertical layout constraints for node */
121 readonly constraints: LayoutConstraint;
122 /**
123 * How the layer is aligned inside an auto-layout frame. This property
124 * is only provided for direct children of auto-layout frames.
125 * MIN
126 * CENTER
127 * MAX
128 * STRETCH
129 * In horizontal auto-layout frames, "MIN" and "MAX" correspond to
130 * "TOP" and "BOTTOM". * In vertical auto-layout frames, "MIN" and
131 * "MAX" correspond to "LEFT" and "RIGHT".
132 */
133 readonly layoutAlign?: string;
134 /**
135 * Node ID of node to transition to in prototyping
136 * @default null
137 */
138 readonly transitionNodeID?: string | null;
139 /**
140 * The duration of the prototyping transition on this node (in milliseconds)
141 * @default null
142 */
143 readonly transitionDuration?: number | null;
144 /**
145 * The easing curve used in the prototyping transition on this node
146 * @default null
147 */
148 readonly transitionEasing?: EasingType | null;
149 /**
150 * Opacity of the node
151 * @default 1
152 */
153 readonly opacity?: number;
154 /** Bounding box of the node in absolute space coordinates */
155 readonly absoluteBoundingBox: Rect;
156 /**
157 * Width and height of element. This is different from the width and height
158 * of the bounding box in that the absolute bounding box represents the
159 * element after scaling and rotation. Only present if geometry=paths
160 * is passed
161 */
162 readonly size?: Vector2;
163 /**
164 * The top two rows of a matrix that represents the 2D transform of this
165 * node relative to its parent. The bottom row of the matrix is implicitly
166 * always (0, 0, 1). Use to transform coordinates in geometry.
167 * Only present if geometry=paths is passed
168 */
169 readonly relativeTransform?: Transform;
170 /** Does this node clip content outside of its bounds? */
171 readonly clipsContent: boolean;
172 /**
173 * Whether this layer uses auto-layout to position its children.
174 * @default NONE
175 */
176 readonly layoutMode?: 'NONE' | 'HORIZONTAL' | 'VERTICAL';
177 /**
178 * Whether the counter axis has a fixed length (determined by the user)
179 * or an automatic length (determined by the layout engine).
180 * This property is only applicable for auto-layout frames
181 * @default AUTO
182 */
183 readonly primaryAxisSizingMode?: 'FIXED' | 'AUTO';
184 /**
185 * When autolayout is enabled
186 */
187 readonly primaryAxisAlignItems?: 'MIN' | 'CENTER' | 'MAX' | 'SPACE_BETWEEN';
188 /**
189 * When autolayout is enabled
190 */
191 readonly counterAxisAlignItems?: 'MIN' | 'CENTER' | 'MAX';
192 /**
193 * When autolayout is enabled
194 */
195 readonly paddingLeft?: number;
196 /**
197 * The padding betweeen the left border of the frame and its children.
198 * This property is only applicable for auto-layout frames.
199 * @default 0
200 */
201 readonly paddingRight?: number;
202 /**
203 * The padding betweeen the right border of the frame and its children.
204 * This property is only applicable for auto-layout frames.
205 * @default 0
206 */
207 readonly paddingTop?: number;
208 /**
209 * The padding betweeen the top border of the frame and its children.
210 * This property is only applicable for auto-layout frames.
211 * @default 0
212 */
213 readonly paddingBottom?: number;
214 /**
215 * The padding betweeen the bottom border of the frame and its children.
216 * This property is only applicable for auto-layout frames.
217 * @default 0
218 */
219 readonly counterAxisSizingMode?: 'FIXED' | 'AUTO';
220 /**
221 * The horizontal padding between the borders of the frame and its
222 * children. This property is only applicable for auto-layout frames.
223 * @default 0
224 */
225 readonly horizontalPadding?: number;
226 /**
227 * The vertical padding between the borders of the frame and its
228 * children. This property is only applicable for auto-layout frames.
229 * @default 0
230 */
231 readonly verticalPadding?: number;
232 /**
233 * The distance between children of the frame. This property is only
234 * applicable for auto-layout frames.
235 * @default 0
236 */
237 readonly itemSpacing?: number;
238 /**
239 * An array of layout grids attached to this node (see layout grids section
240 * for more details). GROUP nodes do not have this attribute
241 * @default []
242 */
243 readonly layoutGrids?: ReadonlyArray<LayoutGrid>;
244 /**
245 * Defines the scrolling behavior of the frame, if there exist contents
246 * outside of the frame boundaries. The frame can either scroll
247 * vertically, horizontally, or in both directions to the extents of the
248 * content contained within it. This behavior can be observed in a
249 * prototype.
250 * HORIZONTAL_SCROLLING
251 * VERTICAL_SCROLLING
252 * HORIZONTAL_AND_VERTICAL_SCROLLING
253 * @default NONE
254 */
255 readonly overflowDirection?: string;
256 /**
257 * An array of effects attached to this node
258 * (see effects sectionfor more details)
259 * @default []
260 */
261 readonly effects: ReadonlyArray<Effect>;
262 /**
263 * Does this node mask sibling nodes in front of it?
264 * @default false
265 */
266 readonly isMask?: boolean;
267}
268/** A node of fixed size containing other nodes */
269export interface Frame extends FrameBase {
270 readonly type: 'FRAME';
271}
272/** A logical grouping of nodes */
273export interface Group extends FrameBase {
274 readonly type: 'GROUP';
275}
276export interface VectorBase extends Global {
277 /**
278 * An array of export settings representing images to export from node
279 * @default []
280 */
281 readonly exportSettings?: ReadonlyArray<ExportSetting>;
282 /**
283 * How this node blends with nodes behind it in the scene
284 * (see blend mode section for more details)
285 */
286 readonly blendMode: BlendMode;
287 /**
288 * Keep height and width constrained to same ratio
289 * @default false
290 */
291 readonly preserveRatio?: boolean;
292 /**
293 * Horizontal and vertical layout constraints for node
294 */
295 readonly constraints: LayoutConstraint;
296 /**
297 * Node ID of node to transition to in prototyping
298 * @default null
299 */
300 readonly transitionNodeID?: string | null;
301 /**
302 * The duration of the prototyping transition on this node (in milliseconds)
303 * @default null
304 */
305 readonly transitionDuration?: number | null;
306 /**
307 * The easing curve used in the prototyping transition on this node
308 * @default null
309 */
310 readonly transitionEasing?: EasingType | null;
311 /**
312 * Opacity of the node
313 * @default 1
314 */
315 readonly opacity?: number;
316 /** Bounding box of the node in absolute space coordinates */
317 readonly absoluteBoundingBox: Rect;
318 /**
319 * Width and height of element. This is different from the width and height
320 * of the bounding box in that the absolute bounding box represents the
321 * element after scaling and rotation. Only present if geometry=paths
322 * is passed
323 */
324 readonly size?: Vector2;
325 /**
326 * The top two rows of a matrix that represents the 2D transform of this
327 * node relative to its parent. The bottom row of the matrix is implicitly
328 * always (0, 0, 1). Use to transform coordinates in geometry.
329 * Only present if geometry=paths is passed
330 */
331 readonly relativeTransform?: Transform;
332 /**
333 * An array of effects attached to this node
334 * (see effects sectionfor more details)
335 * @default []
336 */
337 readonly effects: ReadonlyArray<Effect>;
338 /**
339 * Does this node mask sibling nodes in front of it?
340 * @default false
341 */
342 readonly isMask?: boolean;
343 /**
344 * An array of fill paints applied to the node
345 * @default []
346 */
347 readonly fills: ReadonlyArray<Paint>;
348 /**
349 * Only specified if parameter geometry=paths is used. An array of paths
350 * representing the object fill
351 */
352 readonly fillGeometry?: ReadonlyArray<Path>;
353 /**
354 * An array of stroke paints applied to the node
355 * @default []
356 */
357 readonly strokes: ReadonlyArray<Paint>;
358 /** The weight of strokes on the node */
359 readonly strokeWeight: number;
360 /**
361 * Only specified if parameter geometry=paths is used. An array of paths
362 * representing the object stroke
363 */
364 readonly strokeGeometry?: ReadonlyArray<Path>;
365 /**
366 * Where stroke is drawn relative to the vector outline as a string enum
367 * "INSIDE": draw stroke inside the shape boundary
368 * "OUTSIDE": draw stroke outside the shape boundary
369 * "CENTER": draw stroke centered along the shape boundary
370 */
371 readonly strokeAlign: 'INSIDE' | 'OUTSIDE' | 'CENTER';
372 /**
373 * Styles this node uses from the global `styles`
374 */
375 readonly styles?: StylesObject;
376}
377/** A vector network, consisting of vertices and edges */
378export interface Vector extends VectorBase {
379 readonly type: 'VECTOR';
380}
381/** A group that has a boolean operation applied to it */
382export interface BooleanOperation extends VectorBase {
383 readonly type: 'BOOLEAN_OPERATION';
384 /**
385 * A string enum with value of "UNION", "INTERSECT", "SUBTRACT", or "EXCLUDE"
386 * indicating the type of boolean operation applied
387 */
388 readonly booleanOperation: 'UNION' | 'INTERSECT' | 'SUBTRACT' | 'EXCLUDE';
389 /** An array of nodes that are being boolean operated on */
390 readonly children: ReadonlyArray<Node>;
391}
392/** A regular star shape */
393export interface Star extends VectorBase {
394 readonly type: 'STAR';
395}
396/** A straight line */
397export interface Line extends VectorBase {
398 readonly type: 'LINE';
399}
400/** An ellipse */
401export interface Ellipse extends VectorBase {
402 readonly type: 'ELLIPSE';
403}
404/** A regular n-sided polygon */
405export interface RegularPolygon extends VectorBase {
406 readonly type: 'REGULAR_POLYGON';
407}
408/** A rectangle */
409export interface Rectangle extends VectorBase {
410 readonly type: 'RECTANGLE';
411 /** Radius of each corner of the rectangle if a single radius is set for all corners */
412 readonly cornerRadius?: number;
413 /** Array of length 4 of the radius of each corner of the rectangle, starting in the top left and proceeding clockwise */
414 readonly rectangleCornerRadii?: readonly [number, number, number, number];
415}
416/** A text box */
417export interface Text extends VectorBase {
418 readonly type: TextType;
419 /** Text contained within text box */
420 readonly characters: string;
421 /**
422 * Style of text including font family and weight (see type style
423 * section for more information)
424 */
425 readonly style: TypeStyle;
426 /**
427 * Array with same number of elements as characeters in text 'box' | * each element is a reference to the styleOverrideTable defined
428 * below and maps to the corresponding character in the characters
429 * field. Elements with value 0 have the default type style
430 */
431 readonly characterStyleOverrides: ReadonlyArray<number>;
432 /** Map from ID to TypeStyle for looking up style overrides */
433 readonly styleOverrideTable: {
434 readonly [index: number]: TypeStyle;
435 };
436}
437/** A rectangular region of the canvas that can be exported */
438export interface Slice extends Global {
439 readonly type: 'SLICE';
440 /** An array of export settings representing images to export from this node */
441 readonly exportSettings: ReadonlyArray<ExportSetting>;
442 /** Bounding box of the node in absolute space coordinates */
443 readonly absoluteBoundingBox: Rect;
444 /**
445 * Width and height of element. This is different from the width and height
446 * of the bounding box in that the absolute bounding box represents the
447 * element after scaling and rotation. Only present if geometry=paths
448 * is passed
449 */
450 readonly size?: Vector2;
451 /**
452 * The top two rows of a matrix that represents the 2D transform of this
453 * node relative to its parent. The bottom row of the matrix is implicitly
454 * always (0, 0, 1). Use to transform coordinates in geometry.
455 * Only present if geometry=paths is passed
456 */
457 readonly relativeTransform?: Transform;
458}
459/** A node that can have instances created of it that share the same properties */
460export interface Component extends FrameBase {
461 readonly type: 'COMPONENT';
462}
463/** A node that can have multiple component variations */
464export interface ComponentSet extends FrameBase {
465 readonly type: 'COMPONENT_SET';
466}
467/**
468 * An instance of a component, changes to the component result in the same
469 * changes applied to the instance
470 */
471export interface Instance extends FrameBase {
472 readonly type: 'INSTANCE';
473 /**
474 * ID of component that this instance came from, refers to components
475 * table (see endpoints section below)
476 */
477 readonly componentId: string;
478}
479/** An RGBA color */
480export interface Color {
481 /** Red channel value, between 0 and 1 */
482 readonly r: number;
483 /** Green channel value, between 0 and 1 */
484 readonly g: number;
485 /** Blue channel value, between 0 and 1 */
486 readonly b: number;
487 /** Alpha channel value, between 0 and 1 */
488 readonly a: number;
489}
490/** Format and size to export an asset at */
491export interface ExportSetting {
492 /** File suffix to append to all filenames */
493 readonly suffix: string;
494 /** Image type, string enum */
495 readonly format: 'JPG' | 'PNG' | 'SVG' | 'PDF';
496 /** Constraint that determines sizing of exported asset */
497 readonly constraint: Constraint;
498}
499/** Sizing constraint for exports */
500export interface Constraint {
501 /**
502 * Type of constraint to apply; string enum with potential values below
503 * "SCALE": Scale by value
504 * "WIDTH": Scale proportionally and set width to value
505 * "HEIGHT": Scale proportionally and set height to value
506 */
507 readonly type: 'SCALE' | 'WIDTH' | 'HEIGHT';
508 /** See type property for effect of this field */
509 readonly value: number;
510}
511/** A rectangle that expresses a bounding box in absolute coordinates */
512export interface Rect {
513 /** X coordinate of top left corner of the rectangle */
514 readonly x: number;
515 /** Y coordinate of top left corner of the rectangle */
516 readonly y: number;
517 /** Width of the rectangle */
518 readonly width: number;
519 /** Height of the rectangle */
520 readonly height: number;
521}
522/** Layout constraint relative to containing Frame */
523export interface LayoutConstraint {
524 /**
525 * Vertical constraint as an enum
526 * "TOP": Node is laid out relative to top of the containing frame
527 * "BOTTOM": Node is laid out relative to bottom of the containing frame
528 * "CENTER": Node is vertically centered relative to containing frame
529 * "TOP_BOTTOM": Both top and bottom of node are constrained relative to containing frame (node stretches with frame)
530 * "SCALE": Node scales vertically with containing frame
531 */
532 readonly vertical: 'TOP' | 'BOTTOM' | 'CENTER' | 'TOP_BOTTOM' | 'SCALE';
533 /**
534 * Horizontal constraint as an enum
535 * "LEFT": Node is laid out relative to left of the containing frame
536 * "RIGHT": Node is laid out relative to right of the containing frame
537 * "CENTER": Node is horizontally centered relative to containing frame
538 * "LEFT_RIGHT": Both left and right of node are constrained relative to containing frame (node stretches with frame)
539 * "SCALE": Node scales horizontally with containing frame
540 */
541 readonly horizontal: 'LEFT' | 'RIGHT' | 'CENTER' | 'LEFT_RIGHT' | 'SCALE';
542}
543/** Guides to align and place objects within a frame */
544export interface LayoutGrid {
545 /**
546 * Orientation of the grid as a string enum
547 * "COLUMNS": Vertical grid
548 * "ROWS": Horizontal grid
549 * "GRID": Square grid
550 */
551 readonly pattern: 'COLUMNS' | 'ROWS' | 'GRID';
552 /** Width of column grid or height of row grid or square grid spacing */
553 readonly sectionSize: number;
554 /** Is the grid currently visible? */
555 readonly visible: boolean;
556 /** Color of the grid */
557 readonly color: Color;
558 /**
559 * Positioning of grid as a string enum
560 * "MIN": Grid starts at the left or top of the frame
561 * "MAX": Grid starts at the right or bottom of the frame
562 * "CENTER": Grid is center aligned
563 */
564 readonly alignment: 'MIN' | 'MAX' | 'CENTER';
565 /** Spacing in between columns and rows */
566 readonly gutterSize: number;
567 /** Spacing before the first column or row */
568 readonly offset: number;
569 /** Number of columns or rows */
570 readonly count: number;
571}
572/** A visual effect such as a shadow or blur */
573export interface Effect {
574 /** Type of effect as a string enum */
575 readonly type: 'INNER_SHADOW' | 'DROP_SHADOW' | 'LAYER_BLUR' | 'BACKGROUND_BLUR';
576 /** Is the effect active? */
577 readonly visible: boolean;
578 /** Radius of the blur effect (applies to shadows as well) */
579 readonly radius: number;
580 readonly color?: Color;
581 readonly blendMode?: BlendMode;
582 readonly offset?: Vector2;
583}
584/** A solid color, gradient, or image texture that can be applied as fills or strokes */
585export interface Paint {
586 /** Type of paint as a string enum */
587 readonly type: PaintType;
588 /**
589 * Is the paint enabled?
590 * @default true
591 */
592 readonly visible?: boolean;
593 /**
594 * Overall opacity of paint (colors within the paint can also have opacity
595 * values which would blend with this)
596 * @default 1
597 */
598 readonly opacity?: number;
599 /** Solid color of the paint */
600 readonly color?: Color;
601 /**
602 * How this node blends with nodes behind it in the scene
603 * (see blend mode section for more details)
604 */
605 readonly blendMode: BlendMode;
606 /**
607 * This field contains three vectors, each of which are a position in
608 * normalized object space (normalized object space is if the top left
609 * corner of the bounding box of the object is (0, 0) and the bottom
610 * right is (1,1)). The first position corresponds to the start of the
611 * gradient (value 0 for the purposes of calculating gradient stops),
612 * the second position is the end of the gradient (value 1), and the
613 * third handle position determines the width of the gradient (only
614 * relevant for non-linear gradients).
615 *
616 */
617 readonly gradientHandlePositions?: ReadonlyArray<Vector2>;
618 /**
619 * Positions of key points along the gradient axis with the colors
620 * anchored there. Colors along the gradient are interpolated smoothly
621 * between neighboring gradient stops.
622 */
623 readonly gradientStops?: ReadonlyArray<ColorStop>;
624 /** Image scaling mode */
625 readonly scaleMode?: ScaleMode;
626 /**
627 * Affine transform applied to the image, only present if scaleMode is `STRETCH`
628 */
629 readonly imageTransform?: Transform;
630 /**
631 * Amount image is scaled by in tiling, only present if scaleMode is `TILE`
632 */
633 readonly scalingFactor?: number;
634 /**
635 * A reference to an image embedded in the file. To download the image using this reference,
636 * use the GET file images endpoint to retrieve the mapping from image references to image URLs
637 */
638 readonly imageRef?: string;
639 /**
640 * A reference to the GIF embedded in this node, if the image is a GIF.
641 * To download the image using this reference,
642 * use the GET file images endpoint to retrieve the mapping from image references to image URLs
643 */
644 readonly gifRef?: string;
645}
646export interface Path {
647 /** A sequence of path commands in SVG notation */
648 readonly path: string;
649 /** Winding rule for the path */
650 readonly windingRule: 'EVENODD' | 'NONZERO';
651}
652export type Transform = ReadonlyArray<ReadonlyArray<number>>;
653/** A 2d vector */
654export interface Vector2 {
655 /** X coordinate of the vector */
656 readonly x: number;
657 /** Y coordinate of the vector */
658 readonly y: number;
659}
660/** A position color pair representing a gradient stop */
661export interface ColorStop {
662 /** Value between 0 and 1 representing position along gradient axis */
663 readonly position: number;
664 /** Color attached to corresponding position */
665 readonly color: Color;
666}
667/** Metadata for character formatting */
668export interface TypeStyle {
669 /** Font family of text (standard name) */
670 readonly fontFamily: string;
671 /** PostScript font name */
672 readonly fontPostScriptName: string;
673 /** Space between paragraphs in px, 0 if not present */
674 readonly paragraphSpacing?: number;
675 /** Paragraph indentation in px, 0 if not present */
676 readonly paragraphIndent?: number;
677 /** Is text italicized? */
678 readonly italic?: boolean;
679 /** Numeric font weight */
680 readonly fontWeight: 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
681 /** Font size in px */
682 readonly fontSize: number;
683 /** Horizontal text alignment as string enum */
684 readonly textAlignHorizontal: 'LEFT' | 'RIGHT' | 'CENTER' | 'JUSTIFIED';
685 /** Vertical text alignment as string enum */
686 readonly textAlignVertical: 'TOP' | 'CENTER' | 'BOTTOM';
687 /** Space between characters in px */
688 readonly letterSpacing: number;
689 /** Paints applied to characters */
690 readonly fills?: ReadonlyArray<Paint>;
691 /** Line height in px */
692 readonly lineHeightPx: number;
693 /** Line height as a percentage of normal line height */
694 readonly lineHeightPercent: number;
695 /** The unit of the line height value specified by the user. */
696 readonly lineHeightUnit: 'PIXELS' | 'FONT_SIZE_%' | 'INTRINSIC_%';
697 /** Text casing applied to the node, default is the original casing */
698 readonly textCase?: 'UPPER' | 'LOWER' | 'TITLE';
699 /** Text decoration applied to the node, default is none */
700 readonly textDecoration?: 'STRIKETHROUGH' | 'UNDERLINE';
701 /** Line height as a percentage of the font size. Only returned when lineHeightPercent is not 100. */
702 readonly lineHeightPercentFontSize?: number;
703}
704/**
705 * A description of a master component. Helps you identify which component
706 * instances are attached to
707 */
708export interface ComponentMetadata {
709 /** The unique identifier of the element */
710 readonly key: string;
711 /** The name of the element */
712 readonly name: string;
713 /** The description of the element as entered in the editor */
714 readonly description: string;
715}
716export interface FrameInfo {
717 /** Id of the frame node within the figma file */
718 readonly node_id: string;
719 /** The name of the frame */
720 readonly name: string;
721 /** Background color of the frame */
722 readonly background_color: string;
723 /** Id of the frame's residing page */
724 readonly page_id: string;
725 /** Name of the frame's residing page */
726 readonly page_name: string;
727}
728interface SharedElement extends ComponentMetadata {
729 /** The unique identifier of the figma file which contains the element */
730 readonly file_key: string;
731 /** Id of the component node within the figma file */
732 readonly node_id: string;
733 /** URL link to the element's thumbnail image */
734 readonly thumbnail_url: string;
735 /** The UTC ISO 8601 time at which the element was created */
736 readonly created_at: string;
737 /** The UTC ISO 8601 time at which the element was updated */
738 readonly updated_at: string;
739 /** The user who last updated the element */
740 readonly user: User;
741}
742/**
743 * An arrangement of published UI elements that can be instantiated across figma files
744 */
745export interface FullComponentMetadata extends SharedElement {
746 /** Data on component's containing frame, if component resides within a frame */
747 readonly containing_frame: FrameInfo;
748 /** Data on component's containing page, if component resides in a multi-page file */
749 readonly containing_page: any;
750}
751export interface FullStyleMetadata extends SharedElement {
752 /** The type of style */
753 readonly style_type: StyleType;
754 /** A user specified order number by which the style can be sorted */
755 readonly sort_position: string;
756}
757/**
758 * A description of styles used in a file.
759 */
760export interface Style {
761 /** The name of the stlye */
762 readonly name: string;
763 /** A description of the style */
764 readonly description: string;
765 /** The unique identifier of the style */
766 readonly key: string;
767 /** The type of style */
768 readonly styleType: StyleType;
769}
770/** A comment or reply left by a user */
771export interface Comment {
772 /** Unique identifier for comment */
773 readonly id: string;
774 /** The file in which the comment lives */
775 readonly file_key: string;
776 /** If present, the id of the comment to which this is the reply */
777 readonly parent_id: string;
778 /** The user who left the comment */
779 readonly user: User;
780 /** The time at which the comment was left */
781 readonly created_at: Date;
782 /** If set, when the comment was resolved */
783 readonly resolved_at: Date | null;
784 /**
785 * (MISSING IN DOCS)
786 * The content of the comment
787 */
788 readonly message: string;
789 readonly client_meta: Vector2 | FrameOffset;
790 /**
791 * Only set for top level comments. The number displayed with the
792 * comment in the UI
793 */
794 readonly order_id: number;
795}
796/** A description of a user */
797export interface User {
798 /** Unique stable id of the user */
799 readonly id: string;
800 /** Name of the user */
801 readonly handle: string;
802 /** URL link to the user's profile image */
803 readonly img_url: string;
804}
805/** A relative offset within a frame */
806export interface FrameOffset {
807 /** Unique id specifying the frame */
808 readonly node_id: string;
809 /** 2d vector offset within the frame */
810 readonly node_offset: Vector2;
811}
812export interface ProjectSummary {
813 readonly id: string;
814 readonly name: string;
815}
816export interface FileResponse {
817 readonly components: {
818 readonly [key: string]: ComponentMetadata;
819 };
820 readonly styles: {
821 readonly [key: string]: Style;
822 };
823 readonly document: Document;
824 readonly lastModified: string;
825 readonly name: string;
826 readonly role: RoleType;
827 readonly schemaVersion: number;
828 readonly thumbnailUrl: string;
829 readonly version: string;
830}
831export interface FileNodesResponse {
832 readonly nodes: {
833 readonly [key: string]: null | {
834 readonly document: Node;
835 readonly components: {
836 readonly [key: string]: ComponentMetadata;
837 };
838 readonly styles: {
839 readonly [key: string]: Style;
840 };
841 readonly schemaVersion: number;
842 };
843 };
844 readonly lastModified: string;
845 readonly name: string;
846 readonly role: RoleType;
847 readonly thumbnailUrl: string;
848 readonly version: string;
849}
850export interface VersionMetadata {
851 /** Unique identifier for version */
852 readonly id: string;
853 /** The UTC ISO 8601 time at which the version was created */
854 readonly created_at: string;
855 /** The label given to the version in the editor */
856 readonly label: string;
857 /** The description of the version as entered in the editor */
858 readonly description: string;
859 /** The user that created the version */
860 readonly user: User;
861}
862export interface FileVersionsResponse {
863 readonly versions: ReadonlyArray<VersionMetadata>;
864}
865export interface FileImageResponse {
866 readonly err: string | null;
867 readonly images: {
868 readonly [key: string]: string;
869 };
870}
871export interface FileImageFillsResponse {
872 readonly error: boolean;
873 readonly status: number;
874 readonly meta: {
875 readonly images: {
876 readonly [key: string]: string;
877 };
878 };
879}
880export interface CommentsResponse {
881 readonly comments: ReadonlyArray<Comment>;
882}
883export interface ComponentResponse {
884 readonly error: boolean;
885 readonly status: number;
886 readonly meta: FullComponentMetadata;
887}
888export interface ComponentSetResponse {
889 readonly error: boolean;
890 readonly status: number;
891 readonly meta: FullComponentMetadata;
892}
893export interface StyleResponse {
894 readonly error: boolean;
895 readonly status: number;
896 readonly meta: FullStyleMetadata;
897}
898export interface FileSummary {
899 readonly key: string;
900 readonly name: string;
901 readonly thumbnail_url: string;
902 readonly last_modified: string;
903}
904export interface TeamProjectsResponse {
905 readonly name: string;
906 readonly projects: ReadonlyArray<ProjectSummary>;
907}
908export interface ProjectFilesResponse {
909 readonly name: string;
910 readonly files: ReadonlyArray<FileSummary>;
911}
912interface PaginationMeta {
913 readonly before: number;
914 readonly after: number;
915}
916export interface TeamComponentsResponse {
917 readonly error: boolean;
918 readonly status: number;
919 readonly meta: {
920 readonly components: ReadonlyArray<FullComponentMetadata>;
921 readonly cursor: PaginationMeta;
922 };
923}
924export interface FileComponentsResponse {
925 readonly error: boolean;
926 readonly status: number;
927 readonly meta: {
928 readonly components: ReadonlyArray<FullComponentMetadata>;
929 };
930}
931export interface TeamComponentSetsResponse {
932 readonly error: boolean;
933 readonly status: number;
934 readonly meta: {
935 readonly component_sets: ReadonlyArray<FullComponentMetadata>;
936 readonly cursor: PaginationMeta;
937 };
938}
939export interface FileComponentSetsResponse {
940 readonly error: boolean;
941 readonly status: number;
942 readonly meta: {
943 readonly component_sets: ReadonlyArray<FullComponentMetadata>;
944 };
945}
946export interface TeamStylesResponse {
947 readonly error: boolean;
948 readonly status: number;
949 readonly meta: {
950 readonly styles: ReadonlyArray<FullStyleMetadata>;
951 readonly cursor: PaginationMeta;
952 };
953}
954export interface FileStylesResponse {
955 readonly error: boolean;
956 readonly status: number;
957 readonly meta: {
958 readonly styles: ReadonlyArray<FullStyleMetadata>;
959 };
960}
961export {};