Skip to content

pantoken-root / packages/core/src / toStyleDictionary

تابع: toStyleDictionary() ​

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

بتا

IR حل‌شده را به‌صورت یک دیکشنری تخت از توکن‌های Style Dictionary شکل دهید که بر اساس نام توکن کلیدگذاری شده است (با -- پیش‌رو حذف‌شده). این را به tools/sd-config برای منتشرکننده‌های بومی ارسال کنید.

پارامترها ​

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.