Skip to content

pantoken-root / packages/core/src / toStyleDictionary

دالة: toStyleDictionary() ​

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

Beta

شكل الـ IR المحلّل كقاموس مسطّح من Style Dictionary مفهرس باسم الرمز (مع إزالة -- القياسية في البداية). مرّر هذا إلى tools/sd-config للمصدّرات الأصلية.

Parameters ​

tokens ​

للقراءة فقط Token[]

الـ IR.

mode? ​

Mode = "light"

أي وضع لون ليتم حله (الافتراضي "light").

Returns ​

Record<string, SdLeaf>

كائن قاموس من Style Dictionary.

Example ​

شكّل الـ 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.