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