Skip to content

pantoken / packages/core/src / toStyleDictionary

Funktion: toStyleDictionary()

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

Beta

Forme das aufgelöste IR zu einem flachen Style Dictionary-Token-Wörterbuch, das nach Token-Namen indiziert ist (wobei das am Anfang stehende -- entfernt wurde). Gib dies an tools/sd-config für die nativen Emitter weiter.

Parameter

tokens

schreibgeschützt Token[]

Die IR.

mode?

Mode = "light"

Welchen Farbmodus auflösen (Standard "light").

Rückgabe

Record<string, SdLeaf>

Ein Style Dictionary-Wörterbuchobjekt.

Beispiel

Forme das IR für die native Herkunft

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.