@ui0/icon 0.1.2 → 0.1.4

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