Skip to content

pantoken-root / packages/core/src / resolveReferences

Hàm: resolveReferences() ​

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

Beta

Giải quyết mọi token thành một giá trị cụ thể, đơn chế độ: mở rộng các chuỗi var(...) và thu gọn light-dark() thành mode đã chọn.

Tham số ​

tokens ​

chỉ đọc Token[]

IR.

mode? ​

Mode = "light"

Giữ phía nào của light-dark() (mặc định "light").

Trả về ​

Map<string, string>

Một ánh xạ từ tên token tới giá trị cụ thể.

Ví dụ ​

Giải quyết IR đã xây dựng thành các giá trị chế độ tối cụ thể

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