Skip to content

pantoken / packages/core/src / toStyleDictionary

Fall: toStyleDictionary()

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

Beta

Móta útreiknaðan IR sem flataða Style Dictionary-token-orðabók sem er lyklað eftir tokennafni (með fyrirliggjandi -- fjarlægðan). Sendu þetta til tools/sd-config fyrir innfæddar útgeislara.

Færibreytur

tokens

aðeins-lesa Token[]

IR-ið.

mode?

Mode = "light"

Hvaða litastilling á að leysa (sjálfgefið "light").

Skilar

Record<string, SdLeaf>

Style Dictionary orðabókahlutur.

Dæmi

Móta IR fyrir innfædda arfleifð

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.