@ui0/icon 0.0.0-stage → 0.1.1
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/dist/defaults.d.ts +14 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/framework.d.ts +30 -0
- package/dist/framework.d.ts.map +1 -0
- package/dist/getIcon.d.ts +3 -0
- package/dist/getIcon.d.ts.map +1 -0
- package/dist/helpers.d.ts +32 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/icon.config.d.ts +22 -0
- package/dist/icon.config.d.ts.map +1 -0
- package/dist/icon.d.ts +26 -0
- package/dist/icon.d.ts.map +1 -0
- package/dist/icon.module.css +21 -0
- package/dist/icon.vue.d.ts +5 -0
- package/dist/icon.vue.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +496 -0
- package/dist/keys.d.ts +5 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/plugin.d.ts +23 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +218 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/ui0/index.d.ts +8 -0
- package/dist/ui0/index.d.ts.map +1 -0
- package/dist/ui0/index.js +19 -0
- package/dist/util.d.ts +33 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/vite/blocks/index.d.ts +9 -0
- package/dist/vite/blocks/index.d.ts.map +1 -0
- package/dist/vite/compose.d.ts +68 -0
- package/dist/vite/compose.d.ts.map +1 -0
- package/dist/vite/index.d.ts +6 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +829 -0
- package/dist/vite/options.d.ts +51 -0
- package/dist/vite/options.d.ts.map +1 -0
- package/dist/vite/transformer.d.ts +47 -0
- package/dist/vite/transformer.d.ts.map +1 -0
- package/dist/vite/types.d.ts +57 -0
- package/dist/vite/types.d.ts.map +1 -0
- package/dist/vite/util.d.ts +66 -0
- package/dist/vite/util.d.ts.map +1 -0
- package/dist/vite/xml-parser.d.ts +48 -0
- package/dist/vite/xml-parser.d.ts.map +1 -0
- package/package.json +64 -4
- package/README.md +0 -3
|
@@ -0,0 +1,829 @@
|
|
|
1
|
+
var et = Object.defineProperty;
|
|
2
|
+
var st = (i, t, s) => t in i ? et(i, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[t] = s;
|
|
3
|
+
var M = (i, t, s) => st(i, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
+
import I from "node:path";
|
|
5
|
+
import { createFilter as z } from "vite";
|
|
6
|
+
import J from "node:fs";
|
|
7
|
+
const it = `<svg width="960" height="960" viewBox="0 0 960 960">>
|
|
8
|
+
<path class="no-fill" d="M340 340 C494.6 340 620 465.4 620 620" />
|
|
9
|
+
</svg>
|
|
10
|
+
`, rt = `<svg width="960" height="960" viewBox="0 0 960 960">
|
|
11
|
+
<path class="no-fill" d="M480 600 L480 360 M480 360 L395.1 444.9 M480 360 L564.9 444.9"/>
|
|
12
|
+
</svg>
|
|
13
|
+
`, at = `<svg width="960" height="960" viewBox="0 0 960 960">
|
|
14
|
+
|
|
15
|
+
<polyline points="347.69,546.155 480,413.845 612.31,546.155"/>
|
|
16
|
+
|
|
17
|
+
</svg>
|
|
18
|
+
`, nt = `<svg viewBox="0 0 960 960">
|
|
19
|
+
<circle cx="480" cy="480" r="320"/>
|
|
20
|
+
</svg>
|
|
21
|
+
`, ot = `<svg>
|
|
22
|
+
<path class="no-fill" d="M480,480h280c0,74.2-29.5,145.5-82,198-52.5,52.5-123.8,82-198,82v-280Z"/>
|
|
23
|
+
</svg>
|
|
24
|
+
`, ct = `<svg viewBox="0 0 960 960"><circle cx="480" cy="480" r="60"/></svg>
|
|
25
|
+
`, lt = `<svg data-icon="utility no-progress" viewBox="0 0 960 960">
|
|
26
|
+
<path d="M441.3,253.9c17.2-29.8,60.2-29.8,77.4,0l117.6,203.8,117.6,203.8c17.2,29.8-4.3,67-38.7,67H244.7c-34.4,0-55.9-37.2-38.7-67l117.6-203.8,117.6-203.8Z"/>
|
|
27
|
+
</svg>
|
|
28
|
+
`, j = {
|
|
29
|
+
"arc-90": it,
|
|
30
|
+
arrow: rt,
|
|
31
|
+
chevron: at,
|
|
32
|
+
circle: nt,
|
|
33
|
+
"pie-90": ot,
|
|
34
|
+
point: ct,
|
|
35
|
+
triangle: lt
|
|
36
|
+
};
|
|
37
|
+
function k(i) {
|
|
38
|
+
return "file" in i;
|
|
39
|
+
}
|
|
40
|
+
const y = ".svg", A = "ui0-icon:";
|
|
41
|
+
function P(i, t, s, r = 480, e = 480) {
|
|
42
|
+
const c = i.split(/[\s,]+/).map(parseFloat), l = i.includes(",") ? "," : " ";
|
|
43
|
+
return c.map((u, p) => {
|
|
44
|
+
const o = p % 2 === 0, g = o ? r : e, d = o ? t : s;
|
|
45
|
+
return ((u - g) * d + g).toFixed(2);
|
|
46
|
+
}).reduce((u, p, o) => u + (o > 0 ? o % 2 === 0 ? " " : l : "") + p, "");
|
|
47
|
+
}
|
|
48
|
+
function Y(i, t) {
|
|
49
|
+
return i.replace(/([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/g, (s) => (parseFloat(s) * t).toFixed(2));
|
|
50
|
+
}
|
|
51
|
+
function G(i, t, s) {
|
|
52
|
+
const [r = 0, e = 0] = s, { x1: c, y1: l, x2: u, y2: p, ...o } = i, g = parseFloat(c).toFixed(3), d = parseFloat(l).toFixed(3), n = parseFloat(u).toFixed(3), h = parseFloat(p).toFixed(3), a = (f, x) => (x + (f - x) * t).toFixed(3);
|
|
53
|
+
return {
|
|
54
|
+
...o,
|
|
55
|
+
// Сохраняем остальные атрибуты
|
|
56
|
+
x1: a(+g, r),
|
|
57
|
+
y1: a(+d, e),
|
|
58
|
+
x2: a(+n, r),
|
|
59
|
+
y2: a(+h, e)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function V(i, t, s) {
|
|
63
|
+
const [r = 0, e = 0] = s, { x: c, y: l, width: u, height: p, ...o } = i, g = (d, n) => (n + (d - n) * t).toFixed(3);
|
|
64
|
+
return {
|
|
65
|
+
...o,
|
|
66
|
+
x: g(+c, r),
|
|
67
|
+
y: g(+l, e),
|
|
68
|
+
width: (+u * t).toFixed(3),
|
|
69
|
+
height: (+p * t).toFixed(3)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function T(i, t, s) {
|
|
73
|
+
return isNaN(t) || isNaN(s) ? i : i.replace(/([MLHVCSQTZmlhvcsqtaz])([^MLHVCSQTZmlhvcsqtaz]*)/gi, (r, e, c) => {
|
|
74
|
+
if (/^[Zz]$/.test(e)) return e;
|
|
75
|
+
const l = e === e.toLowerCase();
|
|
76
|
+
let u = e, p = 0;
|
|
77
|
+
return c.split(/[\s,]+/).filter(Boolean).forEach((o) => {
|
|
78
|
+
const g = parseFloat(o);
|
|
79
|
+
let d = o;
|
|
80
|
+
isNaN(g) || (l || (d = (p % 2 === 0 ? g + t : g + s).toFixed(3)), p++), u += (u === e ? "" : " ") + d;
|
|
81
|
+
}), u;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function ut(i) {
|
|
85
|
+
return i.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (t, s) => (s ? "-" : "") + t.toLowerCase());
|
|
86
|
+
}
|
|
87
|
+
function Z(i) {
|
|
88
|
+
return i.startsWith("@") || i.startsWith(":") ? i : i.replace(/[^a-zA-Z0-9]+(.)/g, (t, s) => s.toUpperCase()).replace(/^[A-Z]/, (t) => t.toLowerCase());
|
|
89
|
+
}
|
|
90
|
+
function ft(i) {
|
|
91
|
+
if (i.startsWith(A)) return i;
|
|
92
|
+
const t = i.split("?", 1)[0];
|
|
93
|
+
if (t) {
|
|
94
|
+
const r = t.replace(A, "").replace(y, "");
|
|
95
|
+
return `${A}${r}`;
|
|
96
|
+
}
|
|
97
|
+
return i;
|
|
98
|
+
}
|
|
99
|
+
function K(i) {
|
|
100
|
+
return i.split(/(\\|\/)/g).pop();
|
|
101
|
+
}
|
|
102
|
+
function dt(i) {
|
|
103
|
+
return i.replace(K(i) || "", "");
|
|
104
|
+
}
|
|
105
|
+
function ht(i) {
|
|
106
|
+
const t = K(i);
|
|
107
|
+
return t == null ? void 0 : t.split("?", 1)[0].replace(y, "");
|
|
108
|
+
}
|
|
109
|
+
function pt(i) {
|
|
110
|
+
let t;
|
|
111
|
+
try {
|
|
112
|
+
t = J.readFileSync(i);
|
|
113
|
+
} catch {
|
|
114
|
+
console.error(`${i} couldn't be loaded by loader, fallback to default loader`);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
return Buffer.from(t).toString();
|
|
118
|
+
}
|
|
119
|
+
function C(i) {
|
|
120
|
+
try {
|
|
121
|
+
return Buffer.from(J.readFileSync(i)).toString();
|
|
122
|
+
} catch {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function gt(i, t, s) {
|
|
127
|
+
const r = [];
|
|
128
|
+
for (let e = 0; e < i.length; e++) {
|
|
129
|
+
const c = i.indexOf(">", e);
|
|
130
|
+
if (i.startsWith(`<${t}`, e) && c > -1 && i[c - 1] !== "/" && r.push(e), i.startsWith(`</${t}>`, e) && r.length > 0 && r.pop() === s)
|
|
131
|
+
return e;
|
|
132
|
+
}
|
|
133
|
+
return -1;
|
|
134
|
+
}
|
|
135
|
+
const xt = [
|
|
136
|
+
"attributeName",
|
|
137
|
+
"repeatCount",
|
|
138
|
+
"repeatDur",
|
|
139
|
+
"keyTimes",
|
|
140
|
+
"keySplines",
|
|
141
|
+
"calcMode",
|
|
142
|
+
"viewBox",
|
|
143
|
+
"gradientUnits",
|
|
144
|
+
"gradientTransform",
|
|
145
|
+
"filterUnits",
|
|
146
|
+
"primitiveUnits",
|
|
147
|
+
"textLength",
|
|
148
|
+
"lengthAdjust",
|
|
149
|
+
"ariaHidden",
|
|
150
|
+
"ariaLabel"
|
|
151
|
+
], bt = [
|
|
152
|
+
"svg",
|
|
153
|
+
"g",
|
|
154
|
+
"path",
|
|
155
|
+
"rect",
|
|
156
|
+
"circle",
|
|
157
|
+
"ellipse",
|
|
158
|
+
"line",
|
|
159
|
+
"polyline",
|
|
160
|
+
"polygon",
|
|
161
|
+
"text",
|
|
162
|
+
"tspan",
|
|
163
|
+
"textPath",
|
|
164
|
+
"image",
|
|
165
|
+
"foreignObject",
|
|
166
|
+
"symbol",
|
|
167
|
+
"use",
|
|
168
|
+
"defs",
|
|
169
|
+
"clipPath",
|
|
170
|
+
"mask",
|
|
171
|
+
"pattern",
|
|
172
|
+
"marker",
|
|
173
|
+
"linearGradient",
|
|
174
|
+
"radialGradient",
|
|
175
|
+
"stop",
|
|
176
|
+
"filter",
|
|
177
|
+
"feBlend",
|
|
178
|
+
"feColorMatrix",
|
|
179
|
+
"feComponentTransfer",
|
|
180
|
+
"feComposite",
|
|
181
|
+
"feConvolveMatrix",
|
|
182
|
+
"feDiffuseLighting",
|
|
183
|
+
"feDisplacementMap",
|
|
184
|
+
"feDistantLight",
|
|
185
|
+
"feDropShadow",
|
|
186
|
+
"feFlood",
|
|
187
|
+
"feFuncA",
|
|
188
|
+
"feFuncB",
|
|
189
|
+
"feFuncG",
|
|
190
|
+
"feFuncR",
|
|
191
|
+
"feGaussianBlur",
|
|
192
|
+
"feImage",
|
|
193
|
+
"feMerge",
|
|
194
|
+
"feMergeNode",
|
|
195
|
+
"feMorphology",
|
|
196
|
+
"feOffset",
|
|
197
|
+
"fePointLight",
|
|
198
|
+
"feSpecularLighting",
|
|
199
|
+
"feSpotLight",
|
|
200
|
+
"feTile",
|
|
201
|
+
"feTurbulence",
|
|
202
|
+
"animate",
|
|
203
|
+
"animateMotion",
|
|
204
|
+
"animateTransform",
|
|
205
|
+
"set",
|
|
206
|
+
"script",
|
|
207
|
+
"style",
|
|
208
|
+
"title",
|
|
209
|
+
"desc",
|
|
210
|
+
"metadata",
|
|
211
|
+
"view",
|
|
212
|
+
"a",
|
|
213
|
+
"switch"
|
|
214
|
+
];
|
|
215
|
+
function mt(i, t) {
|
|
216
|
+
return bt.includes(i.tag) ? !xt.includes(t) : !0;
|
|
217
|
+
}
|
|
218
|
+
class $ {
|
|
219
|
+
static createNode(t = {}) {
|
|
220
|
+
return {
|
|
221
|
+
tag: "node",
|
|
222
|
+
children: [],
|
|
223
|
+
attributes: {},
|
|
224
|
+
parent: null,
|
|
225
|
+
content: "",
|
|
226
|
+
raw: "",
|
|
227
|
+
...t,
|
|
228
|
+
getAttr(s) {
|
|
229
|
+
return this.attributes[s] ?? null;
|
|
230
|
+
},
|
|
231
|
+
setAttr(s, r) {
|
|
232
|
+
this.attributes[s] = r;
|
|
233
|
+
},
|
|
234
|
+
hasAttr(s) {
|
|
235
|
+
return Z(s) in this.attributes;
|
|
236
|
+
},
|
|
237
|
+
/**
|
|
238
|
+
* Is node is child of node or any of nodes
|
|
239
|
+
* @param child
|
|
240
|
+
* @param parent
|
|
241
|
+
*/
|
|
242
|
+
isChildOf(s) {
|
|
243
|
+
if (!s) return !1;
|
|
244
|
+
const r = Array.isArray(s) ? s : [s];
|
|
245
|
+
for (const e of r) {
|
|
246
|
+
let c = this.parent;
|
|
247
|
+
for (; c !== null; ) {
|
|
248
|
+
if (c === e)
|
|
249
|
+
return !0;
|
|
250
|
+
c = c.parent;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return !1;
|
|
254
|
+
},
|
|
255
|
+
hasClass(s) {
|
|
256
|
+
return !!(this.attributes.class && this.attributes.class.split(" ").includes(s));
|
|
257
|
+
},
|
|
258
|
+
walk(s) {
|
|
259
|
+
return $.walk(this, s);
|
|
260
|
+
},
|
|
261
|
+
serialize() {
|
|
262
|
+
return $.serialize(this);
|
|
263
|
+
},
|
|
264
|
+
addClass(s) {
|
|
265
|
+
const r = this.attributes.class.split(" ");
|
|
266
|
+
r.includes(s) || (r.push(s), this.attributes.class = r.join(" "));
|
|
267
|
+
},
|
|
268
|
+
addStyle(s) {
|
|
269
|
+
this.hasAttr("style") ? this.attributes.style += s + ";" : this.attributes.style = s + ";";
|
|
270
|
+
},
|
|
271
|
+
removeClass(s) {
|
|
272
|
+
const r = this.attributes.class.split(" ");
|
|
273
|
+
r.includes(s) && (r.splice(r.indexOf(s), 1), this.attributes.class = r.join(" "));
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
// todo when exists end tag between quotes - "something >" parser have issues
|
|
278
|
+
static parse(t, s, r = {}) {
|
|
279
|
+
let e = t.replace(/\r?\n/g, " ").replace(/\s+/g, " ").trim();
|
|
280
|
+
const c = [], { parent: l = null } = r;
|
|
281
|
+
for (; e.length > 0; ) {
|
|
282
|
+
if (e.startsWith("<!--")) {
|
|
283
|
+
const x = e.indexOf("-->") + 3;
|
|
284
|
+
e = e.slice(x).trim();
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
if (e.startsWith("<?")) {
|
|
288
|
+
const x = e.indexOf("?>") + 2;
|
|
289
|
+
e = e.slice(x).trim();
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
if (e.startsWith("<![CDATA[")) {
|
|
293
|
+
const x = e.indexOf("]]>") + 3;
|
|
294
|
+
e = e.slice(x).trim();
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
if (e.startsWith("<!")) {
|
|
298
|
+
const x = e.indexOf(">") + 1;
|
|
299
|
+
e = e.slice(x).trim();
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
if (e.startsWith("</")) {
|
|
303
|
+
const x = e.indexOf(">");
|
|
304
|
+
if (x === -1) break;
|
|
305
|
+
e = e.slice(x + 1).trim();
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
if (!e.startsWith("<")) {
|
|
309
|
+
const x = e.indexOf("<"), b = x === -1 ? e : e.slice(0, x), v = this.createNode({
|
|
310
|
+
tag: "#text",
|
|
311
|
+
attributes: {},
|
|
312
|
+
children: [],
|
|
313
|
+
parent: l,
|
|
314
|
+
content: b,
|
|
315
|
+
raw: b
|
|
316
|
+
}), m = s ? s(v) : v;
|
|
317
|
+
m && c.push(...Array.isArray(m) ? m : [m]), e = x === -1 ? "" : e.slice(x);
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
const u = e.indexOf(">");
|
|
321
|
+
if (u === -1) break;
|
|
322
|
+
const p = e[u - 1] === "/", o = e.slice(1, p ? u - 1 : u), g = o.indexOf(" "), d = g === -1 ? o : o.slice(0, g), n = g === -1 ? "" : o.slice(g + 1), h = this.createNode({
|
|
323
|
+
tag: d,
|
|
324
|
+
attributes: this.parseAttributes(n),
|
|
325
|
+
children: [],
|
|
326
|
+
parent: l,
|
|
327
|
+
content: "",
|
|
328
|
+
raw: ""
|
|
329
|
+
// Will be set later
|
|
330
|
+
});
|
|
331
|
+
let a = u + 1;
|
|
332
|
+
if (!p) {
|
|
333
|
+
const x = `</${d}>`, b = gt(e, d, 0);
|
|
334
|
+
b !== -1 && (h.raw = e.slice(a, b), h.content = h.raw.slice(0, b - a), h.raw.includes("<") && (h.children = this.parse(h.raw, s, { parent: h })), a = b + x.length);
|
|
335
|
+
}
|
|
336
|
+
const f = s ? s(h) : h;
|
|
337
|
+
f ? c.push(...Array.isArray(f) ? f : [f]) : h.parent && (h.parent.content = h.parent.content.replace(this.serialize(h), "")), e = e.slice(a).trim();
|
|
338
|
+
}
|
|
339
|
+
return c;
|
|
340
|
+
}
|
|
341
|
+
static parseAsSingle(t, s, r = {}) {
|
|
342
|
+
return this.parse(t, s, r)[0];
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Serialize
|
|
346
|
+
* @param node Node or nodes to serialize
|
|
347
|
+
* @returns XML string
|
|
348
|
+
*/
|
|
349
|
+
static serialize(t) {
|
|
350
|
+
if (Array.isArray(t))
|
|
351
|
+
return t.map((e) => this.serialize(e)).join("");
|
|
352
|
+
const s = Object.entries(t.attributes).map(([e, c]) => ` ${mt(t, e) ? ut(e) : e}="${c}"`).join(""), r = t.children.map((e) => this.serialize(e)).join("");
|
|
353
|
+
return t.children.length === 0 ? t.content ? `<${t.tag}${s}>${t.content}</${t.tag}>` : `<${t.tag}${s}/>` : `<${t.tag}${s}>${r}</${t.tag}>`;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* walk nodes with callback
|
|
357
|
+
* if callback returns false, stop traversal
|
|
358
|
+
* @param node Root node or nodes
|
|
359
|
+
* @param onEntry
|
|
360
|
+
* @param options Optional traversal options
|
|
361
|
+
*/
|
|
362
|
+
static walk(t, s, r) {
|
|
363
|
+
const e = Array.isArray(t) ? t : [t], c = (r == null ? void 0 : r.includeText) ?? !0, l = (u) => {
|
|
364
|
+
(u.tag !== "#text" || c) && s(u) === !1 || u.children.forEach((p) => l(p));
|
|
365
|
+
};
|
|
366
|
+
e.forEach(l);
|
|
367
|
+
}
|
|
368
|
+
static clone(t, s = null) {
|
|
369
|
+
const r = this.createNode({
|
|
370
|
+
tag: t.tag,
|
|
371
|
+
attributes: { ...t.attributes },
|
|
372
|
+
children: [],
|
|
373
|
+
parent: s,
|
|
374
|
+
content: t.content,
|
|
375
|
+
raw: t.raw
|
|
376
|
+
});
|
|
377
|
+
return r.children = t.children.map((e) => this.clone(e, r)), r;
|
|
378
|
+
}
|
|
379
|
+
static parseAttributes(t) {
|
|
380
|
+
const s = {}, r = /([^\s=]+)="([^"]*)"/g;
|
|
381
|
+
let e;
|
|
382
|
+
for (; (e = r.exec(t)) !== null; )
|
|
383
|
+
s[Z(e[1])] = e[2];
|
|
384
|
+
return s;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
const D = 90, H = 720, U = 8 / 9;
|
|
388
|
+
function B(i, t, s) {
|
|
389
|
+
const [r, e] = s.split("-").map(Number), c = H / t, l = H / i;
|
|
390
|
+
return { x: D + (e - 1) * c, y: D + (r - 1) * l, width: c, height: l };
|
|
391
|
+
}
|
|
392
|
+
function X(i) {
|
|
393
|
+
const t = i.width * U, s = i.height * U;
|
|
394
|
+
return {
|
|
395
|
+
x: i.x + (i.width - t) / 2,
|
|
396
|
+
y: i.y + (i.height - s) / 2,
|
|
397
|
+
width: t,
|
|
398
|
+
height: s
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
const w = 960;
|
|
402
|
+
function vt(i) {
|
|
403
|
+
const t = i.indexOf("?"), s = t === -1 ? void 0 : i.slice(t), r = t === -1 ? i : i.slice(0, t), e = r.indexOf("#"), c = e === -1 ? r : r.slice(0, e), [l, ...u] = c.split("."), p = e === -1 ? void 0 : r.slice(e + 1);
|
|
404
|
+
return {
|
|
405
|
+
name: l,
|
|
406
|
+
cell: p,
|
|
407
|
+
query: s,
|
|
408
|
+
modifiers: u.length ? u.map((o) => o.replace(/:/g, "-")) : void 0
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
function wt(i) {
|
|
412
|
+
return i ? Object.fromEntries(
|
|
413
|
+
i.replace(/^\?/, "").split("&").filter(Boolean).map((t) => t.split("=", 2))
|
|
414
|
+
) : {};
|
|
415
|
+
}
|
|
416
|
+
const $t = { default: 1, small: 0.84210526, large: 1.16666667 };
|
|
417
|
+
function _(i) {
|
|
418
|
+
const t = $.parseAsSingle(i);
|
|
419
|
+
return !t || t.tag !== "svg" ? i : t.children.map((s) => $.serialize(s)).join("");
|
|
420
|
+
}
|
|
421
|
+
function At(i, t, s, r) {
|
|
422
|
+
const e = $.parseAsSingle(i);
|
|
423
|
+
if (!e) return;
|
|
424
|
+
let c;
|
|
425
|
+
const l = (p) => {
|
|
426
|
+
var o;
|
|
427
|
+
if (((o = p.attributes) == null ? void 0 : o.dataCell) === t) {
|
|
428
|
+
c = p;
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
p.children.forEach(l);
|
|
432
|
+
};
|
|
433
|
+
return l(e), c ? { markup: c.children.map((p) => $.serialize(p)).join(""), rect: X(B(s, r, t)) } : void 0;
|
|
434
|
+
}
|
|
435
|
+
function O(i, t, s = 0, r = 1) {
|
|
436
|
+
const e = s % 180 !== 0, c = e ? t.height : t.width, l = e ? t.width : t.height, u = Math.min(i.width / c, i.height / l) * r, p = i.x + i.width / 2, o = i.y + i.height / 2;
|
|
437
|
+
if (t.x === 0 && t.y === 0 && t.width === w && t.height === w)
|
|
438
|
+
return `translate(${p} ${o}) scale(${u}) rotate(${s}) translate(${-w / 2} ${-w / 2})`;
|
|
439
|
+
const g = p - c * u / 2 - (e ? t.y : t.x) * u, d = o - l * u / 2 - (e ? t.x : t.y) * u, n = t.x + c / 2, h = t.y + l / 2;
|
|
440
|
+
return `translate(${g} ${d}) scale(${u}) rotate(${s} ${n} ${h})`;
|
|
441
|
+
}
|
|
442
|
+
function E(i, t, s, r = /* @__PURE__ */ new Set()) {
|
|
443
|
+
var c;
|
|
444
|
+
if (r.has(i))
|
|
445
|
+
return console.warn(`[ui0-icon] virtual '${i}': circular composition skipped`), `<svg viewBox="0 0 ${w} ${w}"/>`;
|
|
446
|
+
r.add(i);
|
|
447
|
+
const e = [];
|
|
448
|
+
for (const [l, u] of Object.entries(t.cells)) {
|
|
449
|
+
const p = typeof u == "string" ? { value: u } : u, o = vt(p.value), g = wt(o.query);
|
|
450
|
+
g.weight !== void 0 && console.warn(`[ui0-icon] virtual '${i}': 'weight' is not supported yet (source '${p.value}')`);
|
|
451
|
+
const d = p.rotate ?? (g.rotate !== void 0 ? Number(g.rotate) : 0), n = $t[g.fit] ?? 1, h = (c = o.modifiers) != null && c.length ? ` class="${o.modifiers.join(" ")}"` : "", a = s(o.name);
|
|
452
|
+
if (!a) {
|
|
453
|
+
console.warn(`[ui0-icon] virtual '${i}': source '${p.value}' not found`);
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
const f = p.cell === "full" ? B(t.rows, t.cols, l) : X(B(t.rows, t.cols, l));
|
|
457
|
+
if (a.def && !k(a.def) && !a.svg) {
|
|
458
|
+
const b = E(o.name, a.def, s, new Set(r)), v = O(
|
|
459
|
+
f,
|
|
460
|
+
{ x: 0, y: 0, width: w, height: w },
|
|
461
|
+
d,
|
|
462
|
+
n
|
|
463
|
+
);
|
|
464
|
+
e.push(`<g transform="${v}"${h}>${_(b)}</g>`);
|
|
465
|
+
continue;
|
|
466
|
+
}
|
|
467
|
+
if (!a.svg) continue;
|
|
468
|
+
if (o.cell) {
|
|
469
|
+
const b = a.def;
|
|
470
|
+
if (!b || !k(b)) {
|
|
471
|
+
console.warn(
|
|
472
|
+
`[ui0-icon] virtual '${i}': '#${o.cell}' addresses a part of '${o.name}', which is not a template`
|
|
473
|
+
);
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
const v = At(a.svg, o.cell, b.rows, b.cols);
|
|
477
|
+
if (!v) {
|
|
478
|
+
console.warn(`[ui0-icon] virtual '${i}': template '${o.name}' has no <g data-cell="${o.cell}"> part`);
|
|
479
|
+
continue;
|
|
480
|
+
}
|
|
481
|
+
const m = O(f, v.rect, d, n);
|
|
482
|
+
e.push(`<g transform="${m}"${h}>${v.markup}</g>`);
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
const x = O(
|
|
486
|
+
f,
|
|
487
|
+
{ x: 0, y: 0, width: w, height: w },
|
|
488
|
+
d,
|
|
489
|
+
n
|
|
490
|
+
);
|
|
491
|
+
e.push(`<g transform="${x}"${h}>${_(a.svg)}</g>`);
|
|
492
|
+
}
|
|
493
|
+
return `<svg viewBox="0 0 ${w} ${w}" xmlns="http://www.w3.org/2000/svg">${e.join("")}</svg>`;
|
|
494
|
+
}
|
|
495
|
+
const L = /\s|,/, q = ["path", "rect", "circle", "ellipse", "line", "polyline", "polygon"], F = (i) => (960 * i - 960) / 2;
|
|
496
|
+
function Q(i, t = 1) {
|
|
497
|
+
return t !== 1 ? T(Y(i, t), -F(t), -F(t)) : i;
|
|
498
|
+
}
|
|
499
|
+
class St {
|
|
500
|
+
constructor(t = {}) {
|
|
501
|
+
M(this, "options");
|
|
502
|
+
M(this, "name");
|
|
503
|
+
M(this, "result");
|
|
504
|
+
const { fit: s = !0, process: r = !0, rescaling: e = !0 } = t;
|
|
505
|
+
this.result = {}, this.options = {
|
|
506
|
+
fit: s,
|
|
507
|
+
process: r,
|
|
508
|
+
rescaling: e
|
|
509
|
+
}, this.name = "";
|
|
510
|
+
}
|
|
511
|
+
process(t, s = "", r = this.options) {
|
|
512
|
+
this.result[t] = {
|
|
513
|
+
sfc: {
|
|
514
|
+
template: "",
|
|
515
|
+
script: "",
|
|
516
|
+
style: ""
|
|
517
|
+
},
|
|
518
|
+
options: {
|
|
519
|
+
flags: [],
|
|
520
|
+
layers: [],
|
|
521
|
+
paintNodesCount: 0,
|
|
522
|
+
modifiers: []
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
let e = "", c = {
|
|
526
|
+
x: 1,
|
|
527
|
+
y: 1
|
|
528
|
+
}, l = this.result[t].options;
|
|
529
|
+
l.flags ?? (l.flags = []), l.modifiers ?? (l.modifiers = []), l.layers ?? (l.layers = []);
|
|
530
|
+
const u = $.parseAsSingle(s, (n) => {
|
|
531
|
+
var h;
|
|
532
|
+
if (n.tag === "svg" || n.tag === "g") {
|
|
533
|
+
if (n.tag === "svg" && n.hasAttr("viewBox")) {
|
|
534
|
+
const [, , a = "960", f = "960"] = n.attributes.viewBox.split(" ");
|
|
535
|
+
(a !== "960" || f !== "960") && (c.x = 960 / +a, c.y = 960 / +f);
|
|
536
|
+
}
|
|
537
|
+
n.hasAttr("data-icon") && (l.flags = n.attributes.dataIcon.split(L)), n.hasAttr("data-layers") && (l.layers = n.attributes.dataLayers.split(L)), n.hasAttr("data-modifiers") && (l.modifiers = n.attributes.dataModifiers.split(L));
|
|
538
|
+
}
|
|
539
|
+
if (n.tag === "template")
|
|
540
|
+
return $.createNode({
|
|
541
|
+
tag: "template",
|
|
542
|
+
attributes: n.attributes,
|
|
543
|
+
content: n.raw,
|
|
544
|
+
children: [],
|
|
545
|
+
parent: n.parent,
|
|
546
|
+
raw: ""
|
|
547
|
+
});
|
|
548
|
+
if (n.tag === "style" && ((h = n.parent) == null ? void 0 : h.tag) === "defs")
|
|
549
|
+
return e += n.content, null;
|
|
550
|
+
if (q.includes(n.tag) || n.tag === "g") {
|
|
551
|
+
const { id: a } = n.attributes;
|
|
552
|
+
a && (a.startsWith("r-icon") || a.startsWith("no-")) && (n.attributes.class = a + " " + (n.attributes.class ?? ""), delete n.attributes.id);
|
|
553
|
+
}
|
|
554
|
+
return n;
|
|
555
|
+
});
|
|
556
|
+
!l.flags.includes("no-rescale") && this.options.rescaling && u.walk((n) => {
|
|
557
|
+
(n.tag !== "g" && c && c.x !== 1 || c.y !== 1) && this.processBoxScaling(n, c.x, c.y);
|
|
558
|
+
});
|
|
559
|
+
const p = this.processNode(t, u);
|
|
560
|
+
delete u.attributes.id, delete u.attributes.viewBox;
|
|
561
|
+
const o = {};
|
|
562
|
+
u.children.unshift(
|
|
563
|
+
$.createNode({
|
|
564
|
+
tag: "rect",
|
|
565
|
+
children: [],
|
|
566
|
+
attributes: {
|
|
567
|
+
width: "960",
|
|
568
|
+
height: "960",
|
|
569
|
+
class: "no-fill no-stroke"
|
|
570
|
+
}
|
|
571
|
+
})
|
|
572
|
+
);
|
|
573
|
+
const g = $.createNode({
|
|
574
|
+
tag: "g",
|
|
575
|
+
content: u.content,
|
|
576
|
+
raw: u.raw,
|
|
577
|
+
children: u.children,
|
|
578
|
+
attributes: {
|
|
579
|
+
...o,
|
|
580
|
+
":class": "modifiers",
|
|
581
|
+
"data-icon-body": ""
|
|
582
|
+
},
|
|
583
|
+
parent: null
|
|
584
|
+
});
|
|
585
|
+
u.hasAttr("class") && (g.attributes.class = u.attributes.class), u.hasAttr("style") && (g.attributes.style = u.attributes.style), this.options.fit && (g.attributes[":style"] = "'--r-icon-fit-ratio: ' + fitRatios[fit]");
|
|
586
|
+
let d = $.serialize(g);
|
|
587
|
+
return this.result[t].sfc = {
|
|
588
|
+
template: d,
|
|
589
|
+
style: e,
|
|
590
|
+
script: p
|
|
591
|
+
}, this.result[t].sfc;
|
|
592
|
+
}
|
|
593
|
+
render(t) {
|
|
594
|
+
if (!this.result) return "";
|
|
595
|
+
const { template: s = "", style: r = "", script: e = "" } = this.result[t].sfc;
|
|
596
|
+
let c = "";
|
|
597
|
+
return s && (c += `
|
|
598
|
+
<template>
|
|
599
|
+
${s}
|
|
600
|
+
</template>`), r && (c += `
|
|
601
|
+
<style scoped lang="scss">
|
|
602
|
+
${r.trim()}
|
|
603
|
+
</style>`), e && (c += `
|
|
604
|
+
<script>
|
|
605
|
+
${e}
|
|
606
|
+
<\/script>`), c;
|
|
607
|
+
}
|
|
608
|
+
processBoxScaling(t, s = 1, r = 1) {
|
|
609
|
+
if (!(s === 1 && r === 1))
|
|
610
|
+
switch (t.tag) {
|
|
611
|
+
case "path":
|
|
612
|
+
t.hasAttr("d") && t.setAttr("d", Y(t.attributes.d, s));
|
|
613
|
+
break;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
processNode(t, s) {
|
|
617
|
+
const r = this.result[t].options, e = ["fit", "progress", "rendering", "modifiers"], { layers: c = [] } = this.processFeatures(t, s);
|
|
618
|
+
r.layers = [...r.layers, ...c];
|
|
619
|
+
const l = {
|
|
620
|
+
...this.processFit(s),
|
|
621
|
+
layers: c,
|
|
622
|
+
fitRatios: {
|
|
623
|
+
default: 1,
|
|
624
|
+
small: 0.84210526,
|
|
625
|
+
large: 1.16666667
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
return Array.isArray(this.options.fit) && (this.options.fit.length === 2 && ([l.fitRatios.small, l.fitRatios.large] = this.options.fit), this.options.fit[2] && ([l.fitRatios.small, l.fitRatios.default, l.fitRatios.large] = this.options.fit)), `export default {
|
|
629
|
+
setup: () => (${JSON.stringify(l)}),
|
|
630
|
+
props: ${JSON.stringify(e)},
|
|
631
|
+
customOptions: ${JSON.stringify(r)}
|
|
632
|
+
}`;
|
|
633
|
+
}
|
|
634
|
+
processNodesIfModifiers(t) {
|
|
635
|
+
(Array.isArray(t) ? t : [t]).forEach((r) => {
|
|
636
|
+
r.hasAttr("data-mod") && (r.attributes.dataMod === "default" ? r.attributes.vIf = "modifiers.includes('default') || modifiers.length === 0" : r.attributes.vIf = `modifiers.includes('${r.attributes.dataMod}')`, delete r.attributes.dataMod);
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
processPointNodes(t) {
|
|
640
|
+
t.forEach((s, r) => {
|
|
641
|
+
s.attributes["data-p-i"] = `${r}`, s.addStyle(`--r-icon-p-i: ${r}`);
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
processRendering(t) {
|
|
645
|
+
var r;
|
|
646
|
+
const s = ((r = t.attributes.dataSkipAttr) == null ? void 0 : r.split(",")) ?? [];
|
|
647
|
+
t.attributes.fill && !s.includes("fill") && (t.attributes[":fill"] = `rendering === 'original' ? '${t.attributes.fill}' : undefined`, delete t.attributes.fill), t.attributes.stroke && !s.includes("stroke") && (t.attributes[":stroke"] = `rendering === 'original' ? '${t.attributes.stroke}' : undefined`, delete t.attributes.stroke);
|
|
648
|
+
}
|
|
649
|
+
processFit(t) {
|
|
650
|
+
let s = 0, r = 0, e = 0, c = 0, l = 0;
|
|
651
|
+
const u = [], p = [], o = [], g = [], d = [], [n = 0.84210526, h = 1.16666667] = Array.isArray(this.options.fit) ? this.options.fit : [];
|
|
652
|
+
return t.walk((a) => {
|
|
653
|
+
var f;
|
|
654
|
+
if (!a.hasClass("no-fit") && ((f = a.parent) == null ? void 0 : f.tag) !== "mask") {
|
|
655
|
+
if (a.tag === "line") {
|
|
656
|
+
const { x1: x = "0", x2: b = "0", y1: v = "0", y2: m = "0" } = a.attributes;
|
|
657
|
+
o.push({
|
|
658
|
+
x1: x,
|
|
659
|
+
x2: b,
|
|
660
|
+
y1: v,
|
|
661
|
+
y2: m
|
|
662
|
+
}), a.attributes[":x1"] = `fitLine[${e}][this.fit].x1`, a.attributes[":x2"] = `fitLine[${e}][this.fit].x2`, a.attributes[":y1"] = `fitLine[${e}][this.fit].y1`, a.attributes[":y2"] = `fitLine[${e}][this.fit].y2`, delete a.attributes.x1, delete a.attributes.x2, delete a.attributes.y1, delete a.attributes.y2, e++;
|
|
663
|
+
}
|
|
664
|
+
if (a.tag === "path" && a.hasAttr("d") && (u.push(a.attributes.d), a.attributes[":d"] = `fitPath[${r}][this.fit]`, r++, delete a.attributes.d), a.tag === "polyline" && (g.push(a.attributes.points), a.attributes[":points"] = `fitPolyline[${s}][this.fit]`, delete a.attributes.points, s++), a.tag === "circle" && a.hasAttr("r") && (d.push(a.attributes.r), a.attributes[":r"] = `fitCircle[${c}][this.fit]`, c++, delete a.attributes.r), a.tag === "rect" && a.hasAttr("width") && a.hasAttr("height")) {
|
|
665
|
+
const { width: x, height: b, x: v, y: m } = a.attributes;
|
|
666
|
+
p.push({ width: x, height: b, x: v, y: m }), a.attributes[":width"] = `fitRect[${l}][this.fit].width`, a.attributes[":height"] = `fitRect[${l}][this.fit].height`, a.attributes[":x"] = `fitRect[${l}][this.fit].x`, a.attributes[":y"] = `fitRect[${l}][this.fit].y`, l++, delete a.attributes.width, delete a.attributes.height, delete a.attributes.x, delete a.attributes.y;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}), {
|
|
670
|
+
fitPolyline: g.reduce((a, f) => [
|
|
671
|
+
...a,
|
|
672
|
+
{
|
|
673
|
+
default: f,
|
|
674
|
+
small: T(P(f, n, n), -F(n), -F(n)),
|
|
675
|
+
large: T(P(f, h, h), -F(h), -F(h))
|
|
676
|
+
}
|
|
677
|
+
], []),
|
|
678
|
+
fitLine: o.reduce((a, f) => [
|
|
679
|
+
...a,
|
|
680
|
+
{
|
|
681
|
+
default: f,
|
|
682
|
+
small: G(f, n, [480, 480]),
|
|
683
|
+
large: G(f, h, [480, 480])
|
|
684
|
+
}
|
|
685
|
+
], []),
|
|
686
|
+
fitPath: u.reduce((a, f) => [
|
|
687
|
+
...a,
|
|
688
|
+
{
|
|
689
|
+
default: f,
|
|
690
|
+
small: Q(f, n),
|
|
691
|
+
large: Q(f, h)
|
|
692
|
+
}
|
|
693
|
+
], []),
|
|
694
|
+
fitRect: p.reduce((a, f) => [
|
|
695
|
+
...a,
|
|
696
|
+
{
|
|
697
|
+
default: f,
|
|
698
|
+
small: V(f, n, [480, 480]),
|
|
699
|
+
large: V(f, h, [480, 480])
|
|
700
|
+
}
|
|
701
|
+
], []),
|
|
702
|
+
fitCircle: d.reduce((a, f) => [
|
|
703
|
+
...a,
|
|
704
|
+
{
|
|
705
|
+
default: f,
|
|
706
|
+
small: (+f * n).toFixed(3),
|
|
707
|
+
large: (+f * h).toFixed(3)
|
|
708
|
+
}
|
|
709
|
+
], [])
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
processFeatures(t, s) {
|
|
713
|
+
const r = [], e = [], c = [], { options: l } = this.result[t], u = [], p = /* @__PURE__ */ new Set();
|
|
714
|
+
return s.walk((o) => {
|
|
715
|
+
const g = q.includes(o.tag), d = o.tag === "g";
|
|
716
|
+
if (!o.hasAttr("data-skip")) {
|
|
717
|
+
if (o.hasAttr("data-layer")) {
|
|
718
|
+
p.add(o.attributes.dataLayer);
|
|
719
|
+
const n = [...p].indexOf(o.attributes.dataLayer);
|
|
720
|
+
o.addStyle(`--r-icon-l-i: ${n}`), o.attributes["data-l-i"] = n.toString();
|
|
721
|
+
}
|
|
722
|
+
if (o.hasClass("no-progress") && c.push(o), o.tag === "mask" && u.push(o), g || d) {
|
|
723
|
+
const n = o.attributes.class && o.attributes.class.indexOf("no-progress") > -1;
|
|
724
|
+
d && o.hasAttr("data-group") && (r.push(o), e.push(o), delete o.attributes.dataGroup), g && !o.isChildOf(e) && (n || r.push(o)), o.isChildOf(u) || this.processRendering(o);
|
|
725
|
+
}
|
|
726
|
+
this.processNodesIfModifiers(o);
|
|
727
|
+
}
|
|
728
|
+
}), s.addStyle(`--r-icon-l-c: ${p.size}`), s.addStyle(`--r-icon-p-c: ${r.length}`), this.processPointNodes(r), l.flags.includes("no-progress") || r.forEach((o, g) => {
|
|
729
|
+
if (!o.isChildOf([...c, ...u])) {
|
|
730
|
+
const d = ((100 / r.length || 1) * (g + 1)).toFixed(3);
|
|
731
|
+
o.attributes["data-p-on"] = d, o.attributes[":opacity"] = `(progress ?? 100) >= ${d} ? 1 : .2`;
|
|
732
|
+
}
|
|
733
|
+
}), {
|
|
734
|
+
layers: p
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
const yt = /\.svg\?icon*$/, N = (i) => i.replace(/^.*\//, "").split(".")[0];
|
|
739
|
+
function Mt(i = {}) {
|
|
740
|
+
const { fit: t = [0.84210526, 1.16666667], include: s = "", exclude: r = "" } = i;
|
|
741
|
+
let e = /* @__PURE__ */ new Map();
|
|
742
|
+
const c = /* @__PURE__ */ new Map(), l = z(s || /\.svg\?icon.*$/, r), u = z(s || /\.svg$/, r), p = new St({ fit: t }), o = (d) => {
|
|
743
|
+
var b, v;
|
|
744
|
+
const n = d.includes("/") ? d.slice(0, d.indexOf("/")) : void 0, h = N(d), a = n ? (b = i.packs) == null ? void 0 : b[n] : void 0;
|
|
745
|
+
if (n && typeof a == "string") {
|
|
746
|
+
const m = C(I.join(a, h + y));
|
|
747
|
+
if (m) return { svg: m };
|
|
748
|
+
}
|
|
749
|
+
if (n === "blocks" && j[h])
|
|
750
|
+
return { svg: j[h] };
|
|
751
|
+
const f = (v = i.virtual) == null ? void 0 : v[h];
|
|
752
|
+
if (f && (n === void 0 || n === "blocks" || n === "virtual")) {
|
|
753
|
+
if (k(f)) {
|
|
754
|
+
const S = f.file.trimStart().startsWith("<") ? f.file : C(f.file);
|
|
755
|
+
return S || console.warn(`[ui0-icon] template not found: ${f.file.slice(0, 80)}`), { def: f, svg: S };
|
|
756
|
+
}
|
|
757
|
+
const m = (i.sources ?? []).map((S) => C(I.join(S, h + y))).find(Boolean);
|
|
758
|
+
return { def: f, svg: m };
|
|
759
|
+
}
|
|
760
|
+
const x = (i.sources ?? []).map((m) => C(I.join(m, h + y))).find(Boolean);
|
|
761
|
+
return x ? { svg: x } : void 0;
|
|
762
|
+
}, g = (d) => {
|
|
763
|
+
var f;
|
|
764
|
+
const n = N(d), h = C(d + y);
|
|
765
|
+
if (h) return h;
|
|
766
|
+
const a = (f = i.virtual) == null ? void 0 : f[n];
|
|
767
|
+
return a && !k(a) ? E(n, a, o) : pt(d + y);
|
|
768
|
+
};
|
|
769
|
+
return {
|
|
770
|
+
name: "vite:ui0-icon",
|
|
771
|
+
enforce: "pre",
|
|
772
|
+
resolveId(d, n) {
|
|
773
|
+
if (e.has(d) || d.indexOf("?vue") > -1)
|
|
774
|
+
return d;
|
|
775
|
+
if (yt.test(d)) {
|
|
776
|
+
const h = ht(d);
|
|
777
|
+
if (n) return `${A}${dt(n) + h}`;
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
async load(d) {
|
|
781
|
+
var a, f, x;
|
|
782
|
+
const h = d.split("?", 1)[0].replace(A, "");
|
|
783
|
+
if (d.startsWith(A) && d.indexOf("?vue") === -1) {
|
|
784
|
+
const b = g(h);
|
|
785
|
+
return b !== void 0 && ((a = i.virtual) != null && a[N(h)]) && c.set(d, N(h)), b;
|
|
786
|
+
}
|
|
787
|
+
if (d.startsWith(A) && d.indexOf("?vue") > -1) {
|
|
788
|
+
const b = g(h);
|
|
789
|
+
return b !== void 0 && ((f = i.virtual) != null && f[N(h)]) && c.set(d, N(h)), p.process(h, b ?? ""), ((x = p.result[h]) == null ? void 0 : x.sfc.style) ?? "";
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
async transform(d, n) {
|
|
793
|
+
if (!n.startsWith(A) && !l(n))
|
|
794
|
+
return;
|
|
795
|
+
if (n.indexOf("?vue") > -1)
|
|
796
|
+
return d;
|
|
797
|
+
if (!n.split("?", 1)[0]) return;
|
|
798
|
+
const a = d || "";
|
|
799
|
+
p.process(n, a || "");
|
|
800
|
+
const f = p.render(n);
|
|
801
|
+
return e.set(n, f), f;
|
|
802
|
+
},
|
|
803
|
+
async handleHotUpdate(d) {
|
|
804
|
+
var v;
|
|
805
|
+
const { file: n, read: h, server: a } = d;
|
|
806
|
+
if (!u(n)) return;
|
|
807
|
+
const f = ft(n);
|
|
808
|
+
p.process(f, await h()), e.set(f, p.render(f));
|
|
809
|
+
const x = [];
|
|
810
|
+
for (const [m, S] of c) {
|
|
811
|
+
const R = (v = i.virtual) == null ? void 0 : v[S];
|
|
812
|
+
if (!R || k(R)) continue;
|
|
813
|
+
const tt = E(S, R, o);
|
|
814
|
+
p.process(m, tt), e.set(m, p.render(m));
|
|
815
|
+
const W = a.moduleGraph.getModuleById(m);
|
|
816
|
+
W && x.push(W);
|
|
817
|
+
}
|
|
818
|
+
const b = a.moduleGraph.getModuleById(f);
|
|
819
|
+
return !b && !x.length ? [] : [...b ? [b] : [], ...x];
|
|
820
|
+
},
|
|
821
|
+
buildStart() {
|
|
822
|
+
e = /* @__PURE__ */ new Map(), c.clear();
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
export {
|
|
827
|
+
Mt as default,
|
|
828
|
+
k as isVirtualTemplate
|
|
829
|
+
};
|