Skip to content

pantoken-root / platforms/vanilla/src / toVanillaVariables

دالة: toVanillaVariables() ​

toVanillaVariables(tokens, options?): Record<string, unknown>

Experimental

حوّل قائمة رموز IR إلى كائن Vanilla Foundation variables.json.

Parameters ​

tokens ​

للقراءة فقط Token[]

IR (مثلاً من @pantoken/tokens).

options? ​

ToVanillaOptions = {}

ToVanillaOptions.

Returns ​

Record<string, unknown>

كائن المتغيرات المتداخل ليتم PUT إلى مورد السمة variables.json.

Examples ​

حوّل IR إلى كائن المتغيرات المتداخل

ts
import { toVanillaVariables } from "@pantoken/vanilla";
import { byTheme } from "@pantoken/tokens";

const vars = toVanillaVariables(byTheme("rebrand"));
// { global: { mainColors: { primary: "#…" }, … }, titleBar: { … }, button: { … } }

الوضع الداكن

ts
import { toVanillaVariables } from "@pantoken/vanilla";
import { byTheme } from "@pantoken/tokens";

const vars = toVanillaVariables(byTheme("canvas"), { mode: "dark" });