Skip to content

pantoken / packages/core/src / toStyleDictionary

Functie: toStyleDictionary()

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

Bèta

Vorm de opgeloste IR als een platte Style Dictionary-tokenwoordenlijst, geïndexeerd op tokennaam (met de leading -- verwijderd). Geef dit door aan tools/sd-config voor de native emitters.

Parameters

tokens

alleen-lezen Token[]

De IR.

mode?

Mode = "light"

Welke kleurmodus moet worden opgelost (standaard "light").

Retourneert

Record<string, SdLeaf>

Een Style Dictionary dictionary-object.

Voorbeeld

Vorm de IR voor de 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.