Skip to content

pantoken-root / packages/core/src / resolveReferences

Ֆունկցիա: resolveReferences() ​

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

Բետա

Լուծել յուրաքանչյուր տոկենը կոնկրետ, մեկ ռեժիմով արժեքի՝ ընդարձակել var(...) շղթաները և համախմբել light-dark()-ը ընտրված mode-ի։

Պարամետրեր ​

tokens ​

միայն ընթերցման Token[]

The IR:

mode? ​

Mode = "light"

Ո՞ր կողմը light-dark()-ից պահել (ստանդարտ՝ "light").

Վերադարձվող արժեք ​

Map<string, string>

Տոկենների անունների և դրանց կոնկրետ արժեքների քարտեզ։

Օրինակ ​

Լուծել կառուցված IR-ը դեպի կոնկրետ մութ ռեժիմի արժեքներ

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