@benjavicente/angular-router-experimental 1.142.12 → 1.142.14
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/fesm2022/tanstack-angular-router-experimental-experimental.mjs +199 -166
- package/dist/fesm2022/tanstack-angular-router-experimental.mjs +675 -637
- package/dist/types/tanstack-angular-router-experimental-experimental.d.ts +37 -40
- package/dist/types/tanstack-angular-router-experimental.d.ts +41 -42
- package/package.json +4 -4
- package/src/Match.ts +53 -11
- package/src/document/install-unified-document-sync.ts +1 -2
- package/src/document/provide-tanstack-body-managed-tags.ts +1 -2
- package/src/document/provide-tanstack-document-title.ts +1 -2
- package/src/document/provide-tanstack-head-managed-tags.ts +1 -2
- package/src/index.ts +1 -0
- package/src/injectIsShell.ts +7 -0
- package/src/renderer/injectIsCatchingError.ts +20 -8
- package/src/renderer/injectRender.ts +4 -2
- package/src/route.ts +0 -3
- package/src/ssr-scroll-restoration.ts +1 -1
|
@@ -1,92 +1,92 @@
|
|
|
1
1
|
import "@tanstack/store";
|
|
2
2
|
import * as e from "@angular/core";
|
|
3
|
-
import { ChangeDetectionStrategy as t, DestroyRef as n, ElementRef as r, EnvironmentInjector as i, InjectionToken as a, Injector as o, Renderer2 as s, ViewContainerRef as c, afterNextRender as l, assertInInjectionContext as u, computed as d, effect as f, inject as p, input as m, inputBinding as h, isDevMode as g, linkedSignal as _, runInInjectionContext as ee, signal as
|
|
4
|
-
import { DOCUMENT as
|
|
5
|
-
var
|
|
6
|
-
function
|
|
3
|
+
import { ChangeDetectionStrategy as t, DestroyRef as n, ElementRef as r, EnvironmentInjector as i, InjectionToken as a, Injector as o, Renderer2 as s, ViewContainerRef as c, afterNextRender as l, assertInInjectionContext as u, computed as d, effect as f, inject as p, input as m, inputBinding as h, isDevMode as g, linkedSignal as _, runInInjectionContext as ee, signal as te, untracked as v } from "@angular/core";
|
|
4
|
+
import { DOCUMENT as ne } from "@angular/common";
|
|
5
|
+
var re = Object.prototype.hasOwnProperty, y = Object.prototype.propertyIsEnumerable;
|
|
6
|
+
function ie(e, t, n = () => ({}), r = 0) {
|
|
7
7
|
if (e === t) return e;
|
|
8
8
|
if (r > 500) return t;
|
|
9
|
-
let i = t, a =
|
|
10
|
-
if (!a && !(
|
|
11
|
-
let o = a ? e :
|
|
9
|
+
let i = t, a = C(e) && C(i);
|
|
10
|
+
if (!a && !(x(e) && x(i))) return i;
|
|
11
|
+
let o = a ? e : b(e);
|
|
12
12
|
if (!o) return i;
|
|
13
|
-
let s = a ? i :
|
|
13
|
+
let s = a ? i : b(i);
|
|
14
14
|
if (!s) return i;
|
|
15
15
|
let c = o.length, l = s.length, u = a ? Array(l) : n(), d = 0;
|
|
16
16
|
for (let t = 0; t < l; t++) {
|
|
17
17
|
let o = a ? t : s[t], l = e[o], f = i[o];
|
|
18
18
|
if (l === f) {
|
|
19
|
-
u[o] = l, (a ? t < c :
|
|
19
|
+
u[o] = l, (a ? t < c : re.call(e, o)) && d++;
|
|
20
20
|
continue;
|
|
21
21
|
}
|
|
22
22
|
if (l === null || f === null || typeof l != "object" || typeof f != "object") {
|
|
23
23
|
u[o] = f;
|
|
24
24
|
continue;
|
|
25
25
|
}
|
|
26
|
-
let p =
|
|
26
|
+
let p = ie(l, f, n, r + 1);
|
|
27
27
|
u[o] = p, p === l && d++;
|
|
28
28
|
}
|
|
29
29
|
return c === l && d === c ? e : u;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function b(e) {
|
|
32
32
|
let t = Object.getOwnPropertyNames(e);
|
|
33
|
-
for (let n of t) if (!
|
|
33
|
+
for (let n of t) if (!y.call(e, n)) return !1;
|
|
34
34
|
let n = Object.getOwnPropertySymbols(e);
|
|
35
35
|
if (n.length === 0) return t;
|
|
36
36
|
let r = t;
|
|
37
37
|
for (let t of n) {
|
|
38
|
-
if (!
|
|
38
|
+
if (!y.call(e, t)) return !1;
|
|
39
39
|
r.push(t);
|
|
40
40
|
}
|
|
41
41
|
return r;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
if (!
|
|
43
|
+
function x(e) {
|
|
44
|
+
if (!S(e)) return !1;
|
|
45
45
|
let t = e.constructor;
|
|
46
46
|
if (t === void 0) return !0;
|
|
47
47
|
let n = t.prototype;
|
|
48
|
-
return !(!
|
|
48
|
+
return !(!S(n) || !n.hasOwnProperty("isPrototypeOf"));
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function S(e) {
|
|
51
51
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function C(e) {
|
|
54
54
|
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function w(e, t, n) {
|
|
57
57
|
if (e === t) return !0;
|
|
58
58
|
if (typeof e != typeof t) return !1;
|
|
59
59
|
if (Array.isArray(e) && Array.isArray(t)) {
|
|
60
60
|
if (e.length !== t.length) return !1;
|
|
61
|
-
for (let r = 0, i = e.length; r < i; r++) if (!
|
|
61
|
+
for (let r = 0, i = e.length; r < i; r++) if (!w(e[r], t[r], n)) return !1;
|
|
62
62
|
return !0;
|
|
63
63
|
}
|
|
64
|
-
if (
|
|
64
|
+
if (x(e) && x(t)) {
|
|
65
65
|
let r = n?.ignoreUndefined ?? !0;
|
|
66
66
|
if (n?.partial) {
|
|
67
|
-
for (let i in t) if ((!r || t[i] !== void 0) && !
|
|
67
|
+
for (let i in t) if ((!r || t[i] !== void 0) && !w(e[i], t[i], n)) return !1;
|
|
68
68
|
return !0;
|
|
69
69
|
}
|
|
70
70
|
let i = 0;
|
|
71
71
|
if (!r) i = Object.keys(e).length;
|
|
72
72
|
else for (let t in e) e[t] !== void 0 && i++;
|
|
73
73
|
let a = 0;
|
|
74
|
-
for (let o in t) if ((!r || t[o] !== void 0) && (a++, a > i || !
|
|
74
|
+
for (let o in t) if ((!r || t[o] !== void 0) && (a++, a > i || !w(e[o], t[o], n))) return !1;
|
|
75
75
|
return i === a;
|
|
76
76
|
}
|
|
77
77
|
return !1;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function ae() {
|
|
80
80
|
throw Error("Invariant failed");
|
|
81
81
|
}
|
|
82
|
-
var
|
|
83
|
-
function
|
|
82
|
+
var oe = 4, T = 5;
|
|
83
|
+
function se(e) {
|
|
84
84
|
let t = e.indexOf("{");
|
|
85
85
|
if (t === -1) return null;
|
|
86
86
|
let n = e.indexOf("}", t);
|
|
87
87
|
return n === -1 || t + 1 >= e.length ? null : [t, n];
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function ce(e, t, n = new Uint16Array(6)) {
|
|
90
90
|
let r = e.indexOf("/", t), i = r === -1 ? e.length : r, a = e.substring(t, i);
|
|
91
91
|
if (!a || !a.includes("$")) return n[0] = 0, n[1] = t, n[2] = t, n[3] = i, n[4] = i, n[5] = i, n;
|
|
92
92
|
if (a === "$") {
|
|
@@ -94,7 +94,7 @@ function oe(e, t, n = new Uint16Array(6)) {
|
|
|
94
94
|
return n[0] = 2, n[1] = t, n[2] = t, n[3] = r, n[4] = r, n[5] = r, n;
|
|
95
95
|
}
|
|
96
96
|
if (a.charCodeAt(0) === 36) return n[0] = 1, n[1] = t, n[2] = t + 1, n[3] = i, n[4] = i, n[5] = i, n;
|
|
97
|
-
let o =
|
|
97
|
+
let o = se(a);
|
|
98
98
|
if (o) {
|
|
99
99
|
let [r, s] = o, c = a.charCodeAt(r + 1);
|
|
100
100
|
if (c === 45) {
|
|
@@ -109,13 +109,13 @@ function oe(e, t, n = new Uint16Array(6)) {
|
|
|
109
109
|
}
|
|
110
110
|
return n[0] = 0, n[1] = t, n[2] = t, n[3] = i, n[4] = i, n[5] = i, n;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function le(e, t, n, r, i, a, o) {
|
|
113
113
|
o?.(n);
|
|
114
114
|
let s = r;
|
|
115
115
|
{
|
|
116
116
|
let r = n.fullPath ?? n.from, o = r.length, c = n.options?.caseSensitive ?? e, l = n.options?.params?.parse ?? n.options?.parseParams;
|
|
117
117
|
for (; s < o;) {
|
|
118
|
-
let e =
|
|
118
|
+
let e = ce(r, s, t), o, u = s, d = e[5];
|
|
119
119
|
switch (s = d + 1, a++, e[0]) {
|
|
120
120
|
case 0: {
|
|
121
121
|
let t = r.substring(e[2], e[3]);
|
|
@@ -124,7 +124,7 @@ function se(e, t, n, r, i, a, o) {
|
|
|
124
124
|
if (e) o = e;
|
|
125
125
|
else {
|
|
126
126
|
i.static ??= /* @__PURE__ */ new Map();
|
|
127
|
-
let e =
|
|
127
|
+
let e = O(n.fullPath ?? n.from);
|
|
128
128
|
e.parent = i, e.depth = a, o = e, i.static.set(t, e);
|
|
129
129
|
}
|
|
130
130
|
} else {
|
|
@@ -132,7 +132,7 @@ function se(e, t, n, r, i, a, o) {
|
|
|
132
132
|
if (r) o = r;
|
|
133
133
|
else {
|
|
134
134
|
i.staticInsensitive ??= /* @__PURE__ */ new Map();
|
|
135
|
-
let t =
|
|
135
|
+
let t = O(n.fullPath ?? n.from);
|
|
136
136
|
t.parent = i, t.depth = a, o = t, i.staticInsensitive.set(e, t);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -142,7 +142,7 @@ function se(e, t, n, r, i, a, o) {
|
|
|
142
142
|
let t = r.substring(u, e[1]), s = r.substring(e[4], d), f = c && !!(t || s), p = t ? f ? t : t.toLowerCase() : void 0, m = s ? f ? s : s.toLowerCase() : void 0, h = !l && i.dynamic?.find((e) => !e.parse && e.caseSensitive === f && e.prefix === p && e.suffix === m);
|
|
143
143
|
if (h) o = h;
|
|
144
144
|
else {
|
|
145
|
-
let e =
|
|
145
|
+
let e = k(1, n.fullPath ?? n.from, f, p, m);
|
|
146
146
|
o = e, e.depth = a, e.parent = i, i.dynamic ??= [], i.dynamic.push(e);
|
|
147
147
|
}
|
|
148
148
|
break;
|
|
@@ -151,32 +151,32 @@ function se(e, t, n, r, i, a, o) {
|
|
|
151
151
|
let t = r.substring(u, e[1]), s = r.substring(e[4], d), f = c && !!(t || s), p = t ? f ? t : t.toLowerCase() : void 0, m = s ? f ? s : s.toLowerCase() : void 0, h = !l && i.optional?.find((e) => !e.parse && e.caseSensitive === f && e.prefix === p && e.suffix === m);
|
|
152
152
|
if (h) o = h;
|
|
153
153
|
else {
|
|
154
|
-
let e =
|
|
154
|
+
let e = k(3, n.fullPath ?? n.from, f, p, m);
|
|
155
155
|
o = e, e.parent = i, e.depth = a, i.optional ??= [], i.optional.push(e);
|
|
156
156
|
}
|
|
157
157
|
break;
|
|
158
158
|
}
|
|
159
159
|
case 2: {
|
|
160
|
-
let t = r.substring(u, e[1]), s = r.substring(e[4], d), l = c && !!(t || s), f = t ? l ? t : t.toLowerCase() : void 0, p = s ? l ? s : s.toLowerCase() : void 0, m =
|
|
160
|
+
let t = r.substring(u, e[1]), s = r.substring(e[4], d), l = c && !!(t || s), f = t ? l ? t : t.toLowerCase() : void 0, p = s ? l ? s : s.toLowerCase() : void 0, m = k(2, n.fullPath ?? n.from, l, f, p);
|
|
161
161
|
o = m, m.parent = i, m.depth = a, i.wildcard ??= [], i.wildcard.push(m);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
i = o;
|
|
165
165
|
}
|
|
166
166
|
if (l && n.children && !n.isRoot && n.id && n.id.charCodeAt(n.id.lastIndexOf("/") + 1) === 95) {
|
|
167
|
-
let e =
|
|
168
|
-
e.kind =
|
|
167
|
+
let e = O(n.fullPath ?? n.from);
|
|
168
|
+
e.kind = T, e.parent = i, a++, e.depth = a, i.pathless ??= [], i.pathless.push(e), i = e;
|
|
169
169
|
}
|
|
170
170
|
let u = (n.path || !n.children) && !n.isRoot;
|
|
171
171
|
if (u && r.endsWith("/")) {
|
|
172
|
-
let e =
|
|
173
|
-
e.kind =
|
|
172
|
+
let e = O(n.fullPath ?? n.from);
|
|
173
|
+
e.kind = oe, e.parent = i, a++, e.depth = a, i.index = e, i = e;
|
|
174
174
|
}
|
|
175
175
|
i.parse = l ?? null, u && !i.route && (i.route = n, i.fullPath = n.fullPath ?? n.from);
|
|
176
176
|
}
|
|
177
|
-
if (n.children) for (let r of n.children)
|
|
177
|
+
if (n.children) for (let r of n.children) le(e, t, r, s, i, a, o);
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function E(e, t) {
|
|
180
180
|
if (e.parse && !t.parse) return -1;
|
|
181
181
|
if (!e.parse && t.parse) return 1;
|
|
182
182
|
if (e.prefix && t.prefix && e.prefix !== t.prefix) {
|
|
@@ -189,24 +189,24 @@ function O(e, t) {
|
|
|
189
189
|
}
|
|
190
190
|
return e.prefix && !t.prefix ? -1 : !e.prefix && t.prefix ? 1 : e.suffix && !t.suffix ? -1 : !e.suffix && t.suffix ? 1 : e.caseSensitive && !t.caseSensitive ? -1 : !e.caseSensitive && t.caseSensitive ? 1 : 0;
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
if (e.pathless) for (let t of e.pathless)
|
|
194
|
-
if (e.static) for (let t of e.static.values())
|
|
195
|
-
if (e.staticInsensitive) for (let t of e.staticInsensitive.values())
|
|
192
|
+
function D(e) {
|
|
193
|
+
if (e.pathless) for (let t of e.pathless) D(t);
|
|
194
|
+
if (e.static) for (let t of e.static.values()) D(t);
|
|
195
|
+
if (e.staticInsensitive) for (let t of e.staticInsensitive.values()) D(t);
|
|
196
196
|
if (e.dynamic?.length) {
|
|
197
|
-
e.dynamic.sort(
|
|
198
|
-
for (let t of e.dynamic)
|
|
197
|
+
e.dynamic.sort(E);
|
|
198
|
+
for (let t of e.dynamic) D(t);
|
|
199
199
|
}
|
|
200
200
|
if (e.optional?.length) {
|
|
201
|
-
e.optional.sort(
|
|
202
|
-
for (let t of e.optional)
|
|
201
|
+
e.optional.sort(E);
|
|
202
|
+
for (let t of e.optional) D(t);
|
|
203
203
|
}
|
|
204
204
|
if (e.wildcard?.length) {
|
|
205
|
-
e.wildcard.sort(
|
|
206
|
-
for (let t of e.wildcard)
|
|
205
|
+
e.wildcard.sort(E);
|
|
206
|
+
for (let t of e.wildcard) D(t);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function O(e) {
|
|
210
210
|
return {
|
|
211
211
|
kind: 0,
|
|
212
212
|
depth: 0,
|
|
@@ -223,7 +223,7 @@ function A(e) {
|
|
|
223
223
|
parse: null
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function k(e, t, n, r, i) {
|
|
227
227
|
return {
|
|
228
228
|
kind: e,
|
|
229
229
|
depth: 0,
|
|
@@ -243,19 +243,19 @@ function j(e, t, n, r, i) {
|
|
|
243
243
|
suffix: i
|
|
244
244
|
};
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function A(e) {
|
|
247
247
|
let t = e.length;
|
|
248
248
|
return t > 1 && e[t - 1] === "/" ? e.replace(/\/{1,}$/, "") : e;
|
|
249
249
|
}
|
|
250
|
-
function
|
|
250
|
+
function j(e, t) {
|
|
251
251
|
return e?.endsWith("/") && e !== "/" && e !== `${t}/` ? e.slice(0, -1) : e;
|
|
252
252
|
}
|
|
253
|
-
function
|
|
254
|
-
return
|
|
253
|
+
function M(e, t, n) {
|
|
254
|
+
return j(e, n) === j(t, n);
|
|
255
255
|
}
|
|
256
256
|
JSON.parse, JSON.stringify, JSON.parse;
|
|
257
|
-
var
|
|
258
|
-
function
|
|
257
|
+
var N = "__root__";
|
|
258
|
+
function P(e, t) {
|
|
259
259
|
let n = t, r = e;
|
|
260
260
|
return {
|
|
261
261
|
fromLocation: n,
|
|
@@ -266,8 +266,8 @@ function F(e, t) {
|
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
268
|
Error, Error;
|
|
269
|
-
var
|
|
270
|
-
function
|
|
269
|
+
var ue = "Error preloading route! ☝️";
|
|
270
|
+
function de(e) {
|
|
271
271
|
if (typeof document < "u" && document.querySelector) {
|
|
272
272
|
let t = e.stores.location.get(), n = t.state.__hashScrollIntoViewOptions ?? !0;
|
|
273
273
|
if (n && t.hash !== "") {
|
|
@@ -276,27 +276,27 @@ function ue(e) {
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
var
|
|
279
|
+
var fe = {
|
|
280
280
|
matchId: () => void 0,
|
|
281
281
|
routeId: () => void 0,
|
|
282
282
|
match: () => void 0,
|
|
283
283
|
hasPending: () => !1
|
|
284
|
-
},
|
|
284
|
+
}, F = /* @__PURE__ */ new e.InjectionToken("MATCH_CONTEXT_INJECTOR", {
|
|
285
285
|
providedIn: "root",
|
|
286
|
-
factory: () =>
|
|
287
|
-
}),
|
|
288
|
-
function
|
|
289
|
-
return typeof document > "u" ?
|
|
286
|
+
factory: () => fe
|
|
287
|
+
}), I = /* @__PURE__ */ new e.InjectionToken("ROUTER");
|
|
288
|
+
function L() {
|
|
289
|
+
return typeof document > "u" ? I : window.__TSR_ROUTER_INJECTION_KEY__ ? window.__TSR_ROUTER_INJECTION_KEY__ : (window.__TSR_ROUTER_INJECTION_KEY__ = I, I);
|
|
290
290
|
}
|
|
291
|
-
function
|
|
292
|
-
let n = e.inject(
|
|
291
|
+
function R(t) {
|
|
292
|
+
let n = e.inject(L(), { optional: !0 });
|
|
293
293
|
return process.env.NODE_ENV !== "production" && (t?.warn ?? !0) && !n && console.warn("Warning: injectRouter must be used inside a <router-provider> component!"), n;
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function z(e, t) {
|
|
296
296
|
return t || (u(e), p(o));
|
|
297
297
|
}
|
|
298
|
-
function
|
|
299
|
-
return ee(B
|
|
298
|
+
function B(e, t = (e) => e, n) {
|
|
299
|
+
return ee(z(B, n?.injector), () => {
|
|
300
300
|
let r = typeof e == "function" ? e : () => e, i = _(() => t(r().get()), { equal: n?.compare });
|
|
301
301
|
return f((e) => {
|
|
302
302
|
let { unsubscribe: n } = r().subscribe((e) => {
|
|
@@ -306,37 +306,37 @@ function V(e, t = (e) => e, n) {
|
|
|
306
306
|
}), i.asReadonly();
|
|
307
307
|
});
|
|
308
308
|
}
|
|
309
|
-
function
|
|
309
|
+
function V(e, t = (e) => e, n) {
|
|
310
310
|
let { equal: r, injector: i, ...a } = n ?? {};
|
|
311
|
-
return
|
|
311
|
+
return B(e, t, {
|
|
312
312
|
...a,
|
|
313
313
|
compare: r,
|
|
314
314
|
injector: i
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
|
-
var
|
|
317
|
+
var H = {
|
|
318
318
|
get: () => void 0,
|
|
319
319
|
subscribe: () => ({ unsubscribe: () => {} })
|
|
320
320
|
};
|
|
321
|
-
function
|
|
322
|
-
let n =
|
|
321
|
+
function pe(t) {
|
|
322
|
+
let n = R(), r = t.from ? void 0 : e.inject(F), i = V(t.from ? n.stores.getRouteMatchStore(t.from) : () => {
|
|
323
323
|
let e = r?.matchId();
|
|
324
|
-
return e ? n.stores.matchStores.get(e) ??
|
|
325
|
-
}, (e) => e), a =
|
|
324
|
+
return e ? n.stores.matchStores.get(e) ?? H : H;
|
|
325
|
+
}, (e) => e), a = V(n.stores.pendingRouteIds, (e) => e), o = V(n.stores.isTransitioning, (e) => e);
|
|
326
326
|
return e.computed(() => {
|
|
327
327
|
let e = i();
|
|
328
328
|
if (e !== void 0) return t.select ? t.select(e) : e;
|
|
329
329
|
if (!(t.from ? a()[t.from] : r?.hasPending() ?? !1) && !o() && (t.shouldThrow ?? !0)) {
|
|
330
330
|
if (process.env.NODE_ENV !== "production") throw Error(`Invariant failed: Could not find ${t.from ? `an active match from "${t.from}"` : "a nearest match!"}`);
|
|
331
|
-
|
|
331
|
+
ae();
|
|
332
332
|
}
|
|
333
|
-
}, { equal:
|
|
333
|
+
}, { equal: w });
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function U(e) {
|
|
336
336
|
let t = p(c), r = p(o), i = [];
|
|
337
337
|
f(() => {
|
|
338
|
-
let n = e(), a =
|
|
339
|
-
if (
|
|
338
|
+
let n = e(), a = me(n);
|
|
339
|
+
if (W(i, a)) return;
|
|
340
340
|
i.length > 0 && t.clear(), i = a;
|
|
341
341
|
let s = n?.component;
|
|
342
342
|
if (!s) return;
|
|
@@ -352,16 +352,16 @@ function W(e) {
|
|
|
352
352
|
t.clear();
|
|
353
353
|
});
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function me(e) {
|
|
356
356
|
let t = e?.component;
|
|
357
|
-
return !e || !t ? [] : [t, e.key];
|
|
357
|
+
return !e || !t ? [] : Array.isArray(e.key) ? [t, ...e.key] : [t, e.key];
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function W(e, t) {
|
|
360
360
|
if (e.length !== t.length) return !1;
|
|
361
361
|
for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
|
|
362
362
|
return !0;
|
|
363
363
|
}
|
|
364
|
-
var
|
|
364
|
+
var he = class n {
|
|
365
365
|
static {
|
|
366
366
|
this.ɵfac = function(e) {
|
|
367
367
|
return new (e || n)();
|
|
@@ -385,32 +385,56 @@ var me = class n {
|
|
|
385
385
|
changeDetection: t.OnPush
|
|
386
386
|
});
|
|
387
387
|
}
|
|
388
|
-
},
|
|
388
|
+
}, G = /* @__PURE__ */ new e.InjectionToken("ERROR_STATE_INJECTOR_TOKEN");
|
|
389
389
|
function ge(e) {
|
|
390
|
-
let t =
|
|
391
|
-
return e?.select ?
|
|
390
|
+
let t = R({ warn: e?.router === void 0 }), n = e?.router ?? t;
|
|
391
|
+
return e?.select ? V(n.stores.__store, e.select, { equal: w }) : V(n.stores.__store);
|
|
392
392
|
}
|
|
393
393
|
function _e({ matchId: t }) {
|
|
394
|
-
let n =
|
|
394
|
+
let n = R(), r = ge({ select: (e) => e.matches }), i = e.computed(() => r().findIndex((e) => e.id === t()));
|
|
395
395
|
return e.computed(() => {
|
|
396
|
-
if (n.options.defaultErrorComponent != null) return
|
|
396
|
+
if (n.options.defaultErrorComponent != null) return;
|
|
397
397
|
let e = i();
|
|
398
|
-
if (e === -1) return
|
|
398
|
+
if (e === -1) return;
|
|
399
399
|
let t = r();
|
|
400
400
|
for (let r = e + 1; r < t.length; r++) {
|
|
401
401
|
let e = t[r];
|
|
402
|
-
if (n.routesById[e?.routeId].options.errorComponent != null) return
|
|
403
|
-
if (e?.status === "error") return
|
|
402
|
+
if (n.routesById[e?.routeId].options.errorComponent != null) return;
|
|
403
|
+
if (e?.status === "error") return e;
|
|
404
404
|
}
|
|
405
|
-
return !1;
|
|
406
405
|
});
|
|
407
406
|
}
|
|
408
407
|
var K = {
|
|
409
408
|
get: () => void 0,
|
|
410
409
|
subscribe: () => ({ unsubscribe: () => {} })
|
|
410
|
+
}, ve = class t {
|
|
411
|
+
constructor() {
|
|
412
|
+
this.state = p(G), this.message = d(() => {
|
|
413
|
+
let e = this.state.error;
|
|
414
|
+
return e instanceof Error ? e.stack ?? e.message : String(e);
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
static {
|
|
418
|
+
this.ɵfac = function(e) {
|
|
419
|
+
return new (e || t)();
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
static {
|
|
423
|
+
this.ɵcmp = /* @__PURE__ */ e.ɵɵdefineComponent({
|
|
424
|
+
type: t,
|
|
425
|
+
selectors: [["tanstack-router-default-error"]],
|
|
426
|
+
decls: 5,
|
|
427
|
+
vars: 1,
|
|
428
|
+
consts: [["role", "alert"]],
|
|
429
|
+
template: function(t, n) {
|
|
430
|
+
t & 1 && (e.ɵɵelementStart(0, "div", 0)(1, "p"), e.ɵɵtext(2, "Something went wrong."), e.ɵɵelementEnd(), e.ɵɵelementStart(3, "pre"), e.ɵɵtext(4), e.ɵɵelementEnd()()), t & 2 && (e.ɵɵadvance(4), e.ɵɵtextInterpolate(n.message()));
|
|
431
|
+
},
|
|
432
|
+
encapsulation: 2
|
|
433
|
+
});
|
|
434
|
+
}
|
|
411
435
|
};
|
|
412
|
-
function
|
|
413
|
-
let t =
|
|
436
|
+
function ye({ parentRouteIsRoot: e }) {
|
|
437
|
+
let t = R({ warn: !1 }), r = p(i), a = p(n), o = V(t.stores.resolvedLocation, (e) => e?.state?.__TSR_key), s = V(t.stores.loadedAt, (e) => e), c, u = 0;
|
|
414
438
|
a.onDestroy(() => {
|
|
415
439
|
u++;
|
|
416
440
|
}), f(() => {
|
|
@@ -422,14 +446,14 @@ function ve({ parentRouteIsRoot: e }) {
|
|
|
422
446
|
let r = t.latestLocation.href;
|
|
423
447
|
c !== void 0 && c === r || (c = r, t.emit({
|
|
424
448
|
type: "onRendered",
|
|
425
|
-
...
|
|
449
|
+
...P(t.stores.location.get(), t.stores.resolvedLocation.get())
|
|
426
450
|
}));
|
|
427
451
|
} }, { injector: r });
|
|
428
452
|
});
|
|
429
453
|
}
|
|
430
454
|
var q = class t {
|
|
431
455
|
constructor() {
|
|
432
|
-
this.matchId = m.required(), this.router =
|
|
456
|
+
this.matchId = m.required(), this.router = R(), this.match = d(() => this.matchSignal()), this.matchSignal = V(() => this.router.stores.matchStores.get(this.matchId()) ?? K, (e) => e), this.matchData = d(() => {
|
|
433
457
|
let e = this.match();
|
|
434
458
|
if (!e) return null;
|
|
435
459
|
let t = e.routeId, n = this.router.routesById[t], r = n.parentRoute?.id ?? null, i = (n.options.remountDeps ?? this.router.options.defaultRemountDeps)?.({
|
|
@@ -444,45 +468,51 @@ var q = class t {
|
|
|
444
468
|
match: e,
|
|
445
469
|
parentRouteId: r
|
|
446
470
|
};
|
|
447
|
-
}), this.isFistRouteInRouteTree = d(() => this.matchData()?.parentRouteId ===
|
|
471
|
+
}), this.isFistRouteInRouteTree = d(() => this.matchData()?.parentRouteId === N), this.resolvedNoSsr = d(() => {
|
|
448
472
|
let e = this.matchData()?.match;
|
|
449
473
|
return e ? e.ssr === !1 || e.ssr === "data-only" : !0;
|
|
450
474
|
}), this.shouldClientOnly = d(() => {
|
|
451
475
|
let e = this.matchData()?.match;
|
|
452
476
|
return e ? this.resolvedNoSsr() || !!e._displayPending : !0;
|
|
453
|
-
}), this.parentRouteIdSignal = d(() => this.matchData()?.parentRouteId ?? ""), this.rootRouteIdSignal = d(() =>
|
|
477
|
+
}), this.parentRouteIdSignal = d(() => this.matchData()?.parentRouteId ?? ""), this.rootRouteIdSignal = d(() => N), this.hasPendingMatch = d(() => {
|
|
454
478
|
let e = this.matchData()?.route.id;
|
|
455
479
|
return e ? !!this.pendingRouteIds()[e] : !1;
|
|
456
|
-
}), this.pendingRouteIds =
|
|
480
|
+
}), this.pendingRouteIds = V(this.router.stores.pendingRouteIds, (e) => e), this.nearestMatchContext = {
|
|
457
481
|
matchId: this.matchId,
|
|
458
482
|
routeId: d(() => this.matchData()?.route.id),
|
|
459
483
|
match: this.match,
|
|
460
484
|
hasPending: this.hasPendingMatch
|
|
461
|
-
}, this.
|
|
485
|
+
}, this.catchingErrorMatch = _e({ matchId: this.matchId }), this.render = U(() => {
|
|
462
486
|
let e = this.matchData();
|
|
463
|
-
if (!e
|
|
487
|
+
if (!e) return null;
|
|
464
488
|
let { match: t, route: n } = e;
|
|
489
|
+
if (this.shouldClientOnly() && this.router.isServer) {
|
|
490
|
+
let e = Y(n.options.pendingComponent) ?? Y(this.router.options.defaultPendingComponent);
|
|
491
|
+
return e ? { component: e } : null;
|
|
492
|
+
}
|
|
465
493
|
if (t.status === "notFound") return { component: X(this.router, n) };
|
|
466
|
-
if (t.status === "error" || this.
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
494
|
+
if (t.status === "error" || this.catchingErrorMatch()) {
|
|
495
|
+
let e = this.catchingErrorMatch();
|
|
496
|
+
return {
|
|
497
|
+
component: be(this.router, n),
|
|
498
|
+
providers: [{
|
|
499
|
+
provide: G,
|
|
500
|
+
useValue: {
|
|
501
|
+
error: t.status === "error" ? t.error : e?.error,
|
|
502
|
+
reset: () => {
|
|
503
|
+
this.router.invalidate();
|
|
504
|
+
},
|
|
505
|
+
info: { componentStack: "" }
|
|
506
|
+
}
|
|
507
|
+
}]
|
|
508
|
+
};
|
|
509
|
+
} else if (t.status === "redirected" || t.status === "pending") {
|
|
480
510
|
let t = n.isRoot && (Y(n.options.component) ?? Y(this.router.options.defaultComponent));
|
|
481
511
|
return t && t !== J ? {
|
|
482
512
|
key: e.key,
|
|
483
513
|
component: t,
|
|
484
514
|
providers: [{
|
|
485
|
-
provide:
|
|
515
|
+
provide: F,
|
|
486
516
|
useValue: this.nearestMatchContext
|
|
487
517
|
}]
|
|
488
518
|
} : { component: Y(n.options.pendingComponent) ?? Y(this.router.options.defaultPendingComponent) };
|
|
@@ -492,12 +522,12 @@ var q = class t {
|
|
|
492
522
|
key: e.key,
|
|
493
523
|
component: t,
|
|
494
524
|
providers: [{
|
|
495
|
-
provide:
|
|
525
|
+
provide: F,
|
|
496
526
|
useValue: this.nearestMatchContext
|
|
497
527
|
}]
|
|
498
528
|
};
|
|
499
529
|
}
|
|
500
|
-
}), this.onRendered =
|
|
530
|
+
}), this.onRendered = ye({ parentRouteIsRoot: d(() => this.parentRouteIdSignal() === N) });
|
|
501
531
|
}
|
|
502
532
|
static {
|
|
503
533
|
this.ɵfac = function(e) {
|
|
@@ -526,13 +556,13 @@ var q = class t {
|
|
|
526
556
|
}
|
|
527
557
|
}, J = class t {
|
|
528
558
|
constructor() {
|
|
529
|
-
this.router =
|
|
559
|
+
this.router = R(), this.nearestMatch = p(F), this.currentMatch = V(() => {
|
|
530
560
|
let e = this.nearestMatch.matchId();
|
|
531
561
|
return e ? this.router.stores.matchStores.get(e) ?? K : K;
|
|
532
|
-
}, (e) => e), this.routeId = d(() => this.currentMatch()?.routeId), this.route = d(() => this.router.routesById[this.routeId()]), this.parentGlobalNotFound = d(() => this.currentMatch()?.globalNotFound ?? !1), this.childMatchIdByRouteId =
|
|
562
|
+
}, (e) => e), this.routeId = d(() => this.currentMatch()?.routeId), this.route = d(() => this.router.routesById[this.routeId()]), this.parentGlobalNotFound = d(() => this.currentMatch()?.globalNotFound ?? !1), this.childMatchIdByRouteId = V(this.router.stores.childMatchIdByRouteId, (e) => e), this.childMatchId = d(() => {
|
|
533
563
|
let e = this.routeId();
|
|
534
564
|
return e ? this.childMatchIdByRouteId()[e] ?? null : null;
|
|
535
|
-
}), this.render =
|
|
565
|
+
}), this.render = U(() => this.parentGlobalNotFound() ? { component: X(this.router, this.route()) } : this.childMatchId() ? {
|
|
536
566
|
component: q,
|
|
537
567
|
inputs: { matchId: () => this.childMatchId() }
|
|
538
568
|
} : null);
|
|
@@ -562,18 +592,21 @@ function Y(e) {
|
|
|
562
592
|
return typeof e == "function" ? e() : e;
|
|
563
593
|
}
|
|
564
594
|
function X(e, t) {
|
|
565
|
-
return (Y(t.options.notFoundComponent) ?? Y(e.options.defaultNotFoundComponent)) || (g() && !t.options.notFoundComponent && console.warn(`A notFoundError was encountered on the route with ID "${t.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Page not found</p>)`),
|
|
595
|
+
return (Y(t.options.notFoundComponent) ?? Y(e.options.defaultNotFoundComponent)) || (g() && !t.options.notFoundComponent && console.warn(`A notFoundError was encountered on the route with ID "${t.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Page not found</p>)`), he);
|
|
566
596
|
}
|
|
567
|
-
function
|
|
597
|
+
function be(e, t) {
|
|
598
|
+
return (Y(t.options.errorComponent) ?? Y(e.options.defaultErrorComponent)) || (g() && !t.options.errorComponent && console.warn(`An error was encountered on the route with ID "${t.id}", but an errorComponent option was not configured, nor was a router level defaultErrorComponent configured. Consider configuring at least one of these to avoid TanStack Router's generic defaultErrorComponent.`), ve);
|
|
599
|
+
}
|
|
600
|
+
function xe(e) {
|
|
568
601
|
return null;
|
|
569
602
|
}
|
|
570
603
|
var Z = "data-tsr-scroll-restoration-inline";
|
|
571
|
-
function
|
|
572
|
-
let e =
|
|
604
|
+
function Se() {
|
|
605
|
+
let e = R(), t = p(ne), n = p(i);
|
|
573
606
|
e.isServer && l(() => {
|
|
574
607
|
let n = e.options.scrollRestoration;
|
|
575
608
|
if (!n || typeof n == "function" && !n({ location: e.latestLocation }) || t.querySelector(`script[${Z}]`)) return;
|
|
576
|
-
let r =
|
|
609
|
+
let r = xe(e);
|
|
577
610
|
if (!r) return;
|
|
578
611
|
let i = t.createElement("script");
|
|
579
612
|
i.setAttribute(Z, ""), i.className = "$tsr", i.text = `${r};document.currentScript.remove()`;
|
|
@@ -585,10 +618,10 @@ var Q = {
|
|
|
585
618
|
router: null,
|
|
586
619
|
mounted: !1
|
|
587
620
|
};
|
|
588
|
-
function
|
|
589
|
-
let t =
|
|
621
|
+
function Ce() {
|
|
622
|
+
let t = R(), n = e.inject(e.EnvironmentInjector);
|
|
590
623
|
if (t.isServer) return;
|
|
591
|
-
let r = e.inject(e.DestroyRef), i = !1, a =
|
|
624
|
+
let r = e.inject(e.DestroyRef), i = !1, a = V(t.stores.isLoading, (e) => e), o = V(t.stores.isTransitioning, (e) => e), s = V(t.stores.hasPending, (e) => e), c = V(t.stores.status, (e) => e), l = V(t.stores.location, (e) => e), u = V(t.stores.resolvedLocation, (e) => e), d = e.computed(() => a() || o() || s()), f = e.computed(() => a() || s()), p = $(() => a()), m = $(() => d()), h = $(() => f());
|
|
592
625
|
t.startTransition = (r) => {
|
|
593
626
|
t.stores.isTransitioning.set(!0);
|
|
594
627
|
let a = () => {
|
|
@@ -611,7 +644,7 @@ function xe() {
|
|
|
611
644
|
state: !0,
|
|
612
645
|
_includeValidateSearch: !0
|
|
613
646
|
});
|
|
614
|
-
|
|
647
|
+
A(t.latestLocation.href) !== A(e.href) && t.commitLocation({
|
|
615
648
|
...e,
|
|
616
649
|
replace: !0
|
|
617
650
|
});
|
|
@@ -636,24 +669,24 @@ function xe() {
|
|
|
636
669
|
if (_()) try {
|
|
637
670
|
p() && !a() && t.emit({
|
|
638
671
|
type: "onLoad",
|
|
639
|
-
...
|
|
672
|
+
...P(l(), u())
|
|
640
673
|
});
|
|
641
674
|
} catch {}
|
|
642
675
|
}), e.effect(() => {
|
|
643
676
|
if (_()) try {
|
|
644
677
|
h() && !f() && t.emit({
|
|
645
678
|
type: "onBeforeRouteMount",
|
|
646
|
-
...
|
|
679
|
+
...P(l(), u())
|
|
647
680
|
});
|
|
648
681
|
} catch {}
|
|
649
682
|
}), e.effect(() => {
|
|
650
683
|
if (_()) try {
|
|
651
684
|
if (m() && !d() && c() === "pending" && (t.stores.status.set("idle"), t.stores.resolvedLocation.set(l())), m() && !d()) {
|
|
652
|
-
let e =
|
|
685
|
+
let e = P(l(), u());
|
|
653
686
|
t.emit({
|
|
654
687
|
type: "onResolved",
|
|
655
688
|
...e
|
|
656
|
-
}), e.hrefChanged &&
|
|
689
|
+
}), e.hrefChanged && de(t);
|
|
657
690
|
}
|
|
658
691
|
} catch {}
|
|
659
692
|
});
|
|
@@ -665,9 +698,9 @@ function $(t) {
|
|
|
665
698
|
return r = n(), e;
|
|
666
699
|
});
|
|
667
700
|
}
|
|
668
|
-
var
|
|
701
|
+
var we = class t {
|
|
669
702
|
constructor() {
|
|
670
|
-
this.router =
|
|
703
|
+
this.router = R(), this.matchId = V(this.router.stores.firstId, (e) => e), this.ssrScrollRestoration = Se(), this.transitioner = Ce(), this.render = U(() => {
|
|
671
704
|
let e = this.matchId();
|
|
672
705
|
return e ? {
|
|
673
706
|
component: q,
|
|
@@ -691,16 +724,16 @@ var Se = class t {
|
|
|
691
724
|
encapsulation: 2
|
|
692
725
|
});
|
|
693
726
|
}
|
|
694
|
-
},
|
|
727
|
+
}, Te = /* @__PURE__ */ new a("CONTEXT", {
|
|
695
728
|
providedIn: "root",
|
|
696
729
|
factory: () => ({})
|
|
697
|
-
}),
|
|
730
|
+
}), Ee = /* @__PURE__ */ new a("OPTIONS", {
|
|
698
731
|
providedIn: "root",
|
|
699
732
|
factory: () => ({})
|
|
700
733
|
});
|
|
701
734
|
(class t {
|
|
702
735
|
constructor() {
|
|
703
|
-
this.injectedContext = p(
|
|
736
|
+
this.injectedContext = p(Te), this.injectedOptions = p(Ee), this.injectedRouter = p(L(), { optional: !0 }), this.context = m(this.injectedContext), this.options = m(this.injectedOptions), this.routerInput = m(void 0, { alias: "router" }), this.router = d(() => {
|
|
704
737
|
let e = this.routerInput();
|
|
705
738
|
if (e) return e;
|
|
706
739
|
if (this.injectedRouter) return this.injectedRouter;
|
|
@@ -715,12 +748,12 @@ var Se = class t {
|
|
|
715
748
|
...t
|
|
716
749
|
}
|
|
717
750
|
});
|
|
718
|
-
}), this.render =
|
|
719
|
-
let e =
|
|
751
|
+
}), this.render = U(() => {
|
|
752
|
+
let e = v(this.router);
|
|
720
753
|
return {
|
|
721
|
-
component:
|
|
754
|
+
component: we,
|
|
722
755
|
providers: [{
|
|
723
|
-
provide:
|
|
756
|
+
provide: L(),
|
|
724
757
|
useValue: e
|
|
725
758
|
}]
|
|
726
759
|
};
|
|
@@ -756,11 +789,11 @@ var Se = class t {
|
|
|
756
789
|
});
|
|
757
790
|
}
|
|
758
791
|
});
|
|
759
|
-
function
|
|
760
|
-
let t =
|
|
761
|
-
return e?.select ?
|
|
792
|
+
function De(e) {
|
|
793
|
+
let t = R();
|
|
794
|
+
return e?.select ? V(t.stores.location, e.select, { equal: w }) : V(t.stores.location);
|
|
762
795
|
}
|
|
763
|
-
function
|
|
796
|
+
function Oe(t, n, r) {
|
|
764
797
|
let i = e.inject(e.ElementRef);
|
|
765
798
|
e.afterRenderEffect((e) => {
|
|
766
799
|
let a = typeof IntersectionObserver == "function", o = i.nativeElement;
|
|
@@ -773,7 +806,7 @@ function Ee(t, n, r) {
|
|
|
773
806
|
}
|
|
774
807
|
(class t {
|
|
775
808
|
constructor() {
|
|
776
|
-
this.passiveEvents =
|
|
809
|
+
this.passiveEvents = Ae(() => ({ touchstart: this.handleTouchStart })), this.options = m.required({ alias: "link" }), this.router = R(), this.isTransitioning = te(!1), this.from = d(() => v(() => this.options().from)), this.disabled = d(() => this._options().disabled ?? !1), this.target = d(() => this._options().target), this._options = d(() => ({
|
|
777
810
|
...this.options(),
|
|
778
811
|
from: this.from()
|
|
779
812
|
})), this.nextLocation = d(() => {
|
|
@@ -795,33 +828,33 @@ function Ee(t, n, r) {
|
|
|
795
828
|
try {
|
|
796
829
|
return new URL(this.options().to), this.options().to;
|
|
797
830
|
} catch {}
|
|
798
|
-
}), this.preload = d(() => this.options().reloadDocument ? !1 : this.options().preload ?? this.router.options.defaultPreload), this.preloadDelay = d(() => this.options().preloadDelay ?? this.router.options.defaultPreloadDelay ?? 0), this.location =
|
|
831
|
+
}), this.preload = d(() => this.options().reloadDocument ? !1 : this.options().preload ?? this.router.options.defaultPreload), this.preloadDelay = d(() => this.options().preloadDelay ?? this.router.options.defaultPreloadDelay ?? 0), this.location = De(), this.isActiveProps = d(() => {
|
|
799
832
|
let e = this.options(), t = this.isActive() ? e.activeProps : e.inactiveProps;
|
|
800
833
|
if (!(!t || typeof t != "object")) return t;
|
|
801
834
|
}), this.isActive = d(() => {
|
|
802
835
|
if (this.externalLink()) return !1;
|
|
803
836
|
let e = this.options().activeOptions;
|
|
804
837
|
if (e?.exact) {
|
|
805
|
-
if (!
|
|
838
|
+
if (!M(this.location().pathname, this.nextLocation().pathname, this.router.basepath)) return !1;
|
|
806
839
|
} else {
|
|
807
|
-
let e =
|
|
840
|
+
let e = j(this.location().pathname, this.router.basepath), t = j(this.nextLocation().pathname, this.router.basepath);
|
|
808
841
|
if (!(e.startsWith(t) && (e.length === t.length || e[t.length] === "/"))) return !1;
|
|
809
842
|
}
|
|
810
|
-
return (e?.includeSearch ?? !0) && !
|
|
843
|
+
return (e?.includeSearch ?? !0) && !w(this.location().search, this.nextLocation().search, {
|
|
811
844
|
partial: !e?.exact,
|
|
812
845
|
ignoreUndefined: !e?.explicitUndefined
|
|
813
846
|
}) ? !1 : e?.includeHash ? this.location().hash === this.nextLocation().hash : !0;
|
|
814
847
|
}), this.doPreload = () => {
|
|
815
848
|
this.router.preloadRoute(this.options()).catch((e) => {
|
|
816
|
-
console.warn(e), console.warn(
|
|
849
|
+
console.warn(e), console.warn(ue);
|
|
817
850
|
});
|
|
818
851
|
}, this.preloadViewportIoCallback = (e) => {
|
|
819
852
|
e?.isIntersecting && this.doPreload();
|
|
820
|
-
}, this.viewportPreloader =
|
|
853
|
+
}, this.viewportPreloader = Oe(this.preloadViewportIoCallback, { rootMargin: "100px" }, () => !!this._options().disabled || this.preload() !== "viewport"), this.hasRenderFetched = !1, this.rendererPreloader = f(() => {
|
|
821
854
|
this.hasRenderFetched || !this._options().disabled && this.preload() === "render" && (this.doPreload(), this.hasRenderFetched = !0);
|
|
822
855
|
}), this.handleClick = (e) => {
|
|
823
856
|
let t = e.currentTarget.getAttribute("target"), n = this._options().target, r = n === void 0 ? t : n;
|
|
824
|
-
if (!this._options().disabled && !
|
|
857
|
+
if (!this._options().disabled && !ke(e) && !e.defaultPrevented && (!r || r === "_self") && e.button === 0) {
|
|
825
858
|
e.preventDefault(), this.isTransitioning.set(!0);
|
|
826
859
|
let t = this.router.subscribe("onResolved", () => {
|
|
827
860
|
t(), this.isTransitioning.set(!1);
|
|
@@ -886,10 +919,10 @@ function Ee(t, n, r) {
|
|
|
886
919
|
});
|
|
887
920
|
}
|
|
888
921
|
});
|
|
889
|
-
function
|
|
922
|
+
function ke(e) {
|
|
890
923
|
return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
|
|
891
924
|
}
|
|
892
|
-
function
|
|
925
|
+
function Ae(e) {
|
|
893
926
|
let t = p(r).nativeElement, i = p(n), a = p(s), o = [];
|
|
894
927
|
l(() => {
|
|
895
928
|
for (let [n, r] of Object.entries(e())) {
|
|
@@ -902,8 +935,8 @@ function Oe(e) {
|
|
|
902
935
|
}
|
|
903
936
|
//#endregion
|
|
904
937
|
//#region experimental/injectRouteErrorHandler.ts
|
|
905
|
-
function
|
|
906
|
-
let t =
|
|
938
|
+
function je(e) {
|
|
939
|
+
let t = R(), r = pe({ from: e.from }), i = !1;
|
|
907
940
|
return p(n).onDestroy(() => {
|
|
908
941
|
i = !0;
|
|
909
942
|
}), { throw: (e) => {
|
|
@@ -911,7 +944,7 @@ function ke(e) {
|
|
|
911
944
|
console.warn("Attempted to throw error to route after it has been destroyed");
|
|
912
945
|
return;
|
|
913
946
|
}
|
|
914
|
-
let n =
|
|
947
|
+
let n = v(r).id;
|
|
915
948
|
t.updateMatch(n, (t) => ({
|
|
916
949
|
...t,
|
|
917
950
|
error: e,
|
|
@@ -922,4 +955,4 @@ function ke(e) {
|
|
|
922
955
|
} };
|
|
923
956
|
}
|
|
924
957
|
//#endregion
|
|
925
|
-
export {
|
|
958
|
+
export { je as injectRouteErrorHandler };
|