@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
package/dist/index.js
ADDED
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
var te = Object.defineProperty;
|
|
2
|
+
var ne = (n, s, e) => s in n ? te(n, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[s] = e;
|
|
3
|
+
var $ = (n, s, e) => ne(n, typeof s != "symbol" ? s + "" : s, e);
|
|
4
|
+
import { newErrorForSetupCall as ce, isArray as ae, hyphenate as ie } from "@ui0/util";
|
|
5
|
+
import { inject as R, getCurrentInstance as re, h as k, resolveComponent as le, defineComponent as pe, useCssModule as ue, shallowRef as he, useAttrs as de, openBlock as fe, createBlock as me, mergeProps as N, camelize as ge } from "vue";
|
|
6
|
+
import { useComponentId as ke } from "@ui0/composable";
|
|
7
|
+
const ve = Symbol.for("ui0-icon"), U = Symbol("ui0-icon-instance");
|
|
8
|
+
function as() {
|
|
9
|
+
const n = R(U, void 0);
|
|
10
|
+
if (n) return n;
|
|
11
|
+
const s = re();
|
|
12
|
+
if (!s) throw ce("getIcon");
|
|
13
|
+
return s.appContext.config.globalProperties.$ui0Icon;
|
|
14
|
+
}
|
|
15
|
+
const ye = {
|
|
16
|
+
value: "fake",
|
|
17
|
+
rotate: 0,
|
|
18
|
+
weight: 400,
|
|
19
|
+
progress: 100,
|
|
20
|
+
display: "block",
|
|
21
|
+
rendering: "monochrome",
|
|
22
|
+
pack: "ui0",
|
|
23
|
+
modifiers: [],
|
|
24
|
+
fit: "default",
|
|
25
|
+
options: {
|
|
26
|
+
badge: {
|
|
27
|
+
x: "start",
|
|
28
|
+
y: "start",
|
|
29
|
+
scale: 0.4,
|
|
30
|
+
showMask: !0
|
|
31
|
+
},
|
|
32
|
+
guides: !1
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
function we(n, s) {
|
|
36
|
+
const e = [
|
|
37
|
+
n,
|
|
38
|
+
s,
|
|
39
|
+
ye
|
|
40
|
+
], f = (c) => {
|
|
41
|
+
for (const p of e) {
|
|
42
|
+
const m = p == null ? void 0 : p[c];
|
|
43
|
+
if (m !== void 0) return m;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return new Proxy({}, {
|
|
47
|
+
get: (c, p) => f(p),
|
|
48
|
+
ownKeys: () => [...new Set(e.flatMap((c) => c ? Object.keys(c) : []))],
|
|
49
|
+
getOwnPropertyDescriptor: (c, p) => ({
|
|
50
|
+
enumerable: !0,
|
|
51
|
+
configurable: !0,
|
|
52
|
+
value: f(p)
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const K = Symbol("ui0-icon-framework");
|
|
57
|
+
function be() {
|
|
58
|
+
return R(K, {});
|
|
59
|
+
}
|
|
60
|
+
const G = {
|
|
61
|
+
"ellipse-rect": "M930,602.17c0,12.52,0,25.03-.07,37.55-.06,10.54-.18,21.09-.47,31.63-.62,22.97-1.97,46.14-6.06,68.85-4.14,23.04-10.9,44.49-21.56,65.42-10.47,20.58-24.16,39.41-40.49,55.73-16.33,16.33-35.16,30.01-55.73,40.49-20.94,10.66-42.38,17.42-65.42,21.56-22.71,4.08-45.88,5.43-68.85,6.06-10.54.29-21.08.41-31.63.47-12.52.08-25.03.07-37.55.07h-244.34c-12.52,0-25.03,0-37.55-.07-10.54-.06-21.09-.18-31.63-.47-22.97-.62-46.14-1.97-68.85-6.06-23.04-4.14-44.49-10.9-65.42-21.56-20.58-10.47-39.41-24.16-55.73-40.49-16.33-16.33-30.01-35.16-40.49-55.73-10.66-20.94-17.42-42.38-21.56-65.42-4.08-22.71-5.43-45.88-6.06-68.85-.29-10.54-.41-21.08-.47-31.63-.08-12.52-.07-25.03-.07-37.55v-244.34c0-12.52,0-25.03.07-37.55.06-10.54.18-21.09.47-31.63.62-22.97,1.97-46.14,6.06-68.85,4.14-23.04,10.9-44.49,21.56-65.42,10.47-20.58,24.16-39.41,40.49-55.73,16.33-16.33,35.16-30.01,55.73-40.49,20.94-10.66,42.38-17.42,65.42-21.56,22.71-4.08,45.88-5.43,68.85-6.06,10.54-.29,21.08-.41,31.63-.47,12.52-.08,25.03-.07,37.55-.07h244.34c12.52,0,25.03,0,37.55.07,10.54.06,21.09.18,31.63.47,22.97.62,46.14,1.97,68.85,6.06,23.04,4.14,44.49,10.9,65.42,21.56,20.58,10.47,39.41,24.16,55.73,40.49,16.33,16.33,30.01,35.16,40.49,55.73,10.66,20.94,17.42,42.38,21.56,65.42,4.08,22.71,5.43,45.88,6.06,68.85.29,10.54.41,21.08.47,31.63.08,12.52.07,25.03.07,37.55v244.34Z",
|
|
62
|
+
shield: "M75,408.8c0-143.9,0-215.8,17-240,17-24.2,84.6-47.4,219.9-93.7l25.8-8.8c70.5-24.1,105.8-36.2,142.3-36.2s71.8,12.1,142.3,36.2l25.8,8.8c135.3,46.3,202.9,69.5,219.9,93.7,17,24.2,17,96.2,17,240v70.9c0,253.7-190.8,376.8-310.4,429.1-32.5,14.2-48.7,21.3-94.6,21.3s-62.1-7.1-94.6-21.3c-119.7-52.3-310.4-175.4-310.4-429.1v-70.9h0Z",
|
|
63
|
+
pentagon: "M515.9,52.2l114.6,232.2c5.8,11.8,17.1,20,30.1,21.9l256.3,37.2c32.8,4.8,45.9,45.1,22.2,68.2l-185.4,180.8c-9.4,9.2-13.7,22.4-11.5,35.4l43.8,255.2c5.6,32.7-28.7,57.6-58,42.2l-229.2-120.5c-11.7-6.1-25.6-6.1-37.2,0l-229.2,120.5c-29.3,15.4-63.6-9.5-58-42.2l43.8-255.2c2.2-13-2.1-26.2-11.5-35.4L21,411.8c-23.7-23.1-10.6-63.5,22.2-68.2l256.3-37.2c13-1.9,24.3-10.1,30.1-21.9l114.6-232.2c14.7-29.7,57.1-29.7,71.7,0Z",
|
|
64
|
+
hexagon: "M500,34.8l355.6,205.3c12.4,7.1,20,20.4,20,34.6v410.6c0,14.3-7.6,27.5-20,34.6l-355.6,205.3c-12.4,7.1-27.6,7.1-40,0l-355.6-205.3c-12.4-7.1-20-20.4-20-34.6v-410.6c0-14.3,7.6-27.5,20-34.6L460,34.8c12.4-7.1,27.6-7.1,40,0Z",
|
|
65
|
+
heptagon: "M462.6,40.8L133.9,199.2c-11,5.3-18.9,15.3-21.6,27.1L31.1,582c-2.7,11.9.1,24.3,7.7,33.8l227.5,285.3c7.6,9.5,19.1,15.1,31.3,15.1h364.9c12.2,0,23.7-5.5,31.3-15.1l227.5-285.3c7.6-9.5,10.4-22,7.7-33.8l-81.2-355.7c-2.7-11.9-10.7-21.9-21.6-27.1L497.4,40.8c-11-5.3-23.7-5.3-34.7,0Z",
|
|
66
|
+
octagon: "M523,38.5l238.7,98.9c27.6,11.4,49.5,33.3,60.9,60.9l98.9,238.7c11.4,27.6,11.4,58.5,0,86.1l-98.9,238.7c-11.4,27.6-33.3,49.5-60.9,60.9l-238.7,98.9c-27.6,11.4-58.5,11.4-86.1,0l-238.7-98.9c-27.6-11.4-49.5-33.3-60.9-60.9l-98.9-238.7c-11.4-27.6-11.4-58.5,0-86.1l98.9-238.7c11.4-27.6,33.3-49.5,60.9-60.9l238.7-98.9c27.6-11.4,58.5-11.4,86.1,0h0Z"
|
|
67
|
+
};
|
|
68
|
+
function xe(n) {
|
|
69
|
+
return n in G;
|
|
70
|
+
}
|
|
71
|
+
function _e(n) {
|
|
72
|
+
return !!n && "customOptions" in n;
|
|
73
|
+
}
|
|
74
|
+
function A(n) {
|
|
75
|
+
return (s) => k("g", n, s || []);
|
|
76
|
+
}
|
|
77
|
+
class Ie {
|
|
78
|
+
constructor() {
|
|
79
|
+
$(this, "stack", []);
|
|
80
|
+
}
|
|
81
|
+
add(s) {
|
|
82
|
+
this.stack.push(s);
|
|
83
|
+
}
|
|
84
|
+
render() {
|
|
85
|
+
return this.stack.reduce((s, e) => e(s), {});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function Se(n, s) {
|
|
89
|
+
const e = () => c.params.value ? `icon-${c.params.pack}-${c.params.value}` : "icon-none", c = {
|
|
90
|
+
modifiers: [],
|
|
91
|
+
params: {},
|
|
92
|
+
getComponentName: e,
|
|
93
|
+
getComponent: () => {
|
|
94
|
+
const b = le(e());
|
|
95
|
+
return typeof b == "string" ? null : b;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
if (!n) return c;
|
|
99
|
+
const p = n.includes("/") ? n : `/${n}`, [m, v = ""] = p.split("?", 2), [h, j] = m.split("/", 2), [O, ...w] = j.split(".");
|
|
100
|
+
return w.length && (c.modifiers = w.reduce((b, E) => [...b, E.replace(":", "-")], [])), v && (c.params = Object.fromEntries(v.split("&").map((b) => b.split("=", 2)))), c.params.pack = h || s.pack || "ui0", O && (c.params.value = O), c;
|
|
101
|
+
}
|
|
102
|
+
function Z(n, s) {
|
|
103
|
+
const e = Se(n, s);
|
|
104
|
+
for (const [c, p] of Object.entries(s))
|
|
105
|
+
p !== void 0 && c !== "value" && e.params[c] === void 0 && (e.params[c] = p);
|
|
106
|
+
const f = {
|
|
107
|
+
...s,
|
|
108
|
+
...e.params
|
|
109
|
+
};
|
|
110
|
+
return {
|
|
111
|
+
...e,
|
|
112
|
+
params: f
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const Me = /* @__PURE__ */ pe({
|
|
116
|
+
__name: "icon",
|
|
117
|
+
props: {
|
|
118
|
+
badge: {},
|
|
119
|
+
display: {},
|
|
120
|
+
shape: {},
|
|
121
|
+
modifiers: {},
|
|
122
|
+
progress: {},
|
|
123
|
+
flipped: { type: Boolean },
|
|
124
|
+
fit: {},
|
|
125
|
+
options: {},
|
|
126
|
+
pack: {},
|
|
127
|
+
rotate: {},
|
|
128
|
+
rendering: {},
|
|
129
|
+
size: {},
|
|
130
|
+
title: {},
|
|
131
|
+
value: {},
|
|
132
|
+
weight: {},
|
|
133
|
+
width: {},
|
|
134
|
+
height: {},
|
|
135
|
+
color: {}
|
|
136
|
+
},
|
|
137
|
+
setup(n) {
|
|
138
|
+
var D, z;
|
|
139
|
+
const s = n, e = ue(), f = be(), c = (D = f.useTheme) == null ? void 0 : D.call(f, s, e), p = we(s, (z = f.useDefaults) == null ? void 0 : z.call(f)), m = q(), [, v] = ke("icon"), h = {
|
|
140
|
+
badge: v("badge"),
|
|
141
|
+
radial: v("radial"),
|
|
142
|
+
shape: v("shape"),
|
|
143
|
+
shapeBadge: v("shape-badge"),
|
|
144
|
+
strokeMask: v("stroke-mask"),
|
|
145
|
+
shapeStrokeMask: v("shape-stroke-mask"),
|
|
146
|
+
icon: v("icon"),
|
|
147
|
+
iconMask: v("mask-icon")
|
|
148
|
+
}, j = k("rect", {
|
|
149
|
+
...m.viewBox,
|
|
150
|
+
fill: "#FFF"
|
|
151
|
+
}), w = {
|
|
152
|
+
...ee(s),
|
|
153
|
+
viewBox: m.getViewBox()
|
|
154
|
+
}, b = he(!1), E = de();
|
|
155
|
+
function H(t) {
|
|
156
|
+
return Array.isArray(t) ? t.filter(Boolean) : typeof t == "string" ? t.split(/[\s,]+/).filter(Boolean) : [];
|
|
157
|
+
}
|
|
158
|
+
function W(t) {
|
|
159
|
+
const a = [], o = Object.keys(t), r = ["size", "color", "value", "fill", "weight"];
|
|
160
|
+
for (let i = 0; i < o.length; i++) {
|
|
161
|
+
const l = t[o[i]];
|
|
162
|
+
r.includes(o[i]) && l !== void 0 && ["string", "number", "boolean"].includes(typeof l) && a.push(`icon-${o[i]}-${l}`);
|
|
163
|
+
}
|
|
164
|
+
return a;
|
|
165
|
+
}
|
|
166
|
+
const Q = () => {
|
|
167
|
+
const { value: t } = s;
|
|
168
|
+
if (!t) return null;
|
|
169
|
+
const a = Z(ae(t) ? t[0] : t, p), o = [e.icon];
|
|
170
|
+
c ? o.push(...c.classes(a.params)) : o.push(...W(a.params));
|
|
171
|
+
const r = {
|
|
172
|
+
class: o,
|
|
173
|
+
onPointermove() {
|
|
174
|
+
b.value = !0;
|
|
175
|
+
},
|
|
176
|
+
onPointerleave() {
|
|
177
|
+
b.value = !1;
|
|
178
|
+
},
|
|
179
|
+
onVnodeMounted(l) {
|
|
180
|
+
l.el instanceof HTMLElement && l.el.parentElement && l.el.parentElement instanceof HTMLElement && l.el.parentElement;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
if (a.params.value === "fake")
|
|
184
|
+
return k("i", N(E, r));
|
|
185
|
+
const i = X(a);
|
|
186
|
+
return i ? k("i", N(E, r), i) : null;
|
|
187
|
+
}, T = (t, a) => k("symbol", a, t), X = (t) => {
|
|
188
|
+
const a = V(t);
|
|
189
|
+
if (!a) return null;
|
|
190
|
+
const o = t.params, r = o.color && o.color.length === 2, i = o.color && o.color.length > 2, l = (r || i) && o.rendering && o.rendering === "multicolor", d = [e.canvas];
|
|
191
|
+
c && d.push(...c.classes(o, e));
|
|
192
|
+
const u = [], _ = [], M = {
|
|
193
|
+
viewBox: m.getViewBox(),
|
|
194
|
+
class: d
|
|
195
|
+
};
|
|
196
|
+
r && d.push(e.doubleColored), i && d.push(e.tripleColored);
|
|
197
|
+
let y = {};
|
|
198
|
+
if (u.push(
|
|
199
|
+
T(a, {
|
|
200
|
+
id: h.icon,
|
|
201
|
+
viewBox: m.getViewBox()
|
|
202
|
+
})
|
|
203
|
+
), o.badge && typeof o.badge == "string") {
|
|
204
|
+
const g = Z(o.badge, {});
|
|
205
|
+
y = g.params;
|
|
206
|
+
const S = V(g);
|
|
207
|
+
if (S) {
|
|
208
|
+
const B = T(S, {
|
|
209
|
+
id: h.badge,
|
|
210
|
+
viewBox: m.getViewBox()
|
|
211
|
+
});
|
|
212
|
+
u.push(B), !o.shape && !y.shape && u.push(x(h.badge, y, w));
|
|
213
|
+
const I = x(h.badge, y, {
|
|
214
|
+
...w,
|
|
215
|
+
class: [e.strokeMask, e.masked]
|
|
216
|
+
});
|
|
217
|
+
_.push(L(h.strokeMask, [I]));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if ((!o.shape || l) && u.push(x(h.icon, o, { mask: h.strokeMask })), o.shape) {
|
|
221
|
+
const g = x(h.icon, o, {
|
|
222
|
+
mask: h.strokeMask,
|
|
223
|
+
class: e.masked
|
|
224
|
+
}), S = x(h.badge, y, {
|
|
225
|
+
...w,
|
|
226
|
+
class: e.masked
|
|
227
|
+
});
|
|
228
|
+
y.shape && u.push(x(h.shape, {}, { mask: h.badge, ...w }));
|
|
229
|
+
const B = [g];
|
|
230
|
+
if (o.badge && B.push(S), y.shape) {
|
|
231
|
+
const I = {
|
|
232
|
+
...w,
|
|
233
|
+
viewBox: m.getViewBox()
|
|
234
|
+
};
|
|
235
|
+
B.push(
|
|
236
|
+
x(
|
|
237
|
+
h.shape,
|
|
238
|
+
{},
|
|
239
|
+
{
|
|
240
|
+
...I,
|
|
241
|
+
class: [e.strokeMask, e.shapeStrokeMask, e.masked]
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
if (_.push(L(h.iconMask, B)), o.shape || y.shape) {
|
|
247
|
+
const I = J(t);
|
|
248
|
+
I && u.push(
|
|
249
|
+
T(I, {
|
|
250
|
+
id: h.shape,
|
|
251
|
+
viewBox: m.getViewBox()
|
|
252
|
+
})
|
|
253
|
+
), u.push(x(h.shape, {}, l ? { mask: h.iconMask } : { mask: h.iconMask }));
|
|
254
|
+
}
|
|
255
|
+
o.badge && u.push(x(h.badge, y, l ? w : { ...w }));
|
|
256
|
+
}
|
|
257
|
+
return _.length && u.unshift(k("defs", _)), k("svg", M, u);
|
|
258
|
+
}, V = (t) => {
|
|
259
|
+
const a = t.getComponent();
|
|
260
|
+
if (!_e(a)) return null;
|
|
261
|
+
const o = new Ie(), r = a.customOptions, i = {
|
|
262
|
+
fit: t.params.fit ?? "default",
|
|
263
|
+
progress: t.params.progress ?? 100,
|
|
264
|
+
rendering: t.params.rendering,
|
|
265
|
+
modifiers: [...t.modifiers, ...H(t.params.modifiers)]
|
|
266
|
+
}, l = [e.layerStyle], d = {
|
|
267
|
+
class: l,
|
|
268
|
+
style: "--0-icon-weight: 800;"
|
|
269
|
+
};
|
|
270
|
+
return r.flags.includes("no-fill") || l.push(e.fillable), !r.flags.includes("no-stroke") && !r.flags.includes("no-process-stroke") && l.push(e.weighty), r.flags.includes("no-cap") || l.push(e.cap), r.flags.includes("no-join") || l.push(e.join), t.params.shape && l.push(e.shaped), t.modifiers.includes("fill") && l.push(e.filled), t.params.rendering && l.push(e[ge(t.params.rendering)]), o.add(() => k(a, i)), o.add(A(d)), t.params.animation && o.add(A({})), (t.params.flipped || t.modifiers.includes("flip")) && o.add(A({ class: e.flip })), t.params.rotate && o.add(
|
|
271
|
+
A({
|
|
272
|
+
class: e.rotate,
|
|
273
|
+
style: `--0-icon-rotate: ${t.params.rotate ?? 0}deg`
|
|
274
|
+
})
|
|
275
|
+
), o.render();
|
|
276
|
+
}, x = (t, a = {}, o = {}) => {
|
|
277
|
+
let r = {
|
|
278
|
+
"--0-icon-weight": +(a.weight ?? 400) / 100 * m.getStrokeUnit(),
|
|
279
|
+
"--0-icon-progress": a.progress ?? 100
|
|
280
|
+
};
|
|
281
|
+
const i = Array.isArray(o.class) ? o.class : [o.class];
|
|
282
|
+
c && (r = { ...r, ...c.styles(a) }, i.push(...c.classes(a, e)));
|
|
283
|
+
const l = {
|
|
284
|
+
href: `#${t}`,
|
|
285
|
+
style: r,
|
|
286
|
+
...o,
|
|
287
|
+
class: i
|
|
288
|
+
};
|
|
289
|
+
return o.mask && (l.mask = `url(#${o.mask})`), k("use", l);
|
|
290
|
+
}, L = (t, a = []) => k("mask", { id: t }, [j, ...a]), J = (t) => {
|
|
291
|
+
const a = t.params;
|
|
292
|
+
if (!a.shape) return;
|
|
293
|
+
const o = [], r = Y(t), i = a.shape;
|
|
294
|
+
return i === "rect" || i === "circle" ? o.push(
|
|
295
|
+
k("rect", {
|
|
296
|
+
...r,
|
|
297
|
+
rx: i === "circle" ? "50%" : "10%"
|
|
298
|
+
// mask: 'url(#badgenumber)'
|
|
299
|
+
})
|
|
300
|
+
) : xe(i) && o.push(
|
|
301
|
+
k("path", {
|
|
302
|
+
// 'stroke-width': 80,
|
|
303
|
+
...r,
|
|
304
|
+
x: void 0,
|
|
305
|
+
y: void 0,
|
|
306
|
+
"stroke-linejoin": "round",
|
|
307
|
+
"stroke-linecap": "round",
|
|
308
|
+
d: G[i]
|
|
309
|
+
// !asMask ? shapes[p.shape] : scalePath(shapes[p.shape], .4),
|
|
310
|
+
})
|
|
311
|
+
), o;
|
|
312
|
+
};
|
|
313
|
+
function Y(t) {
|
|
314
|
+
const i = m.viewBox.height - m.viewBox.height / 16, l = i, d = i, u = (
|
|
315
|
+
/* isChild && isMask ? measure.x : */
|
|
316
|
+
m.viewBox.width / 32
|
|
317
|
+
), _ = (
|
|
318
|
+
/*isChild && isMask ? measure.y : */
|
|
319
|
+
m.viewBox.height / 32
|
|
320
|
+
), M = [e.shape];
|
|
321
|
+
return c && M.push(...c.classes(t.params, e)), {
|
|
322
|
+
class: M,
|
|
323
|
+
// mask,
|
|
324
|
+
x: u,
|
|
325
|
+
y: _,
|
|
326
|
+
height: l,
|
|
327
|
+
width: d
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
function q() {
|
|
331
|
+
return {
|
|
332
|
+
viewBox: {
|
|
333
|
+
width: 960,
|
|
334
|
+
height: 960,
|
|
335
|
+
x: 0,
|
|
336
|
+
y: 0
|
|
337
|
+
},
|
|
338
|
+
name: "ui0",
|
|
339
|
+
fillable: !0,
|
|
340
|
+
weighty: !0,
|
|
341
|
+
cap: !0,
|
|
342
|
+
join: !0,
|
|
343
|
+
getStrokeUnit() {
|
|
344
|
+
return this.viewBox.width / 96;
|
|
345
|
+
},
|
|
346
|
+
getViewBox() {
|
|
347
|
+
return `${this.viewBox.x} ${this.viewBox.y} ${this.viewBox.width} ${this.viewBox.height}`;
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
function ee(t) {
|
|
352
|
+
const { options: a } = t, o = 960, r = o / 4 * 3, i = (o - r) / 2, l = {
|
|
353
|
+
small: r / 4,
|
|
354
|
+
normal: r / 3,
|
|
355
|
+
large: r / 2
|
|
356
|
+
}, d = a == null ? void 0 : a.badge, u = d !== void 0 && d.scale || "normal", _ = d == null ? void 0 : d.cell, M = d == null ? void 0 : d.x, y = d == null ? void 0 : d.y;
|
|
357
|
+
if (u === "full" || u === 1)
|
|
358
|
+
return {
|
|
359
|
+
x: "0",
|
|
360
|
+
y: "0",
|
|
361
|
+
width: `${o}px`,
|
|
362
|
+
height: `${o}px`
|
|
363
|
+
};
|
|
364
|
+
let g;
|
|
365
|
+
if (typeof u == "number" ? g = u > 0.75 ? u * o : Math.min(r, Math.round(r * u)) : g = l[u], _) {
|
|
366
|
+
const P = typeof u == "string" ? {
|
|
367
|
+
small: 4,
|
|
368
|
+
normal: 3,
|
|
369
|
+
large: 2
|
|
370
|
+
}[u] : 3, C = r / P, [se, oe] = _.split(/\s|-|,/).map(Number), F = P - 1;
|
|
371
|
+
return {
|
|
372
|
+
x: `${i + Math.min(se, F) * C}`,
|
|
373
|
+
y: `${i + Math.min(oe, F) * C}`,
|
|
374
|
+
width: `${g}px`,
|
|
375
|
+
height: `${g}px`
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
const S = (I) => {
|
|
379
|
+
const P = I === "x" ? M : y, C = r - g;
|
|
380
|
+
switch (P) {
|
|
381
|
+
case "center":
|
|
382
|
+
return i + C / 2;
|
|
383
|
+
case "end":
|
|
384
|
+
return i + C;
|
|
385
|
+
default:
|
|
386
|
+
return i;
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
return {
|
|
390
|
+
x: `${S("x")}`,
|
|
391
|
+
y: `${S("y")}`,
|
|
392
|
+
width: `${g}px`,
|
|
393
|
+
height: `${g}px`
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
return (t, a) => (fe(), me(Q));
|
|
397
|
+
}
|
|
398
|
+
}), Be = "ic_c2d4", $e = "ca_a457", Ce = "si_e681", Ee = "st_39f2", Pe = "sh_6010", Ae = "sh_f589", je = "la_1353", Oe = "we_0775", Te = "fi_ff74", Ve = "fi_8a2f", Le = "la_e3b8", De = "ma_30e1", ze = "la_9af0", Fe = "do_9bcc", Ne = "mu_2455", Ze = "sh_0266", Re = "tr_07fb", Ue = "jo_5839", Ke = "ca_45e8", Ge = "fl_4e44", He = "ro_299b", We = {
|
|
399
|
+
icon: Be,
|
|
400
|
+
canvas: $e,
|
|
401
|
+
sizeCustom: Ce,
|
|
402
|
+
strokeMask: Ee,
|
|
403
|
+
shapeStrokeMask: Pe,
|
|
404
|
+
shape: Ae,
|
|
405
|
+
layerStyle: je,
|
|
406
|
+
weighty: Oe,
|
|
407
|
+
fillable: Te,
|
|
408
|
+
filled: Ve,
|
|
409
|
+
layers: Le,
|
|
410
|
+
masked: De,
|
|
411
|
+
layersShift: ze,
|
|
412
|
+
doubleColored: Fe,
|
|
413
|
+
multicolor: Ne,
|
|
414
|
+
shaped: Ze,
|
|
415
|
+
tripleColored: Re,
|
|
416
|
+
join: Ue,
|
|
417
|
+
cap: Ke,
|
|
418
|
+
flip: Ge,
|
|
419
|
+
rotate: He
|
|
420
|
+
}, Qe = (n, s) => {
|
|
421
|
+
const e = n.__vccOpts || n;
|
|
422
|
+
for (const [f, c] of s)
|
|
423
|
+
e[f] = c;
|
|
424
|
+
return e;
|
|
425
|
+
}, Xe = {
|
|
426
|
+
$style: We
|
|
427
|
+
}, Je = /* @__PURE__ */ Qe(Me, [["__cssModules", Xe]]);
|
|
428
|
+
function Ye(n) {
|
|
429
|
+
const s = ie(n.replace("Icon", "")), e = s.split("-")[0];
|
|
430
|
+
return e ? e + "/" + s.replace(e + "-", "") : s.replace(e + "-", "");
|
|
431
|
+
}
|
|
432
|
+
class qe {
|
|
433
|
+
constructor() {
|
|
434
|
+
$(this, "icons", []);
|
|
435
|
+
$(this, "vueApp");
|
|
436
|
+
$(this, "packs", {});
|
|
437
|
+
$(this, "deferred", []);
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* add icon pack plugin
|
|
441
|
+
* @param plugin
|
|
442
|
+
*/
|
|
443
|
+
addPack(s) {
|
|
444
|
+
Object.keys(s.components).forEach((e) => this.add(e, s.components[e])), this.packs[s.name] = s.config;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* returns installed icons list
|
|
448
|
+
* @param pack
|
|
449
|
+
*/
|
|
450
|
+
list(s) {
|
|
451
|
+
return s ? this.icons.filter((e) => e.startsWith(`${s}/`)) : this.icons;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* add icon component
|
|
455
|
+
* @param name
|
|
456
|
+
* @param component
|
|
457
|
+
*/
|
|
458
|
+
add(s, e) {
|
|
459
|
+
var c;
|
|
460
|
+
const f = Ye(s);
|
|
461
|
+
this.icons.push(f), this.vueApp ? (c = this.vueApp) == null || c.component(s, e) : this.deferred.push([s, e]);
|
|
462
|
+
}
|
|
463
|
+
setVue(s) {
|
|
464
|
+
if (!s) throw new Error("app is null");
|
|
465
|
+
if (!this.vueApp)
|
|
466
|
+
this.vueApp = s, this.deferred.length && this.deferred.forEach((e) => s.component(...e));
|
|
467
|
+
else
|
|
468
|
+
throw new Error("vue already installed");
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
function is(n = {}, s) {
|
|
472
|
+
const e = new qe();
|
|
473
|
+
return {
|
|
474
|
+
install: (p) => {
|
|
475
|
+
if (!p) throw new Error("@ui0/icon can be run with vue 3 only");
|
|
476
|
+
p.provide(U, e), n.framework && p.provide(K, n.framework), p.component("Icon", Je), e.setVue(p), p.config.globalProperties.$ui0Icon = e;
|
|
477
|
+
},
|
|
478
|
+
use: (p) => {
|
|
479
|
+
e.addPack(p);
|
|
480
|
+
},
|
|
481
|
+
key: ve
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
const es = "ic_c2d4", ss = "ca_a457", rs = {
|
|
485
|
+
icon: es,
|
|
486
|
+
canvas: ss
|
|
487
|
+
};
|
|
488
|
+
export {
|
|
489
|
+
rs as $style,
|
|
490
|
+
Je as Icon,
|
|
491
|
+
K as IconFrameworkKey,
|
|
492
|
+
is as createIcon,
|
|
493
|
+
as as getIcon,
|
|
494
|
+
we as resolveIconDefaults,
|
|
495
|
+
be as useIconFramework
|
|
496
|
+
};
|
package/dist/keys.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AAEvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,eAAO,MAAM,OAAO,eAAyB,CAAA;AAE7C,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,QAAQ,CAA+B,CAAA"}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Ui0CorePlugin } from '@ui0/types';
|
|
2
|
+
import type { Plugin } from 'vue';
|
|
3
|
+
import { type IconFramework } from './framework';
|
|
4
|
+
import type { IconImpl, IconPlugin } from './types';
|
|
5
|
+
export interface CreateIconOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Framework services (theme contracts, configured defaults). Pass the
|
|
8
|
+
* `@ui0/icon/ui0` bridge in ui0 apps; omit for standalone usage - the
|
|
9
|
+
* component then renders unthemed with its built-in defaults.
|
|
10
|
+
*/
|
|
11
|
+
framework?: IconFramework;
|
|
12
|
+
}
|
|
13
|
+
type PluginVueIcon = Plugin & Ui0CorePlugin & {
|
|
14
|
+
use: (plugin: IconPlugin) => void;
|
|
15
|
+
};
|
|
16
|
+
declare module 'vue' {
|
|
17
|
+
interface ComponentCustomProperties {
|
|
18
|
+
$ui0Icon?: IconImpl;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export declare function createIcon(options?: CreateIconOptions, _host?: HTMLElement): PluginVueIcon;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,KAAK,CAAA;AAEtC,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAIlE,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEnD,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,SAAS,CAAC,EAAE,aAAa,CAAA;CAC1B;AAED,KAAK,aAAa,GAAG,MAAM,GACzB,aAAa,GAAG;IACd,GAAG,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;CAClC,CAAA;AAEH,OAAO,QAAQ,KAAK,CAAC;IACnB,UAAU,yBAAyB;QACjC,QAAQ,CAAC,EAAE,QAAQ,CAAA;KACpB;CACF;AAED,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,aAAa,CAoB9F"}
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@property --0-icon-layer-count{inherits: true; syntax: "<number>"; initial-value: 0;}@property --0-icon-progress{inherits: true; syntax: "<number>"; initial-value: 0;}@layer ui0.ic_c2d4{.ic_c2d4{--0-c-src: initial;--0-c-src-l: initial;--0-c-src-d: initial;--0-c-src-hover: initial;--0-c-src-active: initial;--0-c-src-focus: initial;--0-c-src-l-hover: initial;--0-c-src-l-active: initial;--0-c-src-l-focus: initial;--0-c-src-d-hover: initial;--0-c-src-d-active: initial;--0-c-src-d-focus: initial;--0-c-o: var(--0-c-src, var(--0-c-src-l, 1));--0-c-cur: rgb(var(--0-c-cur-v) / var(--0-c-o))}.theme_dark .ic_c2d4{--0-c-o: var(--0-c-src-d, var(--0-c-src, 1))}.ic_c2d4:hover{--0-c-o: var(--0-c-src-hover, var(--0-c-src, var(--0-c-src-l, 1)))}.ic_c2d4:active{--0-c-o: var(--0-c-src-active, var(--0-c-src, var(--0-c-src-l, 1)))}.ic_c2d4:focus{--0-c-o: var(--0-c-src-focus, var(--0-c-src, var(--0-c-src-l, 1)))}.theme_dark .ic_c2d4:hover{--0-c-o: var(--0-c-src-d-hover, var(--0-c-src-hover, var(--0-c-src-d, var(--0-c-src, 1))))}.theme_dark .ic_c2d4:active{--0-c-o: var(--0-c-src-d-active, var(--0-c-src-active, var(--0-c-src-d, var(--0-c-src, 1))))}.theme_dark .ic_c2d4:focus{--0-c-o: var(--0-c-src-d-focus, var(--0-c-src-focus, var(--0-c-src-d, var(--0-c-src, 1))))}.ic_c2d4{--0-f-src: initial;--0-f-src-l: initial;--0-f-src-d: initial;--0-f-src-hover: initial;--0-f-src-active: initial;--0-f-src-focus: initial;--0-f-src-l-hover: initial;--0-f-src-l-active: initial;--0-f-src-l-focus: initial;--0-f-src-d-hover: initial;--0-f-src-d-active: initial;--0-f-src-d-focus: initial;--0-f-o: var(--0-f-src, var(--0-f-src-l, 1));--0-f-cur: rgb(var(--0-f-cur-v) / var(--0-f-o))}.theme_dark .ic_c2d4{--0-f-o: var(--0-f-src-d, var(--0-f-src, 1))}.ic_c2d4:hover{--0-f-o: var(--0-f-src-hover, var(--0-f-src, var(--0-f-src-l, 1)))}.ic_c2d4:active{--0-f-o: var(--0-f-src-active, var(--0-f-src, var(--0-f-src-l, 1)))}.ic_c2d4:focus{--0-f-o: var(--0-f-src-focus, var(--0-f-src, var(--0-f-src-l, 1)))}.theme_dark .ic_c2d4:hover{--0-f-o: var(--0-f-src-d-hover, var(--0-f-src-hover, var(--0-f-src-d, var(--0-f-src, 1))))}.theme_dark .ic_c2d4:active{--0-f-o: var(--0-f-src-d-active, var(--0-f-src-active, var(--0-f-src-d, var(--0-f-src, 1))))}.theme_dark .ic_c2d4:focus{--0-f-o: var(--0-f-src-d-focus, var(--0-f-src-focus, var(--0-f-src-d, var(--0-f-src, 1))))}.ic_c2d4{--0-g-cur: initial;height:var(--0-s);align-items:center;display:flex;--0-icon-size: calc(var(--0-s-cur) * 1.5);justify-content:center;transform-origin:50% 50%}.ic_c2d4:not(.si_e681){height:var(--0-icon-size, 100%);min-height:var(--0-icon-size);min-width:var(--0-icon-size);width:var(--0-icon-size, 100%)}.ca_a457{box-sizing:border-box;color:var(--0-c-cur, currentColor);height:100%;width:100%}use{--0-icon-fill-color: var(--0-c-cur, currentColor);--0-icon-stroke-color: var(--0-c-cur, currentColor);--0-icon-stroke-width: clamp(20, var(--0-icon-weight, 20), 80)}.st_39f2 *,.st_39f2{--0-icon-stroke-width: calc(clamp(30, var(--0-icon-weight, 30), 80)*.15em) !important}.sh_6010{stroke:#000;stroke-width:80}.sh_f589{fill:var(--0-c-cur, currentColor)}.la_1353{fill:none;stroke:inherit;stroke-width:var(--0-icon-stroke-width)}.la_1353 .no-fill,.la_1353 [data-icon-body] .no-fill{fill:none}.la_1353 [data-icon-body] .no-stroke,.la_1353 .no-stroke{--0-icon-stroke-width: 0;stroke:none}.la_1353.we_0775 :not(.no-stroke){stroke:var(--0-icon-stroke-color, currentColor)}.la_1353.fi_ff74.fi_8a2f :not(.no-fill,.no-fill *){fill:var(--0-icon-fill-color)}.la_1353 [data-icon-body] .always-fill{fill:var(--0-icon-fill-color, currentColor)!important}.la_e3b8 [data-layer]:not(.ma_30e1){--0-icon-l-step: calc(1 / var(--0-icon-l-c));--0-icon-layer-opacity: calc( (var(--0-icon-l-i) + 1) - var(--0-icon-l-i) - (var(--0-icon-l-i) * var(--0-icon-l-step)) );opacity:var(--0-icon-layer-opacity)}.la_9af0 [data-layer]{--0-icon-l-step: calc(1 / var(--0-icon-l-c));--0-icon-layer-opacity: calc((var(--0-icon-l-i) + 1) - ((var(--0-icon-l-i) + 1) * var(--0-icon-l-step)));opacity:var(--0-icon-layer-opacity)}.do_9bcc .mu_2455:not(.ma_30e1) [data-p-i]{--0-icon-fill-color: rgba(var(--0-c-v, 1));--0-icon-stroke-color: rgba(var(--0-c-v, 1))}.do_9bcc .mu_2455:not(.ma_30e1) [data-p-i="1"],.do_9bcc .mu_2455:not(.ma_30e1) [data-p-i="3"],.do_9bcc .mu_2455:not(.ma_30e1) [data-p-i="5"],.do_9bcc .mu_2455:not(.ma_30e1) [data-p-i="7"]{--0-icon-fill-color: rgba(var(--0-c2-v, 1));--0-icon-stroke-color: rgba(var(--0-c2-v, 1))}.do_9bcc .mu_2455:not(.ma_30e1).sh_0266 [data-p-i]{--0-icon-fill-color: rgba(var(--0-c2-v, 1));--0-icon-stroke-color: rgba(var(--0-c2-v, 1))}.tr_07fb .mu_2455:not(.ma_30e1) [data-p-i]{--0-icon-fill-color: rgba(var(--0-c-v, 1));--0-icon-stroke-color: rgba(var(--0-c-v, 1))}.tr_07fb .mu_2455:not(.ma_30e1) [data-p-i="1"],.tr_07fb .mu_2455:not(.ma_30e1) [data-p-i="4"],.tr_07fb .mu_2455:not(.ma_30e1) [data-p-i="7"]{--0-icon-fill-color: rgba(var(--0-c2-v, 1));--0-icon-stroke-color: rgba(var(--0-c2-v, var(--0-c-v)), 1)}.tr_07fb .mu_2455:not(.ma_30e1) [data-p-i="2"],.tr_07fb .mu_2455:not(.ma_30e1) [data-p-i="5"],.tr_07fb .mu_2455:not(.ma_30e1) [data-p-i="8"]{--0-icon-fill-color: rgba(var(--0-c3-v, 1));--0-icon-stroke-color: rgba(var(--0-c3-v, var(--0-c-v)), 1)}.tr_07fb .mu_2455:not(.ma_30e1).sh_0266 [data-p-i]{--0-icon-fill-color: rgba(var(--0-c2-v, 1));--0-icon-stroke-color: rgba(var(--0-c2-v, 1))}.tr_07fb .mu_2455:not(.ma_30e1).sh_0266 [data-p-i="1"],.tr_07fb .mu_2455:not(.ma_30e1).sh_0266 [data-p-i="3"],.tr_07fb .mu_2455:not(.ma_30e1).sh_0266 [data-p-i="5"]{--0-icon-fill-color: rgba(var(--0-c3-v, 1));--0-icon-stroke-color: rgba(var(--0-c3-v, var(--0-c-v)), 1)}defs>mask .ma_30e1:not(.mu_2455){color:#000!important;--0-icon-fill-color: #000 !important;--0-icon-stroke-color: #000 !important}.we_0775.jo_5839{stroke-linejoin:round}.we_0775.ca_45e8{stroke-linecap:round}.fl_4e44,.ro_299b{transform-origin:50% 50%}.fl_4e44{transform:scaleX(-1)}.ro_299b{transform:rotate(var(--0-icon-rotate, 0deg))}}
|