Skip to content

pantoken / packages/plugin-kit/src / resolveTokens

फंक्शन: resolveTokens()

resolveTokens(base, options?): Map<string, string>

बीटा

संग्रह के साथ प्रत्येक टोकन के मान को हल करें (देखें makeResolver), नाम के अनुसार कुंजीबद्ध।

पैरामीटर

base

पढ़ने के लिए केवल Token[]

options?

ResolveOptions

वापसी

Map<string, string>

उदाहरण

पूरे IR को नाम → मान मैप में हल करें

ts
import { resolveTokens } from "@pantoken/utils";
import type { Token } from "@pantoken/model";

const ir: Token[] = [
  { name: "--instui-leaf", syntax: "<color>", inherits: true, value: "#0374B5" },
  { name: "--instui-brand", syntax: "*", inherits: true, value: "var(--instui-leaf)" },
  { name: "--instui-bg", syntax: "*", inherits: true, value: "light-dark(#fff, #000)" },
];

const byName = resolveTokens(ir, { mode: "dark" });
byName.get("--instui-brand"); // → "#0374B5"
byName.get("--instui-bg");    // → "#000"