Skip to content

pantoken-root / packages/core/src / resolveReferences

Function: resolveReferences() ​

resolveReferences(tokens, mode?): Map<string, string>

Beta

Resolve every token to a concrete, single-mode value: expand var(...) chains and collapse light-dark() to the chosen mode.

Parameters ​

tokens ​

readonly Token[]

The IR.

mode? ​

Mode = "light"

Which side of light-dark() to keep (default "light").

Returns ​

Map<string, string>

A map of token name to concrete value.

Example ​

Resolve the built IR to concrete dark-mode values

ts
import { buildTokens } from "@pantoken/core/build";
import { resolveReferences } from "@pantoken/core";

const resolved = resolveReferences(buildTokens(), "dark");
resolved.get("--instui-color-background-base"); // → a concrete "#…" value