Skip to content

pantoken / packages/core/src / toStyleDictionary

Fungsi: toStyleDictionary()

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

Beta

Bentuk IR yang telah diselesaikan sebagai kamus token Style Dictionary datar yang diindeks berdasarkan nama token (dengan -- awal dihapus). Berikan ini ke tools/sd-config untuk emitter native.

Parameter

tokens

hanya baca Token[]

IR.

mode?

Mode = "light"

Mode warna mana yang akan diselesaikan (default "light").

Mengembalikan

Record<string, SdLeaf>

Objek kamus Style Dictionary.

Contoh

Bentuk IR untuk lineage native

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.