@jasonshimmy/custom-elements-runtime 2.8.2 → 3.1.0
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/README.md +223 -73
- package/dist/css-utils-Cg4o1MqY.js +643 -0
- package/dist/css-utils-Cg4o1MqY.js.map +1 -0
- package/dist/css-utils-RqkyBWft.cjs +576 -0
- package/dist/css-utils-RqkyBWft.cjs.map +1 -0
- package/dist/custom-elements-runtime.cjs.js +3 -3
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.dom-jit-css.cjs.js +7 -0
- package/dist/custom-elements-runtime.dom-jit-css.cjs.js.map +1 -0
- package/dist/custom-elements-runtime.dom-jit-css.es.js +136 -0
- package/dist/custom-elements-runtime.dom-jit-css.es.js.map +1 -0
- package/dist/custom-elements-runtime.es.js +105 -97
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.event-bus.cjs.js +1 -1
- package/dist/custom-elements-runtime.event-bus.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.event-bus.es.js +62 -46
- package/dist/custom-elements-runtime.event-bus.es.js.map +1 -1
- package/dist/custom-elements-runtime.jit-css.cjs.js +2 -0
- package/dist/custom-elements-runtime.jit-css.cjs.js.map +1 -0
- package/dist/custom-elements-runtime.jit-css.es.js +37 -0
- package/dist/custom-elements-runtime.jit-css.es.js.map +1 -0
- package/dist/custom-elements-runtime.router.cjs.js +20 -20
- package/dist/custom-elements-runtime.router.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.router.es.js +472 -458
- package/dist/custom-elements-runtime.router.es.js.map +1 -1
- package/dist/custom-elements-runtime.ssr-middleware.cjs.js +2 -0
- package/dist/custom-elements-runtime.ssr-middleware.cjs.js.map +1 -0
- package/dist/custom-elements-runtime.ssr-middleware.es.js +63 -0
- package/dist/custom-elements-runtime.ssr-middleware.es.js.map +1 -0
- package/dist/custom-elements-runtime.ssr.cjs.js +3 -1
- package/dist/custom-elements-runtime.ssr.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.ssr.es.js +137 -24
- package/dist/custom-elements-runtime.ssr.es.js.map +1 -1
- package/dist/custom-elements-runtime.store.cjs.js +1 -1
- package/dist/custom-elements-runtime.store.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.store.es.js +21 -16
- package/dist/custom-elements-runtime.store.es.js.map +1 -1
- package/dist/custom-elements-runtime.transitions.cjs.js +1 -1
- package/dist/custom-elements-runtime.transitions.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.transitions.es.js +279 -7
- package/dist/custom-elements-runtime.transitions.es.js.map +1 -1
- package/dist/custom-elements-runtime.vite-plugin.cjs.js +2 -0
- package/dist/custom-elements-runtime.vite-plugin.cjs.js.map +1 -0
- package/dist/custom-elements-runtime.vite-plugin.es.js +105 -0
- package/dist/custom-elements-runtime.vite-plugin.es.js.map +1 -0
- package/dist/dom-jit-css.d.ts +66 -0
- package/dist/event-bus.d.ts +3 -1
- package/dist/hooks-B50HhrHh.cjs +6 -0
- package/dist/hooks-B50HhrHh.cjs.map +1 -0
- package/dist/hooks-Cze3o-F7.js +1462 -0
- package/dist/hooks-Cze3o-F7.js.map +1 -0
- package/dist/index.d.ts +6 -3
- package/dist/jit-css.d.ts +30 -0
- package/dist/namespace-helpers-D4wC2-qA.js +61 -0
- package/dist/namespace-helpers-D4wC2-qA.js.map +1 -0
- package/dist/namespace-helpers-ckeEOxpR.cjs +2 -0
- package/dist/namespace-helpers-ckeEOxpR.cjs.map +1 -0
- package/dist/router/matcher.d.ts +14 -0
- package/dist/router/types.d.ts +4 -2
- package/dist/runtime/component/factory.d.ts +16 -2
- package/dist/runtime/css-utils.d.ts +33 -0
- package/dist/runtime/discovery-state.d.ts +3 -0
- package/dist/runtime/hooks.d.ts +78 -0
- package/dist/runtime/hydration.d.ts +33 -0
- package/dist/runtime/jit-hooks.d.ts +28 -0
- package/dist/runtime/render-bridge.d.ts +37 -0
- package/dist/runtime/scheduler.d.ts +3 -4
- package/dist/runtime/secure-expression-evaluator.d.ts +0 -1
- package/dist/runtime/ssr-context.d.ts +45 -0
- package/dist/runtime/style.d.ts +84 -26
- package/dist/runtime/template-compiler/lru-cache.d.ts +0 -3
- package/dist/runtime/types.d.ts +18 -0
- package/dist/runtime/vdom-helpers.d.ts +0 -1
- package/dist/runtime/vdom-ssr-dsd.d.ts +58 -0
- package/dist/ssr-middleware.d.ts +125 -0
- package/dist/ssr.d.ts +120 -16
- package/dist/{transitions-DMJXs_tY.js → style-BmyOIMcU.js} +904 -1344
- package/dist/style-BmyOIMcU.js.map +1 -0
- package/dist/style-D40DsIqJ.cjs +55 -0
- package/dist/style-D40DsIqJ.cjs.map +1 -0
- package/dist/style.css +1 -1
- package/dist/template-compiler-Cshhqxyd.cjs +23 -0
- package/dist/template-compiler-Cshhqxyd.cjs.map +1 -0
- package/dist/template-compiler-DtpNsqE-.js +3744 -0
- package/dist/template-compiler-DtpNsqE-.js.map +1 -0
- package/dist/variables.css +1 -1
- package/dist/vite-plugin.d.ts +142 -0
- package/package.json +60 -6
- package/dist/namespace-helpers-Ctd_h7j2.cjs +0 -5
- package/dist/namespace-helpers-Ctd_h7j2.cjs.map +0 -1
- package/dist/namespace-helpers-DhLBqt-7.js +0 -1009
- package/dist/namespace-helpers-DhLBqt-7.js.map +0 -1
- package/dist/template-compiler-Bvx02nAT.js +0 -4020
- package/dist/template-compiler-Bvx02nAT.js.map +0 -1
- package/dist/template-compiler-bj-MFC_Y.cjs +0 -23
- package/dist/template-compiler-bj-MFC_Y.cjs.map +0 -1
- package/dist/transitions-DMJXs_tY.js.map +0 -1
- package/dist/transitions-f4KfN29T.cjs +0 -330
- package/dist/transitions-f4KfN29T.cjs.map +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import { c as
|
|
4
|
-
import { createStore as
|
|
5
|
-
import { match as
|
|
6
|
-
const
|
|
1
|
+
import { a as g, d as q } from "./logger-BvkEbVM4.js";
|
|
2
|
+
import { j as nt, r as et, w as it, x as lt, b as St, z as Rt, d as I } from "./hooks-Cze3o-F7.js";
|
|
3
|
+
import { c as ut, h as U } from "./template-compiler-DtpNsqE-.js";
|
|
4
|
+
import { createStore as ft } from "./custom-elements-runtime.store.es.js";
|
|
5
|
+
import { match as $t } from "./custom-elements-runtime.directives.es.js";
|
|
6
|
+
const ht = {
|
|
7
7
|
enabled: !0,
|
|
8
8
|
offset: 0,
|
|
9
9
|
timeoutMs: 2e3
|
|
10
|
-
},
|
|
10
|
+
}, st = (t) => t ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(t)) : {}, Et = (t) => {
|
|
11
11
|
if (!t || Object.keys(t).length === 0) return "";
|
|
12
12
|
try {
|
|
13
13
|
return "?" + new URLSearchParams(t).toString();
|
|
14
14
|
} catch {
|
|
15
15
|
return "";
|
|
16
16
|
}
|
|
17
|
-
},
|
|
17
|
+
}, pt = (t) => t ? /^\s*javascript\s*:/i.test(t) : !1, Z = (t) => /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t) || t.startsWith("//"), Ct = (t) => {
|
|
18
18
|
try {
|
|
19
19
|
return decodeURIComponent(t);
|
|
20
20
|
} catch {
|
|
@@ -26,194 +26,195 @@ function C(t) {
|
|
|
26
26
|
let r = t.replace(/\/+/g, "/");
|
|
27
27
|
return r.startsWith("/") || (r = "/" + r), r.length > 1 && r.endsWith("/") && (r = r.slice(0, -1)), r;
|
|
28
28
|
}
|
|
29
|
-
const
|
|
29
|
+
const At = (t) => {
|
|
30
30
|
if (!t) return "";
|
|
31
31
|
const r = C(t);
|
|
32
32
|
return r === "/" ? "" : r;
|
|
33
|
-
},
|
|
34
|
-
function
|
|
33
|
+
}, dt = /* @__PURE__ */ new WeakMap();
|
|
34
|
+
function xt(t) {
|
|
35
35
|
return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
const r = t.path || "/",
|
|
39
|
-
for (let
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
if (
|
|
43
|
-
return
|
|
37
|
+
function Pt(t) {
|
|
38
|
+
const r = t.path || "/", d = C(r), a = d === "/" ? [] : d.split("/").filter(Boolean), c = [], o = [];
|
|
39
|
+
for (let i = 0; i < a.length; i++) {
|
|
40
|
+
const l = a[i];
|
|
41
|
+
if (l === "*") {
|
|
42
|
+
if (i !== a.length - 1)
|
|
43
|
+
return g(
|
|
44
44
|
`Route '${t.path}' contains a '*' splat in a non-terminal position; splats must be the last segment. This route will be ignored.`
|
|
45
45
|
), { invalid: !0 };
|
|
46
|
-
const A = `splat${
|
|
47
|
-
|
|
46
|
+
const A = `splat${c.length}`;
|
|
47
|
+
c.push(A), o.push("__SPLAT__");
|
|
48
48
|
continue;
|
|
49
49
|
}
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
const A =
|
|
53
|
-
if (
|
|
54
|
-
return
|
|
50
|
+
const y = l.match(/^:([A-Za-z0-9_-]+)(\*)?$/);
|
|
51
|
+
if (y) {
|
|
52
|
+
const A = y[1], x = !!y[2];
|
|
53
|
+
if (x && i !== a.length - 1)
|
|
54
|
+
return g(
|
|
55
55
|
`Route '${t.path}' contains a splat param ':${A}*' in a non-terminal position; splats must be the last segment. This route will be ignored.`
|
|
56
56
|
), { invalid: !0 };
|
|
57
|
-
|
|
57
|
+
c.push(A), o.push(x ? "__SPLAT__" : "([^/]+)");
|
|
58
58
|
continue;
|
|
59
59
|
}
|
|
60
|
-
o.push(
|
|
60
|
+
o.push(xt(l));
|
|
61
61
|
}
|
|
62
|
-
let
|
|
62
|
+
let w;
|
|
63
63
|
if (o.length === 0)
|
|
64
|
-
|
|
64
|
+
w = "^/$";
|
|
65
65
|
else if (o[o.length - 1] === "__SPLAT__") {
|
|
66
|
-
const
|
|
67
|
-
|
|
66
|
+
const l = o.slice(0, -1).join("/");
|
|
67
|
+
l ? w = `^/${l}(?:/(.*))?(?:/)?$` : w = "^(?:/(.*))?(?:/)?$";
|
|
68
68
|
} else
|
|
69
|
-
|
|
69
|
+
w = `^/${o.join("/")}(?:/)?$`;
|
|
70
70
|
try {
|
|
71
|
-
return { regex: new RegExp(
|
|
72
|
-
} catch (
|
|
73
|
-
return
|
|
71
|
+
return { regex: new RegExp(w), paramNames: c };
|
|
72
|
+
} catch (i) {
|
|
73
|
+
return g(`Failed to compile route regex for '${t.path}': ${String(i)}`), { invalid: !0 };
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
const Q = (t, r) => {
|
|
77
|
-
const
|
|
77
|
+
const d = C(r);
|
|
78
78
|
for (const a of t) {
|
|
79
|
-
let
|
|
80
|
-
if (
|
|
81
|
-
const { regex: o, paramNames:
|
|
82
|
-
if (
|
|
83
|
-
const
|
|
84
|
-
for (let
|
|
85
|
-
const A =
|
|
86
|
-
|
|
79
|
+
let c = dt.get(a);
|
|
80
|
+
if (c || (c = Pt(a), dt.set(a, c)), c.invalid) continue;
|
|
81
|
+
const { regex: o, paramNames: w } = c, i = o.exec(d);
|
|
82
|
+
if (i) {
|
|
83
|
+
const l = {};
|
|
84
|
+
for (let y = 0; y < w.length; y++) {
|
|
85
|
+
const A = i[y + 1] || "";
|
|
86
|
+
l[w[y]] = A ? Ct(A) : "";
|
|
87
87
|
}
|
|
88
|
-
return { route: a, params:
|
|
88
|
+
return { route: a, params: l };
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
return { route: null, params: {} };
|
|
92
92
|
};
|
|
93
|
-
function
|
|
94
|
-
for (const
|
|
95
|
-
if (Q([
|
|
93
|
+
function rt(t, r) {
|
|
94
|
+
for (const d of t)
|
|
95
|
+
if (Q([d], r).route !== null) return d;
|
|
96
96
|
return null;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
|
|
98
|
+
function Ut(t, r) {
|
|
99
|
+
const d = r.split("?")[0].split("#")[0];
|
|
100
|
+
return Q(t, d);
|
|
100
101
|
}
|
|
101
|
-
const
|
|
102
|
-
let J = {},
|
|
103
|
-
function
|
|
104
|
-
J = {},
|
|
102
|
+
const yt = 50;
|
|
103
|
+
let J = {}, B = {};
|
|
104
|
+
function kt() {
|
|
105
|
+
J = {}, B = {};
|
|
105
106
|
}
|
|
106
|
-
function
|
|
107
|
+
function _t() {
|
|
107
108
|
const t = Object.entries(J);
|
|
108
|
-
if (t.length <=
|
|
109
|
-
const
|
|
110
|
-
([, a], [,
|
|
109
|
+
if (t.length <= yt) return;
|
|
110
|
+
const d = t.sort(
|
|
111
|
+
([, a], [, c]) => a.lastAccessed - c.lastAccessed
|
|
111
112
|
).slice(
|
|
112
113
|
0,
|
|
113
|
-
t.length -
|
|
114
|
+
t.length - yt
|
|
114
115
|
);
|
|
115
|
-
for (const [a] of
|
|
116
|
+
for (const [a] of d)
|
|
116
117
|
delete J[a];
|
|
117
118
|
}
|
|
118
|
-
async function
|
|
119
|
+
async function qt(t) {
|
|
119
120
|
if (t.component) return t.component;
|
|
120
121
|
if (t.load) {
|
|
121
122
|
const r = J[t.path];
|
|
122
123
|
if (r)
|
|
123
124
|
return r.lastAccessed = Date.now(), r.component;
|
|
124
|
-
if (
|
|
125
|
-
return
|
|
126
|
-
const
|
|
125
|
+
if (B[t.path] !== void 0)
|
|
126
|
+
return B[t.path];
|
|
127
|
+
const d = typeof window > "u";
|
|
127
128
|
try {
|
|
128
|
-
const a = t.load().then((
|
|
129
|
-
|
|
130
|
-
const o =
|
|
129
|
+
const a = t.load().then((c) => {
|
|
130
|
+
_t();
|
|
131
|
+
const o = c.default;
|
|
131
132
|
return J[t.path] = {
|
|
132
133
|
component: o,
|
|
133
134
|
lastAccessed: Date.now()
|
|
134
|
-
}, delete
|
|
135
|
-
}).catch((
|
|
136
|
-
delete
|
|
137
|
-
const o =
|
|
138
|
-
throw
|
|
135
|
+
}, delete B[t.path], o;
|
|
136
|
+
}).catch((c) => {
|
|
137
|
+
delete B[t.path];
|
|
138
|
+
const o = c instanceof Error ? c.message : String(c);
|
|
139
|
+
throw d && q(
|
|
139
140
|
`SSR component load failed for route: ${t.path}. ${o}`
|
|
140
141
|
), new Error(
|
|
141
142
|
`Failed to load component for route: ${t.path}. ${o}`
|
|
142
143
|
);
|
|
143
144
|
});
|
|
144
|
-
return
|
|
145
|
+
return B[t.path] = a, await a;
|
|
145
146
|
} catch (a) {
|
|
146
|
-
const
|
|
147
|
+
const c = a instanceof Error ? a.message : String(a);
|
|
147
148
|
throw new Error(
|
|
148
|
-
`Failed to load component for route: ${t.path}. ${
|
|
149
|
+
`Failed to load component for route: ${t.path}. ${c}`,
|
|
149
150
|
{ cause: a }
|
|
150
151
|
);
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
throw new Error(`No component or loader defined for route: ${t.path}`);
|
|
154
155
|
}
|
|
155
|
-
let
|
|
156
|
-
function
|
|
157
|
-
|
|
156
|
+
let m = null;
|
|
157
|
+
function Tt(t) {
|
|
158
|
+
m = t;
|
|
158
159
|
}
|
|
159
|
-
function
|
|
160
|
-
return
|
|
160
|
+
function mt() {
|
|
161
|
+
return m;
|
|
161
162
|
}
|
|
162
|
-
const
|
|
163
|
-
let
|
|
164
|
-
function
|
|
165
|
-
if (
|
|
163
|
+
const K = /* @__PURE__ */ new Set();
|
|
164
|
+
let z = null;
|
|
165
|
+
function bt() {
|
|
166
|
+
if (z) {
|
|
166
167
|
try {
|
|
167
|
-
|
|
168
|
+
z();
|
|
168
169
|
} catch {
|
|
169
170
|
}
|
|
170
|
-
|
|
171
|
+
z = null;
|
|
171
172
|
}
|
|
172
|
-
if (
|
|
173
|
+
if (m)
|
|
173
174
|
try {
|
|
174
175
|
let t = !1;
|
|
175
|
-
|
|
176
|
+
z = m.subscribe((r) => {
|
|
176
177
|
t = !0;
|
|
177
|
-
for (const
|
|
178
|
+
for (const d of K)
|
|
178
179
|
try {
|
|
179
|
-
|
|
180
|
+
d(r);
|
|
180
181
|
} catch {
|
|
181
182
|
}
|
|
182
183
|
});
|
|
183
184
|
try {
|
|
184
|
-
E.base =
|
|
185
|
+
E.base = m.base;
|
|
185
186
|
} catch {
|
|
186
187
|
}
|
|
187
188
|
if (t) {
|
|
188
|
-
const r =
|
|
189
|
-
for (const
|
|
189
|
+
const r = m.getCurrent();
|
|
190
|
+
for (const d of K)
|
|
190
191
|
try {
|
|
191
|
-
|
|
192
|
+
d(r);
|
|
192
193
|
} catch {
|
|
193
194
|
}
|
|
194
195
|
} else {
|
|
195
|
-
const r =
|
|
196
|
-
for (const
|
|
196
|
+
const r = m.getCurrent();
|
|
197
|
+
for (const d of K)
|
|
197
198
|
try {
|
|
198
|
-
|
|
199
|
+
d(r);
|
|
199
200
|
} catch {
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
203
|
try {
|
|
203
|
-
typeof window < "u" &&
|
|
204
|
+
typeof window < "u" && nt();
|
|
204
205
|
} catch {
|
|
205
206
|
}
|
|
206
207
|
} catch {
|
|
207
|
-
|
|
208
|
+
z = null;
|
|
208
209
|
}
|
|
209
210
|
}
|
|
210
|
-
function
|
|
211
|
-
|
|
211
|
+
function It() {
|
|
212
|
+
bt();
|
|
212
213
|
}
|
|
213
214
|
const E = {
|
|
214
215
|
store: {
|
|
215
216
|
subscribe(t) {
|
|
216
|
-
if (
|
|
217
|
+
if (m) return m.store.subscribe(t);
|
|
217
218
|
try {
|
|
218
219
|
t({ path: "/", params: {}, query: {} });
|
|
219
220
|
} catch {
|
|
@@ -222,12 +223,12 @@ const E = {
|
|
|
222
223
|
};
|
|
223
224
|
},
|
|
224
225
|
getState() {
|
|
225
|
-
return
|
|
226
|
+
return m ? m.getCurrent() : { path: "/", params: {}, query: {} };
|
|
226
227
|
},
|
|
227
228
|
setState(t) {
|
|
228
|
-
if (
|
|
229
|
+
if (m)
|
|
229
230
|
try {
|
|
230
|
-
|
|
231
|
+
m.store.setState(
|
|
231
232
|
t
|
|
232
233
|
);
|
|
233
234
|
} catch {
|
|
@@ -236,133 +237,140 @@ const E = {
|
|
|
236
237
|
},
|
|
237
238
|
subscribe(t) {
|
|
238
239
|
if (typeof t != "function")
|
|
239
|
-
return
|
|
240
|
+
return g("activeRouterProxy.subscribe: listener must be a function"), () => {
|
|
240
241
|
};
|
|
241
|
-
if (
|
|
242
|
-
if (!
|
|
243
|
-
|
|
242
|
+
if (K.add(t), m)
|
|
243
|
+
if (!z)
|
|
244
|
+
bt();
|
|
244
245
|
else
|
|
245
246
|
try {
|
|
246
|
-
const r =
|
|
247
|
+
const r = m.getCurrent();
|
|
247
248
|
r && t(r);
|
|
248
249
|
} catch (r) {
|
|
249
|
-
|
|
250
|
+
g("activeRouterProxy subscription failed", r);
|
|
250
251
|
}
|
|
251
252
|
else
|
|
252
253
|
try {
|
|
253
254
|
t({ path: "/", params: {}, query: {} });
|
|
254
255
|
} catch (r) {
|
|
255
|
-
|
|
256
|
+
g("activeRouterProxy fallback state delivery failed", r);
|
|
256
257
|
}
|
|
257
258
|
return () => {
|
|
258
259
|
try {
|
|
259
|
-
if (
|
|
260
|
+
if (K.delete(t), K.size === 0 && z) {
|
|
260
261
|
try {
|
|
261
|
-
|
|
262
|
+
z();
|
|
262
263
|
} catch (r) {
|
|
263
|
-
|
|
264
|
+
g("activeRouterProxy inner unsubscribe failed", r);
|
|
264
265
|
}
|
|
265
|
-
|
|
266
|
+
z = null;
|
|
266
267
|
}
|
|
267
268
|
} catch (r) {
|
|
268
|
-
|
|
269
|
+
g("activeRouterProxy unsubscribe failed", r);
|
|
269
270
|
}
|
|
270
271
|
};
|
|
271
272
|
},
|
|
272
273
|
getCurrent() {
|
|
273
|
-
return
|
|
274
|
+
return m ? m.getCurrent() : { path: "/", params: {}, query: {} };
|
|
274
275
|
},
|
|
275
276
|
async push(t) {
|
|
276
|
-
return
|
|
277
|
+
return m ? m.push(t) : Promise.resolve();
|
|
277
278
|
},
|
|
278
279
|
async replace(t) {
|
|
279
|
-
return
|
|
280
|
+
return m ? m.replace(t) : Promise.resolve();
|
|
280
281
|
},
|
|
281
282
|
back() {
|
|
282
|
-
if (
|
|
283
|
-
return
|
|
283
|
+
if (m)
|
|
284
|
+
return m.back();
|
|
284
285
|
},
|
|
285
286
|
matchRoute(t) {
|
|
286
|
-
return
|
|
287
|
+
return m ? m.matchRoute(t) : { route: null, params: {} };
|
|
287
288
|
},
|
|
288
289
|
resolveRouteComponent(t) {
|
|
289
|
-
return
|
|
290
|
+
return m ? m.resolveRouteComponent(t) : Promise.reject(new Error("No active router"));
|
|
290
291
|
},
|
|
291
292
|
base: "",
|
|
292
293
|
scrollToFragment(t) {
|
|
293
|
-
return
|
|
294
|
+
return m ? m.scrollToFragment(t) : Promise.resolve(!1);
|
|
295
|
+
},
|
|
296
|
+
destroy() {
|
|
297
|
+
m && m.destroy();
|
|
294
298
|
}
|
|
295
299
|
};
|
|
296
|
-
function
|
|
297
|
-
const { routes: r, base:
|
|
298
|
-
let
|
|
299
|
-
|
|
300
|
+
function Mt(t) {
|
|
301
|
+
const { routes: r, base: d = "", initialUrl: a, scrollToFragment: c = !0 } = t, o = At(d), w = typeof c == "boolean" ? { ...ht, enabled: c } : { ...ht, ...c };
|
|
302
|
+
let i, l, y, A, x, F, V, X = () => {
|
|
303
|
+
};
|
|
304
|
+
const T = /* @__PURE__ */ new Set(), j = 10;
|
|
300
305
|
let k = 0;
|
|
301
|
-
const
|
|
302
|
-
const e =
|
|
306
|
+
const G = async (s, u) => {
|
|
307
|
+
const e = rt(r, s.path);
|
|
303
308
|
if (!e || !e.beforeEnter) return !0;
|
|
304
309
|
try {
|
|
305
|
-
const n = await e.beforeEnter(s,
|
|
310
|
+
const n = await e.beforeEnter(s, u);
|
|
306
311
|
if (typeof n == "string") {
|
|
307
|
-
const
|
|
308
|
-
return
|
|
312
|
+
const h = `${s.path}->${n}`;
|
|
313
|
+
return T.has(h) || k >= j ? (q(`Redirect loop detected: ${h}`), !1) : n;
|
|
309
314
|
}
|
|
310
315
|
return n !== !1;
|
|
311
316
|
} catch (n) {
|
|
312
|
-
|
|
317
|
+
q("beforeEnter error", n);
|
|
313
318
|
try {
|
|
314
|
-
|
|
319
|
+
y.setState(u);
|
|
315
320
|
} catch {
|
|
316
321
|
}
|
|
317
322
|
throw n;
|
|
318
323
|
}
|
|
319
|
-
},
|
|
320
|
-
const e =
|
|
324
|
+
}, at = async (s, u) => {
|
|
325
|
+
const e = rt(r, s.path);
|
|
321
326
|
if (!e || !e.onEnter) return !0;
|
|
322
327
|
try {
|
|
323
|
-
const n = await e.onEnter(s,
|
|
328
|
+
const n = await e.onEnter(s, u);
|
|
324
329
|
if (typeof n == "string") {
|
|
325
|
-
const
|
|
326
|
-
return
|
|
330
|
+
const h = `${s.path}->${n}`;
|
|
331
|
+
return T.has(h) || k >= j ? (q(`Redirect loop detected: ${h}`), !1) : n;
|
|
327
332
|
}
|
|
328
333
|
return n !== !1;
|
|
329
334
|
} catch (n) {
|
|
330
|
-
|
|
335
|
+
q("onEnter error", n);
|
|
331
336
|
try {
|
|
332
|
-
|
|
337
|
+
y.setState(u);
|
|
333
338
|
} catch {
|
|
334
339
|
}
|
|
335
340
|
throw n;
|
|
336
341
|
}
|
|
337
|
-
},
|
|
338
|
-
const e =
|
|
342
|
+
}, Y = (s, u) => {
|
|
343
|
+
const e = rt(r, s.path);
|
|
339
344
|
if (!(!e || !e.afterEnter))
|
|
340
345
|
try {
|
|
341
|
-
e.afterEnter(s,
|
|
346
|
+
const n = e.afterEnter(s, u);
|
|
347
|
+
n instanceof Promise && n.catch((h) => {
|
|
348
|
+
q("afterEnter async error", h);
|
|
349
|
+
});
|
|
342
350
|
} catch (n) {
|
|
343
|
-
|
|
351
|
+
q("afterEnter error", n);
|
|
344
352
|
}
|
|
345
|
-
},
|
|
346
|
-
if (
|
|
347
|
-
return
|
|
348
|
-
const
|
|
349
|
-
if (
|
|
350
|
-
const e = Math.floor(
|
|
351
|
-
for (let
|
|
352
|
-
|
|
353
|
+
}, P = /* @__PURE__ */ new Map(), W = 100, M = (s) => {
|
|
354
|
+
if (P.has(s))
|
|
355
|
+
return P.get(s);
|
|
356
|
+
const u = Q(r, s);
|
|
357
|
+
if (P.size >= W) {
|
|
358
|
+
const e = Math.floor(W * 0.25), n = Array.from(P.keys());
|
|
359
|
+
for (let h = 0; h < e && h < n.length; h++)
|
|
360
|
+
P.delete(n[h]);
|
|
353
361
|
}
|
|
354
|
-
return
|
|
355
|
-
},
|
|
362
|
+
return P.set(s, u), u;
|
|
363
|
+
}, tt = () => {
|
|
356
364
|
};
|
|
357
|
-
async function
|
|
365
|
+
async function p(s, u = 0) {
|
|
358
366
|
try {
|
|
359
367
|
const e = document.getElementById(s);
|
|
360
368
|
if (!e)
|
|
361
369
|
return !1;
|
|
362
|
-
if (
|
|
370
|
+
if (u > 0)
|
|
363
371
|
try {
|
|
364
|
-
const n = e.getBoundingClientRect(),
|
|
365
|
-
typeof window.scrollTo == "function" && window.scrollTo({ top:
|
|
372
|
+
const n = e.getBoundingClientRect(), h = Math.max(0, window.scrollY + n.top - u);
|
|
373
|
+
typeof window.scrollTo == "function" && window.scrollTo({ top: h, behavior: "auto" });
|
|
366
374
|
} catch {
|
|
367
375
|
try {
|
|
368
376
|
e.scrollIntoView();
|
|
@@ -389,120 +397,120 @@ function Tt(t) {
|
|
|
389
397
|
return !1;
|
|
390
398
|
}
|
|
391
399
|
}
|
|
392
|
-
function
|
|
400
|
+
function R(s, u = 0, e = 2e3) {
|
|
393
401
|
return new Promise((n) => {
|
|
394
|
-
let
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
},
|
|
398
|
-
if (!
|
|
402
|
+
let h = !1, v = null, b = null;
|
|
403
|
+
const $ = Date.now(), S = (N) => {
|
|
404
|
+
h || (h = !0, v && clearTimeout(v), b !== null && cancelAnimationFrame(b), n(N));
|
|
405
|
+
}, D = async () => {
|
|
406
|
+
if (!h)
|
|
399
407
|
try {
|
|
400
|
-
if (await
|
|
408
|
+
if (await p(s, u))
|
|
401
409
|
return S(!0);
|
|
402
|
-
const
|
|
403
|
-
if (
|
|
404
|
-
if (Date.now() -
|
|
410
|
+
const N = async () => {
|
|
411
|
+
if (h) return;
|
|
412
|
+
if (Date.now() - $ >= e)
|
|
405
413
|
return S(!1);
|
|
406
414
|
try {
|
|
407
|
-
if (await
|
|
415
|
+
if (await p(s, u))
|
|
408
416
|
return S(!0);
|
|
409
|
-
requestAnimationFrame(
|
|
410
|
-
} catch (
|
|
411
|
-
|
|
417
|
+
b = requestAnimationFrame(N);
|
|
418
|
+
} catch (wt) {
|
|
419
|
+
g("Scroll retry attempt failed:", wt), b = requestAnimationFrame(N);
|
|
412
420
|
}
|
|
413
421
|
};
|
|
414
|
-
requestAnimationFrame(
|
|
415
|
-
} catch (
|
|
416
|
-
|
|
422
|
+
b = requestAnimationFrame(N);
|
|
423
|
+
} catch (N) {
|
|
424
|
+
g("Initial scroll attempt failed:", N), S(!1);
|
|
417
425
|
}
|
|
418
426
|
};
|
|
419
|
-
|
|
427
|
+
v = setTimeout(() => {
|
|
420
428
|
S(!1);
|
|
421
|
-
}, e),
|
|
422
|
-
|
|
429
|
+
}, e), D().catch((N) => {
|
|
430
|
+
g("Scroll attempt failed:", N), S(!1);
|
|
423
431
|
});
|
|
424
432
|
});
|
|
425
433
|
}
|
|
426
|
-
let
|
|
427
|
-
const
|
|
428
|
-
if (
|
|
429
|
-
|
|
434
|
+
let f = !1;
|
|
435
|
+
const _ = async (s, u = !1) => {
|
|
436
|
+
if (f) {
|
|
437
|
+
g(`Navigation to ${s} blocked - navigation already in progress`);
|
|
430
438
|
return;
|
|
431
439
|
}
|
|
432
|
-
|
|
440
|
+
f = !0, k = 0, T.clear();
|
|
433
441
|
try {
|
|
434
|
-
await
|
|
442
|
+
await L(s, u);
|
|
435
443
|
} finally {
|
|
436
|
-
|
|
444
|
+
f = !1, k = 0, T.clear();
|
|
437
445
|
}
|
|
438
|
-
},
|
|
439
|
-
const
|
|
446
|
+
}, O = (s) => {
|
|
447
|
+
const u = s.indexOf("#"), e = u >= 0 ? s.slice(u + 1) : "", n = u >= 0 ? s.slice(0, u) : s, h = n.indexOf("?"), v = h >= 0 ? n.slice(0, h) : n, b = h >= 0 ? st(n.slice(h)) : {}, $ = v.startsWith(o) ? v.slice(o.length) : v;
|
|
440
448
|
return {
|
|
441
|
-
path: C(
|
|
442
|
-
query:
|
|
449
|
+
path: C($ || "/"),
|
|
450
|
+
query: b,
|
|
443
451
|
fragment: e
|
|
444
452
|
};
|
|
445
|
-
},
|
|
453
|
+
}, L = async (s, u = !1) => {
|
|
446
454
|
try {
|
|
447
|
-
const e =
|
|
455
|
+
const e = O(s), n = M(e.path);
|
|
448
456
|
if (!n.route) throw new Error(`No route found for ${e.path}`);
|
|
449
|
-
const
|
|
457
|
+
const h = y.getState(), v = {
|
|
450
458
|
path: e.path,
|
|
451
459
|
params: n.params,
|
|
452
460
|
query: e.query,
|
|
453
461
|
fragment: e.fragment
|
|
454
|
-
},
|
|
455
|
-
if (
|
|
456
|
-
if (typeof
|
|
462
|
+
}, b = await G(v, h);
|
|
463
|
+
if (b === !1) return;
|
|
464
|
+
if (typeof b == "string") {
|
|
457
465
|
k++;
|
|
458
|
-
const
|
|
459
|
-
|
|
466
|
+
const S = `${v.path}->${b}`;
|
|
467
|
+
T.add(S), await L(b, !0);
|
|
460
468
|
return;
|
|
461
469
|
}
|
|
462
|
-
const
|
|
463
|
-
if (
|
|
464
|
-
if (typeof
|
|
470
|
+
const $ = await at(v, h);
|
|
471
|
+
if ($ === !1) return;
|
|
472
|
+
if (typeof $ == "string") {
|
|
465
473
|
k++;
|
|
466
|
-
const
|
|
467
|
-
|
|
474
|
+
const S = `${v.path}->${$}`;
|
|
475
|
+
T.add(S), await L($, !0);
|
|
468
476
|
return;
|
|
469
477
|
}
|
|
470
478
|
if (typeof window < "u" && typeof document < "u") {
|
|
471
|
-
const
|
|
472
|
-
|
|
479
|
+
const S = Et(e.query), D = o + e.path + (S || "") + (e.fragment ? "#" + e.fragment : "");
|
|
480
|
+
u ? window.history.replaceState({}, "", D) : window.history.pushState({}, "", D);
|
|
473
481
|
}
|
|
474
|
-
if (
|
|
482
|
+
if (y.setState(v), Y(v, h), typeof window < "u" && typeof document < "u")
|
|
475
483
|
try {
|
|
476
|
-
const
|
|
477
|
-
|
|
478
|
-
String(
|
|
479
|
-
|
|
480
|
-
|
|
484
|
+
const S = v.fragment;
|
|
485
|
+
w.enabled && S && R(
|
|
486
|
+
String(S),
|
|
487
|
+
w.offset,
|
|
488
|
+
w.timeoutMs
|
|
481
489
|
).catch(() => {
|
|
482
490
|
});
|
|
483
491
|
} catch {
|
|
484
492
|
}
|
|
485
493
|
} catch (e) {
|
|
486
|
-
if (
|
|
494
|
+
if (q("Navigation error:", e), e instanceof Error && (e.stack?.includes("runBeforeEnter") || e.stack?.includes("runOnEnter")))
|
|
487
495
|
throw e;
|
|
488
496
|
try {
|
|
489
|
-
const n =
|
|
497
|
+
const n = y.getState();
|
|
490
498
|
if (!Q(r, n.path).route) {
|
|
491
|
-
let
|
|
492
|
-
if (
|
|
493
|
-
(
|
|
494
|
-
)), !
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
-
path:
|
|
498
|
-
params:
|
|
499
|
+
let v = r.find((b) => b.path === "/");
|
|
500
|
+
if (v || (v = r.find(
|
|
501
|
+
(b) => !b.path.includes(":") && !b.path.includes("*")
|
|
502
|
+
)), !v && r.length > 0 && (v = r[0]), v) {
|
|
503
|
+
const b = Q(r, v.path);
|
|
504
|
+
y.setState({
|
|
505
|
+
path: v.path,
|
|
506
|
+
params: b.params,
|
|
499
507
|
query: {}
|
|
500
508
|
});
|
|
501
509
|
} else
|
|
502
|
-
|
|
510
|
+
q("No fallback route available for error recovery");
|
|
503
511
|
}
|
|
504
512
|
} catch (n) {
|
|
505
|
-
|
|
513
|
+
g(
|
|
506
514
|
"State recovery failed during navigation error:",
|
|
507
515
|
n
|
|
508
516
|
);
|
|
@@ -511,144 +519,150 @@ function Tt(t) {
|
|
|
511
519
|
};
|
|
512
520
|
if (((s) => {
|
|
513
521
|
if (!s || s.length === 0)
|
|
514
|
-
return
|
|
515
|
-
const
|
|
522
|
+
return q("Router configuration error: No routes provided"), !1;
|
|
523
|
+
const u = /* @__PURE__ */ new Set();
|
|
516
524
|
for (const e of s) {
|
|
517
525
|
if (!e.path)
|
|
518
|
-
return
|
|
519
|
-
|
|
526
|
+
return q("Router configuration error: Route missing path", e), !1;
|
|
527
|
+
u.has(e.path) && g(`Duplicate route path detected: ${e.path}`), u.add(e.path), !e.component && !e.load && g(`Route '${e.path}' has no component or load function`);
|
|
520
528
|
}
|
|
521
529
|
return !0;
|
|
522
530
|
})(r), typeof window > "u" || typeof a < "u") {
|
|
523
531
|
for (const s of r)
|
|
524
|
-
|
|
525
|
-
|
|
532
|
+
M(s.path);
|
|
533
|
+
g(`Pre-compiled ${r.length} routes for SSR`);
|
|
526
534
|
}
|
|
527
535
|
if (typeof window < "u" && typeof document < "u" && typeof a > "u") {
|
|
528
|
-
|
|
536
|
+
i = () => {
|
|
529
537
|
try {
|
|
530
|
-
const e = new URL(window.location.href), n = e.pathname,
|
|
531
|
-
return { path:
|
|
538
|
+
const e = new URL(window.location.href), n = e.pathname, h = n.startsWith(o) ? n.slice(o.length) : n, v = C(h || "/"), b = st(e.search), $ = e.hash && e.hash.length ? e.hash.slice(1) : "";
|
|
539
|
+
return { path: v, query: b, fragment: $ };
|
|
532
540
|
} catch (e) {
|
|
533
|
-
return
|
|
541
|
+
return g("Invalid URL detected, falling back to safe defaults", e), { path: "/", query: {}, fragment: "" };
|
|
534
542
|
}
|
|
535
|
-
},
|
|
536
|
-
const s =
|
|
537
|
-
|
|
538
|
-
path:
|
|
543
|
+
}, l = i();
|
|
544
|
+
const s = M(l.path);
|
|
545
|
+
y = ft({
|
|
546
|
+
path: l.path,
|
|
539
547
|
params: s.params,
|
|
540
|
-
query:
|
|
541
|
-
fragment:
|
|
548
|
+
query: l.query,
|
|
549
|
+
fragment: l.fragment
|
|
542
550
|
}), A = async (e = !1) => {
|
|
543
|
-
const n =
|
|
544
|
-
await
|
|
551
|
+
const n = i();
|
|
552
|
+
await _(n.path, e);
|
|
545
553
|
};
|
|
546
|
-
const
|
|
547
|
-
window.addEventListener("popstate",
|
|
554
|
+
const u = () => A(!0);
|
|
555
|
+
window.addEventListener("popstate", u), X = () => window.removeEventListener("popstate", u), x = (e) => _(e, !1), F = (e) => _(e, !0), V = () => window.history.back();
|
|
548
556
|
} else {
|
|
549
|
-
|
|
557
|
+
i = () => {
|
|
550
558
|
try {
|
|
551
|
-
const e = new URL(a || "/", "http://localhost"), n = e.pathname,
|
|
552
|
-
return { path:
|
|
559
|
+
const e = new URL(a || "/", "http://localhost"), n = e.pathname, h = n.startsWith(o) ? n.slice(o.length) : n, v = C(h || "/"), b = st(e.search), $ = e.hash && e.hash.length ? e.hash.slice(1) : "";
|
|
560
|
+
return { path: v, query: b, fragment: $ };
|
|
553
561
|
} catch (e) {
|
|
554
|
-
return
|
|
562
|
+
return g(
|
|
555
563
|
"Invalid SSR URL detected, falling back to safe defaults",
|
|
556
564
|
e
|
|
557
565
|
), { path: "/", query: {}, fragment: "" };
|
|
558
566
|
}
|
|
559
|
-
},
|
|
560
|
-
const s =
|
|
561
|
-
|
|
562
|
-
path:
|
|
567
|
+
}, l = i();
|
|
568
|
+
const s = M(l.path);
|
|
569
|
+
y = ft({
|
|
570
|
+
path: l.path,
|
|
563
571
|
params: s.params,
|
|
564
|
-
query:
|
|
565
|
-
fragment:
|
|
572
|
+
query: l.query,
|
|
573
|
+
fragment: l.fragment
|
|
566
574
|
}), A = async () => {
|
|
567
|
-
const e =
|
|
568
|
-
await
|
|
575
|
+
const e = i();
|
|
576
|
+
await u(e.path);
|
|
569
577
|
};
|
|
570
|
-
const
|
|
571
|
-
if (k++, k >
|
|
572
|
-
|
|
578
|
+
const u = async (e) => {
|
|
579
|
+
if (k++, k > j) {
|
|
580
|
+
q(`SSR redirect depth exceeded for path: ${e}`);
|
|
573
581
|
return;
|
|
574
582
|
}
|
|
575
583
|
try {
|
|
576
|
-
const n =
|
|
577
|
-
if (!
|
|
578
|
-
const
|
|
584
|
+
const n = O(e), h = M(n.path);
|
|
585
|
+
if (!h.route) throw new Error(`No route found for ${n.path}`);
|
|
586
|
+
const v = y.getState(), b = {
|
|
579
587
|
path: n.path,
|
|
580
|
-
params:
|
|
588
|
+
params: h.params,
|
|
581
589
|
query: n.query,
|
|
582
590
|
fragment: n.fragment
|
|
583
|
-
},
|
|
584
|
-
if (
|
|
585
|
-
const
|
|
586
|
-
if (typeof
|
|
587
|
-
const
|
|
588
|
-
|
|
591
|
+
}, $ = rt(r, b.path);
|
|
592
|
+
if ($?.beforeEnter) {
|
|
593
|
+
const S = await $.beforeEnter(b, v);
|
|
594
|
+
if (typeof S == "string") {
|
|
595
|
+
const D = `${b.path}->${S}`;
|
|
596
|
+
T.add(D), await u(S);
|
|
589
597
|
return;
|
|
590
598
|
}
|
|
591
|
-
if (
|
|
599
|
+
if (S === !1) return;
|
|
592
600
|
}
|
|
593
|
-
if (
|
|
594
|
-
const
|
|
595
|
-
if (typeof
|
|
596
|
-
const
|
|
597
|
-
|
|
601
|
+
if ($?.onEnter) {
|
|
602
|
+
const S = await $.onEnter(b, v);
|
|
603
|
+
if (typeof S == "string") {
|
|
604
|
+
const D = `${b.path}->${S}`;
|
|
605
|
+
T.add(D), await u(S);
|
|
598
606
|
return;
|
|
599
607
|
}
|
|
600
|
-
if (
|
|
608
|
+
if (S === !1) return;
|
|
601
609
|
}
|
|
602
|
-
|
|
610
|
+
y.setState(b), $?.afterEnter && $.afterEnter(b, v);
|
|
603
611
|
} catch (n) {
|
|
604
|
-
throw
|
|
612
|
+
throw q("SSR navigation error:", n), n;
|
|
605
613
|
}
|
|
606
614
|
};
|
|
607
|
-
|
|
615
|
+
x = async (e) => (k = 0, T.clear(), u(e)), F = async (e) => (k = 0, T.clear(), u(e)), V = () => {
|
|
608
616
|
};
|
|
609
617
|
}
|
|
610
618
|
return {
|
|
611
|
-
_cleanupScrollState:
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
619
|
+
_cleanupScrollState: tt,
|
|
620
|
+
destroy: X,
|
|
621
|
+
store: y,
|
|
622
|
+
push: x,
|
|
623
|
+
replace: F,
|
|
624
|
+
back: V,
|
|
625
|
+
subscribe: y.subscribe,
|
|
626
|
+
matchRoute: (s) => M(s),
|
|
627
|
+
getCurrent: () => y.getState(),
|
|
628
|
+
resolveRouteComponent: qt,
|
|
620
629
|
base: o,
|
|
621
630
|
// Public API: allow components or tests to explicitly request scrolling to
|
|
622
631
|
// a fragment when they know their DOM is ready. Returns true if scrolled.
|
|
623
632
|
scrollToFragment: (s) => {
|
|
624
|
-
const
|
|
625
|
-
return !
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
633
|
+
const u = s || y.getState().fragment;
|
|
634
|
+
return !u || typeof window > "u" || typeof document > "u" ? Promise.resolve(!1) : R(
|
|
635
|
+
u,
|
|
636
|
+
w.offset,
|
|
637
|
+
w.timeoutMs
|
|
629
638
|
);
|
|
630
639
|
}
|
|
631
640
|
};
|
|
632
641
|
}
|
|
633
|
-
function
|
|
634
|
-
|
|
635
|
-
const r =
|
|
636
|
-
if (
|
|
642
|
+
function jt(t) {
|
|
643
|
+
kt();
|
|
644
|
+
const r = Mt(t), d = mt();
|
|
645
|
+
if (d) {
|
|
637
646
|
try {
|
|
638
|
-
|
|
647
|
+
d.destroy();
|
|
639
648
|
} catch {
|
|
640
649
|
}
|
|
641
|
-
|
|
650
|
+
try {
|
|
651
|
+
d._cleanupScrollState?.();
|
|
652
|
+
} catch {
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
Tt(r);
|
|
642
656
|
try {
|
|
643
|
-
|
|
657
|
+
It();
|
|
644
658
|
try {
|
|
645
|
-
typeof window < "u" &&
|
|
659
|
+
typeof window < "u" && nt();
|
|
646
660
|
} catch {
|
|
647
661
|
}
|
|
648
662
|
try {
|
|
649
663
|
typeof window < "u" && queueMicrotask(() => {
|
|
650
664
|
try {
|
|
651
|
-
|
|
665
|
+
nt();
|
|
652
666
|
} catch {
|
|
653
667
|
}
|
|
654
668
|
});
|
|
@@ -656,54 +670,54 @@ function Ft(t) {
|
|
|
656
670
|
}
|
|
657
671
|
} catch {
|
|
658
672
|
}
|
|
659
|
-
return
|
|
660
|
-
if (!
|
|
661
|
-
const a =
|
|
673
|
+
return ut("router-view", async () => {
|
|
674
|
+
if (!mt()) return U`<div>Router not initialized.</div>`;
|
|
675
|
+
const a = et(E.getCurrent()), c = typeof window > "u";
|
|
662
676
|
let o;
|
|
663
|
-
|
|
677
|
+
c || (it(() => {
|
|
664
678
|
try {
|
|
665
|
-
typeof E.subscribe == "function" && (o = E.subscribe((
|
|
679
|
+
typeof E.subscribe == "function" && (o = E.subscribe((i) => {
|
|
666
680
|
try {
|
|
667
|
-
|
|
668
|
-
} catch (
|
|
669
|
-
|
|
681
|
+
i && typeof i == "object" && typeof i.path == "string" ? a.value = i : (g("router-view received invalid state", i), a.value = { path: "/", params: {}, query: {} });
|
|
682
|
+
} catch (l) {
|
|
683
|
+
g("router-view subscription update failed", l);
|
|
670
684
|
try {
|
|
671
685
|
a.value = { path: "/", params: {}, query: {} };
|
|
672
686
|
} catch {
|
|
673
687
|
}
|
|
674
688
|
}
|
|
675
689
|
}));
|
|
676
|
-
} catch (
|
|
677
|
-
|
|
690
|
+
} catch (i) {
|
|
691
|
+
g("router-view subscribe failed", i);
|
|
678
692
|
}
|
|
679
|
-
}),
|
|
693
|
+
}), lt(() => {
|
|
680
694
|
if (typeof o == "function") {
|
|
681
695
|
try {
|
|
682
696
|
o();
|
|
683
|
-
} catch (
|
|
684
|
-
|
|
697
|
+
} catch (i) {
|
|
698
|
+
g("router-view unsubscribe failed", i);
|
|
685
699
|
}
|
|
686
700
|
o = void 0;
|
|
687
701
|
}
|
|
688
702
|
}));
|
|
689
|
-
const
|
|
690
|
-
if (!
|
|
703
|
+
const w = E.matchRoute(a.value.path);
|
|
704
|
+
if (!w || !w.route) return U`<div>Not found</div>`;
|
|
691
705
|
try {
|
|
692
|
-
const
|
|
693
|
-
|
|
706
|
+
const l = await E.resolveRouteComponent(
|
|
707
|
+
w.route
|
|
694
708
|
);
|
|
695
|
-
if (typeof
|
|
696
|
-
return { tag:
|
|
697
|
-
if (typeof
|
|
698
|
-
const
|
|
699
|
-
return (
|
|
709
|
+
if (typeof l == "string")
|
|
710
|
+
return { tag: l, props: {}, children: [] };
|
|
711
|
+
if (typeof l == "function") {
|
|
712
|
+
const y = l();
|
|
713
|
+
return (y instanceof Promise ? y : Promise.resolve(y)).then((x) => typeof x == "string" ? { tag: x, props: {}, children: [] } : x);
|
|
700
714
|
}
|
|
701
|
-
return
|
|
715
|
+
return U`<div>Invalid route component</div>`;
|
|
702
716
|
} catch {
|
|
703
|
-
return
|
|
717
|
+
return U`<div>Invalid route component</div>`;
|
|
704
718
|
}
|
|
705
|
-
}),
|
|
706
|
-
const a =
|
|
719
|
+
}), ut("router-link", () => {
|
|
720
|
+
const a = St({
|
|
707
721
|
to: "",
|
|
708
722
|
tag: "a",
|
|
709
723
|
replace: !1,
|
|
@@ -716,32 +730,32 @@ function Ft(t) {
|
|
|
716
730
|
// allow host `class` and `style` attributes to be read via useProps
|
|
717
731
|
class: "",
|
|
718
732
|
style: ""
|
|
719
|
-
}),
|
|
720
|
-
isExactActive:
|
|
721
|
-
|
|
722
|
-
|
|
733
|
+
}), c = typeof window > "u", o = et(E.getCurrent()), w = o.value?.path || "/", i = String(a.to || ""), l = c ? {
|
|
734
|
+
isExactActive: gt(
|
|
735
|
+
w,
|
|
736
|
+
i,
|
|
723
737
|
E.base
|
|
724
738
|
),
|
|
725
|
-
isActive:
|
|
726
|
-
|
|
727
|
-
|
|
739
|
+
isActive: vt(
|
|
740
|
+
w,
|
|
741
|
+
i,
|
|
728
742
|
E.base
|
|
729
743
|
),
|
|
730
|
-
isExternal: Z(
|
|
744
|
+
isExternal: Z(i) || !!a.external
|
|
731
745
|
} : null;
|
|
732
|
-
let
|
|
733
|
-
|
|
734
|
-
const A =
|
|
735
|
-
if (!
|
|
736
|
-
let
|
|
737
|
-
|
|
746
|
+
let y;
|
|
747
|
+
Rt(() => "a,button{display:inline-block;}");
|
|
748
|
+
const A = et(a.class || ""), x = et(a.style || "");
|
|
749
|
+
if (!c) {
|
|
750
|
+
let p = null;
|
|
751
|
+
it((R) => {
|
|
738
752
|
try {
|
|
739
753
|
if (typeof E.subscribe == "function") {
|
|
740
|
-
|
|
754
|
+
y = E.subscribe((f) => {
|
|
741
755
|
try {
|
|
742
|
-
f && typeof f == "object" && typeof f.path == "string" ? o.value = f : (
|
|
743
|
-
} catch (
|
|
744
|
-
|
|
756
|
+
f && typeof f == "object" && typeof f.path == "string" ? o.value = f : (g("router-link received invalid state", f), o.value = { path: "/", params: {}, query: {} });
|
|
757
|
+
} catch (_) {
|
|
758
|
+
g("router-link subscription update failed", _);
|
|
745
759
|
try {
|
|
746
760
|
o.value = { path: "/", params: {}, query: {} };
|
|
747
761
|
} catch {
|
|
@@ -752,9 +766,9 @@ function Ft(t) {
|
|
|
752
766
|
const f = E.getCurrent();
|
|
753
767
|
f && typeof f.path == "string" && (o.value = f);
|
|
754
768
|
} catch (f) {
|
|
755
|
-
|
|
769
|
+
g("router-link initial state sync failed", f);
|
|
756
770
|
}
|
|
757
|
-
|
|
771
|
+
p = setInterval(() => {
|
|
758
772
|
try {
|
|
759
773
|
const f = E.getCurrent();
|
|
760
774
|
f && typeof f.path == "string" && JSON.stringify(o.value) !== JSON.stringify(f) && (o.value = f);
|
|
@@ -763,180 +777,180 @@ function Ft(t) {
|
|
|
763
777
|
}, 100);
|
|
764
778
|
}
|
|
765
779
|
} catch (f) {
|
|
766
|
-
|
|
780
|
+
g("router-link subscribe failed", f);
|
|
767
781
|
}
|
|
768
782
|
try {
|
|
769
783
|
const f = R?._host;
|
|
770
784
|
if (f instanceof HTMLElement) {
|
|
771
|
-
const
|
|
772
|
-
|
|
785
|
+
const _ = f.getAttribute("class"), O = f.getAttribute("style");
|
|
786
|
+
_ && (A.value = _), O && (x.value = O), _ !== null && f.removeAttribute("class"), O !== null && f.removeAttribute("style");
|
|
773
787
|
try {
|
|
774
788
|
R?._requestRender?.();
|
|
775
789
|
try {
|
|
776
|
-
|
|
790
|
+
nt();
|
|
777
791
|
} catch {
|
|
778
792
|
}
|
|
779
793
|
} catch {
|
|
780
794
|
}
|
|
781
795
|
}
|
|
782
796
|
} catch (f) {
|
|
783
|
-
|
|
797
|
+
g("router-link host migration failed", f);
|
|
784
798
|
}
|
|
785
|
-
}),
|
|
786
|
-
if (typeof
|
|
799
|
+
}), lt(() => {
|
|
800
|
+
if (typeof y == "function")
|
|
787
801
|
try {
|
|
788
|
-
|
|
802
|
+
y();
|
|
789
803
|
} catch (R) {
|
|
790
|
-
|
|
804
|
+
g("router-link unsubscribe failed", R);
|
|
791
805
|
} finally {
|
|
792
|
-
|
|
806
|
+
y = void 0;
|
|
793
807
|
}
|
|
794
|
-
if (
|
|
808
|
+
if (p)
|
|
795
809
|
try {
|
|
796
|
-
clearInterval(
|
|
810
|
+
clearInterval(p);
|
|
797
811
|
} catch (R) {
|
|
798
|
-
|
|
812
|
+
g("router-link sync interval cleanup failed", R);
|
|
799
813
|
} finally {
|
|
800
|
-
|
|
814
|
+
p = null;
|
|
801
815
|
}
|
|
802
816
|
});
|
|
803
817
|
}
|
|
804
|
-
const
|
|
805
|
-
if (
|
|
806
|
-
return
|
|
818
|
+
const F = I(() => {
|
|
819
|
+
if (c && l)
|
|
820
|
+
return l.isExactActive;
|
|
807
821
|
try {
|
|
808
|
-
const
|
|
809
|
-
return !o.value || typeof o.value.path != "string" ? !1 :
|
|
810
|
-
} catch (
|
|
811
|
-
return
|
|
822
|
+
const p = E.base ?? "", R = a.to || "";
|
|
823
|
+
return !o.value || typeof o.value.path != "string" ? !1 : gt(o.value.path, R, p);
|
|
824
|
+
} catch (p) {
|
|
825
|
+
return g("isExactActive computation error", p), !1;
|
|
812
826
|
}
|
|
813
|
-
}),
|
|
814
|
-
if (
|
|
815
|
-
return
|
|
827
|
+
}), V = I(() => {
|
|
828
|
+
if (c && l)
|
|
829
|
+
return l.isActive;
|
|
816
830
|
try {
|
|
817
|
-
const
|
|
818
|
-
return !o.value || typeof o.value.path != "string" ? !1 : a.exact ?
|
|
819
|
-
} catch (
|
|
820
|
-
return
|
|
831
|
+
const p = E.base ?? "", R = a.to || "";
|
|
832
|
+
return !o.value || typeof o.value.path != "string" ? !1 : a.exact ? F.value : vt(o.value.path, R, p);
|
|
833
|
+
} catch (p) {
|
|
834
|
+
return g("isActive computation error", p), !1;
|
|
821
835
|
}
|
|
822
|
-
}),
|
|
823
|
-
const
|
|
824
|
-
if (
|
|
825
|
-
if (Z(
|
|
826
|
-
const [R, f] =
|
|
827
|
-
let H =
|
|
828
|
-
if (
|
|
829
|
-
const
|
|
830
|
-
|
|
836
|
+
}), X = I(() => {
|
|
837
|
+
const p = String(a.to || "");
|
|
838
|
+
if (pt(p)) return null;
|
|
839
|
+
if (Z(p)) return p;
|
|
840
|
+
const [R, f] = p.split("#"), [_, O] = (R || "").split("?"), L = E.base ?? "";
|
|
841
|
+
let H = _ || "/";
|
|
842
|
+
if (L && L !== "/") {
|
|
843
|
+
const ot = C(L), s = C(H);
|
|
844
|
+
s.startsWith(ot) ? H = s.slice(ot.length) || "/" : H = s;
|
|
831
845
|
}
|
|
832
|
-
const
|
|
833
|
-
return
|
|
834
|
-
}),
|
|
846
|
+
const ct = C(H || "/");
|
|
847
|
+
return L + ct + (O ? "?" + O : "") + (f ? "#" + f : "");
|
|
848
|
+
}), T = I(() => {
|
|
835
849
|
const R = (A && A.value || a.class || "").split(/\s+/).filter(Boolean), f = {};
|
|
836
|
-
for (const
|
|
850
|
+
for (const _ of R) f[_] = !0;
|
|
837
851
|
return f;
|
|
838
|
-
}),
|
|
839
|
-
...
|
|
840
|
-
[a.activeClass || "active"]:
|
|
841
|
-
[a.exactActiveClass || "exact-active"]:
|
|
842
|
-
})),
|
|
843
|
-
() => Object.keys(
|
|
844
|
-
), G =
|
|
845
|
-
() =>
|
|
846
|
-
),
|
|
847
|
-
const
|
|
848
|
-
return (Z(
|
|
849
|
-
}),
|
|
850
|
-
() =>
|
|
851
|
-
),
|
|
852
|
-
if (
|
|
852
|
+
}), j = I(() => ({
|
|
853
|
+
...T.value,
|
|
854
|
+
[a.activeClass || "active"]: V.value,
|
|
855
|
+
[a.exactActiveClass || "exact-active"]: F.value
|
|
856
|
+
})), k = I(
|
|
857
|
+
() => Object.keys(j.value).filter((p) => j.value[p]).join(" ")
|
|
858
|
+
), G = I(() => a.tag || "a"), at = I(() => G.value === "button"), Y = I(
|
|
859
|
+
() => F.value ? a.ariaCurrentValue : null
|
|
860
|
+
), P = I(() => !!a.disabled), W = I(() => {
|
|
861
|
+
const p = String(a.to || "");
|
|
862
|
+
return (Z(p) || !!a.external) && G.value === "a";
|
|
863
|
+
}), M = I(
|
|
864
|
+
() => x && x.value || a.style || ""
|
|
865
|
+
), tt = (p) => {
|
|
866
|
+
if (p.defaultPrevented || p.button !== 0 || p.metaKey || p.altKey || p.ctrlKey || p.shiftKey)
|
|
853
867
|
return;
|
|
854
|
-
if (
|
|
855
|
-
|
|
868
|
+
if (P.value) {
|
|
869
|
+
p.preventDefault();
|
|
856
870
|
return;
|
|
857
871
|
}
|
|
858
872
|
const R = String(a.to || "");
|
|
859
|
-
if (
|
|
873
|
+
if (pt(R)) {
|
|
860
874
|
try {
|
|
861
|
-
|
|
875
|
+
p.preventDefault();
|
|
862
876
|
} catch {
|
|
863
877
|
}
|
|
864
|
-
|
|
878
|
+
g("Blocked unsafe javascript: URI in router-link.to");
|
|
865
879
|
return;
|
|
866
880
|
}
|
|
867
|
-
|
|
881
|
+
W.value || (p.preventDefault(), a.replace ? E.replace(a.to) : E.push(a.to));
|
|
868
882
|
};
|
|
869
|
-
return
|
|
870
|
-
${
|
|
871
|
-
|
|
872
|
-
|
|
883
|
+
return U`
|
|
884
|
+
${$t().when(
|
|
885
|
+
at.value,
|
|
886
|
+
U`
|
|
873
887
|
<button
|
|
874
888
|
part="button"
|
|
875
|
-
class="${
|
|
876
|
-
style="${
|
|
877
|
-
aria-current="${
|
|
878
|
-
disabled="${
|
|
879
|
-
aria-disabled="${
|
|
880
|
-
tabindex="${
|
|
881
|
-
@click="${
|
|
889
|
+
class="${k.value}"
|
|
890
|
+
style="${M.value || null}"
|
|
891
|
+
aria-current="${Y.value}"
|
|
892
|
+
disabled="${P.value ? "" : null}"
|
|
893
|
+
aria-disabled="${P.value ? "true" : null}"
|
|
894
|
+
tabindex="${P.value ? "-1" : null}"
|
|
895
|
+
@click="${tt}"
|
|
882
896
|
>
|
|
883
897
|
<slot></slot>
|
|
884
898
|
</button>
|
|
885
899
|
`
|
|
886
|
-
).otherwise(
|
|
900
|
+
).otherwise(U`
|
|
887
901
|
<a
|
|
888
902
|
part="link"
|
|
889
|
-
href="${
|
|
890
|
-
class="${
|
|
891
|
-
style="${
|
|
892
|
-
aria-current="${
|
|
893
|
-
aria-disabled="${
|
|
894
|
-
tabindex="${
|
|
895
|
-
target="${
|
|
896
|
-
rel="${
|
|
897
|
-
@click="${
|
|
903
|
+
href="${P.value ? null : X.value}"
|
|
904
|
+
class="${k.value}"
|
|
905
|
+
style="${M.value || null}"
|
|
906
|
+
aria-current="${Y.value}"
|
|
907
|
+
aria-disabled="${P.value ? "true" : null}"
|
|
908
|
+
tabindex="${P.value ? "-1" : null}"
|
|
909
|
+
target="${W.value ? "_blank" : null}"
|
|
910
|
+
rel="${W.value ? "noopener noreferrer" : null}"
|
|
911
|
+
@click="${tt}"
|
|
898
912
|
><slot></slot
|
|
899
913
|
></a>
|
|
900
914
|
`).done()}
|
|
901
915
|
`;
|
|
902
916
|
}), r;
|
|
903
917
|
}
|
|
904
|
-
function
|
|
918
|
+
function gt(t, r, d) {
|
|
905
919
|
if (Z(r)) return !1;
|
|
906
|
-
let
|
|
907
|
-
if (
|
|
908
|
-
const
|
|
909
|
-
|
|
920
|
+
let c = (r.split("#")[0] || "/").split("?")[0];
|
|
921
|
+
if (d && d !== "/") {
|
|
922
|
+
const i = C(d), l = C(c);
|
|
923
|
+
l.startsWith(i) ? c = l.slice(i.length) || "/" : c = l;
|
|
910
924
|
}
|
|
911
|
-
const o = C(t),
|
|
912
|
-
return o ===
|
|
925
|
+
const o = C(t), w = C(c);
|
|
926
|
+
return o === w;
|
|
913
927
|
}
|
|
914
|
-
function
|
|
928
|
+
function vt(t, r, d) {
|
|
915
929
|
if (Z(r)) return !1;
|
|
916
|
-
let
|
|
917
|
-
if (
|
|
918
|
-
const
|
|
919
|
-
|
|
930
|
+
let c = (r.split("#")[0] || "/").split("?")[0];
|
|
931
|
+
if (d && d !== "/") {
|
|
932
|
+
const i = C(d), l = C(c);
|
|
933
|
+
l.startsWith(i) ? c = l.slice(i.length) || "/" : c = l;
|
|
920
934
|
}
|
|
921
|
-
const o = C(t),
|
|
922
|
-
return
|
|
935
|
+
const o = C(t), w = C(c);
|
|
936
|
+
return w === "/" ? o === "/" : o === w ? !0 : o.startsWith(w.endsWith("/") ? w : w + "/");
|
|
923
937
|
}
|
|
924
938
|
export {
|
|
925
|
-
|
|
939
|
+
ht as DEFAULT_SCROLL_CONFIG,
|
|
926
940
|
E as activeRouterProxy,
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
941
|
+
At as canonicalizeBase,
|
|
942
|
+
kt as clearComponentCache,
|
|
943
|
+
rt as findMatchedRoute,
|
|
944
|
+
jt as initRouter,
|
|
931
945
|
Z as isAbsoluteUrl,
|
|
932
|
-
|
|
946
|
+
pt as isDangerousScheme,
|
|
933
947
|
Q as matchRoute,
|
|
934
|
-
|
|
948
|
+
Ut as matchRouteSSR,
|
|
935
949
|
C as normalizePathForRoute,
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
950
|
+
st as parseQuery,
|
|
951
|
+
qt as resolveRouteComponent,
|
|
952
|
+
Ct as safeDecode,
|
|
953
|
+
Et as serializeQuery,
|
|
954
|
+
Mt as useRouter
|
|
941
955
|
};
|
|
942
956
|
//# sourceMappingURL=custom-elements-runtime.router.es.js.map
|