Skip to content

pantoken / packages/core/src / toStyleDictionary

Funktion: toStyleDictionary()

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

Beta

Formatera den upplösta IR:n som en platt Style Dictionary-tokenordbok med token-namn som nycklar (med den ledande -- borttagen). Mata detta till tools/sd-config för de inbyggda emitterarna.

Parametrar

tokens

skrivskyddad Token[]

IR:n.

mode?

Mode = "light"

Vilket färgläge som ska lösas (standard "light").

Returnerar

Record<string, SdLeaf>

Ett Style Dictionary-ordbokobjekt.

Exempel

Formatera IR:n för den inbyggda härstamningen

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.