zp-figma-converter
Version:
Convert Figma designs to various code formats
209 lines • 4.79 kB
TypeScript
/**
* Interface for figma file node type
*/
export interface FigmaFileNode {
id: string;
name: string;
type: string;
[key: string]: any;
}
export interface FigmaFile {
name: string;
lastModified: string;
thumbnailUrl: string;
document: FigmaDocument;
components: {
[key: string]: FigmaComponent;
};
componentSets: {
[key: string]: FigmaComponentSet;
};
schemaVersion: number;
styles: {
[key: string]: FigmaStyle;
};
version: string;
}
export interface FigmaDocument {
id: string;
name: string;
type: string;
children?: FigmaNode[];
}
export interface FigmaNode {
id: string;
name: string;
type: FigmaNodeType;
visible?: boolean;
children?: FigmaNode[];
absoluteBoundingBox?: FigmaRectangle;
absoluteRenderBounds?: FigmaRectangle;
relativeTransform?: number[][];
size?: FigmaVector;
fills?: FigmaFill[];
strokes?: FigmaStroke[];
strokeWeight?: number;
cornerRadius?: number;
rotation?: number;
rectangleCornerRadii?: number[];
opacity?: number;
effects?: FigmaEffect[];
characters?: string;
style?: FigmaTextStyle;
layoutMode?: string;
paddingLeft?: number;
paddingRight?: number;
paddingTop?: number;
paddingBottom?: number;
itemSpacing?: number;
counterAxisSpacing?: number;
layoutAlign?: string;
layoutGrow?: number;
primaryAxisSizingMode?: string;
counterAxisSizingMode?: string;
blendMode?: string;
constraints?: FigmaConstraints;
layoutGrids?: FigmaLayoutGrid[];
styles?: {
[key: string]: string;
};
componentId?: string;
componentProperties?: {
[key: string]: FigmaComponentProperty;
};
reactions?: FigmaReaction[];
primaryAxisAlignItems?: string;
counterAxisAlignItems?: string;
parent?: FigmaNode;
}
export declare enum FigmaNodeType {
DOCUMENT = "DOCUMENT",
CANVAS = "CANVAS",
FRAME = "FRAME",
GROUP = "GROUP",
VECTOR = "VECTOR",
BOOLEAN = "BOOLEAN",
STAR = "STAR",
LINE = "LINE",
ELLIPSE = "ELLIPSE",
REGULAR_POLYGON = "REGULAR_POLYGON",
RECTANGLE = "RECTANGLE",
TEXT = "TEXT",
SLICE = "SLICE",
COMPONENT = "COMPONENT",
COMPONENT_SET = "COMPONENT_SET",
INSTANCE = "INSTANCE"
}
export interface FigmaRectangle {
x: number;
y: number;
width: number;
height: number;
}
export interface FigmaVector {
x: number;
y: number;
}
export interface FigmaColor {
r: number;
g: number;
b: number;
a: number;
}
export interface FigmaFill {
type: string;
visible?: boolean;
opacity?: number;
color?: FigmaColor;
blendMode?: string;
gradientHandlePositions?: FigmaVector[];
gradientStops?: FigmaColorStop[];
scaleMode?: string;
imageRef?: string;
}
export interface FigmaStroke {
type: string;
color?: FigmaColor;
visible?: boolean;
opacity?: number;
blendMode?: string;
}
export interface FigmaEffect {
type: string;
visible?: boolean;
radius?: number;
color?: FigmaColor;
offset?: FigmaVector;
blendMode?: string;
}
export interface FigmaTextStyle {
fontFamily: string;
fontPostScriptName?: string;
fontWeight: number;
fontSize: number;
textCase?: string;
textDecoration?: string;
textAlignHorizontal?: string;
textAlignVertical?: string;
letterSpacing: number;
lineHeightPx: number;
lineHeightPercent: number;
lineHeightUnit?: string;
}
export interface FigmaColorStop {
position: number;
color: FigmaColor;
}
export interface FigmaLayoutGrid {
pattern: string;
sectionSize: number;
visible: boolean;
color: FigmaColor;
alignment: string;
gutterSize: number;
offset: number;
count: number;
}
export interface FigmaConstraints {
vertical: string;
horizontal: string;
}
export interface FigmaComponent {
key: string;
name: string;
description: string;
}
export interface FigmaComponentSet {
key: string;
name: string;
description: string;
}
export interface FigmaStyle {
key: string;
name: string;
description: string;
styleType: string;
}
export interface FigmaComponentProperty {
type: string;
value: any;
defaultValue?: any;
}
export interface FigmaReaction {
action: FigmaReactionAction;
trigger: FigmaReactionTrigger;
}
export interface FigmaReactionAction {
type: string;
url?: string;
destination?: string;
navigation?: string;
preserveScrollPosition?: boolean;
overlayRelativePosition?: FigmaVector;
nodeID?: string;
}
export interface FigmaReactionTrigger {
type: string;
delay?: number;
}
//# sourceMappingURL=types.d.ts.map