@benjavicente/angular-router-experimental 1.142.11 → 1.142.13
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 +242 -204
- package/dist/fesm2022/tanstack-angular-router-experimental.mjs +1228 -1204
- package/dist/types/tanstack-angular-router-experimental-experimental.d.ts +38 -37
- package/dist/types/tanstack-angular-router-experimental.d.ts +59 -46
- package/package.json +4 -3
- package/src/Match.ts +90 -33
- package/src/Matches.ts +5 -2
- package/src/RouterProvider.ts +3 -0
- package/src/document/build-match-managed-document.ts +1 -1
- package/src/document/install-unified-document-sync.ts +6 -3
- package/src/document/provide-tanstack-body-managed-tags.ts +2 -2
- package/src/document/provide-tanstack-document-title.ts +4 -5
- package/src/document/provide-tanstack-head-managed-tags.ts +2 -2
- package/src/index.ts +6 -2
- package/src/injectCanGoBack.ts +2 -2
- package/src/injectIsShell.ts +7 -0
- package/src/injectLocation.ts +11 -8
- package/src/injectMatch.ts +45 -34
- package/src/injectMatchRoute.ts +4 -5
- package/src/injectMatches.ts +9 -9
- package/src/injectRouterState.ts +15 -10
- package/src/renderer/injectIsCatchingError.ts +20 -8
- package/src/renderer/injectRender.ts +4 -2
- package/src/route.ts +0 -3
- package/src/routerStores.ts +25 -52
- package/src/store/injectSelector.ts +62 -0
- package/src/store/injectStore.ts +33 -0
- package/src/transitioner.ts +12 -25
- package/src/injectStore.ts +0 -87
|
@@ -1,91 +1,92 @@
|
|
|
1
|
+
import "@tanstack/store";
|
|
1
2
|
import * as e from "@angular/core";
|
|
2
|
-
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 _,
|
|
3
|
-
import { DOCUMENT as
|
|
4
|
-
var
|
|
5
|
-
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) {
|
|
6
7
|
if (e === t) return e;
|
|
7
8
|
if (r > 500) return t;
|
|
8
|
-
let i = t, a =
|
|
9
|
-
if (!a && !(
|
|
10
|
-
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);
|
|
11
12
|
if (!o) return i;
|
|
12
|
-
let s = a ? i :
|
|
13
|
+
let s = a ? i : b(i);
|
|
13
14
|
if (!s) return i;
|
|
14
15
|
let c = o.length, l = s.length, u = a ? Array(l) : n(), d = 0;
|
|
15
16
|
for (let t = 0; t < l; t++) {
|
|
16
17
|
let o = a ? t : s[t], l = e[o], f = i[o];
|
|
17
18
|
if (l === f) {
|
|
18
|
-
u[o] = l, (a ? t < c :
|
|
19
|
+
u[o] = l, (a ? t < c : re.call(e, o)) && d++;
|
|
19
20
|
continue;
|
|
20
21
|
}
|
|
21
22
|
if (l === null || f === null || typeof l != "object" || typeof f != "object") {
|
|
22
23
|
u[o] = f;
|
|
23
24
|
continue;
|
|
24
25
|
}
|
|
25
|
-
let p =
|
|
26
|
+
let p = ie(l, f, n, r + 1);
|
|
26
27
|
u[o] = p, p === l && d++;
|
|
27
28
|
}
|
|
28
29
|
return c === l && d === c ? e : u;
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
+
function b(e) {
|
|
31
32
|
let t = Object.getOwnPropertyNames(e);
|
|
32
|
-
for (let n of t) if (!
|
|
33
|
+
for (let n of t) if (!y.call(e, n)) return !1;
|
|
33
34
|
let n = Object.getOwnPropertySymbols(e);
|
|
34
35
|
if (n.length === 0) return t;
|
|
35
36
|
let r = t;
|
|
36
37
|
for (let t of n) {
|
|
37
|
-
if (!
|
|
38
|
+
if (!y.call(e, t)) return !1;
|
|
38
39
|
r.push(t);
|
|
39
40
|
}
|
|
40
41
|
return r;
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
-
if (!
|
|
43
|
+
function x(e) {
|
|
44
|
+
if (!S(e)) return !1;
|
|
44
45
|
let t = e.constructor;
|
|
45
46
|
if (t === void 0) return !0;
|
|
46
47
|
let n = t.prototype;
|
|
47
|
-
return !(!
|
|
48
|
+
return !(!S(n) || !n.hasOwnProperty("isPrototypeOf"));
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
+
function S(e) {
|
|
50
51
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function C(e) {
|
|
53
54
|
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
+
function w(e, t, n) {
|
|
56
57
|
if (e === t) return !0;
|
|
57
58
|
if (typeof e != typeof t) return !1;
|
|
58
59
|
if (Array.isArray(e) && Array.isArray(t)) {
|
|
59
60
|
if (e.length !== t.length) return !1;
|
|
60
|
-
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;
|
|
61
62
|
return !0;
|
|
62
63
|
}
|
|
63
|
-
if (
|
|
64
|
+
if (x(e) && x(t)) {
|
|
64
65
|
let r = n?.ignoreUndefined ?? !0;
|
|
65
66
|
if (n?.partial) {
|
|
66
|
-
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;
|
|
67
68
|
return !0;
|
|
68
69
|
}
|
|
69
70
|
let i = 0;
|
|
70
71
|
if (!r) i = Object.keys(e).length;
|
|
71
72
|
else for (let t in e) e[t] !== void 0 && i++;
|
|
72
73
|
let a = 0;
|
|
73
|
-
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;
|
|
74
75
|
return i === a;
|
|
75
76
|
}
|
|
76
77
|
return !1;
|
|
77
78
|
}
|
|
78
|
-
function
|
|
79
|
+
function ae() {
|
|
79
80
|
throw Error("Invariant failed");
|
|
80
81
|
}
|
|
81
|
-
var
|
|
82
|
-
function
|
|
82
|
+
var oe = 4, T = 5;
|
|
83
|
+
function se(e) {
|
|
83
84
|
let t = e.indexOf("{");
|
|
84
85
|
if (t === -1) return null;
|
|
85
86
|
let n = e.indexOf("}", t);
|
|
86
87
|
return n === -1 || t + 1 >= e.length ? null : [t, n];
|
|
87
88
|
}
|
|
88
|
-
function
|
|
89
|
+
function ce(e, t, n = new Uint16Array(6)) {
|
|
89
90
|
let r = e.indexOf("/", t), i = r === -1 ? e.length : r, a = e.substring(t, i);
|
|
90
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;
|
|
91
92
|
if (a === "$") {
|
|
@@ -93,7 +94,7 @@ function ne(e, t, n = new Uint16Array(6)) {
|
|
|
93
94
|
return n[0] = 2, n[1] = t, n[2] = t, n[3] = r, n[4] = r, n[5] = r, n;
|
|
94
95
|
}
|
|
95
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;
|
|
96
|
-
let o =
|
|
97
|
+
let o = se(a);
|
|
97
98
|
if (o) {
|
|
98
99
|
let [r, s] = o, c = a.charCodeAt(r + 1);
|
|
99
100
|
if (c === 45) {
|
|
@@ -108,13 +109,13 @@ function ne(e, t, n = new Uint16Array(6)) {
|
|
|
108
109
|
}
|
|
109
110
|
return n[0] = 0, n[1] = t, n[2] = t, n[3] = i, n[4] = i, n[5] = i, n;
|
|
110
111
|
}
|
|
111
|
-
function
|
|
112
|
+
function le(e, t, n, r, i, a, o) {
|
|
112
113
|
o?.(n);
|
|
113
114
|
let s = r;
|
|
114
115
|
{
|
|
115
|
-
let r = n.fullPath ?? n.from, o = r.length, c = n.options?.caseSensitive ?? e, l =
|
|
116
|
+
let r = n.fullPath ?? n.from, o = r.length, c = n.options?.caseSensitive ?? e, l = n.options?.params?.parse ?? n.options?.parseParams;
|
|
116
117
|
for (; s < o;) {
|
|
117
|
-
let e =
|
|
118
|
+
let e = ce(r, s, t), o, u = s, d = e[5];
|
|
118
119
|
switch (s = d + 1, a++, e[0]) {
|
|
119
120
|
case 0: {
|
|
120
121
|
let t = r.substring(e[2], e[3]);
|
|
@@ -123,7 +124,7 @@ function re(e, t, n, r, i, a, o) {
|
|
|
123
124
|
if (e) o = e;
|
|
124
125
|
else {
|
|
125
126
|
i.static ??= /* @__PURE__ */ new Map();
|
|
126
|
-
let e =
|
|
127
|
+
let e = O(n.fullPath ?? n.from);
|
|
127
128
|
e.parent = i, e.depth = a, o = e, i.static.set(t, e);
|
|
128
129
|
}
|
|
129
130
|
} else {
|
|
@@ -131,54 +132,53 @@ function re(e, t, n, r, i, a, o) {
|
|
|
131
132
|
if (r) o = r;
|
|
132
133
|
else {
|
|
133
134
|
i.staticInsensitive ??= /* @__PURE__ */ new Map();
|
|
134
|
-
let t =
|
|
135
|
+
let t = O(n.fullPath ?? n.from);
|
|
135
136
|
t.parent = i, t.depth = a, o = t, i.staticInsensitive.set(e, t);
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
break;
|
|
139
140
|
}
|
|
140
141
|
case 1: {
|
|
141
|
-
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.
|
|
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);
|
|
142
143
|
if (h) o = h;
|
|
143
144
|
else {
|
|
144
|
-
let e =
|
|
145
|
+
let e = k(1, n.fullPath ?? n.from, f, p, m);
|
|
145
146
|
o = e, e.depth = a, e.parent = i, i.dynamic ??= [], i.dynamic.push(e);
|
|
146
147
|
}
|
|
147
148
|
break;
|
|
148
149
|
}
|
|
149
150
|
case 3: {
|
|
150
|
-
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.
|
|
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);
|
|
151
152
|
if (h) o = h;
|
|
152
153
|
else {
|
|
153
|
-
let e =
|
|
154
|
+
let e = k(3, n.fullPath ?? n.from, f, p, m);
|
|
154
155
|
o = e, e.parent = i, e.depth = a, i.optional ??= [], i.optional.push(e);
|
|
155
156
|
}
|
|
156
157
|
break;
|
|
157
158
|
}
|
|
158
159
|
case 2: {
|
|
159
|
-
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);
|
|
160
161
|
o = m, m.parent = i, m.depth = a, i.wildcard ??= [], i.wildcard.push(m);
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
164
|
i = o;
|
|
164
165
|
}
|
|
165
166
|
if (l && n.children && !n.isRoot && n.id && n.id.charCodeAt(n.id.lastIndexOf("/") + 1) === 95) {
|
|
166
|
-
let e =
|
|
167
|
-
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;
|
|
168
169
|
}
|
|
169
170
|
let u = (n.path || !n.children) && !n.isRoot;
|
|
170
171
|
if (u && r.endsWith("/")) {
|
|
171
|
-
let e =
|
|
172
|
-
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;
|
|
173
174
|
}
|
|
174
|
-
i.parse =
|
|
175
|
+
i.parse = l ?? null, u && !i.route && (i.route = n, i.fullPath = n.fullPath ?? n.from);
|
|
175
176
|
}
|
|
176
|
-
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);
|
|
177
178
|
}
|
|
178
|
-
function
|
|
179
|
-
if (e.
|
|
180
|
-
if (!e.
|
|
181
|
-
if (e.skipOnParamError && t.skipOnParamError && (e.parsingPriority || t.parsingPriority)) return t.parsingPriority - e.parsingPriority;
|
|
179
|
+
function E(e, t) {
|
|
180
|
+
if (e.parse && !t.parse) return -1;
|
|
181
|
+
if (!e.parse && t.parse) return 1;
|
|
182
182
|
if (e.prefix && t.prefix && e.prefix !== t.prefix) {
|
|
183
183
|
if (e.prefix.startsWith(t.prefix)) return -1;
|
|
184
184
|
if (t.prefix.startsWith(e.prefix)) return 1;
|
|
@@ -189,24 +189,24 @@ function j(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,
|
|
@@ -220,12 +220,10 @@ function N(e) {
|
|
|
220
220
|
route: null,
|
|
221
221
|
fullPath: e,
|
|
222
222
|
parent: null,
|
|
223
|
-
parse: null
|
|
224
|
-
skipOnParamError: !1,
|
|
225
|
-
parsingPriority: 0
|
|
223
|
+
parse: null
|
|
226
224
|
};
|
|
227
225
|
}
|
|
228
|
-
function
|
|
226
|
+
function k(e, t, n, r, i) {
|
|
229
227
|
return {
|
|
230
228
|
kind: e,
|
|
231
229
|
depth: 0,
|
|
@@ -240,26 +238,24 @@ function P(e, t, n, r, i) {
|
|
|
240
238
|
fullPath: t,
|
|
241
239
|
parent: null,
|
|
242
240
|
parse: null,
|
|
243
|
-
skipOnParamError: !1,
|
|
244
|
-
parsingPriority: 0,
|
|
245
241
|
caseSensitive: n,
|
|
246
242
|
prefix: r,
|
|
247
243
|
suffix: i
|
|
248
244
|
};
|
|
249
245
|
}
|
|
250
|
-
function
|
|
246
|
+
function A(e) {
|
|
251
247
|
let t = e.length;
|
|
252
248
|
return t > 1 && e[t - 1] === "/" ? e.replace(/\/{1,}$/, "") : e;
|
|
253
249
|
}
|
|
254
|
-
function
|
|
250
|
+
function j(e, t) {
|
|
255
251
|
return e?.endsWith("/") && e !== "/" && e !== `${t}/` ? e.slice(0, -1) : e;
|
|
256
252
|
}
|
|
257
|
-
function
|
|
258
|
-
return
|
|
253
|
+
function M(e, t, n) {
|
|
254
|
+
return j(e, n) === j(t, n);
|
|
259
255
|
}
|
|
260
256
|
JSON.parse, JSON.stringify, JSON.parse;
|
|
261
|
-
var
|
|
262
|
-
function
|
|
257
|
+
var N = "__root__";
|
|
258
|
+
function P(e, t) {
|
|
263
259
|
let n = t, r = e;
|
|
264
260
|
return {
|
|
265
261
|
fromLocation: n,
|
|
@@ -270,74 +266,77 @@ function R(e, t) {
|
|
|
270
266
|
};
|
|
271
267
|
}
|
|
272
268
|
Error, Error;
|
|
273
|
-
var
|
|
274
|
-
function
|
|
269
|
+
var ue = "Error preloading route! ☝️";
|
|
270
|
+
function de(e) {
|
|
275
271
|
if (typeof document < "u" && document.querySelector) {
|
|
276
|
-
let t = e.stores.location.
|
|
272
|
+
let t = e.stores.location.get(), n = t.state.__hashScrollIntoViewOptions ?? !0;
|
|
277
273
|
if (n && t.hash !== "") {
|
|
278
274
|
let e = document.getElementById(t.hash);
|
|
279
275
|
e && e.scrollIntoView(n);
|
|
280
276
|
}
|
|
281
277
|
}
|
|
282
278
|
}
|
|
283
|
-
var
|
|
279
|
+
var fe = {
|
|
284
280
|
matchId: () => void 0,
|
|
285
281
|
routeId: () => void 0,
|
|
286
282
|
match: () => void 0,
|
|
287
283
|
hasPending: () => !1
|
|
288
|
-
},
|
|
284
|
+
}, F = /* @__PURE__ */ new e.InjectionToken("MATCH_CONTEXT_INJECTOR", {
|
|
289
285
|
providedIn: "root",
|
|
290
|
-
factory: () =>
|
|
291
|
-
}),
|
|
292
|
-
function
|
|
293
|
-
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);
|
|
294
290
|
}
|
|
295
|
-
function
|
|
296
|
-
let n = e.inject(
|
|
291
|
+
function R(t) {
|
|
292
|
+
let n = e.inject(L(), { optional: !0 });
|
|
297
293
|
return process.env.NODE_ENV !== "production" && (t?.warn ?? !0) && !n && console.warn("Warning: injectRouter must be used inside a <router-provider> component!"), n;
|
|
298
294
|
}
|
|
299
|
-
function
|
|
300
|
-
u(
|
|
301
|
-
let r = typeof e == "function" ? e : () => e, i = _(() => t(r().state), n);
|
|
302
|
-
return f(() => {
|
|
303
|
-
i();
|
|
304
|
-
}), i.asReadonly();
|
|
295
|
+
function z(e, t) {
|
|
296
|
+
return t || (u(e), p(o));
|
|
305
297
|
}
|
|
306
|
-
function
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
298
|
+
function B(e, t = (e) => e, n) {
|
|
299
|
+
return ee(z(B, n?.injector), () => {
|
|
300
|
+
let r = typeof e == "function" ? e : () => e, i = _(() => t(r().get()), { equal: n?.compare });
|
|
301
|
+
return f((e) => {
|
|
302
|
+
let { unsubscribe: n } = r().subscribe((e) => {
|
|
303
|
+
i.set(t(e));
|
|
304
|
+
});
|
|
305
|
+
e(n);
|
|
306
|
+
}), i.asReadonly();
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
function V(e, t = (e) => e, n) {
|
|
310
|
+
let { equal: r, injector: i, ...a } = n ?? {};
|
|
311
|
+
return B(e, t, {
|
|
312
|
+
...a,
|
|
313
|
+
compare: r,
|
|
314
|
+
injector: i
|
|
315
|
+
});
|
|
324
316
|
}
|
|
325
|
-
|
|
326
|
-
|
|
317
|
+
var H = {
|
|
318
|
+
get: () => void 0,
|
|
319
|
+
subscribe: () => ({ unsubscribe: () => {} })
|
|
320
|
+
};
|
|
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
|
+
let e = r?.matchId();
|
|
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);
|
|
327
326
|
return e.computed(() => {
|
|
328
|
-
let e =
|
|
327
|
+
let e = i();
|
|
329
328
|
if (e !== void 0) return t.select ? t.select(e) : e;
|
|
330
|
-
if (!(t.from ?
|
|
329
|
+
if (!(t.from ? a()[t.from] : r?.hasPending() ?? !1) && !o() && (t.shouldThrow ?? !0)) {
|
|
331
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!"}`);
|
|
332
|
-
|
|
331
|
+
ae();
|
|
333
332
|
}
|
|
334
|
-
}, { equal:
|
|
333
|
+
}, { equal: w });
|
|
335
334
|
}
|
|
336
|
-
function
|
|
335
|
+
function U(e) {
|
|
337
336
|
let t = p(c), r = p(o), i = [];
|
|
338
337
|
f(() => {
|
|
339
|
-
let n = e(), a =
|
|
340
|
-
if (
|
|
338
|
+
let n = e(), a = me(n);
|
|
339
|
+
if (W(i, a)) return;
|
|
341
340
|
i.length > 0 && t.clear(), i = a;
|
|
342
341
|
let s = n?.component;
|
|
343
342
|
if (!s) return;
|
|
@@ -353,16 +352,16 @@ function K(e) {
|
|
|
353
352
|
t.clear();
|
|
354
353
|
});
|
|
355
354
|
}
|
|
356
|
-
function
|
|
355
|
+
function me(e) {
|
|
357
356
|
let t = e?.component;
|
|
358
|
-
return !e || !t ? [] : [t, e.key];
|
|
357
|
+
return !e || !t ? [] : Array.isArray(e.key) ? [t, ...e.key] : [t, e.key];
|
|
359
358
|
}
|
|
360
|
-
function
|
|
359
|
+
function W(e, t) {
|
|
361
360
|
if (e.length !== t.length) return !1;
|
|
362
361
|
for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
|
|
363
362
|
return !0;
|
|
364
363
|
}
|
|
365
|
-
var
|
|
364
|
+
var he = class n {
|
|
366
365
|
static {
|
|
367
366
|
this.ɵfac = function(e) {
|
|
368
367
|
return new (e || n)();
|
|
@@ -386,28 +385,56 @@ var ue = class n {
|
|
|
386
385
|
changeDetection: t.OnPush
|
|
387
386
|
});
|
|
388
387
|
}
|
|
389
|
-
},
|
|
390
|
-
function
|
|
391
|
-
let
|
|
392
|
-
return e
|
|
388
|
+
}, G = /* @__PURE__ */ new e.InjectionToken("ERROR_STATE_INJECTOR_TOKEN");
|
|
389
|
+
function ge(e) {
|
|
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);
|
|
393
392
|
}
|
|
394
|
-
function
|
|
395
|
-
let n =
|
|
393
|
+
function _e({ matchId: t }) {
|
|
394
|
+
let n = R(), r = ge({ select: (e) => e.matches }), i = e.computed(() => r().findIndex((e) => e.id === t()));
|
|
396
395
|
return e.computed(() => {
|
|
397
|
-
if (n.options.defaultErrorComponent != null) return
|
|
396
|
+
if (n.options.defaultErrorComponent != null) return;
|
|
398
397
|
let e = i();
|
|
399
|
-
if (e === -1) return
|
|
398
|
+
if (e === -1) return;
|
|
400
399
|
let t = r();
|
|
401
400
|
for (let r = e + 1; r < t.length; r++) {
|
|
402
401
|
let e = t[r];
|
|
403
|
-
if (n.routesById[e?.routeId].options.errorComponent != null) return
|
|
404
|
-
if (e?.status === "error") return
|
|
402
|
+
if (n.routesById[e?.routeId].options.errorComponent != null) return;
|
|
403
|
+
if (e?.status === "error") return e;
|
|
405
404
|
}
|
|
406
|
-
return !1;
|
|
407
405
|
});
|
|
408
406
|
}
|
|
409
|
-
|
|
410
|
-
|
|
407
|
+
var K = {
|
|
408
|
+
get: () => void 0,
|
|
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
|
+
}
|
|
435
|
+
};
|
|
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;
|
|
411
438
|
a.onDestroy(() => {
|
|
412
439
|
u++;
|
|
413
440
|
}), f(() => {
|
|
@@ -419,17 +446,14 @@ function me({ parentRouteIsRoot: e }) {
|
|
|
419
446
|
let r = t.latestLocation.href;
|
|
420
447
|
c !== void 0 && c === r || (c = r, t.emit({
|
|
421
448
|
type: "onRendered",
|
|
422
|
-
...
|
|
449
|
+
...P(t.stores.location.get(), t.stores.resolvedLocation.get())
|
|
423
450
|
}));
|
|
424
451
|
} }, { injector: r });
|
|
425
452
|
});
|
|
426
453
|
}
|
|
427
454
|
var q = class t {
|
|
428
455
|
constructor() {
|
|
429
|
-
this.matchId = m.required(), this.router =
|
|
430
|
-
let e = this.matchId();
|
|
431
|
-
return e ? this.router.stores.activeMatchStoresById.get(e)?.state : void 0;
|
|
432
|
-
}), this.matchData = d(() => {
|
|
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) {
|
|
@@ -512,6 +542,7 @@ var q = class t {
|
|
|
512
542
|
"router-match",
|
|
513
543
|
""
|
|
514
544
|
]],
|
|
545
|
+
hostAttrs: ["hidden", ""],
|
|
515
546
|
hostVars: 1,
|
|
516
547
|
hostBindings: function(t, n) {
|
|
517
548
|
t & 2 && e.ɵɵattribute("data-matchId", n.matchId());
|
|
@@ -525,13 +556,13 @@ var q = class t {
|
|
|
525
556
|
}
|
|
526
557
|
}, J = class t {
|
|
527
558
|
constructor() {
|
|
528
|
-
this.router =
|
|
559
|
+
this.router = R(), this.nearestMatch = p(F), this.currentMatch = V(() => {
|
|
529
560
|
let e = this.nearestMatch.matchId();
|
|
530
|
-
return e ? this.router.stores.
|
|
531
|
-
}), this.routeId = d(() => this.currentMatch()?.routeId), this.route = d(() => this.router.routesById[this.routeId()]), this.parentGlobalNotFound = d(() => this.currentMatch()?.globalNotFound ?? !1), this.childMatchIdByRouteId =
|
|
561
|
+
return e ? this.router.stores.matchStores.get(e) ?? K : K;
|
|
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(() => {
|
|
532
563
|
let e = this.routeId();
|
|
533
564
|
return e ? this.childMatchIdByRouteId()[e] ?? null : null;
|
|
534
|
-
}), this.render =
|
|
565
|
+
}), this.render = U(() => this.parentGlobalNotFound() ? { component: X(this.router, this.route()) } : this.childMatchId() ? {
|
|
535
566
|
component: q,
|
|
536
567
|
inputs: { matchId: () => this.childMatchId() }
|
|
537
568
|
} : null);
|
|
@@ -549,6 +580,7 @@ var q = class t {
|
|
|
549
580
|
"outlet",
|
|
550
581
|
""
|
|
551
582
|
]],
|
|
583
|
+
hostAttrs: ["hidden", ""],
|
|
552
584
|
decls: 0,
|
|
553
585
|
vars: 0,
|
|
554
586
|
template: function(e, t) {},
|
|
@@ -560,18 +592,21 @@ function Y(e) {
|
|
|
560
592
|
return typeof e == "function" ? e() : e;
|
|
561
593
|
}
|
|
562
594
|
function X(e, t) {
|
|
563
|
-
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);
|
|
564
596
|
}
|
|
565
|
-
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) {
|
|
566
601
|
return null;
|
|
567
602
|
}
|
|
568
603
|
var Z = "data-tsr-scroll-restoration-inline";
|
|
569
|
-
function
|
|
570
|
-
let e =
|
|
604
|
+
function Se() {
|
|
605
|
+
let e = R(), t = p(ne), n = p(i);
|
|
571
606
|
e.isServer && l(() => {
|
|
572
607
|
let n = e.options.scrollRestoration;
|
|
573
608
|
if (!n || typeof n == "function" && !n({ location: e.latestLocation }) || t.querySelector(`script[${Z}]`)) return;
|
|
574
|
-
let r =
|
|
609
|
+
let r = xe(e);
|
|
575
610
|
if (!r) return;
|
|
576
611
|
let i = t.createElement("script");
|
|
577
612
|
i.setAttribute(Z, ""), i.className = "$tsr", i.text = `${r};document.currentScript.remove()`;
|
|
@@ -583,16 +618,16 @@ var Q = {
|
|
|
583
618
|
router: null,
|
|
584
619
|
mounted: !1
|
|
585
620
|
};
|
|
586
|
-
function
|
|
587
|
-
let t =
|
|
621
|
+
function Ce() {
|
|
622
|
+
let t = R(), n = e.inject(e.EnvironmentInjector);
|
|
588
623
|
if (t.isServer) return;
|
|
589
|
-
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());
|
|
590
625
|
t.startTransition = (r) => {
|
|
591
|
-
t.stores.isTransitioning.
|
|
626
|
+
t.stores.isTransitioning.set(!0);
|
|
592
627
|
let a = () => {
|
|
593
628
|
i || e.afterNextRender({ read: () => {
|
|
594
629
|
try {
|
|
595
|
-
t.stores.isTransitioning.
|
|
630
|
+
t.stores.isTransitioning.set(!1);
|
|
596
631
|
} catch {}
|
|
597
632
|
} }, { injector: n });
|
|
598
633
|
}, o = r();
|
|
@@ -609,14 +644,14 @@ function _e() {
|
|
|
609
644
|
state: !0,
|
|
610
645
|
_includeValidateSearch: !0
|
|
611
646
|
});
|
|
612
|
-
|
|
647
|
+
A(t.latestLocation.href) !== A(e.href) && t.commitLocation({
|
|
613
648
|
...e,
|
|
614
649
|
replace: !0
|
|
615
650
|
});
|
|
616
651
|
});
|
|
617
652
|
let _ = e.signal(!1);
|
|
618
653
|
e.afterNextRender(() => {
|
|
619
|
-
_.set(!0), d() || c() === "pending" && (t.stores.status.
|
|
654
|
+
_.set(!0), d() || c() === "pending" && (t.stores.status.set("idle"), t.stores.resolvedLocation.set(l()));
|
|
620
655
|
}), r.onDestroy(() => {
|
|
621
656
|
_.set(!1), i = !0, g && g();
|
|
622
657
|
}), e.afterNextRender(() => {
|
|
@@ -634,24 +669,24 @@ function _e() {
|
|
|
634
669
|
if (_()) try {
|
|
635
670
|
p() && !a() && t.emit({
|
|
636
671
|
type: "onLoad",
|
|
637
|
-
...
|
|
672
|
+
...P(l(), u())
|
|
638
673
|
});
|
|
639
674
|
} catch {}
|
|
640
675
|
}), e.effect(() => {
|
|
641
676
|
if (_()) try {
|
|
642
677
|
h() && !f() && t.emit({
|
|
643
678
|
type: "onBeforeRouteMount",
|
|
644
|
-
...
|
|
679
|
+
...P(l(), u())
|
|
645
680
|
});
|
|
646
681
|
} catch {}
|
|
647
682
|
}), e.effect(() => {
|
|
648
683
|
if (_()) try {
|
|
649
|
-
if (m() && !d() && c() === "pending" && (t.stores.status.
|
|
650
|
-
let e =
|
|
684
|
+
if (m() && !d() && c() === "pending" && (t.stores.status.set("idle"), t.stores.resolvedLocation.set(l())), m() && !d()) {
|
|
685
|
+
let e = P(l(), u());
|
|
651
686
|
t.emit({
|
|
652
687
|
type: "onResolved",
|
|
653
688
|
...e
|
|
654
|
-
}), e.hrefChanged &&
|
|
689
|
+
}), e.hrefChanged && de(t);
|
|
655
690
|
}
|
|
656
691
|
} catch {}
|
|
657
692
|
});
|
|
@@ -663,9 +698,9 @@ function $(t) {
|
|
|
663
698
|
return r = n(), e;
|
|
664
699
|
});
|
|
665
700
|
}
|
|
666
|
-
var
|
|
701
|
+
var we = class t {
|
|
667
702
|
constructor() {
|
|
668
|
-
this.router =
|
|
703
|
+
this.router = R(), this.matchId = V(this.router.stores.firstId, (e) => e), this.ssrScrollRestoration = Se(), this.transitioner = Ce(), this.render = U(() => {
|
|
669
704
|
let e = this.matchId();
|
|
670
705
|
return e ? {
|
|
671
706
|
component: q,
|
|
@@ -682,22 +717,23 @@ var ve = class t {
|
|
|
682
717
|
this.ɵcmp = /* @__PURE__ */ e.ɵɵdefineComponent({
|
|
683
718
|
type: t,
|
|
684
719
|
selectors: [["router-matches"]],
|
|
720
|
+
hostAttrs: ["hidden", ""],
|
|
685
721
|
decls: 0,
|
|
686
722
|
vars: 0,
|
|
687
723
|
template: function(e, t) {},
|
|
688
724
|
encapsulation: 2
|
|
689
725
|
});
|
|
690
726
|
}
|
|
691
|
-
},
|
|
727
|
+
}, Te = /* @__PURE__ */ new a("CONTEXT", {
|
|
692
728
|
providedIn: "root",
|
|
693
729
|
factory: () => ({})
|
|
694
|
-
}),
|
|
730
|
+
}), Ee = /* @__PURE__ */ new a("OPTIONS", {
|
|
695
731
|
providedIn: "root",
|
|
696
732
|
factory: () => ({})
|
|
697
733
|
});
|
|
698
734
|
(class t {
|
|
699
735
|
constructor() {
|
|
700
|
-
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(() => {
|
|
701
737
|
let e = this.routerInput();
|
|
702
738
|
if (e) return e;
|
|
703
739
|
if (this.injectedRouter) return this.injectedRouter;
|
|
@@ -712,12 +748,12 @@ var ve = class t {
|
|
|
712
748
|
...t
|
|
713
749
|
}
|
|
714
750
|
});
|
|
715
|
-
}), this.render =
|
|
751
|
+
}), this.render = U(() => {
|
|
716
752
|
let e = v(this.router);
|
|
717
753
|
return {
|
|
718
|
-
component:
|
|
754
|
+
component: we,
|
|
719
755
|
providers: [{
|
|
720
|
-
provide:
|
|
756
|
+
provide: L(),
|
|
721
757
|
useValue: e
|
|
722
758
|
}]
|
|
723
759
|
};
|
|
@@ -736,6 +772,7 @@ var ve = class t {
|
|
|
736
772
|
"router-provider",
|
|
737
773
|
""
|
|
738
774
|
]],
|
|
775
|
+
hostAttrs: ["hidden", ""],
|
|
739
776
|
inputs: {
|
|
740
777
|
context: [1, "context"],
|
|
741
778
|
options: [1, "options"],
|
|
@@ -752,10 +789,11 @@ var ve = class t {
|
|
|
752
789
|
});
|
|
753
790
|
}
|
|
754
791
|
});
|
|
755
|
-
function
|
|
756
|
-
|
|
792
|
+
function De(e) {
|
|
793
|
+
let t = R();
|
|
794
|
+
return e?.select ? V(t.stores.location, e.select, { equal: w }) : V(t.stores.location);
|
|
757
795
|
}
|
|
758
|
-
function
|
|
796
|
+
function Oe(t, n, r) {
|
|
759
797
|
let i = e.inject(e.ElementRef);
|
|
760
798
|
e.afterRenderEffect((e) => {
|
|
761
799
|
let a = typeof IntersectionObserver == "function", o = i.nativeElement;
|
|
@@ -768,7 +806,7 @@ function Se(t, n, r) {
|
|
|
768
806
|
}
|
|
769
807
|
(class t {
|
|
770
808
|
constructor() {
|
|
771
|
-
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(() => ({
|
|
772
810
|
...this.options(),
|
|
773
811
|
from: this.from()
|
|
774
812
|
})), this.nextLocation = d(() => {
|
|
@@ -790,33 +828,33 @@ function Se(t, n, r) {
|
|
|
790
828
|
try {
|
|
791
829
|
return new URL(this.options().to), this.options().to;
|
|
792
830
|
} catch {}
|
|
793
|
-
}), 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(() => {
|
|
794
832
|
let e = this.options(), t = this.isActive() ? e.activeProps : e.inactiveProps;
|
|
795
833
|
if (!(!t || typeof t != "object")) return t;
|
|
796
834
|
}), this.isActive = d(() => {
|
|
797
835
|
if (this.externalLink()) return !1;
|
|
798
836
|
let e = this.options().activeOptions;
|
|
799
837
|
if (e?.exact) {
|
|
800
|
-
if (!
|
|
838
|
+
if (!M(this.location().pathname, this.nextLocation().pathname, this.router.basepath)) return !1;
|
|
801
839
|
} else {
|
|
802
|
-
let e =
|
|
840
|
+
let e = j(this.location().pathname, this.router.basepath), t = j(this.nextLocation().pathname, this.router.basepath);
|
|
803
841
|
if (!(e.startsWith(t) && (e.length === t.length || e[t.length] === "/"))) return !1;
|
|
804
842
|
}
|
|
805
|
-
return (e?.includeSearch ?? !0) && !
|
|
843
|
+
return (e?.includeSearch ?? !0) && !w(this.location().search, this.nextLocation().search, {
|
|
806
844
|
partial: !e?.exact,
|
|
807
845
|
ignoreUndefined: !e?.explicitUndefined
|
|
808
846
|
}) ? !1 : e?.includeHash ? this.location().hash === this.nextLocation().hash : !0;
|
|
809
847
|
}), this.doPreload = () => {
|
|
810
848
|
this.router.preloadRoute(this.options()).catch((e) => {
|
|
811
|
-
console.warn(e), console.warn(
|
|
849
|
+
console.warn(e), console.warn(ue);
|
|
812
850
|
});
|
|
813
851
|
}, this.preloadViewportIoCallback = (e) => {
|
|
814
852
|
e?.isIntersecting && this.doPreload();
|
|
815
|
-
}, this.viewportPreloader =
|
|
853
|
+
}, this.viewportPreloader = Oe(this.preloadViewportIoCallback, { rootMargin: "100px" }, () => !!this._options().disabled || this.preload() !== "viewport"), this.hasRenderFetched = !1, this.rendererPreloader = f(() => {
|
|
816
854
|
this.hasRenderFetched || !this._options().disabled && this.preload() === "render" && (this.doPreload(), this.hasRenderFetched = !0);
|
|
817
855
|
}), this.handleClick = (e) => {
|
|
818
856
|
let t = e.currentTarget.getAttribute("target"), n = this._options().target, r = n === void 0 ? t : n;
|
|
819
|
-
if (!this._options().disabled && !
|
|
857
|
+
if (!this._options().disabled && !ke(e) && !e.defaultPrevented && (!r || r === "_self") && e.button === 0) {
|
|
820
858
|
e.preventDefault(), this.isTransitioning.set(!0);
|
|
821
859
|
let t = this.router.subscribe("onResolved", () => {
|
|
822
860
|
t(), this.isTransitioning.set(!1);
|
|
@@ -881,10 +919,10 @@ function Se(t, n, r) {
|
|
|
881
919
|
});
|
|
882
920
|
}
|
|
883
921
|
});
|
|
884
|
-
function
|
|
922
|
+
function ke(e) {
|
|
885
923
|
return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
|
|
886
924
|
}
|
|
887
|
-
function
|
|
925
|
+
function Ae(e) {
|
|
888
926
|
let t = p(r).nativeElement, i = p(n), a = p(s), o = [];
|
|
889
927
|
l(() => {
|
|
890
928
|
for (let [n, r] of Object.entries(e())) {
|
|
@@ -897,8 +935,8 @@ function we(e) {
|
|
|
897
935
|
}
|
|
898
936
|
//#endregion
|
|
899
937
|
//#region experimental/injectRouteErrorHandler.ts
|
|
900
|
-
function
|
|
901
|
-
let t =
|
|
938
|
+
function je(e) {
|
|
939
|
+
let t = R(), r = pe({ from: e.from }), i = !1;
|
|
902
940
|
return p(n).onDestroy(() => {
|
|
903
941
|
i = !0;
|
|
904
942
|
}), { throw: (e) => {
|
|
@@ -917,4 +955,4 @@ function Te(e) {
|
|
|
917
955
|
} };
|
|
918
956
|
}
|
|
919
957
|
//#endregion
|
|
920
|
-
export {
|
|
958
|
+
export { je as injectRouteErrorHandler };
|