@figma/code-connect
Version:
A tool for connecting your design system components in code with your design system in Figma
329 lines • 10.1 kB
TypeScript
import { z } from 'zod';
import { ComponentTypeSignature } from '../react/parser';
import { Intrinsic } from './intrinsics';
export type ParseRequestPayload = {
mode: 'PARSE';
paths: string[];
config: Record<string, any>;
verbose?: boolean;
};
export declare const ParserExecutableMessages: z.ZodArray<z.ZodObject<{
level: z.ZodUnion<[z.ZodLiteral<"DEBUG">, z.ZodLiteral<"INFO">, z.ZodLiteral<"WARN">, z.ZodLiteral<"ERROR">]>;
type: z.ZodOptional<z.ZodString>;
message: z.ZodString;
sourceLocation: z.ZodOptional<z.ZodObject<{
file: z.ZodString;
line: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
file: string;
line?: number | undefined;
}, {
file: string;
line?: number | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
message: string;
level: "DEBUG" | "INFO" | "WARN" | "ERROR";
type?: string | undefined;
sourceLocation?: {
file: string;
line?: number | undefined;
} | undefined;
}, {
message: string;
level: "DEBUG" | "INFO" | "WARN" | "ERROR";
type?: string | undefined;
sourceLocation?: {
file: string;
line?: number | undefined;
} | undefined;
}>, "many">;
export declare const ParseResponsePayload: z.ZodObject<{
docs: z.ZodArray<z.ZodObject<{
figmaNode: z.ZodString;
component: z.ZodOptional<z.ZodString>;
variant: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
source: z.ZodOptional<z.ZodString>;
sourceLocation: z.ZodOptional<z.ZodObject<{
line: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
line: number;
}, {
line: number;
}>>;
template: z.ZodString;
templateData: z.ZodObject<{
props: z.ZodRecord<z.ZodString, any>;
imports: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
nestable: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
props: Record<string, any>;
imports?: string[] | undefined;
nestable?: boolean | undefined;
}, {
props: Record<string, any>;
imports?: string[] | undefined;
nestable?: boolean | undefined;
}>;
language: z.ZodString;
label: z.ZodString;
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
name: z.ZodString;
url: z.ZodString;
}, "strip", z.ZodTypeAny, {
name: string;
url: string;
}, {
name: string;
url: string;
}>, "many">>;
}, "strip", z.ZodTypeAny, {
label: string;
template: string;
figmaNode: string;
templateData: {
props: Record<string, any>;
imports?: string[] | undefined;
nestable?: boolean | undefined;
};
language: string;
source?: string | undefined;
sourceLocation?: {
line: number;
} | undefined;
component?: string | undefined;
variant?: Record<string, any> | undefined;
links?: {
name: string;
url: string;
}[] | undefined;
}, {
label: string;
template: string;
figmaNode: string;
templateData: {
props: Record<string, any>;
imports?: string[] | undefined;
nestable?: boolean | undefined;
};
language: string;
source?: string | undefined;
sourceLocation?: {
line: number;
} | undefined;
component?: string | undefined;
variant?: Record<string, any> | undefined;
links?: {
name: string;
url: string;
}[] | undefined;
}>, "many">;
messages: z.ZodArray<z.ZodObject<{
level: z.ZodUnion<[z.ZodLiteral<"DEBUG">, z.ZodLiteral<"INFO">, z.ZodLiteral<"WARN">, z.ZodLiteral<"ERROR">]>;
type: z.ZodOptional<z.ZodString>;
message: z.ZodString;
sourceLocation: z.ZodOptional<z.ZodObject<{
file: z.ZodString;
line: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
file: string;
line?: number | undefined;
}, {
file: string;
line?: number | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
message: string;
level: "DEBUG" | "INFO" | "WARN" | "ERROR";
type?: string | undefined;
sourceLocation?: {
file: string;
line?: number | undefined;
} | undefined;
}, {
message: string;
level: "DEBUG" | "INFO" | "WARN" | "ERROR";
type?: string | undefined;
sourceLocation?: {
file: string;
line?: number | undefined;
} | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
docs: {
label: string;
template: string;
figmaNode: string;
templateData: {
props: Record<string, any>;
imports?: string[] | undefined;
nestable?: boolean | undefined;
};
language: string;
source?: string | undefined;
sourceLocation?: {
line: number;
} | undefined;
component?: string | undefined;
variant?: Record<string, any> | undefined;
links?: {
name: string;
url: string;
}[] | undefined;
}[];
messages: {
message: string;
level: "DEBUG" | "INFO" | "WARN" | "ERROR";
type?: string | undefined;
sourceLocation?: {
file: string;
line?: number | undefined;
} | undefined;
}[];
}, {
docs: {
label: string;
template: string;
figmaNode: string;
templateData: {
props: Record<string, any>;
imports?: string[] | undefined;
nestable?: boolean | undefined;
};
language: string;
source?: string | undefined;
sourceLocation?: {
line: number;
} | undefined;
component?: string | undefined;
variant?: Record<string, any> | undefined;
links?: {
name: string;
url: string;
}[] | undefined;
}[];
messages: {
message: string;
level: "DEBUG" | "INFO" | "WARN" | "ERROR";
type?: string | undefined;
sourceLocation?: {
file: string;
line?: number | undefined;
} | undefined;
}[];
}>;
export type PropMapping = Record<string, Intrinsic>;
export type ComponentPropertyDefinition = {
type: 'BOOLEAN' | 'INSTANCE_SWAP' | 'TEXT' | 'VARIANT';
defaultValue: boolean | string;
variantOptions?: string[];
};
export interface FigmaConnectionComponent {
figmaNodeUrl: string;
id: string;
name: string;
type: 'COMPONENT' | 'COMPONENT_SET';
componentPropertyDefinitions: Record<string, ComponentPropertyDefinition>;
}
export interface FigmaConnection {
sourceExport?: string;
propMapping?: PropMapping;
reactTypeSignature?: ComponentTypeSignature;
component: FigmaConnectionComponent;
}
export type CreateRequestPayload = {
mode: 'CREATE';
destinationDir: string;
destinationFile?: string;
sourceFilepath?: string;
sourceExport?: string;
propMapping?: PropMapping;
reactTypeSignature?: ComponentTypeSignature;
component: {
figmaNodeUrl: string;
id: string;
name: string;
normalizedName: string;
type: 'COMPONENT' | 'COMPONENT_SET';
componentPropertyDefinitions: Record<string, ComponentPropertyDefinition>;
};
config: Record<string, any>;
verbose?: boolean;
};
export type CreateRequestPayloadMulti = {
mode: 'CREATE';
destinationDir: string;
destinationFile?: string;
sourceFilepath?: string;
normalizedName: string;
figmaConnections: FigmaConnection[];
config: Record<string, any>;
};
export declare const CreateResponsePayload: z.ZodObject<{
createdFiles: z.ZodArray<z.ZodObject<{
filePath: z.ZodString;
}, "strip", z.ZodTypeAny, {
filePath: string;
}, {
filePath: string;
}>, "many">;
messages: z.ZodArray<z.ZodObject<{
level: z.ZodUnion<[z.ZodLiteral<"DEBUG">, z.ZodLiteral<"INFO">, z.ZodLiteral<"WARN">, z.ZodLiteral<"ERROR">]>;
type: z.ZodOptional<z.ZodString>;
message: z.ZodString;
sourceLocation: z.ZodOptional<z.ZodObject<{
file: z.ZodString;
line: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
file: string;
line?: number | undefined;
}, {
file: string;
line?: number | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
message: string;
level: "DEBUG" | "INFO" | "WARN" | "ERROR";
type?: string | undefined;
sourceLocation?: {
file: string;
line?: number | undefined;
} | undefined;
}, {
message: string;
level: "DEBUG" | "INFO" | "WARN" | "ERROR";
type?: string | undefined;
sourceLocation?: {
file: string;
line?: number | undefined;
} | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
messages: {
message: string;
level: "DEBUG" | "INFO" | "WARN" | "ERROR";
type?: string | undefined;
sourceLocation?: {
file: string;
line?: number | undefined;
} | undefined;
}[];
createdFiles: {
filePath: string;
}[];
}, {
messages: {
message: string;
level: "DEBUG" | "INFO" | "WARN" | "ERROR";
type?: string | undefined;
sourceLocation?: {
file: string;
line?: number | undefined;
} | undefined;
}[];
createdFiles: {
filePath: string;
}[];
}>;
export type ParserRequestPayload = ParseRequestPayload | CreateRequestPayload;
//# sourceMappingURL=parser_executable_types.d.ts.map