pantoken / packages/core/src / toStyleDictionary
Function: toStyleDictionary()
toStyleDictionary(
tokens,mode?):Record<string,SdLeaf>
Beta
Shape the resolved IR as a flat Style Dictionary token dictionary keyed by token name (with the leading -- stripped). Feed this to tools/sd-config for the native emitters.
Parameters
tokens
readonly Token[]
The IR.
mode?
Mode = "light"
Which colour mode to resolve (default "light").
Returns
Record<string, SdLeaf>
A Style Dictionary dictionary object.
Example
Shape the IR for the native lineage
ts
import { buildTokens, 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.