Skip to content

pantoken / 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.