Skip to content

pantoken / packages/core/src / toStyleDictionary

Fonksiyon: toStyleDictionary()

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

Beta

Çözülmüş IR'ı token adıyla anahtarlanan düz bir Style Dictionary token sözlüğü olarak şekillendir (başındaki -- kaldırılmış). Bunu yerel emitörler için tools/sd-config'e ver.

Parametreler

tokens

salt okunur Token[]

Ara temsil (IR).

mode?

Mode = "light"

Hangi renk modunun çözüleceği (varsayılan "light").

Döndürür

Record<string, SdLeaf>

Bir Style Dictionary sözlük nesnesi.

Örnek

Yerel soy için IR'ı şekillendir

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.