@yh-ui/icons 1.0.52 → 1.0.54
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 +58 -26
- package/dist/src/vue/icon.d.ts +2 -2
- package/dist/vue/icon.mjs +34 -26
- package/package.json +1 -1
package/dist/iconify.mjs
CHANGED
|
@@ -1,47 +1,79 @@
|
|
|
1
|
-
import { Icon as
|
|
2
|
-
import { h
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Icon as p, getIcon as d, loadIcon as u, addAPIProvider as l } from "@iconify/vue";
|
|
2
|
+
import { h } from "vue";
|
|
3
|
+
try {
|
|
4
|
+
l("", {
|
|
5
|
+
resources: ["https://api.iconify.design", "https://api.simplesvg.com"],
|
|
6
|
+
rotate: 1e3,
|
|
7
|
+
timeout: 3e3
|
|
8
|
+
});
|
|
9
|
+
} catch {
|
|
10
|
+
}
|
|
11
|
+
const f = "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(f)) return;
|
|
22
|
+
const t = document.createElement("style");
|
|
23
|
+
t.id = f, t.textContent = m, document.head.appendChild(t);
|
|
24
|
+
}
|
|
25
|
+
function I(t) {
|
|
26
|
+
const { icon: e, size: o, color: n, spin: i, rotate: a } = t, r = {}, s = [];
|
|
27
|
+
if (o) {
|
|
28
|
+
const c = typeof o == "number" ? `${o}px` : o;
|
|
29
|
+
r.width = c, r.height = c, r.fontSize = c;
|
|
8
30
|
}
|
|
9
|
-
return
|
|
10
|
-
icon:
|
|
11
|
-
|
|
31
|
+
return n && (r.color = n), a && (r.transform = `rotate(${a}deg)`), i && (g(), s.push("yh-icons--spin")), {
|
|
32
|
+
icon: e,
|
|
33
|
+
class: s.length > 0 ? s.join(" ") : void 0,
|
|
34
|
+
style: Object.keys(r).length > 0 ? r : void 0
|
|
12
35
|
};
|
|
13
36
|
}
|
|
14
|
-
function
|
|
37
|
+
function S() {
|
|
15
38
|
return (t) => {
|
|
16
|
-
const
|
|
17
|
-
return
|
|
39
|
+
const e = I(t);
|
|
40
|
+
return h(p, e);
|
|
18
41
|
};
|
|
19
42
|
}
|
|
20
|
-
function
|
|
43
|
+
function y(t) {
|
|
21
44
|
return t.includes(":") ? t : t.includes("/") ? t.replace("/", ":") : `mdi:${t}`;
|
|
22
45
|
}
|
|
23
|
-
async function
|
|
46
|
+
async function v(t) {
|
|
47
|
+
if (typeof t != "string" || !t.trim())
|
|
48
|
+
return !1;
|
|
24
49
|
try {
|
|
25
|
-
|
|
50
|
+
const e = y(t);
|
|
51
|
+
if (!/^[a-z0-9-]+:[a-z0-9-_]+$/i.test(e))
|
|
52
|
+
return !1;
|
|
53
|
+
const n = d(e);
|
|
54
|
+
if (n && n.body && typeof n.body == "string" && n.body.trim().length > 0)
|
|
55
|
+
return !0;
|
|
56
|
+
const i = await u(e);
|
|
57
|
+
return !!(i && i.body && typeof i.body == "string" && i.body.trim().length > 0);
|
|
26
58
|
} catch {
|
|
27
59
|
return !1;
|
|
28
60
|
}
|
|
29
61
|
}
|
|
30
|
-
async function
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
62
|
+
async function x(t) {
|
|
63
|
+
const e = y(t), o = d(e);
|
|
64
|
+
if (o) return o;
|
|
33
65
|
try {
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
66
|
+
const n = await u(e);
|
|
67
|
+
if (!n)
|
|
36
68
|
throw new Error(`Icon not found: ${t}`);
|
|
37
|
-
return
|
|
69
|
+
return n;
|
|
38
70
|
} catch {
|
|
39
71
|
throw new Error(`Failed to load icon: ${t}`);
|
|
40
72
|
}
|
|
41
73
|
}
|
|
42
74
|
export {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
75
|
+
S as createIconifyComponent,
|
|
76
|
+
x as getIconData,
|
|
77
|
+
v as iconExists,
|
|
78
|
+
y as parseIconName
|
|
47
79
|
};
|
package/dist/src/vue/icon.d.ts
CHANGED
|
@@ -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
|
|
2
|
-
import { Icon as
|
|
3
|
-
import { COMMON_ICONS as
|
|
4
|
-
const
|
|
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
|
|
14
|
-
if (typeof document > "u" || document.getElementById(
|
|
13
|
+
function s() {
|
|
14
|
+
if (typeof document > "u" || document.getElementById(u)) return;
|
|
15
15
|
const e = document.createElement("style");
|
|
16
|
-
e.id =
|
|
16
|
+
e.id = u, e.textContent = v, document.head.appendChild(e);
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return e ? e.includes(":") || e.includes("/") ? e.replace("/", ":") : e in
|
|
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
|
-
|
|
95
|
-
e.spin &&
|
|
102
|
+
m(() => {
|
|
103
|
+
e.spin && s();
|
|
96
104
|
});
|
|
97
|
-
const n = r(() => e.icon ?
|
|
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
|
-
),
|
|
105
|
-
return () => (e.spin &&
|
|
106
|
-
class:
|
|
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 ?
|
|
110
|
-
class:
|
|
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 ?
|
|
125
|
+
}) : n.value ? o(y, {
|
|
118
126
|
icon: n.value,
|
|
119
|
-
class:
|
|
127
|
+
class: c.value,
|
|
120
128
|
style: i.value,
|
|
121
129
|
...t
|
|
122
|
-
}) :
|
|
123
|
-
class: ["yh-icon",
|
|
130
|
+
}) : o("span", {
|
|
131
|
+
class: ["yh-icon", c.value],
|
|
124
132
|
style: i.value,
|
|
125
133
|
...t
|
|
126
134
|
}));
|
|
127
135
|
}
|
|
128
|
-
}), z = h,
|
|
129
|
-
ensureSpinStyle:
|
|
130
|
-
resolveIconName:
|
|
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
|
-
|
|
144
|
+
x as __test__
|
|
137
145
|
};
|