Skip to content

pantoken-root / packages/plugin-kit/src / definePlugin

फंक्शन: definePlugin() ​

definePlugin(config): PantokenPlugin

बीटा

इसके hooks से एक pantoken प्लगइन बनाएँ। परिणाम एक सामान्य PantokenPlugin है जो आप द्वारा दिए गए hooks से व्युत्पन्न क्षमताओं के साथ ब्रांडेड है।

पैरामीटर ​

config ​

PantokenPlugin

प्लगइन name और किसी भी tokens/icons/css/rehype/native hooks के साथ।

वापसी ​

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"]