@ui0/icon 0.1.1 → 0.1.3

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 +0 -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 +342 -279
  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 +15 -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,14 +1,14 @@
1
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";
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
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();
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
12
  if (!s) throw ce("getIcon");
13
13
  return s.appContext.config.globalProperties.$ui0Icon;
14
14
  }
@@ -32,32 +32,32 @@ const ye = {
32
32
  guides: !1
33
33
  }
34
34
  };
35
- function we(n, s) {
35
+ function be(o, s) {
36
36
  const e = [
37
- n,
37
+ o,
38
38
  s,
39
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;
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;
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, r) => i(r),
48
+ ownKeys: () => [...new Set(e.flatMap((n) => n ? Object.keys(n) : []))],
49
+ getOwnPropertyDescriptor: (n, r) => ({
50
50
  enumerable: !0,
51
51
  configurable: !0,
52
- value: f(p)
52
+ value: i(r)
53
53
  })
54
54
  });
55
55
  }
56
- const K = Symbol("ui0-icon-framework");
57
- function be() {
58
- return R(K, {});
56
+ const Q = Symbol("ui0-icon-framework");
57
+ function xe() {
58
+ return z(Q, {});
59
59
  }
60
- const G = {
60
+ const Y = {
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 Ie(o) {
69
+ return o in Y;
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 F(o) {
75
+ return (s) => B("g", o, s || []);
76
76
  }
77
- class Ie {
77
+ class _e {
78
78
  constructor() {
79
- $(this, "stack", []);
79
+ V(this, "stack", []);
80
80
  }
81
81
  add(s) {
82
82
  this.stack.push(s);
@@ -85,36 +85,109 @@ 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 Se(o, s) {
89
+ const e = () => n.params.value ? `icon-${n.params.pack}-${n.params.value}` : "icon-none", n = {
90
90
  modifiers: [],
91
91
  params: {},
92
92
  getComponentName: e,
93
93
  getComponent: () => {
94
- const b = le(e());
95
- return typeof b == "string" ? null : b;
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;
96
98
  }
97
99
  };
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;
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;
101
103
  }
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 = {
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 = {
107
109
  ...s,
108
110
  ...e.params
109
111
  };
110
112
  return {
111
113
  ...e,
112
- params: f
114
+ params: i
113
115
  };
114
116
  }
115
- const Me = /* @__PURE__ */ pe({
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) : [];
119
+ }
120
+ function Me(o, s) {
121
+ 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);
125
+ }
126
+ return [...e];
127
+ }
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 = () => {
135
+ };
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();
143
+ };
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);
147
+ };
148
+ }, D = (g, k) => {
149
+ const P = {
150
+ pointerenter: () => {
151
+ k.hover = !0, r();
152
+ },
153
+ pointerleave: () => {
154
+ k.hover = !1, r();
155
+ },
156
+ pointerdown: (m) => L(m, k),
157
+ keydown: (m) => L(m, k),
158
+ focusin: () => {
159
+ k.focus = !0, r();
160
+ },
161
+ focusout: (m) => {
162
+ const E = m.relatedTarget;
163
+ k.focus = E !== null && g.contains(E), r();
164
+ }
165
+ };
166
+ for (const [m, E] of Object.entries(P)) g.addEventListener(m, E);
167
+ return () => {
168
+ for (const [m, E] of Object.entries(P)) g.removeEventListener(m, E);
169
+ };
170
+ }, M = D(o, e), O = i && i !== o ? D(i, n) : () => {
171
+ };
172
+ return r(), () => {
173
+ M(), O(), u();
174
+ };
175
+ }
176
+ function Ce() {
177
+ const o = pe({ hover: !1, active: !1, focus: !1 });
178
+ let s = null, e = () => {
179
+ };
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)) : () => {
183
+ });
184
+ };
185
+ return ue(() => i(null)), { state: o, elementRef: i };
186
+ }
187
+ const Pe = /* @__PURE__ */ fe({
116
188
  __name: "icon",
117
189
  props: {
190
+ filled: { type: Boolean, default: void 0 },
118
191
  badge: {},
119
192
  display: {},
120
193
  shape: {},
@@ -134,200 +207,191 @@ const Me = /* @__PURE__ */ pe({
134
207
  height: {},
135
208
  color: {}
136
209
  },
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,
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,
150
223
  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}`);
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"];
230
+ 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}`);
163
233
  }
164
- return a;
234
+ return p;
165
235
  }
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
- }
236
+ const P = () => {
237
+ const { value: c } = s;
238
+ 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
182
254
  };
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
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);
195
263
  };
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,
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,
215
272
  class: [e.strokeMask, e.masked]
216
273
  });
217
- _.push(L(h.strokeMask, [I]));
274
+ _.push(R(d.strokeMask, [w]));
218
275
  }
219
276
  }
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,
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,
223
280
  class: e.masked
224
- }), S = x(h.badge, y, {
225
- ...w,
281
+ }), I = S(d.badge, b, {
282
+ ...M,
226
283
  class: e.masked
227
284
  });
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()
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()
234
291
  };
235
- B.push(
236
- x(
237
- h.shape,
292
+ w.push(
293
+ S(
294
+ d.shape,
238
295
  {},
239
296
  {
240
- ...I,
297
+ ...C,
241
298
  class: [e.strokeMask, e.shapeStrokeMask, e.masked]
242
299
  }
243
300
  )
244
301
  );
245
302
  }
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()
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()
252
309
  })
253
- ), u.push(x(h.shape, {}, l ? { mask: h.iconMask } : { mask: h.iconMask }));
310
+ ), h.push(S(d.shape, {}, v ? { mask: d.iconMask } : { mask: d.iconMask }));
254
311
  }
255
- o.badge && u.push(x(h.badge, y, l ? w : { ...w }));
312
+ t.badge && h.push(S(d.badge, b, v ? M : { ...M }));
256
313
  }
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,
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 = {
322
+ fit: c.params.fit ?? "default",
323
+ progress: c.params.progress ?? 100,
324
+ rendering: c.params.rendering,
325
+ modifiers: l
326
+ }, a = [e.layerStyle], h = {
327
+ class: a,
268
328
  style: "--0-icon-weight: 800;"
269
329
  };
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`
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;
334
+ return t.add(
335
+ F({
336
+ "data-icon-rotate": "",
337
+ transform: `rotate(${Number.isFinite(b) ? b : 0} ${$} ${j})`
274
338
  })
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
339
+ ), t.render();
340
+ }, J = (c, p = {}, t = {}, f) => {
341
+ let l = {
342
+ "--0-icon-weight": +(p.weight ?? 400) / 100 * u.getStrokeUnit(),
343
+ "--0-icon-progress": p.progress ?? 100
280
344
  };
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
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 = {
348
+ href: `#${c}`,
349
+ style: l,
350
+ ...t,
351
+ class: v
288
352
  };
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%"
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;
358
+ return l === "rect" || l === "circle" ? t.push(
359
+ B("rect", {
360
+ ...f,
361
+ rx: l === "circle" ? "50%" : "10%"
298
362
  // mask: 'url(#badgenumber)'
299
363
  })
300
- ) : xe(i) && o.push(
301
- k("path", {
364
+ ) : Ie(l) && t.push(
365
+ B("path", {
302
366
  // 'stroke-width': 80,
303
- ...r,
367
+ ...f,
304
368
  x: void 0,
305
369
  y: void 0,
306
370
  "stroke-linejoin": "round",
307
371
  "stroke-linecap": "round",
308
- d: G[i]
372
+ d: Y[l]
309
373
  // !asMask ? shapes[p.shape] : scalePath(shapes[p.shape], .4),
310
374
  })
311
- ), o;
375
+ ), t;
312
376
  };
313
- function Y(t) {
314
- const i = m.viewBox.height - m.viewBox.height / 16, l = i, d = i, u = (
377
+ function ee(c) {
378
+ const l = u.viewBox.height - u.viewBox.height / 16, v = l, a = l, h = (
315
379
  /* isChild && isMask ? measure.x : */
316
- m.viewBox.width / 32
380
+ u.viewBox.width / 32
317
381
  ), _ = (
318
382
  /*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,
383
+ u.viewBox.height / 32
384
+ ), A = [e.shape];
385
+ return n && A.push(...n.classes(c.params, e)), {
386
+ class: A,
323
387
  // mask,
324
- x: u,
388
+ x: h,
325
389
  y: _,
326
- height: l,
327
- width: d
390
+ height: v,
391
+ width: a
328
392
  };
329
393
  }
330
- function q() {
394
+ function se() {
331
395
  return {
332
396
  viewBox: {
333
397
  width: 960,
@@ -348,93 +412,92 @@ const Me = /* @__PURE__ */ pe({
348
412
  }
349
413
  };
350
414
  }
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)
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)
358
422
  return {
359
423
  x: "0",
360
424
  y: "0",
361
- width: `${o}px`,
362
- height: `${o}px`
425
+ width: `${t}px`,
426
+ height: `${t}px`
363
427
  };
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" ? {
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" ? {
367
431
  small: 4,
368
432
  normal: 3,
369
433
  large: 2
370
- }[u] : 3, C = r / P, [se, oe] = _.split(/\s|-|,/).map(Number), F = P - 1;
434
+ }[h] : 3, w = f / I, [C, K] = _.split(/\s|-|,/).map(Number), T = I - 1;
371
435
  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`
436
+ x: `${l + Math.min(C, T) * w}`,
437
+ y: `${l + Math.min(K, T) * w}`,
438
+ width: `${$}px`,
439
+ height: `${$}px`
376
440
  };
377
441
  }
378
- const S = (I) => {
379
- const P = I === "x" ? M : y, C = r - g;
380
- switch (P) {
442
+ const j = (x) => {
443
+ const I = x === "x" ? A : b, w = f - $;
444
+ switch (I) {
381
445
  case "center":
382
- return i + C / 2;
446
+ return l + w / 2;
383
447
  case "end":
384
- return i + C;
448
+ return l + w;
385
449
  default:
386
- return i;
450
+ return l;
387
451
  }
388
452
  };
389
453
  return {
390
- x: `${S("x")}`,
391
- y: `${S("y")}`,
392
- width: `${g}px`,
393
- height: `${g}px`
454
+ x: `${j("x")}`,
455
+ y: `${j("y")}`,
456
+ width: `${$}px`,
457
+ height: `${$}px`
394
458
  };
395
459
  }
396
- return (t, a) => (fe(), me(Q));
460
+ return (c, p) => (me(), ge(P));
397
461
  }
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;
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;
424
487
  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];
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];
430
493
  return e ? e + "/" + s.replace(e + "-", "") : s.replace(e + "-", "");
431
494
  }
432
- class qe {
495
+ class os {
433
496
  constructor() {
434
- $(this, "icons", []);
435
- $(this, "vueApp");
436
- $(this, "packs", {});
437
- $(this, "deferred", []);
497
+ V(this, "icons", []);
498
+ V(this, "vueApp");
499
+ V(this, "packs", {});
500
+ V(this, "deferred", []);
438
501
  }
439
502
  /**
440
503
  * add icon pack plugin
@@ -456,9 +519,9 @@ class qe {
456
519
  * @param component
457
520
  */
458
521
  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]);
522
+ 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]);
462
525
  }
463
526
  setVue(s) {
464
527
  if (!s) throw new Error("app is null");
@@ -468,29 +531,29 @@ class qe {
468
531
  throw new Error("vue already installed");
469
532
  }
470
533
  }
471
- function is(n = {}, s) {
472
- const e = new qe();
534
+ function ps(o = {}, s) {
535
+ const e = new os();
473
536
  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;
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;
477
540
  },
478
- use: (p) => {
479
- e.addPack(p);
541
+ use: (r) => {
542
+ e.addPack(r);
480
543
  },
481
- key: ve
544
+ key: we
482
545
  };
483
546
  }
484
- const es = "ic_c2d4", ss = "ca_a457", rs = {
485
- icon: es,
486
- canvas: ss
547
+ const ts = "ic_c2d4", ns = "ca_a457", us = {
548
+ icon: ts,
549
+ canvas: ns
487
550
  };
488
551
  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
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
496
559
  };