Skip to content

pantoken / packages/core/src / defineToken

פונקציה: defineToken()

defineToken(input): Token

בטא

בנה Token מלא מתוך קלט חלקי, עם ברירת מחדל של inherits ו- syntax.

פרמטרים

input

TokenInput

מחזיר

Token

דוגמאות

לזהות תחביר מתוך ערך קונקרטי

ts
import { defineToken } from "@pantoken/core";

defineToken({ name: "--instui-color-x", value: "#0374B5" });
// → { name: "--instui-color-x", syntax: "<color>", inherits: true, value: "#0374B5" }

ערך var() יחיד רושם refersTo; קריאה light-dark() מגדירה themed

ts
import { defineToken } from "@pantoken/core";

defineToken({ name: "--instui-brand", value: "var(--instui-color-background-brand)" });
// → syntax "*", refersTo: "--instui-color-background-brand"

defineToken({ name: "--instui-bg", value: "light-dark(#fff, #000)" });
// → syntax "*", themed: true