@ui0/icon 0.1.3 → 0.1.5

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/index.js CHANGED
@@ -1,18 +1,18 @@
1
- var te = Object.defineProperty;
2
- var ne = (o, s, e) => s in o ? te(o, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[s] = e;
3
- var V = (o, s, e) => ne(o, typeof s != "symbol" ? s + "" : s, e);
4
- import { newErrorForSetupCall as ce, isArray as ie, hyphenate as re } from "@ui0/util";
5
- import { inject as z, getCurrentInstance as ae, h as B, resolveComponent as le, reactive as pe, onScopeDispose as ue, defineComponent as fe, useCssModule as de, useAttrs as he, openBlock as me, createBlock as ge, mergeProps as G, camelize as ve } from "vue";
6
- import { useComponentId as ke } from "@ui0/composable";
7
- const we = Symbol.for("ui0-icon"), X = Symbol("ui0-icon-instance");
8
- function ls() {
9
- const o = z(X, void 0);
10
- if (o) return o;
11
- const s = ae();
12
- if (!s) throw ce("getIcon");
13
- return s.appContext.config.globalProperties.$ui0Icon;
1
+ var ne = Object.defineProperty;
2
+ var ce = (s, o, e) => o in s ? ne(s, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[o] = e;
3
+ var z = (s, o, e) => ce(s, typeof o != "symbol" ? o + "" : o, e);
4
+ import { newErrorForSetupCall as ie, isArray as re, hyphenate as ae } from "@ui0/util";
5
+ import { hasInjectionContext as le, inject as Z, h as E, reactive as pe, onScopeDispose as ue, resolveComponent as fe, defineComponent as de, useCssModule as he, useAttrs as me, openBlock as ge, createBlock as ve, mergeProps as G, camelize as ke } from "vue";
6
+ import { useComponentId as we } from "@ui0/composable";
7
+ const ye = Symbol.for("ui0-icon"), Y = Symbol("ui0-icon-instance");
8
+ function us() {
9
+ if (le()) {
10
+ const s = Z(Y, void 0);
11
+ if (s) return s;
12
+ }
13
+ throw ie("getIcon");
14
14
  }
15
- const ye = {
15
+ const be = {
16
16
  value: "fake",
17
17
  rotate: 0,
18
18
  weight: 400,
@@ -32,32 +32,32 @@ const ye = {
32
32
  guides: !1
33
33
  }
34
34
  };
35
- function be(o, s) {
35
+ function xe(s, o) {
36
36
  const e = [
37
- o,
38
37
  s,
39
- ye
40
- ], i = (n) => {
41
- for (const r of e) {
42
- const u = r == null ? void 0 : r[n];
43
- if (u !== void 0) return u;
38
+ o,
39
+ be
40
+ ], d = (n) => {
41
+ for (const i of e) {
42
+ const p = i == null ? void 0 : i[n];
43
+ if (p !== void 0) return p;
44
44
  }
45
45
  };
46
46
  return new Proxy({}, {
47
- get: (n, r) => i(r),
47
+ get: (n, i) => d(i),
48
48
  ownKeys: () => [...new Set(e.flatMap((n) => n ? Object.keys(n) : []))],
49
- getOwnPropertyDescriptor: (n, r) => ({
49
+ getOwnPropertyDescriptor: (n, i) => ({
50
50
  enumerable: !0,
51
51
  configurable: !0,
52
- value: i(r)
52
+ value: d(i)
53
53
  })
54
54
  });
55
55
  }
56
- const Q = Symbol("ui0-icon-framework");
57
- function xe() {
58
- return z(Q, {});
56
+ const J = Symbol("ui0-icon-framework");
57
+ function Ie() {
58
+ return Z(J, {});
59
59
  }
60
- const Y = {
60
+ const q = {
61
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
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
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",
@@ -65,126 +65,135 @@ const Y = {
65
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
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
67
  };
68
- function Ie(o) {
69
- return o in Y;
68
+ function _e(s) {
69
+ return s in q;
70
70
  }
71
- function W(o) {
72
- return !!o && "customOptions" in o;
71
+ function W(s) {
72
+ return !!s && "customOptions" in s;
73
73
  }
74
- function F(o) {
75
- return (s) => B("g", o, s || []);
74
+ function R(s) {
75
+ return (o) => E("g", s, o || []);
76
76
  }
77
- class _e {
77
+ class Se {
78
78
  constructor() {
79
- V(this, "stack", []);
79
+ z(this, "stack", []);
80
80
  }
81
- add(s) {
82
- this.stack.push(s);
81
+ add(o) {
82
+ this.stack.push(o);
83
83
  }
84
84
  render() {
85
- return this.stack.reduce((s, e) => e(s), {});
85
+ return this.stack.reduce((o, e) => e(o), {});
86
86
  }
87
87
  }
88
- function Se(o, s) {
89
- const e = () => n.params.value ? `icon-${n.params.pack}-${n.params.value}` : "icon-none", n = {
90
- modifiers: [],
91
- params: {},
92
- getComponentName: e,
93
- getComponent: () => {
94
- const k = z(Symbol.for("ui0-icon-generated"), {})[`${n.params.pack}/${n.params.value}`];
95
- if (k) return k;
96
- const P = le(e());
97
- return typeof P == "string" ? null : P;
98
- }
99
- };
100
- if (!o) return n;
101
- const r = o.includes("/") ? o : `/${o}`, [u, y = ""] = r.split("?", 2), d = u.indexOf("/"), L = u.slice(0, d), D = u.slice(d + 1), [M, ...O] = D.split(".");
102
- return O.length && (n.modifiers = O.reduce((g, k) => [...g, k.replace(":", "-")], [])), y && (n.params = Object.fromEntries(y.split("&").map((g) => g.split("=", 2)))), n.params.pack = L || s.pack || "ui0", M && (n.params.value = M), n;
103
- }
104
- function H(o, s) {
105
- const e = Se(o, s);
106
- for (const [n, r] of Object.entries(s))
107
- r !== void 0 && n !== "value" && e.params[n] === void 0 && (e.params[n] = r);
108
- const i = {
109
- ...s,
110
- ...e.params
111
- };
112
- return {
113
- ...e,
114
- params: i
115
- };
116
- }
117
- function Be(o) {
118
- return Array.isArray(o) ? o.filter((s) => typeof s == "string" && s.length > 0) : typeof o == "string" ? o.split(/[\s,]+/).filter(Boolean) : [];
88
+ function X(s) {
89
+ return Array.isArray(s) ? s.filter((o) => typeof o == "string" && o.length > 0) : typeof s == "string" ? s.split(/[\s,]+/).filter(Boolean) : [];
119
90
  }
120
- function Me(o, s) {
91
+ function Be(s, o) {
121
92
  const e = /* @__PURE__ */ new Set();
122
- for (const i of o) {
123
- const n = i.match(/^(.+?)(?::|-)(hover|active|focus)$/);
124
- n ? s[n[2]] && e.add(n[1]) : e.add(i);
93
+ for (const d of s) {
94
+ const n = d.match(/^(.+?)(?::|-)(hover|active|focus)$/);
95
+ n ? o[n[2]] && e.add(n[1]) : e.add(d);
125
96
  }
126
97
  return [...e];
127
98
  }
128
- function $e(o, s) {
129
- const e = { hover: o.matches(":hover"), active: o.matches(":active"), focus: o.matches(":focus-within") }, i = o.closest("button, input, a"), n = {
130
- hover: (i == null ? void 0 : i.matches(":hover")) ?? !1,
131
- active: (i == null ? void 0 : i.matches(":active")) ?? !1,
132
- focus: (i == null ? void 0 : i.matches(":focus-within")) ?? !1
133
- }, r = () => s({ hover: e.hover || n.hover, active: e.active || n.active, focus: e.focus || n.focus });
134
- let u = () => {
99
+ function Ee(s) {
100
+ return s.some((o) => /(?::|-)(hover|active|focus)$/.test(o));
101
+ }
102
+ function Me(s, o) {
103
+ const e = { hover: s.matches(":hover"), active: s.matches(":active"), focus: s.matches(":focus-within") }, d = () => s.closest("button, input, a, [data-icon-host]");
104
+ let n = null;
105
+ const i = { hover: !1, active: !1, focus: !1 }, p = () => o({ hover: e.hover || i.hover, active: e.active || i.active, focus: e.focus || i.focus });
106
+ let v = () => {
135
107
  };
136
- const y = () => {
137
- e.active = n.active = !1, u(), u = () => {
138
- }, r();
139
- }, d = o.ownerDocument.defaultView, L = (g, k) => {
140
- if (g.type === "pointerdown" && g.button !== 0 || g.type === "keydown" && ![" ", "Enter"].includes(g.key) || (y(), k.active = !0, r(), !d)) return;
141
- const P = (m) => {
142
- (m.type !== "keyup" || [" ", "Enter"].includes(m.key)) && y();
108
+ const h = () => {
109
+ e.active = i.active = !1, v(), v = () => {
110
+ }, p();
111
+ }, L = s.ownerDocument.defaultView, F = (f, P) => {
112
+ if (f.type === "pointerdown" && f.button !== 0 || f.type === "keydown" && ![" ", "Enter"].includes(f.key) || (h(), P.active = !0, p(), !L)) return;
113
+ const O = (g) => {
114
+ (g.type !== "keyup" || [" ", "Enter"].includes(g.key)) && h();
143
115
  };
144
- for (const m of ["pointerup", "pointercancel", "keyup", "blur"]) d.addEventListener(m, P);
145
- u = () => {
146
- for (const m of ["pointerup", "pointercancel", "keyup", "blur"]) d.removeEventListener(m, P);
116
+ for (const g of ["pointerup", "pointercancel", "keyup", "blur"]) L.addEventListener(g, O);
117
+ v = () => {
118
+ for (const g of ["pointerup", "pointercancel", "keyup", "blur"]) L.removeEventListener(g, O);
147
119
  };
148
- }, D = (g, k) => {
149
- const P = {
120
+ }, I = (f, P) => {
121
+ const O = {
150
122
  pointerenter: () => {
151
- k.hover = !0, r();
123
+ P.hover = !0, p();
152
124
  },
153
125
  pointerleave: () => {
154
- k.hover = !1, r();
126
+ P.hover = !1, p();
155
127
  },
156
- pointerdown: (m) => L(m, k),
157
- keydown: (m) => L(m, k),
128
+ pointerdown: (g) => F(g, P),
129
+ keydown: (g) => F(g, P),
158
130
  focusin: () => {
159
- k.focus = !0, r();
131
+ P.focus = !0, p();
160
132
  },
161
- focusout: (m) => {
162
- const E = m.relatedTarget;
163
- k.focus = E !== null && g.contains(E), r();
133
+ focusout: (g) => {
134
+ const A = g.relatedTarget;
135
+ P.focus = A !== null && f.contains(A), p();
164
136
  }
165
137
  };
166
- for (const [m, E] of Object.entries(P)) g.addEventListener(m, E);
138
+ for (const [g, A] of Object.entries(O)) f.addEventListener(g, A);
167
139
  return () => {
168
- for (const [m, E] of Object.entries(P)) g.removeEventListener(m, E);
140
+ for (const [g, A] of Object.entries(O)) f.removeEventListener(g, A);
169
141
  };
170
- }, M = D(o, e), O = i && i !== o ? D(i, n) : () => {
142
+ }, j = I(s, e);
143
+ let C = () => {
144
+ };
145
+ const _ = () => {
146
+ const f = d();
147
+ f !== n && (n = f, C(), C = f && f !== s ? I(f, i) : () => {
148
+ }, i.hover = (f == null ? void 0 : f.matches(":hover")) ?? !1, i.active = (f == null ? void 0 : f.matches(":active")) ?? !1, i.focus = (f == null ? void 0 : f.matches(":focus-within")) ?? !1);
171
149
  };
172
- return r(), () => {
173
- M(), O(), u();
150
+ _();
151
+ const D = () => _();
152
+ return s.addEventListener("pointerenter", _), s.addEventListener("focusin", _), s.ownerDocument.addEventListener("pointerover", D), p(), () => {
153
+ j(), C(), s.removeEventListener("pointerenter", _), s.removeEventListener("focusin", _), s.ownerDocument.removeEventListener("pointerover", D), v();
174
154
  };
175
155
  }
176
- function Ce() {
177
- const o = pe({ hover: !1, active: !1, focus: !1 });
178
- let s = null, e = () => {
156
+ function $e() {
157
+ const s = pe({ hover: !1, active: !1, focus: !1 });
158
+ let o = null, e = () => {
179
159
  };
180
- const i = (n) => {
181
- const r = n instanceof Element ? n : null;
182
- r !== s && (e(), s = r, Object.assign(o, { hover: !1, active: !1, focus: !1 }), e = r ? $e(r, (u) => Object.assign(o, u)) : () => {
160
+ const d = (n) => {
161
+ const i = n instanceof Element ? n : null;
162
+ i !== o && (e(), o = i, Object.assign(s, { hover: !1, active: !1, focus: !1 }), e = i ? Me(i, (p) => Object.assign(s, p)) : () => {
183
163
  });
184
164
  };
185
- return ue(() => i(null)), { state: o, elementRef: i };
165
+ return ue(() => d(null)), { state: s, elementRef: d };
186
166
  }
187
- const Pe = /* @__PURE__ */ fe({
167
+ function Ce(s, o) {
168
+ const e = () => n.params.value ? `icon-${n.params.pack}-${n.params.value}` : "icon-none", n = {
169
+ modifiers: [],
170
+ params: {},
171
+ getComponentName: e,
172
+ getComponent: () => {
173
+ const _ = Z(Symbol.for("ui0-icon-generated"), {})[`${n.params.pack}/${n.params.value}`];
174
+ if (_) return _;
175
+ const D = fe(e());
176
+ return typeof D == "string" ? null : D;
177
+ }
178
+ };
179
+ if (!s) return n;
180
+ const i = s.includes("/") ? s : `/${s}`, [p, v = ""] = i.split("?", 2), h = p.indexOf("/"), L = p.slice(0, h), F = p.slice(h + 1), [I, ...j] = F.split(".");
181
+ return j.length && (n.modifiers = j.reduce((C, _) => [...C, _.replace(":", "-")], [])), v && (n.params = Object.fromEntries(v.split("&").map((C) => C.split("=", 2)))), n.params.pack = L || o.pack || "ui0", I && (n.params.value = I), n;
182
+ }
183
+ function Q(s, o) {
184
+ const e = Ce(s, o);
185
+ for (const [n, i] of Object.entries(o))
186
+ i !== void 0 && n !== "value" && e.params[n] === void 0 && (e.params[n] = i);
187
+ const d = {
188
+ ...o,
189
+ ...e.params
190
+ };
191
+ return {
192
+ ...e,
193
+ params: d
194
+ };
195
+ }
196
+ const Pe = /* @__PURE__ */ de({
188
197
  __name: "icon",
189
198
  props: {
190
199
  filled: { type: Boolean, default: void 0 },
@@ -207,191 +216,194 @@ const Pe = /* @__PURE__ */ fe({
207
216
  height: {},
208
217
  color: {}
209
218
  },
210
- setup(o) {
211
- var Z, U;
212
- const s = o, e = de(), i = xe(), n = (Z = i.useTheme) == null ? void 0 : Z.call(i, s, e), r = be(s, (U = i.useDefaults) == null ? void 0 : U.call(i)), u = se(), [, y] = ke("icon"), d = {
213
- badge: y("badge"),
214
- radial: y("radial"),
215
- shape: y("shape"),
216
- shapeBadge: y("shape-badge"),
217
- strokeMask: y("stroke-mask"),
218
- shapeStrokeMask: y("shape-stroke-mask"),
219
- icon: y("icon"),
220
- iconMask: y("mask-icon")
221
- }, L = B("rect", {
222
- ...u.viewBox,
219
+ setup(s) {
220
+ var U, H;
221
+ const o = s, e = he(), d = Ie(), n = (U = d.useTheme) == null ? void 0 : U.call(d, o, e), i = xe(o, (H = d.useDefaults) == null ? void 0 : H.call(d)), p = oe(), [, v] = we("icon"), h = {
222
+ badge: v("badge"),
223
+ radial: v("radial"),
224
+ shape: v("shape"),
225
+ shapeBadge: v("shape-badge"),
226
+ strokeMask: v("stroke-mask"),
227
+ shapeStrokeMask: v("shape-stroke-mask"),
228
+ icon: v("icon"),
229
+ iconMask: v("mask-icon")
230
+ }, L = E("rect", {
231
+ ...p.viewBox,
223
232
  fill: "#FFF"
224
- }), M = {
225
- ...oe(s),
226
- viewBox: u.getViewBox()
227
- }, O = Ce(), g = he();
228
- function k(c) {
229
- const p = [], t = Object.keys(c), f = ["size", "color", "value", "fill", "weight"];
233
+ }), I = {
234
+ ...te(o),
235
+ viewBox: p.getViewBox()
236
+ }, j = $e(), C = me();
237
+ function _(c) {
238
+ const a = [], t = Object.keys(c), u = ["size", "color", "value", "fill", "weight"];
230
239
  for (let l = 0; l < t.length; l++) {
231
- const v = c[t[l]];
232
- f.includes(t[l]) && v !== void 0 && ["string", "number", "boolean"].includes(typeof v) && p.push(`icon-${t[l]}-${v}`);
240
+ const k = c[t[l]];
241
+ u.includes(t[l]) && k !== void 0 && ["string", "number", "boolean"].includes(typeof k) && a.push(`icon-${t[l]}-${k}`);
233
242
  }
234
- return p;
243
+ return a;
235
244
  }
236
- const P = () => {
237
- const { value: c } = s;
245
+ const D = () => {
246
+ const { value: c } = o;
238
247
  if (!c) return null;
239
- const p = H(ie(c) ? c[0] : c, r), t = [e.icon];
240
- n ? t.push(...n.classes(p.params)) : t.push(...k(p.params));
241
- const f = { class: t, ref: O.elementRef };
242
- if (p.params.value === "fake")
243
- return B("i", G(g, f));
244
- const l = E(p);
245
- return l ? B("i", G(g, f), l) : null;
246
- }, m = (c, p) => B("symbol", p, c), E = (c) => {
247
- const p = N(c);
248
- if (!p) return null;
249
- const t = c.params, f = t.color && t.color.length === 2, l = t.color && t.color.length > 2, v = (f || l) && t.rendering && t.rendering === "multicolor", a = [e.canvas];
250
- n && a.push(...n.classes(t, e));
251
- const h = [], _ = [], A = {
252
- viewBox: u.getViewBox(),
253
- class: a
248
+ const a = Q(re(c) ? c[0] : c, i), t = [e.icon];
249
+ n ? t.push(...n.classes(a.params)) : t.push(..._(a.params));
250
+ const u = {
251
+ class: t,
252
+ ref: Ee([...a.modifiers, ...X(a.params.modifiers)]) ? j.elementRef : void 0
253
+ };
254
+ if (a.params.value === "fake")
255
+ return E("i", G(C, u));
256
+ const l = P(a);
257
+ return l ? E("i", G(C, u), l) : null;
258
+ }, f = (c, a) => E("symbol", a, c), P = (c) => {
259
+ const a = O(c);
260
+ if (!a) return null;
261
+ const t = c.params, u = t.color && t.color.length === 2, l = t.color && t.color.length > 2, k = (u || l) && t.rendering && t.rendering === "multicolor", r = [e.canvas];
262
+ n && r.push(...n.classes(t, e));
263
+ const m = [], S = [], V = {
264
+ viewBox: p.getViewBox(),
265
+ class: r
254
266
  };
255
- f && a.push(e.doubleColored), l && a.push(e.tripleColored);
256
- let b = {};
257
- const $ = /* @__PURE__ */ new Map(), j = (x, I, w) => {
258
- const C = I.getComponent();
259
- W(C) && (Array.from(C.customOptions.modifiers).length > 0 || C.customOptions.flags.some((T) => ["animation", "animate"].includes(T))) ? $.set(x, () => N(I)) : h.push(m(w, { id: x, viewBox: u.getViewBox() }));
260
- }, S = (x, I = {}, w = {}) => {
261
- const C = $.get(x);
262
- return J(x, I, w, C);
267
+ u && r.push(e.doubleColored), l && r.push(e.tripleColored);
268
+ let y = {};
269
+ const M = /* @__PURE__ */ new Map(), T = (b, x, w) => {
270
+ const $ = x.getComponent();
271
+ W($) && (Array.from($.customOptions.modifiers).length > 0 || $.customOptions.flags.some((N) => ["animation", "animate"].includes(N))) ? M.set(b, () => O(x)) : m.push(f(w, { id: b, viewBox: p.getViewBox() }));
272
+ }, B = (b, x = {}, w = {}) => {
273
+ const $ = M.get(b);
274
+ return g(b, x, w, $);
263
275
  };
264
- if (j(d.icon, c, p), t.badge && typeof t.badge == "string") {
265
- const x = H(t.badge, {});
266
- b = x.params;
267
- const I = N(x);
268
- if (I) {
269
- j(d.badge, x, I), !t.shape && !b.shape && h.push(S(d.badge, b, M));
270
- const w = S(d.badge, b, {
271
- ...M,
276
+ if (T(h.icon, c, a), t.badge && typeof t.badge == "string") {
277
+ const b = Q(t.badge, {});
278
+ y = b.params;
279
+ const x = O(b);
280
+ if (x) {
281
+ T(h.badge, b, x), !t.shape && !y.shape && m.push(B(h.badge, y, I));
282
+ const w = B(h.badge, y, {
283
+ ...I,
272
284
  class: [e.strokeMask, e.masked]
273
285
  });
274
- _.push(R(d.strokeMask, [w]));
286
+ S.push(A(h.strokeMask, [w]));
275
287
  }
276
288
  }
277
- if ((!t.shape || v) && h.push(S(d.icon, t, { mask: d.strokeMask })), t.shape) {
278
- const x = S(d.icon, t, {
279
- mask: d.strokeMask,
289
+ if ((!t.shape || k) && m.push(B(h.icon, t, { mask: h.strokeMask })), t.shape) {
290
+ const b = B(h.icon, t, {
291
+ mask: h.strokeMask,
280
292
  class: e.masked
281
- }), I = S(d.badge, b, {
282
- ...M,
293
+ }), x = B(h.badge, y, {
294
+ ...I,
283
295
  class: e.masked
284
296
  });
285
- b.shape && h.push(S(d.shape, {}, { mask: d.badge, ...M }));
286
- const w = [x];
287
- if (t.badge && w.push(I), b.shape) {
288
- const C = {
289
- ...M,
290
- viewBox: u.getViewBox()
297
+ y.shape && m.push(B(h.shape, {}, { mask: h.badge, ...I }));
298
+ const w = [b];
299
+ if (t.badge && w.push(x), y.shape) {
300
+ const $ = {
301
+ ...I,
302
+ viewBox: p.getViewBox()
291
303
  };
292
304
  w.push(
293
- S(
294
- d.shape,
305
+ B(
306
+ h.shape,
295
307
  {},
296
308
  {
297
- ...C,
309
+ ...$,
298
310
  class: [e.strokeMask, e.shapeStrokeMask, e.masked]
299
311
  }
300
312
  )
301
313
  );
302
314
  }
303
- if (_.push(R(d.iconMask, w)), t.shape || b.shape) {
304
- const C = q(c);
305
- C && h.push(
306
- m(C, {
307
- id: d.shape,
308
- viewBox: u.getViewBox()
315
+ if (S.push(A(h.iconMask, w)), t.shape || y.shape) {
316
+ const $ = ee(c);
317
+ $ && m.push(
318
+ f($, {
319
+ id: h.shape,
320
+ viewBox: p.getViewBox()
309
321
  })
310
- ), h.push(S(d.shape, {}, v ? { mask: d.iconMask } : { mask: d.iconMask }));
322
+ ), m.push(B(h.shape, {}, k ? { mask: h.iconMask } : { mask: h.iconMask }));
311
323
  }
312
- t.badge && h.push(S(d.badge, b, v ? M : { ...M }));
324
+ t.badge && m.push(B(h.badge, y, k ? I : { ...I }));
313
325
  }
314
- return _.length && h.unshift(B("defs", _)), B("svg", A, h);
315
- }, N = (c) => {
316
- const p = c.getComponent();
317
- if (!W(p)) return null;
318
- const t = new _e(), f = p.customOptions, l = Me(
319
- [...c.modifiers, ...Be(c.params.modifiers)],
320
- O.state
321
- ), v = {
326
+ return S.length && m.unshift(E("defs", S)), E("svg", V, m);
327
+ }, O = (c) => {
328
+ const a = c.getComponent();
329
+ if (!W(a)) return null;
330
+ const t = new Se(), u = a.customOptions, l = Be(
331
+ [...c.modifiers, ...X(c.params.modifiers)],
332
+ j.state
333
+ ), k = {
322
334
  fit: c.params.fit ?? "default",
323
335
  progress: c.params.progress ?? 100,
324
336
  rendering: c.params.rendering,
325
337
  modifiers: l
326
- }, a = [e.layerStyle], h = {
327
- class: a,
338
+ }, r = [e.layerStyle], m = {
339
+ class: r,
328
340
  style: "--0-icon-weight: 800;"
329
341
  };
330
- f.flags.includes("no-fill") || a.push(e.fillable), !f.flags.includes("no-stroke") && !f.flags.includes("no-process-stroke") && a.push(e.weighty), f.flags.includes("no-cap") || a.push(e.cap), f.flags.includes("no-join") || a.push(e.join), c.params.shape && a.push(e.shaped);
331
- const _ = c.params.filled;
332
- (_ !== void 0 ? _ === !0 || _ === "true" : l.some((S) => S === "fill" || S === "filled")) && a.push(e.filled), c.params.rendering && a.push(e[ve(c.params.rendering)]), t.add(() => B(p, v)), t.add(F(h)), c.params.animation && t.add(F({})), (c.params.flipped || l.includes("flip")) && t.add(F({ class: e.flip }));
333
- const b = Number(c.params.rotate ?? 0), $ = u.viewBox.x + u.viewBox.width / 2, j = u.viewBox.y + u.viewBox.height / 2;
342
+ u.flags.includes("no-fill") || r.push(e.fillable), !u.flags.includes("no-stroke") && !u.flags.includes("no-process-stroke") && r.push(e.weighty), u.flags.includes("no-cap") || r.push(e.cap), u.flags.includes("no-join") || r.push(e.join), c.params.shape && r.push(e.shaped);
343
+ const S = c.params.filled;
344
+ (S !== void 0 ? S === !0 || S === "true" : l.some((B) => B === "fill" || B === "filled")) && r.push(e.filled), c.params.rendering && r.push(e[ke(c.params.rendering)]), t.add(() => E(a, k)), t.add(R(m)), c.params.animation && t.add(R({})), (c.params.flipped || l.includes("flip")) && t.add(R({ class: e.flip }));
345
+ const y = Number(c.params.rotate ?? 0), M = p.viewBox.x + p.viewBox.width / 2, T = p.viewBox.y + p.viewBox.height / 2;
334
346
  return t.add(
335
- F({
347
+ R({
336
348
  "data-icon-rotate": "",
337
- transform: `rotate(${Number.isFinite(b) ? b : 0} ${$} ${j})`
349
+ transform: `rotate(${Number.isFinite(y) ? y : 0} ${M} ${T})`
338
350
  })
339
351
  ), t.render();
340
- }, J = (c, p = {}, t = {}, f) => {
352
+ }, g = (c, a = {}, t = {}, u) => {
341
353
  let l = {
342
- "--0-icon-weight": +(p.weight ?? 400) / 100 * u.getStrokeUnit(),
343
- "--0-icon-progress": p.progress ?? 100
354
+ "--0-icon-weight": +(a.weight ?? 400) / 100 * p.getStrokeUnit(),
355
+ "--0-icon-progress": a.progress ?? 100
344
356
  };
345
- const v = Array.isArray(t.class) ? t.class : [t.class];
346
- n && (l = { ...l, ...n.styles(p) }, v.push(...n.classes(p, e)));
347
- const a = {
357
+ const k = Array.isArray(t.class) ? t.class : [t.class];
358
+ n && (l = { ...l, ...n.styles(a) }, k.push(...n.classes(a, e)));
359
+ const r = {
348
360
  href: `#${c}`,
349
361
  style: l,
350
362
  ...t,
351
- class: v
363
+ class: k
352
364
  };
353
- return t.mask && (a.mask = `url(#${t.mask})`), f ? (delete a.href, a.viewBox ?? (a.viewBox = u.getViewBox()), a["data-icon-inline"] = "", B("svg", a, [f()])) : B("use", a);
354
- }, R = (c, p = []) => B("mask", { id: c }, [L, ...p]), q = (c) => {
355
- const p = c.params;
356
- if (!p.shape) return;
357
- const t = [], f = ee(c), l = p.shape;
365
+ return t.mask && (r.mask = `url(#${t.mask})`), u ? (delete r.href, r.viewBox ?? (r.viewBox = p.getViewBox()), r["data-icon-inline"] = "", E("svg", r, [u()])) : E("use", r);
366
+ }, A = (c, a = []) => E("mask", { id: c }, [L, ...a]), ee = (c) => {
367
+ const a = c.params;
368
+ if (!a.shape) return;
369
+ const t = [], u = se(c), l = a.shape;
358
370
  return l === "rect" || l === "circle" ? t.push(
359
- B("rect", {
360
- ...f,
371
+ E("rect", {
372
+ ...u,
361
373
  rx: l === "circle" ? "50%" : "10%"
362
374
  // mask: 'url(#badgenumber)'
363
375
  })
364
- ) : Ie(l) && t.push(
365
- B("path", {
376
+ ) : _e(l) && t.push(
377
+ E("path", {
366
378
  // 'stroke-width': 80,
367
- ...f,
379
+ ...u,
368
380
  x: void 0,
369
381
  y: void 0,
370
382
  "stroke-linejoin": "round",
371
383
  "stroke-linecap": "round",
372
- d: Y[l]
384
+ d: q[l]
373
385
  // !asMask ? shapes[p.shape] : scalePath(shapes[p.shape], .4),
374
386
  })
375
387
  ), t;
376
388
  };
377
- function ee(c) {
378
- const l = u.viewBox.height - u.viewBox.height / 16, v = l, a = l, h = (
389
+ function se(c) {
390
+ const l = p.viewBox.height - p.viewBox.height / 16, k = l, r = l, m = (
379
391
  /* isChild && isMask ? measure.x : */
380
- u.viewBox.width / 32
381
- ), _ = (
392
+ p.viewBox.width / 32
393
+ ), S = (
382
394
  /*isChild && isMask ? measure.y : */
383
- u.viewBox.height / 32
384
- ), A = [e.shape];
385
- return n && A.push(...n.classes(c.params, e)), {
386
- class: A,
395
+ p.viewBox.height / 32
396
+ ), V = [e.shape];
397
+ return n && V.push(...n.classes(c.params, e)), {
398
+ class: V,
387
399
  // mask,
388
- x: h,
389
- y: _,
390
- height: v,
391
- width: a
400
+ x: m,
401
+ y: S,
402
+ height: k,
403
+ width: r
392
404
  };
393
405
  }
394
- function se() {
406
+ function oe() {
395
407
  return {
396
408
  viewBox: {
397
409
  width: 960,
@@ -412,36 +424,36 @@ const Pe = /* @__PURE__ */ fe({
412
424
  }
413
425
  };
414
426
  }
415
- function oe(c) {
416
- const { options: p } = c, t = 960, f = t / 4 * 3, l = (t - f) / 2, v = {
417
- small: f / 4,
418
- normal: f / 3,
419
- large: f / 2
420
- }, a = p == null ? void 0 : p.badge, h = a !== void 0 && a.scale || "normal", _ = a == null ? void 0 : a.cell, A = a == null ? void 0 : a.x, b = a == null ? void 0 : a.y;
421
- if (h === "full" || h === 1)
427
+ function te(c) {
428
+ const { options: a } = c, t = 960, u = t / 4 * 3, l = (t - u) / 2, k = {
429
+ small: u / 4,
430
+ normal: u / 3,
431
+ large: u / 2
432
+ }, r = a == null ? void 0 : a.badge, m = r !== void 0 && r.scale || "normal", S = r == null ? void 0 : r.cell, V = r == null ? void 0 : r.x, y = r == null ? void 0 : r.y;
433
+ if (m === "full" || m === 1)
422
434
  return {
423
435
  x: "0",
424
436
  y: "0",
425
437
  width: `${t}px`,
426
438
  height: `${t}px`
427
439
  };
428
- let $;
429
- if (typeof h == "number" ? $ = h > 0.75 ? h * t : Math.min(f, Math.round(f * h)) : $ = v[h], _) {
430
- const I = typeof h == "string" ? {
440
+ let M;
441
+ if (typeof m == "number" ? M = m > 0.75 ? m * t : Math.min(u, Math.round(u * m)) : M = k[m], S) {
442
+ const x = typeof m == "string" ? {
431
443
  small: 4,
432
444
  normal: 3,
433
445
  large: 2
434
- }[h] : 3, w = f / I, [C, K] = _.split(/\s|-|,/).map(Number), T = I - 1;
446
+ }[m] : 3, w = u / x, [$, K] = S.split(/\s|-|,/).map(Number), N = x - 1;
435
447
  return {
436
- x: `${l + Math.min(C, T) * w}`,
437
- y: `${l + Math.min(K, T) * w}`,
438
- width: `${$}px`,
439
- height: `${$}px`
448
+ x: `${l + Math.min($, N) * w}`,
449
+ y: `${l + Math.min(K, N) * w}`,
450
+ width: `${M}px`,
451
+ height: `${M}px`
440
452
  };
441
453
  }
442
- const j = (x) => {
443
- const I = x === "x" ? A : b, w = f - $;
444
- switch (I) {
454
+ const T = (b) => {
455
+ const x = b === "x" ? V : y, w = u - M;
456
+ switch (x) {
445
457
  case "center":
446
458
  return l + w / 2;
447
459
  case "end":
@@ -451,109 +463,110 @@ const Pe = /* @__PURE__ */ fe({
451
463
  }
452
464
  };
453
465
  return {
454
- x: `${j("x")}`,
455
- y: `${j("y")}`,
456
- width: `${$}px`,
457
- height: `${$}px`
466
+ x: `${T("x")}`,
467
+ y: `${T("y")}`,
468
+ width: `${M}px`,
469
+ height: `${M}px`
458
470
  };
459
471
  }
460
- return (c, p) => (me(), ge(P));
472
+ return (c, a) => (ge(), ve(D));
461
473
  }
462
- }), Ee = "ic_c2d4", Oe = "ca_a457", Ae = "si_e681", je = "st_39f2", Le = "sh_6010", Ve = "sh_f589", De = "la_1353", Te = "we_0775", Fe = "fi_ff74", Ne = "fi_8a2f", ze = "la_e3b8", Re = "ma_30e1", Ze = "la_9af0", Ue = "do_9bcc", Ke = "mu_2455", Ge = "sh_0266", We = "tr_07fb", He = "jo_5839", Xe = "ca_45e8", Qe = "fl_4e44", Ye = {
463
- icon: Ee,
464
- canvas: Oe,
465
- sizeCustom: Ae,
466
- strokeMask: je,
467
- shapeStrokeMask: Le,
468
- shape: Ve,
469
- layerStyle: De,
470
- weighty: Te,
471
- fillable: Fe,
472
- filled: Ne,
473
- layers: ze,
474
- masked: Re,
475
- layersShift: Ze,
476
- doubleColored: Ue,
477
- multicolor: Ke,
478
- shaped: Ge,
479
- tripleColored: We,
480
- join: He,
481
- cap: Xe,
482
- flip: Qe
483
- }, Je = (o, s) => {
484
- const e = o.__vccOpts || o;
485
- for (const [i, n] of s)
486
- e[i] = n;
474
+ }), Oe = "ic_c2d4", Ae = "ca_a457", Le = "si_3f5b", je = "si_e681", De = "st_39f2", Ve = "sh_6010", Te = "sh_f589", ze = "la_1353", Fe = "we_0775", Ne = "fi_ff74", Re = "fi_8a2f", Ze = "la_e3b8", Ue = "ma_30e1", He = "la_9af0", Ke = "do_9bcc", Ge = "mu_2455", We = "sh_0266", Xe = "tr_07fb", Qe = "jo_5839", Ye = "ca_45e8", Je = "fl_4e44", qe = {
475
+ icon: Oe,
476
+ canvas: Ae,
477
+ sized: Le,
478
+ sizeCustom: je,
479
+ strokeMask: De,
480
+ shapeStrokeMask: Ve,
481
+ shape: Te,
482
+ layerStyle: ze,
483
+ weighty: Fe,
484
+ fillable: Ne,
485
+ filled: Re,
486
+ layers: Ze,
487
+ masked: Ue,
488
+ layersShift: He,
489
+ doubleColored: Ke,
490
+ multicolor: Ge,
491
+ shaped: We,
492
+ tripleColored: Xe,
493
+ join: Qe,
494
+ cap: Ye,
495
+ flip: Je
496
+ }, es = (s, o) => {
497
+ const e = s.__vccOpts || s;
498
+ for (const [d, n] of o)
499
+ e[d] = n;
487
500
  return e;
488
- }, qe = {
489
- $style: Ye
490
- }, es = /* @__PURE__ */ Je(Pe, [["__cssModules", qe]]);
491
- function ss(o) {
492
- const s = re(o.replace("Icon", "")), e = s.split("-")[0];
493
- return e ? e + "/" + s.replace(e + "-", "") : s.replace(e + "-", "");
501
+ }, ss = {
502
+ $style: qe
503
+ }, os = /* @__PURE__ */ es(Pe, [["__cssModules", ss]]);
504
+ function ts(s) {
505
+ const o = ae(s.replace("Icon", "")), e = o.split("-")[0];
506
+ return e ? e + "/" + o.replace(e + "-", "") : o.replace(e + "-", "");
494
507
  }
495
- class os {
508
+ class ns {
496
509
  constructor() {
497
- V(this, "icons", []);
498
- V(this, "vueApp");
499
- V(this, "packs", {});
500
- V(this, "deferred", []);
510
+ z(this, "icons", []);
511
+ z(this, "vueApp");
512
+ z(this, "packs", {});
513
+ z(this, "deferred", []);
501
514
  }
502
515
  /**
503
516
  * add icon pack plugin
504
517
  * @param plugin
505
518
  */
506
- addPack(s) {
507
- Object.keys(s.components).forEach((e) => this.add(e, s.components[e])), this.packs[s.name] = s.config;
519
+ addPack(o) {
520
+ Object.keys(o.components).forEach((e) => this.add(e, o.components[e])), this.packs[o.name] = o.config;
508
521
  }
509
522
  /**
510
523
  * returns installed icons list
511
524
  * @param pack
512
525
  */
513
- list(s) {
514
- return s ? this.icons.filter((e) => e.startsWith(`${s}/`)) : this.icons;
526
+ list(o) {
527
+ return o ? this.icons.filter((e) => e.startsWith(`${o}/`)) : this.icons;
515
528
  }
516
529
  /**
517
530
  * add icon component
518
531
  * @param name
519
532
  * @param component
520
533
  */
521
- add(s, e) {
534
+ add(o, e) {
522
535
  var n;
523
- const i = ss(s);
524
- this.icons.push(i), this.vueApp ? (n = this.vueApp) == null || n.component(s, e) : this.deferred.push([s, e]);
536
+ const d = ts(o);
537
+ this.icons.push(d), this.vueApp ? (n = this.vueApp) == null || n.component(o, e) : this.deferred.push([o, e]);
525
538
  }
526
- setVue(s) {
527
- if (!s) throw new Error("app is null");
539
+ setVue(o) {
540
+ if (!o) throw new Error("app is null");
528
541
  if (!this.vueApp)
529
- this.vueApp = s, this.deferred.length && this.deferred.forEach((e) => s.component(...e));
542
+ this.vueApp = o, this.deferred.length && this.deferred.forEach((e) => o.component(...e));
530
543
  else
531
544
  throw new Error("vue already installed");
532
545
  }
533
546
  }
534
- function ps(o = {}, s) {
535
- const e = new os();
547
+ function fs(s = {}, o) {
548
+ const e = new ns();
536
549
  return {
537
- install: (r) => {
538
- if (!r) throw new Error("@ui0/icon can be run with vue 3 only");
539
- r.provide(X, e), o.framework && r.provide(Q, o.framework), r.component("Icon", es), e.setVue(r), r.config.globalProperties.$ui0Icon = e;
550
+ install: (i) => {
551
+ if (!i) throw new Error("@ui0/icon can be run with vue 3 only");
552
+ i.provide(Y, e), s.framework && i.provide(J, s.framework), i.component("Icon", os), e.setVue(i);
540
553
  },
541
- use: (r) => {
542
- e.addPack(r);
554
+ use: (i) => {
555
+ e.addPack(i);
543
556
  },
544
- key: we
557
+ key: ye
545
558
  };
546
559
  }
547
- const ts = "ic_c2d4", ns = "ca_a457", us = {
548
- icon: ts,
549
- canvas: ns
560
+ const cs = "ic_c2d4", is = "ca_a457", ds = {
561
+ icon: cs,
562
+ canvas: is
550
563
  };
551
564
  export {
552
- us as $style,
553
- es as Icon,
554
- Q as IconFrameworkKey,
555
- ps as createIcon,
556
- ls as getIcon,
557
- be as resolveIconDefaults,
558
- xe as useIconFramework
565
+ ds as $style,
566
+ os as Icon,
567
+ J as IconFrameworkKey,
568
+ fs as createIcon,
569
+ us as getIcon,
570
+ xe as resolveIconDefaults,
571
+ Ie as useIconFramework
559
572
  };