Skip to content

pantoken-root / packages/core/src / runIconPlugins

ฟังก์ชัน: runIconPlugins() ​

runIconPlugins(tokens, plugins, theme?): Token[]

เบต้า

Run every plugin's icons hook, letting plugins register extra glyphs as <image> tokens. Each hook receives the current icon list and returns new IconEntry records to add. The result is de-duplicated by name.

พารามิเตอร์ ​

tokens ​

Token[]

plugins ​

อ่านอย่างเดียว PantokenPlugin[]

theme? ​

Theme = "rebrand"

คืนค่า ​

Token[]

ตัวอย่าง ​

ลงทะเบียนสัญลักษณ์เพิ่มเติมเป็นโทเค็น <image>

ts
import { runIconPlugins, type PantokenPlugin } from "@pantoken/core";
import type { Token } from "@pantoken/model";

const base: Token[] = [];
const star: PantokenPlugin = {
  name: "star",
  icons: () => [{ name: "star", path: "M12 2l3 7h7l-6 4 2 7-6-4-6 4 2-7-6-4h7z" }],
};

const tokens = runIconPlugins(base, [star], "rebrand");
// → adds a --instui-icon-star token whose value is a data-URI SVG