@lumal/icons 0.0.1-beta

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lumal contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # @lumal/icons
2
+
3
+ 框架无关的 Lumal 图标内核,提供图标注册表、分组、SVG 改色、渐变、校验、合成、Data URI 缓存和 Vite 静态 SVG 插件。
4
+
5
+ ```ts
6
+ import { recolorSvgString, registerIcons } from '@lumal/icons'
7
+
8
+ registerIcons([
9
+ {
10
+ key: 'app:dashboard',
11
+ source: 'local-svg',
12
+ svgText: '<svg viewBox="0 0 24 24"><path fill="currentColor" d="..."/></svg>',
13
+ },
14
+ ])
15
+
16
+ const blueSvg = recolorSvgString(svgText, '#1677ff')
17
+ ```
18
+
19
+ 该包没有 Vue 或其他 UI 框架运行时依赖。Vue 组件由 `@lumal/icons-vue` 提供,详细说明见仓库文档 `docs/icons.md`。
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e,t,n){return{group:`lumal`,key:`lumal:${e}`,label:t,source:`local-svg`,svgText:`<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">${n}</svg>`}}var t=[e(`sun`,`浅色模式`,`<circle cx="12" cy="12" r="4" fill="currentColor"/><path d="M12 2v2M12 20v2M4.93 4.93l1.42 1.42M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.42-1.42M17.66 6.34l1.41-1.41" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>`),e(`moon`,`深色模式`,`<path d="M20.2 15.4A8.5 8.5 0 0 1 8.6 3.8 8.5 8.5 0 1 0 20.2 15.4Z" fill="currentColor"/>`),e(`monitor`,`跟随系统`,`<rect x="3" y="4" width="18" height="13" rx="2" stroke="currentColor" stroke-width="1.8"/><path d="M8 21h8M12 17v4" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>`),e(`palette`,`主题设置`,`<path d="M12 3a9 9 0 0 0 0 18h1.3a2.2 2.2 0 0 0 1.56-3.76l-.38-.38a1.1 1.1 0 0 1 .78-1.86H17a4 4 0 0 0 3.72-5.47A9 9 0 0 0 12 3Z" stroke="currentColor" stroke-width="1.7"/><circle cx="7.5" cy="10" r="1.2" fill="currentColor"/><circle cx="10.5" cy="6.8" r="1.2" fill="currentColor"/><circle cx="15" cy="7.5" r="1.2" fill="currentColor"/>`),e(`settings`,`设置`,`<path d="M12 8.5a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7Z" stroke="currentColor" stroke-width="1.8"/><path d="m19.4 15 .1-1-.1-1 2-1.5-2-3.4-2.5 1a8 8 0 0 0-1.7-1L14.8 5h-4l-.4 3.1a8 8 0 0 0-1.7 1l-2.5-1-2 3.4 2 1.5-.1 1 .1 1-2 1.5 2 3.4 2.5-1a8 8 0 0 0 1.7 1l.4 3.1h4l.4-3.1a8 8 0 0 0 1.7-1l2.5 1 2-3.4-2-1.5Z" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/>`),e(`reset`,`恢复默认`,`<path d="M4 7v5h5M5.5 11A7 7 0 1 1 7 18.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`),e(`plus`,`新增`,`<path d="M12 5v14M5 12h14" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/>`),e(`filter`,`筛选`,`<path d="M4 5h16l-6.2 7.1v5.2l-3.6 1.8v-7L4 5Z" stroke="currentColor" stroke-width="1.7" stroke-linejoin="round"/>`),e(`refresh`,`刷新`,`<path d="M20 7v5h-5M4 17v-5h5M18.5 11A7 7 0 0 0 6 7.5L4 10M5.5 13A7 7 0 0 0 18 16.5l2-2.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`),e(`fullscreen`,`全屏`,`<path d="M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`),e(`fullscreen-exit`,`退出全屏`,`<path d="M9 4v5H4M20 9h-5V4M15 20v-5h5M4 15h5v5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`),e(`grid`,`列设置`,`<rect x="4" y="4" width="6" height="6" rx="1" stroke="currentColor" stroke-width="1.7"/><rect x="14" y="4" width="6" height="6" rx="1" stroke="currentColor" stroke-width="1.7"/><rect x="4" y="14" width="6" height="6" rx="1" stroke="currentColor" stroke-width="1.7"/><rect x="14" y="14" width="6" height="6" rx="1" stroke="currentColor" stroke-width="1.7"/>`),e(`close`,`关闭`,`<path d="M6 6l12 12M18 6L6 18" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>`),e(`chevron-left`,`上一页`,`<path d="M15 6l-6 6 6 6" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" fill="none"/>`),e(`chevron-right`,`下一页`,`<path d="M9 6l6 6-6 6" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" fill="none"/>`),e(`more`,`更多`,`<circle cx="5" cy="12" r="1.6" fill="currentColor"/><circle cx="12" cy="12" r="1.6" fill="currentColor"/><circle cx="19" cy="12" r="1.6" fill="currentColor"/>`),e(`pin`,`固定`,`<path d="M9 4h6l-1 6 4 3v2H6v-2l4-3-1-6Z" stroke="currentColor" stroke-width="1.7" stroke-linejoin="round" fill="none"/><path d="M12 14v6" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/>`),e(`pin-off`,`取消固定`,`<path d="M9 4h6l-1 6 4 3v2H6v-2l4-3-1-6Z" stroke="currentColor" stroke-width="1.7" stroke-linejoin="round" fill="none"/><path d="M12 14v6M4 4l16 16" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/>`),e(`external-link`,`新窗口打开`,`<path d="M14 4h6v6M20 4l-8 8M14 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" fill="none"/>`),e(`maximize`,`内容最大化`,`<path d="M8 3H3v5M16 3h5v5M3 16v5h5M21 16v5h-5" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" fill="none"/><path d="M3 12h18" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-dasharray="2 3" opacity="0.45"/>`),e(`restore`,`还原`,`<path d="M8 3v3a2 2 0 0 1-2 2H3M16 3v3a2 2 0 0 0 2 2h3M3 16h3a2 2 0 0 1 2 2v3M21 16h-3a2 2 0 0 0-2 2v3" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" fill="none"/>`)],n=new Map,r=new Map,i=new Set;function a(){for(let e of i)e()}function o(e){return i.add(e),()=>{i.delete(e)}}function s(e){for(let t of e)n.set(t.key,t);e.length&&a()}function c(e){return n.get(e)}function l(){return[...n.values()]}function u(e,t){return Object.entries(t).map(([t,n])=>({component:n,group:e,key:`${e}:${t}`,label:t,source:`component`}))}function d(e,t){return t.map(t=>({group:e,icon:t,key:`${e}:${t}`,label:t,source:`iconify`}))}function f(e){for(let t of e)r.set(t.key,t);e.length&&a()}function p(){return[...r.values()].sort((e,t)=>(e.order??2**53-1)-(t.order??2**53-1)||e.label.localeCompare(t.label))}var m=new Map;function h(e){for(let t of e)m.set(t.key,t);s(e)}function g(){return[...m.values()]}function _(e){return m.get(e)??c(e)}function v(e){return c(e)??_(e)}var y=/currentColor/g,b=/(?:fill|stroke)=["']([^"']+)["']/gi;function x(e){if(!/^\s*<svg\b[\s\S]*<\/svg>\s*$/i.test(e))return{reason:`内容不是完整 SVG`,valid:!1};if(/<script\b|\bon\w+\s*=|(?:href|src)=["']https?:/i.test(e))return{reason:`SVG 包含不安全的脚本或外部资源`,valid:!1};for(let t of e.matchAll(b)){let e=t[1]?.trim();if(e&&![`currentColor`,`inherit`,`none`].includes(e)&&!e.startsWith(`url(#`))return{reason:`检测到固定颜色 ${e}`,valid:!1}}return{valid:!0}}function S(e){let t=e.filter(e=>x(e).valid);if(t.length===0)return``;let n=t[0].match(/<svg\b([^>]*)>/i)?.[1]?.trim(),r=t.map((e,t)=>`<g data-lumal-icon-layer="${t}">${e.replace(/^\s*<svg\b[^>]*>/i,``).replace(/<\/svg>\s*$/i,``)}</g>`).join(``);return`<svg${n?` ${n}`:``}>${r}</svg>`}function C(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function w(e,t=`currentColor`){return e.replace(y,t)}function T(e){return e.stops?.length?e.stops:[{offset:`0%`,color:e.from??`currentColor`},{offset:`100%`,color:e.to??e.from??`currentColor`}]}function E(e){let t=e.direction===`vertical`,n=T(e).map(e=>{let t=e.opacity==null?``:` stop-opacity="${e.opacity}"`;return`<stop offset="${e.offset}" stop-color="${e.color}"${t}/>`}).join(``);return`<defs><linearGradient id="${e.id}" x1="0%" y1="0%" x2="${t?`0%`:`100%`}" y2="${t?`100%`:`0%`}">${n}</linearGradient></defs>`}function D(e,t){let n=t.id??`lumal-icon-gradient`,r=E({...t,id:n});return e.replace(/<svg([^>]*)>/,`<svg$1>${r}`).replace(y,`url(#${n})`)}var O=new Map,k=256;function A(e,t){let n=O.get(e);if(n!==void 0)return n;let r=t();return O.size>=k&&O.delete(O.keys().next().value),O.set(e,r),r}function j(){O.clear()}function M(e){return v(e)?.svgText??``}function N(e,t){let n=M(e);return n?A(`${n}:${t??`currentColor`}`,()=>C(w(n,t))):``}function P(e,t){let n=M(e);return n?A(`${n}:${JSON.stringify(t)}`,()=>C(D(n,t))):``}s(t),exports.applySvgGradient=D,exports.builtinIconDefinitions=t,exports.clearIconDataUriCache=j,exports.composeSvgIcons=S,exports.createComponentIconDefinitions=u,exports.createIconifyIconDefinitions=d,exports.getGradientIconDataUri=P,exports.getIconDataUri=N,exports.getIconSvgText=M,exports.getRegisteredIconDefinitions=l,exports.getRegisteredIconGroups=p,exports.getStaticLocalSvgIconDefinitions=g,exports.recolorSvgString=w,exports.registerIconGroups=f,exports.registerIcons=s,exports.registerStaticLocalSvgIcons=h,exports.resolveAnyIconDefinition=v,exports.resolveIconDefinition=c,exports.resolveStaticLocalSvgIconDefinition=_,exports.subscribeIconRegistry=o,exports.svgToDataUri=C,exports.validateMonochromeSvg=x;
package/dist/index.js ADDED
@@ -0,0 +1,186 @@
1
+ //#region src/builtin-icons.ts
2
+ function e(e, t, n) {
3
+ return {
4
+ group: "lumal",
5
+ key: `lumal:${e}`,
6
+ label: t,
7
+ source: "local-svg",
8
+ svgText: `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">${n}</svg>`
9
+ };
10
+ }
11
+ var t = [
12
+ e("sun", "浅色模式", "<circle cx=\"12\" cy=\"12\" r=\"4\" fill=\"currentColor\"/><path d=\"M12 2v2M12 20v2M4.93 4.93l1.42 1.42M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.42-1.42M17.66 6.34l1.41-1.41\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>"),
13
+ e("moon", "深色模式", "<path d=\"M20.2 15.4A8.5 8.5 0 0 1 8.6 3.8 8.5 8.5 0 1 0 20.2 15.4Z\" fill=\"currentColor\"/>"),
14
+ e("monitor", "跟随系统", "<rect x=\"3\" y=\"4\" width=\"18\" height=\"13\" rx=\"2\" stroke=\"currentColor\" stroke-width=\"1.8\"/><path d=\"M8 21h8M12 17v4\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>"),
15
+ e("palette", "主题设置", "<path d=\"M12 3a9 9 0 0 0 0 18h1.3a2.2 2.2 0 0 0 1.56-3.76l-.38-.38a1.1 1.1 0 0 1 .78-1.86H17a4 4 0 0 0 3.72-5.47A9 9 0 0 0 12 3Z\" stroke=\"currentColor\" stroke-width=\"1.7\"/><circle cx=\"7.5\" cy=\"10\" r=\"1.2\" fill=\"currentColor\"/><circle cx=\"10.5\" cy=\"6.8\" r=\"1.2\" fill=\"currentColor\"/><circle cx=\"15\" cy=\"7.5\" r=\"1.2\" fill=\"currentColor\"/>"),
16
+ e("settings", "设置", "<path d=\"M12 8.5a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7Z\" stroke=\"currentColor\" stroke-width=\"1.8\"/><path d=\"m19.4 15 .1-1-.1-1 2-1.5-2-3.4-2.5 1a8 8 0 0 0-1.7-1L14.8 5h-4l-.4 3.1a8 8 0 0 0-1.7 1l-2.5-1-2 3.4 2 1.5-.1 1 .1 1-2 1.5 2 3.4 2.5-1a8 8 0 0 0 1.7 1l.4 3.1h4l.4-3.1a8 8 0 0 0 1.7-1l2.5 1 2-3.4-2-1.5Z\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-linejoin=\"round\"/>"),
17
+ e("reset", "恢复默认", "<path d=\"M4 7v5h5M5.5 11A7 7 0 1 1 7 18.5\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>"),
18
+ e("plus", "新增", "<path d=\"M12 5v14M5 12h14\" stroke=\"currentColor\" stroke-width=\"1.9\" stroke-linecap=\"round\"/>"),
19
+ e("filter", "筛选", "<path d=\"M4 5h16l-6.2 7.1v5.2l-3.6 1.8v-7L4 5Z\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linejoin=\"round\"/>"),
20
+ e("refresh", "刷新", "<path d=\"M20 7v5h-5M4 17v-5h5M18.5 11A7 7 0 0 0 6 7.5L4 10M5.5 13A7 7 0 0 0 18 16.5l2-2.5\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>"),
21
+ e("fullscreen", "全屏", "<path d=\"M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>"),
22
+ e("fullscreen-exit", "退出全屏", "<path d=\"M9 4v5H4M20 9h-5V4M15 20v-5h5M4 15h5v5\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>"),
23
+ e("grid", "列设置", "<rect x=\"4\" y=\"4\" width=\"6\" height=\"6\" rx=\"1\" stroke=\"currentColor\" stroke-width=\"1.7\"/><rect x=\"14\" y=\"4\" width=\"6\" height=\"6\" rx=\"1\" stroke=\"currentColor\" stroke-width=\"1.7\"/><rect x=\"4\" y=\"14\" width=\"6\" height=\"6\" rx=\"1\" stroke=\"currentColor\" stroke-width=\"1.7\"/><rect x=\"14\" y=\"14\" width=\"6\" height=\"6\" rx=\"1\" stroke=\"currentColor\" stroke-width=\"1.7\"/>"),
24
+ e("close", "关闭", "<path d=\"M6 6l12 12M18 6L6 18\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\"/>"),
25
+ e("chevron-left", "上一页", "<path d=\"M15 6l-6 6 6 6\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" fill=\"none\"/>"),
26
+ e("chevron-right", "下一页", "<path d=\"M9 6l6 6-6 6\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" fill=\"none\"/>"),
27
+ e("more", "更多", "<circle cx=\"5\" cy=\"12\" r=\"1.6\" fill=\"currentColor\"/><circle cx=\"12\" cy=\"12\" r=\"1.6\" fill=\"currentColor\"/><circle cx=\"19\" cy=\"12\" r=\"1.6\" fill=\"currentColor\"/>"),
28
+ e("pin", "固定", "<path d=\"M9 4h6l-1 6 4 3v2H6v-2l4-3-1-6Z\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linejoin=\"round\" fill=\"none\"/><path d=\"M12 14v6\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\"/>"),
29
+ e("pin-off", "取消固定", "<path d=\"M9 4h6l-1 6 4 3v2H6v-2l4-3-1-6Z\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linejoin=\"round\" fill=\"none\"/><path d=\"M12 14v6M4 4l16 16\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\"/>"),
30
+ e("external-link", "新窗口打开", "<path d=\"M14 4h6v6M20 4l-8 8M14 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\" fill=\"none\"/>"),
31
+ e("maximize", "内容最大化", "<path d=\"M8 3H3v5M16 3h5v5M3 16v5h5M21 16v5h-5\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\" fill=\"none\"/><path d=\"M3 12h18\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-linecap=\"round\" stroke-dasharray=\"2 3\" opacity=\"0.45\"/>"),
32
+ e("restore", "还原", "<path d=\"M8 3v3a2 2 0 0 1-2 2H3M16 3v3a2 2 0 0 0 2 2h3M3 16h3a2 2 0 0 1 2 2v3M21 16h-3a2 2 0 0 0-2 2v3\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\" fill=\"none\"/>")
33
+ ], n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
34
+ function a() {
35
+ for (let e of i) e();
36
+ }
37
+ function o(e) {
38
+ return i.add(e), () => {
39
+ i.delete(e);
40
+ };
41
+ }
42
+ //#endregion
43
+ //#region src/registry/icons.ts
44
+ function s(e) {
45
+ for (let t of e) n.set(t.key, t);
46
+ e.length && a();
47
+ }
48
+ function c(e) {
49
+ return n.get(e);
50
+ }
51
+ function l() {
52
+ return [...n.values()];
53
+ }
54
+ function u(e, t) {
55
+ return Object.entries(t).map(([t, n]) => ({
56
+ component: n,
57
+ group: e,
58
+ key: `${e}:${t}`,
59
+ label: t,
60
+ source: "component"
61
+ }));
62
+ }
63
+ function d(e, t) {
64
+ return t.map((t) => ({
65
+ group: e,
66
+ icon: t,
67
+ key: `${e}:${t}`,
68
+ label: t,
69
+ source: "iconify"
70
+ }));
71
+ }
72
+ //#endregion
73
+ //#region src/registry/groups.ts
74
+ function f(e) {
75
+ for (let t of e) r.set(t.key, t);
76
+ e.length && a();
77
+ }
78
+ function p() {
79
+ return [...r.values()].sort((e, t) => (e.order ?? 2 ** 53 - 1) - (t.order ?? 2 ** 53 - 1) || e.label.localeCompare(t.label));
80
+ }
81
+ //#endregion
82
+ //#region src/runtime/static-local.ts
83
+ var m = /* @__PURE__ */ new Map();
84
+ function h(e) {
85
+ for (let t of e) m.set(t.key, t);
86
+ s(e);
87
+ }
88
+ function g() {
89
+ return [...m.values()];
90
+ }
91
+ function _(e) {
92
+ return m.get(e) ?? c(e);
93
+ }
94
+ //#endregion
95
+ //#region src/runtime/resolver.ts
96
+ function v(e) {
97
+ return c(e) ?? _(e);
98
+ }
99
+ //#endregion
100
+ //#region src/runtime/svg.ts
101
+ var y = /currentColor/g, b = /(?:fill|stroke)=["']([^"']+)["']/gi;
102
+ function x(e) {
103
+ if (!/^\s*<svg\b[\s\S]*<\/svg>\s*$/i.test(e)) return {
104
+ reason: "内容不是完整 SVG",
105
+ valid: !1
106
+ };
107
+ if (/<script\b|\bon\w+\s*=|(?:href|src)=["']https?:/i.test(e)) return {
108
+ reason: "SVG 包含不安全的脚本或外部资源",
109
+ valid: !1
110
+ };
111
+ for (let t of e.matchAll(b)) {
112
+ let e = t[1]?.trim();
113
+ if (e && ![
114
+ "currentColor",
115
+ "inherit",
116
+ "none"
117
+ ].includes(e) && !e.startsWith("url(#")) return {
118
+ reason: `检测到固定颜色 ${e}`,
119
+ valid: !1
120
+ };
121
+ }
122
+ return { valid: !0 };
123
+ }
124
+ function S(e) {
125
+ let t = e.filter((e) => x(e).valid);
126
+ if (t.length === 0) return "";
127
+ let n = t[0].match(/<svg\b([^>]*)>/i)?.[1]?.trim(), r = t.map((e, t) => `<g data-lumal-icon-layer="${t}">${e.replace(/^\s*<svg\b[^>]*>/i, "").replace(/<\/svg>\s*$/i, "")}</g>`).join("");
128
+ return `<svg${n ? ` ${n}` : ""}>${r}</svg>`;
129
+ }
130
+ function C(e) {
131
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`;
132
+ }
133
+ function w(e, t = "currentColor") {
134
+ return e.replace(y, t);
135
+ }
136
+ function T(e) {
137
+ return e.stops?.length ? e.stops : [{
138
+ offset: "0%",
139
+ color: e.from ?? "currentColor"
140
+ }, {
141
+ offset: "100%",
142
+ color: e.to ?? e.from ?? "currentColor"
143
+ }];
144
+ }
145
+ function E(e) {
146
+ let t = e.direction === "vertical", n = T(e).map((e) => {
147
+ let t = e.opacity == null ? "" : ` stop-opacity="${e.opacity}"`;
148
+ return `<stop offset="${e.offset}" stop-color="${e.color}"${t}/>`;
149
+ }).join("");
150
+ return `<defs><linearGradient id="${e.id}" x1="0%" y1="0%" x2="${t ? "0%" : "100%"}" y2="${t ? "100%" : "0%"}">${n}</linearGradient></defs>`;
151
+ }
152
+ function D(e, t) {
153
+ let n = t.id ?? "lumal-icon-gradient", r = E({
154
+ ...t,
155
+ id: n
156
+ });
157
+ return e.replace(/<svg([^>]*)>/, `<svg$1>${r}`).replace(y, `url(#${n})`);
158
+ }
159
+ //#endregion
160
+ //#region src/runtime/data-uri.ts
161
+ var O = /* @__PURE__ */ new Map(), k = 256;
162
+ function A(e, t) {
163
+ let n = O.get(e);
164
+ if (n !== void 0) return n;
165
+ let r = t();
166
+ return O.size >= k && O.delete(O.keys().next().value), O.set(e, r), r;
167
+ }
168
+ function j() {
169
+ O.clear();
170
+ }
171
+ function M(e) {
172
+ return v(e)?.svgText ?? "";
173
+ }
174
+ function N(e, t) {
175
+ let n = M(e);
176
+ return n ? A(`${n}:${t ?? "currentColor"}`, () => C(w(n, t))) : "";
177
+ }
178
+ function P(e, t) {
179
+ let n = M(e);
180
+ return n ? A(`${n}:${JSON.stringify(t)}`, () => C(D(n, t))) : "";
181
+ }
182
+ //#endregion
183
+ //#region src/index.ts
184
+ s(t);
185
+ //#endregion
186
+ export { D as applySvgGradient, t as builtinIconDefinitions, j as clearIconDataUriCache, S as composeSvgIcons, u as createComponentIconDefinitions, d as createIconifyIconDefinitions, P as getGradientIconDataUri, N as getIconDataUri, M as getIconSvgText, l as getRegisteredIconDefinitions, p as getRegisteredIconGroups, g as getStaticLocalSvgIconDefinitions, w as recolorSvgString, f as registerIconGroups, s as registerIcons, h as registerStaticLocalSvgIcons, v as resolveAnyIconDefinition, c as resolveIconDefinition, _ as resolveStaticLocalSvgIconDefinition, o as subscribeIconRegistry, C as svgToDataUri, x as validateMonochromeSvg };
@@ -0,0 +1,3 @@
1
+ import type { IconDefinition } from './types';
2
+ export declare const builtinIconDefinitions: IconDefinition[];
3
+ //# sourceMappingURL=builtin-icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin-icons.d.ts","sourceRoot":"","sources":["../../src/builtin-icons.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAY7C,eAAO,MAAM,sBAAsB,EAAE,cAAc,EAsBlD,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { builtinIconDefinitions } from './builtin-icons';
2
+ export { builtinIconDefinitions };
3
+ export { getRegisteredIconGroups, registerIconGroups, } from './registry/groups';
4
+ /***********************图标能力导出*********************/
5
+ export { createComponentIconDefinitions, createIconifyIconDefinitions, getRegisteredIconDefinitions, registerIcons, resolveIconDefinition, } from './registry/icons';
6
+ export { subscribeIconRegistry } from './registry/state';
7
+ export type { IconRegistryListener } from './registry/state';
8
+ export { applySvgGradient, clearIconDataUriCache, composeSvgIcons, getGradientIconDataUri, getIconDataUri, getIconSvgText, getStaticLocalSvgIconDefinitions, recolorSvgString, registerStaticLocalSvgIcons, resolveAnyIconDefinition, resolveStaticLocalSvgIconDefinition, svgToDataUri, validateMonochromeSvg, } from './runtime';
9
+ export type { SvgValidationResult } from './runtime';
10
+ export type { IconDefinition, IconGradientOptions, IconGradientStop, IconGroupDefinition, IconKey, IconSource, } from './types';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAKxD,OAAO,EAAE,sBAAsB,EAAE,CAAA;AAEjC,OAAO,EACL,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,mBAAmB,CAAA;AAC1B,oDAAoD;AACpD,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,4BAA4B,EAC5B,aAAa,EACb,qBAAqB,GACtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AACxD,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,gCAAgC,EAChC,gBAAgB,EAChB,2BAA2B,EAC3B,wBAAwB,EACxB,mCAAmC,EACnC,YAAY,EACZ,qBAAqB,GACtB,MAAM,WAAW,CAAA;AAClB,YAAY,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AACpD,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,OAAO,EACP,UAAU,GACX,MAAM,SAAS,CAAA"}
@@ -0,0 +1,6 @@
1
+ import type { IconGroupDefinition } from '../types';
2
+ /***********************分组注册*********************/
3
+ export declare function registerIconGroups(groups: IconGroupDefinition[]): void;
4
+ /***********************分组读取*********************/
5
+ export declare function getRegisteredIconGroups(): IconGroupDefinition[];
6
+ //# sourceMappingURL=groups.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../../src/registry/groups.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAGnD,kDAAkD;AAClD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAQtE;AAED,kDAAkD;AAClD,wBAAgB,uBAAuB,IAAI,mBAAmB,EAAE,CAK/D"}
@@ -0,0 +1,9 @@
1
+ import type { IconDefinition, IconKey } from '../types';
2
+ /***********************图标注册*********************/
3
+ export declare function registerIcons(icons: IconDefinition[]): void;
4
+ /***********************图标读取*********************/
5
+ export declare function resolveIconDefinition(key: IconKey): IconDefinition | undefined;
6
+ export declare function getRegisteredIconDefinitions(): IconDefinition[];
7
+ export declare function createComponentIconDefinitions<TComponent>(group: string, icons: Record<string, TComponent>): IconDefinition<TComponent>[];
8
+ export declare function createIconifyIconDefinitions(group: string, icons: string[]): IconDefinition[];
9
+ //# sourceMappingURL=icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/registry/icons.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAGvD,kDAAkD;AAClD,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,CAQ3D;AAED,kDAAkD;AAClD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAE9E;AAED,wBAAgB,4BAA4B,IAAI,cAAc,EAAE,CAE/D;AAED,wBAAgB,8BAA8B,CAAC,UAAU,EACvD,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAChC,cAAc,CAAC,UAAU,CAAC,EAAE,CAQ9B;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,CAQ7F"}
@@ -0,0 +1,8 @@
1
+ import type { IconDefinition, IconGroupDefinition } from '../types';
2
+ /***********************注册表状态*********************/
3
+ export declare const iconDefinitions: Map<string, IconDefinition<unknown>>;
4
+ export declare const iconGroups: Map<string, IconGroupDefinition>;
5
+ export type IconRegistryListener = () => void;
6
+ export declare function notifyIconRegistryChange(): void;
7
+ export declare function subscribeIconRegistry(listener: IconRegistryListener): () => void;
8
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/registry/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAW,MAAM,UAAU,CAAA;AAE5E,mDAAmD;AACnD,eAAO,MAAM,eAAe,sCAAqC,CAAA;AAEjE,eAAO,MAAM,UAAU,kCAAyC,CAAA;AAEhE,MAAM,MAAM,oBAAoB,GAAG,MAAM,IAAI,CAAA;AAI7C,wBAAgB,wBAAwB,IAAI,IAAI,CAI/C;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,IAAI,CAMhF"}
@@ -0,0 +1,8 @@
1
+ import type { IconGradientOptions } from '../types';
2
+ export declare function clearIconDataUriCache(): void;
3
+ /***********************SVG 文本读取*********************/
4
+ export declare function getIconSvgText(key: string): string;
5
+ /***********************Data URI 生成*********************/
6
+ export declare function getIconDataUri(key: string, color?: string): string;
7
+ export declare function getGradientIconDataUri(key: string, gradient: IconGradientOptions): string;
8
+ //# sourceMappingURL=data-uri.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-uri.d.ts","sourceRoot":"","sources":["../../../src/runtime/data-uri.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAqBnD,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED,sDAAsD;AACtD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIlD;AAED,yDAAyD;AACzD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAUlE;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,GAAG,MAAM,CAUzF"}
@@ -0,0 +1,6 @@
1
+ export { clearIconDataUriCache, getGradientIconDataUri, getIconDataUri, getIconSvgText, } from './data-uri';
2
+ export { resolveAnyIconDefinition } from './resolver';
3
+ export { getStaticLocalSvgIconDefinitions, registerStaticLocalSvgIcons, resolveStaticLocalSvgIconDefinition, } from './static-local';
4
+ export { applySvgGradient, composeSvgIcons, recolorSvgString, svgToDataUri, validateMonochromeSvg, } from './svg';
5
+ export type { SvgValidationResult } from './svg';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,cAAc,GACf,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,EACL,gCAAgC,EAChC,2BAA2B,EAC3B,mCAAmC,GACpC,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,GACtB,MAAM,OAAO,CAAA;AACd,YAAY,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { IconDefinition } from '../types';
2
+ /***********************图标解析*********************/
3
+ export declare function resolveAnyIconDefinition(key: string): IconDefinition | undefined;
4
+ //# sourceMappingURL=resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../src/runtime/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAI9C,kDAAkD;AAClD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAEhF"}
@@ -0,0 +1,7 @@
1
+ import type { IconDefinition } from '../types';
2
+ /***********************静态本地图标注册*********************/
3
+ export declare function registerStaticLocalSvgIcons(icons: IconDefinition[]): void;
4
+ /***********************静态本地图标读取*********************/
5
+ export declare function getStaticLocalSvgIconDefinitions(): IconDefinition[];
6
+ export declare function resolveStaticLocalSvgIconDefinition(key: string): IconDefinition | undefined;
7
+ //# sourceMappingURL=static-local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static-local.d.ts","sourceRoot":"","sources":["../../../src/runtime/static-local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAK9C,sDAAsD;AACtD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,CAMzE;AAED,sDAAsD;AACtD,wBAAgB,gCAAgC,IAAI,cAAc,EAAE,CAEnE;AAED,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAE3F"}
@@ -0,0 +1,13 @@
1
+ import type { IconGradientOptions } from '../types';
2
+ export interface SvgValidationResult {
3
+ reason?: string;
4
+ valid: boolean;
5
+ }
6
+ export declare function validateMonochromeSvg(svgText: string): SvgValidationResult;
7
+ export declare function composeSvgIcons(svgTexts: string[]): string;
8
+ /***********************SVG 编码*********************/
9
+ export declare function svgToDataUri(svgText: string): string;
10
+ /***********************SVG 改色*********************/
11
+ export declare function recolorSvgString(svgText: string, color?: string): string;
12
+ export declare function applySvgGradient(svgText: string, options: IconGradientOptions): string;
13
+ //# sourceMappingURL=svg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg.d.ts","sourceRoot":"","sources":["../../../src/runtime/svg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAoB,MAAM,UAAU,CAAA;AAKrE,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;CACf;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAiB1E;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAa1D;AAED,oDAAoD;AACpD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,oDAAoD;AACpD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,SAAiB,GAAG,MAAM,CAEhF;AA0BD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAMtF"}
@@ -0,0 +1,31 @@
1
+ /***********************图标基础类型*********************/
2
+ export type IconKey = string;
3
+ export type IconSource = 'local-svg' | 'iconify' | 'component';
4
+ export interface IconDefinition<TComponent = unknown> {
5
+ key: IconKey;
6
+ label?: string;
7
+ group?: string;
8
+ source: IconSource;
9
+ svgText?: string;
10
+ icon?: string;
11
+ component?: TComponent;
12
+ }
13
+ export interface IconGroupDefinition {
14
+ key: string;
15
+ label: string;
16
+ order?: number;
17
+ }
18
+ /***********************图标渐变类型*********************/
19
+ export interface IconGradientStop {
20
+ offset: string;
21
+ color: string;
22
+ opacity?: number;
23
+ }
24
+ export interface IconGradientOptions {
25
+ id?: string;
26
+ from?: string;
27
+ to?: string;
28
+ stops?: IconGradientStop[];
29
+ direction?: 'horizontal' | 'vertical';
30
+ }
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,MAAM,MAAM,OAAO,GAAG,MAAM,CAAA;AAE5B,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,CAAA;AAE9D,MAAM,WAAW,cAAc,CAAC,UAAU,GAAG,OAAO;IAClD,GAAG,EAAE,OAAO,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,UAAU,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,UAAU,CAAA;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,oDAAoD;AACpD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC1B,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;CACtC"}
@@ -0,0 +1,3 @@
1
+ export { createStaticLocalSvgIconsPlugin, } from './static-local-svg-icons';
2
+ export type { CreateStaticLocalSvgIconsPluginOptions, StaticLocalSvgIconsManifestSource, } from './static-local-svg-icons';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vite/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,+BAA+B,GAChC,MAAM,0BAA0B,CAAA;AACjC,YAAY,EACV,sCAAsC,EACtC,iCAAiC,GAClC,MAAM,0BAA0B,CAAA"}
@@ -0,0 +1,17 @@
1
+ export interface StaticLocalSvgIconsManifestSource {
2
+ import: string;
3
+ exportName?: string;
4
+ }
5
+ export interface CreateStaticLocalSvgIconsPluginOptions {
6
+ localSvg?: StaticLocalSvgIconsManifestSource | string | false;
7
+ }
8
+ interface VitePluginLike {
9
+ name: string;
10
+ enforce?: 'pre' | 'post';
11
+ resolveId?: (source: string) => string | null | undefined;
12
+ load?: (id: string) => string | null | undefined;
13
+ }
14
+ /***********************静态 SVG 注入插件*********************/
15
+ export declare function createStaticLocalSvgIconsPlugin(options?: CreateStaticLocalSvgIconsPluginOptions): VitePluginLike;
16
+ export {};
17
+ //# sourceMappingURL=static-local-svg-icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static-local-svg-icons.d.ts","sourceRoot":"","sources":["../../../src/vite/static-local-svg-icons.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iCAAiC;IAChD,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,sCAAsC;IACrD,QAAQ,CAAC,EAAE,iCAAiC,GAAG,MAAM,GAAG,KAAK,CAAA;CAC9D;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACxB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACzD,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CACjD;AAgBD,yDAAyD;AACzD,wBAAgB,+BAA+B,CAC7C,OAAO,GAAE,sCAA2C,GACnD,cAAc,CA+BhB"}
package/dist/vite.cjs ADDED
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`\0@lumal/icons/static-local-svg`,t=`@lumal/icons`;function n(e){if(e)return typeof e==`string`?{import:e}:e}function r(r={}){let i=n(r.localSvg);return{name:`lumal:static-local-svg-icons`,enforce:`pre`,resolveId(n){return!i||n!==t?null:e},load(n){if(!i||n!==e)return null;let r=JSON.stringify(i.import);return[i.exportName?`import { ${i.exportName} as staticLocalSvgIcons } from ${r};`:`import staticLocalSvgIcons from ${r};`,`export * from ${JSON.stringify(t)};`,`import { registerStaticLocalSvgIcons } from "@lumal/icons";`,`registerStaticLocalSvgIcons(Array.isArray(staticLocalSvgIcons) ? staticLocalSvgIcons : []);`].join(`
2
+ `)}}}exports.createStaticLocalSvgIconsPlugin=r;
package/dist/vite.js ADDED
@@ -0,0 +1,27 @@
1
+ //#region src/vite/static-local-svg-icons.ts
2
+ var e = "\0@lumal/icons/static-local-svg", t = "@lumal/icons";
3
+ function n(e) {
4
+ if (e) return typeof e == "string" ? { import: e } : e;
5
+ }
6
+ function r(r = {}) {
7
+ let i = n(r.localSvg);
8
+ return {
9
+ name: "lumal:static-local-svg-icons",
10
+ enforce: "pre",
11
+ resolveId(n) {
12
+ return !i || n !== t ? null : e;
13
+ },
14
+ load(n) {
15
+ if (!i || n !== e) return null;
16
+ let r = JSON.stringify(i.import);
17
+ return [
18
+ i.exportName ? `import { ${i.exportName} as staticLocalSvgIcons } from ${r};` : `import staticLocalSvgIcons from ${r};`,
19
+ `export * from ${JSON.stringify(t)};`,
20
+ "import { registerStaticLocalSvgIcons } from \"@lumal/icons\";",
21
+ "registerStaticLocalSvgIcons(Array.isArray(staticLocalSvgIcons) ? staticLocalSvgIcons : []);"
22
+ ].join("\n");
23
+ }
24
+ };
25
+ }
26
+ //#endregion
27
+ export { r as createStaticLocalSvgIconsPlugin };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@lumal/icons",
3
+ "type": "module",
4
+ "version": "0.0.1-beta",
5
+ "description": "Framework-agnostic Lumal icon registry and SVG utilities.",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "lumal",
9
+ "icons",
10
+ "iconify",
11
+ "svg"
12
+ ],
13
+ "sideEffects": false,
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/src/index.d.ts",
20
+ "import": "./dist/index.js",
21
+ "require": "./dist/index.cjs"
22
+ },
23
+ "./vite": {
24
+ "types": "./dist/src/vite/index.d.ts",
25
+ "import": "./dist/vite.js",
26
+ "require": "./dist/vite.cjs"
27
+ }
28
+ },
29
+ "main": "./dist/index.cjs",
30
+ "module": "./dist/index.js",
31
+ "types": "./dist/src/index.d.ts",
32
+ "files": [
33
+ "README.md",
34
+ "dist"
35
+ ],
36
+ "scripts": {
37
+ "build": "vite build --config vite.config.ts && tsc -p tsconfig.json --emitDeclarationOnly && node ../../scripts/clean-package-dist.mjs dist",
38
+ "typecheck": "tsc --noEmit -p tsconfig.json",
39
+ "test": "vitest run --config ../../vitest.config.ts tests"
40
+ }
41
+ }