Skip to content

pantoken-root / packages/core/src / toStyleDictionary

Hàm: toStyleDictionary() ​

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

Beta

Định hình IR đã được giải thành một từ điển token Style Dictionary phẳng, được đánh khóa theo tên token (với phần -- ở đầu bị loại bỏ). Cung cấp điều này cho tools/sd-config cho các emitter gốc.

Tham số ​

tokens ​

chỉ đọc Token[]

IR.

mode? ​

Mode = "light"

Chế độ màu nào để giải quyết (mặc định "light").

Trả về ​

Record<string, SdLeaf>

Một đối tượng từ điển Style Dictionary.

Ví dụ ​

Định hình IR cho dòng phát sinh gốc

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.