Skip to content

pantoken / packages/core/src / resolveReferences

Swyddogaeth: resolveReferences()

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

Bêta

Datrys pob tocyn i werth concrit, mÔd sengl: ehangu cadwyni var(...) a chywasgu light-dark() i'r mode a ddewiswyd.

Paramedrau

tokens

readonly Token[]

Yr IR.

mode?

Mode = "light"

Pa ochr o light-dark() i'w gadw (diofyn "light").

Yn dychwelyd

Map<string, string>

Map o enw tocyn i werth concrit.

Enghraifft

Datrys yr IR a adeiladwyd i werthoedd mòd tywyll concrit

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