Skip to content

pantoken-root / packages/core/src / toStyleDictionary

Feidhm: toStyleDictionary() ​

toStyleDictionary(tokens, mode?): Record<string, SdLeaf>

Béite

Múnlaigh an IR réitithe mar fhoclóir shimplí de tokenanna Style Dictionary eochaithe de réir ainm an token (leis an leading -- bainte). Cuir seo isteach i tools/sd-config do na emitters dúchais.

Paraiméadair ​

tokens ​

inléite Token[]

An IR.

mode? ​

Mode = "light"

Cén mód datha le réiteach (réamhshocraithe "light").

Tuairisceáin ​

Record<string, SdLeaf>

Réad foclóra Style Dictionary.

Sampla ​

Múnlaigh an IR don líneachas dúchais

ts
import { buildTokens } from "@pantoken/core/build";
import { toStyleDictionary } from "@pantoken/core";

const dictionary = toStyleDictionary(buildTokens(), "light");
// → { "instui-color-background-base": { value: "#…", type: "color" }, … }
// keys drop the leading "--"; feed this to tools/sd-config.