Skip to content

pantoken / packages/plugin-kit/src / definePlugin

פונקציה: definePlugin()

definePlugin(config): PantokenPlugin

בטא

צור תוסף pantoken מתוך ה-hooks שלו. התוצאה היא PantokenPlugin רגיל ממותג עם היכולות שנגזרו מן ה-hooks שסיפקת.

פרמטרים

config

PantokenPlugin

התוסף name בתוספת כל אחד מה-hooks tokens/icons/css/rehype/native.

מחזיר

PantokenPlugin

תוסף ממותג PantokenPlugin.

דוגמה

תוסף מאוחד של טוקנים + css

ts
import { capabilitiesOf, definePlugin } from "@pantoken/plugin-kit";

const brand = definePlugin({
  name: "@acme/brand",
  tokens: (ctx) => [
    ...ctx.tokens,
    ctx.define({ name: "--instui-brand", value: "var(--instui-color-background-brand)" }),
  ],
  css: () => ({ append: ":root { color-scheme: light dark; }" }),
});

capabilitiesOf(brand); // → ["tokens", "css"]