@wsxjs/wsx-router 0.0.23 → 0.0.24
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 +355 -349
- package/package.json +5 -5
- package/src/WsxRouter.wsx +14 -2
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { autoRegister as ce, LightComponent as re, jsx as te, WebComponent as le } from "@wsxjs/wsx-core";
|
|
2
2
|
var We = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
3
|
-
function Ae(
|
|
4
|
-
return
|
|
3
|
+
function Ae(r) {
|
|
4
|
+
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
5
5
|
}
|
|
6
|
-
var
|
|
7
|
-
(function(
|
|
6
|
+
var we = { exports: {} };
|
|
7
|
+
(function(r) {
|
|
8
8
|
(function(e, t) {
|
|
9
|
-
|
|
9
|
+
r.exports ? r.exports = t() : e.log = t();
|
|
10
10
|
})(We, function() {
|
|
11
11
|
var e = function() {
|
|
12
|
-
}, t = "undefined",
|
|
12
|
+
}, t = "undefined", n = typeof window !== t && typeof window.navigator !== t && /Trident\/|MSIE /.test(window.navigator.userAgent), g = [
|
|
13
13
|
"trace",
|
|
14
14
|
"debug",
|
|
15
15
|
"info",
|
|
16
16
|
"warn",
|
|
17
17
|
"error"
|
|
18
|
-
],
|
|
18
|
+
], p = {}, f = null;
|
|
19
19
|
function _(o, c) {
|
|
20
20
|
var i = o[c];
|
|
21
21
|
if (typeof i.bind == "function")
|
|
@@ -28,11 +28,11 @@ var ye = { exports: {} };
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function y() {
|
|
32
32
|
console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
|
|
33
33
|
}
|
|
34
34
|
function T(o) {
|
|
35
|
-
return o === "debug" && (o = "log"), typeof console === t ? !1 : o === "trace" &&
|
|
35
|
+
return o === "debug" && (o = "log"), typeof console === t ? !1 : o === "trace" && n ? y : console[o] !== void 0 ? _(console, o) : console.log !== void 0 ? _(console, "log") : e;
|
|
36
36
|
}
|
|
37
37
|
function O() {
|
|
38
38
|
for (var o = this.getLevel(), c = 0; c < g.length; c++) {
|
|
@@ -67,7 +67,7 @@ var ye = { exports: {} };
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function C() {
|
|
71
71
|
var h;
|
|
72
72
|
if (!(typeof window === t || !L)) {
|
|
73
73
|
try {
|
|
@@ -76,9 +76,9 @@ var ye = { exports: {} };
|
|
|
76
76
|
}
|
|
77
77
|
if (typeof h === t)
|
|
78
78
|
try {
|
|
79
|
-
var l = window.document.cookie, x = encodeURIComponent(L),
|
|
80
|
-
|
|
81
|
-
l.slice(
|
|
79
|
+
var l = window.document.cookie, x = encodeURIComponent(L), $ = l.indexOf(x + "=");
|
|
80
|
+
$ !== -1 && (h = /^([^;]+)/.exec(
|
|
81
|
+
l.slice($ + x.length + 1)
|
|
82
82
|
)[1]);
|
|
83
83
|
} catch {
|
|
84
84
|
}
|
|
@@ -97,7 +97,7 @@ var ye = { exports: {} };
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function v(h) {
|
|
101
101
|
var l = h;
|
|
102
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
103
|
return l;
|
|
@@ -113,9 +113,9 @@ var ye = { exports: {} };
|
|
|
113
113
|
}, i.methodFactory = c || M, i.getLevel = function() {
|
|
114
114
|
return k ?? A ?? u;
|
|
115
115
|
}, i.setLevel = function(h, l) {
|
|
116
|
-
return k =
|
|
116
|
+
return k = v(h), l !== !1 && P(k), O.call(i);
|
|
117
117
|
}, i.setDefaultLevel = function(h) {
|
|
118
|
-
A =
|
|
118
|
+
A = v(h), C() || i.setLevel(h, !1);
|
|
119
119
|
}, i.resetLevel = function() {
|
|
120
120
|
k = null, R(), O.call(i);
|
|
121
121
|
}, i.enableAll = function(h) {
|
|
@@ -123,34 +123,34 @@ var ye = { exports: {} };
|
|
|
123
123
|
}, i.disableAll = function(h) {
|
|
124
124
|
i.setLevel(i.levels.SILENT, h);
|
|
125
125
|
}, i.rebuild = function() {
|
|
126
|
-
if (
|
|
127
|
-
for (var h in
|
|
128
|
-
|
|
129
|
-
}, u =
|
|
130
|
-
|
|
126
|
+
if (f !== i && (u = v(f.getLevel())), O.call(i), f === i)
|
|
127
|
+
for (var h in p)
|
|
128
|
+
p[h].rebuild();
|
|
129
|
+
}, u = v(
|
|
130
|
+
f ? f.getLevel() : "WARN"
|
|
131
131
|
);
|
|
132
|
-
var m =
|
|
133
|
-
m != null && (k =
|
|
132
|
+
var m = C();
|
|
133
|
+
m != null && (k = v(m)), O.call(i);
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
f = new H(), f.getLogger = function(c) {
|
|
136
136
|
if (typeof c != "symbol" && typeof c != "string" || c === "")
|
|
137
137
|
throw new TypeError("You must supply a name when creating a logger.");
|
|
138
|
-
var i =
|
|
139
|
-
return i || (i =
|
|
138
|
+
var i = p[c];
|
|
139
|
+
return i || (i = p[c] = new H(
|
|
140
140
|
c,
|
|
141
|
-
|
|
141
|
+
f.methodFactory
|
|
142
142
|
)), i;
|
|
143
143
|
};
|
|
144
144
|
var s = typeof window !== t ? window.log : void 0;
|
|
145
|
-
return
|
|
146
|
-
return typeof window !== t && window.log ===
|
|
147
|
-
},
|
|
148
|
-
return
|
|
149
|
-
},
|
|
145
|
+
return f.noConflict = function() {
|
|
146
|
+
return typeof window !== t && window.log === f && (window.log = s), f;
|
|
147
|
+
}, f.getLoggers = function() {
|
|
148
|
+
return p;
|
|
149
|
+
}, f.default = f, f;
|
|
150
150
|
});
|
|
151
|
-
})(
|
|
152
|
-
var Te =
|
|
153
|
-
const Oe = /* @__PURE__ */ Ae(Te),
|
|
151
|
+
})(we);
|
|
152
|
+
var Te = we.exports;
|
|
153
|
+
const Oe = /* @__PURE__ */ Ae(Te), ye = {
|
|
154
154
|
trace: "trace",
|
|
155
155
|
debug: "debug",
|
|
156
156
|
info: "info",
|
|
@@ -166,14 +166,14 @@ const Oe = /* @__PURE__ */ Ae(Te), be = {
|
|
|
166
166
|
5: "silent"
|
|
167
167
|
};
|
|
168
168
|
function ae() {
|
|
169
|
-
var
|
|
169
|
+
var r, e;
|
|
170
170
|
if (typeof process < "u")
|
|
171
171
|
return process.env.NODE_ENV === "production" || process.env.MODE === "production";
|
|
172
172
|
try {
|
|
173
173
|
const t = globalThis;
|
|
174
|
-
if ((e = (
|
|
175
|
-
const
|
|
176
|
-
return
|
|
174
|
+
if ((e = (r = t.import) == null ? void 0 : r.meta) != null && e.env) {
|
|
175
|
+
const n = t.import.meta.env;
|
|
176
|
+
return n.MODE === "production" || n.PROD === !0;
|
|
177
177
|
}
|
|
178
178
|
} catch {
|
|
179
179
|
}
|
|
@@ -184,53 +184,53 @@ const ee = {
|
|
|
184
184
|
level: ae() ? "info" : "debug",
|
|
185
185
|
pretty: !ae()
|
|
186
186
|
};
|
|
187
|
-
function De(
|
|
188
|
-
const { name: e, level: t } = { ...ee, ...
|
|
189
|
-
return g.setLevel(
|
|
187
|
+
function De(r = {}) {
|
|
188
|
+
const { name: e, level: t } = { ...ee, ...r }, n = e || ee.name, g = Oe.getLogger(n), p = t || ee.level;
|
|
189
|
+
return g.setLevel(ye[p]), g;
|
|
190
190
|
}
|
|
191
|
-
function X(
|
|
192
|
-
return
|
|
191
|
+
function X(r, e) {
|
|
192
|
+
return r ? `[${r}] ${e}` : e;
|
|
193
193
|
}
|
|
194
|
-
class
|
|
194
|
+
class be {
|
|
195
195
|
constructor(e = {}) {
|
|
196
196
|
this.isProd = ae(), this.name = e.name || ee.name, this.currentLevel = e.level || ee.level, this.logInstance = De(e);
|
|
197
197
|
}
|
|
198
198
|
debug(e, ...t) {
|
|
199
199
|
if (!this.isProd || this.shouldLog("debug")) {
|
|
200
|
-
const
|
|
201
|
-
t.length > 0 ? this.logInstance.debug(
|
|
200
|
+
const n = X(this.name, e);
|
|
201
|
+
t.length > 0 ? this.logInstance.debug(n, ...t) : this.logInstance.debug(n);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
info(e, ...t) {
|
|
205
205
|
if (this.shouldLog("info")) {
|
|
206
|
-
const
|
|
207
|
-
t.length > 0 ? this.logInstance.info(
|
|
206
|
+
const n = X(this.name, e);
|
|
207
|
+
t.length > 0 ? this.logInstance.info(n, ...t) : this.logInstance.info(n);
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
warn(e, ...t) {
|
|
211
|
-
const
|
|
212
|
-
t.length > 0 ? this.logInstance.warn(
|
|
211
|
+
const n = X(this.name, e);
|
|
212
|
+
t.length > 0 ? this.logInstance.warn(n, ...t) : this.logInstance.warn(n);
|
|
213
213
|
}
|
|
214
214
|
error(e, ...t) {
|
|
215
|
-
const
|
|
216
|
-
t.length > 0 ? this.logInstance.error(
|
|
215
|
+
const n = X(this.name, e);
|
|
216
|
+
t.length > 0 ? this.logInstance.error(n, ...t) : this.logInstance.error(n);
|
|
217
217
|
}
|
|
218
218
|
fatal(e, ...t) {
|
|
219
|
-
const
|
|
220
|
-
t.length > 0 ? this.logInstance.error(`[FATAL] ${
|
|
219
|
+
const n = X(this.name, e);
|
|
220
|
+
t.length > 0 ? this.logInstance.error(`[FATAL] ${n}`, ...t) : this.logInstance.error(`[FATAL] ${n}`);
|
|
221
221
|
}
|
|
222
222
|
trace(e, ...t) {
|
|
223
223
|
if (!this.isProd || this.shouldLog("trace")) {
|
|
224
|
-
const
|
|
225
|
-
t.length > 0 ? this.logInstance.trace(
|
|
224
|
+
const n = X(this.name, e);
|
|
225
|
+
t.length > 0 ? this.logInstance.trace(n, ...t) : this.logInstance.trace(n);
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
229
|
* Check if a log level should be logged based on current level
|
|
230
230
|
*/
|
|
231
231
|
shouldLog(e) {
|
|
232
|
-
const t = ["trace", "debug", "info", "warn", "error", "silent"],
|
|
233
|
-
return t.indexOf(e) >=
|
|
232
|
+
const t = ["trace", "debug", "info", "warn", "error", "silent"], n = t.indexOf(this.currentLevel);
|
|
233
|
+
return t.indexOf(e) >= n;
|
|
234
234
|
}
|
|
235
235
|
/**
|
|
236
236
|
* Get the underlying loglevel logger instance
|
|
@@ -242,7 +242,7 @@ class we {
|
|
|
242
242
|
* Set the log level dynamically
|
|
243
243
|
*/
|
|
244
244
|
setLevel(e) {
|
|
245
|
-
this.currentLevel = e, this.logInstance.setLevel(
|
|
245
|
+
this.currentLevel = e, this.logInstance.setLevel(ye[e]);
|
|
246
246
|
}
|
|
247
247
|
/**
|
|
248
248
|
* Get the current log level
|
|
@@ -252,11 +252,11 @@ class we {
|
|
|
252
252
|
return je[e] || this.currentLevel;
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
new
|
|
256
|
-
function ie(
|
|
257
|
-
return new
|
|
255
|
+
new be();
|
|
256
|
+
function ie(r, e = {}) {
|
|
257
|
+
return new be({
|
|
258
258
|
...e,
|
|
259
|
-
name: e.name || `WSX:${
|
|
259
|
+
name: e.name || `WSX:${r}`
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
262
|
const Me = ie("RouterUtils"), Y = class Y {
|
|
@@ -294,7 +294,7 @@ const Me = ie("RouterUtils"), Y = class Y {
|
|
|
294
294
|
* 解析路由路径,提取参数
|
|
295
295
|
*/
|
|
296
296
|
static parseRoute(e, t) {
|
|
297
|
-
var
|
|
297
|
+
var n;
|
|
298
298
|
if (e === t)
|
|
299
299
|
return {
|
|
300
300
|
route: e,
|
|
@@ -308,14 +308,14 @@ const Me = ie("RouterUtils"), Y = class Y {
|
|
|
308
308
|
exact: !1
|
|
309
309
|
};
|
|
310
310
|
if (e.includes(":")) {
|
|
311
|
-
const g = ((
|
|
311
|
+
const g = ((n = e.match(/:([^/]+)/g)) == null ? void 0 : n.map((y) => y.slice(1))) || [], p = e.replace(/:[^/]+/g, "([^/]+)"), f = new RegExp(`^${p}$`), _ = t.match(f);
|
|
312
312
|
if (_ && g.length > 0) {
|
|
313
|
-
const
|
|
313
|
+
const y = {};
|
|
314
314
|
return g.forEach((T, O) => {
|
|
315
|
-
|
|
315
|
+
y[T] = _[O + 1];
|
|
316
316
|
}), {
|
|
317
317
|
route: e,
|
|
318
|
-
params:
|
|
318
|
+
params: y,
|
|
319
319
|
exact: !0
|
|
320
320
|
};
|
|
321
321
|
}
|
|
@@ -335,17 +335,17 @@ const Me = ie("RouterUtils"), Y = class Y {
|
|
|
335
335
|
* 构建路由路径,替换参数
|
|
336
336
|
*/
|
|
337
337
|
static buildPath(e, t = {}) {
|
|
338
|
-
let
|
|
339
|
-
return Object.entries(t).forEach(([g,
|
|
340
|
-
|
|
341
|
-
}),
|
|
338
|
+
let n = e;
|
|
339
|
+
return Object.entries(t).forEach(([g, p]) => {
|
|
340
|
+
n = n.replace(`:${g}`, encodeURIComponent(p));
|
|
341
|
+
}), n;
|
|
342
342
|
}
|
|
343
343
|
/**
|
|
344
344
|
* 检查路由是否匹配当前路径
|
|
345
345
|
*/
|
|
346
346
|
static isRouteActive(e, t = !1) {
|
|
347
|
-
const
|
|
348
|
-
return t ?
|
|
347
|
+
const n = window.location.pathname;
|
|
348
|
+
return t ? n === e : e === "/" ? n === "/" : n.startsWith(e);
|
|
349
349
|
}
|
|
350
350
|
/**
|
|
351
351
|
* 获取路由层级
|
|
@@ -357,7 +357,7 @@ const Me = ie("RouterUtils"), Y = class Y {
|
|
|
357
357
|
* 获取父级路由
|
|
358
358
|
*/
|
|
359
359
|
static getParentRoute(e) {
|
|
360
|
-
const t = e.split("/").filter((
|
|
360
|
+
const t = e.split("/").filter((n) => n.length > 0);
|
|
361
361
|
return t.length <= 1 ? "/" : (t.pop(), "/" + t.join("/"));
|
|
362
362
|
}
|
|
363
363
|
/**
|
|
@@ -381,19 +381,19 @@ const Me = ie("RouterUtils"), Y = class Y {
|
|
|
381
381
|
/**
|
|
382
382
|
* 设置查询参数
|
|
383
383
|
*/
|
|
384
|
-
static setQueryParam(e, t,
|
|
384
|
+
static setQueryParam(e, t, n = !1) {
|
|
385
385
|
const g = new URL(window.location.href);
|
|
386
386
|
g.searchParams.set(e, t);
|
|
387
|
-
const
|
|
388
|
-
this.navigate(
|
|
387
|
+
const p = g.pathname + g.search + g.hash;
|
|
388
|
+
this.navigate(p, n);
|
|
389
389
|
}
|
|
390
390
|
/**
|
|
391
391
|
* 删除查询参数
|
|
392
392
|
*/
|
|
393
393
|
static removeQueryParam(e, t = !1) {
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
-
const g =
|
|
394
|
+
const n = new URL(window.location.href);
|
|
395
|
+
n.searchParams.delete(e);
|
|
396
|
+
const g = n.pathname + n.search + n.hash;
|
|
397
397
|
this.navigate(g, t);
|
|
398
398
|
}
|
|
399
399
|
/**
|
|
@@ -433,8 +433,8 @@ const Me = ie("RouterUtils"), Y = class Y {
|
|
|
433
433
|
*/
|
|
434
434
|
static onRouteChange(e) {
|
|
435
435
|
const t = () => {
|
|
436
|
-
const
|
|
437
|
-
e(
|
|
436
|
+
const n = this.getCurrentRoute();
|
|
437
|
+
e(n);
|
|
438
438
|
};
|
|
439
439
|
return document.addEventListener("route-changed", t), () => {
|
|
440
440
|
document.removeEventListener("route-changed", t);
|
|
@@ -446,11 +446,11 @@ let ne = Y;
|
|
|
446
446
|
const ue = ":host{display:grid;width:100%}.router-outlet{width:100%}:host>wsx-view{grid-area:1 / 1}";
|
|
447
447
|
var Re;
|
|
448
448
|
let Le, xe;
|
|
449
|
-
function F(
|
|
450
|
-
return (e = Ee(e)) in
|
|
449
|
+
function F(r, e, t) {
|
|
450
|
+
return (e = Ee(e)) in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
|
|
451
451
|
}
|
|
452
|
-
function Pe(
|
|
453
|
-
function
|
|
452
|
+
function Pe(r, e, t, n, g, p) {
|
|
453
|
+
function f(s, o, c) {
|
|
454
454
|
return function(i, u) {
|
|
455
455
|
return c && c(i), s[o].call(i, u);
|
|
456
456
|
};
|
|
@@ -459,114 +459,114 @@ function Pe(n, e, t, r, g, v) {
|
|
|
459
459
|
for (var c = 0; c < s.length; c++) s[c].call(o);
|
|
460
460
|
return o;
|
|
461
461
|
}
|
|
462
|
-
function
|
|
462
|
+
function y(s, o, c, i) {
|
|
463
463
|
if (typeof s != "function" && (i || s !== void 0)) throw new TypeError(o + " must " + (c || "be") + " a function" + (i ? "" : " or undefined"));
|
|
464
464
|
return s;
|
|
465
465
|
}
|
|
466
|
-
function T(s, o, c, i, u, A, k, L, P,
|
|
467
|
-
function h(
|
|
468
|
-
if (!m(
|
|
466
|
+
function T(s, o, c, i, u, A, k, L, P, C, R, v, m) {
|
|
467
|
+
function h(d) {
|
|
468
|
+
if (!m(d)) throw new TypeError("Attempted to access private element on non-instance");
|
|
469
469
|
}
|
|
470
|
-
var l, x = o[0],
|
|
470
|
+
var l, x = o[0], $ = o[3], W = !L;
|
|
471
471
|
if (!W) {
|
|
472
472
|
c || Array.isArray(x) || (x = [x]);
|
|
473
|
-
var a = {}, I = [],
|
|
474
|
-
|
|
475
|
-
return
|
|
476
|
-
}, i, "get"), set: function(
|
|
477
|
-
o[4](this,
|
|
478
|
-
} } : a[
|
|
473
|
+
var a = {}, I = [], b = u === 3 ? "get" : u === 4 || v ? "set" : "value";
|
|
474
|
+
C ? (R || v ? a = { get: he(function() {
|
|
475
|
+
return $(this);
|
|
476
|
+
}, i, "get"), set: function(d) {
|
|
477
|
+
o[4](this, d);
|
|
478
|
+
} } : a[b] = $, R || he(a[b], i, u === 2 ? "" : b)) : R || (a = Object.getOwnPropertyDescriptor(s, i));
|
|
479
479
|
}
|
|
480
|
-
for (var
|
|
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(
|
|
482
|
-
if (
|
|
483
|
-
|
|
480
|
+
for (var w = 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
|
+
y(S, "An initializer", "be", !0), k.push(S);
|
|
484
484
|
}).bind(null, K) };
|
|
485
485
|
try {
|
|
486
|
-
if (W) (l =
|
|
486
|
+
if (W) (l = y(B.call(G, w, j), "class decorators", "return")) && (w = l);
|
|
487
487
|
else {
|
|
488
488
|
var D, z;
|
|
489
|
-
j.static = P, j.private =
|
|
490
|
-
return h(
|
|
491
|
-
} : (u < 4 && (D =
|
|
492
|
-
return
|
|
493
|
-
}, (u < 2 || u === 4) && (z = function(
|
|
494
|
-
|
|
489
|
+
j.static = P, j.private = C, C ? u === 2 ? D = function(d) {
|
|
490
|
+
return h(d), a.value;
|
|
491
|
+
} : (u < 4 && (D = f(a, "get", h)), u !== 3 && (z = f(a, "set", h))) : (D = function(d) {
|
|
492
|
+
return d[i];
|
|
493
|
+
}, (u < 2 || u === 4) && (z = function(d, S) {
|
|
494
|
+
d[i] = S;
|
|
495
495
|
}));
|
|
496
|
-
var J = j.access = { has:
|
|
497
|
-
return i in
|
|
496
|
+
var J = j.access = { has: C ? m.bind() : function(d) {
|
|
497
|
+
return i in d;
|
|
498
498
|
} };
|
|
499
|
-
if (D && (J.get = D), z && (J.set = z),
|
|
500
|
-
if (typeof
|
|
501
|
-
else if (
|
|
502
|
-
} else
|
|
499
|
+
if (D && (J.get = D), z && (J.set = z), w = B.call(G, v ? { get: a.get, set: a.set } : a[b], j), v) {
|
|
500
|
+
if (typeof w == "object" && w) (l = y(w.get, "accessor.get")) && (a.get = l), (l = y(w.set, "accessor.set")) && (a.set = l), (l = y(w.init, "accessor.init")) && I.push(l);
|
|
501
|
+
else if (w !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
502
|
+
} else y(w, (R ? "field" : "method") + " decorators", "return") && (R ? I.push(w) : a[b] = w);
|
|
503
503
|
}
|
|
504
504
|
} finally {
|
|
505
505
|
K.v = !0;
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
return (R ||
|
|
509
|
-
for (var N = I.length - 1; N >= 0; N--) S = I[N].call(
|
|
508
|
+
return (R || v) && L.push(function(d, S) {
|
|
509
|
+
for (var N = I.length - 1; N >= 0; N--) S = I[N].call(d, S);
|
|
510
510
|
return S;
|
|
511
|
-
}), R || W || (
|
|
511
|
+
}), R || W || (C ? v ? L.push(f(a, "get"), f(a, "set")) : L.push(u === 2 ? a[b] : f.call.bind(a[b])) : Object.defineProperty(s, i, a)), w;
|
|
512
512
|
}
|
|
513
513
|
function O(s, o) {
|
|
514
514
|
return Object.defineProperty(s, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: o });
|
|
515
515
|
}
|
|
516
|
-
if (arguments.length >= 6) var V =
|
|
516
|
+
if (arguments.length >= 6) var V = p[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
517
517
|
var M = Object.create(V ?? null), H = function(s, o, c, i) {
|
|
518
|
-
var u, A, k = [], L = function(
|
|
519
|
-
return Ue(
|
|
518
|
+
var u, A, k = [], L = function(b) {
|
|
519
|
+
return Ue(b) === s;
|
|
520
520
|
}, P = /* @__PURE__ */ new Map();
|
|
521
|
-
function
|
|
522
|
-
|
|
521
|
+
function C(b) {
|
|
522
|
+
b && k.push(_.bind(null, b));
|
|
523
523
|
}
|
|
524
524
|
for (var R = 0; R < o.length; R++) {
|
|
525
|
-
var
|
|
526
|
-
if (Array.isArray(
|
|
527
|
-
var m =
|
|
525
|
+
var v = o[R];
|
|
526
|
+
if (Array.isArray(v)) {
|
|
527
|
+
var m = v[1], h = v[2], l = v.length > 3, x = 16 & m, $ = !!(8 & m), W = (m &= 7) == 0, a = h + "/" + $;
|
|
528
528
|
if (!W && !l) {
|
|
529
529
|
var I = P.get(a);
|
|
530
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
531
|
P.set(a, !(m > 2) || m);
|
|
532
532
|
}
|
|
533
|
-
T(
|
|
533
|
+
T($ ? s : s.prototype, v, x, l ? "#" + h : Ee(h), m, i, $ ? A = A || [] : u = u || [], k, $, l, W, m === 1, $ && l ? L : c);
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
|
-
return
|
|
537
|
-
}(
|
|
538
|
-
return t.length || O(
|
|
536
|
+
return C(u), C(A), k;
|
|
537
|
+
}(r, e, g, M);
|
|
538
|
+
return t.length || O(r, M), { e: H, get c() {
|
|
539
539
|
var s = [];
|
|
540
|
-
return t.length && [O(T(
|
|
540
|
+
return t.length && [O(T(r, [t], n, r.name, 5, M, s), M), _.bind(null, s, r)];
|
|
541
541
|
} };
|
|
542
542
|
}
|
|
543
|
-
function Ee(
|
|
544
|
-
var e = Ve(
|
|
543
|
+
function Ee(r) {
|
|
544
|
+
var e = Ve(r, "string");
|
|
545
545
|
return typeof e == "symbol" ? e : e + "";
|
|
546
546
|
}
|
|
547
|
-
function Ve(
|
|
548
|
-
if (typeof
|
|
549
|
-
var t =
|
|
547
|
+
function Ve(r, e) {
|
|
548
|
+
if (typeof r != "object" || !r) return r;
|
|
549
|
+
var t = r[Symbol.toPrimitive];
|
|
550
550
|
if (t !== void 0) {
|
|
551
|
-
var
|
|
552
|
-
if (typeof
|
|
551
|
+
var n = t.call(r, e);
|
|
552
|
+
if (typeof n != "object") return n;
|
|
553
553
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
554
554
|
}
|
|
555
|
-
return String(
|
|
555
|
+
return String(r);
|
|
556
556
|
}
|
|
557
|
-
function he(
|
|
557
|
+
function he(r, e, t) {
|
|
558
558
|
typeof e == "symbol" && (e = (e = e.description) ? "[" + e + "]" : "");
|
|
559
559
|
try {
|
|
560
|
-
Object.defineProperty(
|
|
560
|
+
Object.defineProperty(r, "name", { configurable: !0, value: t ? t + " " + e : e });
|
|
561
561
|
} catch {
|
|
562
562
|
}
|
|
563
|
-
return
|
|
563
|
+
return r;
|
|
564
564
|
}
|
|
565
|
-
function Ue(
|
|
566
|
-
if (Object(
|
|
567
|
-
return
|
|
565
|
+
function Ue(r) {
|
|
566
|
+
if (Object(r) !== r) throw TypeError("right-hand side of 'in' should be an object, got " + (r !== null ? typeof r : "null"));
|
|
567
|
+
return r;
|
|
568
568
|
}
|
|
569
|
-
const
|
|
569
|
+
const E = ie("WsxRouter");
|
|
570
570
|
xe = [ce({
|
|
571
571
|
tagName: "wsx-router"
|
|
572
572
|
})];
|
|
@@ -578,13 +578,13 @@ class Ne extends re {
|
|
|
578
578
|
styleName: "wsx-router"
|
|
579
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", () => {
|
|
580
580
|
if (this.isHandlingRoute) {
|
|
581
|
-
|
|
581
|
+
E.debug("Route change already in progress, skipping");
|
|
582
582
|
return;
|
|
583
583
|
}
|
|
584
|
-
this.views.size === 0 && (this.collectViews(),
|
|
584
|
+
this.views.size === 0 && (this.collectViews(), E.debug(`WsxRouter re-collected views: ${this.views.size}`)), this.isHandlingRoute = !0;
|
|
585
585
|
try {
|
|
586
586
|
const e = window.location.pathname;
|
|
587
|
-
|
|
587
|
+
E.debug(`WsxRouter: Route changed to: ${e}`);
|
|
588
588
|
const t = new CustomEvent("before-navigate", {
|
|
589
589
|
detail: {
|
|
590
590
|
to: e,
|
|
@@ -594,7 +594,7 @@ class Ne extends re {
|
|
|
594
594
|
cancelable: !0
|
|
595
595
|
});
|
|
596
596
|
if (!this.dispatchEvent(t)) {
|
|
597
|
-
|
|
597
|
+
E.debug(`Navigation to ${e} was cancelled`);
|
|
598
598
|
return;
|
|
599
599
|
}
|
|
600
600
|
this.performNavigation(e);
|
|
@@ -606,8 +606,8 @@ class Ne extends re {
|
|
|
606
606
|
}), F(this, "interceptLinks", (e) => {
|
|
607
607
|
const t = e.target.closest("a");
|
|
608
608
|
if (!t) return;
|
|
609
|
-
const
|
|
610
|
-
!
|
|
609
|
+
const n = t.getAttribute("href");
|
|
610
|
+
!n || n.startsWith("http") || n.startsWith("#") || (e.preventDefault(), this.navigate(n));
|
|
611
611
|
});
|
|
612
612
|
}
|
|
613
613
|
render() {
|
|
@@ -615,15 +615,15 @@ class Ne extends re {
|
|
|
615
615
|
}
|
|
616
616
|
onRendered() {
|
|
617
617
|
var e;
|
|
618
|
-
(e = super.onRendered) == null || e.call(this), this.views.size === 0 && (this.collectViews(),
|
|
618
|
+
(e = super.onRendered) == null || e.call(this), this.views.size === 0 && (this.collectViews(), E.debug("WsxRouter collected views in onRendered:", this.views.size)), this.views.size > 0 && !this.currentView && requestAnimationFrame(() => {
|
|
619
619
|
this.handleRouteChange();
|
|
620
620
|
});
|
|
621
621
|
}
|
|
622
622
|
onConnected() {
|
|
623
623
|
var e;
|
|
624
|
-
(e = super.onConnected) == null || e.call(this),
|
|
625
|
-
this.views.size === 0 && (this.collectViews(),
|
|
626
|
-
|
|
624
|
+
(e = super.onConnected) == null || e.call(this), E.debug("WsxRouter connected to DOM"), "scrollRestoration" in history && (history.scrollRestoration = this.scrollRestoration), window.addEventListener("popstate", this.handleRouteChange), this.addEventListener("click", this.interceptLinks), requestAnimationFrame(() => {
|
|
625
|
+
this.views.size === 0 && (this.collectViews(), E.debug(`WsxRouter collected views in onConnected: ${this.views.size}`)), requestAnimationFrame(() => {
|
|
626
|
+
E.debug(`WsxRouter handling initial route: ${window.location.pathname}`), this.handleRouteChange();
|
|
627
627
|
});
|
|
628
628
|
});
|
|
629
629
|
}
|
|
@@ -633,11 +633,11 @@ class Ne extends re {
|
|
|
633
633
|
}
|
|
634
634
|
collectViews() {
|
|
635
635
|
const e = Array.from(this.children).filter((t) => t.tagName.toLowerCase() === "wsx-view");
|
|
636
|
-
|
|
637
|
-
const
|
|
638
|
-
if (this.views.set(
|
|
639
|
-
const g =
|
|
640
|
-
this.compiledRoutes.set(
|
|
636
|
+
E.debug(`WsxRouter found ${e.length} views`), this.views.clear(), this.compiledRoutes.clear(), this.matchCache.clear(), e.forEach((t) => {
|
|
637
|
+
const n = t.getAttribute("route") || "/";
|
|
638
|
+
if (this.views.set(n, t), E.debug(`WsxRouter registered route: ${n}`), n.includes(":")) {
|
|
639
|
+
const g = n.replace(/:[^/]+/g, "([^/]+)"), p = new RegExp(`^${g}$`);
|
|
640
|
+
this.compiledRoutes.set(n, p), E.debug(`WsxRouter compiled regex for route: ${n} -> ${p}`);
|
|
641
641
|
}
|
|
642
642
|
t.style.display = "none";
|
|
643
643
|
});
|
|
@@ -647,43 +647,43 @@ class Ne extends re {
|
|
|
647
647
|
*/
|
|
648
648
|
performNavigation(e) {
|
|
649
649
|
const t = () => {
|
|
650
|
-
const
|
|
651
|
-
if (
|
|
652
|
-
|
|
653
|
-
const g =
|
|
654
|
-
|
|
650
|
+
const n = this.matchRoute(e);
|
|
651
|
+
if (n) {
|
|
652
|
+
n.style.display = "block", n.style.visibility = "visible";
|
|
653
|
+
const g = n.getAttribute("route") || "/";
|
|
654
|
+
E.debug(`Showing view for route: ${g}`);
|
|
655
655
|
for (const [O, V] of this.views)
|
|
656
|
-
V !==
|
|
657
|
-
this.currentView =
|
|
658
|
-
const
|
|
659
|
-
|
|
660
|
-
|
|
656
|
+
V !== n && (V.style.display = "none", V.style.visibility = "");
|
|
657
|
+
this.currentView = n;
|
|
658
|
+
const p = this.extractParams(g, e);
|
|
659
|
+
E.debug(`Extracted params for route ${g} and path ${e}:`, p), p && requestAnimationFrame(() => {
|
|
660
|
+
n.setAttribute("params", JSON.stringify(p)), E.debug(`Set params attribute on view: ${JSON.stringify(p)}`);
|
|
661
661
|
});
|
|
662
|
-
const
|
|
662
|
+
const f = window.location.href || `${window.location.pathname}${window.location.search}${window.location.hash}`, _ = new URL(f, window.location.origin || "http://localhost"), y = {
|
|
663
663
|
path: e,
|
|
664
|
-
params:
|
|
664
|
+
params: p || {},
|
|
665
665
|
query: Object.fromEntries(_.searchParams.entries()),
|
|
666
666
|
hash: _.hash.slice(1)
|
|
667
667
|
};
|
|
668
|
-
ne._setCurrentRoute(
|
|
668
|
+
ne._setCurrentRoute(y), E.debug("Updated RouterUtils._currentRoute:", y);
|
|
669
669
|
const T = new CustomEvent("route-changed", {
|
|
670
|
-
detail:
|
|
670
|
+
detail: y,
|
|
671
671
|
bubbles: !0
|
|
672
672
|
});
|
|
673
673
|
document.dispatchEvent(T);
|
|
674
674
|
} else {
|
|
675
|
-
for (const [
|
|
675
|
+
for (const [y, T] of this.views)
|
|
676
676
|
T.style.display = "none";
|
|
677
|
-
this.currentView = null,
|
|
678
|
-
const g = window.location.href || `${window.location.pathname}${window.location.search}${window.location.hash}`,
|
|
677
|
+
this.currentView = null, E.warn(`No view found for path: ${e}`);
|
|
678
|
+
const g = window.location.href || `${window.location.pathname}${window.location.search}${window.location.hash}`, p = new URL(g, window.location.origin || "http://localhost"), f = {
|
|
679
679
|
path: e,
|
|
680
680
|
params: {},
|
|
681
|
-
query: Object.fromEntries(
|
|
682
|
-
hash:
|
|
681
|
+
query: Object.fromEntries(p.searchParams.entries()),
|
|
682
|
+
hash: p.hash.slice(1)
|
|
683
683
|
};
|
|
684
|
-
ne._setCurrentRoute(
|
|
684
|
+
ne._setCurrentRoute(f);
|
|
685
685
|
const _ = new CustomEvent("route-changed", {
|
|
686
|
-
detail:
|
|
686
|
+
detail: f,
|
|
687
687
|
bubbles: !0
|
|
688
688
|
});
|
|
689
689
|
document.dispatchEvent(_);
|
|
@@ -702,7 +702,7 @@ class Ne extends re {
|
|
|
702
702
|
* RFC 0033: 滚动恢复处理
|
|
703
703
|
*/
|
|
704
704
|
handleScrollRestoration(e) {
|
|
705
|
-
this.scrollRestoration === "manual" && (this.isBackNavigation() || (window.scrollTo(0, 0),
|
|
705
|
+
this.scrollRestoration === "manual" && (this.isBackNavigation() || (window.scrollTo(0, 0), E.debug("Scrolled to top for forward navigation")));
|
|
706
706
|
}
|
|
707
707
|
/**
|
|
708
708
|
* RFC 0033: 检测是否是后退导航
|
|
@@ -712,34 +712,40 @@ class Ne extends re {
|
|
|
712
712
|
return "navigation" in performance && performance.navigation ? performance.navigation.type === 2 : ((e = window.history.state) == null ? void 0 : e.navigationType) === "back";
|
|
713
713
|
}
|
|
714
714
|
matchRoute(e) {
|
|
715
|
-
if (
|
|
716
|
-
const
|
|
717
|
-
return
|
|
715
|
+
if (E.warn(`matchRoute called for path: ${e}, views count: ${this.views.size}`), this.matchCache.has(e)) {
|
|
716
|
+
const n = this.matchCache.get(e);
|
|
717
|
+
return E.warn(`matchRoute: found in cache, route: ${n}`), this.views.get(n) || null;
|
|
718
718
|
}
|
|
719
719
|
if (this.views.has(e))
|
|
720
|
-
return this.matchCache.set(e, e),
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
720
|
+
return this.matchCache.set(e, e), E.warn(`matchRoute: exact match found for ${e}`), this.views.get(e);
|
|
721
|
+
for (const [n, g] of this.views)
|
|
722
|
+
if (n.endsWith("/*")) {
|
|
723
|
+
const p = n.slice(0, -2);
|
|
724
|
+
if (e.startsWith(p))
|
|
725
|
+
return this.matchCache.set(e, n), E.warn(`matchRoute: prefix match found, route: ${n}, path: ${e}`), g;
|
|
726
|
+
}
|
|
727
|
+
E.warn(`matchRoute: checking parameter routes, compiledRoutes count: ${this.compiledRoutes.size}`);
|
|
728
|
+
for (const [n, g] of this.views)
|
|
729
|
+
if (n.includes(":")) {
|
|
730
|
+
const p = this.compiledRoutes.get(n);
|
|
731
|
+
if (p) {
|
|
732
|
+
const f = p.test(e);
|
|
733
|
+
if (E.warn(`matchRoute: testing route ${n} against ${e}, matches: ${f}`), f)
|
|
734
|
+
return this.matchCache.set(e, n), E.warn(`matchRoute: parameter match found, route: ${n}, path: ${e}`), g;
|
|
729
735
|
} else
|
|
730
|
-
|
|
736
|
+
E.warn(`matchRoute: route ${n} has ':' but no compiled regex found`);
|
|
731
737
|
}
|
|
732
738
|
const t = this.views.get("*") || null;
|
|
733
|
-
return t ? (this.matchCache.set(e, "*"),
|
|
739
|
+
return t ? (this.matchCache.set(e, "*"), E.warn(`matchRoute: wildcard match found for ${e}`)) : E.warn(`matchRoute: no match found for ${e}, no wildcard view available`), t;
|
|
734
740
|
}
|
|
735
741
|
extractParams(e, t) {
|
|
736
|
-
var
|
|
742
|
+
var y;
|
|
737
743
|
if (!e.includes(":")) return null;
|
|
738
|
-
const
|
|
739
|
-
if (!
|
|
744
|
+
const n = ((y = e.match(/:([^/]+)/g)) == null ? void 0 : y.map((T) => T.slice(1))) || [], g = e.replace(/:[^/]+/g, "([^/]+)"), p = new RegExp(`^${g}$`), f = t.match(p);
|
|
745
|
+
if (!f || !n.length) return null;
|
|
740
746
|
const _ = {};
|
|
741
|
-
return
|
|
742
|
-
_[T] =
|
|
747
|
+
return n.forEach((T, O) => {
|
|
748
|
+
_[T] = f[O + 1];
|
|
743
749
|
}), _;
|
|
744
750
|
}
|
|
745
751
|
/**
|
|
@@ -747,19 +753,19 @@ class Ne extends re {
|
|
|
747
753
|
* 当路由配置变更时调用,确保使用最新的路由规则
|
|
748
754
|
*/
|
|
749
755
|
clearMatchCache() {
|
|
750
|
-
this.matchCache.clear(),
|
|
756
|
+
this.matchCache.clear(), E.debug("WsxRouter cleared match cache");
|
|
751
757
|
}
|
|
752
758
|
/**
|
|
753
759
|
* RFC 0033: 配置 View Transitions
|
|
754
760
|
*/
|
|
755
761
|
setViewTransitions(e) {
|
|
756
|
-
this.enableViewTransitions = e,
|
|
762
|
+
this.enableViewTransitions = e, E.debug(`View Transitions ${e ? "enabled" : "disabled"}`);
|
|
757
763
|
}
|
|
758
764
|
/**
|
|
759
765
|
* RFC 0033: 配置 Scroll Restoration
|
|
760
766
|
*/
|
|
761
767
|
setScrollRestoration(e) {
|
|
762
|
-
this.scrollRestoration = e, "scrollRestoration" in history && (history.scrollRestoration = e),
|
|
768
|
+
this.scrollRestoration = e, "scrollRestoration" in history && (history.scrollRestoration = e), E.debug(`Scroll Restoration set to ${e}`);
|
|
763
769
|
}
|
|
764
770
|
/**
|
|
765
771
|
* 编程式导航 - 使用原生 History API
|
|
@@ -774,11 +780,11 @@ Le();
|
|
|
774
780
|
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}}";
|
|
775
781
|
var Ce;
|
|
776
782
|
let $e, _e;
|
|
777
|
-
function Z(
|
|
778
|
-
return (e = Ie(e)) in
|
|
783
|
+
function Z(r, e, t) {
|
|
784
|
+
return (e = Ie(e)) in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
|
|
779
785
|
}
|
|
780
|
-
function qe(
|
|
781
|
-
function
|
|
786
|
+
function qe(r, e, t, n, g, p) {
|
|
787
|
+
function f(s, o, c) {
|
|
782
788
|
return function(i, u) {
|
|
783
789
|
return c && c(i), s[o].call(i, u);
|
|
784
790
|
};
|
|
@@ -787,112 +793,112 @@ function qe(n, e, t, r, g, v) {
|
|
|
787
793
|
for (var c = 0; c < s.length; c++) s[c].call(o);
|
|
788
794
|
return o;
|
|
789
795
|
}
|
|
790
|
-
function
|
|
796
|
+
function y(s, o, c, i) {
|
|
791
797
|
if (typeof s != "function" && (i || s !== void 0)) throw new TypeError(o + " must " + (c || "be") + " a function" + (i ? "" : " or undefined"));
|
|
792
798
|
return s;
|
|
793
799
|
}
|
|
794
|
-
function T(s, o, c, i, u, A, k, L, P,
|
|
795
|
-
function h(
|
|
796
|
-
if (!m(
|
|
800
|
+
function T(s, o, c, i, u, A, k, L, P, C, R, v, m) {
|
|
801
|
+
function h(d) {
|
|
802
|
+
if (!m(d)) throw new TypeError("Attempted to access private element on non-instance");
|
|
797
803
|
}
|
|
798
|
-
var l, x = o[0],
|
|
804
|
+
var l, x = o[0], $ = o[3], W = !L;
|
|
799
805
|
if (!W) {
|
|
800
806
|
c || Array.isArray(x) || (x = [x]);
|
|
801
|
-
var a = {}, I = [],
|
|
802
|
-
|
|
803
|
-
return
|
|
804
|
-
}, i, "get"), set: function(
|
|
805
|
-
o[4](this,
|
|
806
|
-
} } : a[
|
|
807
|
+
var a = {}, I = [], b = u === 3 ? "get" : u === 4 || v ? "set" : "value";
|
|
808
|
+
C ? (R || v ? a = { get: fe(function() {
|
|
809
|
+
return $(this);
|
|
810
|
+
}, i, "get"), set: function(d) {
|
|
811
|
+
o[4](this, d);
|
|
812
|
+
} } : a[b] = $, R || fe(a[b], i, u === 2 ? "" : b)) : R || (a = Object.getOwnPropertyDescriptor(s, i));
|
|
807
813
|
}
|
|
808
|
-
for (var
|
|
809
|
-
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(
|
|
810
|
-
if (
|
|
811
|
-
|
|
814
|
+
for (var w = s, U = x.length - 1; U >= 0; U -= c ? 2 : 1) {
|
|
815
|
+
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) {
|
|
816
|
+
if (d.v) throw Error("attempted to call addInitializer after decoration was finished");
|
|
817
|
+
y(S, "An initializer", "be", !0), k.push(S);
|
|
812
818
|
}).bind(null, K) };
|
|
813
819
|
try {
|
|
814
|
-
if (W) (l =
|
|
820
|
+
if (W) (l = y(B.call(G, w, j), "class decorators", "return")) && (w = l);
|
|
815
821
|
else {
|
|
816
822
|
var D, z;
|
|
817
|
-
j.static = P, j.private =
|
|
818
|
-
return h(
|
|
819
|
-
} : (u < 4 && (D =
|
|
820
|
-
return
|
|
821
|
-
}, (u < 2 || u === 4) && (z = function(
|
|
822
|
-
|
|
823
|
+
j.static = P, j.private = C, C ? u === 2 ? D = function(d) {
|
|
824
|
+
return h(d), a.value;
|
|
825
|
+
} : (u < 4 && (D = f(a, "get", h)), u !== 3 && (z = f(a, "set", h))) : (D = function(d) {
|
|
826
|
+
return d[i];
|
|
827
|
+
}, (u < 2 || u === 4) && (z = function(d, S) {
|
|
828
|
+
d[i] = S;
|
|
823
829
|
}));
|
|
824
|
-
var J = j.access = { has:
|
|
825
|
-
return i in
|
|
830
|
+
var J = j.access = { has: C ? m.bind() : function(d) {
|
|
831
|
+
return i in d;
|
|
826
832
|
} };
|
|
827
|
-
if (D && (J.get = D), z && (J.set = z),
|
|
828
|
-
if (typeof
|
|
829
|
-
else if (
|
|
830
|
-
} else
|
|
833
|
+
if (D && (J.get = D), z && (J.set = z), w = B.call(G, v ? { get: a.get, set: a.set } : a[b], j), v) {
|
|
834
|
+
if (typeof w == "object" && w) (l = y(w.get, "accessor.get")) && (a.get = l), (l = y(w.set, "accessor.set")) && (a.set = l), (l = y(w.init, "accessor.init")) && I.push(l);
|
|
835
|
+
else if (w !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
836
|
+
} else y(w, (R ? "field" : "method") + " decorators", "return") && (R ? I.push(w) : a[b] = w);
|
|
831
837
|
}
|
|
832
838
|
} finally {
|
|
833
839
|
K.v = !0;
|
|
834
840
|
}
|
|
835
841
|
}
|
|
836
|
-
return (R ||
|
|
837
|
-
for (var N = I.length - 1; N >= 0; N--) S = I[N].call(
|
|
842
|
+
return (R || v) && L.push(function(d, S) {
|
|
843
|
+
for (var N = I.length - 1; N >= 0; N--) S = I[N].call(d, S);
|
|
838
844
|
return S;
|
|
839
|
-
}), R || W || (
|
|
845
|
+
}), R || W || (C ? v ? L.push(f(a, "get"), f(a, "set")) : L.push(u === 2 ? a[b] : f.call.bind(a[b])) : Object.defineProperty(s, i, a)), w;
|
|
840
846
|
}
|
|
841
847
|
function O(s, o) {
|
|
842
848
|
return Object.defineProperty(s, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: o });
|
|
843
849
|
}
|
|
844
|
-
if (arguments.length >= 6) var V =
|
|
850
|
+
if (arguments.length >= 6) var V = p[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
845
851
|
var M = Object.create(V ?? null), H = function(s, o, c, i) {
|
|
846
|
-
var u, A, k = [], L = function(
|
|
847
|
-
return Be(
|
|
852
|
+
var u, A, k = [], L = function(b) {
|
|
853
|
+
return Be(b) === s;
|
|
848
854
|
}, P = /* @__PURE__ */ new Map();
|
|
849
|
-
function
|
|
850
|
-
|
|
855
|
+
function C(b) {
|
|
856
|
+
b && k.push(_.bind(null, b));
|
|
851
857
|
}
|
|
852
858
|
for (var R = 0; R < o.length; R++) {
|
|
853
|
-
var
|
|
854
|
-
if (Array.isArray(
|
|
855
|
-
var m =
|
|
859
|
+
var v = o[R];
|
|
860
|
+
if (Array.isArray(v)) {
|
|
861
|
+
var m = v[1], h = v[2], l = v.length > 3, x = 16 & m, $ = !!(8 & m), W = (m &= 7) == 0, a = h + "/" + $;
|
|
856
862
|
if (!W && !l) {
|
|
857
863
|
var I = P.get(a);
|
|
858
864
|
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);
|
|
859
865
|
P.set(a, !(m > 2) || m);
|
|
860
866
|
}
|
|
861
|
-
T(
|
|
867
|
+
T($ ? s : s.prototype, v, x, l ? "#" + h : Ie(h), m, i, $ ? A = A || [] : u = u || [], k, $, l, W, m === 1, $ && l ? L : c);
|
|
862
868
|
}
|
|
863
869
|
}
|
|
864
|
-
return
|
|
865
|
-
}(
|
|
866
|
-
return t.length || O(
|
|
870
|
+
return C(u), C(A), k;
|
|
871
|
+
}(r, e, g, M);
|
|
872
|
+
return t.length || O(r, M), { e: H, get c() {
|
|
867
873
|
var s = [];
|
|
868
|
-
return t.length && [O(T(
|
|
874
|
+
return t.length && [O(T(r, [t], n, r.name, 5, M, s), M), _.bind(null, s, r)];
|
|
869
875
|
} };
|
|
870
876
|
}
|
|
871
|
-
function Ie(
|
|
872
|
-
var e = He(
|
|
877
|
+
function Ie(r) {
|
|
878
|
+
var e = He(r, "string");
|
|
873
879
|
return typeof e == "symbol" ? e : e + "";
|
|
874
880
|
}
|
|
875
|
-
function He(
|
|
876
|
-
if (typeof
|
|
877
|
-
var t =
|
|
881
|
+
function He(r, e) {
|
|
882
|
+
if (typeof r != "object" || !r) return r;
|
|
883
|
+
var t = r[Symbol.toPrimitive];
|
|
878
884
|
if (t !== void 0) {
|
|
879
|
-
var
|
|
880
|
-
if (typeof
|
|
885
|
+
var n = t.call(r, e);
|
|
886
|
+
if (typeof n != "object") return n;
|
|
881
887
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
882
888
|
}
|
|
883
|
-
return String(
|
|
889
|
+
return String(r);
|
|
884
890
|
}
|
|
885
|
-
function
|
|
891
|
+
function fe(r, e, t) {
|
|
886
892
|
typeof e == "symbol" && (e = (e = e.description) ? "[" + e + "]" : "");
|
|
887
893
|
try {
|
|
888
|
-
Object.defineProperty(
|
|
894
|
+
Object.defineProperty(r, "name", { configurable: !0, value: t ? t + " " + e : e });
|
|
889
895
|
} catch {
|
|
890
896
|
}
|
|
891
|
-
return
|
|
897
|
+
return r;
|
|
892
898
|
}
|
|
893
|
-
function Be(
|
|
894
|
-
if (Object(
|
|
895
|
-
return
|
|
899
|
+
function Be(r) {
|
|
900
|
+
if (Object(r) !== r) throw TypeError("right-hand side of 'in' should be an object, got " + (r !== null ? typeof r : "null"));
|
|
901
|
+
return r;
|
|
896
902
|
}
|
|
897
903
|
const q = ie("WsxView");
|
|
898
904
|
_e = [ce({
|
|
@@ -939,8 +945,8 @@ class Ke extends re {
|
|
|
939
945
|
q.warn(`Component ${e} not found in customElements registry`), this.isLoading = !1;
|
|
940
946
|
return;
|
|
941
947
|
}
|
|
942
|
-
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(([
|
|
943
|
-
this.componentInstance.setAttribute(
|
|
948
|
+
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(([p, f]) => {
|
|
949
|
+
this.componentInstance.setAttribute(p, f);
|
|
944
950
|
}));
|
|
945
951
|
const g = this.querySelector(".route-view");
|
|
946
952
|
if (g) {
|
|
@@ -970,12 +976,12 @@ Ce = Ke;
|
|
|
970
976
|
$e();
|
|
971
977
|
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)}';
|
|
972
978
|
var oe, se;
|
|
973
|
-
let
|
|
974
|
-
function Q(
|
|
975
|
-
return (e = ke(e)) in
|
|
979
|
+
let de, Se, ge;
|
|
980
|
+
function Q(r, e, t) {
|
|
981
|
+
return (e = ke(e)) in r ? Object.defineProperty(r, e, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : r[e] = t, r;
|
|
976
982
|
}
|
|
977
|
-
function Qe(
|
|
978
|
-
function
|
|
983
|
+
function Qe(r, e, t, n, g, p) {
|
|
984
|
+
function f(s, o, c) {
|
|
979
985
|
return function(i, u) {
|
|
980
986
|
return c && c(i), s[o].call(i, u);
|
|
981
987
|
};
|
|
@@ -984,115 +990,115 @@ function Qe(n, e, t, r, g, v) {
|
|
|
984
990
|
for (var c = 0; c < s.length; c++) s[c].call(o);
|
|
985
991
|
return o;
|
|
986
992
|
}
|
|
987
|
-
function
|
|
993
|
+
function y(s, o, c, i) {
|
|
988
994
|
if (typeof s != "function" && (i || s !== void 0)) throw new TypeError(o + " must " + (c || "be") + " a function" + (i ? "" : " or undefined"));
|
|
989
995
|
return s;
|
|
990
996
|
}
|
|
991
|
-
function T(s, o, c, i, u, A, k, L, P,
|
|
992
|
-
function h(
|
|
993
|
-
if (!m(
|
|
997
|
+
function T(s, o, c, i, u, A, k, L, P, C, R, v, m) {
|
|
998
|
+
function h(d) {
|
|
999
|
+
if (!m(d)) throw new TypeError("Attempted to access private element on non-instance");
|
|
994
1000
|
}
|
|
995
|
-
var l, x = o[0],
|
|
1001
|
+
var l, x = o[0], $ = o[3], W = !L;
|
|
996
1002
|
if (!W) {
|
|
997
1003
|
c || Array.isArray(x) || (x = [x]);
|
|
998
|
-
var a = {}, I = [],
|
|
999
|
-
|
|
1000
|
-
return
|
|
1001
|
-
}, i, "get"), set: function(
|
|
1002
|
-
o[4](this,
|
|
1003
|
-
} } : a[
|
|
1004
|
+
var a = {}, I = [], b = u === 3 ? "get" : u === 4 || v ? "set" : "value";
|
|
1005
|
+
C ? (R || v ? a = { get: pe(function() {
|
|
1006
|
+
return $(this);
|
|
1007
|
+
}, i, "get"), set: function(d) {
|
|
1008
|
+
o[4](this, d);
|
|
1009
|
+
} } : a[b] = $, R || pe(a[b], i, u === 2 ? "" : b)) : R || (a = Object.getOwnPropertyDescriptor(s, i));
|
|
1004
1010
|
}
|
|
1005
|
-
for (var
|
|
1006
|
-
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(
|
|
1007
|
-
if (
|
|
1008
|
-
|
|
1011
|
+
for (var w = s, U = x.length - 1; U >= 0; U -= c ? 2 : 1) {
|
|
1012
|
+
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) {
|
|
1013
|
+
if (d.v) throw Error("attempted to call addInitializer after decoration was finished");
|
|
1014
|
+
y(S, "An initializer", "be", !0), k.push(S);
|
|
1009
1015
|
}).bind(null, K) };
|
|
1010
1016
|
try {
|
|
1011
|
-
if (W) (l =
|
|
1017
|
+
if (W) (l = y(B.call(G, w, j), "class decorators", "return")) && (w = l);
|
|
1012
1018
|
else {
|
|
1013
1019
|
var D, z;
|
|
1014
|
-
j.static = P, j.private =
|
|
1015
|
-
return h(
|
|
1016
|
-
} : (u < 4 && (D =
|
|
1017
|
-
return
|
|
1018
|
-
}, (u < 2 || u === 4) && (z = function(
|
|
1019
|
-
|
|
1020
|
+
j.static = P, j.private = C, C ? u === 2 ? D = function(d) {
|
|
1021
|
+
return h(d), a.value;
|
|
1022
|
+
} : (u < 4 && (D = f(a, "get", h)), u !== 3 && (z = f(a, "set", h))) : (D = function(d) {
|
|
1023
|
+
return d[i];
|
|
1024
|
+
}, (u < 2 || u === 4) && (z = function(d, S) {
|
|
1025
|
+
d[i] = S;
|
|
1020
1026
|
}));
|
|
1021
|
-
var J = j.access = { has:
|
|
1022
|
-
return i in
|
|
1027
|
+
var J = j.access = { has: C ? m.bind() : function(d) {
|
|
1028
|
+
return i in d;
|
|
1023
1029
|
} };
|
|
1024
|
-
if (D && (J.get = D), z && (J.set = z),
|
|
1025
|
-
if (typeof
|
|
1026
|
-
else if (
|
|
1027
|
-
} else
|
|
1030
|
+
if (D && (J.get = D), z && (J.set = z), w = B.call(G, v ? { get: a.get, set: a.set } : a[b], j), v) {
|
|
1031
|
+
if (typeof w == "object" && w) (l = y(w.get, "accessor.get")) && (a.get = l), (l = y(w.set, "accessor.set")) && (a.set = l), (l = y(w.init, "accessor.init")) && I.push(l);
|
|
1032
|
+
else if (w !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
1033
|
+
} else y(w, (R ? "field" : "method") + " decorators", "return") && (R ? I.push(w) : a[b] = w);
|
|
1028
1034
|
}
|
|
1029
1035
|
} finally {
|
|
1030
1036
|
K.v = !0;
|
|
1031
1037
|
}
|
|
1032
1038
|
}
|
|
1033
|
-
return (R ||
|
|
1034
|
-
for (var N = I.length - 1; N >= 0; N--) S = I[N].call(
|
|
1039
|
+
return (R || v) && L.push(function(d, S) {
|
|
1040
|
+
for (var N = I.length - 1; N >= 0; N--) S = I[N].call(d, S);
|
|
1035
1041
|
return S;
|
|
1036
|
-
}), R || W || (
|
|
1042
|
+
}), R || W || (C ? v ? L.push(f(a, "get"), f(a, "set")) : L.push(u === 2 ? a[b] : f.call.bind(a[b])) : Object.defineProperty(s, i, a)), w;
|
|
1037
1043
|
}
|
|
1038
1044
|
function O(s, o) {
|
|
1039
1045
|
return Object.defineProperty(s, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: o });
|
|
1040
1046
|
}
|
|
1041
|
-
if (arguments.length >= 6) var V =
|
|
1047
|
+
if (arguments.length >= 6) var V = p[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
1042
1048
|
var M = Object.create(V ?? null), H = function(s, o, c, i) {
|
|
1043
|
-
var u, A, k = [], L = function(
|
|
1044
|
-
return Ye(
|
|
1049
|
+
var u, A, k = [], L = function(b) {
|
|
1050
|
+
return Ye(b) === s;
|
|
1045
1051
|
}, P = /* @__PURE__ */ new Map();
|
|
1046
|
-
function
|
|
1047
|
-
|
|
1052
|
+
function C(b) {
|
|
1053
|
+
b && k.push(_.bind(null, b));
|
|
1048
1054
|
}
|
|
1049
1055
|
for (var R = 0; R < o.length; R++) {
|
|
1050
|
-
var
|
|
1051
|
-
if (Array.isArray(
|
|
1052
|
-
var m =
|
|
1056
|
+
var v = o[R];
|
|
1057
|
+
if (Array.isArray(v)) {
|
|
1058
|
+
var m = v[1], h = v[2], l = v.length > 3, x = 16 & m, $ = !!(8 & m), W = (m &= 7) == 0, a = h + "/" + $;
|
|
1053
1059
|
if (!W && !l) {
|
|
1054
1060
|
var I = P.get(a);
|
|
1055
1061
|
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);
|
|
1056
1062
|
P.set(a, !(m > 2) || m);
|
|
1057
1063
|
}
|
|
1058
|
-
T(
|
|
1064
|
+
T($ ? s : s.prototype, v, x, l ? "#" + h : ke(h), m, i, $ ? A = A || [] : u = u || [], k, $, l, W, m === 1, $ && l ? L : c);
|
|
1059
1065
|
}
|
|
1060
1066
|
}
|
|
1061
|
-
return
|
|
1062
|
-
}(
|
|
1063
|
-
return t.length || O(
|
|
1067
|
+
return C(u), C(A), k;
|
|
1068
|
+
}(r, e, g, M);
|
|
1069
|
+
return t.length || O(r, M), { e: H, get c() {
|
|
1064
1070
|
var s = [];
|
|
1065
|
-
return t.length && [O(T(
|
|
1071
|
+
return t.length && [O(T(r, [t], n, r.name, 5, M, s), M), _.bind(null, s, r)];
|
|
1066
1072
|
} };
|
|
1067
1073
|
}
|
|
1068
|
-
function ke(
|
|
1069
|
-
var e = Xe(
|
|
1074
|
+
function ke(r) {
|
|
1075
|
+
var e = Xe(r, "string");
|
|
1070
1076
|
return typeof e == "symbol" ? e : e + "";
|
|
1071
1077
|
}
|
|
1072
|
-
function Xe(
|
|
1073
|
-
if (typeof
|
|
1074
|
-
var t =
|
|
1078
|
+
function Xe(r, e) {
|
|
1079
|
+
if (typeof r != "object" || !r) return r;
|
|
1080
|
+
var t = r[Symbol.toPrimitive];
|
|
1075
1081
|
if (t !== void 0) {
|
|
1076
|
-
var
|
|
1077
|
-
if (typeof
|
|
1082
|
+
var n = t.call(r, e);
|
|
1083
|
+
if (typeof n != "object") return n;
|
|
1078
1084
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1079
1085
|
}
|
|
1080
|
-
return (e === "string" ? String : Number)(
|
|
1086
|
+
return (e === "string" ? String : Number)(r);
|
|
1081
1087
|
}
|
|
1082
|
-
function pe(
|
|
1088
|
+
function pe(r, e, t) {
|
|
1083
1089
|
typeof e == "symbol" && (e = (e = e.description) ? "[" + e + "]" : "");
|
|
1084
1090
|
try {
|
|
1085
|
-
Object.defineProperty(
|
|
1091
|
+
Object.defineProperty(r, "name", { configurable: !0, value: t ? t + " " + e : e });
|
|
1086
1092
|
} catch {
|
|
1087
1093
|
}
|
|
1088
|
-
return
|
|
1094
|
+
return r;
|
|
1089
1095
|
}
|
|
1090
|
-
function Ye(
|
|
1091
|
-
if (Object(
|
|
1092
|
-
return
|
|
1096
|
+
function Ye(r) {
|
|
1097
|
+
if (Object(r) !== r) throw TypeError("right-hand side of 'in' should be an object, got " + (r !== null ? typeof r : "null"));
|
|
1098
|
+
return r;
|
|
1093
1099
|
}
|
|
1094
|
-
function Ze(
|
|
1095
|
-
return
|
|
1100
|
+
function Ze(r) {
|
|
1101
|
+
return r;
|
|
1096
1102
|
}
|
|
1097
1103
|
const ve = ie("WsxLink");
|
|
1098
1104
|
Se = [ce({
|
|
@@ -1101,8 +1107,8 @@ Se = [ce({
|
|
|
1101
1107
|
let me;
|
|
1102
1108
|
new (ge = (se = class extends le {
|
|
1103
1109
|
constructor() {
|
|
1104
|
-
super(), Q(this, "_autoStyles", Je), Q(this, "to", void 0), Q(this, "activeClass", void 0), Q(this, "handleClick", (
|
|
1105
|
-
if (
|
|
1110
|
+
super(), Q(this, "_autoStyles", Je), Q(this, "to", void 0), Q(this, "activeClass", void 0), Q(this, "handleClick", (p) => {
|
|
1111
|
+
if (p.preventDefault(), !this.to) {
|
|
1106
1112
|
ve.warn("No 'to' attribute specified");
|
|
1107
1113
|
return;
|
|
1108
1114
|
}
|
|
@@ -1112,9 +1118,9 @@ new (ge = (se = class extends le {
|
|
|
1112
1118
|
}
|
|
1113
1119
|
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}`);
|
|
1114
1120
|
}), Q(this, "updateActiveState", () => {
|
|
1115
|
-
var
|
|
1116
|
-
const
|
|
1117
|
-
_ && (
|
|
1121
|
+
var y;
|
|
1122
|
+
const p = window.location.pathname, f = this.exact ? p === this.to : p.startsWith(this.to) && this.to !== "/", _ = (y = this.shadowRoot) == null ? void 0 : y.querySelector("a");
|
|
1123
|
+
_ && (f ? (_.classList.add(this.activeClass), this.setAttribute("active", "")) : (_.classList.remove(this.activeClass), this.removeAttribute("active")));
|
|
1118
1124
|
});
|
|
1119
1125
|
const [e, t] = this.useState("to", "");
|
|
1120
1126
|
Object.defineProperty(this, "to", {
|
|
@@ -1123,9 +1129,9 @@ new (ge = (se = class extends le {
|
|
|
1123
1129
|
enumerable: !0,
|
|
1124
1130
|
configurable: !0
|
|
1125
1131
|
});
|
|
1126
|
-
const [
|
|
1132
|
+
const [n, g] = this.useState("activeClass", "active");
|
|
1127
1133
|
Object.defineProperty(this, "activeClass", {
|
|
1128
|
-
get:
|
|
1134
|
+
get: n,
|
|
1129
1135
|
set: g,
|
|
1130
1136
|
enumerable: !0,
|
|
1131
1137
|
configurable: !0
|
|
@@ -1150,19 +1156,19 @@ new (ge = (se = class extends le {
|
|
|
1150
1156
|
var e;
|
|
1151
1157
|
(e = super.onDisconnected) == null || e.call(this), window.removeEventListener("popstate", this.updateActiveState), document.removeEventListener("route-changed", this.updateActiveState);
|
|
1152
1158
|
}
|
|
1153
|
-
onAttributeChanged(e, t,
|
|
1159
|
+
onAttributeChanged(e, t, n) {
|
|
1154
1160
|
switch (e) {
|
|
1155
1161
|
case "to":
|
|
1156
|
-
this.to =
|
|
1162
|
+
this.to = n || "", this.updateActiveState();
|
|
1157
1163
|
break;
|
|
1158
1164
|
case "replace":
|
|
1159
|
-
this.replace =
|
|
1165
|
+
this.replace = n !== null && n !== "false";
|
|
1160
1166
|
break;
|
|
1161
1167
|
case "active-class":
|
|
1162
|
-
this.activeClass =
|
|
1168
|
+
this.activeClass = n || "active", this.updateActiveState();
|
|
1163
1169
|
break;
|
|
1164
1170
|
case "exact":
|
|
1165
|
-
this.exact =
|
|
1171
|
+
this.exact = n !== null && n !== "false", this.updateActiveState();
|
|
1166
1172
|
break;
|
|
1167
1173
|
}
|
|
1168
1174
|
}
|
|
@@ -1178,9 +1184,9 @@ new (ge = (se = class extends le {
|
|
|
1178
1184
|
cancelable: !0
|
|
1179
1185
|
}));
|
|
1180
1186
|
}
|
|
1181
|
-
}, [me,
|
|
1187
|
+
}, [me, de] = Qe(se, [], Se, 0, void 0, le).c, se), oe = class extends Ze {
|
|
1182
1188
|
constructor() {
|
|
1183
|
-
super(me), Q(this, "observedAttributes", ["to", "replace", "active-class", "exact"]),
|
|
1189
|
+
super(me), Q(this, "observedAttributes", ["to", "replace", "active-class", "exact"]), de();
|
|
1184
1190
|
}
|
|
1185
1191
|
}, Q(oe, ge, void 0), oe)();
|
|
1186
1192
|
export {
|