@wsxjs/wsx-router 0.0.18 → 0.0.20
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.cjs +1 -1
- package/dist/index.js +694 -911
- package/package.json +5 -5
- package/src/WsxLink.wsx +10 -6
- package/src/WsxView.wsx +19 -51
package/dist/index.js
CHANGED
|
@@ -1,475 +1,277 @@
|
|
|
1
|
-
import { autoRegister as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { autoRegister as ce, LightComponent as re, jsx as te, WebComponent as le } from "@wsxjs/wsx-core";
|
|
2
|
+
var We = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
3
|
+
function Ae(n) {
|
|
4
|
+
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
4
5
|
}
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (u === 0) return t;
|
|
29
|
-
for (var i = "", p = 1 - s, v = -1, z = t && t.length || 0, x = 0; x < z; ) {
|
|
30
|
-
if (t.charCodeAt(x) === 37 && x + 1 < z) {
|
|
31
|
-
switch (v = v > -1 ? v : 0, t.charCodeAt(x + 1)) {
|
|
32
|
-
case 100:
|
|
33
|
-
// 'd'
|
|
34
|
-
case 102:
|
|
35
|
-
if (p >= u || e[p] == null) break;
|
|
36
|
-
v < x && (i += t.slice(v, x)), i += Number(e[p]), v = x + 2, x++;
|
|
37
|
-
break;
|
|
38
|
-
case 105:
|
|
39
|
-
if (p >= u || e[p] == null) break;
|
|
40
|
-
v < x && (i += t.slice(v, x)), i += Math.floor(Number(e[p])), v = x + 2, x++;
|
|
41
|
-
break;
|
|
42
|
-
case 79:
|
|
43
|
-
// 'O'
|
|
44
|
-
case 111:
|
|
45
|
-
// 'o'
|
|
46
|
-
case 106:
|
|
47
|
-
if (p >= u || e[p] === void 0) break;
|
|
48
|
-
v < x && (i += t.slice(v, x));
|
|
49
|
-
var o = typeof e[p];
|
|
50
|
-
if (o === "string") {
|
|
51
|
-
i += "'" + e[p] + "'", v = x + 2, x++;
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
if (o === "function") {
|
|
55
|
-
i += e[p].name || "<anonymous>", v = x + 2, x++;
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
i += r(e[p]), v = x + 2, x++;
|
|
59
|
-
break;
|
|
60
|
-
case 115:
|
|
61
|
-
if (p >= u)
|
|
62
|
-
break;
|
|
63
|
-
v < x && (i += t.slice(v, x)), i += String(e[p]), v = x + 2, x++;
|
|
64
|
-
break;
|
|
65
|
-
case 37:
|
|
66
|
-
v < x && (i += t.slice(v, x)), i += "%", v = x + 2, x++, p--;
|
|
67
|
-
break;
|
|
6
|
+
var ye = { exports: {} };
|
|
7
|
+
(function(n) {
|
|
8
|
+
(function(e, t) {
|
|
9
|
+
n.exports ? n.exports = t() : e.log = t();
|
|
10
|
+
})(We, function() {
|
|
11
|
+
var e = function() {
|
|
12
|
+
}, t = "undefined", r = typeof window !== t && typeof window.navigator !== t && /Trident\/|MSIE /.test(window.navigator.userAgent), g = [
|
|
13
|
+
"trace",
|
|
14
|
+
"debug",
|
|
15
|
+
"info",
|
|
16
|
+
"warn",
|
|
17
|
+
"error"
|
|
18
|
+
], v = {}, f = null;
|
|
19
|
+
function _(o, c) {
|
|
20
|
+
var i = o[c];
|
|
21
|
+
if (typeof i.bind == "function")
|
|
22
|
+
return i.bind(o);
|
|
23
|
+
try {
|
|
24
|
+
return Function.prototype.bind.call(i, o);
|
|
25
|
+
} catch {
|
|
26
|
+
return function() {
|
|
27
|
+
return Function.prototype.apply.apply(i, [o, arguments]);
|
|
28
|
+
};
|
|
68
29
|
}
|
|
69
|
-
++p;
|
|
70
30
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return v === -1 ? t : (v < z && (i += t.slice(v)), i);
|
|
74
|
-
}
|
|
75
|
-
const Le = Ye;
|
|
76
|
-
ue.exports = K;
|
|
77
|
-
const re = mt().console || {}, et = {
|
|
78
|
-
mapHttpRequest: ie,
|
|
79
|
-
mapHttpResponse: ie,
|
|
80
|
-
wrapRequestSerializer: fe,
|
|
81
|
-
wrapResponseSerializer: fe,
|
|
82
|
-
wrapErrorSerializer: fe,
|
|
83
|
-
req: ie,
|
|
84
|
-
res: ie,
|
|
85
|
-
err: _e,
|
|
86
|
-
errWithCause: _e
|
|
87
|
-
};
|
|
88
|
-
function Y(t, e) {
|
|
89
|
-
return t === "silent" ? 1 / 0 : e.levels.values[t];
|
|
90
|
-
}
|
|
91
|
-
const xe = Symbol("pino.logFuncs"), be = Symbol("pino.hierarchy"), tt = {
|
|
92
|
-
error: "log",
|
|
93
|
-
fatal: "error",
|
|
94
|
-
warn: "error",
|
|
95
|
-
info: "log",
|
|
96
|
-
debug: "log",
|
|
97
|
-
trace: "log"
|
|
98
|
-
};
|
|
99
|
-
function ke(t, e) {
|
|
100
|
-
const n = {
|
|
101
|
-
logger: e,
|
|
102
|
-
parent: t[be]
|
|
103
|
-
};
|
|
104
|
-
e[be] = n;
|
|
105
|
-
}
|
|
106
|
-
function nt(t, e, n) {
|
|
107
|
-
const r = {};
|
|
108
|
-
e.forEach((s) => {
|
|
109
|
-
r[s] = n[s] ? n[s] : re[s] || re[tt[s] || "log"] || ne;
|
|
110
|
-
}), t[xe] = r;
|
|
111
|
-
}
|
|
112
|
-
function rt(t, e) {
|
|
113
|
-
return Array.isArray(t) ? t.filter(function(r) {
|
|
114
|
-
return r !== "!stdSerializers.err";
|
|
115
|
-
}) : t === !0 ? Object.keys(e) : !1;
|
|
116
|
-
}
|
|
117
|
-
function K(t) {
|
|
118
|
-
t = t || {}, t.browser = t.browser || {};
|
|
119
|
-
const e = t.browser.transmit;
|
|
120
|
-
if (e && typeof e.send != "function")
|
|
121
|
-
throw Error("pino: transmit option must have a send function");
|
|
122
|
-
const n = t.browser.write || re;
|
|
123
|
-
t.browser.write && (t.browser.asObject = !0);
|
|
124
|
-
const r = t.serializers || {}, s = rt(t.browser.serialize, r);
|
|
125
|
-
let l = t.browser.serialize;
|
|
126
|
-
Array.isArray(t.browser.serialize) && t.browser.serialize.indexOf("!stdSerializers.err") > -1 && (l = !1);
|
|
127
|
-
const m = Object.keys(t.customLevels || {}), g = ["error", "fatal", "warn", "info", "debug", "trace"].concat(m);
|
|
128
|
-
typeof n == "function" && g.forEach(function(c) {
|
|
129
|
-
n[c] = n;
|
|
130
|
-
}), (t.enabled === !1 || t.browser.disabled) && (t.level = "silent");
|
|
131
|
-
const u = t.level || "info", i = Object.create(n);
|
|
132
|
-
i.log || (i.log = ne), nt(i, g, n), ke({}, i), Object.defineProperty(i, "levelVal", {
|
|
133
|
-
get: v
|
|
134
|
-
}), Object.defineProperty(i, "level", {
|
|
135
|
-
get: z,
|
|
136
|
-
set: x
|
|
137
|
-
});
|
|
138
|
-
const p = {
|
|
139
|
-
transmit: e,
|
|
140
|
-
serialize: s,
|
|
141
|
-
asObject: t.browser.asObject,
|
|
142
|
-
asObjectBindingsOnly: t.browser.asObjectBindingsOnly,
|
|
143
|
-
formatters: t.browser.formatters,
|
|
144
|
-
levels: g,
|
|
145
|
-
timestamp: ht(t),
|
|
146
|
-
messageKey: t.messageKey || "msg",
|
|
147
|
-
onChild: t.onChild || ne
|
|
148
|
-
};
|
|
149
|
-
i.levels = it(t), i.level = u, i.isLevelEnabled = function(c) {
|
|
150
|
-
return this.levels.values[c] ? this.levels.values[c] >= this.levels.values[this.level] : !1;
|
|
151
|
-
}, i.setMaxListeners = i.getMaxListeners = i.emit = i.addListener = i.on = i.prependListener = i.once = i.prependOnceListener = i.removeListener = i.removeAllListeners = i.listeners = i.listenerCount = i.eventNames = i.write = i.flush = ne, i.serializers = r, i._serialize = s, i._stdErrSerialize = l, i.child = function(...c) {
|
|
152
|
-
return o.call(this, p, ...c);
|
|
153
|
-
}, e && (i._logEvent = ye());
|
|
154
|
-
function v() {
|
|
155
|
-
return Y(this.level, this);
|
|
156
|
-
}
|
|
157
|
-
function z() {
|
|
158
|
-
return this._level;
|
|
159
|
-
}
|
|
160
|
-
function x(c) {
|
|
161
|
-
if (c !== "silent" && !this.levels.values[c])
|
|
162
|
-
throw Error("unknown level " + c);
|
|
163
|
-
this._level = c, Z(this, p, i, "error"), Z(this, p, i, "fatal"), Z(this, p, i, "warn"), Z(this, p, i, "info"), Z(this, p, i, "debug"), Z(this, p, i, "trace"), m.forEach((f) => {
|
|
164
|
-
Z(this, p, i, f);
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
function o(c, f, h) {
|
|
168
|
-
if (!f)
|
|
169
|
-
throw new Error("missing bindings for child Pino");
|
|
170
|
-
h = h || {}, s && f.serializers && (h.serializers = f.serializers);
|
|
171
|
-
const d = h.serializers;
|
|
172
|
-
if (s && d) {
|
|
173
|
-
var T = Object.assign({}, r, d), V = t.browser.serialize === !0 ? Object.keys(T) : s;
|
|
174
|
-
delete f.serializers, Ee([f], V, T, this._stdErrSerialize);
|
|
31
|
+
function b() {
|
|
32
|
+
console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
|
|
175
33
|
}
|
|
176
|
-
function
|
|
177
|
-
|
|
178
|
-
[].concat(_._logEvent.bindings, f)
|
|
179
|
-
));
|
|
34
|
+
function T(o) {
|
|
35
|
+
return o === "debug" && (o = "log"), typeof console === t ? !1 : o === "trace" && r ? b : console[o] !== void 0 ? _(console, o) : console.log !== void 0 ? _(console, "log") : e;
|
|
180
36
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}, I.level = h.level || this.level, c.onChild(I), I;
|
|
186
|
-
}
|
|
187
|
-
return i;
|
|
188
|
-
}
|
|
189
|
-
function it(t) {
|
|
190
|
-
const e = t.customLevels || {}, n = Object.assign({}, K.levels.values, e), r = Object.assign({}, K.levels.labels, st(e));
|
|
191
|
-
return {
|
|
192
|
-
values: n,
|
|
193
|
-
labels: r
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
function st(t) {
|
|
197
|
-
const e = {};
|
|
198
|
-
return Object.keys(t).forEach(function(n) {
|
|
199
|
-
e[t[n]] = n;
|
|
200
|
-
}), e;
|
|
201
|
-
}
|
|
202
|
-
K.levels = {
|
|
203
|
-
values: {
|
|
204
|
-
fatal: 60,
|
|
205
|
-
error: 50,
|
|
206
|
-
warn: 40,
|
|
207
|
-
info: 30,
|
|
208
|
-
debug: 20,
|
|
209
|
-
trace: 10
|
|
210
|
-
},
|
|
211
|
-
labels: {
|
|
212
|
-
10: "trace",
|
|
213
|
-
20: "debug",
|
|
214
|
-
30: "info",
|
|
215
|
-
40: "warn",
|
|
216
|
-
50: "error",
|
|
217
|
-
60: "fatal"
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
K.stdSerializers = et;
|
|
221
|
-
K.stdTimeFunctions = Object.assign({}, { nullTime: De, epochTime: Me, unixTime: ft, isoTime: dt });
|
|
222
|
-
function ot(t) {
|
|
223
|
-
const e = [];
|
|
224
|
-
t.bindings && e.push(t.bindings);
|
|
225
|
-
let n = t[be];
|
|
226
|
-
for (; n.parent; )
|
|
227
|
-
n = n.parent, n.logger.bindings && e.push(n.logger.bindings);
|
|
228
|
-
return e.reverse();
|
|
229
|
-
}
|
|
230
|
-
function Z(t, e, n, r) {
|
|
231
|
-
if (Object.defineProperty(t, r, {
|
|
232
|
-
value: Y(t.level, n) > Y(r, n) ? ne : n[xe][r],
|
|
233
|
-
writable: !0,
|
|
234
|
-
enumerable: !0,
|
|
235
|
-
configurable: !0
|
|
236
|
-
}), t[r] === ne) {
|
|
237
|
-
if (!e.transmit) return;
|
|
238
|
-
const l = e.transmit.level || t.level, m = Y(l, n);
|
|
239
|
-
if (Y(r, n) < m) return;
|
|
240
|
-
}
|
|
241
|
-
t[r] = ct(t, e, n, r);
|
|
242
|
-
const s = ot(t);
|
|
243
|
-
s.length !== 0 && (t[r] = at(s, t[r]));
|
|
244
|
-
}
|
|
245
|
-
function at(t, e) {
|
|
246
|
-
return function() {
|
|
247
|
-
return e.apply(this, [...t, ...arguments]);
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
function ct(t, e, n, r) {
|
|
251
|
-
return /* @__PURE__ */ function(s) {
|
|
252
|
-
return function() {
|
|
253
|
-
const m = e.timestamp(), g = new Array(arguments.length), u = Object.getPrototypeOf && Object.getPrototypeOf(this) === re ? re : this;
|
|
254
|
-
for (var i = 0; i < g.length; i++) g[i] = arguments[i];
|
|
255
|
-
var p = !1;
|
|
256
|
-
if (e.serialize && (Ee(g, this._serialize, this.serializers, this._stdErrSerialize), p = !0), e.asObject || e.formatters ? s.call(u, ...lt(this, r, g, m, e)) : s.apply(u, g), e.transmit) {
|
|
257
|
-
const v = e.transmit.level || t._level, z = Y(v, n), x = Y(r, n);
|
|
258
|
-
if (x < z) return;
|
|
259
|
-
ut(this, {
|
|
260
|
-
ts: m,
|
|
261
|
-
methodLevel: r,
|
|
262
|
-
methodValue: x,
|
|
263
|
-
transmitValue: n.levels.values[e.transmit.level || t._level],
|
|
264
|
-
send: e.transmit.send,
|
|
265
|
-
val: Y(t._level, n)
|
|
266
|
-
}, g, p);
|
|
37
|
+
function O() {
|
|
38
|
+
for (var o = this.getLevel(), c = 0; c < g.length; c++) {
|
|
39
|
+
var i = g[c];
|
|
40
|
+
this[i] = c < o ? e : this.methodFactory(i, o, this.name);
|
|
267
41
|
}
|
|
42
|
+
if (this.log = this.debug, typeof console === t && o < this.levels.SILENT)
|
|
43
|
+
return "No console available for logging";
|
|
44
|
+
}
|
|
45
|
+
function V(o) {
|
|
46
|
+
return function() {
|
|
47
|
+
typeof console !== t && (O.call(this), this[o].apply(this, arguments));
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function D(o, c, i) {
|
|
51
|
+
return T(o) || V.apply(this, arguments);
|
|
52
|
+
}
|
|
53
|
+
function H(o, c) {
|
|
54
|
+
var i = this, u, A, k, R = "loglevel";
|
|
55
|
+
typeof o == "string" ? R += ":" + o : typeof o == "symbol" && (R = void 0);
|
|
56
|
+
function P(h) {
|
|
57
|
+
var l = (g[h] || "silent").toUpperCase();
|
|
58
|
+
if (!(typeof window === t || !R)) {
|
|
59
|
+
try {
|
|
60
|
+
window.localStorage[R] = l;
|
|
61
|
+
return;
|
|
62
|
+
} catch {
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
window.document.cookie = encodeURIComponent(R) + "=" + l + ";";
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function E() {
|
|
71
|
+
var h;
|
|
72
|
+
if (!(typeof window === t || !R)) {
|
|
73
|
+
try {
|
|
74
|
+
h = window.localStorage[R];
|
|
75
|
+
} catch {
|
|
76
|
+
}
|
|
77
|
+
if (typeof h === t)
|
|
78
|
+
try {
|
|
79
|
+
var l = window.document.cookie, x = encodeURIComponent(R), C = l.indexOf(x + "=");
|
|
80
|
+
C !== -1 && (h = /^([^;]+)/.exec(
|
|
81
|
+
l.slice(C + x.length + 1)
|
|
82
|
+
)[1]);
|
|
83
|
+
} catch {
|
|
84
|
+
}
|
|
85
|
+
return i.levels[h] === void 0 && (h = void 0), h;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function L() {
|
|
89
|
+
if (!(typeof window === t || !R)) {
|
|
90
|
+
try {
|
|
91
|
+
window.localStorage.removeItem(R);
|
|
92
|
+
} catch {
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
window.document.cookie = encodeURIComponent(R) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
|
|
96
|
+
} catch {
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function p(h) {
|
|
101
|
+
var l = h;
|
|
102
|
+
if (typeof l == "string" && i.levels[l.toUpperCase()] !== void 0 && (l = i.levels[l.toUpperCase()]), typeof l == "number" && l >= 0 && l <= i.levels.SILENT)
|
|
103
|
+
return l;
|
|
104
|
+
throw new TypeError("log.setLevel() called with invalid level: " + h);
|
|
105
|
+
}
|
|
106
|
+
i.name = o, i.levels = {
|
|
107
|
+
TRACE: 0,
|
|
108
|
+
DEBUG: 1,
|
|
109
|
+
INFO: 2,
|
|
110
|
+
WARN: 3,
|
|
111
|
+
ERROR: 4,
|
|
112
|
+
SILENT: 5
|
|
113
|
+
}, i.methodFactory = c || D, i.getLevel = function() {
|
|
114
|
+
return k ?? A ?? u;
|
|
115
|
+
}, i.setLevel = function(h, l) {
|
|
116
|
+
return k = p(h), l !== !1 && P(k), O.call(i);
|
|
117
|
+
}, i.setDefaultLevel = function(h) {
|
|
118
|
+
A = p(h), E() || i.setLevel(h, !1);
|
|
119
|
+
}, i.resetLevel = function() {
|
|
120
|
+
k = null, L(), O.call(i);
|
|
121
|
+
}, i.enableAll = function(h) {
|
|
122
|
+
i.setLevel(i.levels.TRACE, h);
|
|
123
|
+
}, i.disableAll = function(h) {
|
|
124
|
+
i.setLevel(i.levels.SILENT, h);
|
|
125
|
+
}, i.rebuild = function() {
|
|
126
|
+
if (f !== i && (u = p(f.getLevel())), O.call(i), f === i)
|
|
127
|
+
for (var h in v)
|
|
128
|
+
v[h].rebuild();
|
|
129
|
+
}, u = p(
|
|
130
|
+
f ? f.getLevel() : "WARN"
|
|
131
|
+
);
|
|
132
|
+
var m = E();
|
|
133
|
+
m != null && (k = p(m)), O.call(i);
|
|
134
|
+
}
|
|
135
|
+
f = new H(), f.getLogger = function(c) {
|
|
136
|
+
if (typeof c != "symbol" && typeof c != "string" || c === "")
|
|
137
|
+
throw new TypeError("You must supply a name when creating a logger.");
|
|
138
|
+
var i = v[c];
|
|
139
|
+
return i || (i = v[c] = new H(
|
|
140
|
+
c,
|
|
141
|
+
f.methodFactory
|
|
142
|
+
)), i;
|
|
268
143
|
};
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
function Ee(t, e, n, r) {
|
|
299
|
-
for (const s in t)
|
|
300
|
-
if (r && t[s] instanceof Error)
|
|
301
|
-
t[s] = K.stdSerializers.err(t[s]);
|
|
302
|
-
else if (typeof t[s] == "object" && !Array.isArray(t[s]) && e)
|
|
303
|
-
for (const l in t[s])
|
|
304
|
-
e.indexOf(l) > -1 && l in n && (t[s][l] = n[l](t[s][l]));
|
|
305
|
-
}
|
|
306
|
-
function ut(t, e, n, r = !1) {
|
|
307
|
-
const s = e.send, l = e.ts, m = e.methodLevel, g = e.methodValue, u = e.val, i = t._logEvent.bindings;
|
|
308
|
-
r || Ee(
|
|
309
|
-
n,
|
|
310
|
-
t._serialize || Object.keys(t.serializers),
|
|
311
|
-
t.serializers,
|
|
312
|
-
t._stdErrSerialize === void 0 ? !0 : t._stdErrSerialize
|
|
313
|
-
), t._logEvent.ts = l, t._logEvent.messages = n.filter(function(p) {
|
|
314
|
-
return i.indexOf(p) === -1;
|
|
315
|
-
}), t._logEvent.level.label = m, t._logEvent.level.value = g, s(m, t._logEvent, u), t._logEvent = ye(i);
|
|
316
|
-
}
|
|
317
|
-
function ye(t) {
|
|
318
|
-
return {
|
|
319
|
-
ts: 0,
|
|
320
|
-
messages: [],
|
|
321
|
-
bindings: t || [],
|
|
322
|
-
level: { label: "", value: 0 }
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
function _e(t) {
|
|
326
|
-
const e = {
|
|
327
|
-
type: t.constructor.name,
|
|
328
|
-
msg: t.message,
|
|
329
|
-
stack: t.stack
|
|
330
|
-
};
|
|
331
|
-
for (const n in t)
|
|
332
|
-
e[n] === void 0 && (e[n] = t[n]);
|
|
333
|
-
return e;
|
|
334
|
-
}
|
|
335
|
-
function ht(t) {
|
|
336
|
-
return typeof t.timestamp == "function" ? t.timestamp : t.timestamp === !1 ? De : Me;
|
|
337
|
-
}
|
|
338
|
-
function ie() {
|
|
339
|
-
return {};
|
|
340
|
-
}
|
|
341
|
-
function fe(t) {
|
|
342
|
-
return t;
|
|
343
|
-
}
|
|
344
|
-
function ne() {
|
|
345
|
-
}
|
|
346
|
-
function De() {
|
|
347
|
-
return !1;
|
|
348
|
-
}
|
|
349
|
-
function Me() {
|
|
350
|
-
return Date.now();
|
|
351
|
-
}
|
|
352
|
-
function ft() {
|
|
353
|
-
return Math.round(Date.now() / 1e3);
|
|
354
|
-
}
|
|
355
|
-
function dt() {
|
|
356
|
-
return new Date(Date.now()).toISOString();
|
|
357
|
-
}
|
|
358
|
-
function mt() {
|
|
359
|
-
function t(e) {
|
|
360
|
-
return typeof e < "u" && e;
|
|
361
|
-
}
|
|
144
|
+
var s = typeof window !== t ? window.log : void 0;
|
|
145
|
+
return f.noConflict = function() {
|
|
146
|
+
return typeof window !== t && window.log === f && (window.log = s), f;
|
|
147
|
+
}, f.getLoggers = function() {
|
|
148
|
+
return v;
|
|
149
|
+
}, f.default = f, f;
|
|
150
|
+
});
|
|
151
|
+
})(ye);
|
|
152
|
+
var Te = ye.exports;
|
|
153
|
+
const Oe = /* @__PURE__ */ Ae(Te), be = {
|
|
154
|
+
trace: "trace",
|
|
155
|
+
debug: "debug",
|
|
156
|
+
info: "info",
|
|
157
|
+
warn: "warn",
|
|
158
|
+
error: "error",
|
|
159
|
+
silent: "silent"
|
|
160
|
+
}, je = {
|
|
161
|
+
0: "trace",
|
|
162
|
+
1: "debug",
|
|
163
|
+
2: "info",
|
|
164
|
+
3: "warn",
|
|
165
|
+
4: "error",
|
|
166
|
+
5: "silent"
|
|
167
|
+
};
|
|
168
|
+
function ae() {
|
|
169
|
+
var n, e;
|
|
170
|
+
if (typeof process < "u")
|
|
171
|
+
return process.env.NODE_ENV === "production" || process.env.MODE === "production";
|
|
362
172
|
try {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
}), globalThis;
|
|
173
|
+
const t = globalThis;
|
|
174
|
+
if ((e = (n = t.import) == null ? void 0 : n.meta) != null && e.env) {
|
|
175
|
+
const r = t.import.meta.env;
|
|
176
|
+
return r.MODE === "production" || r.PROD === !0;
|
|
177
|
+
}
|
|
369
178
|
} catch {
|
|
370
|
-
return t(self) || t(window) || t(this) || {};
|
|
371
179
|
}
|
|
180
|
+
return !1;
|
|
372
181
|
}
|
|
373
|
-
|
|
374
|
-
ue.exports.pino = K;
|
|
375
|
-
var gt = ue.exports;
|
|
376
|
-
const se = /* @__PURE__ */ Ge(gt);
|
|
377
|
-
function ce() {
|
|
378
|
-
return typeof process < "u" && process.env.NODE_ENV === "production";
|
|
379
|
-
}
|
|
380
|
-
function pt() {
|
|
381
|
-
var t;
|
|
382
|
-
return typeof process < "u" && ((t = process.versions) == null ? void 0 : t.node) !== void 0;
|
|
383
|
-
}
|
|
384
|
-
function vt() {
|
|
385
|
-
return typeof window < "u" && typeof document < "u";
|
|
386
|
-
}
|
|
387
|
-
const de = {
|
|
182
|
+
const ee = {
|
|
388
183
|
name: "WSX",
|
|
389
|
-
level:
|
|
390
|
-
pretty: !
|
|
184
|
+
level: ae() ? "info" : "debug",
|
|
185
|
+
pretty: !ae()
|
|
391
186
|
};
|
|
392
|
-
function
|
|
393
|
-
const { name: e, level:
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
};
|
|
398
|
-
if (vt() && (l.browser = {
|
|
399
|
-
asObject: !1,
|
|
400
|
-
// Use console methods directly (default behavior)
|
|
401
|
-
write: void 0,
|
|
402
|
-
// Use default console write
|
|
403
|
-
...(s == null ? void 0 : s.browser) || {}
|
|
404
|
-
// Allow override via pinoOptions
|
|
405
|
-
}), r && pt() && !ce())
|
|
406
|
-
try {
|
|
407
|
-
return se(
|
|
408
|
-
l,
|
|
409
|
-
se.transport({
|
|
410
|
-
target: "pino-pretty",
|
|
411
|
-
options: {
|
|
412
|
-
colorize: !0,
|
|
413
|
-
translateTime: "HH:MM:ss.l",
|
|
414
|
-
ignore: "pid,hostname",
|
|
415
|
-
singleLine: !1
|
|
416
|
-
}
|
|
417
|
-
})
|
|
418
|
-
);
|
|
419
|
-
} catch {
|
|
420
|
-
return console.warn("[wsx-logger] pino-pretty not available, using default formatter"), se(l);
|
|
421
|
-
}
|
|
422
|
-
return se(l);
|
|
187
|
+
function Me(n = {}) {
|
|
188
|
+
const { name: e, level: t } = { ...ee, ...n }, r = e || ee.name, g = Oe.getLogger(r), v = t || ee.level;
|
|
189
|
+
return g.setLevel(be[v]), g;
|
|
190
|
+
}
|
|
191
|
+
function X(n, e) {
|
|
192
|
+
return n ? `[${n}] ${e}` : e;
|
|
423
193
|
}
|
|
424
|
-
class
|
|
194
|
+
class we {
|
|
425
195
|
constructor(e = {}) {
|
|
426
|
-
this.isProd =
|
|
196
|
+
this.isProd = ae(), this.name = e.name || ee.name, this.currentLevel = e.level || ee.level, this.logInstance = Me(e);
|
|
427
197
|
}
|
|
428
|
-
debug(e, ...
|
|
429
|
-
this.isProd ||
|
|
198
|
+
debug(e, ...t) {
|
|
199
|
+
if (!this.isProd || this.shouldLog("debug")) {
|
|
200
|
+
const r = X(this.name, e);
|
|
201
|
+
t.length > 0 ? this.logInstance.debug(r, ...t) : this.logInstance.debug(r);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
info(e, ...t) {
|
|
205
|
+
if (this.shouldLog("info")) {
|
|
206
|
+
const r = X(this.name, e);
|
|
207
|
+
t.length > 0 ? this.logInstance.info(r, ...t) : this.logInstance.info(r);
|
|
208
|
+
}
|
|
430
209
|
}
|
|
431
|
-
|
|
432
|
-
|
|
210
|
+
warn(e, ...t) {
|
|
211
|
+
const r = X(this.name, e);
|
|
212
|
+
t.length > 0 ? this.logInstance.warn(r, ...t) : this.logInstance.warn(r);
|
|
433
213
|
}
|
|
434
|
-
|
|
435
|
-
|
|
214
|
+
error(e, ...t) {
|
|
215
|
+
const r = X(this.name, e);
|
|
216
|
+
t.length > 0 ? this.logInstance.error(r, ...t) : this.logInstance.error(r);
|
|
436
217
|
}
|
|
437
|
-
|
|
438
|
-
|
|
218
|
+
fatal(e, ...t) {
|
|
219
|
+
const r = X(this.name, e);
|
|
220
|
+
t.length > 0 ? this.logInstance.error(`[FATAL] ${r}`, ...t) : this.logInstance.error(`[FATAL] ${r}`);
|
|
439
221
|
}
|
|
440
|
-
|
|
441
|
-
|
|
222
|
+
trace(e, ...t) {
|
|
223
|
+
if (!this.isProd || this.shouldLog("trace")) {
|
|
224
|
+
const r = X(this.name, e);
|
|
225
|
+
t.length > 0 ? this.logInstance.trace(r, ...t) : this.logInstance.trace(r);
|
|
226
|
+
}
|
|
442
227
|
}
|
|
443
|
-
|
|
444
|
-
|
|
228
|
+
/**
|
|
229
|
+
* Check if a log level should be logged based on current level
|
|
230
|
+
*/
|
|
231
|
+
shouldLog(e) {
|
|
232
|
+
const t = ["trace", "debug", "info", "warn", "error", "silent"], r = t.indexOf(this.currentLevel);
|
|
233
|
+
return t.indexOf(e) >= r;
|
|
445
234
|
}
|
|
446
235
|
/**
|
|
447
|
-
* Get the underlying
|
|
236
|
+
* Get the underlying loglevel logger instance
|
|
448
237
|
*/
|
|
449
|
-
|
|
450
|
-
return this.
|
|
238
|
+
getLoglevelLogger() {
|
|
239
|
+
return this.logInstance;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Set the log level dynamically
|
|
243
|
+
*/
|
|
244
|
+
setLevel(e) {
|
|
245
|
+
this.currentLevel = e, this.logInstance.setLevel(be[e]);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Get the current log level
|
|
249
|
+
*/
|
|
250
|
+
getLevel() {
|
|
251
|
+
const e = this.logInstance.getLevel();
|
|
252
|
+
return je[e] || this.currentLevel;
|
|
451
253
|
}
|
|
452
254
|
}
|
|
453
|
-
new
|
|
454
|
-
function
|
|
455
|
-
return new
|
|
255
|
+
new we();
|
|
256
|
+
function ie(n, e = {}) {
|
|
257
|
+
return new we({
|
|
456
258
|
...e,
|
|
457
|
-
name: e.name || `WSX:${
|
|
259
|
+
name: e.name || `WSX:${n}`
|
|
458
260
|
});
|
|
459
261
|
}
|
|
460
|
-
const
|
|
262
|
+
const De = ie("RouterUtils"), Y = class Y {
|
|
461
263
|
/**
|
|
462
264
|
* 设置当前路由信息(由 WsxRouter 内部调用)
|
|
463
265
|
* @internal
|
|
464
266
|
*/
|
|
465
267
|
static _setCurrentRoute(e) {
|
|
466
|
-
|
|
268
|
+
Y._currentRoute = e;
|
|
467
269
|
}
|
|
468
270
|
/**
|
|
469
271
|
* 编程式导航
|
|
470
272
|
*/
|
|
471
|
-
static navigate(e,
|
|
472
|
-
|
|
273
|
+
static navigate(e, t = !1) {
|
|
274
|
+
t ? window.history.replaceState(null, "", e) : window.history.pushState(null, "", e), window.dispatchEvent(new PopStateEvent("popstate")), De.debug(`Navigated to: ${e} (replace: ${t})`);
|
|
473
275
|
}
|
|
474
276
|
/**
|
|
475
277
|
* 获取当前路由信息
|
|
@@ -477,8 +279,8 @@ const yt = he("RouterUtils"), te = class te {
|
|
|
477
279
|
* 否则返回基础路由信息(参数为空对象)
|
|
478
280
|
*/
|
|
479
281
|
static getCurrentRoute() {
|
|
480
|
-
if (
|
|
481
|
-
return
|
|
282
|
+
if (Y._currentRoute)
|
|
283
|
+
return Y._currentRoute;
|
|
482
284
|
const e = new URL(window.location.href);
|
|
483
285
|
return {
|
|
484
286
|
path: e.pathname,
|
|
@@ -491,9 +293,9 @@ const yt = he("RouterUtils"), te = class te {
|
|
|
491
293
|
/**
|
|
492
294
|
* 解析路由路径,提取参数
|
|
493
295
|
*/
|
|
494
|
-
static parseRoute(e,
|
|
296
|
+
static parseRoute(e, t) {
|
|
495
297
|
var r;
|
|
496
|
-
if (e ===
|
|
298
|
+
if (e === t)
|
|
497
299
|
return {
|
|
498
300
|
route: e,
|
|
499
301
|
params: {},
|
|
@@ -506,21 +308,21 @@ const yt = he("RouterUtils"), te = class te {
|
|
|
506
308
|
exact: !1
|
|
507
309
|
};
|
|
508
310
|
if (e.includes(":")) {
|
|
509
|
-
const
|
|
510
|
-
if (
|
|
511
|
-
const
|
|
512
|
-
return
|
|
513
|
-
|
|
311
|
+
const g = ((r = e.match(/:([^/]+)/g)) == null ? void 0 : r.map((b) => b.slice(1))) || [], v = e.replace(/:[^/]+/g, "([^/]+)"), f = new RegExp(`^${v}$`), _ = t.match(f);
|
|
312
|
+
if (_ && g.length > 0) {
|
|
313
|
+
const b = {};
|
|
314
|
+
return g.forEach((T, O) => {
|
|
315
|
+
b[T] = _[O + 1];
|
|
514
316
|
}), {
|
|
515
317
|
route: e,
|
|
516
|
-
params:
|
|
318
|
+
params: b,
|
|
517
319
|
exact: !0
|
|
518
320
|
};
|
|
519
321
|
}
|
|
520
322
|
}
|
|
521
323
|
if (e.endsWith("/*")) {
|
|
522
|
-
const
|
|
523
|
-
if (
|
|
324
|
+
const g = e.slice(0, -2);
|
|
325
|
+
if (t.startsWith(g))
|
|
524
326
|
return {
|
|
525
327
|
route: e,
|
|
526
328
|
params: {},
|
|
@@ -532,37 +334,37 @@ const yt = he("RouterUtils"), te = class te {
|
|
|
532
334
|
/**
|
|
533
335
|
* 构建路由路径,替换参数
|
|
534
336
|
*/
|
|
535
|
-
static buildPath(e,
|
|
337
|
+
static buildPath(e, t = {}) {
|
|
536
338
|
let r = e;
|
|
537
|
-
return Object.entries(
|
|
538
|
-
r = r.replace(`:${
|
|
339
|
+
return Object.entries(t).forEach(([g, v]) => {
|
|
340
|
+
r = r.replace(`:${g}`, encodeURIComponent(v));
|
|
539
341
|
}), r;
|
|
540
342
|
}
|
|
541
343
|
/**
|
|
542
344
|
* 检查路由是否匹配当前路径
|
|
543
345
|
*/
|
|
544
|
-
static isRouteActive(e,
|
|
346
|
+
static isRouteActive(e, t = !1) {
|
|
545
347
|
const r = window.location.pathname;
|
|
546
|
-
return
|
|
348
|
+
return t ? r === e : e === "/" ? r === "/" : r.startsWith(e);
|
|
547
349
|
}
|
|
548
350
|
/**
|
|
549
351
|
* 获取路由层级
|
|
550
352
|
*/
|
|
551
353
|
static getRouteDepth(e) {
|
|
552
|
-
return e.split("/").filter((
|
|
354
|
+
return e.split("/").filter((t) => t.length > 0).length;
|
|
553
355
|
}
|
|
554
356
|
/**
|
|
555
357
|
* 获取父级路由
|
|
556
358
|
*/
|
|
557
359
|
static getParentRoute(e) {
|
|
558
|
-
const
|
|
559
|
-
return
|
|
360
|
+
const t = e.split("/").filter((r) => r.length > 0);
|
|
361
|
+
return t.length <= 1 ? "/" : (t.pop(), "/" + t.join("/"));
|
|
560
362
|
}
|
|
561
363
|
/**
|
|
562
364
|
* 合并路由路径
|
|
563
365
|
*/
|
|
564
366
|
static joinPaths(...e) {
|
|
565
|
-
return e.map((
|
|
367
|
+
return e.map((t) => t.replace(/^\/+|\/+$/g, "")).filter((t) => t.length > 0).join("/").replace(/^/, "/");
|
|
566
368
|
}
|
|
567
369
|
/**
|
|
568
370
|
* 检查是否为外部链接
|
|
@@ -579,20 +381,20 @@ const yt = he("RouterUtils"), te = class te {
|
|
|
579
381
|
/**
|
|
580
382
|
* 设置查询参数
|
|
581
383
|
*/
|
|
582
|
-
static setQueryParam(e,
|
|
583
|
-
const
|
|
584
|
-
|
|
585
|
-
const
|
|
586
|
-
this.navigate(
|
|
384
|
+
static setQueryParam(e, t, r = !1) {
|
|
385
|
+
const g = new URL(window.location.href);
|
|
386
|
+
g.searchParams.set(e, t);
|
|
387
|
+
const v = g.pathname + g.search + g.hash;
|
|
388
|
+
this.navigate(v, r);
|
|
587
389
|
}
|
|
588
390
|
/**
|
|
589
391
|
* 删除查询参数
|
|
590
392
|
*/
|
|
591
|
-
static removeQueryParam(e,
|
|
393
|
+
static removeQueryParam(e, t = !1) {
|
|
592
394
|
const r = new URL(window.location.href);
|
|
593
395
|
r.searchParams.delete(e);
|
|
594
|
-
const
|
|
595
|
-
this.navigate(
|
|
396
|
+
const g = r.pathname + r.search + r.hash;
|
|
397
|
+
this.navigate(g, t);
|
|
596
398
|
}
|
|
597
399
|
/**
|
|
598
400
|
* 返回上一页
|
|
@@ -630,151 +432,151 @@ const yt = he("RouterUtils"), te = class te {
|
|
|
630
432
|
* @see RFC-0035: 路由导航竞态条件修复
|
|
631
433
|
*/
|
|
632
434
|
static onRouteChange(e) {
|
|
633
|
-
const
|
|
435
|
+
const t = () => {
|
|
634
436
|
const r = this.getCurrentRoute();
|
|
635
437
|
e(r);
|
|
636
438
|
};
|
|
637
|
-
return document.addEventListener("route-changed",
|
|
638
|
-
document.removeEventListener("route-changed",
|
|
439
|
+
return document.addEventListener("route-changed", t), () => {
|
|
440
|
+
document.removeEventListener("route-changed", t);
|
|
639
441
|
};
|
|
640
442
|
}
|
|
641
443
|
};
|
|
642
|
-
|
|
643
|
-
let
|
|
644
|
-
const
|
|
645
|
-
var
|
|
646
|
-
let
|
|
647
|
-
function
|
|
648
|
-
return (e =
|
|
444
|
+
Y._currentRoute = null;
|
|
445
|
+
let ne = Y;
|
|
446
|
+
const ue = ":host{display:grid;width:100%}.router-outlet{width:100%}:host>wsx-view{grid-area:1 / 1}";
|
|
447
|
+
var Le;
|
|
448
|
+
let Re, xe;
|
|
449
|
+
function F(n, e, t) {
|
|
450
|
+
return (e = Ee(e)) in n ? Object.defineProperty(n, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = t, n;
|
|
649
451
|
}
|
|
650
|
-
function
|
|
651
|
-
function
|
|
652
|
-
return function(
|
|
653
|
-
return
|
|
452
|
+
function Pe(n, e, t, r, g, v) {
|
|
453
|
+
function f(s, o, c) {
|
|
454
|
+
return function(i, u) {
|
|
455
|
+
return c && c(i), s[o].call(i, u);
|
|
654
456
|
};
|
|
655
457
|
}
|
|
656
|
-
function
|
|
657
|
-
for (var
|
|
658
|
-
return c;
|
|
659
|
-
}
|
|
660
|
-
function u(o, c, f, h) {
|
|
661
|
-
if (typeof o != "function" && (h || o !== void 0)) throw new TypeError(c + " must " + (f || "be") + " a function" + (h ? "" : " or undefined"));
|
|
458
|
+
function _(s, o) {
|
|
459
|
+
for (var c = 0; c < s.length; c++) s[c].call(o);
|
|
662
460
|
return o;
|
|
663
461
|
}
|
|
664
|
-
function
|
|
665
|
-
function
|
|
666
|
-
|
|
462
|
+
function b(s, o, c, i) {
|
|
463
|
+
if (typeof s != "function" && (i || s !== void 0)) throw new TypeError(o + " must " + (c || "be") + " a function" + (i ? "" : " or undefined"));
|
|
464
|
+
return s;
|
|
465
|
+
}
|
|
466
|
+
function T(s, o, c, i, u, A, k, R, P, E, L, p, m) {
|
|
467
|
+
function h(d) {
|
|
468
|
+
if (!m(d)) throw new TypeError("Attempted to access private element on non-instance");
|
|
667
469
|
}
|
|
668
|
-
var
|
|
669
|
-
if (!
|
|
670
|
-
|
|
671
|
-
var a = {},
|
|
672
|
-
|
|
673
|
-
return
|
|
674
|
-
},
|
|
675
|
-
|
|
676
|
-
} } : a[
|
|
470
|
+
var l, x = o[0], C = o[3], W = !R;
|
|
471
|
+
if (!W) {
|
|
472
|
+
c || Array.isArray(x) || (x = [x]);
|
|
473
|
+
var a = {}, I = [], w = u === 3 ? "get" : u === 4 || p ? "set" : "value";
|
|
474
|
+
E ? (L || p ? a = { get: he(function() {
|
|
475
|
+
return C(this);
|
|
476
|
+
}, i, "get"), set: function(d) {
|
|
477
|
+
o[4](this, d);
|
|
478
|
+
} } : a[w] = C, L || he(a[w], i, u === 2 ? "" : w)) : L || (a = Object.getOwnPropertyDescriptor(s, i));
|
|
677
479
|
}
|
|
678
|
-
for (var
|
|
679
|
-
var
|
|
680
|
-
if (
|
|
681
|
-
|
|
682
|
-
}).bind(null,
|
|
480
|
+
for (var y = s, U = x.length - 1; U >= 0; U -= c ? 2 : 1) {
|
|
481
|
+
var B = x[U], G = c ? x[U - 1] : void 0, K = {}, j = { kind: ["field", "accessor", "method", "getter", "setter", "class"][u], name: i, metadata: A, addInitializer: (function(d, S) {
|
|
482
|
+
if (d.v) throw Error("attempted to call addInitializer after decoration was finished");
|
|
483
|
+
b(S, "An initializer", "be", !0), k.push(S);
|
|
484
|
+
}).bind(null, K) };
|
|
683
485
|
try {
|
|
684
|
-
if (
|
|
486
|
+
if (W) (l = b(B.call(G, y, j), "class decorators", "return")) && (y = l);
|
|
685
487
|
else {
|
|
686
|
-
var M,
|
|
687
|
-
|
|
688
|
-
return
|
|
689
|
-
} : (
|
|
690
|
-
return
|
|
691
|
-
}, (
|
|
692
|
-
|
|
488
|
+
var M, z;
|
|
489
|
+
j.static = P, j.private = E, E ? u === 2 ? M = function(d) {
|
|
490
|
+
return h(d), a.value;
|
|
491
|
+
} : (u < 4 && (M = f(a, "get", h)), u !== 3 && (z = f(a, "set", h))) : (M = function(d) {
|
|
492
|
+
return d[i];
|
|
493
|
+
}, (u < 2 || u === 4) && (z = function(d, S) {
|
|
494
|
+
d[i] = S;
|
|
693
495
|
}));
|
|
694
|
-
var
|
|
695
|
-
return
|
|
496
|
+
var J = j.access = { has: E ? m.bind() : function(d) {
|
|
497
|
+
return i in d;
|
|
696
498
|
} };
|
|
697
|
-
if (M && (
|
|
698
|
-
if (typeof
|
|
699
|
-
else if (
|
|
700
|
-
} else
|
|
499
|
+
if (M && (J.get = M), z && (J.set = z), y = B.call(G, p ? { get: a.get, set: a.set } : a[w], j), p) {
|
|
500
|
+
if (typeof y == "object" && y) (l = b(y.get, "accessor.get")) && (a.get = l), (l = b(y.set, "accessor.set")) && (a.set = l), (l = b(y.init, "accessor.init")) && I.push(l);
|
|
501
|
+
else if (y !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
502
|
+
} else b(y, (L ? "field" : "method") + " decorators", "return") && (L ? I.push(y) : a[w] = y);
|
|
701
503
|
}
|
|
702
504
|
} finally {
|
|
703
|
-
|
|
505
|
+
K.v = !0;
|
|
704
506
|
}
|
|
705
507
|
}
|
|
706
|
-
return (
|
|
707
|
-
for (var
|
|
708
|
-
return
|
|
709
|
-
}),
|
|
710
|
-
}
|
|
711
|
-
function
|
|
712
|
-
return Object.defineProperty(
|
|
713
|
-
}
|
|
714
|
-
if (arguments.length >= 6) var
|
|
715
|
-
var
|
|
716
|
-
var
|
|
717
|
-
return
|
|
718
|
-
},
|
|
719
|
-
function
|
|
720
|
-
|
|
508
|
+
return (L || p) && R.push(function(d, S) {
|
|
509
|
+
for (var N = I.length - 1; N >= 0; N--) S = I[N].call(d, S);
|
|
510
|
+
return S;
|
|
511
|
+
}), L || W || (E ? p ? R.push(f(a, "get"), f(a, "set")) : R.push(u === 2 ? a[w] : f.call.bind(a[w])) : Object.defineProperty(s, i, a)), y;
|
|
512
|
+
}
|
|
513
|
+
function O(s, o) {
|
|
514
|
+
return Object.defineProperty(s, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: o });
|
|
515
|
+
}
|
|
516
|
+
if (arguments.length >= 6) var V = v[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
517
|
+
var D = Object.create(V ?? null), H = function(s, o, c, i) {
|
|
518
|
+
var u, A, k = [], R = function(w) {
|
|
519
|
+
return Ue(w) === s;
|
|
520
|
+
}, P = /* @__PURE__ */ new Map();
|
|
521
|
+
function E(w) {
|
|
522
|
+
w && k.push(_.bind(null, w));
|
|
721
523
|
}
|
|
722
|
-
for (var
|
|
723
|
-
var
|
|
724
|
-
if (Array.isArray(
|
|
725
|
-
var
|
|
726
|
-
if (!
|
|
727
|
-
var
|
|
728
|
-
if (
|
|
729
|
-
|
|
524
|
+
for (var L = 0; L < o.length; L++) {
|
|
525
|
+
var p = o[L];
|
|
526
|
+
if (Array.isArray(p)) {
|
|
527
|
+
var m = p[1], h = p[2], l = p.length > 3, x = 16 & m, C = !!(8 & m), W = (m &= 7) == 0, a = h + "/" + C;
|
|
528
|
+
if (!W && !l) {
|
|
529
|
+
var I = P.get(a);
|
|
530
|
+
if (I === !0 || I === 3 && m !== 4 || I === 4 && m !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h);
|
|
531
|
+
P.set(a, !(m > 2) || m);
|
|
730
532
|
}
|
|
731
|
-
|
|
533
|
+
T(C ? s : s.prototype, p, x, l ? "#" + h : Ee(h), m, i, C ? A = A || [] : u = u || [], k, C, l, W, m === 1, C && l ? R : c);
|
|
732
534
|
}
|
|
733
535
|
}
|
|
734
|
-
return
|
|
735
|
-
}(
|
|
736
|
-
return
|
|
737
|
-
var
|
|
738
|
-
return
|
|
536
|
+
return E(u), E(A), k;
|
|
537
|
+
}(n, e, g, D);
|
|
538
|
+
return t.length || O(n, D), { e: H, get c() {
|
|
539
|
+
var s = [];
|
|
540
|
+
return t.length && [O(T(n, [t], r, n.name, 5, D, s), D), _.bind(null, s, n)];
|
|
739
541
|
} };
|
|
740
542
|
}
|
|
741
|
-
function
|
|
742
|
-
var e =
|
|
543
|
+
function Ee(n) {
|
|
544
|
+
var e = Ve(n, "string");
|
|
743
545
|
return typeof e == "symbol" ? e : e + "";
|
|
744
546
|
}
|
|
745
|
-
function
|
|
746
|
-
if (typeof
|
|
747
|
-
var
|
|
748
|
-
if (
|
|
749
|
-
var r =
|
|
547
|
+
function Ve(n, e) {
|
|
548
|
+
if (typeof n != "object" || !n) return n;
|
|
549
|
+
var t = n[Symbol.toPrimitive];
|
|
550
|
+
if (t !== void 0) {
|
|
551
|
+
var r = t.call(n, e);
|
|
750
552
|
if (typeof r != "object") return r;
|
|
751
553
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
752
554
|
}
|
|
753
|
-
return String(
|
|
555
|
+
return String(n);
|
|
754
556
|
}
|
|
755
|
-
function
|
|
557
|
+
function he(n, e, t) {
|
|
756
558
|
typeof e == "symbol" && (e = (e = e.description) ? "[" + e + "]" : "");
|
|
757
559
|
try {
|
|
758
|
-
Object.defineProperty(
|
|
560
|
+
Object.defineProperty(n, "name", { configurable: !0, value: t ? t + " " + e : e });
|
|
759
561
|
} catch {
|
|
760
562
|
}
|
|
761
|
-
return
|
|
563
|
+
return n;
|
|
762
564
|
}
|
|
763
|
-
function
|
|
764
|
-
if (Object(
|
|
765
|
-
return
|
|
565
|
+
function Ue(n) {
|
|
566
|
+
if (Object(n) !== n) throw TypeError("right-hand side of 'in' should be an object, got " + (n !== null ? typeof n : "null"));
|
|
567
|
+
return n;
|
|
766
568
|
}
|
|
767
|
-
const $ =
|
|
768
|
-
|
|
569
|
+
const $ = ie("WsxRouter");
|
|
570
|
+
xe = [ce({
|
|
769
571
|
tagName: "wsx-router"
|
|
770
572
|
})];
|
|
771
|
-
let
|
|
772
|
-
class
|
|
573
|
+
let ze;
|
|
574
|
+
class Ne extends re {
|
|
773
575
|
constructor() {
|
|
774
576
|
super({
|
|
775
|
-
styles:
|
|
577
|
+
styles: ue,
|
|
776
578
|
styleName: "wsx-router"
|
|
777
|
-
}),
|
|
579
|
+
}), F(this, "_autoStyles", ue), F(this, "views", /* @__PURE__ */ new Map()), F(this, "currentView", null), F(this, "currentPath", ""), F(this, "isHandlingRoute", !1), F(this, "compiledRoutes", /* @__PURE__ */ new Map()), F(this, "matchCache", /* @__PURE__ */ new Map()), F(this, "enableViewTransitions", !0), F(this, "scrollRestoration", "manual"), F(this, "handleRouteChange", () => {
|
|
778
580
|
if (this.isHandlingRoute) {
|
|
779
581
|
$.debug("Route change already in progress, skipping");
|
|
780
582
|
return;
|
|
@@ -783,7 +585,7 @@ class Lt extends oe {
|
|
|
783
585
|
try {
|
|
784
586
|
const e = window.location.pathname;
|
|
785
587
|
$.debug(`WsxRouter: Route changed to: ${e}`);
|
|
786
|
-
const
|
|
588
|
+
const t = new CustomEvent("before-navigate", {
|
|
787
589
|
detail: {
|
|
788
590
|
to: e,
|
|
789
591
|
from: this.currentPath
|
|
@@ -791,7 +593,7 @@ class Lt extends oe {
|
|
|
791
593
|
bubbles: !0,
|
|
792
594
|
cancelable: !0
|
|
793
595
|
});
|
|
794
|
-
if (!this.dispatchEvent(
|
|
596
|
+
if (!this.dispatchEvent(t)) {
|
|
795
597
|
$.debug(`Navigation to ${e} was cancelled`);
|
|
796
598
|
return;
|
|
797
599
|
}
|
|
@@ -801,15 +603,15 @@ class Lt extends oe {
|
|
|
801
603
|
this.isHandlingRoute = !1;
|
|
802
604
|
});
|
|
803
605
|
}
|
|
804
|
-
}),
|
|
805
|
-
const
|
|
806
|
-
if (!
|
|
807
|
-
const r =
|
|
606
|
+
}), F(this, "interceptLinks", (e) => {
|
|
607
|
+
const t = e.target.closest("a");
|
|
608
|
+
if (!t) return;
|
|
609
|
+
const r = t.getAttribute("href");
|
|
808
610
|
!r || r.startsWith("http") || r.startsWith("#") || (e.preventDefault(), this.navigate(r));
|
|
809
611
|
});
|
|
810
612
|
}
|
|
811
613
|
render() {
|
|
812
|
-
return /* @__PURE__ */
|
|
614
|
+
return /* @__PURE__ */ te("div", { class: "router-outlet" });
|
|
813
615
|
}
|
|
814
616
|
onRendered() {
|
|
815
617
|
this.views.size === 0 && (this.collectViews(), $.debug("WsxRouter collected views in onRendered:", this.views.size)), this.views.size > 0 && !this.currentView && requestAnimationFrame(() => {
|
|
@@ -827,61 +629,61 @@ class Lt extends oe {
|
|
|
827
629
|
window.removeEventListener("popstate", this.handleRouteChange);
|
|
828
630
|
}
|
|
829
631
|
collectViews() {
|
|
830
|
-
const e = Array.from(this.children).filter((
|
|
831
|
-
$.debug(`WsxRouter found ${e.length} views`), this.views.clear(), this.compiledRoutes.clear(), this.matchCache.clear(), e.forEach((
|
|
832
|
-
const r =
|
|
833
|
-
if (this.views.set(r,
|
|
834
|
-
const
|
|
835
|
-
this.compiledRoutes.set(r,
|
|
632
|
+
const e = Array.from(this.children).filter((t) => t.tagName.toLowerCase() === "wsx-view");
|
|
633
|
+
$.debug(`WsxRouter found ${e.length} views`), this.views.clear(), this.compiledRoutes.clear(), this.matchCache.clear(), e.forEach((t) => {
|
|
634
|
+
const r = t.getAttribute("route") || "/";
|
|
635
|
+
if (this.views.set(r, t), $.debug(`WsxRouter registered route: ${r}`), r.includes(":")) {
|
|
636
|
+
const g = r.replace(/:[^/]+/g, "([^/]+)"), v = new RegExp(`^${g}$`);
|
|
637
|
+
this.compiledRoutes.set(r, v), $.debug(`WsxRouter compiled regex for route: ${r} -> ${v}`);
|
|
836
638
|
}
|
|
837
|
-
|
|
639
|
+
t.style.display = "none";
|
|
838
640
|
});
|
|
839
641
|
}
|
|
840
642
|
/**
|
|
841
643
|
* RFC 0033: 执行导航(带 View Transitions 支持)
|
|
842
644
|
*/
|
|
843
645
|
performNavigation(e) {
|
|
844
|
-
const
|
|
646
|
+
const t = () => {
|
|
845
647
|
const r = this.matchRoute(e);
|
|
846
648
|
if (r) {
|
|
847
649
|
r.style.display = "block", r.style.visibility = "visible";
|
|
848
|
-
const
|
|
849
|
-
$.debug(`Showing view for route: ${
|
|
850
|
-
for (const [
|
|
851
|
-
|
|
650
|
+
const g = r.getAttribute("route") || "/";
|
|
651
|
+
$.debug(`Showing view for route: ${g}`);
|
|
652
|
+
for (const [O, V] of this.views)
|
|
653
|
+
V !== r && (V.style.display = "none", V.style.visibility = "");
|
|
852
654
|
this.currentView = r;
|
|
853
|
-
const
|
|
854
|
-
$.debug(`Extracted params for route ${
|
|
855
|
-
r.setAttribute("params", JSON.stringify(
|
|
655
|
+
const v = this.extractParams(g, e);
|
|
656
|
+
$.debug(`Extracted params for route ${g} and path ${e}:`, v), v && requestAnimationFrame(() => {
|
|
657
|
+
r.setAttribute("params", JSON.stringify(v)), $.debug(`Set params attribute on view: ${JSON.stringify(v)}`);
|
|
856
658
|
});
|
|
857
|
-
const
|
|
659
|
+
const f = window.location.href || `${window.location.pathname}${window.location.search}${window.location.hash}`, _ = new URL(f, window.location.origin || "http://localhost"), b = {
|
|
858
660
|
path: e,
|
|
859
|
-
params:
|
|
860
|
-
query: Object.fromEntries(
|
|
861
|
-
hash:
|
|
661
|
+
params: v || {},
|
|
662
|
+
query: Object.fromEntries(_.searchParams.entries()),
|
|
663
|
+
hash: _.hash.slice(1)
|
|
862
664
|
};
|
|
863
|
-
|
|
864
|
-
const
|
|
865
|
-
detail:
|
|
665
|
+
ne._setCurrentRoute(b), $.debug("Updated RouterUtils._currentRoute:", b);
|
|
666
|
+
const T = new CustomEvent("route-changed", {
|
|
667
|
+
detail: b,
|
|
866
668
|
bubbles: !0
|
|
867
669
|
});
|
|
868
|
-
document.dispatchEvent(
|
|
670
|
+
document.dispatchEvent(T);
|
|
869
671
|
} else {
|
|
870
|
-
for (const [
|
|
871
|
-
|
|
672
|
+
for (const [b, T] of this.views)
|
|
673
|
+
T.style.display = "none";
|
|
872
674
|
this.currentView = null, $.warn(`No view found for path: ${e}`);
|
|
873
|
-
const
|
|
675
|
+
const g = window.location.href || `${window.location.pathname}${window.location.search}${window.location.hash}`, v = new URL(g, window.location.origin || "http://localhost"), f = {
|
|
874
676
|
path: e,
|
|
875
677
|
params: {},
|
|
876
|
-
query: Object.fromEntries(
|
|
877
|
-
hash:
|
|
678
|
+
query: Object.fromEntries(v.searchParams.entries()),
|
|
679
|
+
hash: v.hash.slice(1)
|
|
878
680
|
};
|
|
879
|
-
|
|
880
|
-
const
|
|
881
|
-
detail:
|
|
681
|
+
ne._setCurrentRoute(f);
|
|
682
|
+
const _ = new CustomEvent("route-changed", {
|
|
683
|
+
detail: f,
|
|
882
684
|
bubbles: !0
|
|
883
685
|
});
|
|
884
|
-
document.dispatchEvent(
|
|
686
|
+
document.dispatchEvent(_);
|
|
885
687
|
}
|
|
886
688
|
this.handleScrollRestoration(e), this.dispatchEvent(new CustomEvent("after-navigate", {
|
|
887
689
|
detail: {
|
|
@@ -891,7 +693,7 @@ class Lt extends oe {
|
|
|
891
693
|
bubbles: !0
|
|
892
694
|
})), this.currentPath = e;
|
|
893
695
|
};
|
|
894
|
-
this.enableViewTransitions && "startViewTransition" in document ? document.startViewTransition(
|
|
696
|
+
this.enableViewTransitions && "startViewTransition" in document ? document.startViewTransition(t) : t();
|
|
895
697
|
}
|
|
896
698
|
/**
|
|
897
699
|
* RFC 0033: 滚动恢复处理
|
|
@@ -914,28 +716,28 @@ class Lt extends oe {
|
|
|
914
716
|
if (this.views.has(e))
|
|
915
717
|
return this.matchCache.set(e, e), $.warn(`matchRoute: exact match found for ${e}`), this.views.get(e);
|
|
916
718
|
$.warn(`matchRoute: checking parameter routes, compiledRoutes count: ${this.compiledRoutes.size}`);
|
|
917
|
-
for (const [r,
|
|
719
|
+
for (const [r, g] of this.views)
|
|
918
720
|
if (r.includes(":")) {
|
|
919
|
-
const
|
|
920
|
-
if (
|
|
921
|
-
const
|
|
922
|
-
if ($.warn(`matchRoute: testing route ${r} against ${e}, matches: ${
|
|
923
|
-
return this.matchCache.set(e, r), $.warn(`matchRoute: parameter match found, route: ${r}, path: ${e}`),
|
|
721
|
+
const v = this.compiledRoutes.get(r);
|
|
722
|
+
if (v) {
|
|
723
|
+
const f = v.test(e);
|
|
724
|
+
if ($.warn(`matchRoute: testing route ${r} against ${e}, matches: ${f}`), f)
|
|
725
|
+
return this.matchCache.set(e, r), $.warn(`matchRoute: parameter match found, route: ${r}, path: ${e}`), g;
|
|
924
726
|
} else
|
|
925
727
|
$.warn(`matchRoute: route ${r} has ':' but no compiled regex found`);
|
|
926
728
|
}
|
|
927
|
-
const
|
|
928
|
-
return
|
|
729
|
+
const t = this.views.get("*") || null;
|
|
730
|
+
return t ? (this.matchCache.set(e, "*"), $.warn(`matchRoute: wildcard match found for ${e}`)) : $.warn(`matchRoute: no match found for ${e}, no wildcard view available`), t;
|
|
929
731
|
}
|
|
930
|
-
extractParams(e,
|
|
931
|
-
var
|
|
732
|
+
extractParams(e, t) {
|
|
733
|
+
var b;
|
|
932
734
|
if (!e.includes(":")) return null;
|
|
933
|
-
const r = ((
|
|
934
|
-
if (!
|
|
935
|
-
const
|
|
936
|
-
return r.forEach((
|
|
937
|
-
|
|
938
|
-
}),
|
|
735
|
+
const r = ((b = e.match(/:([^/]+)/g)) == null ? void 0 : b.map((T) => T.slice(1))) || [], g = e.replace(/:[^/]+/g, "([^/]+)"), v = new RegExp(`^${g}$`), f = t.match(v);
|
|
736
|
+
if (!f || !r.length) return null;
|
|
737
|
+
const _ = {};
|
|
738
|
+
return r.forEach((T, O) => {
|
|
739
|
+
_[T] = f[O + 1];
|
|
740
|
+
}), _;
|
|
939
741
|
}
|
|
940
742
|
/**
|
|
941
743
|
* RFC 0032: 清除匹配缓存
|
|
@@ -963,404 +765,385 @@ class Lt extends oe {
|
|
|
963
765
|
window.history.pushState(null, "", e), this.handleRouteChange();
|
|
964
766
|
}
|
|
965
767
|
}
|
|
966
|
-
|
|
967
|
-
[
|
|
968
|
-
|
|
969
|
-
const
|
|
970
|
-
var
|
|
971
|
-
let
|
|
972
|
-
function
|
|
973
|
-
return (e =
|
|
768
|
+
Le = Ne;
|
|
769
|
+
[ze, Re] = Pe(Le, [], xe, 0, void 0, re).c;
|
|
770
|
+
Re();
|
|
771
|
+
const Fe = ":host{display:block;width:100%;height:100%}.route-view{width:100%;height:100%;position:relative}:host([loading]) .route-view{opacity:.5;transition:opacity .3s ease}:host([error]) .route-view{border:1px solid var(--error-color, #ff0000);padding:1rem}.route-view.entering{animation:fadeIn .3s ease-out}.route-view.leaving{animation:fadeOut .3s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}";
|
|
772
|
+
var Ce;
|
|
773
|
+
let $e, _e;
|
|
774
|
+
function Z(n, e, t) {
|
|
775
|
+
return (e = Ie(e)) in n ? Object.defineProperty(n, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = t, n;
|
|
974
776
|
}
|
|
975
|
-
function
|
|
976
|
-
function
|
|
977
|
-
return function(
|
|
978
|
-
return
|
|
777
|
+
function qe(n, e, t, r, g, v) {
|
|
778
|
+
function f(s, o, c) {
|
|
779
|
+
return function(i, u) {
|
|
780
|
+
return c && c(i), s[o].call(i, u);
|
|
979
781
|
};
|
|
980
782
|
}
|
|
981
|
-
function
|
|
982
|
-
for (var
|
|
983
|
-
return c;
|
|
984
|
-
}
|
|
985
|
-
function u(o, c, f, h) {
|
|
986
|
-
if (typeof o != "function" && (h || o !== void 0)) throw new TypeError(c + " must " + (f || "be") + " a function" + (h ? "" : " or undefined"));
|
|
783
|
+
function _(s, o) {
|
|
784
|
+
for (var c = 0; c < s.length; c++) s[c].call(o);
|
|
987
785
|
return o;
|
|
988
786
|
}
|
|
989
|
-
function
|
|
990
|
-
function
|
|
991
|
-
|
|
787
|
+
function b(s, o, c, i) {
|
|
788
|
+
if (typeof s != "function" && (i || s !== void 0)) throw new TypeError(o + " must " + (c || "be") + " a function" + (i ? "" : " or undefined"));
|
|
789
|
+
return s;
|
|
790
|
+
}
|
|
791
|
+
function T(s, o, c, i, u, A, k, R, P, E, L, p, m) {
|
|
792
|
+
function h(d) {
|
|
793
|
+
if (!m(d)) throw new TypeError("Attempted to access private element on non-instance");
|
|
992
794
|
}
|
|
993
|
-
var
|
|
994
|
-
if (!
|
|
995
|
-
|
|
996
|
-
var a = {},
|
|
997
|
-
|
|
998
|
-
return
|
|
999
|
-
},
|
|
1000
|
-
|
|
1001
|
-
} } : a[
|
|
795
|
+
var l, x = o[0], C = o[3], W = !R;
|
|
796
|
+
if (!W) {
|
|
797
|
+
c || Array.isArray(x) || (x = [x]);
|
|
798
|
+
var a = {}, I = [], w = u === 3 ? "get" : u === 4 || p ? "set" : "value";
|
|
799
|
+
E ? (L || p ? a = { get: fe(function() {
|
|
800
|
+
return C(this);
|
|
801
|
+
}, i, "get"), set: function(d) {
|
|
802
|
+
o[4](this, d);
|
|
803
|
+
} } : a[w] = C, L || fe(a[w], i, u === 2 ? "" : w)) : L || (a = Object.getOwnPropertyDescriptor(s, i));
|
|
1002
804
|
}
|
|
1003
|
-
for (var
|
|
1004
|
-
var
|
|
1005
|
-
if (
|
|
1006
|
-
|
|
1007
|
-
}).bind(null,
|
|
805
|
+
for (var y = s, U = x.length - 1; U >= 0; U -= c ? 2 : 1) {
|
|
806
|
+
var B = x[U], G = c ? x[U - 1] : void 0, K = {}, j = { kind: ["field", "accessor", "method", "getter", "setter", "class"][u], name: i, metadata: A, addInitializer: (function(d, S) {
|
|
807
|
+
if (d.v) throw Error("attempted to call addInitializer after decoration was finished");
|
|
808
|
+
b(S, "An initializer", "be", !0), k.push(S);
|
|
809
|
+
}).bind(null, K) };
|
|
1008
810
|
try {
|
|
1009
|
-
if (
|
|
811
|
+
if (W) (l = b(B.call(G, y, j), "class decorators", "return")) && (y = l);
|
|
1010
812
|
else {
|
|
1011
|
-
var M,
|
|
1012
|
-
|
|
1013
|
-
return
|
|
1014
|
-
} : (
|
|
1015
|
-
return
|
|
1016
|
-
}, (
|
|
1017
|
-
|
|
813
|
+
var M, z;
|
|
814
|
+
j.static = P, j.private = E, E ? u === 2 ? M = function(d) {
|
|
815
|
+
return h(d), a.value;
|
|
816
|
+
} : (u < 4 && (M = f(a, "get", h)), u !== 3 && (z = f(a, "set", h))) : (M = function(d) {
|
|
817
|
+
return d[i];
|
|
818
|
+
}, (u < 2 || u === 4) && (z = function(d, S) {
|
|
819
|
+
d[i] = S;
|
|
1018
820
|
}));
|
|
1019
|
-
var
|
|
1020
|
-
return
|
|
821
|
+
var J = j.access = { has: E ? m.bind() : function(d) {
|
|
822
|
+
return i in d;
|
|
1021
823
|
} };
|
|
1022
|
-
if (M && (
|
|
1023
|
-
if (typeof
|
|
1024
|
-
else if (
|
|
1025
|
-
} else
|
|
824
|
+
if (M && (J.get = M), z && (J.set = z), y = B.call(G, p ? { get: a.get, set: a.set } : a[w], j), p) {
|
|
825
|
+
if (typeof y == "object" && y) (l = b(y.get, "accessor.get")) && (a.get = l), (l = b(y.set, "accessor.set")) && (a.set = l), (l = b(y.init, "accessor.init")) && I.push(l);
|
|
826
|
+
else if (y !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
827
|
+
} else b(y, (L ? "field" : "method") + " decorators", "return") && (L ? I.push(y) : a[w] = y);
|
|
1026
828
|
}
|
|
1027
829
|
} finally {
|
|
1028
|
-
|
|
830
|
+
K.v = !0;
|
|
1029
831
|
}
|
|
1030
832
|
}
|
|
1031
|
-
return (
|
|
1032
|
-
for (var
|
|
1033
|
-
return
|
|
1034
|
-
}),
|
|
1035
|
-
}
|
|
1036
|
-
function
|
|
1037
|
-
return Object.defineProperty(
|
|
1038
|
-
}
|
|
1039
|
-
if (arguments.length >= 6) var
|
|
1040
|
-
var
|
|
1041
|
-
var
|
|
1042
|
-
return
|
|
1043
|
-
},
|
|
1044
|
-
function
|
|
1045
|
-
|
|
833
|
+
return (L || p) && R.push(function(d, S) {
|
|
834
|
+
for (var N = I.length - 1; N >= 0; N--) S = I[N].call(d, S);
|
|
835
|
+
return S;
|
|
836
|
+
}), L || W || (E ? p ? R.push(f(a, "get"), f(a, "set")) : R.push(u === 2 ? a[w] : f.call.bind(a[w])) : Object.defineProperty(s, i, a)), y;
|
|
837
|
+
}
|
|
838
|
+
function O(s, o) {
|
|
839
|
+
return Object.defineProperty(s, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: o });
|
|
840
|
+
}
|
|
841
|
+
if (arguments.length >= 6) var V = v[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
842
|
+
var D = Object.create(V ?? null), H = function(s, o, c, i) {
|
|
843
|
+
var u, A, k = [], R = function(w) {
|
|
844
|
+
return Be(w) === s;
|
|
845
|
+
}, P = /* @__PURE__ */ new Map();
|
|
846
|
+
function E(w) {
|
|
847
|
+
w && k.push(_.bind(null, w));
|
|
1046
848
|
}
|
|
1047
|
-
for (var
|
|
1048
|
-
var
|
|
1049
|
-
if (Array.isArray(
|
|
1050
|
-
var
|
|
1051
|
-
if (!
|
|
1052
|
-
var
|
|
1053
|
-
if (
|
|
1054
|
-
|
|
849
|
+
for (var L = 0; L < o.length; L++) {
|
|
850
|
+
var p = o[L];
|
|
851
|
+
if (Array.isArray(p)) {
|
|
852
|
+
var m = p[1], h = p[2], l = p.length > 3, x = 16 & m, C = !!(8 & m), W = (m &= 7) == 0, a = h + "/" + C;
|
|
853
|
+
if (!W && !l) {
|
|
854
|
+
var I = P.get(a);
|
|
855
|
+
if (I === !0 || I === 3 && m !== 4 || I === 4 && m !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h);
|
|
856
|
+
P.set(a, !(m > 2) || m);
|
|
1055
857
|
}
|
|
1056
|
-
|
|
858
|
+
T(C ? s : s.prototype, p, x, l ? "#" + h : Ie(h), m, i, C ? A = A || [] : u = u || [], k, C, l, W, m === 1, C && l ? R : c);
|
|
1057
859
|
}
|
|
1058
860
|
}
|
|
1059
|
-
return
|
|
1060
|
-
}(
|
|
1061
|
-
return
|
|
1062
|
-
var
|
|
1063
|
-
return
|
|
861
|
+
return E(u), E(A), k;
|
|
862
|
+
}(n, e, g, D);
|
|
863
|
+
return t.length || O(n, D), { e: H, get c() {
|
|
864
|
+
var s = [];
|
|
865
|
+
return t.length && [O(T(n, [t], r, n.name, 5, D, s), D), _.bind(null, s, n)];
|
|
1064
866
|
} };
|
|
1065
867
|
}
|
|
1066
|
-
function
|
|
1067
|
-
var e =
|
|
868
|
+
function Ie(n) {
|
|
869
|
+
var e = He(n, "string");
|
|
1068
870
|
return typeof e == "symbol" ? e : e + "";
|
|
1069
871
|
}
|
|
1070
|
-
function
|
|
1071
|
-
if (typeof
|
|
1072
|
-
var
|
|
1073
|
-
if (
|
|
1074
|
-
var r =
|
|
872
|
+
function He(n, e) {
|
|
873
|
+
if (typeof n != "object" || !n) return n;
|
|
874
|
+
var t = n[Symbol.toPrimitive];
|
|
875
|
+
if (t !== void 0) {
|
|
876
|
+
var r = t.call(n, e);
|
|
1075
877
|
if (typeof r != "object") return r;
|
|
1076
878
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1077
879
|
}
|
|
1078
|
-
return
|
|
880
|
+
return String(n);
|
|
1079
881
|
}
|
|
1080
|
-
function
|
|
882
|
+
function fe(n, e, t) {
|
|
1081
883
|
typeof e == "symbol" && (e = (e = e.description) ? "[" + e + "]" : "");
|
|
1082
884
|
try {
|
|
1083
|
-
Object.defineProperty(
|
|
885
|
+
Object.defineProperty(n, "name", { configurable: !0, value: t ? t + " " + e : e });
|
|
1084
886
|
} catch {
|
|
1085
887
|
}
|
|
1086
|
-
return
|
|
1087
|
-
}
|
|
1088
|
-
function $t(t) {
|
|
1089
|
-
if (Object(t) !== t) throw TypeError("right-hand side of 'in' should be an object, got " + (t !== null ? typeof t : "null"));
|
|
1090
|
-
return t;
|
|
888
|
+
return n;
|
|
1091
889
|
}
|
|
1092
|
-
function
|
|
1093
|
-
|
|
890
|
+
function Be(n) {
|
|
891
|
+
if (Object(n) !== n) throw TypeError("right-hand side of 'in' should be an object, got " + (n !== null ? typeof n : "null"));
|
|
892
|
+
return n;
|
|
1094
893
|
}
|
|
1095
|
-
const
|
|
1096
|
-
|
|
894
|
+
const q = ie("WsxView");
|
|
895
|
+
_e = [ce({
|
|
1097
896
|
tagName: "wsx-view"
|
|
1098
897
|
})];
|
|
1099
|
-
let
|
|
1100
|
-
|
|
1101
|
-
// 防止重复加载的标志
|
|
898
|
+
let Ge;
|
|
899
|
+
class Ke extends re {
|
|
1102
900
|
constructor() {
|
|
1103
|
-
super(
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
901
|
+
super(), Z(this, "_autoStyles", Fe), Z(this, "_component", ""), Z(this, "params", void 0), Z(this, "componentInstance", null), Z(this, "isLoading", !1);
|
|
902
|
+
let e = this.reactive({});
|
|
903
|
+
Object.defineProperty(this, "params", {
|
|
904
|
+
get: () => e,
|
|
905
|
+
set: (t) => {
|
|
906
|
+
e = t !== null && typeof t < "u" && (Array.isArray(t) || typeof t == "object") ? this.reactive(t) : t, this.scheduleRerender();
|
|
907
|
+
},
|
|
908
|
+
enumerable: !0,
|
|
909
|
+
configurable: !0
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
get component() {
|
|
913
|
+
return this._component;
|
|
1107
914
|
}
|
|
915
|
+
set component(e) {
|
|
916
|
+
this._component = e || "", this._component && requestAnimationFrame(() => {
|
|
917
|
+
this.connected && !this.componentInstance && !this.isLoading && this.loadComponent(this._component || "");
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
// 防止重复加载的标志
|
|
1108
921
|
render() {
|
|
1109
|
-
return /* @__PURE__ */
|
|
922
|
+
return /* @__PURE__ */ te("div", { class: "route-view" });
|
|
1110
923
|
}
|
|
1111
924
|
onConnected() {
|
|
1112
925
|
requestAnimationFrame(() => {
|
|
1113
|
-
|
|
1114
|
-
return;
|
|
1115
|
-
const e = this.getAttribute("component");
|
|
1116
|
-
e && this.loadComponent(e);
|
|
926
|
+
!this.connected || this.isLoading || this.componentInstance || this.component && this.loadComponent(this.component);
|
|
1117
927
|
});
|
|
1118
928
|
}
|
|
1119
|
-
onAttributeChanged(e, n, r) {
|
|
1120
|
-
if (this.connected) {
|
|
1121
|
-
if (e === "component" && r && !this.componentInstance && !this.isLoading)
|
|
1122
|
-
requestAnimationFrame(() => {
|
|
1123
|
-
this.connected && !this.componentInstance && !this.isLoading && this.loadComponent(r);
|
|
1124
|
-
});
|
|
1125
|
-
else if (e === "params" && this.componentInstance)
|
|
1126
|
-
try {
|
|
1127
|
-
this.params = JSON.parse(r), N.debug("WsxView: params attribute changed, setting on component:", this.params), Object.entries(this.params).forEach(([s, l]) => {
|
|
1128
|
-
this.componentInstance.setAttribute(s, l);
|
|
1129
|
-
}), N.debug(`WsxView: params set on component ${this.componentInstance.tagName}`);
|
|
1130
|
-
} catch (s) {
|
|
1131
|
-
N.warn("Failed to parse params:", s);
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
929
|
async loadComponent(e) {
|
|
1136
|
-
if (!this.connected || this.isLoading || this.componentInstance) {
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
const n = this.componentInstance;
|
|
1143
|
-
if (n && (n.remove(), this.componentInstance = null), !customElements.get(e)) {
|
|
1144
|
-
N.warn(`Component ${e} not found in customElements registry`), this.isLoading = !1;
|
|
1145
|
-
return;
|
|
1146
|
-
}
|
|
1147
|
-
N.warn(`WsxView: Creating instance of ${e}`), this.componentInstance = document.createElement(e), Object.keys(this.params).length > 0 && (N.warn(`WsxView: Setting initial params on ${e}:`, this.params), Object.entries(this.params).forEach(([l, m]) => {
|
|
1148
|
-
this.componentInstance.setAttribute(l, m);
|
|
1149
|
-
}));
|
|
1150
|
-
const s = this.querySelector(".route-view");
|
|
1151
|
-
if (s) {
|
|
1152
|
-
if (N.warn(`WsxView: Appending ${e} to container`), !customElements.get(e)) {
|
|
1153
|
-
N.error(`WsxView: Component ${e} is not registered in customElements registry!`), this.isLoading = !1, this.componentInstance = null;
|
|
930
|
+
if (!(!this.connected || this.isLoading || this.componentInstance)) {
|
|
931
|
+
this.isLoading = !0;
|
|
932
|
+
try {
|
|
933
|
+
const t = this.componentInstance;
|
|
934
|
+
if (t && (t.remove(), this.componentInstance = null), !customElements.get(e)) {
|
|
935
|
+
q.warn(`Component ${e} not found in customElements registry`), this.isLoading = !1;
|
|
1154
936
|
return;
|
|
1155
937
|
}
|
|
1156
|
-
|
|
1157
|
-
this.componentInstance
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
938
|
+
q.warn(`WsxView: Creating instance of ${e}`), this.componentInstance = document.createElement(e), Object.keys(this.params).length > 0 && (q.warn(`WsxView: Setting initial params on ${e}:`, this.params), Object.entries(this.params).forEach(([v, f]) => {
|
|
939
|
+
this.componentInstance.setAttribute(v, f);
|
|
940
|
+
}));
|
|
941
|
+
const g = this.querySelector(".route-view");
|
|
942
|
+
if (g) {
|
|
943
|
+
if (q.warn(`WsxView: Appending ${e} to container`), !customElements.get(e)) {
|
|
944
|
+
q.error(`WsxView: Component ${e} is not registered in customElements registry!`), this.isLoading = !1, this.componentInstance = null;
|
|
945
|
+
return;
|
|
946
|
+
}
|
|
947
|
+
g.appendChild(this.componentInstance), q.warn(`WsxView: Component ${e} appended successfully, waiting for connectedCallback...`), setTimeout(() => {
|
|
948
|
+
this.componentInstance && this.componentInstance.isConnected ? q.warn(`WsxView: Component ${e} is now connected to DOM`) : q.error(`WsxView: Component ${e} was not connected to DOM!`);
|
|
949
|
+
}, 0);
|
|
950
|
+
} else
|
|
951
|
+
q.error("WsxView: Route view container not found"), this.componentInstance = null;
|
|
952
|
+
} catch (t) {
|
|
953
|
+
q.warn(`Error loading component ${e}:`, t), this.componentInstance = null;
|
|
954
|
+
} finally {
|
|
955
|
+
this.isLoading = !1, q.warn(`WsxView: loadComponent for ${e} completed, isLoading=${this.isLoading}`);
|
|
956
|
+
}
|
|
1165
957
|
}
|
|
1166
958
|
}
|
|
1167
959
|
onDisconnected() {
|
|
1168
960
|
this.componentInstance && (this.componentInstance.remove(), this.componentInstance = null);
|
|
1169
961
|
}
|
|
1170
|
-
}, [ze, Oe] = kt(ge, [], Be, 0, void 0, oe).c, ge), me = class extends jt {
|
|
1171
|
-
constructor() {
|
|
1172
|
-
super(ze), ee(this, "observedAttributes", ["route", "component", "params"]), Oe();
|
|
1173
|
-
}
|
|
1174
|
-
}, ee(me, Se, void 0), me)();
|
|
1175
|
-
const Ct = ':host{display:inline-block;min-width:fit-content;min-height:fit-content;width:auto;height:auto}.wsx-link{color:var(--link-color, #007bff);text-decoration:var(--link-decoration, underline);cursor:pointer;transition:color .2s ease;display:inline-block;min-height:1.2em;line-height:1.2}.wsx-link:hover{color:var(--link-hover-color, #0056b3);text-decoration:var(--link-hover-decoration, underline)}.wsx-link:focus{outline:2px solid var(--link-focus-color, var(--focus-color, #dc2626));outline-offset:2px}.wsx-link.active{color:var(--link-active-color, #6c757d);font-weight:var(--link-active-weight, bold)}:host([disabled]) .wsx-link{color:var(--link-disabled-color, #6c757d);cursor:not-allowed;pointer-events:none}:host([external]) .wsx-link:after{content:"↗";font-size:.8em;margin-left:.2em;opacity:.7}:host([variant="button"]) .wsx-link{background-color:var(--button-bg, #007bff);color:var(--button-color, white);padding:.5rem 1rem;border-radius:.25rem;text-decoration:none;display:inline-block}:host([variant="button"]) .wsx-link:hover{background-color:var(--button-hover-bg, #0056b3);color:var(--button-hover-color, white)}:host([variant="tab"]) .wsx-link{padding:.5rem 1rem;border-bottom:2px solid transparent;text-decoration:none}:host([variant="tab"]) .wsx-link.active{border-bottom-color:var(--tab-active-border, #007bff)}';
|
|
1176
|
-
var pe, ve;
|
|
1177
|
-
let Ae, Je, Te;
|
|
1178
|
-
function B(t, e, n) {
|
|
1179
|
-
return (e = Qe(e)) in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
|
|
1180
962
|
}
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
963
|
+
Ce = Ke;
|
|
964
|
+
[Ge, $e] = qe(Ce, [], _e, 0, void 0, re).c;
|
|
965
|
+
$e();
|
|
966
|
+
const Je = ':host{display:inline-block;min-width:fit-content;min-height:fit-content;width:auto;height:auto}.wsx-link{color:var(--link-color, #007bff);text-decoration:var(--link-decoration, underline);cursor:pointer;transition:color .2s ease;display:inline-block;min-height:1.2em;line-height:1.2}.wsx-link:hover{color:var(--link-hover-color, #0056b3);text-decoration:var(--link-hover-decoration, underline)}.wsx-link:focus{outline:2px solid var(--link-focus-color, var(--focus-color, #dc2626));outline-offset:2px}.wsx-link.active{color:var(--link-active-color, #6c757d);font-weight:var(--link-active-weight, bold)}:host([disabled]) .wsx-link{color:var(--link-disabled-color, #6c757d);cursor:not-allowed;pointer-events:none}:host([external]) .wsx-link:after{content:"↗";font-size:.8em;margin-left:.2em;opacity:.7}:host([variant="button"]) .wsx-link{background-color:var(--button-bg, #007bff);color:var(--button-color, white);padding:.5rem 1rem;border-radius:.25rem;text-decoration:none;display:inline-block}:host([variant="button"]) .wsx-link:hover{background-color:var(--button-hover-bg, #0056b3);color:var(--button-hover-color, white)}:host([variant="tab"]) .wsx-link{padding:.5rem 1rem;border-bottom:2px solid transparent;text-decoration:none}:host([variant="tab"]) .wsx-link.active{border-bottom-color:var(--tab-active-border, #007bff)}';
|
|
967
|
+
var oe, se;
|
|
968
|
+
let de, Se, ge;
|
|
969
|
+
function Q(n, e, t) {
|
|
970
|
+
return (e = ke(e)) in n ? Object.defineProperty(n, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : n[e] = t, n;
|
|
971
|
+
}
|
|
972
|
+
function Qe(n, e, t, r, g, v) {
|
|
973
|
+
function f(s, o, c) {
|
|
974
|
+
return function(i, u) {
|
|
975
|
+
return c && c(i), s[o].call(i, u);
|
|
1185
976
|
};
|
|
1186
977
|
}
|
|
1187
|
-
function
|
|
1188
|
-
for (var
|
|
1189
|
-
return c;
|
|
1190
|
-
}
|
|
1191
|
-
function u(o, c, f, h) {
|
|
1192
|
-
if (typeof o != "function" && (h || o !== void 0)) throw new TypeError(c + " must " + (f || "be") + " a function" + (h ? "" : " or undefined"));
|
|
978
|
+
function _(s, o) {
|
|
979
|
+
for (var c = 0; c < s.length; c++) s[c].call(o);
|
|
1193
980
|
return o;
|
|
1194
981
|
}
|
|
1195
|
-
function
|
|
1196
|
-
function
|
|
1197
|
-
|
|
982
|
+
function b(s, o, c, i) {
|
|
983
|
+
if (typeof s != "function" && (i || s !== void 0)) throw new TypeError(o + " must " + (c || "be") + " a function" + (i ? "" : " or undefined"));
|
|
984
|
+
return s;
|
|
985
|
+
}
|
|
986
|
+
function T(s, o, c, i, u, A, k, R, P, E, L, p, m) {
|
|
987
|
+
function h(d) {
|
|
988
|
+
if (!m(d)) throw new TypeError("Attempted to access private element on non-instance");
|
|
1198
989
|
}
|
|
1199
|
-
var
|
|
1200
|
-
if (!
|
|
1201
|
-
|
|
1202
|
-
var a = {},
|
|
1203
|
-
|
|
1204
|
-
return
|
|
1205
|
-
},
|
|
1206
|
-
|
|
1207
|
-
} } : a[
|
|
990
|
+
var l, x = o[0], C = o[3], W = !R;
|
|
991
|
+
if (!W) {
|
|
992
|
+
c || Array.isArray(x) || (x = [x]);
|
|
993
|
+
var a = {}, I = [], w = u === 3 ? "get" : u === 4 || p ? "set" : "value";
|
|
994
|
+
E ? (L || p ? a = { get: pe(function() {
|
|
995
|
+
return C(this);
|
|
996
|
+
}, i, "get"), set: function(d) {
|
|
997
|
+
o[4](this, d);
|
|
998
|
+
} } : a[w] = C, L || pe(a[w], i, u === 2 ? "" : w)) : L || (a = Object.getOwnPropertyDescriptor(s, i));
|
|
1208
999
|
}
|
|
1209
|
-
for (var
|
|
1210
|
-
var
|
|
1211
|
-
if (
|
|
1212
|
-
|
|
1213
|
-
}).bind(null,
|
|
1000
|
+
for (var y = s, U = x.length - 1; U >= 0; U -= c ? 2 : 1) {
|
|
1001
|
+
var B = x[U], G = c ? x[U - 1] : void 0, K = {}, j = { kind: ["field", "accessor", "method", "getter", "setter", "class"][u], name: i, metadata: A, addInitializer: (function(d, S) {
|
|
1002
|
+
if (d.v) throw Error("attempted to call addInitializer after decoration was finished");
|
|
1003
|
+
b(S, "An initializer", "be", !0), k.push(S);
|
|
1004
|
+
}).bind(null, K) };
|
|
1214
1005
|
try {
|
|
1215
|
-
if (
|
|
1006
|
+
if (W) (l = b(B.call(G, y, j), "class decorators", "return")) && (y = l);
|
|
1216
1007
|
else {
|
|
1217
|
-
var M,
|
|
1218
|
-
|
|
1219
|
-
return
|
|
1220
|
-
} : (
|
|
1221
|
-
return
|
|
1222
|
-
}, (
|
|
1223
|
-
|
|
1008
|
+
var M, z;
|
|
1009
|
+
j.static = P, j.private = E, E ? u === 2 ? M = function(d) {
|
|
1010
|
+
return h(d), a.value;
|
|
1011
|
+
} : (u < 4 && (M = f(a, "get", h)), u !== 3 && (z = f(a, "set", h))) : (M = function(d) {
|
|
1012
|
+
return d[i];
|
|
1013
|
+
}, (u < 2 || u === 4) && (z = function(d, S) {
|
|
1014
|
+
d[i] = S;
|
|
1224
1015
|
}));
|
|
1225
|
-
var
|
|
1226
|
-
return
|
|
1016
|
+
var J = j.access = { has: E ? m.bind() : function(d) {
|
|
1017
|
+
return i in d;
|
|
1227
1018
|
} };
|
|
1228
|
-
if (M && (
|
|
1229
|
-
if (typeof
|
|
1230
|
-
else if (
|
|
1231
|
-
} else
|
|
1019
|
+
if (M && (J.get = M), z && (J.set = z), y = B.call(G, p ? { get: a.get, set: a.set } : a[w], j), p) {
|
|
1020
|
+
if (typeof y == "object" && y) (l = b(y.get, "accessor.get")) && (a.get = l), (l = b(y.set, "accessor.set")) && (a.set = l), (l = b(y.init, "accessor.init")) && I.push(l);
|
|
1021
|
+
else if (y !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
1022
|
+
} else b(y, (L ? "field" : "method") + " decorators", "return") && (L ? I.push(y) : a[w] = y);
|
|
1232
1023
|
}
|
|
1233
1024
|
} finally {
|
|
1234
|
-
|
|
1025
|
+
K.v = !0;
|
|
1235
1026
|
}
|
|
1236
1027
|
}
|
|
1237
|
-
return (
|
|
1238
|
-
for (var
|
|
1239
|
-
return
|
|
1240
|
-
}),
|
|
1241
|
-
}
|
|
1242
|
-
function
|
|
1243
|
-
return Object.defineProperty(
|
|
1244
|
-
}
|
|
1245
|
-
if (arguments.length >= 6) var
|
|
1246
|
-
var
|
|
1247
|
-
var
|
|
1248
|
-
return
|
|
1249
|
-
},
|
|
1250
|
-
function
|
|
1251
|
-
|
|
1028
|
+
return (L || p) && R.push(function(d, S) {
|
|
1029
|
+
for (var N = I.length - 1; N >= 0; N--) S = I[N].call(d, S);
|
|
1030
|
+
return S;
|
|
1031
|
+
}), L || W || (E ? p ? R.push(f(a, "get"), f(a, "set")) : R.push(u === 2 ? a[w] : f.call.bind(a[w])) : Object.defineProperty(s, i, a)), y;
|
|
1032
|
+
}
|
|
1033
|
+
function O(s, o) {
|
|
1034
|
+
return Object.defineProperty(s, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: o });
|
|
1035
|
+
}
|
|
1036
|
+
if (arguments.length >= 6) var V = v[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
1037
|
+
var D = Object.create(V ?? null), H = function(s, o, c, i) {
|
|
1038
|
+
var u, A, k = [], R = function(w) {
|
|
1039
|
+
return Ye(w) === s;
|
|
1040
|
+
}, P = /* @__PURE__ */ new Map();
|
|
1041
|
+
function E(w) {
|
|
1042
|
+
w && k.push(_.bind(null, w));
|
|
1252
1043
|
}
|
|
1253
|
-
for (var
|
|
1254
|
-
var
|
|
1255
|
-
if (Array.isArray(
|
|
1256
|
-
var
|
|
1257
|
-
if (!
|
|
1258
|
-
var
|
|
1259
|
-
if (
|
|
1260
|
-
|
|
1044
|
+
for (var L = 0; L < o.length; L++) {
|
|
1045
|
+
var p = o[L];
|
|
1046
|
+
if (Array.isArray(p)) {
|
|
1047
|
+
var m = p[1], h = p[2], l = p.length > 3, x = 16 & m, C = !!(8 & m), W = (m &= 7) == 0, a = h + "/" + C;
|
|
1048
|
+
if (!W && !l) {
|
|
1049
|
+
var I = P.get(a);
|
|
1050
|
+
if (I === !0 || I === 3 && m !== 4 || I === 4 && m !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h);
|
|
1051
|
+
P.set(a, !(m > 2) || m);
|
|
1261
1052
|
}
|
|
1262
|
-
|
|
1053
|
+
T(C ? s : s.prototype, p, x, l ? "#" + h : ke(h), m, i, C ? A = A || [] : u = u || [], k, C, l, W, m === 1, C && l ? R : c);
|
|
1263
1054
|
}
|
|
1264
1055
|
}
|
|
1265
|
-
return
|
|
1266
|
-
}(
|
|
1267
|
-
return
|
|
1268
|
-
var
|
|
1269
|
-
return
|
|
1056
|
+
return E(u), E(A), k;
|
|
1057
|
+
}(n, e, g, D);
|
|
1058
|
+
return t.length || O(n, D), { e: H, get c() {
|
|
1059
|
+
var s = [];
|
|
1060
|
+
return t.length && [O(T(n, [t], r, n.name, 5, D, s), D), _.bind(null, s, n)];
|
|
1270
1061
|
} };
|
|
1271
1062
|
}
|
|
1272
|
-
function
|
|
1273
|
-
var e =
|
|
1063
|
+
function ke(n) {
|
|
1064
|
+
var e = Xe(n, "string");
|
|
1274
1065
|
return typeof e == "symbol" ? e : e + "";
|
|
1275
1066
|
}
|
|
1276
|
-
function
|
|
1277
|
-
if (typeof
|
|
1278
|
-
var
|
|
1279
|
-
if (
|
|
1280
|
-
var r =
|
|
1067
|
+
function Xe(n, e) {
|
|
1068
|
+
if (typeof n != "object" || !n) return n;
|
|
1069
|
+
var t = n[Symbol.toPrimitive];
|
|
1070
|
+
if (t !== void 0) {
|
|
1071
|
+
var r = t.call(n, e);
|
|
1281
1072
|
if (typeof r != "object") return r;
|
|
1282
1073
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1283
1074
|
}
|
|
1284
|
-
return (e === "string" ? String : Number)(
|
|
1075
|
+
return (e === "string" ? String : Number)(n);
|
|
1285
1076
|
}
|
|
1286
|
-
function
|
|
1077
|
+
function pe(n, e, t) {
|
|
1287
1078
|
typeof e == "symbol" && (e = (e = e.description) ? "[" + e + "]" : "");
|
|
1288
1079
|
try {
|
|
1289
|
-
Object.defineProperty(
|
|
1080
|
+
Object.defineProperty(n, "name", { configurable: !0, value: t ? t + " " + e : e });
|
|
1290
1081
|
} catch {
|
|
1291
1082
|
}
|
|
1292
|
-
return
|
|
1083
|
+
return n;
|
|
1293
1084
|
}
|
|
1294
|
-
function
|
|
1295
|
-
if (Object(
|
|
1296
|
-
return
|
|
1085
|
+
function Ye(n) {
|
|
1086
|
+
if (Object(n) !== n) throw TypeError("right-hand side of 'in' should be an object, got " + (n !== null ? typeof n : "null"));
|
|
1087
|
+
return n;
|
|
1297
1088
|
}
|
|
1298
|
-
function
|
|
1299
|
-
return
|
|
1089
|
+
function Ze(n) {
|
|
1090
|
+
return n;
|
|
1300
1091
|
}
|
|
1301
|
-
const
|
|
1302
|
-
|
|
1092
|
+
const ve = ie("WsxLink");
|
|
1093
|
+
Se = [ce({
|
|
1303
1094
|
tagName: "wsx-link"
|
|
1304
1095
|
})];
|
|
1305
|
-
let
|
|
1306
|
-
new (
|
|
1096
|
+
let me;
|
|
1097
|
+
new (ge = (se = class extends le {
|
|
1307
1098
|
constructor() {
|
|
1308
|
-
super(),
|
|
1309
|
-
if (
|
|
1310
|
-
|
|
1099
|
+
super(), Q(this, "_autoStyles", Je), Q(this, "to", void 0), Q(this, "activeClass", void 0), Q(this, "handleClick", (v) => {
|
|
1100
|
+
if (v.preventDefault(), !this.to) {
|
|
1101
|
+
ve.warn("No 'to' attribute specified");
|
|
1311
1102
|
return;
|
|
1312
1103
|
}
|
|
1313
1104
|
if (this.isExternalLink(this.to)) {
|
|
1314
1105
|
window.open(this.to, "_blank");
|
|
1315
1106
|
return;
|
|
1316
1107
|
}
|
|
1317
|
-
this.replace ? window.history.replaceState(null, "", this.to) : window.history.pushState(null, "", this.to), window.dispatchEvent(new PopStateEvent("popstate")),
|
|
1318
|
-
}),
|
|
1319
|
-
var
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1108
|
+
this.replace ? window.history.replaceState(null, "", this.to) : window.history.pushState(null, "", this.to), window.dispatchEvent(new PopStateEvent("popstate")), ve.debug(`Navigated to: ${this.to}`);
|
|
1109
|
+
}), Q(this, "updateActiveState", () => {
|
|
1110
|
+
var b;
|
|
1111
|
+
const v = window.location.pathname, f = this.exact ? v === this.to : v.startsWith(this.to) && this.to !== "/", _ = (b = this.shadowRoot) == null ? void 0 : b.querySelector("a");
|
|
1112
|
+
_ && (f ? (_.classList.add(this.activeClass), this.setAttribute("active", "")) : (_.classList.remove(this.activeClass), this.removeAttribute("active")));
|
|
1322
1113
|
});
|
|
1323
|
-
const [e,
|
|
1114
|
+
const [e, t] = this.useState("to", "");
|
|
1324
1115
|
Object.defineProperty(this, "to", {
|
|
1325
1116
|
get: e,
|
|
1326
|
-
set:
|
|
1327
|
-
enumerable: !0,
|
|
1328
|
-
configurable: !0
|
|
1329
|
-
});
|
|
1330
|
-
const [r, s] = this.useState("replace", !1);
|
|
1331
|
-
Object.defineProperty(this, "replace", {
|
|
1332
|
-
get: r,
|
|
1333
|
-
set: s,
|
|
1117
|
+
set: t,
|
|
1334
1118
|
enumerable: !0,
|
|
1335
1119
|
configurable: !0
|
|
1336
1120
|
});
|
|
1337
|
-
const [
|
|
1121
|
+
const [r, g] = this.useState("activeClass", "active");
|
|
1338
1122
|
Object.defineProperty(this, "activeClass", {
|
|
1339
|
-
get:
|
|
1340
|
-
set:
|
|
1341
|
-
enumerable: !0,
|
|
1342
|
-
configurable: !0
|
|
1343
|
-
});
|
|
1344
|
-
const [g, u] = this.useState("exact", !1);
|
|
1345
|
-
Object.defineProperty(this, "exact", {
|
|
1346
|
-
get: g,
|
|
1347
|
-
set: u,
|
|
1123
|
+
get: r,
|
|
1124
|
+
set: g,
|
|
1348
1125
|
enumerable: !0,
|
|
1349
1126
|
configurable: !0
|
|
1350
1127
|
});
|
|
1351
1128
|
}
|
|
1129
|
+
get replace() {
|
|
1130
|
+
return this.hasAttribute("replace");
|
|
1131
|
+
}
|
|
1132
|
+
get exact() {
|
|
1133
|
+
return this.hasAttribute("exact");
|
|
1134
|
+
}
|
|
1352
1135
|
render() {
|
|
1353
|
-
return /* @__PURE__ */
|
|
1136
|
+
return /* @__PURE__ */ te("a", { href: this.to, class: "wsx-link", onClick: this.handleClick, part: "link" }, /* @__PURE__ */ te("slot", null));
|
|
1354
1137
|
}
|
|
1355
1138
|
onConnected() {
|
|
1356
|
-
this.to = this.
|
|
1139
|
+
this.to = this.to || "", this.activeClass = this.activeClass || "active";
|
|
1357
1140
|
const e = this.shadowRoot.querySelector(".wsx-link");
|
|
1358
1141
|
e && (e.href = this.to), window.addEventListener("popstate", this.updateActiveState), document.addEventListener("route-changed", this.updateActiveState), this.updateActiveState();
|
|
1359
1142
|
}
|
|
1360
1143
|
onDisconnected() {
|
|
1361
1144
|
window.removeEventListener("popstate", this.updateActiveState), document.removeEventListener("route-changed", this.updateActiveState);
|
|
1362
1145
|
}
|
|
1363
|
-
onAttributeChanged(e,
|
|
1146
|
+
onAttributeChanged(e, t, r) {
|
|
1364
1147
|
switch (e) {
|
|
1365
1148
|
case "to":
|
|
1366
1149
|
this.to = r || "", this.updateActiveState();
|
|
@@ -1388,14 +1171,14 @@ new (Te = (ve = class extends Re {
|
|
|
1388
1171
|
cancelable: !0
|
|
1389
1172
|
}));
|
|
1390
1173
|
}
|
|
1391
|
-
}, [
|
|
1174
|
+
}, [me, de] = Qe(se, [], Se, 0, void 0, le).c, se), oe = class extends Ze {
|
|
1392
1175
|
constructor() {
|
|
1393
|
-
super(
|
|
1176
|
+
super(me), Q(this, "observedAttributes", ["to", "replace", "active-class", "exact"]), de();
|
|
1394
1177
|
}
|
|
1395
|
-
},
|
|
1178
|
+
}, Q(oe, ge, void 0), oe)();
|
|
1396
1179
|
export {
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1180
|
+
ne as RouterUtils,
|
|
1181
|
+
me as WsxLink,
|
|
1182
|
+
ze as WsxRouter,
|
|
1183
|
+
Ge as WsxView
|
|
1401
1184
|
};
|