Skip to content

Theemo / @theemo/figma / FigmaParserConfig

Interface: FigmaParserConfig

Defined in: packages/figma/src/config.ts:63

Configuration for Figma Parser

Properties

considerMode()?

ts
optional considerMode: (mode) => boolean;

Defined in: packages/figma/src/config.ts:155

Should this mode considered to be used for tokens?

Parameters

ParameterTypeDescription
modestringthe name of the mode

Returns

boolean

true, when the mode is used for tokens

See

Documentation


formats?

ts
optional formats: ColorConfig;

Defined in: packages/figma/src/config.ts:206

The formats in which tokens are written to disk


getConstraints()?

ts
optional getConstraints: (mode, variable) => 
  | undefined
| Partial<FeatureConstraints & ScopeConstraint>;

Defined in: packages/figma/src/config.ts:166

Returns the constraints for a considered mode

Parameters

ParameterTypeDescription
modestringthe name of the mode
variableFigmaVariableFigma Variable

Returns

| undefined | Partial<FeatureConstraints & ScopeConstraint>

the constraints for the given mode

See


getNameFromStyle()?

ts
optional getNameFromStyle: (style) => string;

Defined in: packages/figma/src/config.ts:87

To retrieve the name for a token from a Style

Parameters

ParameterTypeDescription
styleStyleFigma Style

Returns

string

the name for the given style

See


getNameFromText()?

ts
optional getNameFromText: (node) => string;

Defined in: packages/figma/src/config.ts:112

To retrieve the name for a token from a Node

Parameters

ParameterTypeDescription
nodeNode<"TEXT">Figma Text Node

Returns

string

the token name for the text node

See


getNameFromVariable()?

ts
optional getNameFromVariable: (variable) => string;

Defined in: packages/figma/src/config.ts:146

Retrieve the token name for the given variable

Parameters

ParameterTypeDescription
variableFigmaVariableFigma Variable

Returns

string

the token name for the variable

See


getPropertiesForToken()?

ts
optional getPropertiesForToken: (token, document) => Record<string, unknown>;

Defined in: packages/figma/src/config.ts:201

Add properties relevant for you to the token.

Parameters

ParameterTypeDescription
tokenFigmaTokenFigma Token
documentGetFileResultThe Figma File from which this token was sourced

Returns

Record<string, unknown>

an object with properties

See

Documentation


getTypeFromToken()?

ts
optional getTypeFromToken: (token) => keyof TokenTypeRegistry;

Defined in: packages/figma/src/config.ts:191

When the type of a token was detected incorrectly or is missing for some other reasons, here is a chance to provide it

Parameters

ParameterTypeDescription
tokenFigmaTokenFigma Token

Returns

keyof TokenTypeRegistry

the type of a token

See

Documentation


getValueFromText()?

ts
optional getValueFromText: (node) => unknown;

Defined in: packages/figma/src/config.ts:122

To retrieve the value for a token from a Node

Parameters

ParameterTypeDescription
nodeNode<"TEXT">Figma Text Node

Returns

unknown

the token value of that text node

See


isTokenByStyle()?

ts
optional isTokenByStyle: (style) => boolean;

Defined in: packages/figma/src/config.ts:77

This is to verify that a given Style node found in figmas node tree is considered to be a token or not

Parameters

ParameterTypeDescription
styleStyleFigma Style

Returns

boolean

true, when this style should be considered a token

See


isTokenByText()?

ts
optional isTokenByText: (node) => boolean;

Defined in: packages/figma/src/config.ts:102

This is to verify that a given Nodefound in figmas node tree is considered to be a token or not, depending on the name of the node

Parameters

ParameterTypeDescription
nodeNode<"TEXT">Figma Text Node

Returns

boolean

true, when this text node should be considered a token

See


isTokenByVariable()?

ts
optional isTokenByVariable: (variable) => boolean;

Defined in: packages/figma/src/config.ts:136

Should this variable be considered a token, or not?

Parameters

ParameterTypeDescription
variableFigmaVariableFigma Variable

Returns

boolean

true, when this variable is considered to be atoken

See


skipTypeForReferences?

ts
optional skipTypeForReferences: boolean;

Defined in: packages/figma/src/config.ts:177

Skip type for tokens that are references.

According to the spec, $type can be optional when certain criteria are met. One of them being references. If you wish, you can skip types here.

See

Spec

Default

false