Skip to content

pantoken-root / packages/core/src / toStyleDictionary

Ֆունկցիա: toStyleDictionary() ​

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

Բետա

Արտահայտված IR-ը հեշտորեն կազմակերպել՝ որպես հարթ Style Dictionary տոկենների բառարան՝ բանալիով՝ տոկենի անունը (առաջին ---ը հանված): Սա փոխանցել tools/sd-config-ին բնիկ էմիտերների համար.

Պարամետրեր ​

tokens ​

միայն ընթերցման Token[]

The IR:

mode? ​

Mode = "light"

Որ գույնային ռեժիմն օգտագործել (նախնականը "light").

Վերադարձվող արժեք ​

Record<string, SdLeaf>

Style Dictionary բառարանի օբյեկտ։

Օրինակ ​

IR-ը ձեւավորել բնիկ հոսքի համար

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.