Skip to content

pantoken-root / packages/core/src / resolveReferences

Funkcja: resolveReferences() ​

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

Beta

Rozwiąż każdy token do konkretnej, jednokontekstowej wartości: rozwiń var(...) łańcuchy i zredukuj light-dark() do wybranego mode.

Parametry ​

tokens ​

tylko do odczytu Token[]

Reprezentacja pośrednia (IR).

mode? ​

Mode = "light"

Którą stronę light-dark() zachować (domyślnie "light").

Zwraca ​

Map<string, string>

Mapa mapująca nazwę tokena na konkretną wartość.

Przykład ​

Rozwiąż zbudowaną reprezentację pośrednią na konkretne wartości w trybie ciemnym

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