@yh-ui/icons 1.0.52 → 1.0.53

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/iconify.mjs CHANGED
@@ -1,47 +1,70 @@
1
- import { Icon as f, getIcon as u, loadIcon as p } from "@iconify/vue";
2
- import { h as d } from "vue";
3
- function l(t) {
4
- const { icon: o, size: r, color: e, spin: a, rotate: i } = t, n = {};
5
- if (r) {
6
- const c = typeof r == "number" ? `${r}px` : r;
7
- n.width = c, n.height = c, n.fontSize = c;
1
+ import { Icon as u, getIcon as p, loadIcon as l, addAPIProvider as y } from "@iconify/vue";
2
+ import { h } from "vue";
3
+ try {
4
+ y("", {
5
+ resources: ["https://api.iconify.design", "https://api.simplesvg.com"],
6
+ rotate: 1e3,
7
+ timeout: 3e3
8
+ });
9
+ } catch {
10
+ }
11
+ const a = "yh-icon-spin-style", m = `
12
+ @keyframes yh-icon-spin {
13
+ from { transform: rotate(0deg); }
14
+ to { transform: rotate(360deg); }
15
+ }
16
+ .yh-icons--spin {
17
+ animation: yh-icon-spin 1s linear infinite;
18
+ }
19
+ `;
20
+ function g() {
21
+ if (typeof document > "u" || document.getElementById(a)) return;
22
+ const t = document.createElement("style");
23
+ t.id = a, t.textContent = m, document.head.appendChild(t);
24
+ }
25
+ function I(t) {
26
+ const { icon: n, size: e, color: r, spin: f, rotate: s } = t, o = {}, i = [];
27
+ if (e) {
28
+ const c = typeof e == "number" ? `${e}px` : e;
29
+ o.width = c, o.height = c, o.fontSize = c;
8
30
  }
9
- return e && (n.color = e), i && (n.transform = `rotate(${i}deg)`), a && (n.animation = "spin 1s linear infinite"), {
10
- icon: o,
11
- style: Object.keys(n).length > 0 ? n : void 0
31
+ return r && (o.color = r), s && (o.transform = `rotate(${s}deg)`), f && (g(), i.push("yh-icons--spin")), {
32
+ icon: n,
33
+ class: i.length > 0 ? i.join(" ") : void 0,
34
+ style: Object.keys(o).length > 0 ? o : void 0
12
35
  };
13
36
  }
14
- function g() {
37
+ function w() {
15
38
  return (t) => {
16
- const o = l(t);
17
- return d(f, o);
39
+ const n = I(t);
40
+ return h(u, n);
18
41
  };
19
42
  }
20
- function s(t) {
43
+ function d(t) {
21
44
  return t.includes(":") ? t : t.includes("/") ? t.replace("/", ":") : `mdi:${t}`;
22
45
  }
23
- async function m(t) {
46
+ async function E(t) {
24
47
  try {
25
- return !!s(t);
48
+ return !!d(t);
26
49
  } catch {
27
50
  return !1;
28
51
  }
29
52
  }
30
- async function I(t) {
31
- const o = s(t), r = u(o);
32
- if (r) return r;
53
+ async function N(t) {
54
+ const n = d(t), e = p(n);
55
+ if (e) return e;
33
56
  try {
34
- const e = await p(o);
35
- if (!e)
57
+ const r = await l(n);
58
+ if (!r)
36
59
  throw new Error(`Icon not found: ${t}`);
37
- return e;
60
+ return r;
38
61
  } catch {
39
62
  throw new Error(`Failed to load icon: ${t}`);
40
63
  }
41
64
  }
42
65
  export {
43
- g as createIconifyComponent,
44
- I as getIconData,
45
- m as iconExists,
46
- s as parseIconName
66
+ w as createIconifyComponent,
67
+ N as getIconData,
68
+ E as iconExists,
69
+ d as parseIconName
47
70
  };
@@ -144,11 +144,11 @@ export declare const YhIcon: import('vue').DefineComponent<import('vue').Extract
144
144
  default: number;
145
145
  };
146
146
  }>> & Readonly<{}>, {
147
+ rotate: number;
147
148
  icon: string;
148
149
  size: IconSize;
149
150
  color: string;
150
151
  spin: boolean;
151
- rotate: number;
152
152
  svg: string;
153
153
  name: string;
154
154
  component: object | ((...args: unknown[]) => unknown);
@@ -279,11 +279,11 @@ export declare const Icon: import('vue').DefineComponent<import('vue').ExtractPr
279
279
  default: number;
280
280
  };
281
281
  }>> & Readonly<{}>, {
282
+ rotate: number;
282
283
  icon: string;
283
284
  size: IconSize;
284
285
  color: string;
285
286
  spin: boolean;
286
- rotate: number;
287
287
  svg: string;
288
288
  name: string;
289
289
  component: object | ((...args: unknown[]) => unknown);
package/dist/vue/icon.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { defineComponent as d, onMounted as y, computed as r, h as c } from "vue";
2
- import { Icon as m } from "@iconify/vue";
3
- import { COMMON_ICONS as s } from "../presets.mjs";
4
- const a = "yh-icon-spin-style", v = `
1
+ import { defineComponent as d, onMounted as m, computed as r, h as o } from "vue";
2
+ import { Icon as y } from "@iconify/vue";
3
+ import { COMMON_ICONS as l } from "../presets.mjs";
4
+ const u = "yh-icon-spin-style", v = `
5
5
  @keyframes yh-icon-spin {
6
6
  from { transform: rotate(0deg); }
7
7
  to { transform: rotate(360deg); }
@@ -10,13 +10,13 @@ const a = "yh-icon-spin-style", v = `
10
10
  animation: yh-icon-spin 1s linear infinite;
11
11
  }
12
12
  `;
13
- function l() {
14
- if (typeof document > "u" || document.getElementById(a)) return;
13
+ function s() {
14
+ if (typeof document > "u" || document.getElementById(u)) return;
15
15
  const e = document.createElement("style");
16
- e.id = a, e.textContent = v, document.head.appendChild(e);
16
+ e.id = u, e.textContent = v, document.head.appendChild(e);
17
17
  }
18
- function u(e) {
19
- return e ? e.includes(":") || e.includes("/") ? e.replace("/", ":") : e in s ? s[e] : `mdi:${e}` : "";
18
+ function a(e) {
19
+ return e ? e.includes(":") || e.includes("/") ? e.replace("/", ":") : e in l ? l[e] : `mdi:${e}` : "";
20
20
  }
21
21
  function f(e) {
22
22
  const t = {};
@@ -26,6 +26,14 @@ function f(e) {
26
26
  }
27
27
  return e.color && (t.color = e.color), e.rotate && !e.spin && (t.transform = `rotate(${e.rotate}deg)`), Object.keys(t).length > 0 ? t : void 0;
28
28
  }
29
+ function g(e) {
30
+ if (!e) return "";
31
+ let t = e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "");
32
+ return t = t.replace(/\son[a-z]+\s*=\s*(['"][^'"]*['"]|[^\s>]+)/gi, ""), t = t.replace(/href\s*=\s*(['"]javascript:[^'"]*['"]|javascript:[^\s>]+)/gi, ""), t = t.replace(/xlink:href\s*=\s*(['"]javascript:[^'"]*['"]|javascript:[^\s>]+)/gi, ""), t = t.replace(
33
+ /(?:href|src|xlink:href)\s*=\s*['"]\s*(?:data:(?:text\/html|image\/svg\+xml;utf8|image\/svg\+xml;base64)|javascript|vbscript):[^'"]*['"]/gi,
34
+ ""
35
+ ), t;
36
+ }
29
37
  const h = d({
30
38
  name: "YhIconIconify",
31
39
  inheritAttrs: !1,
@@ -91,47 +99,47 @@ const h = d({
91
99
  }
92
100
  },
93
101
  setup(e, { attrs: t }) {
94
- y(() => {
95
- e.spin && l();
102
+ m(() => {
103
+ e.spin && s();
96
104
  });
97
- const n = r(() => e.icon ? u(e.icon) : e.name ? u(e.name) : ""), i = r(
105
+ const n = r(() => e.icon ? a(e.icon) : e.name ? a(e.name) : ""), i = r(
98
106
  () => f({
99
107
  size: e.size,
100
108
  color: e.color,
101
109
  rotate: e.rotate,
102
110
  spin: e.spin
103
111
  })
104
- ), o = r(() => e.spin ? "yh-icons--spin" : "");
105
- return () => (e.spin && l(), e.component ? c(e.component, {
106
- class: o.value,
112
+ ), c = r(() => e.spin ? "yh-icons--spin" : "");
113
+ return () => (e.spin && s(), e.component ? o(e.component, {
114
+ class: c.value,
107
115
  style: i.value,
108
116
  ...t
109
- }) : e.svg ? c("svg", {
110
- class: o.value,
117
+ }) : e.svg ? o("svg", {
118
+ class: c.value,
111
119
  style: i.value,
112
120
  viewBox: "0 0 24 24",
113
121
  xmlns: "http://www.w3.org/2000/svg",
114
122
  "aria-hidden": "true",
115
- innerHTML: e.svg,
123
+ innerHTML: g(e.svg),
116
124
  ...t
117
- }) : n.value ? c(m, {
125
+ }) : n.value ? o(y, {
118
126
  icon: n.value,
119
- class: o.value,
127
+ class: c.value,
120
128
  style: i.value,
121
129
  ...t
122
- }) : c("span", {
123
- class: ["yh-icon", o.value],
130
+ }) : o("span", {
131
+ class: ["yh-icon", c.value],
124
132
  style: i.value,
125
133
  ...t
126
134
  }));
127
135
  }
128
- }), z = h, C = {
129
- ensureSpinStyle: l,
130
- resolveIconName: u,
136
+ }), z = h, x = {
137
+ ensureSpinStyle: s,
138
+ resolveIconName: a,
131
139
  createIconStyle: f
132
140
  };
133
141
  export {
134
142
  z as Icon,
135
143
  h as YhIcon,
136
- C as __test__
144
+ x as __test__
137
145
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yh-ui/icons",
3
- "version": "1.0.52",
3
+ "version": "1.0.53",
4
4
  "description": "YH-UI Icons - High performance icon library with Iconify integration",
5
5
  "type": "module",
6
6
  "sideEffects": false,