@jasonshimmy/custom-elements-runtime 2.2.8 → 2.3.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/dist/custom-elements-runtime.cjs.js +2 -2
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +250 -248
- 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.es.js +1 -1
- package/dist/custom-elements-runtime.router.cjs.js +17 -17
- package/dist/custom-elements-runtime.router.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.router.es.js +267 -208
- package/dist/custom-elements-runtime.router.es.js.map +1 -1
- package/dist/custom-elements-runtime.ssr.cjs.js +1 -1
- package/dist/custom-elements-runtime.ssr.es.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/logger-BuUYv7C_.js +44 -0
- package/dist/logger-BuUYv7C_.js.map +1 -0
- package/dist/logger-DiXdWaF-.cjs +2 -0
- package/dist/logger-DiXdWaF-.cjs.map +1 -0
- package/dist/namespace-helpers-BsKQl3aH.cjs +5 -0
- package/dist/namespace-helpers-BsKQl3aH.cjs.map +1 -0
- package/dist/namespace-helpers-Dw1mgQab.js +692 -0
- package/dist/namespace-helpers-Dw1mgQab.js.map +1 -0
- package/dist/runtime/logger.d.ts +6 -0
- package/dist/runtime/reactive.d.ts +10 -2
- package/package.json +1 -1
- package/dist/logger-BpibrmKL.js +0 -25
- package/dist/logger-BpibrmKL.js.map +0 -1
- package/dist/logger-CqdBMdui.cjs +0 -2
- package/dist/logger-CqdBMdui.cjs.map +0 -1
- package/dist/namespace-helpers-DwMMXN9Q.cjs +0 -5
- package/dist/namespace-helpers-DwMMXN9Q.cjs.map +0 -1
- package/dist/namespace-helpers-Vwt2Fzds.js +0 -651
- package/dist/namespace-helpers-Vwt2Fzds.js.map +0 -1
|
@@ -1,208 +1,267 @@
|
|
|
1
|
-
import { component as
|
|
2
|
-
import { r as
|
|
3
|
-
import { createStore as
|
|
4
|
-
import { d as
|
|
5
|
-
import { match as
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { component as O, html as S, useOnConnected as N, useOnDisconnected as j, useProps as W, useStyle as F } from "./custom-elements-runtime.es.js";
|
|
2
|
+
import { r as _, c as g } from "./namespace-helpers-Dw1mgQab.js";
|
|
3
|
+
import { createStore as B } from "./custom-elements-runtime.store.es.js";
|
|
4
|
+
import { d as C, a as $ } from "./logger-BuUYv7C_.js";
|
|
5
|
+
import { match as M } from "./custom-elements-runtime.directives.es.js";
|
|
6
|
+
const T = (n) => n ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(n)) : {}, U = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function V(n) {
|
|
8
|
+
return n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
9
|
+
}
|
|
10
|
+
function D(n) {
|
|
11
|
+
if (!n) return "/";
|
|
12
|
+
let r = n.replace(/\/+/g, "/");
|
|
13
|
+
return r.startsWith("/") || (r = "/" + r), r.length > 1 && r.endsWith("/") && (r = r.slice(0, -1)), r;
|
|
14
|
+
}
|
|
15
|
+
function z(n) {
|
|
16
|
+
const r = n.path || "/", t = D(r), f = t === "/" ? [] : t.split("/").filter(Boolean), s = [], i = [];
|
|
17
|
+
for (let c = 0; c < f.length; c++) {
|
|
18
|
+
const d = f[c];
|
|
19
|
+
if (d === "*") {
|
|
20
|
+
if (c !== f.length - 1)
|
|
21
|
+
return $(
|
|
22
|
+
`Route '${n.path}' contains a '*' splat in a non-terminal position; splats must be the last segment. This route will be ignored.`
|
|
23
|
+
), { invalid: !0 };
|
|
24
|
+
const p = `splat${s.length}`;
|
|
25
|
+
s.push(p), i.push("__SPLAT__");
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const w = d.match(/^:([A-Za-z0-9_-]+)(\*)?$/);
|
|
29
|
+
if (w) {
|
|
30
|
+
const p = w[1], b = !!w[2];
|
|
31
|
+
if (b && c !== f.length - 1)
|
|
32
|
+
return $(
|
|
33
|
+
`Route '${n.path}' contains a splat param ':${p}*' in a non-terminal position; splats must be the last segment. This route will be ignored.`
|
|
34
|
+
), { invalid: !0 };
|
|
35
|
+
s.push(p), i.push(b ? "__SPLAT__" : "([^/]+)");
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
i.push(V(d));
|
|
39
|
+
}
|
|
40
|
+
let o;
|
|
41
|
+
if (i.length === 0)
|
|
42
|
+
o = "^/$";
|
|
43
|
+
else if (i[i.length - 1] === "__SPLAT__") {
|
|
44
|
+
const d = i.slice(0, -1).join("/");
|
|
45
|
+
d ? o = `^/${d}(?:/(.*))?(?:/)?$` : o = "^(?:/(.*))?(?:/)?$";
|
|
46
|
+
} else
|
|
47
|
+
o = `^/${i.join("/")}(?:/)?$`;
|
|
48
|
+
try {
|
|
49
|
+
return { regex: new RegExp(o), paramNames: s };
|
|
50
|
+
} catch (c) {
|
|
51
|
+
return $(`Failed to compile route regex for '${n.path}': ${String(c)}`), { invalid: !0 };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const x = (n, r) => {
|
|
55
|
+
const t = D(r);
|
|
56
|
+
for (const f of n) {
|
|
57
|
+
let s = U.get(f);
|
|
58
|
+
if (s || (s = z(f), U.set(f, s)), s.invalid) continue;
|
|
59
|
+
const { regex: i, paramNames: o } = s, c = i.exec(t);
|
|
60
|
+
if (c) {
|
|
61
|
+
const d = {}, w = (p) => {
|
|
62
|
+
try {
|
|
63
|
+
return decodeURIComponent(p);
|
|
64
|
+
} catch {
|
|
65
|
+
return p;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
for (let p = 0; p < o.length; p++) {
|
|
69
|
+
const b = c[p + 1] || "";
|
|
70
|
+
d[o[p]] = b ? w(b) : "";
|
|
71
|
+
}
|
|
72
|
+
return { route: f, params: d };
|
|
14
73
|
}
|
|
15
74
|
}
|
|
16
75
|
return { route: null, params: {} };
|
|
17
76
|
};
|
|
18
|
-
function A(
|
|
19
|
-
for (const t of
|
|
20
|
-
if (
|
|
77
|
+
function A(n, r) {
|
|
78
|
+
for (const t of n)
|
|
79
|
+
if (x([t], r).route !== null) return t;
|
|
21
80
|
return null;
|
|
22
81
|
}
|
|
23
|
-
const
|
|
24
|
-
async function
|
|
25
|
-
if (
|
|
26
|
-
if (
|
|
27
|
-
if (
|
|
82
|
+
const L = {};
|
|
83
|
+
async function H(n) {
|
|
84
|
+
if (n.component) return n.component;
|
|
85
|
+
if (n.load) {
|
|
86
|
+
if (L[n.path]) return L[n.path];
|
|
28
87
|
try {
|
|
29
|
-
const
|
|
30
|
-
return
|
|
88
|
+
const r = await n.load();
|
|
89
|
+
return L[n.path] = r.default, r.default;
|
|
31
90
|
} catch {
|
|
32
|
-
throw new Error(`Failed to load component for route: ${
|
|
91
|
+
throw new Error(`Failed to load component for route: ${n.path}`);
|
|
33
92
|
}
|
|
34
93
|
}
|
|
35
|
-
throw new Error(`No component or loader defined for route: ${
|
|
94
|
+
throw new Error(`No component or loader defined for route: ${n.path}`);
|
|
36
95
|
}
|
|
37
|
-
function
|
|
38
|
-
const { routes:
|
|
39
|
-
let
|
|
40
|
-
const
|
|
41
|
-
const e = A(
|
|
96
|
+
function I(n) {
|
|
97
|
+
const { routes: r, base: t = "", initialUrl: f } = n;
|
|
98
|
+
let s, i, o, c, d, w, p;
|
|
99
|
+
const b = async (u, l) => {
|
|
100
|
+
const e = A(r, u.path);
|
|
42
101
|
if (!e || !e.beforeEnter) return !0;
|
|
43
102
|
try {
|
|
44
|
-
const
|
|
45
|
-
return typeof
|
|
46
|
-
} catch (
|
|
47
|
-
return
|
|
103
|
+
const a = await e.beforeEnter(u, l);
|
|
104
|
+
return typeof a == "string" ? (await R(a, !0), !1) : a !== !1;
|
|
105
|
+
} catch (a) {
|
|
106
|
+
return C("beforeEnter error", a), !1;
|
|
48
107
|
}
|
|
49
|
-
},
|
|
50
|
-
const e = A(
|
|
108
|
+
}, k = async (u, l) => {
|
|
109
|
+
const e = A(r, u.path);
|
|
51
110
|
if (!e || !e.onEnter) return !0;
|
|
52
111
|
try {
|
|
53
|
-
const
|
|
54
|
-
return typeof
|
|
55
|
-
} catch (
|
|
56
|
-
return
|
|
112
|
+
const a = await e.onEnter(u, l);
|
|
113
|
+
return typeof a == "string" ? (await R(a, !0), !1) : a !== !1;
|
|
114
|
+
} catch (a) {
|
|
115
|
+
return C("onEnter error", a), !1;
|
|
57
116
|
}
|
|
58
|
-
},
|
|
59
|
-
const e = A(
|
|
117
|
+
}, q = (u, l) => {
|
|
118
|
+
const e = A(r, u.path);
|
|
60
119
|
if (!(!e || !e.afterEnter))
|
|
61
120
|
try {
|
|
62
|
-
e.afterEnter(
|
|
63
|
-
} catch (
|
|
64
|
-
|
|
121
|
+
e.afterEnter(u, l);
|
|
122
|
+
} catch (a) {
|
|
123
|
+
C("afterEnter error", a);
|
|
65
124
|
}
|
|
66
|
-
},
|
|
125
|
+
}, R = async (u, l = !1) => {
|
|
67
126
|
try {
|
|
68
127
|
const e = {
|
|
69
|
-
path:
|
|
128
|
+
path: u.replace(t, "") || "/",
|
|
70
129
|
query: {}
|
|
71
|
-
},
|
|
72
|
-
if (!
|
|
73
|
-
const
|
|
130
|
+
}, a = x(r, e.path);
|
|
131
|
+
if (!a.route) throw new Error(`No route found for ${e.path}`);
|
|
132
|
+
const m = o.getState(), h = {
|
|
74
133
|
path: e.path,
|
|
75
|
-
params:
|
|
134
|
+
params: a.params,
|
|
76
135
|
query: e.query
|
|
77
136
|
};
|
|
78
|
-
if (!await
|
|
79
|
-
typeof window < "u" && typeof document < "u" && (
|
|
137
|
+
if (!await b(h, m) || !await k(h, m)) return;
|
|
138
|
+
typeof window < "u" && typeof document < "u" && (l ? window.history.replaceState({}, "", t + u) : window.history.pushState({}, "", t + u)), o.setState(h), q(h, m);
|
|
80
139
|
} catch (e) {
|
|
81
|
-
|
|
140
|
+
C("Navigation error:", e);
|
|
82
141
|
}
|
|
83
142
|
};
|
|
84
|
-
if (typeof window < "u" && typeof document < "u" && typeof
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
return { path: e, query:
|
|
88
|
-
},
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
path:
|
|
92
|
-
params:
|
|
93
|
-
query:
|
|
94
|
-
}),
|
|
95
|
-
const e =
|
|
96
|
-
await
|
|
97
|
-
}, window.addEventListener("popstate", () =>
|
|
143
|
+
if (typeof window < "u" && typeof document < "u" && typeof f > "u") {
|
|
144
|
+
s = () => {
|
|
145
|
+
const l = new URL(window.location.href), e = l.pathname.replace(t, "") || "/", a = T(l.search);
|
|
146
|
+
return { path: e, query: a };
|
|
147
|
+
}, i = s();
|
|
148
|
+
const u = x(r, i.path);
|
|
149
|
+
o = B({
|
|
150
|
+
path: i.path,
|
|
151
|
+
params: u.params,
|
|
152
|
+
query: i.query
|
|
153
|
+
}), c = async (l = !1) => {
|
|
154
|
+
const e = s();
|
|
155
|
+
await R(e.path, l);
|
|
156
|
+
}, window.addEventListener("popstate", () => c(!0)), d = (l) => R(l, !1), w = (l) => R(l, !0), p = () => window.history.back();
|
|
98
157
|
} else {
|
|
99
|
-
|
|
100
|
-
const e = new URL(
|
|
101
|
-
return { path:
|
|
102
|
-
},
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
path:
|
|
106
|
-
params:
|
|
107
|
-
query:
|
|
108
|
-
}),
|
|
109
|
-
const e =
|
|
110
|
-
await
|
|
158
|
+
s = () => {
|
|
159
|
+
const e = new URL(f || "/", "http://localhost"), a = e.pathname.replace(t, "") || "/", m = T(e.search);
|
|
160
|
+
return { path: a, query: m };
|
|
161
|
+
}, i = s();
|
|
162
|
+
const u = x(r, i.path);
|
|
163
|
+
o = B({
|
|
164
|
+
path: i.path,
|
|
165
|
+
params: u.params,
|
|
166
|
+
query: i.query
|
|
167
|
+
}), c = async () => {
|
|
168
|
+
const e = s();
|
|
169
|
+
await l(e.path);
|
|
111
170
|
};
|
|
112
|
-
const
|
|
171
|
+
const l = async (e) => {
|
|
113
172
|
try {
|
|
114
|
-
const
|
|
173
|
+
const a = {
|
|
115
174
|
path: e.replace(t, "") || "/",
|
|
116
175
|
query: {}
|
|
117
|
-
},
|
|
118
|
-
if (!
|
|
119
|
-
const
|
|
120
|
-
path:
|
|
121
|
-
params:
|
|
122
|
-
query:
|
|
123
|
-
}, y = A(
|
|
176
|
+
}, m = x(r, a.path);
|
|
177
|
+
if (!m.route) throw new Error(`No route found for ${a.path}`);
|
|
178
|
+
const h = o.getState(), v = {
|
|
179
|
+
path: a.path,
|
|
180
|
+
params: m.params,
|
|
181
|
+
query: a.query
|
|
182
|
+
}, y = A(r, v.path);
|
|
124
183
|
if (y?.beforeEnter) {
|
|
125
|
-
const E = await y.beforeEnter(
|
|
184
|
+
const E = await y.beforeEnter(v, h);
|
|
126
185
|
if (typeof E == "string") {
|
|
127
|
-
await
|
|
186
|
+
await l(E);
|
|
128
187
|
return;
|
|
129
188
|
}
|
|
130
189
|
if (E === !1) return;
|
|
131
190
|
}
|
|
132
191
|
if (y?.onEnter) {
|
|
133
|
-
const E = await y.onEnter(
|
|
192
|
+
const E = await y.onEnter(v, h);
|
|
134
193
|
if (typeof E == "string") {
|
|
135
|
-
await
|
|
194
|
+
await l(E);
|
|
136
195
|
return;
|
|
137
196
|
}
|
|
138
197
|
if (E === !1) return;
|
|
139
198
|
}
|
|
140
|
-
|
|
141
|
-
} catch (
|
|
142
|
-
throw
|
|
199
|
+
o.setState(v), y?.afterEnter && y.afterEnter(v, h);
|
|
200
|
+
} catch (a) {
|
|
201
|
+
throw C("SSR navigation error:", a), a;
|
|
143
202
|
}
|
|
144
203
|
};
|
|
145
|
-
|
|
204
|
+
d = async (e) => l(e), w = async (e) => l(e), p = () => {
|
|
146
205
|
};
|
|
147
206
|
}
|
|
148
207
|
return {
|
|
149
|
-
store:
|
|
150
|
-
push:
|
|
151
|
-
replace:
|
|
152
|
-
back:
|
|
153
|
-
subscribe:
|
|
154
|
-
matchRoute: (
|
|
155
|
-
getCurrent: () =>
|
|
156
|
-
resolveRouteComponent:
|
|
208
|
+
store: o,
|
|
209
|
+
push: d,
|
|
210
|
+
replace: w,
|
|
211
|
+
back: p,
|
|
212
|
+
subscribe: o.subscribe,
|
|
213
|
+
matchRoute: (u) => x(r, u),
|
|
214
|
+
getCurrent: () => o.getState(),
|
|
215
|
+
resolveRouteComponent: H
|
|
157
216
|
};
|
|
158
217
|
}
|
|
159
|
-
function
|
|
160
|
-
return
|
|
218
|
+
function X(n, r) {
|
|
219
|
+
return x(n, r);
|
|
161
220
|
}
|
|
162
|
-
let
|
|
163
|
-
function
|
|
164
|
-
const
|
|
165
|
-
return
|
|
166
|
-
const t =
|
|
167
|
-
if (!t) return
|
|
168
|
-
const
|
|
169
|
-
let
|
|
170
|
-
|
|
221
|
+
let P = null;
|
|
222
|
+
function Y(n) {
|
|
223
|
+
const r = I(n);
|
|
224
|
+
return P = r, O("router-view", async () => {
|
|
225
|
+
const t = P || r;
|
|
226
|
+
if (!t) return S`<div>Router not initialized.</div>`;
|
|
227
|
+
const f = _(t.getCurrent());
|
|
228
|
+
let s;
|
|
229
|
+
N(() => {
|
|
171
230
|
try {
|
|
172
|
-
t && typeof t.subscribe == "function" && (
|
|
231
|
+
t && typeof t.subscribe == "function" && (s = t.subscribe((o) => {
|
|
173
232
|
try {
|
|
174
|
-
|
|
175
|
-
} catch (
|
|
176
|
-
$("router-view subscription update failed",
|
|
233
|
+
f.value = o;
|
|
234
|
+
} catch (c) {
|
|
235
|
+
$("router-view subscription update failed", c);
|
|
177
236
|
}
|
|
178
237
|
}));
|
|
179
|
-
} catch (
|
|
180
|
-
$("router-view subscribe failed",
|
|
238
|
+
} catch (o) {
|
|
239
|
+
$("router-view subscribe failed", o);
|
|
181
240
|
}
|
|
182
|
-
}),
|
|
183
|
-
if (typeof
|
|
241
|
+
}), j(() => {
|
|
242
|
+
if (typeof s == "function")
|
|
184
243
|
try {
|
|
185
|
-
|
|
186
|
-
} catch (
|
|
187
|
-
$("router-view unsubscribe failed",
|
|
244
|
+
s();
|
|
245
|
+
} catch (o) {
|
|
246
|
+
$("router-view unsubscribe failed", o);
|
|
188
247
|
}
|
|
189
248
|
});
|
|
190
|
-
const
|
|
191
|
-
if (!
|
|
249
|
+
const i = t.matchRoute(f.value.path);
|
|
250
|
+
if (!i || !i.route) return S`<div>Not found</div>`;
|
|
192
251
|
try {
|
|
193
|
-
const
|
|
194
|
-
if (typeof
|
|
195
|
-
return { tag:
|
|
196
|
-
if (typeof
|
|
197
|
-
const
|
|
198
|
-
return (
|
|
252
|
+
const c = await t.resolveRouteComponent(i.route);
|
|
253
|
+
if (typeof c == "string")
|
|
254
|
+
return { tag: c, props: {}, children: [] };
|
|
255
|
+
if (typeof c == "function") {
|
|
256
|
+
const d = c();
|
|
257
|
+
return (d instanceof Promise ? d : Promise.resolve(d)).then((p) => typeof p == "string" ? { tag: p, props: {}, children: [] } : p);
|
|
199
258
|
}
|
|
200
|
-
return
|
|
259
|
+
return S`<div>Invalid route component</div>`;
|
|
201
260
|
} catch {
|
|
202
|
-
return
|
|
261
|
+
return S`<div>Invalid route component</div>`;
|
|
203
262
|
}
|
|
204
|
-
}),
|
|
205
|
-
const t =
|
|
263
|
+
}), O("router-link", () => {
|
|
264
|
+
const t = W({
|
|
206
265
|
to: "",
|
|
207
266
|
tag: "a",
|
|
208
267
|
replace: !1,
|
|
@@ -215,107 +274,107 @@ function J(c) {
|
|
|
215
274
|
// allow host `class` and `style` attributes to be read via useProps
|
|
216
275
|
class: "",
|
|
217
276
|
style: ""
|
|
218
|
-
}),
|
|
219
|
-
let
|
|
220
|
-
|
|
221
|
-
const
|
|
222
|
-
|
|
277
|
+
}), f = P || r, s = _(f.getCurrent());
|
|
278
|
+
let i;
|
|
279
|
+
F(() => "a,button{display:inline-block;}");
|
|
280
|
+
const o = _(t.class || ""), c = _(t.style || "");
|
|
281
|
+
N((m) => {
|
|
223
282
|
try {
|
|
224
|
-
|
|
283
|
+
f && typeof f.subscribe == "function" && (i = f.subscribe((h) => {
|
|
225
284
|
try {
|
|
226
|
-
|
|
227
|
-
} catch (
|
|
228
|
-
$("router-link subscription update failed",
|
|
285
|
+
s.value = h;
|
|
286
|
+
} catch (v) {
|
|
287
|
+
$("router-link subscription update failed", v);
|
|
229
288
|
}
|
|
230
289
|
}));
|
|
231
|
-
} catch (
|
|
232
|
-
$("router-link subscribe failed",
|
|
290
|
+
} catch (h) {
|
|
291
|
+
$("router-link subscribe failed", h);
|
|
233
292
|
}
|
|
234
293
|
try {
|
|
235
|
-
const
|
|
236
|
-
if (
|
|
237
|
-
const
|
|
238
|
-
|
|
294
|
+
const h = m?._host;
|
|
295
|
+
if (h instanceof HTMLElement) {
|
|
296
|
+
const v = h.getAttribute("class"), y = h.getAttribute("style");
|
|
297
|
+
v && (o.value = v), y && (c.value = y), v !== null && h.removeAttribute("class"), y !== null && h.removeAttribute("style");
|
|
239
298
|
}
|
|
240
|
-
} catch (
|
|
241
|
-
$("router-link host migration failed",
|
|
299
|
+
} catch (h) {
|
|
300
|
+
$("router-link host migration failed", h);
|
|
242
301
|
}
|
|
243
|
-
}),
|
|
244
|
-
if (typeof
|
|
302
|
+
}), j(() => {
|
|
303
|
+
if (typeof i == "function")
|
|
245
304
|
try {
|
|
246
|
-
|
|
247
|
-
} catch (
|
|
248
|
-
$("router-link unsubscribe failed",
|
|
305
|
+
i();
|
|
306
|
+
} catch (m) {
|
|
307
|
+
$("router-link unsubscribe failed", m);
|
|
249
308
|
}
|
|
250
309
|
});
|
|
251
|
-
const
|
|
252
|
-
() =>
|
|
253
|
-
),
|
|
254
|
-
() => t.exact ?
|
|
255
|
-
),
|
|
256
|
-
const
|
|
257
|
-
for (const y of
|
|
258
|
-
return
|
|
259
|
-
}),
|
|
260
|
-
...
|
|
261
|
-
[t.activeClass || "active"]:
|
|
262
|
-
[t.exactActiveClass || "exact-active"]:
|
|
263
|
-
})),
|
|
264
|
-
() => Object.keys(
|
|
265
|
-
),
|
|
266
|
-
() =>
|
|
267
|
-
),
|
|
310
|
+
const d = g(
|
|
311
|
+
() => s.value.path === t.to
|
|
312
|
+
), w = g(
|
|
313
|
+
() => t.exact ? d.value : s.value && typeof s.value.path == "string" ? s.value.path.startsWith(t.to) : !1
|
|
314
|
+
), p = g(() => {
|
|
315
|
+
const h = (o && o.value || t.class || "").split(/\s+/).filter(Boolean), v = {};
|
|
316
|
+
for (const y of h) v[y] = !0;
|
|
317
|
+
return v;
|
|
318
|
+
}), b = g(() => ({
|
|
319
|
+
...p.value,
|
|
320
|
+
[t.activeClass || "active"]: w.value,
|
|
321
|
+
[t.exactActiveClass || "exact-active"]: d.value
|
|
322
|
+
})), k = g(
|
|
323
|
+
() => Object.keys(b.value).filter((m) => b.value[m]).join(" ")
|
|
324
|
+
), q = g(() => t.tag === "button"), R = g(
|
|
325
|
+
() => d.value ? t.ariaCurrentValue : ""
|
|
326
|
+
), u = g(() => !!t.disabled), l = g(
|
|
268
327
|
() => !!t.external && (t.tag === "a" || !t.tag)
|
|
269
|
-
), e =
|
|
270
|
-
() =>
|
|
271
|
-
),
|
|
328
|
+
), e = g(
|
|
329
|
+
() => c && c.value || t.style || ""
|
|
330
|
+
), a = (m) => {
|
|
272
331
|
if (t.disabled) {
|
|
273
|
-
|
|
332
|
+
m.preventDefault();
|
|
274
333
|
return;
|
|
275
334
|
}
|
|
276
|
-
t.external && (t.tag === "a" || !t.tag) || (
|
|
335
|
+
t.external && (t.tag === "a" || !t.tag) || (m.preventDefault(), t.replace ? f.replace(t.to) : f.push(t.to));
|
|
277
336
|
};
|
|
278
|
-
return
|
|
279
|
-
${
|
|
280
|
-
|
|
281
|
-
|
|
337
|
+
return S`
|
|
338
|
+
${M().when(
|
|
339
|
+
q.value,
|
|
340
|
+
S`
|
|
282
341
|
<button
|
|
283
342
|
part="button"
|
|
284
|
-
class="${
|
|
343
|
+
class="${k.value}"
|
|
285
344
|
style="${e.value || null}"
|
|
286
|
-
aria-current="${
|
|
287
|
-
disabled="${
|
|
288
|
-
aria-disabled="${
|
|
289
|
-
tabindex="${
|
|
290
|
-
@click="${
|
|
345
|
+
aria-current="${R.value}"
|
|
346
|
+
disabled="${u.value ? "" : null}"
|
|
347
|
+
aria-disabled="${u.value ? "true" : null}"
|
|
348
|
+
tabindex="${u.value ? "-1" : null}"
|
|
349
|
+
@click="${a}"
|
|
291
350
|
>
|
|
292
351
|
<slot></slot>
|
|
293
352
|
</button>
|
|
294
353
|
`
|
|
295
|
-
).otherwise(
|
|
354
|
+
).otherwise(S`
|
|
296
355
|
<a
|
|
297
356
|
part="link"
|
|
298
357
|
href="${t.to}"
|
|
299
|
-
class="${
|
|
358
|
+
class="${k.value}"
|
|
300
359
|
style="${e.value || null}"
|
|
301
|
-
aria-current="${
|
|
302
|
-
aria-disabled="${
|
|
303
|
-
tabindex="${
|
|
304
|
-
target="${
|
|
305
|
-
rel="${
|
|
306
|
-
@click="${
|
|
360
|
+
aria-current="${R.value}"
|
|
361
|
+
aria-disabled="${u.value ? "true" : null}"
|
|
362
|
+
tabindex="${u.value ? "-1" : null}"
|
|
363
|
+
target="${l.value ? "_blank" : null}"
|
|
364
|
+
rel="${l.value ? "noopener noreferrer" : null}"
|
|
365
|
+
@click="${a}"
|
|
307
366
|
><slot></slot
|
|
308
367
|
></a>
|
|
309
368
|
`).done()}
|
|
310
369
|
`;
|
|
311
|
-
}),
|
|
370
|
+
}), r;
|
|
312
371
|
}
|
|
313
372
|
export {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
373
|
+
Y as initRouter,
|
|
374
|
+
x as matchRoute,
|
|
375
|
+
X as matchRouteSSR,
|
|
376
|
+
T as parseQuery,
|
|
377
|
+
H as resolveRouteComponent,
|
|
378
|
+
I as useRouter
|
|
320
379
|
};
|
|
321
380
|
//# sourceMappingURL=custom-elements-runtime.router.es.js.map
|