Skip to content

pantoken-root / packages/core/src / toStyleDictionary

Funció: toStyleDictionary() ​

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

Beta

Formata la IR resuelta com a un diccionari de tokens de Style Dictionary pla indexat per nom de token (amb el -- principal despullat). Alimenta-ho a tools/sd-config per als emissors natives.

Paràmetres ​

tokens ​

només de lectura Token[]

La IR.

mode? ​

Mode = "light"

Quin mode de color resoldre (per defecte "light").

Retorna ​

Record<string, SdLeaf>

Un objecte diccionari de Style Dictionary.

Exemple ​

Formata la IR per al llinatge natiu

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.