Skip to content

pantoken-root / packages/core/src / toStyleDictionary

फंक्शन: toStyleDictionary() ​

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

बीटा

सुलझाए गए IR को एक समतल Style Dictionary टोकन शब्दकोश के रूप में आकार दें, जिसका कुंजीकरण टोकन नाम द्वारा होता है (साथ ही leading -- हटा दिया गया है)। इसे नेटिव इमिटर के लिए tools/sd-config को भेजें।

पैरामीटर ​

tokens ​

केवल-पढ़ने योग्य Token[]

इंटरमीडिएट प्रतिनिधित्व।

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.