Skip to content

pantoken / packages/plugin-kit/src / definePlugin

تابع: definePlugin()

definePlugin(config): PantokenPlugin

بتا

ایجاد یک افزونه pantoken از هوک‌های آن. نتیجه یک PantokenPlugin معمولی است که با قابلیت‌هایی که از هوک‌هایی که ارائه کرده‌اید استخراج شده‌اند برند شده است.

پارامترها

config

PantokenPlugin

افزونه name به‌علاوه هر یک از هوک‌های tokens/icons/css/rehype/native.

مقدار بازگشتی

PantokenPlugin

یک PantokenPlugin برندشده PantokenPlugin.

نمونه

یک افزونهٔ یکپارچهٔ tokens + 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"]