Skip to content

pantoken-root / packages/core/src / toStyleDictionary

Funktion: toStyleDictionary() ​

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

Beta

Form den løst IR som en flad Style Dictionary token-ordbog nøglet efter token-navn (med ledende -- fjernet). Feed dette til tools/sd-config for de native emsitere.

Parametre ​

tokens ​

skrivbeskyttet Token[]

IR'en.

mode? ​

Mode = "light"

Hvilken farvetilstand skal løses (standard "light").

Returnerer ​

Record<string, SdLeaf>

Et Style Dictionary ordbogs objekt.

Eksempel ​

Form IR'en for den native linje

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.