Skip to content

pantoken / packages/core/src / defineToken

Ֆունկցիա: defineToken()

defineToken(input): Token

Բետա

Կառուցեք լիովին ձևավորված Token մասնակի input-ից, լռելյալ inherits և syntax:

Պարամետրեր

input

TokenInput

Վերադարձվող արժեք

Token

Օրինակներ

Որոշեք syntax concrete արժեքից

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