Skip to content

pantoken / packages/core/src / toStyleDictionary

פונקציה: toStyleDictionary()

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

בטא

עצב את ה‑IR המוגמר כמילון שטוח של Style Dictionary של טוקנים הממופים לפי שם הטוקן (כאשר ה הקדמי -- הוסר). הזן זאת ל־tools/sd-config עבור ה‑emitters המקומיים.

פרמטרים

tokens

לקריאה בלבד Token[]

ה-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.