Skip to content

pantoken / packages/core/src / toStyleDictionary

ฟังก์ชัน: toStyleDictionary()

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

เบต้า

จัดรูป IR ที่ถูกแก้ไขแล้วเป็นพจนานุกรมโทเค็นแบบแบนของ Style Dictionary โดยใช้ชื่อโทเค็นเป็นคีย์ (โดยเอา leading -- ออก). ส่งสิ่งนี้ให้ tools/sd-config สำหรับ native emitters.

พารามิเตอร์

tokens

อ่านอย่างเดียว Token[]

IR.

mode?

Mode = "light"

เลือกโหมดสีที่จะทำการแก้ไข (ค่าปริยาย "light").

คืนค่า

Record<string, SdLeaf>

อ็อบเจ็กต์พจนานุกรมของ Style Dictionary.

ตัวอย่าง

จัดรูป IR สำหรับ native lineage

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.