zxq-com 0.0.1 → 0.0.2
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.d.ts +19 -17
- package/dist/zxq-com.js +1095 -51
- package/dist/zxq-com.umd.cjs +1 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
|
+
import { Component } from 'vue';
|
|
2
3
|
import { ComponentOptionsMixin } from 'vue';
|
|
3
4
|
import { ComponentProvideOptions } from 'vue';
|
|
4
5
|
import { DefineComponent } from 'vue';
|
|
5
|
-
import { Fn } from '@vueuse/core';
|
|
6
6
|
import { PublicProps } from 'vue';
|
|
7
|
-
import { Ref } from 'vue';
|
|
8
7
|
import { ShallowRef } from 'vue';
|
|
9
8
|
import { WebSocketStatus } from '@vueuse/core';
|
|
10
9
|
|
|
11
10
|
declare const __VLS_component: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLButtonElement>;
|
|
12
11
|
|
|
12
|
+
declare type __VLS_Props = {
|
|
13
|
+
icon: string | Component;
|
|
14
|
+
};
|
|
15
|
+
|
|
13
16
|
declare function __VLS_template(): {
|
|
14
17
|
attrs: Partial<{}>;
|
|
15
18
|
slots: {
|
|
@@ -27,11 +30,6 @@ declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
|
27
30
|
};
|
|
28
31
|
};
|
|
29
32
|
|
|
30
|
-
declare const close_2: (code?: number, reason?: string) => void;
|
|
31
|
-
export { close_2 as close }
|
|
32
|
-
|
|
33
|
-
export declare const data: Ref<any, any>;
|
|
34
|
-
|
|
35
33
|
declare const _default: {
|
|
36
34
|
install(app: App): void;
|
|
37
35
|
};
|
|
@@ -42,15 +40,11 @@ export declare const EVENT_TYPE: {
|
|
|
42
40
|
readonly DEV2: "dev-2";
|
|
43
41
|
};
|
|
44
42
|
|
|
45
|
-
declare
|
|
46
|
-
export { open_2 as open }
|
|
47
|
-
|
|
48
|
-
export declare const send: (data: string | ArrayBuffer | Blob, useBuffer?: boolean) => boolean;
|
|
43
|
+
export declare function loadLocalSvgIcons(svgEagers: any): Promise<void>;
|
|
49
44
|
|
|
50
|
-
declare
|
|
51
|
-
export { status_2 as status }
|
|
45
|
+
declare function sendMsg(msg: WsMessage): void;
|
|
52
46
|
|
|
53
|
-
export declare function useWs<T = any>(event: WsMessageEvent): UseWsResult<T>;
|
|
47
|
+
export declare function useWs<T = any>(event: WsMessageEvent, config?: WsConfig): UseWsResult<T>;
|
|
54
48
|
|
|
55
49
|
export declare interface UseWsResult<T> {
|
|
56
50
|
on: (callback: (payload: T) => void) => void;
|
|
@@ -59,6 +53,12 @@ export declare interface UseWsResult<T> {
|
|
|
59
53
|
emit: (msg: WsMessage) => void;
|
|
60
54
|
}
|
|
61
55
|
|
|
56
|
+
export declare const ws: {
|
|
57
|
+
sendMsg: typeof sendMsg;
|
|
58
|
+
close: (code?: number, reason?: string) => void;
|
|
59
|
+
status: ShallowRef<WebSocketStatus>;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
62
|
export declare interface WsConfig {
|
|
63
63
|
url: string;
|
|
64
64
|
trustIp?: string;
|
|
@@ -71,10 +71,12 @@ export declare interface WsMessage {
|
|
|
71
71
|
timestamp?: number;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
export declare type WsMessageEvent = typeof EVENT_TYPE[keyof typeof EVENT_TYPE];
|
|
74
|
+
export declare type WsMessageEvent = typeof EVENT_TYPE[keyof typeof EVENT_TYPE] | string;
|
|
75
75
|
|
|
76
|
-
export declare
|
|
76
|
+
export declare const ZButton: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
77
77
|
|
|
78
|
-
export declare const
|
|
78
|
+
export declare const ZIcon: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
79
|
+
|
|
80
|
+
export declare function zwqWs(_app: any, config: WsConfig): void;
|
|
79
81
|
|
|
80
82
|
export { }
|
package/dist/zxq-com.js
CHANGED
|
@@ -1,18 +1,1029 @@
|
|
|
1
|
-
import { createElementBlock, defineComponent, onBeforeUnmount, openBlock, ref, renderSlot, watch } from "vue";
|
|
1
|
+
import { computed, createBlock, createElementBlock, defineComponent, h, nextTick, onBeforeUnmount, onMounted, onUnmounted, openBlock, ref, renderSlot, resolveDynamicComponent, shallowRef, unref, watch } from "vue";
|
|
2
2
|
import { useWebSocket } from "@vueuse/core";
|
|
3
3
|
var _hoisted_1 = { class: "zxq-button" }, Button_default = /* @__PURE__ */ defineComponent({
|
|
4
|
-
name: "
|
|
4
|
+
name: "ZButton",
|
|
5
5
|
__name: "Button",
|
|
6
|
-
setup(
|
|
7
|
-
return (
|
|
6
|
+
setup(i) {
|
|
7
|
+
return (i, N) => (openBlock(), createElementBlock("button", _hoisted_1, [renderSlot(i.$slots, "default")]));
|
|
8
8
|
}
|
|
9
|
+
}), matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/, stringToIcon = (i, N, P, F = "") => {
|
|
10
|
+
let I = i.split(":");
|
|
11
|
+
if (i.slice(0, 1) === "@") {
|
|
12
|
+
if (I.length < 2 || I.length > 3) return null;
|
|
13
|
+
F = I.shift().slice(1);
|
|
14
|
+
}
|
|
15
|
+
if (I.length > 3 || !I.length) return null;
|
|
16
|
+
if (I.length > 1) {
|
|
17
|
+
let i = I.pop(), P = I.pop(), L = {
|
|
18
|
+
provider: I.length > 0 ? I[0] : F,
|
|
19
|
+
prefix: P,
|
|
20
|
+
name: i
|
|
21
|
+
};
|
|
22
|
+
return N && !validateIconName(L) ? null : L;
|
|
23
|
+
}
|
|
24
|
+
let L = I[0], R = L.split("-");
|
|
25
|
+
if (R.length > 1) {
|
|
26
|
+
let i = {
|
|
27
|
+
provider: F,
|
|
28
|
+
prefix: R.shift(),
|
|
29
|
+
name: R.join("-")
|
|
30
|
+
};
|
|
31
|
+
return N && !validateIconName(i) ? null : i;
|
|
32
|
+
}
|
|
33
|
+
if (P && F === "") {
|
|
34
|
+
let i = {
|
|
35
|
+
provider: F,
|
|
36
|
+
prefix: "",
|
|
37
|
+
name: L
|
|
38
|
+
};
|
|
39
|
+
return N && !validateIconName(i, P) ? null : i;
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}, validateIconName = (i, N) => i ? !!((N && i.prefix === "" || i.prefix) && i.name) : !1, defaultIconDimensions = Object.freeze({
|
|
43
|
+
left: 0,
|
|
44
|
+
top: 0,
|
|
45
|
+
width: 16,
|
|
46
|
+
height: 16
|
|
47
|
+
}), defaultIconTransformations = Object.freeze({
|
|
48
|
+
rotate: 0,
|
|
49
|
+
vFlip: !1,
|
|
50
|
+
hFlip: !1
|
|
51
|
+
}), defaultIconProps = Object.freeze({
|
|
52
|
+
...defaultIconDimensions,
|
|
53
|
+
...defaultIconTransformations
|
|
54
|
+
}), defaultExtendedIconProps = Object.freeze({
|
|
55
|
+
...defaultIconProps,
|
|
56
|
+
body: "",
|
|
57
|
+
hidden: !1
|
|
9
58
|
});
|
|
59
|
+
function mergeIconTransformations(i, N) {
|
|
60
|
+
let P = {};
|
|
61
|
+
!i.hFlip != !N.hFlip && (P.hFlip = !0), !i.vFlip != !N.vFlip && (P.vFlip = !0);
|
|
62
|
+
let F = ((i.rotate || 0) + (N.rotate || 0)) % 4;
|
|
63
|
+
return F && (P.rotate = F), P;
|
|
64
|
+
}
|
|
65
|
+
function mergeIconData(i, N) {
|
|
66
|
+
let P = mergeIconTransformations(i, N);
|
|
67
|
+
for (let F in defaultExtendedIconProps) F in defaultIconTransformations ? F in i && !(F in P) && (P[F] = defaultIconTransformations[F]) : F in N ? P[F] = N[F] : F in i && (P[F] = i[F]);
|
|
68
|
+
return P;
|
|
69
|
+
}
|
|
70
|
+
function getIconsTree(i, N) {
|
|
71
|
+
let P = i.icons, F = i.aliases || /* @__PURE__ */ Object.create(null), I = /* @__PURE__ */ Object.create(null);
|
|
72
|
+
function L(i) {
|
|
73
|
+
if (P[i]) return I[i] = [];
|
|
74
|
+
if (!(i in I)) {
|
|
75
|
+
I[i] = null;
|
|
76
|
+
let N = F[i] && F[i].parent, P = N && L(N);
|
|
77
|
+
P && (I[i] = [N].concat(P));
|
|
78
|
+
}
|
|
79
|
+
return I[i];
|
|
80
|
+
}
|
|
81
|
+
return Object.keys(P).concat(Object.keys(F)).forEach(L), I;
|
|
82
|
+
}
|
|
83
|
+
function internalGetIconData(i, N, P) {
|
|
84
|
+
let F = i.icons, I = i.aliases || /* @__PURE__ */ Object.create(null), L = {};
|
|
85
|
+
function R(i) {
|
|
86
|
+
L = mergeIconData(F[i] || I[i], L);
|
|
87
|
+
}
|
|
88
|
+
return R(N), P.forEach(R), mergeIconData(i, L);
|
|
89
|
+
}
|
|
90
|
+
function parseIconSet(i, N) {
|
|
91
|
+
let P = [];
|
|
92
|
+
if (typeof i != "object" || typeof i.icons != "object") return P;
|
|
93
|
+
i.not_found instanceof Array && i.not_found.forEach((i) => {
|
|
94
|
+
N(i, null), P.push(i);
|
|
95
|
+
});
|
|
96
|
+
let F = getIconsTree(i);
|
|
97
|
+
for (let I in F) {
|
|
98
|
+
let L = F[I];
|
|
99
|
+
L && (N(I, internalGetIconData(i, I, L)), P.push(I));
|
|
100
|
+
}
|
|
101
|
+
return P;
|
|
102
|
+
}
|
|
103
|
+
var optionalPropertyDefaults = {
|
|
104
|
+
provider: "",
|
|
105
|
+
aliases: {},
|
|
106
|
+
not_found: {},
|
|
107
|
+
...defaultIconDimensions
|
|
108
|
+
};
|
|
109
|
+
function checkOptionalProps(i, N) {
|
|
110
|
+
for (let P in N) if (P in i && typeof i[P] != typeof N[P]) return !1;
|
|
111
|
+
return !0;
|
|
112
|
+
}
|
|
113
|
+
function quicklyValidateIconSet(i) {
|
|
114
|
+
if (typeof i != "object" || !i) return null;
|
|
115
|
+
let N = i;
|
|
116
|
+
if (typeof N.prefix != "string" || !i.icons || typeof i.icons != "object" || !checkOptionalProps(i, optionalPropertyDefaults)) return null;
|
|
117
|
+
let P = N.icons;
|
|
118
|
+
for (let i in P) {
|
|
119
|
+
let N = P[i];
|
|
120
|
+
if (!i || typeof N.body != "string" || !checkOptionalProps(N, defaultExtendedIconProps)) return null;
|
|
121
|
+
}
|
|
122
|
+
let F = N.aliases || /* @__PURE__ */ Object.create(null);
|
|
123
|
+
for (let i in F) {
|
|
124
|
+
let N = F[i], I = N.parent;
|
|
125
|
+
if (!i || typeof I != "string" || !P[I] && !F[I] || !checkOptionalProps(N, defaultExtendedIconProps)) return null;
|
|
126
|
+
}
|
|
127
|
+
return N;
|
|
128
|
+
}
|
|
129
|
+
var dataStorage = /* @__PURE__ */ Object.create(null);
|
|
130
|
+
function newStorage(i, N) {
|
|
131
|
+
return {
|
|
132
|
+
provider: i,
|
|
133
|
+
prefix: N,
|
|
134
|
+
icons: /* @__PURE__ */ Object.create(null),
|
|
135
|
+
missing: /* @__PURE__ */ new Set()
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function getStorage(i, N) {
|
|
139
|
+
let P = dataStorage[i] || (dataStorage[i] = /* @__PURE__ */ Object.create(null));
|
|
140
|
+
return P[N] || (P[N] = newStorage(i, N));
|
|
141
|
+
}
|
|
142
|
+
function addIconSet(i, N) {
|
|
143
|
+
return quicklyValidateIconSet(N) ? parseIconSet(N, (N, P) => {
|
|
144
|
+
P ? i.icons[N] = P : i.missing.add(N);
|
|
145
|
+
}) : [];
|
|
146
|
+
}
|
|
147
|
+
function addIconToStorage(i, N, P) {
|
|
148
|
+
try {
|
|
149
|
+
if (typeof P.body == "string") return i.icons[N] = { ...P }, !0;
|
|
150
|
+
} catch {}
|
|
151
|
+
return !1;
|
|
152
|
+
}
|
|
153
|
+
var simpleNames = !1;
|
|
154
|
+
function allowSimpleNames(i) {
|
|
155
|
+
return typeof i == "boolean" && (simpleNames = i), simpleNames;
|
|
156
|
+
}
|
|
157
|
+
function getIconData(i) {
|
|
158
|
+
let N = typeof i == "string" ? stringToIcon(i, !0, simpleNames) : i;
|
|
159
|
+
if (N) {
|
|
160
|
+
let i = getStorage(N.provider, N.prefix), P = N.name;
|
|
161
|
+
return i.icons[P] || (i.missing.has(P) ? null : void 0);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function addIcon(i, N) {
|
|
165
|
+
let P = stringToIcon(i, !0, simpleNames);
|
|
166
|
+
if (!P) return !1;
|
|
167
|
+
let F = getStorage(P.provider, P.prefix);
|
|
168
|
+
return N ? addIconToStorage(F, P.name, N) : (F.missing.add(P.name), !0);
|
|
169
|
+
}
|
|
170
|
+
function addCollection(i, N) {
|
|
171
|
+
if (typeof i != "object") return !1;
|
|
172
|
+
if (typeof N != "string" && (N = i.provider || ""), simpleNames && !N && !i.prefix) {
|
|
173
|
+
let N = !1;
|
|
174
|
+
return quicklyValidateIconSet(i) && (i.prefix = "", parseIconSet(i, (i, P) => {
|
|
175
|
+
addIcon(i, P) && (N = !0);
|
|
176
|
+
})), N;
|
|
177
|
+
}
|
|
178
|
+
let P = i.prefix;
|
|
179
|
+
return validateIconName({
|
|
180
|
+
prefix: P,
|
|
181
|
+
name: "a"
|
|
182
|
+
}) ? !!addIconSet(getStorage(N, P), i) : !1;
|
|
183
|
+
}
|
|
184
|
+
var defaultIconSizeCustomisations = Object.freeze({
|
|
185
|
+
width: null,
|
|
186
|
+
height: null
|
|
187
|
+
}), defaultIconCustomisations = Object.freeze({
|
|
188
|
+
...defaultIconSizeCustomisations,
|
|
189
|
+
...defaultIconTransformations
|
|
190
|
+
}), unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g, unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
|
|
191
|
+
function calculateSize(i, N, P) {
|
|
192
|
+
if (N === 1) return i;
|
|
193
|
+
if (P ||= 100, typeof i == "number") return Math.ceil(i * N * P) / P;
|
|
194
|
+
if (typeof i != "string") return i;
|
|
195
|
+
let F = i.split(unitsSplit);
|
|
196
|
+
if (F === null || !F.length) return i;
|
|
197
|
+
let I = [], L = F.shift(), R = unitsTest.test(L);
|
|
198
|
+
for (;;) {
|
|
199
|
+
if (R) {
|
|
200
|
+
let i = parseFloat(L);
|
|
201
|
+
isNaN(i) ? I.push(L) : I.push(Math.ceil(i * N * P) / P);
|
|
202
|
+
} else I.push(L);
|
|
203
|
+
if (L = F.shift(), L === void 0) return I.join("");
|
|
204
|
+
R = !R;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function splitSVGDefs(i, N = "defs") {
|
|
208
|
+
let P = "", F = i.indexOf("<" + N);
|
|
209
|
+
for (; F >= 0;) {
|
|
210
|
+
let I = i.indexOf(">", F), L = i.indexOf("</" + N);
|
|
211
|
+
if (I === -1 || L === -1) break;
|
|
212
|
+
let R = i.indexOf(">", L);
|
|
213
|
+
if (R === -1) break;
|
|
214
|
+
P += i.slice(I + 1, L).trim(), i = i.slice(0, F).trim() + i.slice(R + 1);
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
defs: P,
|
|
218
|
+
content: i
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function mergeDefsAndContent(i, N) {
|
|
222
|
+
return i ? "<defs>" + i + "</defs>" + N : N;
|
|
223
|
+
}
|
|
224
|
+
function wrapSVGContent(i, N, P) {
|
|
225
|
+
let F = splitSVGDefs(i);
|
|
226
|
+
return mergeDefsAndContent(F.defs, N + F.content + P);
|
|
227
|
+
}
|
|
228
|
+
var isUnsetKeyword = (i) => i === "unset" || i === "undefined" || i === "none";
|
|
229
|
+
function iconToSVG(i, N) {
|
|
230
|
+
let P = {
|
|
231
|
+
...defaultIconProps,
|
|
232
|
+
...i
|
|
233
|
+
}, F = {
|
|
234
|
+
...defaultIconCustomisations,
|
|
235
|
+
...N
|
|
236
|
+
}, I = {
|
|
237
|
+
left: P.left,
|
|
238
|
+
top: P.top,
|
|
239
|
+
width: P.width,
|
|
240
|
+
height: P.height
|
|
241
|
+
}, L = P.body;
|
|
242
|
+
[P, F].forEach((i) => {
|
|
243
|
+
let N = [], P = i.hFlip, F = i.vFlip, R = i.rotate;
|
|
244
|
+
P ? F ? R += 2 : (N.push("translate(" + (I.width + I.left).toString() + " " + (0 - I.top).toString() + ")"), N.push("scale(-1 1)"), I.top = I.left = 0) : F && (N.push("translate(" + (0 - I.left).toString() + " " + (I.height + I.top).toString() + ")"), N.push("scale(1 -1)"), I.top = I.left = 0);
|
|
245
|
+
let z;
|
|
246
|
+
switch (R < 0 && (R -= Math.floor(R / 4) * 4), R %= 4, R) {
|
|
247
|
+
case 1:
|
|
248
|
+
z = I.height / 2 + I.top, N.unshift("rotate(90 " + z.toString() + " " + z.toString() + ")");
|
|
249
|
+
break;
|
|
250
|
+
case 2:
|
|
251
|
+
N.unshift("rotate(180 " + (I.width / 2 + I.left).toString() + " " + (I.height / 2 + I.top).toString() + ")");
|
|
252
|
+
break;
|
|
253
|
+
case 3:
|
|
254
|
+
z = I.width / 2 + I.left, N.unshift("rotate(-90 " + z.toString() + " " + z.toString() + ")");
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
R % 2 == 1 && (I.left !== I.top && (z = I.left, I.left = I.top, I.top = z), I.width !== I.height && (z = I.width, I.width = I.height, I.height = z)), N.length && (L = wrapSVGContent(L, "<g transform=\"" + N.join(" ") + "\">", "</g>"));
|
|
258
|
+
});
|
|
259
|
+
let R = F.width, z = F.height, B = I.width, V = I.height, H, U;
|
|
260
|
+
R === null ? (U = z === null ? "1em" : z === "auto" ? V : z, H = calculateSize(U, B / V)) : (H = R === "auto" ? B : R, U = z === null ? calculateSize(H, V / B) : z === "auto" ? V : z);
|
|
261
|
+
let W = {}, G = (i, N) => {
|
|
262
|
+
isUnsetKeyword(N) || (W[i] = N.toString());
|
|
263
|
+
};
|
|
264
|
+
G("width", H), G("height", U);
|
|
265
|
+
let K = [
|
|
266
|
+
I.left,
|
|
267
|
+
I.top,
|
|
268
|
+
B,
|
|
269
|
+
V
|
|
270
|
+
];
|
|
271
|
+
return W.viewBox = K.join(" "), {
|
|
272
|
+
attributes: W,
|
|
273
|
+
viewBox: K,
|
|
274
|
+
body: L
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
var regex = /\sid="(\S+)"/g, randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16), counter = 0;
|
|
278
|
+
function replaceIDs(i, N = randomPrefix) {
|
|
279
|
+
let P = [], F;
|
|
280
|
+
for (; F = regex.exec(i);) P.push(F[1]);
|
|
281
|
+
if (!P.length) return i;
|
|
282
|
+
let I = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
|
|
283
|
+
return P.forEach((P) => {
|
|
284
|
+
let F = typeof N == "function" ? N(P) : N + (counter++).toString(), L = P.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
285
|
+
i = i.replace(RegExp("([#;\"])(" + L + ")([\")]|\\.[a-z])", "g"), "$1" + F + I + "$3");
|
|
286
|
+
}), i = i.replace(new RegExp(I, "g"), ""), i;
|
|
287
|
+
}
|
|
288
|
+
var storage = /* @__PURE__ */ Object.create(null);
|
|
289
|
+
function setAPIModule(i, N) {
|
|
290
|
+
storage[i] = N;
|
|
291
|
+
}
|
|
292
|
+
function getAPIModule(i) {
|
|
293
|
+
return storage[i] || storage[""];
|
|
294
|
+
}
|
|
295
|
+
function createAPIConfig(i) {
|
|
296
|
+
let N;
|
|
297
|
+
if (typeof i.resources == "string") N = [i.resources];
|
|
298
|
+
else if (N = i.resources, !(N instanceof Array) || !N.length) return null;
|
|
299
|
+
return {
|
|
300
|
+
resources: N,
|
|
301
|
+
path: i.path || "/",
|
|
302
|
+
maxURL: i.maxURL || 500,
|
|
303
|
+
rotate: i.rotate || 750,
|
|
304
|
+
timeout: i.timeout || 5e3,
|
|
305
|
+
random: i.random === !0,
|
|
306
|
+
index: i.index || 0,
|
|
307
|
+
dataAfterTimeout: i.dataAfterTimeout !== !1
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
for (var configStorage = /* @__PURE__ */ Object.create(null), fallBackAPISources = ["https://api.simplesvg.com", "https://api.unisvg.com"], fallBackAPI = []; fallBackAPISources.length > 0;) fallBackAPISources.length === 1 || Math.random() > .5 ? fallBackAPI.push(fallBackAPISources.shift()) : fallBackAPI.push(fallBackAPISources.pop());
|
|
311
|
+
configStorage[""] = createAPIConfig({ resources: ["https://api.iconify.design"].concat(fallBackAPI) });
|
|
312
|
+
function addAPIProvider(i, N) {
|
|
313
|
+
let P = createAPIConfig(N);
|
|
314
|
+
return P === null ? !1 : (configStorage[i] = P, !0);
|
|
315
|
+
}
|
|
316
|
+
function getAPIConfig(i) {
|
|
317
|
+
return configStorage[i];
|
|
318
|
+
}
|
|
319
|
+
var fetchModule = (() => {
|
|
320
|
+
let i;
|
|
321
|
+
try {
|
|
322
|
+
if (i = fetch, typeof i == "function") return i;
|
|
323
|
+
} catch {}
|
|
324
|
+
})();
|
|
325
|
+
function calculateMaxLength(i, N) {
|
|
326
|
+
let P = getAPIConfig(i);
|
|
327
|
+
if (!P) return 0;
|
|
328
|
+
let F;
|
|
329
|
+
if (!P.maxURL) F = 0;
|
|
330
|
+
else {
|
|
331
|
+
let i = 0;
|
|
332
|
+
P.resources.forEach((N) => {
|
|
333
|
+
let P = N;
|
|
334
|
+
i = Math.max(i, P.length);
|
|
335
|
+
});
|
|
336
|
+
let I = N + ".json?icons=";
|
|
337
|
+
F = P.maxURL - i - P.path.length - I.length;
|
|
338
|
+
}
|
|
339
|
+
return F;
|
|
340
|
+
}
|
|
341
|
+
function shouldAbort(i) {
|
|
342
|
+
return i === 404;
|
|
343
|
+
}
|
|
344
|
+
var prepare = (i, N, P) => {
|
|
345
|
+
let F = [], I = calculateMaxLength(i, N), L = "icons", R = {
|
|
346
|
+
type: L,
|
|
347
|
+
provider: i,
|
|
348
|
+
prefix: N,
|
|
349
|
+
icons: []
|
|
350
|
+
}, z = 0;
|
|
351
|
+
return P.forEach((P, B) => {
|
|
352
|
+
z += P.length + 1, z >= I && B > 0 && (F.push(R), R = {
|
|
353
|
+
type: L,
|
|
354
|
+
provider: i,
|
|
355
|
+
prefix: N,
|
|
356
|
+
icons: []
|
|
357
|
+
}, z = P.length), R.icons.push(P);
|
|
358
|
+
}), F.push(R), F;
|
|
359
|
+
};
|
|
360
|
+
function getPath(i) {
|
|
361
|
+
if (typeof i == "string") {
|
|
362
|
+
let N = getAPIConfig(i);
|
|
363
|
+
if (N) return N.path;
|
|
364
|
+
}
|
|
365
|
+
return "/";
|
|
366
|
+
}
|
|
367
|
+
var fetchAPIModule = {
|
|
368
|
+
prepare,
|
|
369
|
+
send: (i, N, P) => {
|
|
370
|
+
if (!fetchModule) {
|
|
371
|
+
P("abort", 424);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
let F = getPath(N.provider);
|
|
375
|
+
switch (N.type) {
|
|
376
|
+
case "icons": {
|
|
377
|
+
let i = N.prefix, P = N.icons.join(","), I = new URLSearchParams({ icons: P });
|
|
378
|
+
F += i + ".json?" + I.toString();
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
case "custom": {
|
|
382
|
+
let i = N.uri;
|
|
383
|
+
F += i.slice(0, 1) === "/" ? i.slice(1) : i;
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
386
|
+
default:
|
|
387
|
+
P("abort", 400);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
let I = 503;
|
|
391
|
+
fetchModule(i + F).then((i) => {
|
|
392
|
+
let N = i.status;
|
|
393
|
+
if (N !== 200) {
|
|
394
|
+
setTimeout(() => {
|
|
395
|
+
P(shouldAbort(N) ? "abort" : "next", N);
|
|
396
|
+
});
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
return I = 501, i.json();
|
|
400
|
+
}).then((i) => {
|
|
401
|
+
if (typeof i != "object" || !i) {
|
|
402
|
+
setTimeout(() => {
|
|
403
|
+
i === 404 ? P("abort", i) : P("next", I);
|
|
404
|
+
});
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
setTimeout(() => {
|
|
408
|
+
P("success", i);
|
|
409
|
+
});
|
|
410
|
+
}).catch(() => {
|
|
411
|
+
P("next", I);
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
function sortIcons(i) {
|
|
416
|
+
let N = {
|
|
417
|
+
loaded: [],
|
|
418
|
+
missing: [],
|
|
419
|
+
pending: []
|
|
420
|
+
}, P = /* @__PURE__ */ Object.create(null);
|
|
421
|
+
i.sort((i, N) => i.provider === N.provider ? i.prefix === N.prefix ? i.name.localeCompare(N.name) : i.prefix.localeCompare(N.prefix) : i.provider.localeCompare(N.provider));
|
|
422
|
+
let F = {
|
|
423
|
+
provider: "",
|
|
424
|
+
prefix: "",
|
|
425
|
+
name: ""
|
|
426
|
+
};
|
|
427
|
+
return i.forEach((i) => {
|
|
428
|
+
if (F.name === i.name && F.prefix === i.prefix && F.provider === i.provider) return;
|
|
429
|
+
F = i;
|
|
430
|
+
let I = i.provider, L = i.prefix, R = i.name, z = P[I] || (P[I] = /* @__PURE__ */ Object.create(null)), B = z[L] || (z[L] = getStorage(I, L)), V;
|
|
431
|
+
V = R in B.icons ? N.loaded : L === "" || B.missing.has(R) ? N.missing : N.pending;
|
|
432
|
+
let H = {
|
|
433
|
+
provider: I,
|
|
434
|
+
prefix: L,
|
|
435
|
+
name: R
|
|
436
|
+
};
|
|
437
|
+
V.push(H);
|
|
438
|
+
}), N;
|
|
439
|
+
}
|
|
440
|
+
function removeCallback(i, N) {
|
|
441
|
+
i.forEach((i) => {
|
|
442
|
+
let P = i.loaderCallbacks;
|
|
443
|
+
P && (i.loaderCallbacks = P.filter((i) => i.id !== N));
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
function updateCallbacks(i) {
|
|
447
|
+
i.pendingCallbacksFlag || (i.pendingCallbacksFlag = !0, setTimeout(() => {
|
|
448
|
+
i.pendingCallbacksFlag = !1;
|
|
449
|
+
let N = i.loaderCallbacks ? i.loaderCallbacks.slice(0) : [];
|
|
450
|
+
if (!N.length) return;
|
|
451
|
+
let P = !1, F = i.provider, I = i.prefix;
|
|
452
|
+
N.forEach((N) => {
|
|
453
|
+
let L = N.icons, R = L.pending.length;
|
|
454
|
+
L.pending = L.pending.filter((N) => {
|
|
455
|
+
if (N.prefix !== I) return !0;
|
|
456
|
+
let R = N.name;
|
|
457
|
+
if (i.icons[R]) L.loaded.push({
|
|
458
|
+
provider: F,
|
|
459
|
+
prefix: I,
|
|
460
|
+
name: R
|
|
461
|
+
});
|
|
462
|
+
else if (i.missing.has(R)) L.missing.push({
|
|
463
|
+
provider: F,
|
|
464
|
+
prefix: I,
|
|
465
|
+
name: R
|
|
466
|
+
});
|
|
467
|
+
else return P = !0, !0;
|
|
468
|
+
return !1;
|
|
469
|
+
}), L.pending.length !== R && (P || removeCallback([i], N.id), N.callback(L.loaded.slice(0), L.missing.slice(0), L.pending.slice(0), N.abort));
|
|
470
|
+
});
|
|
471
|
+
}));
|
|
472
|
+
}
|
|
473
|
+
var idCounter = 0;
|
|
474
|
+
function storeCallback(i, N, P) {
|
|
475
|
+
let F = idCounter++, I = removeCallback.bind(null, P, F);
|
|
476
|
+
if (!N.pending.length) return I;
|
|
477
|
+
let L = {
|
|
478
|
+
id: F,
|
|
479
|
+
icons: N,
|
|
480
|
+
callback: i,
|
|
481
|
+
abort: I
|
|
482
|
+
};
|
|
483
|
+
return P.forEach((i) => {
|
|
484
|
+
(i.loaderCallbacks ||= []).push(L);
|
|
485
|
+
}), I;
|
|
486
|
+
}
|
|
487
|
+
function listToIcons(i, N = !0, P = !1) {
|
|
488
|
+
let F = [];
|
|
489
|
+
return i.forEach((i) => {
|
|
490
|
+
let I = typeof i == "string" ? stringToIcon(i, N, P) : i;
|
|
491
|
+
I && F.push(I);
|
|
492
|
+
}), F;
|
|
493
|
+
}
|
|
494
|
+
var defaultConfig = {
|
|
495
|
+
resources: [],
|
|
496
|
+
index: 0,
|
|
497
|
+
timeout: 2e3,
|
|
498
|
+
rotate: 750,
|
|
499
|
+
random: !1,
|
|
500
|
+
dataAfterTimeout: !1
|
|
501
|
+
};
|
|
502
|
+
function sendQuery(i, N, P, F) {
|
|
503
|
+
let I = i.resources.length, L = i.random ? Math.floor(Math.random() * I) : i.index, R;
|
|
504
|
+
if (i.random) {
|
|
505
|
+
let N = i.resources.slice(0);
|
|
506
|
+
for (R = []; N.length > 1;) {
|
|
507
|
+
let i = Math.floor(Math.random() * N.length);
|
|
508
|
+
R.push(N[i]), N = N.slice(0, i).concat(N.slice(i + 1));
|
|
509
|
+
}
|
|
510
|
+
R = R.concat(N);
|
|
511
|
+
} else R = i.resources.slice(L).concat(i.resources.slice(0, L));
|
|
512
|
+
let z = Date.now(), B = "pending", V = 0, H, U = null, W = [], G = [];
|
|
513
|
+
typeof F == "function" && G.push(F);
|
|
514
|
+
function K() {
|
|
515
|
+
U &&= (clearTimeout(U), null);
|
|
516
|
+
}
|
|
517
|
+
function q() {
|
|
518
|
+
B === "pending" && (B = "aborted"), K(), W.forEach((i) => {
|
|
519
|
+
i.status === "pending" && (i.status = "aborted");
|
|
520
|
+
}), W = [];
|
|
521
|
+
}
|
|
522
|
+
function J(i, N) {
|
|
523
|
+
N && (G = []), typeof i == "function" && G.push(i);
|
|
524
|
+
}
|
|
525
|
+
function Y() {
|
|
526
|
+
return {
|
|
527
|
+
startTime: z,
|
|
528
|
+
payload: N,
|
|
529
|
+
status: B,
|
|
530
|
+
queriesSent: V,
|
|
531
|
+
queriesPending: W.length,
|
|
532
|
+
subscribe: J,
|
|
533
|
+
abort: q
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
function X() {
|
|
537
|
+
B = "failed", G.forEach((i) => {
|
|
538
|
+
i(void 0, H);
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
function Z() {
|
|
542
|
+
W.forEach((i) => {
|
|
543
|
+
i.status === "pending" && (i.status = "aborted");
|
|
544
|
+
}), W = [];
|
|
545
|
+
}
|
|
546
|
+
function Q(N, P, F) {
|
|
547
|
+
let I = P !== "success";
|
|
548
|
+
switch (W = W.filter((i) => i !== N), B) {
|
|
549
|
+
case "pending": break;
|
|
550
|
+
case "failed":
|
|
551
|
+
if (I || !i.dataAfterTimeout) return;
|
|
552
|
+
break;
|
|
553
|
+
default: return;
|
|
554
|
+
}
|
|
555
|
+
if (P === "abort") {
|
|
556
|
+
H = F, X();
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
if (I) {
|
|
560
|
+
H = F, W.length || (R.length ? $() : X());
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
if (K(), Z(), !i.random) {
|
|
564
|
+
let P = i.resources.indexOf(N.resource);
|
|
565
|
+
P !== -1 && P !== i.index && (i.index = P);
|
|
566
|
+
}
|
|
567
|
+
B = "completed", G.forEach((i) => {
|
|
568
|
+
i(F);
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
function $() {
|
|
572
|
+
if (B !== "pending") return;
|
|
573
|
+
K();
|
|
574
|
+
let F = R.shift();
|
|
575
|
+
if (F === void 0) {
|
|
576
|
+
if (W.length) {
|
|
577
|
+
U = setTimeout(() => {
|
|
578
|
+
K(), B === "pending" && (Z(), X());
|
|
579
|
+
}, i.timeout);
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
X();
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
let I = {
|
|
586
|
+
status: "pending",
|
|
587
|
+
resource: F,
|
|
588
|
+
callback: (i, N) => {
|
|
589
|
+
Q(I, i, N);
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
W.push(I), V++, U = setTimeout($, i.rotate), P(F, N, I.callback);
|
|
593
|
+
}
|
|
594
|
+
return setTimeout($), Y;
|
|
595
|
+
}
|
|
596
|
+
function initRedundancy(i) {
|
|
597
|
+
let N = {
|
|
598
|
+
...defaultConfig,
|
|
599
|
+
...i
|
|
600
|
+
}, P = [];
|
|
601
|
+
function F() {
|
|
602
|
+
P = P.filter((i) => i().status === "pending");
|
|
603
|
+
}
|
|
604
|
+
function I(i, I, L) {
|
|
605
|
+
let R = sendQuery(N, i, I, (i, N) => {
|
|
606
|
+
F(), L && L(i, N);
|
|
607
|
+
});
|
|
608
|
+
return P.push(R), R;
|
|
609
|
+
}
|
|
610
|
+
function L(i) {
|
|
611
|
+
return P.find((N) => i(N)) || null;
|
|
612
|
+
}
|
|
613
|
+
return {
|
|
614
|
+
query: I,
|
|
615
|
+
find: L,
|
|
616
|
+
setIndex: (i) => {
|
|
617
|
+
N.index = i;
|
|
618
|
+
},
|
|
619
|
+
getIndex: () => N.index,
|
|
620
|
+
cleanup: F
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
function emptyCallback$1() {}
|
|
624
|
+
var redundancyCache = /* @__PURE__ */ Object.create(null);
|
|
625
|
+
function getRedundancyCache(i) {
|
|
626
|
+
if (!redundancyCache[i]) {
|
|
627
|
+
let N = getAPIConfig(i);
|
|
628
|
+
if (!N) return;
|
|
629
|
+
redundancyCache[i] = {
|
|
630
|
+
config: N,
|
|
631
|
+
redundancy: initRedundancy(N)
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
return redundancyCache[i];
|
|
635
|
+
}
|
|
636
|
+
function sendAPIQuery(i, N, P) {
|
|
637
|
+
let F, I;
|
|
638
|
+
if (typeof i == "string") {
|
|
639
|
+
let N = getAPIModule(i);
|
|
640
|
+
if (!N) return P(void 0, 424), emptyCallback$1;
|
|
641
|
+
I = N.send;
|
|
642
|
+
let L = getRedundancyCache(i);
|
|
643
|
+
L && (F = L.redundancy);
|
|
644
|
+
} else {
|
|
645
|
+
let N = createAPIConfig(i);
|
|
646
|
+
if (N) {
|
|
647
|
+
F = initRedundancy(N);
|
|
648
|
+
let P = getAPIModule(i.resources ? i.resources[0] : "");
|
|
649
|
+
P && (I = P.send);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
return !F || !I ? (P(void 0, 424), emptyCallback$1) : F.query(N, I, P)().abort;
|
|
653
|
+
}
|
|
654
|
+
function emptyCallback() {}
|
|
655
|
+
function loadedNewIcons(i) {
|
|
656
|
+
i.iconsLoaderFlag || (i.iconsLoaderFlag = !0, setTimeout(() => {
|
|
657
|
+
i.iconsLoaderFlag = !1, updateCallbacks(i);
|
|
658
|
+
}));
|
|
659
|
+
}
|
|
660
|
+
function checkIconNamesForAPI(i) {
|
|
661
|
+
let N = [], P = [];
|
|
662
|
+
return i.forEach((i) => {
|
|
663
|
+
(i.match(matchIconName) ? N : P).push(i);
|
|
664
|
+
}), {
|
|
665
|
+
valid: N,
|
|
666
|
+
invalid: P
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
function parseLoaderResponse(i, N, P) {
|
|
670
|
+
function F() {
|
|
671
|
+
let P = i.pendingIcons;
|
|
672
|
+
N.forEach((N) => {
|
|
673
|
+
P && P.delete(N), i.icons[N] || i.missing.add(N);
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
if (P && typeof P == "object") try {
|
|
677
|
+
if (!addIconSet(i, P).length) {
|
|
678
|
+
F();
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
} catch (i) {
|
|
682
|
+
console.error(i);
|
|
683
|
+
}
|
|
684
|
+
F(), loadedNewIcons(i);
|
|
685
|
+
}
|
|
686
|
+
function parsePossiblyAsyncResponse(i, N) {
|
|
687
|
+
i instanceof Promise ? i.then((i) => {
|
|
688
|
+
N(i);
|
|
689
|
+
}).catch(() => {
|
|
690
|
+
N(null);
|
|
691
|
+
}) : N(i);
|
|
692
|
+
}
|
|
693
|
+
function loadNewIcons(i, N) {
|
|
694
|
+
i.iconsToLoad ? i.iconsToLoad = i.iconsToLoad.concat(N).sort() : i.iconsToLoad = N, i.iconsQueueFlag || (i.iconsQueueFlag = !0, setTimeout(() => {
|
|
695
|
+
i.iconsQueueFlag = !1;
|
|
696
|
+
let { provider: N, prefix: P } = i, F = i.iconsToLoad;
|
|
697
|
+
if (delete i.iconsToLoad, !F || !F.length) return;
|
|
698
|
+
let I = i.loadIcon;
|
|
699
|
+
if (i.loadIcons && (F.length > 1 || !I)) {
|
|
700
|
+
parsePossiblyAsyncResponse(i.loadIcons(F, P, N), (N) => {
|
|
701
|
+
parseLoaderResponse(i, F, N);
|
|
702
|
+
});
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
if (I) {
|
|
706
|
+
F.forEach((F) => {
|
|
707
|
+
parsePossiblyAsyncResponse(I(F, P, N), (N) => {
|
|
708
|
+
parseLoaderResponse(i, [F], N ? {
|
|
709
|
+
prefix: P,
|
|
710
|
+
icons: { [F]: N }
|
|
711
|
+
} : null);
|
|
712
|
+
});
|
|
713
|
+
});
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
let { valid: L, invalid: R } = checkIconNamesForAPI(F);
|
|
717
|
+
if (R.length && parseLoaderResponse(i, R, null), !L.length) return;
|
|
718
|
+
let z = P.match(matchIconName) ? getAPIModule(N) : null;
|
|
719
|
+
if (!z) {
|
|
720
|
+
parseLoaderResponse(i, L, null);
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
z.prepare(N, P, L).forEach((P) => {
|
|
724
|
+
sendAPIQuery(N, P, (N) => {
|
|
725
|
+
parseLoaderResponse(i, P.icons, N);
|
|
726
|
+
});
|
|
727
|
+
});
|
|
728
|
+
}));
|
|
729
|
+
}
|
|
730
|
+
var loadIcons = (i, N) => {
|
|
731
|
+
let P = sortIcons(listToIcons(i, !0, allowSimpleNames()));
|
|
732
|
+
if (!P.pending.length) {
|
|
733
|
+
let i = !0;
|
|
734
|
+
return N && setTimeout(() => {
|
|
735
|
+
i && N(P.loaded, P.missing, P.pending, emptyCallback);
|
|
736
|
+
}), () => {
|
|
737
|
+
i = !1;
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
let F = /* @__PURE__ */ Object.create(null), I = [], L, R;
|
|
741
|
+
return P.pending.forEach((i) => {
|
|
742
|
+
let { provider: N, prefix: P } = i;
|
|
743
|
+
if (P === R && N === L) return;
|
|
744
|
+
L = N, R = P, I.push(getStorage(N, P));
|
|
745
|
+
let z = F[N] || (F[N] = /* @__PURE__ */ Object.create(null));
|
|
746
|
+
z[P] || (z[P] = []);
|
|
747
|
+
}), P.pending.forEach((i) => {
|
|
748
|
+
let { provider: N, prefix: P, name: I } = i, L = getStorage(N, P), R = L.pendingIcons ||= /* @__PURE__ */ new Set();
|
|
749
|
+
R.has(I) || (R.add(I), F[N][P].push(I));
|
|
750
|
+
}), I.forEach((i) => {
|
|
751
|
+
let N = F[i.provider][i.prefix];
|
|
752
|
+
N.length && loadNewIcons(i, N);
|
|
753
|
+
}), N ? storeCallback(N, P, I) : emptyCallback;
|
|
754
|
+
};
|
|
755
|
+
function mergeCustomisations(i, N) {
|
|
756
|
+
let P = { ...i };
|
|
757
|
+
for (let i in N) {
|
|
758
|
+
let F = N[i], I = typeof F;
|
|
759
|
+
i in defaultIconSizeCustomisations ? (F === null || F && (I === "string" || I === "number")) && (P[i] = F) : I === typeof P[i] && (P[i] = i === "rotate" ? F % 4 : F);
|
|
760
|
+
}
|
|
761
|
+
return P;
|
|
762
|
+
}
|
|
763
|
+
var separator = /[\s,]+/;
|
|
764
|
+
function flipFromString(i, N) {
|
|
765
|
+
N.split(separator).forEach((N) => {
|
|
766
|
+
switch (N.trim()) {
|
|
767
|
+
case "horizontal":
|
|
768
|
+
i.hFlip = !0;
|
|
769
|
+
break;
|
|
770
|
+
case "vertical":
|
|
771
|
+
i.vFlip = !0;
|
|
772
|
+
break;
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
function rotateFromString(i, N = 0) {
|
|
777
|
+
let P = i.replace(/^-?[0-9.]*/, "");
|
|
778
|
+
function F(i) {
|
|
779
|
+
for (; i < 0;) i += 4;
|
|
780
|
+
return i % 4;
|
|
781
|
+
}
|
|
782
|
+
if (P === "") {
|
|
783
|
+
let N = parseInt(i);
|
|
784
|
+
return isNaN(N) ? 0 : F(N);
|
|
785
|
+
} else if (P !== i) {
|
|
786
|
+
let N = 0;
|
|
787
|
+
switch (P) {
|
|
788
|
+
case "%":
|
|
789
|
+
N = 25;
|
|
790
|
+
break;
|
|
791
|
+
case "deg": N = 90;
|
|
792
|
+
}
|
|
793
|
+
if (N) {
|
|
794
|
+
let I = parseFloat(i.slice(0, i.length - P.length));
|
|
795
|
+
return isNaN(I) ? 0 : (I /= N, I % 1 == 0 ? F(I) : 0);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
return N;
|
|
799
|
+
}
|
|
800
|
+
function iconToHTML(i, N) {
|
|
801
|
+
let P = i.indexOf("xlink:") === -1 ? "" : " xmlns:xlink=\"http://www.w3.org/1999/xlink\"";
|
|
802
|
+
for (let i in N) P += " " + i + "=\"" + N[i] + "\"";
|
|
803
|
+
return "<svg xmlns=\"http://www.w3.org/2000/svg\"" + P + ">" + i + "</svg>";
|
|
804
|
+
}
|
|
805
|
+
function encodeSVGforURL(i) {
|
|
806
|
+
return i.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
|
|
807
|
+
}
|
|
808
|
+
function svgToData(i) {
|
|
809
|
+
return "data:image/svg+xml," + encodeSVGforURL(i);
|
|
810
|
+
}
|
|
811
|
+
function svgToURL(i) {
|
|
812
|
+
return "url(\"" + svgToData(i) + "\")";
|
|
813
|
+
}
|
|
814
|
+
var defaultExtendedIconCustomisations = {
|
|
815
|
+
...defaultIconCustomisations,
|
|
816
|
+
inline: !1
|
|
817
|
+
}, svgDefaults = {
|
|
818
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
819
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
820
|
+
"aria-hidden": !0,
|
|
821
|
+
role: "img"
|
|
822
|
+
}, commonProps = { display: "inline-block" }, monotoneProps = { backgroundColor: "currentColor" }, coloredProps = { backgroundColor: "transparent" }, propsToAdd = {
|
|
823
|
+
Image: "var(--svg)",
|
|
824
|
+
Repeat: "no-repeat",
|
|
825
|
+
Size: "100% 100%"
|
|
826
|
+
}, propsToAddTo = {
|
|
827
|
+
webkitMask: monotoneProps,
|
|
828
|
+
mask: monotoneProps,
|
|
829
|
+
background: coloredProps
|
|
830
|
+
};
|
|
831
|
+
for (let i in propsToAddTo) {
|
|
832
|
+
let N = propsToAddTo[i];
|
|
833
|
+
for (let P in propsToAdd) N[i + P] = propsToAdd[P];
|
|
834
|
+
}
|
|
835
|
+
var customisationAliases = {};
|
|
836
|
+
["horizontal", "vertical"].forEach((i) => {
|
|
837
|
+
let N = i.slice(0, 1) + "Flip";
|
|
838
|
+
customisationAliases[i + "-flip"] = N, customisationAliases[i.slice(0, 1) + "-flip"] = N, customisationAliases[i + "Flip"] = N;
|
|
839
|
+
});
|
|
840
|
+
function fixSize(i) {
|
|
841
|
+
return i + (i.match(/^[-0-9.]+$/) ? "px" : "");
|
|
842
|
+
}
|
|
843
|
+
var render = (i, N) => {
|
|
844
|
+
let P = mergeCustomisations(defaultExtendedIconCustomisations, N), F = { ...svgDefaults }, L = N.mode || "svg", R = {}, z = N.style, B = typeof z == "object" && !(z instanceof Array) ? z : {};
|
|
845
|
+
for (let i in N) {
|
|
846
|
+
let I = N[i];
|
|
847
|
+
if (I !== void 0) switch (i) {
|
|
848
|
+
case "icon":
|
|
849
|
+
case "style":
|
|
850
|
+
case "onLoad":
|
|
851
|
+
case "mode":
|
|
852
|
+
case "ssr": break;
|
|
853
|
+
case "inline":
|
|
854
|
+
case "hFlip":
|
|
855
|
+
case "vFlip":
|
|
856
|
+
P[i] = I === !0 || I === "true" || I === 1;
|
|
857
|
+
break;
|
|
858
|
+
case "flip":
|
|
859
|
+
typeof I == "string" && flipFromString(P, I);
|
|
860
|
+
break;
|
|
861
|
+
case "color":
|
|
862
|
+
R.color = I;
|
|
863
|
+
break;
|
|
864
|
+
case "rotate":
|
|
865
|
+
typeof I == "string" ? P[i] = rotateFromString(I) : typeof I == "number" && (P[i] = I);
|
|
866
|
+
break;
|
|
867
|
+
case "ariaHidden":
|
|
868
|
+
case "aria-hidden":
|
|
869
|
+
I !== !0 && I !== "true" && delete F["aria-hidden"];
|
|
870
|
+
break;
|
|
871
|
+
default: {
|
|
872
|
+
let N = customisationAliases[i];
|
|
873
|
+
N ? (I === !0 || I === "true" || I === 1) && (P[N] = !0) : defaultExtendedIconCustomisations[i] === void 0 && (F[i] = I);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
let V = iconToSVG(i, P), H = V.attributes;
|
|
878
|
+
if (P.inline && (R.verticalAlign = "-0.125em"), L === "svg") {
|
|
879
|
+
F.style = {
|
|
880
|
+
...R,
|
|
881
|
+
...B
|
|
882
|
+
}, Object.assign(F, H);
|
|
883
|
+
let i = 0, P = N.id;
|
|
884
|
+
return typeof P == "string" && (P = P.replace(/-/g, "_")), F.innerHTML = replaceIDs(V.body, P ? () => P + "ID" + i++ : "iconifyVue"), h("svg", F);
|
|
885
|
+
}
|
|
886
|
+
let { body: U, width: W, height: G } = i, K = L === "mask" || (L === "bg" ? !1 : U.indexOf("currentColor") !== -1), q = iconToHTML(U, {
|
|
887
|
+
...H,
|
|
888
|
+
width: W + "",
|
|
889
|
+
height: G + ""
|
|
890
|
+
});
|
|
891
|
+
return F.style = {
|
|
892
|
+
...R,
|
|
893
|
+
"--svg": svgToURL(q),
|
|
894
|
+
width: fixSize(H.width),
|
|
895
|
+
height: fixSize(H.height),
|
|
896
|
+
...commonProps,
|
|
897
|
+
...K ? monotoneProps : coloredProps,
|
|
898
|
+
...B
|
|
899
|
+
}, h("span", F);
|
|
900
|
+
};
|
|
901
|
+
if (allowSimpleNames(!0), setAPIModule("", fetchAPIModule), typeof document < "u" && typeof window < "u") {
|
|
902
|
+
let i = window;
|
|
903
|
+
if (i.IconifyPreload !== void 0) {
|
|
904
|
+
let N = i.IconifyPreload, P = "Invalid IconifyPreload syntax.";
|
|
905
|
+
typeof N == "object" && N && (N instanceof Array ? N : [N]).forEach((i) => {
|
|
906
|
+
try {
|
|
907
|
+
(typeof i != "object" || !i || i instanceof Array || typeof i.icons != "object" || typeof i.prefix != "string" || !addCollection(i)) && console.error(P);
|
|
908
|
+
} catch {
|
|
909
|
+
console.error(P);
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
if (i.IconifyProviders !== void 0) {
|
|
914
|
+
let N = i.IconifyProviders;
|
|
915
|
+
if (typeof N == "object" && N) for (let i in N) {
|
|
916
|
+
let P = "IconifyProviders[" + i + "] is invalid.";
|
|
917
|
+
try {
|
|
918
|
+
let F = N[i];
|
|
919
|
+
if (typeof F != "object" || !F || F.resources === void 0) continue;
|
|
920
|
+
addAPIProvider(i, F) || console.error(P);
|
|
921
|
+
} catch {
|
|
922
|
+
console.error(P);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
var emptyIcon = {
|
|
928
|
+
...defaultIconProps,
|
|
929
|
+
body: ""
|
|
930
|
+
}, Icon = defineComponent((i, { emit: N }) => {
|
|
931
|
+
let P = ref(null);
|
|
932
|
+
function F() {
|
|
933
|
+
P.value &&= (P.value.abort?.(), null);
|
|
934
|
+
}
|
|
935
|
+
let I = ref(!!i.ssr), R = ref(""), V = shallowRef(null);
|
|
936
|
+
function U() {
|
|
937
|
+
let I = i.icon;
|
|
938
|
+
if (typeof I == "object" && I && typeof I.body == "string") return R.value = "", { data: I };
|
|
939
|
+
let z;
|
|
940
|
+
if (typeof I != "string" || (z = stringToIcon(I, !1, !0)) === null) return null;
|
|
941
|
+
let B = getIconData(z);
|
|
942
|
+
if (!B) {
|
|
943
|
+
let i = P.value;
|
|
944
|
+
return (!i || i.name !== I) && (B === null ? P.value = { name: I } : P.value = {
|
|
945
|
+
name: I,
|
|
946
|
+
abort: loadIcons([z], W)
|
|
947
|
+
}), null;
|
|
948
|
+
}
|
|
949
|
+
F(), R.value !== I && (R.value = I, nextTick(() => {
|
|
950
|
+
N("load", I);
|
|
951
|
+
}));
|
|
952
|
+
let V = i.customise;
|
|
953
|
+
if (V) {
|
|
954
|
+
B = Object.assign({}, B);
|
|
955
|
+
let i = V(B.body, z.name, z.prefix, z.provider);
|
|
956
|
+
typeof i == "string" && (B.body = i);
|
|
957
|
+
}
|
|
958
|
+
let H = ["iconify"];
|
|
959
|
+
return z.prefix !== "" && H.push("iconify--" + z.prefix), z.provider !== "" && H.push("iconify--" + z.provider), {
|
|
960
|
+
data: B,
|
|
961
|
+
classes: H
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
function W() {
|
|
965
|
+
let i = U();
|
|
966
|
+
i ? i.data !== V.value?.data && (V.value = i) : V.value = null;
|
|
967
|
+
}
|
|
968
|
+
return I.value ? W() : onMounted(() => {
|
|
969
|
+
I.value = !0, W();
|
|
970
|
+
}), watch(() => i.icon, W), onUnmounted(F), () => {
|
|
971
|
+
let N = V.value;
|
|
972
|
+
if (!N) return render(emptyIcon, i);
|
|
973
|
+
let P = i;
|
|
974
|
+
return N.classes && (P = {
|
|
975
|
+
...i,
|
|
976
|
+
class: N.classes.join(" ")
|
|
977
|
+
}), render({
|
|
978
|
+
...defaultIconProps,
|
|
979
|
+
...N.data
|
|
980
|
+
}, P);
|
|
981
|
+
};
|
|
982
|
+
}, {
|
|
983
|
+
props: [
|
|
984
|
+
"icon",
|
|
985
|
+
"mode",
|
|
986
|
+
"ssr",
|
|
987
|
+
"width",
|
|
988
|
+
"height",
|
|
989
|
+
"style",
|
|
990
|
+
"color",
|
|
991
|
+
"inline",
|
|
992
|
+
"rotate",
|
|
993
|
+
"hFlip",
|
|
994
|
+
"horizontalFlip",
|
|
995
|
+
"vFlip",
|
|
996
|
+
"verticalFlip",
|
|
997
|
+
"flip",
|
|
998
|
+
"id",
|
|
999
|
+
"ariaHidden",
|
|
1000
|
+
"customise",
|
|
1001
|
+
"title"
|
|
1002
|
+
],
|
|
1003
|
+
emits: ["load"]
|
|
1004
|
+
}), Icon_default = /* @__PURE__ */ defineComponent({
|
|
1005
|
+
name: "ZIcon",
|
|
1006
|
+
__name: "Icon",
|
|
1007
|
+
props: { icon: {} },
|
|
1008
|
+
setup(P) {
|
|
1009
|
+
let F = P, I = computed(() => typeof F.icon == "string");
|
|
1010
|
+
return (i, F) => I.value ? (openBlock(), createBlock(unref(Icon), {
|
|
1011
|
+
key: 0,
|
|
1012
|
+
icon: P.icon
|
|
1013
|
+
}, null, 8, ["icon"])) : (openBlock(), createBlock(resolveDynamicComponent(P.icon), { key: 1 }));
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1016
|
+
function getUUID(i = "") {
|
|
1017
|
+
return i + (crypto?.randomUUID?.() || `${Date.now()}_${Math.random().toString(16).slice(2)}`);
|
|
1018
|
+
}
|
|
1019
|
+
function log(...i) {
|
|
1020
|
+
console.log("【zxqWs】", ...i);
|
|
1021
|
+
}
|
|
10
1022
|
const EVENT_TYPE = {
|
|
11
1023
|
DEV1: "dev-1",
|
|
12
1024
|
DEV2: "dev-2"
|
|
13
1025
|
};
|
|
14
|
-
var urlRef = ref()
|
|
15
|
-
const { status, data, send, close, open } = useWebSocket(urlRef, {
|
|
1026
|
+
var urlRef = ref(), { status, data, send, close, open } = useWebSocket(urlRef, {
|
|
16
1027
|
immediate: !1,
|
|
17
1028
|
autoConnect: !1,
|
|
18
1029
|
heartbeat: {
|
|
@@ -28,74 +1039,107 @@ const { status, data, send, close, open } = useWebSocket(urlRef, {
|
|
|
28
1039
|
}
|
|
29
1040
|
}
|
|
30
1041
|
});
|
|
1042
|
+
function sendMsg(i) {
|
|
1043
|
+
send(JSON.stringify(i));
|
|
1044
|
+
}
|
|
1045
|
+
const ws = {
|
|
1046
|
+
sendMsg,
|
|
1047
|
+
close,
|
|
1048
|
+
status
|
|
1049
|
+
};
|
|
31
1050
|
var subscribeMap = /* @__PURE__ */ new Map();
|
|
32
|
-
function zwqWs(
|
|
33
|
-
urlRef.value || (urlRef.value =
|
|
34
|
-
log("ws status",
|
|
35
|
-
}), watch(data, (
|
|
36
|
-
if (
|
|
37
|
-
let { sourceIp:
|
|
38
|
-
if (
|
|
39
|
-
let
|
|
40
|
-
|
|
41
|
-
|
|
1051
|
+
function zwqWs(i, N) {
|
|
1052
|
+
urlRef.value || (urlRef.value = N.url, open()), watch(status, (i) => {
|
|
1053
|
+
log("ws status", i);
|
|
1054
|
+
}), watch(data, (i) => {
|
|
1055
|
+
if (i !== "pong") try {
|
|
1056
|
+
let { sourceIp: P, event: F, payload: I } = JSON.parse(i);
|
|
1057
|
+
if (N?.trustIp && P !== N.trustIp) return;
|
|
1058
|
+
let L = subscribeMap.get(F);
|
|
1059
|
+
L && L.forEach(({ fn: i, off: N }) => {
|
|
1060
|
+
i(I), N && N();
|
|
42
1061
|
});
|
|
43
|
-
} catch (
|
|
44
|
-
console.error("ws 数据格式有误",
|
|
1062
|
+
} catch (i) {
|
|
1063
|
+
console.error("ws 数据格式有误", i);
|
|
45
1064
|
}
|
|
46
1065
|
});
|
|
47
1066
|
}
|
|
48
|
-
function useWs(
|
|
49
|
-
status.value === "CLOSED" && urlRef.value && open();
|
|
50
|
-
let
|
|
51
|
-
function
|
|
1067
|
+
function useWs(i, N) {
|
|
1068
|
+
N && zwqWs(null, N), status.value === "CLOSED" && urlRef.value && open();
|
|
1069
|
+
let P = getUUID();
|
|
1070
|
+
function F(N) {
|
|
52
1071
|
log("ws on");
|
|
53
|
-
let
|
|
54
|
-
if (
|
|
1072
|
+
let F = subscribeMap.get(i);
|
|
1073
|
+
if (F) F.set(P, { fn: N });
|
|
55
1074
|
else {
|
|
56
|
-
let
|
|
57
|
-
subscribeMap.set(
|
|
1075
|
+
let F = (/* @__PURE__ */ new Map()).set(P, { fn: N });
|
|
1076
|
+
subscribeMap.set(i, F);
|
|
58
1077
|
}
|
|
59
1078
|
}
|
|
60
|
-
function
|
|
1079
|
+
function I() {
|
|
61
1080
|
log("ws off");
|
|
62
|
-
let
|
|
63
|
-
|
|
1081
|
+
let N = subscribeMap.get(i);
|
|
1082
|
+
N && N.has(P) && (N.delete(P), N.size === 0 && subscribeMap.delete(i));
|
|
64
1083
|
}
|
|
65
|
-
function
|
|
1084
|
+
function L(N) {
|
|
66
1085
|
log("ws once");
|
|
67
|
-
let
|
|
68
|
-
if (
|
|
1086
|
+
let F = subscribeMap.get(i);
|
|
1087
|
+
if (F) F.set(P, { fn: N });
|
|
69
1088
|
else {
|
|
70
|
-
let
|
|
71
|
-
fn:
|
|
72
|
-
off:
|
|
1089
|
+
let F = (/* @__PURE__ */ new Map()).set(P, {
|
|
1090
|
+
fn: N,
|
|
1091
|
+
off: I
|
|
73
1092
|
});
|
|
74
|
-
subscribeMap.set(
|
|
1093
|
+
subscribeMap.set(i, F);
|
|
75
1094
|
}
|
|
76
1095
|
}
|
|
77
1096
|
onBeforeUnmount(() => {
|
|
78
|
-
|
|
1097
|
+
I();
|
|
79
1098
|
});
|
|
80
|
-
function
|
|
81
|
-
|
|
1099
|
+
function z(i) {
|
|
1100
|
+
sendMsg(i);
|
|
82
1101
|
}
|
|
83
1102
|
return {
|
|
84
|
-
on:
|
|
85
|
-
off:
|
|
86
|
-
once:
|
|
87
|
-
emit:
|
|
1103
|
+
on: F,
|
|
1104
|
+
off: I,
|
|
1105
|
+
once: L,
|
|
1106
|
+
emit: z
|
|
88
1107
|
};
|
|
89
1108
|
}
|
|
90
|
-
|
|
91
|
-
|
|
1109
|
+
var loaded = !1;
|
|
1110
|
+
loaded ||= (loadSvgIcons(), !0);
|
|
1111
|
+
async function loadSvgIcons() {
|
|
1112
|
+
let i = import.meta.glob("@/assets/icon/*.svg", {
|
|
1113
|
+
eager: !0,
|
|
1114
|
+
query: "?raw"
|
|
1115
|
+
});
|
|
1116
|
+
await Promise.all(Object.entries(i).map((i) => {
|
|
1117
|
+
let [N, P] = i, F = N.lastIndexOf("/") + 1, I = N.lastIndexOf(".");
|
|
1118
|
+
return addIcon(`svg:${N.slice(F, I)}`, { ...parseSvg(typeof P == "object" ? P.default : P) });
|
|
1119
|
+
}));
|
|
92
1120
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
1121
|
+
async function loadLocalSvgIcons(i) {
|
|
1122
|
+
await Promise.all(Object.entries(i).map((i) => {
|
|
1123
|
+
let [N, P] = i, F = N.lastIndexOf("/") + 1, I = N.lastIndexOf(".");
|
|
1124
|
+
return addIcon(`svg:${N.slice(F, I)}`, { ...parseSvg(typeof P == "object" ? P.default : P) });
|
|
1125
|
+
}));
|
|
1126
|
+
}
|
|
1127
|
+
function parseSvg(i) {
|
|
1128
|
+
let N = new DOMParser().parseFromString(i, "image/svg+xml").documentElement, P = [...N.childNodes].filter((i) => i.nodeType === Node.ELEMENT_NODE).map((i) => new XMLSerializer().serializeToString(i)).join(""), [F, I, L, R] = (N.getAttribute("viewBox") || "").split(" ").map((i) => {
|
|
1129
|
+
let N = Number(i);
|
|
1130
|
+
return Number.isNaN(N) ? void 0 : N;
|
|
1131
|
+
});
|
|
1132
|
+
return {
|
|
1133
|
+
body: P,
|
|
1134
|
+
height: R,
|
|
1135
|
+
left: F,
|
|
1136
|
+
top: I,
|
|
1137
|
+
width: L
|
|
1138
|
+
};
|
|
95
1139
|
}
|
|
96
|
-
var components = [Button_default], src_default = { install(
|
|
97
|
-
components.forEach((
|
|
98
|
-
|
|
1140
|
+
var components = [Button_default, Icon_default], src_default = { install(i) {
|
|
1141
|
+
components.forEach((N) => {
|
|
1142
|
+
i.component(N.name, N);
|
|
99
1143
|
});
|
|
100
1144
|
} };
|
|
101
|
-
export { EVENT_TYPE, Button_default as
|
|
1145
|
+
export { EVENT_TYPE, Button_default as ZButton, Icon_default as ZIcon, src_default as default, loadLocalSvgIcons, useWs, ws, zwqWs };
|
package/dist/zxq-com.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`),require(`@vueuse/core`)):typeof define==`function`&&define.amd?define([`exports`,`vue`,`@vueuse/core`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ZxqCom={},e.Vue,e.VueUse))})(this,function(e,t,n){Object.defineProperty(e,`__esModule`,{value:!0});var r={class:`zxq-button`},i=(0,t.defineComponent)({name:`ZxqButton`,__name:`Button`,setup(e){return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,r,[(0,t.renderSlot)(e.$slots,`default`)]))}});let a={DEV1:`dev-1`,DEV2:`dev-2`};var o=(0,t.ref)();let{status:s,data:c,send:l,close:u,open:d}=(0,n.useWebSocket)(o,{immediate:!1,autoConnect:!1,heartbeat:{message:`ping`,interval:5e3,pongTimeout:15e3},autoReconnect:{retries:3,delay:1e4,onFailed(){console.error(`超过重连次数`)}}});var f=new Map;function p(e,n){o.value||(o.value=n.url,d()),(0,t.watch)(s,e=>{g(`ws status`,e)}),(0,t.watch)(c,e=>{if(e!==`pong`)try{let{sourceIp:t,event:r,payload:i}=JSON.parse(e);if(n?.trustIp&&t!==n.trustIp)return;let a=f.get(r);a&&a.forEach(({fn:e,off:t})=>{e(i),t&&t()})}catch(e){console.error(`ws 数据格式有误`,e)}})}function m(e){s.value===`CLOSED`&&o.value&&d();let n=h();function r(t){g(`ws on`);let r=f.get(e);if(r)r.set(n,{fn:t});else{let r=new Map().set(n,{fn:t});f.set(e,r)}}function i(){g(`ws off`);let t=f.get(e);t&&t.has(n)&&(t.delete(n),t.size===0&&f.delete(e))}function a(t){g(`ws once`);let r=f.get(e);if(r)r.set(n,{fn:t});else{let r=new Map().set(n,{fn:t,off:i});f.set(e,r)}}(0,t.onBeforeUnmount)(()=>{i()});function c(e){l(JSON.stringify(e))}return{on:r,off:i,once:a,emit:c}}function h(e=``){return e+(crypto?.randomUUID?.()||`${Date.now()}_${Math.random().toString(16).slice(2)}`)}function g(...e){console.log(`【zxqWs】`,...e)}var _=[i];e.EVENT_TYPE=a,e.ZxqButton=i,e.close=u,e.data=c,e.default={install(e){_.forEach(t=>{e.component(t.name,t)})}},e.open=d,e.send=l,e.status=s,e.useWs=m,e.zwqWs=p});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`),require(`@vueuse/core`)):typeof define==`function`&&define.amd?define([`exports`,`vue`,`@vueuse/core`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ZxqCom={},e.Vue,e.VueUse))})(this,function(e,t,n){Object.defineProperty(e,`__esModule`,{value:!0});var r={class:`zxq-button`},i=(0,t.defineComponent)({name:`ZButton`,__name:`Button`,setup(e){return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,r,[(0,t.renderSlot)(e.$slots,`default`)]))}}),a=/^[a-z0-9]+(-[a-z0-9]+)*$/,o=(e,t,n,r=``)=>{let i=e.split(`:`);if(e.slice(0,1)===`@`){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let e=i.pop(),n=i.pop(),a={provider:i.length>0?i[0]:r,prefix:n,name:e};return t&&!s(a)?null:a}let a=i[0],o=a.split(`-`);if(o.length>1){let e={provider:r,prefix:o.shift(),name:o.join(`-`)};return t&&!s(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!s(e,n)?null:e}return null},s=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1,c=Object.freeze({left:0,top:0,width:16,height:16}),l=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),u=Object.freeze({...c,...l}),d=Object.freeze({...u,body:``,hidden:!1});function f(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function p(e,t){let n=f(e,t);for(let r in d)r in l?r in e&&!(r in n)&&(n[r]=l[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function m(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}function h(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=p(r[e]||i[e],a)}return o(t),n.forEach(o),p(e,a)}function g(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=m(e);for(let i in r){let a=r[i];a&&(t(i,h(e,i,a)),n.push(i))}return n}var ee={provider:``,aliases:{},not_found:{},...c};function _(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function v(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!_(e,ee))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!_(t,d))return null}let r=t.aliases||Object.create(null);for(let e in r){let t=r[e],i=t.parent;if(!e||typeof i!=`string`||!n[i]&&!r[i]||!_(t,d))return null}return t}var y=Object.create(null);function b(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function x(e,t){let n=y[e]||(y[e]=Object.create(null));return n[t]||(n[t]=b(e,t))}function te(e,t){return v(t)?g(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function ne(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var S=!1;function C(e){return typeof e==`boolean`&&(S=e),S}function re(e){let t=typeof e==`string`?o(e,!0,S):e;if(t){let e=x(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function w(e,t){let n=o(e,!0,S);if(!n)return!1;let r=x(n.provider,n.prefix);return t?ne(r,n.name,t):(r.missing.add(n.name),!0)}function ie(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),S&&!t&&!e.prefix){let t=!1;return v(e)&&(e.prefix=``,g(e,(e,n)=>{w(e,n)&&(t=!0)})),t}let n=e.prefix;return s({prefix:n,name:`a`})?!!te(x(t,n),e):!1}var T=Object.freeze({width:null,height:null}),E=Object.freeze({...T,...l}),ae=/(-?[0-9.]*[0-9]+[0-9.]*)/g,oe=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function D(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(ae);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=oe.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function se(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function ce(e,t){return e?`<defs>`+e+`</defs>`+t:t}function le(e,t,n){let r=se(e);return ce(r.defs,t+r.content+n)}var ue=e=>e===`unset`||e===`undefined`||e===`none`;function de(e,t){let n={...u,...e},r={...E,...t},i={left:n.left,top:n.top,width:n.width,height:n.height},a=n.body;[n,r].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,o=e.rotate;n?r?o+=2:(t.push(`translate(`+(i.width+i.left).toString()+` `+(0-i.top).toString()+`)`),t.push(`scale(-1 1)`),i.top=i.left=0):r&&(t.push(`translate(`+(0-i.left).toString()+` `+(i.height+i.top).toString()+`)`),t.push(`scale(1 -1)`),i.top=i.left=0);let s;switch(o<0&&(o-=Math.floor(o/4)*4),o%=4,o){case 1:s=i.height/2+i.top,t.unshift(`rotate(90 `+s.toString()+` `+s.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(i.width/2+i.left).toString()+` `+(i.height/2+i.top).toString()+`)`);break;case 3:s=i.width/2+i.left,t.unshift(`rotate(-90 `+s.toString()+` `+s.toString()+`)`);break}o%2==1&&(i.left!==i.top&&(s=i.left,i.left=i.top,i.top=s),i.width!==i.height&&(s=i.width,i.width=i.height,i.height=s)),t.length&&(a=le(a,`<g transform="`+t.join(` `)+`">`,`</g>`))});let o=r.width,s=r.height,c=i.width,l=i.height,d,f;o===null?(f=s===null?`1em`:s===`auto`?l:s,d=D(f,c/l)):(d=o===`auto`?c:o,f=s===null?D(d,l/c):s===`auto`?l:s);let p={},m=(e,t)=>{ue(t)||(p[e]=t.toString())};m(`width`,d),m(`height`,f);let h=[i.left,i.top,c,l];return p.viewBox=h.join(` `),{attributes:p,viewBox:h,body:a}}var fe=/\sid="(\S+)"/g,pe=`IconifyId`+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),me=0;function he(e,t=pe){let n=[],r;for(;r=fe.exec(e);)n.push(r[1]);if(!n.length)return e;let i=`suffix`+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(n=>{let r=typeof t==`function`?t(n):t+(me++).toString(),a=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);e=e.replace(RegExp(`([#;"])(`+a+`)([")]|\\.[a-z])`,`g`),`$1`+r+i+`$3`)}),e=e.replace(new RegExp(i,`g`),``),e}var O=Object.create(null);function ge(e,t){O[e]=t}function k(e){return O[e]||O[``]}function A(e){let t;if(typeof e.resources==`string`)t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var j=Object.create(null),M=[`https://api.simplesvg.com`,`https://api.unisvg.com`],N=[];M.length>0;)M.length===1||Math.random()>.5?N.push(M.shift()):N.push(M.pop());j[``]=A({resources:[`https://api.iconify.design`].concat(N)});function _e(e,t){let n=A(t);return n===null?!1:(j[e]=n,!0)}function P(e){return j[e]}var F=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function ve(e,t){let n=P(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{let n=t;e=Math.max(e,n.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function ye(e){return e===404}var be=(e,t,n)=>{let r=[],i=ve(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function xe(e){if(typeof e==`string`){let t=P(e);if(t)return t.path}return`/`}var Se={prepare:be,send:(e,t,n)=>{if(!F){n(`abort`,424);return}let r=xe(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;F(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(ye(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function Ce(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=x(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}function we(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function Te(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||we([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var Ee=0;function De(e,t,n){let r=Ee++,i=we.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function Oe(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?o(e,t,n):e;i&&r.push(i)}),r}var ke={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Ae(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function ee(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function _(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function v(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function y(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,_();return}if(i){u=r,f.length||(o.length?b():_());return}if(m(),v(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function b(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(v(),_())},e.timeout);return}_();return}let i={status:`pending`,resource:r,callback:(e,t)=>{y(i,e,t)}};f.push(i),l++,d=setTimeout(b,e.rotate),n(r,t,i.callback)}return setTimeout(b),ee}function je(e){let t={...ke,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=Ae(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function Me(){}var I=Object.create(null);function Ne(e){if(!I[e]){let t=P(e);if(!t)return;I[e]={config:t,redundancy:je(t)}}return I[e]}function Pe(e,t,n){let r,i;if(typeof e==`string`){let t=k(e);if(!t)return n(void 0,424),Me;i=t.send;let a=Ne(e);a&&(r=a.redundancy)}else{let t=A(e);if(t){r=je(t);let n=k(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),Me):r.query(t,i,n)().abort}function L(){}function Fe(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Te(e)}))}function Ie(e){let t=[],n=[];return e.forEach(e=>{(e.match(a)?t:n).push(e)}),{valid:t,invalid:n}}function R(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!te(e,n).length){r();return}}catch(e){console.error(e)}r(),Fe(e)}function z(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function Le(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;let i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){z(e.loadIcons(r,n,t),t=>{R(e,r,t)});return}if(i){r.forEach(r=>{z(i(r,n,t),t=>{R(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:o,invalid:s}=Ie(r);if(s.length&&R(e,s,null),!o.length)return;let c=n.match(a)?k(t):null;if(!c){R(e,o,null);return}c.prepare(t,n,o).forEach(n=>{Pe(t,n,t=>{R(e,n.icons,t)})})}))}var Re=(e,t)=>{let n=Ce(Oe(e,!0,C()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,L)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(x(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=x(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&Le(e,t)}),t?De(t,n,i):L};function ze(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in T?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var Be=/[\s,]+/;function Ve(e,t){t.split(Be).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0;break}})}function He(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}else if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}function Ue(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function We(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function Ge(e){return`data:image/svg+xml,`+We(e)}function Ke(e){return`url("`+Ge(e)+`")`}var B={...E,inline:!1},qe={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},Je={display:`inline-block`},V={backgroundColor:`currentColor`},H={backgroundColor:`transparent`},U={Image:`var(--svg)`,Repeat:`no-repeat`,Size:`100% 100%`},W={webkitMask:V,mask:V,background:H};for(let e in W){let t=W[e];for(let n in U)t[e+n]=U[n]}var G={};[`horizontal`,`vertical`].forEach(e=>{let t=e.slice(0,1)+`Flip`;G[e+`-flip`]=t,G[e.slice(0,1)+`-flip`]=t,G[e+`Flip`]=t});function K(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}var q=(e,n)=>{let r=ze(B,n),i={...qe},a=n.mode||`svg`,o={},s=n.style,c=typeof s==`object`&&!(s instanceof Array)?s:{};for(let e in n){let t=n[e];if(t!==void 0)switch(e){case`icon`:case`style`:case`onLoad`:case`mode`:case`ssr`:break;case`inline`:case`hFlip`:case`vFlip`:r[e]=t===!0||t===`true`||t===1;break;case`flip`:typeof t==`string`&&Ve(r,t);break;case`color`:o.color=t;break;case`rotate`:typeof t==`string`?r[e]=He(t):typeof t==`number`&&(r[e]=t);break;case`ariaHidden`:case`aria-hidden`:t!==!0&&t!==`true`&&delete i[`aria-hidden`];break;default:{let n=G[e];n?(t===!0||t===`true`||t===1)&&(r[n]=!0):B[e]===void 0&&(i[e]=t)}}}let l=de(e,r),u=l.attributes;if(r.inline&&(o.verticalAlign=`-0.125em`),a===`svg`){i.style={...o,...c},Object.assign(i,u);let e=0,r=n.id;return typeof r==`string`&&(r=r.replace(/-/g,`_`)),i.innerHTML=he(l.body,r?()=>r+`ID`+ e++:`iconifyVue`),(0,t.h)(`svg`,i)}let{body:d,width:f,height:p}=e,m=a===`mask`||(a===`bg`?!1:d.indexOf(`currentColor`)!==-1),h=Ue(d,{...u,width:f+``,height:p+``});return i.style={...o,"--svg":Ke(h),width:K(u.width),height:K(u.height),...Je,...m?V:H,...c},(0,t.h)(`span`,i)};if(C(!0),ge(``,Se),typeof document<`u`&&typeof window<`u`){let e=window;if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!ie(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;_e(e,r)||console.error(n)}catch{console.error(n)}}}}var Ye={...u,body:``},Xe=(0,t.defineComponent)((e,{emit:n})=>{let r=(0,t.ref)(null);function i(){r.value&&=(r.value.abort?.(),null)}let a=(0,t.ref)(!!e.ssr),s=(0,t.ref)(``),c=(0,t.shallowRef)(null);function l(){let a=e.icon;if(typeof a==`object`&&a&&typeof a.body==`string`)return s.value=``,{data:a};let c;if(typeof a!=`string`||(c=o(a,!1,!0))===null)return null;let l=re(c);if(!l){let e=r.value;return(!e||e.name!==a)&&(l===null?r.value={name:a}:r.value={name:a,abort:Re([c],d)}),null}i(),s.value!==a&&(s.value=a,(0,t.nextTick)(()=>{n(`load`,a)}));let u=e.customise;if(u){l=Object.assign({},l);let e=u(l.body,c.name,c.prefix,c.provider);typeof e==`string`&&(l.body=e)}let f=[`iconify`];return c.prefix!==``&&f.push(`iconify--`+c.prefix),c.provider!==``&&f.push(`iconify--`+c.provider),{data:l,classes:f}}function d(){let e=l();e?e.data!==c.value?.data&&(c.value=e):c.value=null}return a.value?d():(0,t.onMounted)(()=>{a.value=!0,d()}),(0,t.watch)(()=>e.icon,d),(0,t.onUnmounted)(i),()=>{let t=c.value;if(!t)return q(Ye,e);let n=e;return t.classes&&(n={...e,class:t.classes.join(` `)}),q({...u,...t.data},n)}},{props:[`icon`,`mode`,`ssr`,`width`,`height`,`style`,`color`,`inline`,`rotate`,`hFlip`,`horizontalFlip`,`vFlip`,`verticalFlip`,`flip`,`id`,`ariaHidden`,`customise`,`title`],emits:[`load`]}),J=(0,t.defineComponent)({name:`ZIcon`,__name:`Icon`,props:{icon:{}},setup(e){let n=e,r=(0,t.computed)(()=>typeof n.icon==`string`);return(n,i)=>r.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Xe),{key:0,icon:e.icon},null,8,[`icon`])):((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.icon),{key:1}))}});function Ze(e=``){return e+(crypto?.randomUUID?.()||`${Date.now()}_${Math.random().toString(16).slice(2)}`)}function Y(...e){console.log(`【zxqWs】`,...e)}let Qe={DEV1:`dev-1`,DEV2:`dev-2`};var X=(0,t.ref)(),{status:Z,data:$e,send:et,close:tt,open:Q}=(0,n.useWebSocket)(X,{immediate:!1,autoConnect:!1,heartbeat:{message:`ping`,interval:5e3,pongTimeout:15e3},autoReconnect:{retries:3,delay:1e4,onFailed(){console.error(`超过重连次数`)}}});function nt(e){et(JSON.stringify(e))}let rt={sendMsg:nt,close:tt,status:Z};var $=new Map;function it(e,n){X.value||(X.value=n.url,Q()),(0,t.watch)(Z,e=>{Y(`ws status`,e)}),(0,t.watch)($e,e=>{if(e!==`pong`)try{let{sourceIp:t,event:r,payload:i}=JSON.parse(e);if(n?.trustIp&&t!==n.trustIp)return;let a=$.get(r);a&&a.forEach(({fn:e,off:t})=>{e(i),t&&t()})}catch(e){console.error(`ws 数据格式有误`,e)}})}function at(e,n){n&&it(null,n),Z.value===`CLOSED`&&X.value&&Q();let r=Ze();function i(t){Y(`ws on`);let n=$.get(e);if(n)n.set(r,{fn:t});else{let n=new Map().set(r,{fn:t});$.set(e,n)}}function a(){Y(`ws off`);let t=$.get(e);t&&t.has(r)&&(t.delete(r),t.size===0&&$.delete(e))}function o(t){Y(`ws once`);let n=$.get(e);if(n)n.set(r,{fn:t});else{let n=new Map().set(r,{fn:t,off:a});$.set(e,n)}}(0,t.onBeforeUnmount)(()=>{a()});function s(e){nt(e)}return{on:i,off:a,once:o,emit:s}}var ot=!1;ot||=(st(),!0);async function st(){let e={}.glob(`@/assets/icon/*.svg`,{eager:!0,query:`?raw`});await Promise.all(Object.entries(e).map(e=>{let[t,n]=e,r=t.lastIndexOf(`/`)+1,i=t.lastIndexOf(`.`);return w(`svg:${t.slice(r,i)}`,{...lt(typeof n==`object`?n.default:n)})}))}async function ct(e){await Promise.all(Object.entries(e).map(e=>{let[t,n]=e,r=t.lastIndexOf(`/`)+1,i=t.lastIndexOf(`.`);return w(`svg:${t.slice(r,i)}`,{...lt(typeof n==`object`?n.default:n)})}))}function lt(e){let t=new DOMParser().parseFromString(e,`image/svg+xml`).documentElement,n=[...t.childNodes].filter(e=>e.nodeType===Node.ELEMENT_NODE).map(e=>new XMLSerializer().serializeToString(e)).join(``),[r,i,a,o]=(t.getAttribute(`viewBox`)||``).split(` `).map(e=>{let t=Number(e);return Number.isNaN(t)?void 0:t});return{body:n,height:o,left:r,top:i,width:a}}var ut=[i,J];e.EVENT_TYPE=Qe,e.ZButton=i,e.ZIcon=J,e.default={install(e){ut.forEach(t=>{e.component(t.name,t)})}},e.loadLocalSvgIcons=ct,e.useWs=at,e.ws=rt,e.zwqWs=it});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zxq-com",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/zxq-com.umd.cjs",
|
|
6
6
|
"module": "./dist/zxq-com.js",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@vueuse/core": "^14.1.0",
|
|
29
|
+
"@iconify/vue": "^5.0.0",
|
|
29
30
|
"vue": "^3.0.0"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|