Skip to content

pantoken / packages/core/src / resolveReferences

פונקציה: resolveReferences()

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

בטא

לְפַתֵּר כל טוקן לערך מוחשי במצב יחיד: להרחיב var(...) שרשראות ולכווץ light-dark() אל ה־mode הנבחר.

פרמטרים

tokens

לקריאה בלבד Token[]

ה-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