@mirrordown/core 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/index.mjs +3 -91
- package/dist/index.mjs.map +1 -1
- package/dist/mermaid-pele-BMyyDozN.mjs +92 -0
- package/dist/mermaid-pele-BMyyDozN.mjs.map +1 -0
- package/dist/tab-icons.d.mts +54 -0
- package/dist/tab-icons.d.mts.map +1 -0
- package/dist/tab-icons.mjs +299 -0
- package/dist/tab-icons.mjs.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// src/mermaid-pele.ts
|
|
2
|
+
/** The class a fenced `mermaid` block's `<code>` takes. */
|
|
3
|
+
const MERMAID_LANGUAGE_CLASS = `language-mermaid`;
|
|
4
|
+
/** The class a `<pre>` holding a diagram written as HTML takes, as Mermaid reads it in the browser. */
|
|
5
|
+
const MERMAID_PRE_CLASS = `mermaid`;
|
|
6
|
+
const hash = (str) => {
|
|
7
|
+
let h = 2166136261;
|
|
8
|
+
for (let i = 0; i < str.length; i++) h = Math.imul(h ^ str.charCodeAt(i), 16777619) >>> 0;
|
|
9
|
+
return h.toString(36);
|
|
10
|
+
};
|
|
11
|
+
/** A diagram's source as Pele reads it: line endings normalized, as markdown-it already has them. */
|
|
12
|
+
const mermaidSource = (text) => text.replace(/\r\n?/g, `\n`);
|
|
13
|
+
/**
|
|
14
|
+
* A document's id prefixes, one per diagram in document order: `prefix`, then a hash of the diagram's source, so a diagram's ids don't change when others are edited, with `-2`, `-3`… for repeats of one diagram. Pele namespaces every id it writes (an accessible title, a gradient) under it. Create one per document.
|
|
15
|
+
*/
|
|
16
|
+
const mermaidIdPrefixes = (prefix) => {
|
|
17
|
+
const seen = /* @__PURE__ */ new Map();
|
|
18
|
+
return (source) => {
|
|
19
|
+
const id = `${prefix}-${hash(source)}`;
|
|
20
|
+
const count = (seen.get(id) ?? 0) + 1;
|
|
21
|
+
seen.set(id, count);
|
|
22
|
+
return count === 1 ? id : `${id}-${count}`;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
const escapeAttribute = (value) => value.replace(/&/g, `&`).replace(/"/g, `"`);
|
|
26
|
+
const classes = (value) => value.split(/\s+/).filter((name) => name !== `` && name !== MERMAID_LANGUAGE_CLASS && name !== MERMAID_PRE_CLASS);
|
|
27
|
+
/**
|
|
28
|
+
* Pele's `<svg>` with the attributes the diagram's element had (from an attribute block such as `{#id .class}`): classes are added after Pele's, a style after Pele's (whose theme variables the diagram needs), and anything else is set, replacing Pele's value. The class that marked the element as a diagram is dropped.
|
|
29
|
+
*/
|
|
30
|
+
const mermaidSvg = (svg, attributes) => {
|
|
31
|
+
const open = /^<svg\b[^>]*>/.exec(svg)?.[0];
|
|
32
|
+
if (!open || attributes.length === 0) return svg;
|
|
33
|
+
const own = [...open.slice(4, -1).matchAll(/\s([^\s=]+)="([^"]*)"/g)].map(([, name = ``, value = ``]) => [name, value]);
|
|
34
|
+
const merged = new Map(own);
|
|
35
|
+
for (const [name, value] of attributes) {
|
|
36
|
+
const escaped = escapeAttribute(value);
|
|
37
|
+
const current = merged.get(name);
|
|
38
|
+
if (name === `class`) {
|
|
39
|
+
const added = classes(value).map(escapeAttribute).join(` `);
|
|
40
|
+
if (added) merged.set(name, current ? `${current} ${added}` : added);
|
|
41
|
+
} else if (name === `style` && current) merged.set(name, `${current.replace(/;$/, ``)};${escaped}`);
|
|
42
|
+
else merged.set(name, escaped);
|
|
43
|
+
}
|
|
44
|
+
return `<svg${[...merged].map(([name, value]) => ` ${name}="${value}"`).join(``)}>${svg.slice(open.length)}`;
|
|
45
|
+
};
|
|
46
|
+
/** A hast element's properties as attributes; `className` becomes `class`, and other names are kept as the attribute plugins write them. */
|
|
47
|
+
const hastAttributes = (properties) => {
|
|
48
|
+
const text = (value) => typeof value === `string` ? value : typeof value === `number` ? String(value) : value === true ? `` : Array.isArray(value) ? value.map((item) => text(item) ?? ``).join(` `) : void 0;
|
|
49
|
+
const attributes = [];
|
|
50
|
+
for (const [key, value] of Object.entries(properties ?? {})) {
|
|
51
|
+
const written = text(value);
|
|
52
|
+
if (written !== void 0) attributes.push([key === `className` ? `class` : key, written]);
|
|
53
|
+
}
|
|
54
|
+
return attributes;
|
|
55
|
+
};
|
|
56
|
+
const hasClass = (node, name) => {
|
|
57
|
+
const value = node.properties?.className;
|
|
58
|
+
return Array.isArray(value) ? value.includes(name) : typeof value === `string` && value.split(/\s+/).includes(name);
|
|
59
|
+
};
|
|
60
|
+
const textOf = (node) => node.type === `text` ? node.value ?? `` : (node.children ?? []).map(textOf).join(``);
|
|
61
|
+
/**
|
|
62
|
+
* The diagram a `<pre>` holds, as rehype-mermaid finds them: a `<pre>` whose only content (besides whitespace) is a `<code class="language-mermaid">`, which is how a fenced `mermaid` block renders, or a `<pre class="mermaid">`. `element` is the one whose attributes the `<svg>` takes. `undefined` for anything else.
|
|
63
|
+
*/
|
|
64
|
+
const mermaidDiagram = (pre) => {
|
|
65
|
+
if (pre.tagName !== `pre`) return void 0;
|
|
66
|
+
if (hasClass(pre, MERMAID_PRE_CLASS)) return {
|
|
67
|
+
source: mermaidSource(textOf(pre)),
|
|
68
|
+
element: pre
|
|
69
|
+
};
|
|
70
|
+
let code;
|
|
71
|
+
for (const child of pre.children ?? []) {
|
|
72
|
+
if (child.type === `text` && /^\s*$/.test(child.value ?? ``)) continue;
|
|
73
|
+
if (code || child.tagName !== `code`) return void 0;
|
|
74
|
+
code = child;
|
|
75
|
+
}
|
|
76
|
+
return code && hasClass(code, MERMAID_LANGUAGE_CLASS) ? {
|
|
77
|
+
source: mermaidSource(textOf(code)),
|
|
78
|
+
element: code
|
|
79
|
+
} : void 0;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* The error a diagram that failed to render throws: Pele's message, at the document line Pele located the problem on (counting from `line`, the line the diagram's element starts on), or at `line` itself when Pele has no location. The original error is the `cause`.
|
|
83
|
+
*/
|
|
84
|
+
const mermaidFailure = (error, line) => {
|
|
85
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
86
|
+
const within = error instanceof Error && `line` in error && typeof error.line === `number` && error.line > 0 ? error.line : 0;
|
|
87
|
+
const at = line === void 0 ? `` : ` on line ${String(line + within)}`;
|
|
88
|
+
return new Error(`Could not render the mermaid diagram${at}: ${reason}`, { cause: error });
|
|
89
|
+
};
|
|
90
|
+
export { mermaidSource as a, mermaidIdPrefixes as i, mermaidDiagram as n, mermaidSvg as o, mermaidFailure as r, hastAttributes as t };
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=mermaid-pele-BMyyDozN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mermaid-pele-BMyyDozN.mjs","names":[],"sources":["../src/mermaid-pele.ts"],"sourcesContent":["// Rendering mermaid diagrams with Pele, shared by the markdown-it, rehype and Sätteri plugins: which elements hold a diagram, each diagram's id prefix, the attributes its `<svg>` takes, and the error a failed diagram throws. Rendering itself stays in the plugins, which depend on Pele, so this module has no dependencies.\n\nimport type { HastLike } from \"./hast.js\";\n\n/** An HTML attribute, as markdown-it's tokens hold them. */\nexport type MermaidAttribute = [name: string, value: string];\n\n/** The class a fenced `mermaid` block's `<code>` takes. */\nconst MERMAID_LANGUAGE_CLASS = `language-mermaid`;\n/** The class a `<pre>` holding a diagram written as HTML takes, as Mermaid reads it in the browser. */\nconst MERMAID_PRE_CLASS = `mermaid`;\n\nconst hash = (str: string): string => {\n let h = 2166136261;\n for (let i = 0; i < str.length; i++) {\n h = Math.imul(h ^ str.charCodeAt(i), 16777619) >>> 0;\n }\n return h.toString(36);\n};\n\n/** A diagram's source as Pele reads it: line endings normalized, as markdown-it already has them. */\nexport const mermaidSource = (text: string): string =>\n text.replace(/\\r\\n?/g, `\\n`);\n\n/**\n * A document's id prefixes, one per diagram in document order: `prefix`, then a hash of the diagram's source, so a diagram's ids don't change when others are edited, with `-2`, `-3`… for repeats of one diagram. Pele namespaces every id it writes (an accessible title, a gradient) under it. Create one per document.\n */\nexport const mermaidIdPrefixes = (\n prefix: string\n): ((source: string) => string) => {\n const seen = new Map<string, number>();\n return (source) => {\n const id = `${prefix}-${hash(source)}`;\n const count = (seen.get(id) ?? 0) + 1;\n seen.set(id, count);\n return count === 1 ? id : `${id}-${count}`;\n };\n};\n\nconst escapeAttribute = (value: string): string =>\n value.replace(/&/g, `&`).replace(/\"/g, `"`);\n\nconst classes = (value: string): string[] =>\n value\n .split(/\\s+/)\n .filter(\n (name) =>\n name !== `` &&\n name !== MERMAID_LANGUAGE_CLASS &&\n name !== MERMAID_PRE_CLASS\n );\n\n/**\n * Pele's `<svg>` with the attributes the diagram's element had (from an attribute block such as `{#id .class}`): classes are added after Pele's, a style after Pele's (whose theme variables the diagram needs), and anything else is set, replacing Pele's value. The class that marked the element as a diagram is dropped.\n */\nexport const mermaidSvg = (\n svg: string,\n attributes: readonly MermaidAttribute[]\n): string => {\n const open = /^<svg\\b[^>]*>/.exec(svg)?.[0];\n if (!open || attributes.length === 0) return svg;\n const own = [...open.slice(4, -1).matchAll(/\\s([^\\s=]+)=\"([^\"]*)\"/g)].map(\n ([, name = ``, value = ``]): MermaidAttribute => [name, value]\n );\n const merged = new Map<string, string>(own);\n for (const [name, value] of attributes) {\n const escaped = escapeAttribute(value);\n const current = merged.get(name);\n if (name === `class`) {\n const added = classes(value).map(escapeAttribute).join(` `);\n if (added) merged.set(name, current ? `${current} ${added}` : added);\n } else if (name === `style` && current) {\n merged.set(name, `${current.replace(/;$/, ``)};${escaped}`);\n } else {\n merged.set(name, escaped);\n }\n }\n const tag = [...merged]\n .map(([name, value]) => ` ${name}=\"${value}\"`)\n .join(``);\n return `<svg${tag}>${svg.slice(open.length)}`;\n};\n\n/** A hast element's properties as attributes; `className` becomes `class`, and other names are kept as the attribute plugins write them. */\nexport const hastAttributes = (\n properties: Record<string, unknown> | undefined\n): MermaidAttribute[] => {\n // hast's property values: a string, a number, a boolean (present or absent) or a list.\n const text = (value: unknown): string | undefined =>\n typeof value === `string`\n ? value\n : typeof value === `number`\n ? String(value)\n : value === true\n ? ``\n : Array.isArray(value)\n ? value.map((item) => text(item) ?? ``).join(` `)\n : undefined;\n const attributes: MermaidAttribute[] = [];\n for (const [key, value] of Object.entries(properties ?? {})) {\n const written = text(value);\n if (written !== undefined)\n attributes.push([key === `className` ? `class` : key, written]);\n }\n return attributes;\n};\n\nconst hasClass = (node: HastLike, name: string): boolean => {\n const value = node.properties?.className;\n return Array.isArray(value)\n ? value.includes(name)\n : typeof value === `string` && value.split(/\\s+/).includes(name);\n};\n\nconst textOf = (node: HastLike): string =>\n node.type === `text`\n ? (node.value ?? ``)\n : (node.children ?? []).map(textOf).join(``);\n\n/**\n * The diagram a `<pre>` holds, as rehype-mermaid finds them: a `<pre>` whose only content (besides whitespace) is a `<code class=\"language-mermaid\">`, which is how a fenced `mermaid` block renders, or a `<pre class=\"mermaid\">`. `element` is the one whose attributes the `<svg>` takes. `undefined` for anything else.\n */\nexport const mermaidDiagram = (\n pre: HastLike\n): { source: string; element: HastLike } | undefined => {\n if (pre.tagName !== `pre`) return undefined;\n if (hasClass(pre, MERMAID_PRE_CLASS))\n return { source: mermaidSource(textOf(pre)), element: pre };\n let code: HastLike | undefined;\n for (const child of pre.children ?? []) {\n if (child.type === `text` && /^\\s*$/.test(child.value ?? ``)) continue;\n if (code || child.tagName !== `code`) return undefined;\n code = child;\n }\n return code && hasClass(code, MERMAID_LANGUAGE_CLASS)\n ? { source: mermaidSource(textOf(code)), element: code }\n : undefined;\n};\n\n/**\n * The error a diagram that failed to render throws: Pele's message, at the document line Pele located the problem on (counting from `line`, the line the diagram's element starts on), or at `line` itself when Pele has no location. The original error is the `cause`.\n */\nexport const mermaidFailure = (\n error: unknown,\n line: number | undefined\n): Error => {\n const reason = error instanceof Error ? error.message : String(error);\n const within =\n error instanceof Error &&\n `line` in error &&\n typeof error.line === `number` &&\n error.line > 0\n ? error.line\n : 0;\n const at = line === undefined ? `` : ` on line ${String(line + within)}`;\n return new Error(`Could not render the mermaid diagram${at}: ${reason}`, {\n cause: error\n });\n};\n"],"mappings":";;AAQA,MAAM,yBAAyB;;AAE/B,MAAM,oBAAoB;AAE1B,MAAM,QAAQ,QAAwB;CACpC,IAAI,IAAI;CACR,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,KAC9B,IAAI,KAAK,KAAK,IAAI,IAAI,WAAW,CAAC,GAAG,QAAQ,MAAM;CAErD,OAAO,EAAE,SAAS,EAAE;AACtB;;AAGA,MAAa,iBAAiB,SAC5B,KAAK,QAAQ,UAAU,IAAI;;;;AAK7B,MAAa,qBACX,WACiC;CACjC,MAAM,uBAAO,IAAI,IAAoB;CACrC,QAAQ,WAAW;EACjB,MAAM,KAAK,GAAG,OAAO,GAAG,KAAK,MAAM;EACnC,MAAM,SAAS,KAAK,IAAI,EAAE,KAAK,KAAK;EACpC,KAAK,IAAI,IAAI,KAAK;EAClB,OAAO,UAAU,IAAI,KAAK,GAAG,GAAG,GAAG;CACrC;AACF;AAEA,MAAM,mBAAmB,UACvB,MAAM,QAAQ,MAAM,OAAO,CAAC,CAAC,QAAQ,MAAM,QAAQ;AAErD,MAAM,WAAW,UACf,MACG,MAAM,KAAK,CAAC,CACZ,QACE,SACC,SAAS,MACT,SAAS,0BACT,SAAS,iBACb;;;;AAKJ,MAAa,cACX,KACA,eACW;CACX,MAAM,OAAO,gBAAgB,KAAK,GAAG,CAAC,GAAG;CACzC,IAAI,CAAC,QAAQ,WAAW,WAAW,GAAG,OAAO;CAC7C,MAAM,MAAM,CAAC,GAAG,KAAK,MAAM,GAAG,EAAE,CAAC,CAAC,SAAS,wBAAwB,CAAC,CAAC,CAAC,KACnE,GAAG,OAAO,IAAI,QAAQ,QAA0B,CAAC,MAAM,KAAK,CAC/D;CACA,MAAM,SAAS,IAAI,IAAoB,GAAG;CAC1C,KAAK,MAAM,CAAC,MAAM,UAAU,YAAY;EACtC,MAAM,UAAU,gBAAgB,KAAK;EACrC,MAAM,UAAU,OAAO,IAAI,IAAI;EAC/B,IAAI,SAAS,SAAS;GACpB,MAAM,QAAQ,QAAQ,KAAK,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,KAAK,GAAG;GAC1D,IAAI,OAAO,OAAO,IAAI,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,KAAK;EACrE,OAAO,IAAI,SAAS,WAAW,SAC7B,OAAO,IAAI,MAAM,GAAG,QAAQ,QAAQ,MAAM,EAAE,EAAE,GAAG,SAAS;OAE1D,OAAO,IAAI,MAAM,OAAO;CAE5B;CAIA,OAAO,OAHK,CAAC,GAAG,MAAM,CAAC,CACpB,KAAK,CAAC,MAAM,WAAW,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC,CAC7C,KAAK,EACQ,EAAE,GAAG,IAAI,MAAM,KAAK,MAAM;AAC5C;;AAGA,MAAa,kBACX,eACuB;CAEvB,MAAM,QAAQ,UACZ,OAAO,UAAU,WACb,QACA,OAAO,UAAU,WACf,OAAO,KAAK,IACZ,UAAU,OACR,KACA,MAAM,QAAQ,KAAK,IACjB,MAAM,KAAK,SAAS,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC,KAAK,GAAG,IAC9C,KAAA;CACZ,MAAM,aAAiC,CAAC;CACxC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,cAAc,CAAC,CAAC,GAAG;EAC3D,MAAM,UAAU,KAAK,KAAK;EAC1B,IAAI,YAAY,KAAA,GACd,WAAW,KAAK,CAAC,QAAQ,cAAc,UAAU,KAAK,OAAO,CAAC;CAClE;CACA,OAAO;AACT;AAEA,MAAM,YAAY,MAAgB,SAA0B;CAC1D,MAAM,QAAQ,KAAK,YAAY;CAC/B,OAAO,MAAM,QAAQ,KAAK,IACtB,MAAM,SAAS,IAAI,IACnB,OAAO,UAAU,YAAY,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,IAAI;AACnE;AAEA,MAAM,UAAU,SACd,KAAK,SAAS,SACT,KAAK,SAAS,MACd,KAAK,YAAY,CAAC,EAAA,CAAG,IAAI,MAAM,CAAC,CAAC,KAAK,EAAE;;;;AAK/C,MAAa,kBACX,QACsD;CACtD,IAAI,IAAI,YAAY,OAAO,OAAO,KAAA;CAClC,IAAI,SAAS,KAAK,iBAAiB,GACjC,OAAO;EAAE,QAAQ,cAAc,OAAO,GAAG,CAAC;EAAG,SAAS;CAAI;CAC5D,IAAI;CACJ,KAAK,MAAM,SAAS,IAAI,YAAY,CAAC,GAAG;EACtC,IAAI,MAAM,SAAS,UAAU,QAAQ,KAAK,MAAM,SAAS,EAAE,GAAG;EAC9D,IAAI,QAAQ,MAAM,YAAY,QAAQ,OAAO,KAAA;EAC7C,OAAO;CACT;CACA,OAAO,QAAQ,SAAS,MAAM,sBAAsB,IAChD;EAAE,QAAQ,cAAc,OAAO,IAAI,CAAC;EAAG,SAAS;CAAK,IACrD,KAAA;AACN;;;;AAKA,MAAa,kBACX,OACA,SACU;CACV,MAAM,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACpE,MAAM,SACJ,iBAAiB,SACjB,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,MAAM,OAAO,IACT,MAAM,OACN;CACN,MAAM,KAAK,SAAS,KAAA,IAAY,KAAK,YAAY,OAAO,OAAO,MAAM;CACrE,OAAO,IAAI,MAAM,uCAAuC,GAAG,IAAI,UAAU,EACvE,OAAO,MACT,CAAC;AACH"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An icon: SVG markup, or a light and dark pair that the color scheme picks between. Pairs render both SVGs, and the stylesheet shows one; icons that adapt to the color scheme themselves (with `light-dark()`) can be single SVGs.
|
|
3
|
+
*/
|
|
4
|
+
type TabIcon = string | {
|
|
5
|
+
light: string;
|
|
6
|
+
dark: string;
|
|
7
|
+
};
|
|
8
|
+
/** Options shared by the tab-icons plugins for every engine. */
|
|
9
|
+
interface TabIconsOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Your own icons, by keyword (a whole word of a label, such as `deno`) or file name and extension (a key with a `.`, such as `.astro` or `deno.json`). They're checked before the built-in ones, and replace one with the same key.
|
|
12
|
+
*/
|
|
13
|
+
icons?: Record<string, TabIcon> | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Include the icons Mirrordown ships (the set vitepress-plugin-group-icons matches).
|
|
16
|
+
*
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
builtin?: boolean | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Match a label's text to an icon when it has no `[!keyword]` marker.
|
|
22
|
+
*
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
match?: boolean | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The tabs plugin's `containerClass`, when you changed it.
|
|
28
|
+
*
|
|
29
|
+
* @default "markdown-tabs"
|
|
30
|
+
*/
|
|
31
|
+
containerClass?: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
/** The icons tab-icons ships, by keyword (a whole word of a label) or file name and extension (keys with a `.`). */
|
|
34
|
+
export declare const BUILTIN_TAB_ICONS: Record<string, TabIcon>;
|
|
35
|
+
/** The class each icon's `<svg>` takes. */
|
|
36
|
+
export declare const TAB_ICON_CLASS = "markdown-tab-icon";
|
|
37
|
+
/** What a tab label becomes: its icon, if it has one, and its text without its marker. */
|
|
38
|
+
export interface TabLabelIcon {
|
|
39
|
+
icon: TabIcon | undefined;
|
|
40
|
+
/** The marker at the start of the label's text (`[!npm] `), to remove from it, or `""`. */
|
|
41
|
+
marker: string;
|
|
42
|
+
/** The label's text without its marker: the marker's keyword when nothing else is left. */
|
|
43
|
+
label: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A resolver for tab labels' icons under a plugin's options. Given a label's plain text, it returns the icon for its `[!keyword]` marker (an unknown keyword isn't a marker; `[!none]` gives no icon), or, without one, the icon its text matches: the longest keyword that is a whole word of the label (case-insensitive, also after splitting camelCase), else the longest file name or extension it ends with, else one in it. Your icons come before the built-in ones.
|
|
47
|
+
*/
|
|
48
|
+
export declare const createTabIconResolver: (options?: TabIconsOptions) => ((label: string) => TabLabelIcon);
|
|
49
|
+
/**
|
|
50
|
+
* The markup for a tab icon, to go before the label's text: the `<svg>` with the icon class and `aria-hidden` (the label names the tab), or, for a light and dark pair, both, marked `data-scheme="light"` and `"dark"` for the stylesheet to show one.
|
|
51
|
+
*/
|
|
52
|
+
export declare const tabIconMarkup: (icon: TabIcon) => string;
|
|
53
|
+
export type { TabIcon, TabIconsOptions };
|
|
54
|
+
//# sourceMappingURL=tab-icons.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tab-icons.d.mts","names":[],"sources":["../src/tab-icons/types.ts","../src/tab-icons/builtin.ts","../src/tab-icons/index.ts"],"mappings":";;;KAGY;EAAqB;EAAe;;;UAG/B;;;;EAIf,QAAQ,eAAe;;;;;;EAMvB;;;;;;EAMA;;;;;;EAMA;;;qBC6IW,mBAAmB,eAAe;;qBChKlC;;iBA0BI;EACf,MAAM;;EAEN;;EAEA;;;;;qBAMW,wBACX,UAAS,sBACN,kBAAkB;;;;qBAoEV,gBAAiB,MAAM"}
|