@benjavicente/angular-router-experimental 1.142.11 → 1.142.12
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 +192 -187
- package/dist/fesm2022/tanstack-angular-router-experimental.mjs +1145 -1160
- package/dist/types/tanstack-angular-router-experimental-experimental.d.ts +39 -35
- package/dist/types/tanstack-angular-router-experimental.d.ts +56 -42
- package/package.json +5 -4
- package/src/Match.ts +37 -22
- 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 +5 -2
- package/src/injectCanGoBack.ts +2 -2
- 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/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 v, untracked as y } from "@angular/core";
|
|
4
|
+
import { DOCUMENT as te } from "@angular/common";
|
|
5
|
+
var ne = Object.prototype.hasOwnProperty, b = Object.prototype.propertyIsEnumerable;
|
|
6
|
+
function re(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 = w(e) && w(i);
|
|
10
|
+
if (!a && !(S(e) && S(i))) return i;
|
|
11
|
+
let o = a ? e : x(e);
|
|
11
12
|
if (!o) return i;
|
|
12
|
-
let s = a ? i :
|
|
13
|
+
let s = a ? i : x(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 : ne.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 = re(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 x(e) {
|
|
31
32
|
let t = Object.getOwnPropertyNames(e);
|
|
32
|
-
for (let n of t) if (!
|
|
33
|
+
for (let n of t) if (!b.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 (!b.call(e, t)) return !1;
|
|
38
39
|
r.push(t);
|
|
39
40
|
}
|
|
40
41
|
return r;
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
-
if (!
|
|
43
|
+
function S(e) {
|
|
44
|
+
if (!C(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 !(!C(n) || !n.hasOwnProperty("isPrototypeOf"));
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
+
function C(e) {
|
|
50
51
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function w(e) {
|
|
53
54
|
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
+
function T(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 (!T(e[r], t[r], n)) return !1;
|
|
61
62
|
return !0;
|
|
62
63
|
}
|
|
63
|
-
if (
|
|
64
|
+
if (S(e) && S(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) && !T(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 || !T(e[o], t[o], n))) return !1;
|
|
74
75
|
return i === a;
|
|
75
76
|
}
|
|
76
77
|
return !1;
|
|
77
78
|
}
|
|
78
|
-
function
|
|
79
|
+
function ie() {
|
|
79
80
|
throw Error("Invariant failed");
|
|
80
81
|
}
|
|
81
|
-
var
|
|
82
|
-
function
|
|
82
|
+
var ae = 4, E = 5;
|
|
83
|
+
function D(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 oe(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 = D(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 se(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 = oe(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 = A(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 = A(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 = j(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 = j(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 = j(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 = A(n.fullPath ?? n.from);
|
|
168
|
+
e.kind = E, 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 = A(n.fullPath ?? n.from);
|
|
173
|
+
e.kind = ae, 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) se(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 O(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 k(e) {
|
|
193
|
+
if (e.pathless) for (let t of e.pathless) k(t);
|
|
194
|
+
if (e.static) for (let t of e.static.values()) k(t);
|
|
195
|
+
if (e.staticInsensitive) for (let t of e.staticInsensitive.values()) k(t);
|
|
196
196
|
if (e.dynamic?.length) {
|
|
197
|
-
e.dynamic.sort(
|
|
198
|
-
for (let t of e.dynamic)
|
|
197
|
+
e.dynamic.sort(O);
|
|
198
|
+
for (let t of e.dynamic) k(t);
|
|
199
199
|
}
|
|
200
200
|
if (e.optional?.length) {
|
|
201
|
-
e.optional.sort(
|
|
202
|
-
for (let t of e.optional)
|
|
201
|
+
e.optional.sort(O);
|
|
202
|
+
for (let t of e.optional) k(t);
|
|
203
203
|
}
|
|
204
204
|
if (e.wildcard?.length) {
|
|
205
|
-
e.wildcard.sort(
|
|
206
|
-
for (let t of e.wildcard)
|
|
205
|
+
e.wildcard.sort(O);
|
|
206
|
+
for (let t of e.wildcard) k(t);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function A(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 j(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 M(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 N(e, t) {
|
|
255
251
|
return e?.endsWith("/") && e !== "/" && e !== `${t}/` ? e.slice(0, -1) : e;
|
|
256
252
|
}
|
|
257
|
-
function
|
|
258
|
-
return
|
|
253
|
+
function ce(e, t, n) {
|
|
254
|
+
return N(e, n) === N(t, n);
|
|
259
255
|
}
|
|
260
256
|
JSON.parse, JSON.stringify, JSON.parse;
|
|
261
|
-
var
|
|
262
|
-
function
|
|
257
|
+
var P = "__root__";
|
|
258
|
+
function F(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 le = "Error preloading route! ☝️";
|
|
270
|
+
function ue(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 de = {
|
|
284
280
|
matchId: () => void 0,
|
|
285
281
|
routeId: () => void 0,
|
|
286
282
|
match: () => void 0,
|
|
287
283
|
hasPending: () => !1
|
|
288
|
-
},
|
|
284
|
+
}, I = /* @__PURE__ */ new e.InjectionToken("MATCH_CONTEXT_INJECTOR", {
|
|
289
285
|
providedIn: "root",
|
|
290
|
-
factory: () =>
|
|
291
|
-
}),
|
|
292
|
-
function
|
|
293
|
-
return typeof document > "u" ?
|
|
286
|
+
factory: () => de
|
|
287
|
+
}), L = /* @__PURE__ */ new e.InjectionToken("ROUTER");
|
|
288
|
+
function R() {
|
|
289
|
+
return typeof document > "u" ? L : window.__TSR_ROUTER_INJECTION_KEY__ ? window.__TSR_ROUTER_INJECTION_KEY__ : (window.__TSR_ROUTER_INJECTION_KEY__ = L, L);
|
|
294
290
|
}
|
|
295
|
-
function
|
|
296
|
-
let n = e.inject(
|
|
291
|
+
function z(t) {
|
|
292
|
+
let n = e.inject(R(), { 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();
|
|
305
|
-
}
|
|
306
|
-
function W(e, t) {
|
|
307
|
-
if (Object.is(e, t)) return !0;
|
|
308
|
-
if (typeof e != "object" || !e || typeof t != "object" || !t) return !1;
|
|
309
|
-
if (e instanceof Map && t instanceof Map) {
|
|
310
|
-
if (e.size !== t.size) return !1;
|
|
311
|
-
for (let [n, r] of e) if (!t.has(n) || !Object.is(r, t.get(n))) return !1;
|
|
312
|
-
return !0;
|
|
313
|
-
}
|
|
314
|
-
if (e instanceof Set && t instanceof Set) {
|
|
315
|
-
if (e.size !== t.size) return !1;
|
|
316
|
-
for (let n of e) if (!t.has(n)) return !1;
|
|
317
|
-
return !0;
|
|
318
|
-
}
|
|
319
|
-
if (e instanceof Date && t instanceof Date) return e.getTime() === t.getTime();
|
|
320
|
-
let n = Object.keys(e);
|
|
321
|
-
if (n.length !== Object.keys(t).length) return !1;
|
|
322
|
-
for (let r of n) if (!Object.prototype.hasOwnProperty.call(t, r) || !Object.is(e[r], t[r])) return !1;
|
|
323
|
-
return !0;
|
|
295
|
+
function B(e, t) {
|
|
296
|
+
return t || (u(e), p(o));
|
|
324
297
|
}
|
|
325
|
-
function
|
|
326
|
-
|
|
298
|
+
function V(e, t = (e) => e, n) {
|
|
299
|
+
return ee(B(V, 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 H(e, t = (e) => e, n) {
|
|
310
|
+
let { equal: r, injector: i, ...a } = n ?? {};
|
|
311
|
+
return V(e, t, {
|
|
312
|
+
...a,
|
|
313
|
+
compare: r,
|
|
314
|
+
injector: i
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
var U = {
|
|
318
|
+
get: () => void 0,
|
|
319
|
+
subscribe: () => ({ unsubscribe: () => {} })
|
|
320
|
+
};
|
|
321
|
+
function fe(t) {
|
|
322
|
+
let n = z(), r = t.from ? void 0 : e.inject(I), i = H(t.from ? n.stores.getRouteMatchStore(t.from) : () => {
|
|
323
|
+
let e = r?.matchId();
|
|
324
|
+
return e ? n.stores.matchStores.get(e) ?? U : U;
|
|
325
|
+
}, (e) => e), a = H(n.stores.pendingRouteIds, (e) => e), o = H(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
|
+
ie();
|
|
333
332
|
}
|
|
334
|
-
}, { equal:
|
|
333
|
+
}, { equal: T });
|
|
335
334
|
}
|
|
336
|
-
function
|
|
335
|
+
function W(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 = pe(n);
|
|
339
|
+
if (G(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 pe(e) {
|
|
357
356
|
let t = e?.component;
|
|
358
357
|
return !e || !t ? [] : [t, e.key];
|
|
359
358
|
}
|
|
360
|
-
function
|
|
359
|
+
function G(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 me = class n {
|
|
366
365
|
static {
|
|
367
366
|
this.ɵfac = function(e) {
|
|
368
367
|
return new (e || n)();
|
|
@@ -386,13 +385,13 @@ var ue = class n {
|
|
|
386
385
|
changeDetection: t.OnPush
|
|
387
386
|
});
|
|
388
387
|
}
|
|
389
|
-
},
|
|
390
|
-
function
|
|
391
|
-
let
|
|
392
|
-
return e
|
|
388
|
+
}, he = /* @__PURE__ */ new e.InjectionToken("ERROR_STATE_INJECTOR_TOKEN");
|
|
389
|
+
function ge(e) {
|
|
390
|
+
let t = z({ warn: e?.router === void 0 }), n = e?.router ?? t;
|
|
391
|
+
return e?.select ? H(n.stores.__store, e.select, { equal: T }) : H(n.stores.__store);
|
|
393
392
|
}
|
|
394
|
-
function
|
|
395
|
-
let n =
|
|
393
|
+
function _e({ matchId: t }) {
|
|
394
|
+
let n = z(), r = ge({ select: (e) => e.matches }), i = e.computed(() => r().findIndex((e) => e.id === t()));
|
|
396
395
|
return e.computed(() => {
|
|
397
396
|
if (n.options.defaultErrorComponent != null) return !1;
|
|
398
397
|
let e = i();
|
|
@@ -406,8 +405,12 @@ function pe({ matchId: t }) {
|
|
|
406
405
|
return !1;
|
|
407
406
|
});
|
|
408
407
|
}
|
|
409
|
-
|
|
410
|
-
|
|
408
|
+
var K = {
|
|
409
|
+
get: () => void 0,
|
|
410
|
+
subscribe: () => ({ unsubscribe: () => {} })
|
|
411
|
+
};
|
|
412
|
+
function ve({ parentRouteIsRoot: e }) {
|
|
413
|
+
let t = z({ warn: !1 }), r = p(i), a = p(n), o = H(t.stores.resolvedLocation, (e) => e?.state?.__TSR_key), s = H(t.stores.loadedAt, (e) => e), c, u = 0;
|
|
411
414
|
a.onDestroy(() => {
|
|
412
415
|
u++;
|
|
413
416
|
}), f(() => {
|
|
@@ -419,17 +422,14 @@ function me({ parentRouteIsRoot: e }) {
|
|
|
419
422
|
let r = t.latestLocation.href;
|
|
420
423
|
c !== void 0 && c === r || (c = r, t.emit({
|
|
421
424
|
type: "onRendered",
|
|
422
|
-
...
|
|
425
|
+
...F(t.stores.location.get(), t.stores.resolvedLocation.get())
|
|
423
426
|
}));
|
|
424
427
|
} }, { injector: r });
|
|
425
428
|
});
|
|
426
429
|
}
|
|
427
430
|
var q = class t {
|
|
428
431
|
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(() => {
|
|
432
|
+
this.matchId = m.required(), this.router = z(), this.match = d(() => this.matchSignal()), this.matchSignal = H(() => this.router.stores.matchStores.get(this.matchId()) ?? K, (e) => e), this.matchData = d(() => {
|
|
433
433
|
let e = this.match();
|
|
434
434
|
if (!e) return null;
|
|
435
435
|
let t = e.routeId, n = this.router.routesById[t], r = n.parentRoute?.id ?? null, i = (n.options.remountDeps ?? this.router.options.defaultRemountDeps)?.({
|
|
@@ -444,21 +444,21 @@ var q = class t {
|
|
|
444
444
|
match: e,
|
|
445
445
|
parentRouteId: r
|
|
446
446
|
};
|
|
447
|
-
}), this.isFistRouteInRouteTree = d(() => this.matchData()?.parentRouteId ===
|
|
447
|
+
}), this.isFistRouteInRouteTree = d(() => this.matchData()?.parentRouteId === P), this.resolvedNoSsr = d(() => {
|
|
448
448
|
let e = this.matchData()?.match;
|
|
449
449
|
return e ? e.ssr === !1 || e.ssr === "data-only" : !0;
|
|
450
450
|
}), this.shouldClientOnly = d(() => {
|
|
451
451
|
let e = this.matchData()?.match;
|
|
452
452
|
return e ? this.resolvedNoSsr() || !!e._displayPending : !0;
|
|
453
|
-
}), this.parentRouteIdSignal = d(() => this.matchData()?.parentRouteId ?? ""), this.rootRouteIdSignal = d(() =>
|
|
453
|
+
}), this.parentRouteIdSignal = d(() => this.matchData()?.parentRouteId ?? ""), this.rootRouteIdSignal = d(() => P), this.hasPendingMatch = d(() => {
|
|
454
454
|
let e = this.matchData()?.route.id;
|
|
455
455
|
return e ? !!this.pendingRouteIds()[e] : !1;
|
|
456
|
-
}), this.pendingRouteIds =
|
|
456
|
+
}), this.pendingRouteIds = H(this.router.stores.pendingRouteIds, (e) => e), this.nearestMatchContext = {
|
|
457
457
|
matchId: this.matchId,
|
|
458
458
|
routeId: d(() => this.matchData()?.route.id),
|
|
459
459
|
match: this.match,
|
|
460
460
|
hasPending: this.hasPendingMatch
|
|
461
|
-
}, this.isCatchingError =
|
|
461
|
+
}, this.isCatchingError = _e({ matchId: this.matchId }), this.render = W(() => {
|
|
462
462
|
let e = this.matchData();
|
|
463
463
|
if (!e || this.shouldClientOnly() && this.router.isServer) return null;
|
|
464
464
|
let { match: t, route: n } = e;
|
|
@@ -466,7 +466,7 @@ var q = class t {
|
|
|
466
466
|
if (t.status === "error" || this.isCatchingError()) return {
|
|
467
467
|
component: (Y(n.options.errorComponent) ?? Y(this.router.options.defaultErrorComponent)) || null,
|
|
468
468
|
providers: [{
|
|
469
|
-
provide:
|
|
469
|
+
provide: he,
|
|
470
470
|
useValue: {
|
|
471
471
|
error: t.error,
|
|
472
472
|
reset: () => {
|
|
@@ -482,7 +482,7 @@ var q = class t {
|
|
|
482
482
|
key: e.key,
|
|
483
483
|
component: t,
|
|
484
484
|
providers: [{
|
|
485
|
-
provide:
|
|
485
|
+
provide: I,
|
|
486
486
|
useValue: this.nearestMatchContext
|
|
487
487
|
}]
|
|
488
488
|
} : { component: Y(n.options.pendingComponent) ?? Y(this.router.options.defaultPendingComponent) };
|
|
@@ -492,12 +492,12 @@ var q = class t {
|
|
|
492
492
|
key: e.key,
|
|
493
493
|
component: t,
|
|
494
494
|
providers: [{
|
|
495
|
-
provide:
|
|
495
|
+
provide: I,
|
|
496
496
|
useValue: this.nearestMatchContext
|
|
497
497
|
}]
|
|
498
498
|
};
|
|
499
499
|
}
|
|
500
|
-
}), this.onRendered =
|
|
500
|
+
}), this.onRendered = ve({ parentRouteIsRoot: d(() => this.parentRouteIdSignal() === P) });
|
|
501
501
|
}
|
|
502
502
|
static {
|
|
503
503
|
this.ɵfac = function(e) {
|
|
@@ -512,6 +512,7 @@ var q = class t {
|
|
|
512
512
|
"router-match",
|
|
513
513
|
""
|
|
514
514
|
]],
|
|
515
|
+
hostAttrs: ["hidden", ""],
|
|
515
516
|
hostVars: 1,
|
|
516
517
|
hostBindings: function(t, n) {
|
|
517
518
|
t & 2 && e.ɵɵattribute("data-matchId", n.matchId());
|
|
@@ -525,13 +526,13 @@ var q = class t {
|
|
|
525
526
|
}
|
|
526
527
|
}, J = class t {
|
|
527
528
|
constructor() {
|
|
528
|
-
this.router =
|
|
529
|
+
this.router = z(), this.nearestMatch = p(I), this.currentMatch = H(() => {
|
|
529
530
|
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 =
|
|
531
|
+
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 = H(this.router.stores.childMatchIdByRouteId, (e) => e), this.childMatchId = d(() => {
|
|
532
533
|
let e = this.routeId();
|
|
533
534
|
return e ? this.childMatchIdByRouteId()[e] ?? null : null;
|
|
534
|
-
}), this.render =
|
|
535
|
+
}), this.render = W(() => this.parentGlobalNotFound() ? { component: X(this.router, this.route()) } : this.childMatchId() ? {
|
|
535
536
|
component: q,
|
|
536
537
|
inputs: { matchId: () => this.childMatchId() }
|
|
537
538
|
} : null);
|
|
@@ -549,6 +550,7 @@ var q = class t {
|
|
|
549
550
|
"outlet",
|
|
550
551
|
""
|
|
551
552
|
]],
|
|
553
|
+
hostAttrs: ["hidden", ""],
|
|
552
554
|
decls: 0,
|
|
553
555
|
vars: 0,
|
|
554
556
|
template: function(e, t) {},
|
|
@@ -560,18 +562,18 @@ function Y(e) {
|
|
|
560
562
|
return typeof e == "function" ? e() : e;
|
|
561
563
|
}
|
|
562
564
|
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>)`),
|
|
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>)`), me);
|
|
564
566
|
}
|
|
565
|
-
function
|
|
567
|
+
function ye(e) {
|
|
566
568
|
return null;
|
|
567
569
|
}
|
|
568
570
|
var Z = "data-tsr-scroll-restoration-inline";
|
|
569
|
-
function
|
|
570
|
-
let e =
|
|
571
|
+
function be() {
|
|
572
|
+
let e = z(), t = p(te), n = p(i);
|
|
571
573
|
e.isServer && l(() => {
|
|
572
574
|
let n = e.options.scrollRestoration;
|
|
573
575
|
if (!n || typeof n == "function" && !n({ location: e.latestLocation }) || t.querySelector(`script[${Z}]`)) return;
|
|
574
|
-
let r =
|
|
576
|
+
let r = ye(e);
|
|
575
577
|
if (!r) return;
|
|
576
578
|
let i = t.createElement("script");
|
|
577
579
|
i.setAttribute(Z, ""), i.className = "$tsr", i.text = `${r};document.currentScript.remove()`;
|
|
@@ -583,16 +585,16 @@ var Q = {
|
|
|
583
585
|
router: null,
|
|
584
586
|
mounted: !1
|
|
585
587
|
};
|
|
586
|
-
function
|
|
587
|
-
let t =
|
|
588
|
+
function xe() {
|
|
589
|
+
let t = z(), n = e.inject(e.EnvironmentInjector);
|
|
588
590
|
if (t.isServer) return;
|
|
589
|
-
let r = e.inject(e.DestroyRef), i = !1, a =
|
|
591
|
+
let r = e.inject(e.DestroyRef), i = !1, a = H(t.stores.isLoading, (e) => e), o = H(t.stores.isTransitioning, (e) => e), s = H(t.stores.hasPending, (e) => e), c = H(t.stores.status, (e) => e), l = H(t.stores.location, (e) => e), u = H(t.stores.resolvedLocation, (e) => e), d = e.computed(() => a() || o() || s()), f = e.computed(() => a() || s()), p = $(() => a()), m = $(() => d()), h = $(() => f());
|
|
590
592
|
t.startTransition = (r) => {
|
|
591
|
-
t.stores.isTransitioning.
|
|
593
|
+
t.stores.isTransitioning.set(!0);
|
|
592
594
|
let a = () => {
|
|
593
595
|
i || e.afterNextRender({ read: () => {
|
|
594
596
|
try {
|
|
595
|
-
t.stores.isTransitioning.
|
|
597
|
+
t.stores.isTransitioning.set(!1);
|
|
596
598
|
} catch {}
|
|
597
599
|
} }, { injector: n });
|
|
598
600
|
}, o = r();
|
|
@@ -609,14 +611,14 @@ function _e() {
|
|
|
609
611
|
state: !0,
|
|
610
612
|
_includeValidateSearch: !0
|
|
611
613
|
});
|
|
612
|
-
|
|
614
|
+
M(t.latestLocation.href) !== M(e.href) && t.commitLocation({
|
|
613
615
|
...e,
|
|
614
616
|
replace: !0
|
|
615
617
|
});
|
|
616
618
|
});
|
|
617
619
|
let _ = e.signal(!1);
|
|
618
620
|
e.afterNextRender(() => {
|
|
619
|
-
_.set(!0), d() || c() === "pending" && (t.stores.status.
|
|
621
|
+
_.set(!0), d() || c() === "pending" && (t.stores.status.set("idle"), t.stores.resolvedLocation.set(l()));
|
|
620
622
|
}), r.onDestroy(() => {
|
|
621
623
|
_.set(!1), i = !0, g && g();
|
|
622
624
|
}), e.afterNextRender(() => {
|
|
@@ -634,24 +636,24 @@ function _e() {
|
|
|
634
636
|
if (_()) try {
|
|
635
637
|
p() && !a() && t.emit({
|
|
636
638
|
type: "onLoad",
|
|
637
|
-
...
|
|
639
|
+
...F(l(), u())
|
|
638
640
|
});
|
|
639
641
|
} catch {}
|
|
640
642
|
}), e.effect(() => {
|
|
641
643
|
if (_()) try {
|
|
642
644
|
h() && !f() && t.emit({
|
|
643
645
|
type: "onBeforeRouteMount",
|
|
644
|
-
...
|
|
646
|
+
...F(l(), u())
|
|
645
647
|
});
|
|
646
648
|
} catch {}
|
|
647
649
|
}), e.effect(() => {
|
|
648
650
|
if (_()) try {
|
|
649
|
-
if (m() && !d() && c() === "pending" && (t.stores.status.
|
|
650
|
-
let e =
|
|
651
|
+
if (m() && !d() && c() === "pending" && (t.stores.status.set("idle"), t.stores.resolvedLocation.set(l())), m() && !d()) {
|
|
652
|
+
let e = F(l(), u());
|
|
651
653
|
t.emit({
|
|
652
654
|
type: "onResolved",
|
|
653
655
|
...e
|
|
654
|
-
}), e.hrefChanged &&
|
|
656
|
+
}), e.hrefChanged && ue(t);
|
|
655
657
|
}
|
|
656
658
|
} catch {}
|
|
657
659
|
});
|
|
@@ -663,9 +665,9 @@ function $(t) {
|
|
|
663
665
|
return r = n(), e;
|
|
664
666
|
});
|
|
665
667
|
}
|
|
666
|
-
var
|
|
668
|
+
var Se = class t {
|
|
667
669
|
constructor() {
|
|
668
|
-
this.router =
|
|
670
|
+
this.router = z(), this.matchId = H(this.router.stores.firstId, (e) => e), this.ssrScrollRestoration = be(), this.transitioner = xe(), this.render = W(() => {
|
|
669
671
|
let e = this.matchId();
|
|
670
672
|
return e ? {
|
|
671
673
|
component: q,
|
|
@@ -682,22 +684,23 @@ var ve = class t {
|
|
|
682
684
|
this.ɵcmp = /* @__PURE__ */ e.ɵɵdefineComponent({
|
|
683
685
|
type: t,
|
|
684
686
|
selectors: [["router-matches"]],
|
|
687
|
+
hostAttrs: ["hidden", ""],
|
|
685
688
|
decls: 0,
|
|
686
689
|
vars: 0,
|
|
687
690
|
template: function(e, t) {},
|
|
688
691
|
encapsulation: 2
|
|
689
692
|
});
|
|
690
693
|
}
|
|
691
|
-
},
|
|
694
|
+
}, Ce = /* @__PURE__ */ new a("CONTEXT", {
|
|
692
695
|
providedIn: "root",
|
|
693
696
|
factory: () => ({})
|
|
694
|
-
}),
|
|
697
|
+
}), we = /* @__PURE__ */ new a("OPTIONS", {
|
|
695
698
|
providedIn: "root",
|
|
696
699
|
factory: () => ({})
|
|
697
700
|
});
|
|
698
701
|
(class t {
|
|
699
702
|
constructor() {
|
|
700
|
-
this.injectedContext = p(
|
|
703
|
+
this.injectedContext = p(Ce), this.injectedOptions = p(we), this.injectedRouter = p(R(), { optional: !0 }), this.context = m(this.injectedContext), this.options = m(this.injectedOptions), this.routerInput = m(void 0, { alias: "router" }), this.router = d(() => {
|
|
701
704
|
let e = this.routerInput();
|
|
702
705
|
if (e) return e;
|
|
703
706
|
if (this.injectedRouter) return this.injectedRouter;
|
|
@@ -712,12 +715,12 @@ var ve = class t {
|
|
|
712
715
|
...t
|
|
713
716
|
}
|
|
714
717
|
});
|
|
715
|
-
}), this.render =
|
|
716
|
-
let e =
|
|
718
|
+
}), this.render = W(() => {
|
|
719
|
+
let e = y(this.router);
|
|
717
720
|
return {
|
|
718
|
-
component:
|
|
721
|
+
component: Se,
|
|
719
722
|
providers: [{
|
|
720
|
-
provide:
|
|
723
|
+
provide: R(),
|
|
721
724
|
useValue: e
|
|
722
725
|
}]
|
|
723
726
|
};
|
|
@@ -736,6 +739,7 @@ var ve = class t {
|
|
|
736
739
|
"router-provider",
|
|
737
740
|
""
|
|
738
741
|
]],
|
|
742
|
+
hostAttrs: ["hidden", ""],
|
|
739
743
|
inputs: {
|
|
740
744
|
context: [1, "context"],
|
|
741
745
|
options: [1, "options"],
|
|
@@ -752,10 +756,11 @@ var ve = class t {
|
|
|
752
756
|
});
|
|
753
757
|
}
|
|
754
758
|
});
|
|
755
|
-
function
|
|
756
|
-
|
|
759
|
+
function Te(e) {
|
|
760
|
+
let t = z();
|
|
761
|
+
return e?.select ? H(t.stores.location, e.select, { equal: T }) : H(t.stores.location);
|
|
757
762
|
}
|
|
758
|
-
function
|
|
763
|
+
function Ee(t, n, r) {
|
|
759
764
|
let i = e.inject(e.ElementRef);
|
|
760
765
|
e.afterRenderEffect((e) => {
|
|
761
766
|
let a = typeof IntersectionObserver == "function", o = i.nativeElement;
|
|
@@ -768,7 +773,7 @@ function Se(t, n, r) {
|
|
|
768
773
|
}
|
|
769
774
|
(class t {
|
|
770
775
|
constructor() {
|
|
771
|
-
this.passiveEvents =
|
|
776
|
+
this.passiveEvents = Oe(() => ({ touchstart: this.handleTouchStart })), this.options = m.required({ alias: "link" }), this.router = z(), this.isTransitioning = v(!1), this.from = d(() => y(() => this.options().from)), this.disabled = d(() => this._options().disabled ?? !1), this.target = d(() => this._options().target), this._options = d(() => ({
|
|
772
777
|
...this.options(),
|
|
773
778
|
from: this.from()
|
|
774
779
|
})), this.nextLocation = d(() => {
|
|
@@ -790,33 +795,33 @@ function Se(t, n, r) {
|
|
|
790
795
|
try {
|
|
791
796
|
return new URL(this.options().to), this.options().to;
|
|
792
797
|
} 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 =
|
|
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 = Te(), this.isActiveProps = d(() => {
|
|
794
799
|
let e = this.options(), t = this.isActive() ? e.activeProps : e.inactiveProps;
|
|
795
800
|
if (!(!t || typeof t != "object")) return t;
|
|
796
801
|
}), this.isActive = d(() => {
|
|
797
802
|
if (this.externalLink()) return !1;
|
|
798
803
|
let e = this.options().activeOptions;
|
|
799
804
|
if (e?.exact) {
|
|
800
|
-
if (!
|
|
805
|
+
if (!ce(this.location().pathname, this.nextLocation().pathname, this.router.basepath)) return !1;
|
|
801
806
|
} else {
|
|
802
|
-
let e =
|
|
807
|
+
let e = N(this.location().pathname, this.router.basepath), t = N(this.nextLocation().pathname, this.router.basepath);
|
|
803
808
|
if (!(e.startsWith(t) && (e.length === t.length || e[t.length] === "/"))) return !1;
|
|
804
809
|
}
|
|
805
|
-
return (e?.includeSearch ?? !0) && !
|
|
810
|
+
return (e?.includeSearch ?? !0) && !T(this.location().search, this.nextLocation().search, {
|
|
806
811
|
partial: !e?.exact,
|
|
807
812
|
ignoreUndefined: !e?.explicitUndefined
|
|
808
813
|
}) ? !1 : e?.includeHash ? this.location().hash === this.nextLocation().hash : !0;
|
|
809
814
|
}), this.doPreload = () => {
|
|
810
815
|
this.router.preloadRoute(this.options()).catch((e) => {
|
|
811
|
-
console.warn(e), console.warn(
|
|
816
|
+
console.warn(e), console.warn(le);
|
|
812
817
|
});
|
|
813
818
|
}, this.preloadViewportIoCallback = (e) => {
|
|
814
819
|
e?.isIntersecting && this.doPreload();
|
|
815
|
-
}, this.viewportPreloader =
|
|
820
|
+
}, this.viewportPreloader = Ee(this.preloadViewportIoCallback, { rootMargin: "100px" }, () => !!this._options().disabled || this.preload() !== "viewport"), this.hasRenderFetched = !1, this.rendererPreloader = f(() => {
|
|
816
821
|
this.hasRenderFetched || !this._options().disabled && this.preload() === "render" && (this.doPreload(), this.hasRenderFetched = !0);
|
|
817
822
|
}), this.handleClick = (e) => {
|
|
818
823
|
let t = e.currentTarget.getAttribute("target"), n = this._options().target, r = n === void 0 ? t : n;
|
|
819
|
-
if (!this._options().disabled && !
|
|
824
|
+
if (!this._options().disabled && !De(e) && !e.defaultPrevented && (!r || r === "_self") && e.button === 0) {
|
|
820
825
|
e.preventDefault(), this.isTransitioning.set(!0);
|
|
821
826
|
let t = this.router.subscribe("onResolved", () => {
|
|
822
827
|
t(), this.isTransitioning.set(!1);
|
|
@@ -881,10 +886,10 @@ function Se(t, n, r) {
|
|
|
881
886
|
});
|
|
882
887
|
}
|
|
883
888
|
});
|
|
884
|
-
function
|
|
889
|
+
function De(e) {
|
|
885
890
|
return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
|
|
886
891
|
}
|
|
887
|
-
function
|
|
892
|
+
function Oe(e) {
|
|
888
893
|
let t = p(r).nativeElement, i = p(n), a = p(s), o = [];
|
|
889
894
|
l(() => {
|
|
890
895
|
for (let [n, r] of Object.entries(e())) {
|
|
@@ -897,8 +902,8 @@ function we(e) {
|
|
|
897
902
|
}
|
|
898
903
|
//#endregion
|
|
899
904
|
//#region experimental/injectRouteErrorHandler.ts
|
|
900
|
-
function
|
|
901
|
-
let t =
|
|
905
|
+
function ke(e) {
|
|
906
|
+
let t = z(), r = fe({ from: e.from }), i = !1;
|
|
902
907
|
return p(n).onDestroy(() => {
|
|
903
908
|
i = !0;
|
|
904
909
|
}), { throw: (e) => {
|
|
@@ -906,7 +911,7 @@ function Te(e) {
|
|
|
906
911
|
console.warn("Attempted to throw error to route after it has been destroyed");
|
|
907
912
|
return;
|
|
908
913
|
}
|
|
909
|
-
let n =
|
|
914
|
+
let n = y(r).id;
|
|
910
915
|
t.updateMatch(n, (t) => ({
|
|
911
916
|
...t,
|
|
912
917
|
error: e,
|
|
@@ -917,4 +922,4 @@ function Te(e) {
|
|
|
917
922
|
} };
|
|
918
923
|
}
|
|
919
924
|
//#endregion
|
|
920
|
-
export {
|
|
925
|
+
export { ke as injectRouteErrorHandler };
|