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"