clear-react-router 1.0.2 → 1.0.3
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/index.js +515 -437
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,439 +1,517 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
},
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
},
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
1
|
+
var _e = Object.defineProperty;
|
|
2
|
+
var we = (r, n, a) => n in r ? _e(r, n, { enumerable: !0, configurable: !0, writable: !0, value: a }) : r[n] = a;
|
|
3
|
+
var S = (r, n, a) => we(r, typeof n != "symbol" ? n + "" : n, a);
|
|
4
|
+
import ke, { createContext as W, lazy as ye, Suspense as Te, useRef as te, useEffect as j, useState as T, useCallback as y, useMemo as N, useContext as q } from "react";
|
|
5
|
+
var C = { exports: {} }, P = {};
|
|
6
|
+
/**
|
|
7
|
+
* @license React
|
|
8
|
+
* react-jsx-runtime.production.js
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the MIT license found in the
|
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
|
14
|
+
*/
|
|
15
|
+
var I;
|
|
16
|
+
function ge() {
|
|
17
|
+
if (I) return P;
|
|
18
|
+
I = 1;
|
|
19
|
+
var r = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
20
|
+
function a(u, o, f) {
|
|
21
|
+
var s = null;
|
|
22
|
+
if (f !== void 0 && (s = "" + f), o.key !== void 0 && (s = "" + o.key), "key" in o) {
|
|
23
|
+
f = {};
|
|
24
|
+
for (var E in o)
|
|
25
|
+
E !== "key" && (f[E] = o[E]);
|
|
26
|
+
} else f = o;
|
|
27
|
+
return o = f.ref, {
|
|
28
|
+
$$typeof: r,
|
|
29
|
+
type: u,
|
|
30
|
+
key: s,
|
|
31
|
+
ref: o !== void 0 ? o : null,
|
|
32
|
+
props: f
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return P.Fragment = n, P.jsx = a, P.jsxs = a, P;
|
|
36
|
+
}
|
|
37
|
+
var O = {};
|
|
38
|
+
/**
|
|
39
|
+
* @license React
|
|
40
|
+
* react-jsx-runtime.development.js
|
|
41
|
+
*
|
|
42
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the MIT license found in the
|
|
45
|
+
* LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/
|
|
47
|
+
var ee;
|
|
48
|
+
function Pe() {
|
|
49
|
+
return ee || (ee = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
50
|
+
function r(e) {
|
|
51
|
+
if (e == null) return null;
|
|
52
|
+
if (typeof e == "function")
|
|
53
|
+
return e.$$typeof === Re ? null : e.displayName || e.name || null;
|
|
54
|
+
if (typeof e == "string") return e;
|
|
55
|
+
switch (e) {
|
|
56
|
+
case w:
|
|
57
|
+
return "Fragment";
|
|
58
|
+
case ue:
|
|
59
|
+
return "Profiler";
|
|
60
|
+
case x:
|
|
61
|
+
return "StrictMode";
|
|
62
|
+
case pe:
|
|
63
|
+
return "Suspense";
|
|
64
|
+
case he:
|
|
65
|
+
return "SuspenseList";
|
|
66
|
+
case Ee:
|
|
67
|
+
return "Activity";
|
|
68
|
+
}
|
|
69
|
+
if (typeof e == "object")
|
|
70
|
+
switch (typeof e.tag == "number" && console.error(
|
|
71
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
72
|
+
), e.$$typeof) {
|
|
73
|
+
case R:
|
|
74
|
+
return "Portal";
|
|
75
|
+
case fe:
|
|
76
|
+
return e.displayName || "Context";
|
|
77
|
+
case le:
|
|
78
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
79
|
+
case de:
|
|
80
|
+
var c = e.render;
|
|
81
|
+
return e = e.displayName, e || (e = c.displayName || c.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
82
|
+
case me:
|
|
83
|
+
return c = e.displayName || null, c !== null ? c : r(e.type) || "Memo";
|
|
84
|
+
case $:
|
|
85
|
+
c = e._payload, e = e._init;
|
|
86
|
+
try {
|
|
87
|
+
return r(e(c));
|
|
88
|
+
} catch {
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
function n(e) {
|
|
94
|
+
return "" + e;
|
|
95
|
+
}
|
|
96
|
+
function a(e) {
|
|
97
|
+
try {
|
|
98
|
+
n(e);
|
|
99
|
+
var c = !1;
|
|
100
|
+
} catch {
|
|
101
|
+
c = !0;
|
|
102
|
+
}
|
|
103
|
+
if (c) {
|
|
104
|
+
c = console;
|
|
105
|
+
var d = c.error, p = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
106
|
+
return d.call(
|
|
107
|
+
c,
|
|
108
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
109
|
+
p
|
|
110
|
+
), n(e);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function u(e) {
|
|
114
|
+
if (e === w) return "<>";
|
|
115
|
+
if (typeof e == "object" && e !== null && e.$$typeof === $)
|
|
116
|
+
return "<...>";
|
|
117
|
+
try {
|
|
118
|
+
var c = r(e);
|
|
119
|
+
return c ? "<" + c + ">" : "<...>";
|
|
120
|
+
} catch {
|
|
121
|
+
return "<...>";
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function o() {
|
|
125
|
+
var e = D.A;
|
|
126
|
+
return e === null ? null : e.getOwner();
|
|
127
|
+
}
|
|
128
|
+
function f() {
|
|
129
|
+
return Error("react-stack-top-frame");
|
|
130
|
+
}
|
|
131
|
+
function s(e) {
|
|
132
|
+
if (G.call(e, "key")) {
|
|
133
|
+
var c = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
134
|
+
if (c && c.isReactWarning) return !1;
|
|
135
|
+
}
|
|
136
|
+
return e.key !== void 0;
|
|
137
|
+
}
|
|
138
|
+
function E(e, c) {
|
|
139
|
+
function d() {
|
|
140
|
+
X || (X = !0, console.error(
|
|
141
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
142
|
+
c
|
|
143
|
+
));
|
|
144
|
+
}
|
|
145
|
+
d.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
146
|
+
get: d,
|
|
147
|
+
configurable: !0
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function m() {
|
|
151
|
+
var e = r(this.type);
|
|
152
|
+
return H[e] || (H[e] = !0, console.error(
|
|
153
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
154
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
155
|
+
}
|
|
156
|
+
function b(e, c, d, p, A, M) {
|
|
157
|
+
var h = d.ref;
|
|
158
|
+
return e = {
|
|
159
|
+
$$typeof: i,
|
|
160
|
+
type: e,
|
|
161
|
+
key: c,
|
|
162
|
+
props: d,
|
|
163
|
+
_owner: p
|
|
164
|
+
}, (h !== void 0 ? h : null) !== null ? Object.defineProperty(e, "ref", {
|
|
165
|
+
enumerable: !1,
|
|
166
|
+
get: m
|
|
167
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
168
|
+
configurable: !1,
|
|
169
|
+
enumerable: !1,
|
|
170
|
+
writable: !0,
|
|
171
|
+
value: 0
|
|
172
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
173
|
+
configurable: !1,
|
|
174
|
+
enumerable: !1,
|
|
175
|
+
writable: !0,
|
|
176
|
+
value: null
|
|
177
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
178
|
+
configurable: !1,
|
|
179
|
+
enumerable: !1,
|
|
180
|
+
writable: !0,
|
|
181
|
+
value: A
|
|
182
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
183
|
+
configurable: !1,
|
|
184
|
+
enumerable: !1,
|
|
185
|
+
writable: !0,
|
|
186
|
+
value: M
|
|
187
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
188
|
+
}
|
|
189
|
+
function _(e, c, d, p, A, M) {
|
|
190
|
+
var h = c.children;
|
|
191
|
+
if (h !== void 0)
|
|
192
|
+
if (p)
|
|
193
|
+
if (be(h)) {
|
|
194
|
+
for (p = 0; p < h.length; p++)
|
|
195
|
+
v(h[p]);
|
|
196
|
+
Object.freeze && Object.freeze(h);
|
|
197
|
+
} else
|
|
198
|
+
console.error(
|
|
199
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
200
|
+
);
|
|
201
|
+
else v(h);
|
|
202
|
+
if (G.call(c, "key")) {
|
|
203
|
+
h = r(e);
|
|
204
|
+
var g = Object.keys(c).filter(function(ve) {
|
|
205
|
+
return ve !== "key";
|
|
206
|
+
});
|
|
207
|
+
p = 0 < g.length ? "{key: someKey, " + g.join(": ..., ") + ": ...}" : "{key: someKey}", K[h + p] || (g = 0 < g.length ? "{" + g.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
208
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
209
|
+
let props = %s;
|
|
210
|
+
<%s {...props} />
|
|
211
|
+
React keys must be passed directly to JSX without using spread:
|
|
212
|
+
let props = %s;
|
|
213
|
+
<%s key={someKey} {...props} />`,
|
|
214
|
+
p,
|
|
215
|
+
h,
|
|
216
|
+
g,
|
|
217
|
+
h
|
|
218
|
+
), K[h + p] = !0);
|
|
219
|
+
}
|
|
220
|
+
if (h = null, d !== void 0 && (a(d), h = "" + d), s(c) && (a(c.key), h = "" + c.key), "key" in c) {
|
|
221
|
+
d = {};
|
|
222
|
+
for (var F in c)
|
|
223
|
+
F !== "key" && (d[F] = c[F]);
|
|
224
|
+
} else d = c;
|
|
225
|
+
return h && E(
|
|
226
|
+
d,
|
|
227
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
228
|
+
), b(
|
|
229
|
+
e,
|
|
230
|
+
h,
|
|
231
|
+
d,
|
|
232
|
+
o(),
|
|
233
|
+
A,
|
|
234
|
+
M
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
function v(e) {
|
|
238
|
+
l(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === $ && (e._payload.status === "fulfilled" ? l(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
239
|
+
}
|
|
240
|
+
function l(e) {
|
|
241
|
+
return typeof e == "object" && e !== null && e.$$typeof === i;
|
|
242
|
+
}
|
|
243
|
+
var t = ke, i = Symbol.for("react.transitional.element"), R = Symbol.for("react.portal"), w = Symbol.for("react.fragment"), x = Symbol.for("react.strict_mode"), ue = Symbol.for("react.profiler"), le = Symbol.for("react.consumer"), fe = Symbol.for("react.context"), de = Symbol.for("react.forward_ref"), pe = Symbol.for("react.suspense"), he = Symbol.for("react.suspense_list"), me = Symbol.for("react.memo"), $ = Symbol.for("react.lazy"), Ee = Symbol.for("react.activity"), Re = Symbol.for("react.client.reference"), D = t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, G = Object.prototype.hasOwnProperty, be = Array.isArray, Y = console.createTask ? console.createTask : function() {
|
|
244
|
+
return null;
|
|
245
|
+
};
|
|
246
|
+
t = {
|
|
247
|
+
react_stack_bottom_frame: function(e) {
|
|
248
|
+
return e();
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
var X, H = {}, Z = t.react_stack_bottom_frame.bind(
|
|
252
|
+
t,
|
|
253
|
+
f
|
|
254
|
+
)(), Q = Y(u(f)), K = {};
|
|
255
|
+
O.Fragment = w, O.jsx = function(e, c, d) {
|
|
256
|
+
var p = 1e4 > D.recentlyCreatedOwnerStacks++;
|
|
257
|
+
return _(
|
|
258
|
+
e,
|
|
259
|
+
c,
|
|
260
|
+
d,
|
|
261
|
+
!1,
|
|
262
|
+
p ? Error("react-stack-top-frame") : Z,
|
|
263
|
+
p ? Y(u(e)) : Q
|
|
264
|
+
);
|
|
265
|
+
}, O.jsxs = function(e, c, d) {
|
|
266
|
+
var p = 1e4 > D.recentlyCreatedOwnerStacks++;
|
|
267
|
+
return _(
|
|
268
|
+
e,
|
|
269
|
+
c,
|
|
270
|
+
d,
|
|
271
|
+
!0,
|
|
272
|
+
p ? Error("react-stack-top-frame") : Z,
|
|
273
|
+
p ? Y(u(e)) : Q
|
|
274
|
+
);
|
|
275
|
+
};
|
|
276
|
+
})()), O;
|
|
277
|
+
}
|
|
278
|
+
var re;
|
|
279
|
+
function Oe() {
|
|
280
|
+
return re || (re = 1, process.env.NODE_ENV === "production" ? C.exports = ge() : C.exports = Pe()), C.exports;
|
|
281
|
+
}
|
|
282
|
+
var k = Oe();
|
|
283
|
+
const ne = W({}), ae = W({}), oe = W({}), B = ({
|
|
284
|
+
children: r,
|
|
285
|
+
setContext: n,
|
|
286
|
+
context: a,
|
|
287
|
+
updateBlockedRoute: u,
|
|
288
|
+
updateLocation: o,
|
|
289
|
+
location: f,
|
|
290
|
+
params: s,
|
|
291
|
+
prefetchLoader: E,
|
|
292
|
+
loaderCache: m,
|
|
293
|
+
blockerState: b
|
|
294
|
+
}) => /* @__PURE__ */ k.jsx(
|
|
295
|
+
ne.Provider,
|
|
296
|
+
{
|
|
297
|
+
value: {
|
|
298
|
+
updateLocation: o,
|
|
299
|
+
updateBlockedRoute: u,
|
|
300
|
+
prefetchLoader: E,
|
|
301
|
+
setContext: n
|
|
302
|
+
},
|
|
303
|
+
children: /* @__PURE__ */ k.jsx(ae.Provider, { value: { context: a, loaderCache: m }, children: /* @__PURE__ */ k.jsx(oe.Provider, { value: { blockerState: b, params: s, location: f }, children: r }) })
|
|
304
|
+
}
|
|
305
|
+
), je = (r, n) => {
|
|
306
|
+
const a = ye(() => r().then((u) => ({ default: u.default || u })));
|
|
307
|
+
return () => /* @__PURE__ */ k.jsx(Te, { fallback: typeof n == "function" ? n() : n || null, children: /* @__PURE__ */ k.jsx(a, {}) });
|
|
308
|
+
}, xe = (r) => typeof r.element == "function" && r.element.toString().includes("import("), se = (r, n = [], a = "") => {
|
|
309
|
+
var v;
|
|
310
|
+
const u = r.path.match(/:[^/]+/g), o = r.path.replaceAll(/:[^/]+(\/|$)/g, "").split("/").filter(Boolean), f = r.path.split("/"), s = u ? [
|
|
311
|
+
...n,
|
|
312
|
+
...u.map((l, t) => ({
|
|
313
|
+
key: o[t],
|
|
314
|
+
value: l.slice(1)
|
|
315
|
+
}))
|
|
316
|
+
] : n, E = s.length ? `${a}${f.slice(0, f.length - 1).join("/")}` : r.path, m = xe(r) ? je(r.element, r.fallback) : r.element, b = {
|
|
317
|
+
...r,
|
|
318
|
+
path: E,
|
|
319
|
+
params: s,
|
|
320
|
+
element: m
|
|
321
|
+
}, _ = ((v = r.children) == null ? void 0 : v.flatMap((l) => se(l, s, E))) || [];
|
|
322
|
+
return [b, ..._];
|
|
323
|
+
}, Fe = (r) => r.flatMap((n) => se(n, [])), Ae = (r) => {
|
|
324
|
+
const { pathname: n } = window.location, a = n.split("/");
|
|
325
|
+
return (r || []).map((u) => ({ index: a.findIndex((o) => o === u.key), value: u.value })).reduce((u, o) => ({ ...u, [o.value]: a[o.index + 1] }), {});
|
|
326
|
+
}, U = (r) => ({
|
|
327
|
+
pathname: r.pathname,
|
|
328
|
+
search: r.search
|
|
329
|
+
}), J = (r, n) => {
|
|
330
|
+
const a = r.path.split("/").filter(Boolean), u = r.params ? Object.keys(r.params).length : 0, o = n.split("/").filter(Boolean);
|
|
331
|
+
return a.every((f, s) => f === o[s + (s ? 1 : 0)]) && o.length === a.length + u;
|
|
332
|
+
};
|
|
333
|
+
class ce {
|
|
334
|
+
constructor(n, a) {
|
|
335
|
+
S(this, "url");
|
|
336
|
+
S(this, "search");
|
|
337
|
+
S(this, "cause");
|
|
338
|
+
this.url = n, this.search = a, this.cause = "redirect";
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
const Be = (r, n) => Promise.reject(new ce(r, n)), Se = (r) => {
|
|
342
|
+
const n = te(r);
|
|
343
|
+
return j(() => {
|
|
344
|
+
n.current = r;
|
|
345
|
+
}, [r]), n;
|
|
346
|
+
}, Ce = ({ setLocation: r, routeList: n, context: a, revalidateCache: u }) => {
|
|
347
|
+
const [o, f] = T({ from: "", to: "" }), s = te(""), E = y(
|
|
348
|
+
async (l) => {
|
|
349
|
+
try {
|
|
350
|
+
const t = n.find((i) => J(i, l.pathname));
|
|
351
|
+
t != null && t.beforeLoad && await (t == null ? void 0 : t.beforeLoad(a)), r(l), l.pathname !== window.location.pathname && (history.pushState(null, "", l.pathname), s.current = l.pathname), await u(t), t != null && t.afterLoad && await (t == null ? void 0 : t.afterLoad(a));
|
|
352
|
+
} catch (t) {
|
|
353
|
+
if (!(t instanceof ce)) return t;
|
|
354
|
+
history.replaceState(null, "", `${t.url}${t.search || ""}`), r({ pathname: t.url, search: t.search });
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
[a, u, n, r]
|
|
358
|
+
), m = Se(E), b = y(
|
|
359
|
+
({ type: l, payload: t = "" }) => f((i) => i.from === t && l === "charge" ? i : t && i.from !== t && l === "charge" ? { ...i, from: t } : l === "reset" ? { ...i, to: "" } : (l === "process" && m.current({ pathname: i.to }), !i.from && !i.to ? i : { from: "", to: "" })),
|
|
360
|
+
[m]
|
|
361
|
+
), _ = y(
|
|
362
|
+
async (l) => {
|
|
363
|
+
o.from ? f((t) => ({ ...t, to: l.pathname })) : await m.current(l);
|
|
364
|
+
},
|
|
365
|
+
[o.from, m]
|
|
366
|
+
);
|
|
367
|
+
return j(() => {
|
|
368
|
+
const l = async (t) => {
|
|
369
|
+
const i = U(t.target.location);
|
|
370
|
+
s.current === o.from ? (f({ from: s.current, to: i.pathname }), history.replaceState(null, "", s.current)) : r(i);
|
|
371
|
+
};
|
|
372
|
+
return window.addEventListener("popstate", l), () => window.removeEventListener("popstate", l);
|
|
373
|
+
}, [o.from, r]), j(() => {
|
|
374
|
+
const l = U(window.location);
|
|
375
|
+
m.current(l), s.current = l.pathname;
|
|
376
|
+
}, [m]), { blockerState: N(() => o.from && o.to ? "blocked" : o.from ? "charged" : "unblocked", [o]), updateLocation: _, updateBlockedRoute: b };
|
|
377
|
+
}, Ne = (r) => {
|
|
378
|
+
const [n, a] = T({}), [u, o] = T({}), [f, s] = T(!1), [E, m] = T({}), b = y(
|
|
379
|
+
({ key: t, value: i }) => a((R) => ({
|
|
380
|
+
...R,
|
|
381
|
+
[t]: i
|
|
382
|
+
})),
|
|
383
|
+
[]
|
|
384
|
+
), _ = y(
|
|
385
|
+
(t) => {
|
|
386
|
+
if (!t) return !0;
|
|
387
|
+
const i = u[t.path];
|
|
388
|
+
return !!(i && Date.now() - i < (t.staleTime || 0));
|
|
389
|
+
},
|
|
390
|
+
[u]
|
|
391
|
+
), v = y(
|
|
392
|
+
async (t) => {
|
|
393
|
+
if (t != null && t.loader && !_(t)) {
|
|
394
|
+
m((i) => ({ ...i, [t.path]: !0 })), a(
|
|
395
|
+
(i) => Object.keys(i).filter((R) => R !== t.path).reduce((R, w) => ({ ...R, [w]: i[w] }), {})
|
|
396
|
+
);
|
|
397
|
+
try {
|
|
398
|
+
s(!1);
|
|
399
|
+
const i = await (t == null ? void 0 : t.loader());
|
|
400
|
+
o((R) => ({
|
|
401
|
+
...R,
|
|
402
|
+
[t.path]: Date.now()
|
|
403
|
+
})), b({ key: t.path, value: i });
|
|
404
|
+
} catch {
|
|
405
|
+
s(!0);
|
|
406
|
+
} finally {
|
|
407
|
+
m((i) => ({ ...i, [t.path]: !1 }));
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
[_, b]
|
|
412
|
+
), l = y(
|
|
413
|
+
async (t) => {
|
|
414
|
+
const i = r.find((R) => J(R, t));
|
|
415
|
+
i && await v(i);
|
|
416
|
+
},
|
|
417
|
+
[v, r]
|
|
418
|
+
);
|
|
419
|
+
return { loaderCache: n, loaderError: f, prefetchLoader: l, revalidateCache: v, isLoadingMap: E };
|
|
420
|
+
}, z = (r) => r ? typeof r == "function" ? /* @__PURE__ */ k.jsx(r, {}) : r : null, Le = "error 404. Page not found", $e = "*", ze = ({ routeList: r, context: n = {} }) => {
|
|
421
|
+
const [a, u] = T(U(window.location)), [o, f] = T(n), s = N(
|
|
422
|
+
() => r.find((x) => x.path === $e || J(x, a.pathname)),
|
|
423
|
+
[a.pathname, r]
|
|
424
|
+
), { loaderError: E, loaderCache: m, prefetchLoader: b, revalidateCache: _, isLoadingMap: v } = Ne(r), { blockerState: l, updateLocation: t, updateBlockedRoute: i } = Ce({
|
|
425
|
+
setLocation: u,
|
|
426
|
+
routeList: r,
|
|
427
|
+
context: o,
|
|
428
|
+
revalidateCache: _
|
|
429
|
+
}), R = N(() => s != null && s.params ? Ae(s.params) : {}, [s]), w = N(
|
|
430
|
+
() => ({
|
|
431
|
+
location: a,
|
|
432
|
+
updateLocation: t,
|
|
433
|
+
params: R,
|
|
434
|
+
loaderCache: m,
|
|
435
|
+
prefetchLoader: b,
|
|
436
|
+
updateBlockedRoute: i,
|
|
437
|
+
blockerState: l,
|
|
438
|
+
context: o,
|
|
439
|
+
setContext: f
|
|
440
|
+
}),
|
|
441
|
+
[l, m, a, R, b, o, i, t]
|
|
442
|
+
);
|
|
443
|
+
return s != null && s.loader && !E && v[a.pathname] ? /* @__PURE__ */ k.jsx(B, { ...w, children: z(s == null ? void 0 : s.loaderFallback) }) : E ? /* @__PURE__ */ k.jsx(B, { ...w, children: z(s == null ? void 0 : s.errorElement) }) : /* @__PURE__ */ k.jsx(B, { ...w, children: z(s == null ? void 0 : s.element) || Le });
|
|
444
|
+
}, V = () => {
|
|
445
|
+
const r = q(oe);
|
|
446
|
+
if (!Object.keys(r).length) throw new Error("useNavigationState must be used within Router component");
|
|
447
|
+
return r;
|
|
393
448
|
}, L = () => {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
},
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
},
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
449
|
+
const r = q(ne);
|
|
450
|
+
if (!Object.keys(r).length) throw new Error("useRouterActions must be used within Router component");
|
|
451
|
+
return r;
|
|
452
|
+
}, ie = () => {
|
|
453
|
+
const r = q(ae);
|
|
454
|
+
if (!Object.keys(r).length) throw new Error("useRouterData must be used within Router component");
|
|
455
|
+
return r;
|
|
456
|
+
}, De = () => {
|
|
457
|
+
const { updateLocation: r } = L();
|
|
458
|
+
return y(
|
|
459
|
+
async (n) => n === -1 ? history.go(-1) : await r(n),
|
|
460
|
+
[r]
|
|
461
|
+
);
|
|
462
|
+
}, Ue = ({ children: r, to: n, prefetch: a = !0 }) => {
|
|
463
|
+
const { prefetchLoader: u } = L(), o = De();
|
|
464
|
+
return /* @__PURE__ */ k.jsx(
|
|
465
|
+
"a",
|
|
466
|
+
{
|
|
467
|
+
style: { cursor: "pointer" },
|
|
468
|
+
onClick: () => o({ pathname: n }),
|
|
469
|
+
onMouseOver: () => a && u(n),
|
|
470
|
+
children: r
|
|
471
|
+
}
|
|
472
|
+
);
|
|
473
|
+
}, We = () => {
|
|
474
|
+
const { params: r } = V();
|
|
475
|
+
return r;
|
|
476
|
+
}, qe = () => V().location, Je = () => {
|
|
477
|
+
const { loaderCache: r } = ie();
|
|
478
|
+
return r[window.location.pathname];
|
|
479
|
+
}, Ve = (r) => {
|
|
480
|
+
const {
|
|
481
|
+
location: { pathname: n },
|
|
482
|
+
blockerState: a
|
|
483
|
+
} = V(), { updateBlockedRoute: u } = L(), o = r();
|
|
484
|
+
return j(
|
|
485
|
+
() => u(o ? { type: "charge", payload: n } : { type: "unblock" }),
|
|
486
|
+
[o, n, u]
|
|
487
|
+
), {
|
|
488
|
+
state: a,
|
|
489
|
+
process: () => u({ type: "process" }),
|
|
490
|
+
reset: () => u({ type: "reset" })
|
|
491
|
+
};
|
|
492
|
+
}, Ge = (r) => {
|
|
493
|
+
j(() => {
|
|
494
|
+
const n = (a) => {
|
|
495
|
+
r && (a.preventDefault(), r());
|
|
496
|
+
};
|
|
497
|
+
return window.addEventListener("beforeunload", n), () => window.removeEventListener("beforeunload", n);
|
|
498
|
+
}, [r]);
|
|
499
|
+
}, Xe = () => {
|
|
500
|
+
const { context: r } = ie(), { setContext: n } = L();
|
|
501
|
+
return { context: r, setContext: n };
|
|
502
|
+
};
|
|
503
|
+
export {
|
|
504
|
+
Ue as Link,
|
|
505
|
+
ze as Router,
|
|
506
|
+
J as comparePaths,
|
|
507
|
+
Fe as createRouter,
|
|
508
|
+
U as parseWindowLocation,
|
|
509
|
+
Be as redirect,
|
|
510
|
+
Ge as useBeforeUnload,
|
|
511
|
+
Ve as useBlocker,
|
|
512
|
+
Je as useLoaderState,
|
|
513
|
+
qe as useLocation,
|
|
514
|
+
De as useNavigate,
|
|
515
|
+
We as useParams,
|
|
516
|
+
Xe as useRouterContext
|
|
437
517
|
};
|
|
438
|
-
//#endregion
|
|
439
|
-
export { R as Link, N as Router, w as comparePaths, x as createRouter, C as parseWindowLocation, E as redirect, U as useBeforeUnload, H as useBlocker, V as useLoaderState, B as useLocation, L as useNavigate, z as useParams, W as useRouterContext };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clear-react-router",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A lightweight, type-safe routing library for React applications",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
16
17
|
"import": "./dist/index.js",
|
|
17
|
-
"require": "./dist/index.js"
|
|
18
|
-
"types": "./dist/index.d.ts"
|
|
18
|
+
"require": "./dist/index.js"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"author": "Andrew Bubnov",
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/react": "^19.2.17",
|
|
43
|
-
"@vitejs/plugin-react": "^
|
|
43
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
44
44
|
"react": "^19.2.7",
|
|
45
45
|
"react-dom": "^19.2.7",
|
|
46
46
|
"typescript": "^6.0.3",
|
|
47
|
-
"vite": "^
|
|
47
|
+
"vite": "^6.4.3",
|
|
48
48
|
"vite-plugin-dts": "^5.0.2"
|
|
49
49
|
}
|
|
50
50
|
}
|