Skip to content

pantoken / platforms/vanilla/src / toVanillaVariables

Fonksiyon: toVanillaVariables()

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

Deneysel

Bir IR token listesini Vanilla Foundation variables.json nesnesine dönüştür.

Parametreler

tokens

salt okunur Token[]

IR (ör. @pantoken/tokens'den).

options?

ToVanillaOptions = {}

ToVanillaOptions.

Döndürür

Record<string, unknown>

Temanın variables.json varlığına PUT edilecek iç içe geçmiş değişkenler nesnesi.

Örnekler

Bir IR'i iç içe geçmiş değişkenler nesnesine dönüştür

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

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

Karanlık mod

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

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