pantoken / packages/core/src / buildTokens
Függvény: buildTokens()
buildTokens(
options?):Token[]
Béta
Hozd létre a téma kanonikus token IR-jét: primitívek, elrendezés, szemantikai színek, komponens tokenek, és opcionális ikonok, majd futtasd a plugin ikon és token hookat az eredményen.
Paraméterek
options?
BuildTokensOptions = {}
Visszatérés
Token[]
A feloldott, deduplikált Token lista.
Példák
Az alapértelmezett (rebrand) IR létrehozása
ts
import { buildTokens } from "@pantoken/core";
const tokens = buildTokens();
// → Token[] : { name, syntax, inherits, value, themed?, refersTo?, meta? }Válasszon egy témát és hagyja el az ikonréteget
ts
import { buildTokens } from "@pantoken/core";
// A smaller, colour/layout-only IR for the canvas theme.
const tokens = buildTokens({ theme: "canvas", includeIcons: false });Futtassa a plugin token hookját az IR-en
ts
import { buildTokens, type PantokenPlugin } from "@pantoken/core";
const brand: PantokenPlugin = {
name: "brand",
tokens: ({ tokens, define }) => [
...tokens,
define({ name: "--instui-focus-color", value: "var(--instui-color-border-brand)" }),
],
};
buildTokens({ theme: "rebrand", plugins: [brand] });