@funstack/router 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/skill-installer.mjs +2 -3
- package/dist/bin/skill-installer.mjs.map +1 -1
- package/dist/{bindRoute-C7JBYje-.mjs → bindRoute-CQ2-ruTp.mjs} +2 -3
- package/dist/{bindRoute-C7JBYje-.mjs.map → bindRoute-CQ2-ruTp.mjs.map} +1 -1
- package/dist/{bindRoute-BtT4qPKI.d.mts → bindRoute-DulMzi5X.d.mts} +1 -1
- package/dist/{bindRoute-BtT4qPKI.d.mts.map → bindRoute-DulMzi5X.d.mts.map} +1 -1
- package/dist/docs/ApiHooksPage.tsx +9 -0
- package/dist/docs/ApiTypesPage.tsx +17 -0
- package/dist/docs/LearnLoadersPage.tsx +320 -0
- package/dist/docs/index.md +1 -0
- package/dist/index.d.mts +21 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +59 -34
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.mjs +2 -3
- package/package.json +4 -3
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/Router/index.tsx","../src/Outlet.tsx","../src/hooks/useLocation.ts","../src/hooks/useSearchParams.ts","../src/hooks/useBlocker.ts","../src/hooks/useRouteParams.ts","../src/hooks/useRouteState.ts","../src/hooks/useRouteData.ts","../src/hooks/useIsPending.ts","../src/bypassInterception.ts"],"mappings":";;;;cAGM,6BAAA;;AAFoE;;;;;;;KAgB9D,uBAAA;EAAA,CACT,6BAAA,UAyB0B;EAvB3B,IAAA,WA4Be;EA1Bf,QAAA,GAAW,uBAAA;EAgCc;;;;;;EAzBzB,KAAA;EAPA;;;;;EAaA,eAAA,YAM2B;EAA3B,MAAA,IAAU,IAAA,EAAM,UAAA,CAAW,MAAA,+BAE3B;EAAA,MAAA,IAAU,IAAA,EAAM,UAAA,CAAW,MAAA,wCAAA;EAE3B,SAAA,GACI,aAAA;IACE,IAAA;IACA,MAAA,GAAS,MAAA;IACT,KAAA;IACA,QAAA,IACE,KAAA,cAAmB,IAAA,2BAChB,OAAA;IACL,YAAA,IAAgB,KAAA,cAAmB,IAAA;IACnC,UAAA,SAAmB,OAAA;IACnB,cAAA;IACA,IAAA;EAAA,KAEF,SAAA;AAAA;;;AAmBN;KAAY,YAAA;sCAEV,KAAA,EAAO,uBAAA,EAAP;EAEA,MAAA,EAAQ,MAAA,kBAAR;EAEA,QAAA;AAAA;;;;KAcU,cAAA;EAMQ,4DAJlB,OAAA,WAAkB,YAAA,WAUR;EARV,YAAA;EAEA,QAAA,EAAU,QAAA;AAAA;;;;KAMA,eAAA;EAYA,uDAVV,OAAA;EAEA,KAAA,YASA;EAPA,IAAA;AAAA
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/Router/index.tsx","../src/Outlet.tsx","../src/hooks/useLocation.ts","../src/hooks/useSearchParams.ts","../src/hooks/useBlocker.ts","../src/hooks/useRouteParams.ts","../src/hooks/useRouteState.ts","../src/hooks/useRouteData.ts","../src/hooks/useIsPending.ts","../src/bypassInterception.ts"],"mappings":";;;;cAGM,6BAAA;;AAFoE;;;;;;;KAgB9D,uBAAA;EAAA,CACT,6BAAA,UAyB0B;EAvB3B,IAAA,WA4Be;EA1Bf,QAAA,GAAW,uBAAA;EAgCc;;;;;;EAzBzB,KAAA;EAPA;;;;;EAaA,eAAA,YAM2B;EAA3B,MAAA,IAAU,IAAA,EAAM,UAAA,CAAW,MAAA,+BAE3B;EAAA,MAAA,IAAU,IAAA,EAAM,UAAA,CAAW,MAAA,wCAAA;EAE3B,SAAA,GACI,aAAA;IACE,IAAA;IACA,MAAA,GAAS,MAAA;IACT,KAAA;IACA,QAAA,IACE,KAAA,cAAmB,IAAA,2BAChB,OAAA;IACL,YAAA,IAAgB,KAAA,cAAmB,IAAA;IACnC,UAAA,SAAmB,OAAA;IACnB,cAAA;IACA,IAAA;EAAA,KAEF,SAAA;AAAA;;;AAmBN;KAAY,YAAA;sCAEV,KAAA,EAAO,uBAAA,EAAP;EAEA,MAAA,EAAQ,MAAA,kBAAR;EAEA,QAAA;AAAA;;;;KAcU,cAAA;EAMQ,4DAJlB,OAAA,WAAkB,YAAA,WAUR;EARV,YAAA;EAEA,QAAA,EAAU,QAAA;AAAA;;;;KAMA,eAAA;EAYA,uDAVV,OAAA;EAEA,KAAA,YASA;EAPA,IAAA;AAAA;;;;KAMU,QAAA;EACV,QAAA;EACA,MAAA;EACA,IAAA;EAgCoB;;;;;;;AAStB;;EA/BE,OAAA;EA+BsB;;;;;AC7HxB;;;;EDwGE,QAAA;AAAA;;;;;;;;KAUU,kBAAA,IACV,KAAA,EAAO,aAAA,EACP,IAAA,EAAM,cAAA;;;;;;;KASI,YAAA;;;;AApK8D;;KCuC9D,SAAA;EDrCkC;;AAc9C;;;;EC8BE,IAAA;EDN2B;;;;;;;;;;;ECkB3B,UAAA;AAAA;AAAA,KAGU,WAAA;EACV,MAAA,EAAQ,eAAA;EDlCR;;;;;;;EC0CA,UAAA,GAAa,kBAAA;ED5Bc;;;;;;ECmC3B,QAAA,GAAW,YAAA;ED7BL;;;;;;;;;;;;;;;AA4BR;;;;;ECsBE,GAAA,GAAM,SAAA;AAAA;AAAA,iBAGQ,MAAA,CAAA;EACd,MAAA,EAAQ,WAAA;EACR,UAAA;EACA,QAAA;EACA;AAAA,GACC,WAAA,GAAc,SAAA;;;;;;AD1GyD;iBEM1D,MAAA,CAAA,GAAU,SAAA;;;;;;iBCAV,WAAA,CAAA,GAAe,QAAA;;;KCJ1B,eAAA,IACH,MAAA,EACI,eAAA,GACA,MAAA,qBACE,IAAA,EAAM,eAAA,KAAoB,eAAA,GAAkB,MAAA;;;;iBAMpC,eAAA,CAAA,IAAoB,eAAA,EAAiB,eAAA;;;KCVzC,iBAAA;;;;ALF8D;EKOxE,WAAA;AAAA;;;ALSF;;;;;;;;;;;;;;;;;;;;;;;;;iBKqBgB,UAAA,CAAW,OAAA,EAAS,iBAAA;;;;;;ALrCsC;;;;;AAgB1E;;;;;;;;;;;;iBMUgB,cAAA,WAEV,4BAAA,SAEE,MAAA,sCAIF,sBAAA,SAA+B,MAAA,oCAAA,CACnC,KAAA,EAAO,CAAA,GAAI,kBAAA,CAAmB,CAAA;;;;;;ANnC0C;;;;;AAgB1E;;;;;;;;;;;;;iBOWgB,aAAA,WAEV,4BAAA,SAEE,MAAA,sCAIF,sBAAA,SAA+B,MAAA,oCAAA,CACnC,KAAA,EAAO,CAAA,GAAI,iBAAA,CAAkB,CAAA;;;;;;APpC2C;;;;;AAgB1E;;;;;;;;;;;;;;;;iBQcgB,YAAA,WAEV,4BAAA,SAEE,MAAA,sCAIF,sBAAA,SAA+B,MAAA,oCAAA,CACnC,KAAA,EAAO,CAAA,GAAI,gBAAA,CAAiB,CAAA;;;;;;iBClCd,YAAA,CAAA;;;ATL0D;;;AAAA,iBUW1D,UAAA,CAAA;;AVKhB;;;iBUGgB,YAAA,CAAa,GAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import { n as route, r as routeState, t as bindRoute } from "./bindRoute-C7JBYje-.mjs";
|
|
2
|
+
import { n as route, r as routeState, t as bindRoute } from "./bindRoute-CQ2-ruTp.mjs";
|
|
4
3
|
import { createContext, useCallback, useContext, useEffect, useEffectEvent, useId, useMemo, useRef, useState, useSyncExternalStore, useTransition } from "react";
|
|
5
4
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
|
|
7
5
|
//#region src/context/RouterContext.ts
|
|
8
6
|
const RouterContext = createContext(null);
|
|
9
|
-
|
|
10
7
|
//#endregion
|
|
11
8
|
//#region src/context/BlockerContext.ts
|
|
12
9
|
/**
|
|
@@ -29,7 +26,6 @@ function createBlockerRegistry() {
|
|
|
29
26
|
};
|
|
30
27
|
}
|
|
31
28
|
const BlockerContext = createContext(null);
|
|
32
|
-
|
|
33
29
|
//#endregion
|
|
34
30
|
//#region src/types.ts
|
|
35
31
|
/**
|
|
@@ -42,7 +38,6 @@ const BlockerContext = createContext(null);
|
|
|
42
38
|
function internalRoutes(routes) {
|
|
43
39
|
return routes;
|
|
44
40
|
}
|
|
45
|
-
|
|
46
41
|
//#endregion
|
|
47
42
|
//#region src/core/matchRoutes.ts
|
|
48
43
|
const SKIPPED = Symbol("skipped");
|
|
@@ -167,7 +162,6 @@ function matchPath(pattern, pathname, exact) {
|
|
|
167
162
|
consumedPathname
|
|
168
163
|
};
|
|
169
164
|
}
|
|
170
|
-
|
|
171
165
|
//#endregion
|
|
172
166
|
//#region src/bypassInterception.ts
|
|
173
167
|
const bypassInterceptionSymbol = Symbol("bypassInterception");
|
|
@@ -190,10 +184,20 @@ function hardReload() {
|
|
|
190
184
|
function hardNavigate(url) {
|
|
191
185
|
navigation.navigate(url, { info: bypassInterceptionSymbol });
|
|
192
186
|
}
|
|
193
|
-
|
|
194
187
|
//#endregion
|
|
195
188
|
//#region src/core/loaderCache.ts
|
|
196
189
|
/**
|
|
190
|
+
* Wrapper for synchronous errors thrown by loaders.
|
|
191
|
+
* Cached instead of the raw error so the Router's useMemo doesn't throw.
|
|
192
|
+
* RouteRenderer checks for this class and re-throws the original error
|
|
193
|
+
* during rendering, where Error Boundaries can catch it.
|
|
194
|
+
*/
|
|
195
|
+
var LoaderError = class {
|
|
196
|
+
constructor(error) {
|
|
197
|
+
this.error = error;
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
197
201
|
* Cache for loader results.
|
|
198
202
|
* Key format: `${entryId}:${matchIndex}`
|
|
199
203
|
*/
|
|
@@ -205,7 +209,11 @@ const loaderCache = /* @__PURE__ */ new Map();
|
|
|
205
209
|
function getOrCreateLoaderResult(entryId, matchIndex, route, args) {
|
|
206
210
|
if (!route.loader) return;
|
|
207
211
|
const cacheKey = `${entryId}:${matchIndex}`;
|
|
208
|
-
if (!loaderCache.has(cacheKey))
|
|
212
|
+
if (!loaderCache.has(cacheKey)) try {
|
|
213
|
+
loaderCache.set(cacheKey, route.loader(args));
|
|
214
|
+
} catch (error) {
|
|
215
|
+
loaderCache.set(cacheKey, new LoaderError(error));
|
|
216
|
+
}
|
|
209
217
|
return loaderCache.get(cacheKey);
|
|
210
218
|
}
|
|
211
219
|
/**
|
|
@@ -250,7 +258,6 @@ function clearLoaderCacheForEntry(entryId) {
|
|
|
250
258
|
const prefix = `${entryId}:`;
|
|
251
259
|
for (const key of loaderCache.keys()) if (key.startsWith(prefix)) loaderCache.delete(key);
|
|
252
260
|
}
|
|
253
|
-
|
|
254
261
|
//#endregion
|
|
255
262
|
//#region src/core/NavigationAPIAdapter.ts
|
|
256
263
|
/**
|
|
@@ -267,6 +274,7 @@ var NavigationAPIAdapter = class {
|
|
|
267
274
|
#cachedSnapshot = null;
|
|
268
275
|
#cachedEntryId = null;
|
|
269
276
|
#currentNavigationInfo = void 0;
|
|
277
|
+
#reloadCounts = /* @__PURE__ */ new Map();
|
|
270
278
|
getSnapshot() {
|
|
271
279
|
const entry = navigation.currentEntry;
|
|
272
280
|
if (!entry?.url) return null;
|
|
@@ -274,7 +282,9 @@ var NavigationAPIAdapter = class {
|
|
|
274
282
|
this.#cachedEntryId = entry.id;
|
|
275
283
|
this.#cachedSnapshot = {
|
|
276
284
|
url: new URL(entry.url),
|
|
277
|
-
key: entry.id,
|
|
285
|
+
key: this.#effectiveKey(entry.id),
|
|
286
|
+
entryId: entry.id,
|
|
287
|
+
entryKey: entry.key,
|
|
278
288
|
state: entry.getState(),
|
|
279
289
|
info: this.#currentNavigationInfo
|
|
280
290
|
};
|
|
@@ -307,9 +317,19 @@ var NavigationAPIAdapter = class {
|
|
|
307
317
|
entry.addEventListener("dispose", () => {
|
|
308
318
|
clearLoaderCacheForEntry(entryId);
|
|
309
319
|
this.#subscribedEntryIds.delete(entryId);
|
|
320
|
+
this.#reloadCounts.delete(entryId);
|
|
310
321
|
}, { signal });
|
|
311
322
|
}
|
|
312
323
|
}
|
|
324
|
+
/**
|
|
325
|
+
* Compute the effective cache key for a given entry.
|
|
326
|
+
* Includes a reload suffix when the entry has been reloaded,
|
|
327
|
+
* so loaders get a fresh cache key and re-execute.
|
|
328
|
+
*/
|
|
329
|
+
#effectiveKey(entryId) {
|
|
330
|
+
const count = this.#reloadCounts.get(entryId) ?? 0;
|
|
331
|
+
return count > 0 ? `${entryId}:r${count}` : entryId;
|
|
332
|
+
}
|
|
313
333
|
navigate(to, options) {
|
|
314
334
|
navigation.navigate(to, {
|
|
315
335
|
history: options?.replace ? "replace" : "push",
|
|
@@ -371,6 +391,13 @@ var NavigationAPIAdapter = class {
|
|
|
371
391
|
if (event.defaultPrevented) return;
|
|
372
392
|
}
|
|
373
393
|
if (!willIntercept) return;
|
|
394
|
+
if (event.navigationType === "reload") {
|
|
395
|
+
const entryId = navigation.currentEntry.id;
|
|
396
|
+
const oldCount = this.#reloadCounts.get(entryId) ?? 0;
|
|
397
|
+
if (oldCount >= 2) clearLoaderCacheForEntry(`${entryId}:r${oldCount - 1}`);
|
|
398
|
+
this.#reloadCounts.set(entryId, oldCount + 1);
|
|
399
|
+
this.#cachedSnapshot = null;
|
|
400
|
+
}
|
|
374
401
|
if (idleController) {
|
|
375
402
|
idleController.abort();
|
|
376
403
|
idleController = null;
|
|
@@ -378,6 +405,7 @@ var NavigationAPIAdapter = class {
|
|
|
378
405
|
event.intercept({ handler: async () => {
|
|
379
406
|
const currentEntry = navigation.currentEntry;
|
|
380
407
|
if (!currentEntry) throw new Error("Navigation currentEntry is null during navigation interception");
|
|
408
|
+
const effectiveKey = this.#effectiveKey(currentEntry.id);
|
|
381
409
|
let actionResult = void 0;
|
|
382
410
|
if (isFormSubmission) {
|
|
383
411
|
const actionRoute = findActionRoute(matched);
|
|
@@ -391,8 +419,7 @@ var NavigationAPIAdapter = class {
|
|
|
391
419
|
}
|
|
392
420
|
clearLoaderCacheForEntry(currentEntry.id);
|
|
393
421
|
}
|
|
394
|
-
const
|
|
395
|
-
const results = executeLoaders(matched, currentEntry.id, request, event.signal, actionResult);
|
|
422
|
+
const results = executeLoaders(matched, effectiveKey, createLoaderRequest(url), event.signal, actionResult);
|
|
396
423
|
await Promise.all(results.map((r) => r.data));
|
|
397
424
|
} });
|
|
398
425
|
};
|
|
@@ -418,7 +445,6 @@ var NavigationAPIAdapter = class {
|
|
|
418
445
|
function findActionRoute(matched) {
|
|
419
446
|
for (let i = matched.length - 1; i >= 0; i--) if (matched[i].route.action) return matched[i];
|
|
420
447
|
}
|
|
421
|
-
|
|
422
448
|
//#endregion
|
|
423
449
|
//#region src/core/StaticAdapter.ts
|
|
424
450
|
/**
|
|
@@ -434,6 +460,8 @@ var StaticAdapter = class {
|
|
|
434
460
|
if (!this.#cachedSnapshot) this.#cachedSnapshot = {
|
|
435
461
|
url: new URL(window.location.href),
|
|
436
462
|
key: "__static__",
|
|
463
|
+
entryId: null,
|
|
464
|
+
entryKey: null,
|
|
437
465
|
state: void 0,
|
|
438
466
|
info: void 0
|
|
439
467
|
};
|
|
@@ -455,7 +483,6 @@ var StaticAdapter = class {
|
|
|
455
483
|
}
|
|
456
484
|
updateCurrentEntryState(_state) {}
|
|
457
485
|
};
|
|
458
|
-
|
|
459
486
|
//#endregion
|
|
460
487
|
//#region src/core/NullAdapter.ts
|
|
461
488
|
/**
|
|
@@ -483,7 +510,6 @@ var NullAdapter = class {
|
|
|
483
510
|
}
|
|
484
511
|
updateCurrentEntryState(_state) {}
|
|
485
512
|
};
|
|
486
|
-
|
|
487
513
|
//#endregion
|
|
488
514
|
//#region src/core/createAdapter.ts
|
|
489
515
|
/**
|
|
@@ -504,7 +530,6 @@ function createAdapter(fallback) {
|
|
|
504
530
|
if (fallback === "static") return new StaticAdapter();
|
|
505
531
|
return new NullAdapter();
|
|
506
532
|
}
|
|
507
|
-
|
|
508
533
|
//#endregion
|
|
509
534
|
//#region src/Router/ServerLocationSnapshot.ts
|
|
510
535
|
/**
|
|
@@ -520,7 +545,6 @@ function isServerSnapshot(value) {
|
|
|
520
545
|
return value instanceof ServerLocationSnapshot;
|
|
521
546
|
}
|
|
522
547
|
const noopSubscribe = () => () => {};
|
|
523
|
-
|
|
524
548
|
//#endregion
|
|
525
549
|
//#region src/context/RouteContext.ts
|
|
526
550
|
const RouteContext = createContext(null);
|
|
@@ -536,7 +560,6 @@ function findRouteContextById(context, id) {
|
|
|
536
560
|
}
|
|
537
561
|
return null;
|
|
538
562
|
}
|
|
539
|
-
|
|
540
563
|
//#endregion
|
|
541
564
|
//#region src/Router/useRouteStateCallbacks.ts
|
|
542
565
|
function useRouteStateCallbacks(index, internalState, url, navigateAsync, updateCurrentEntryState) {
|
|
@@ -598,7 +621,6 @@ function useRouteStateCallbacks(index, internalState, url, navigateAsync, update
|
|
|
598
621
|
resetStateSync
|
|
599
622
|
};
|
|
600
623
|
}
|
|
601
|
-
|
|
602
624
|
//#endregion
|
|
603
625
|
//#region src/Router/RouteRenderer.tsx
|
|
604
626
|
/**
|
|
@@ -650,6 +672,7 @@ function RouteRenderer({ matchedRoutes, index }) {
|
|
|
650
672
|
resetStateSync
|
|
651
673
|
};
|
|
652
674
|
const info = locationInfo;
|
|
675
|
+
if (data instanceof LoaderError) throw data.error;
|
|
653
676
|
if (route.loader) return /* @__PURE__ */ jsx(Component, {
|
|
654
677
|
data,
|
|
655
678
|
params,
|
|
@@ -669,7 +692,6 @@ function RouteRenderer({ matchedRoutes, index }) {
|
|
|
669
692
|
children: renderComponent()
|
|
670
693
|
});
|
|
671
694
|
}
|
|
672
|
-
|
|
673
695
|
//#endregion
|
|
674
696
|
//#region src/Router/index.tsx
|
|
675
697
|
function Router({ routes: inputRoutes, onNavigate, fallback = "none", ssr }) {
|
|
@@ -749,10 +771,14 @@ function Router({ routes: inputRoutes, onNavigate, fallback = "none", ssr }) {
|
|
|
749
771
|
]);
|
|
750
772
|
const locationState = locationEntry?.state;
|
|
751
773
|
const locationInfo = locationEntry?.info;
|
|
774
|
+
const entryId = locationEntry?.entryId ?? (isServerSnapshot(locationEntryInternal) ? locationEntryInternal.actualLocationEntry?.entryId : null) ?? null;
|
|
775
|
+
const entryKey = locationEntry?.entryKey ?? (isServerSnapshot(locationEntryInternal) ? locationEntryInternal.actualLocationEntry?.entryKey : null) ?? null;
|
|
752
776
|
const routerContextValue = useMemo(() => ({
|
|
753
777
|
locationState,
|
|
754
778
|
locationInfo,
|
|
755
779
|
url: urlObject,
|
|
780
|
+
entryId,
|
|
781
|
+
entryKey,
|
|
756
782
|
isPending,
|
|
757
783
|
navigateAsync,
|
|
758
784
|
updateCurrentEntryState
|
|
@@ -760,6 +786,8 @@ function Router({ routes: inputRoutes, onNavigate, fallback = "none", ssr }) {
|
|
|
760
786
|
locationState,
|
|
761
787
|
locationInfo,
|
|
762
788
|
urlObject,
|
|
789
|
+
entryId,
|
|
790
|
+
entryKey,
|
|
763
791
|
isPending,
|
|
764
792
|
navigateAsync,
|
|
765
793
|
updateCurrentEntryState
|
|
@@ -782,7 +810,6 @@ function Router({ routes: inputRoutes, onNavigate, fallback = "none", ssr }) {
|
|
|
782
810
|
blockerRegistry
|
|
783
811
|
]);
|
|
784
812
|
}
|
|
785
|
-
|
|
786
813
|
//#endregion
|
|
787
814
|
//#region src/Outlet.tsx
|
|
788
815
|
/**
|
|
@@ -794,7 +821,6 @@ function Outlet() {
|
|
|
794
821
|
if (!routeContext) return null;
|
|
795
822
|
return routeContext.outlet;
|
|
796
823
|
}
|
|
797
|
-
|
|
798
824
|
//#endregion
|
|
799
825
|
//#region src/hooks/useLocation.ts
|
|
800
826
|
/**
|
|
@@ -803,17 +829,22 @@ function Outlet() {
|
|
|
803
829
|
function useLocation() {
|
|
804
830
|
const context = useContext(RouterContext);
|
|
805
831
|
if (!context) throw new Error("useLocation must be used within a Router");
|
|
806
|
-
const { url } = context;
|
|
832
|
+
const { url, entryId, entryKey } = context;
|
|
807
833
|
if (url === null) throw new Error("useLocation: URL is not available during SSR.");
|
|
808
834
|
return useMemo(() => {
|
|
809
835
|
return {
|
|
810
836
|
pathname: url.pathname,
|
|
811
837
|
search: url.search,
|
|
812
|
-
hash: url.hash
|
|
838
|
+
hash: url.hash,
|
|
839
|
+
entryId,
|
|
840
|
+
entryKey
|
|
813
841
|
};
|
|
814
|
-
}, [
|
|
842
|
+
}, [
|
|
843
|
+
url,
|
|
844
|
+
entryId,
|
|
845
|
+
entryKey
|
|
846
|
+
]);
|
|
815
847
|
}
|
|
816
|
-
|
|
817
848
|
//#endregion
|
|
818
849
|
//#region src/hooks/useSearchParams.ts
|
|
819
850
|
/**
|
|
@@ -837,7 +868,6 @@ function useSearchParams() {
|
|
|
837
868
|
navigateAsync(url.pathname + url.search + url.hash, { replace: true });
|
|
838
869
|
}, [currentUrl, navigateAsync])];
|
|
839
870
|
}
|
|
840
|
-
|
|
841
871
|
//#endregion
|
|
842
872
|
//#region src/hooks/useBlocker.ts
|
|
843
873
|
/**
|
|
@@ -881,7 +911,6 @@ function useBlocker(options) {
|
|
|
881
911
|
registry
|
|
882
912
|
]);
|
|
883
913
|
}
|
|
884
|
-
|
|
885
914
|
//#endregion
|
|
886
915
|
//#region src/hooks/useRouteContext.ts
|
|
887
916
|
/**
|
|
@@ -903,7 +932,6 @@ function useRouteContext(hookName, routeId) {
|
|
|
903
932
|
if (!matchedContext) throw new Error(`${hookName}: Route ID "${routeId}" not found in current route hierarchy. Current route is "${context.id ?? "(no id)"}"`);
|
|
904
933
|
return matchedContext;
|
|
905
934
|
}
|
|
906
|
-
|
|
907
935
|
//#endregion
|
|
908
936
|
//#region src/hooks/useRouteParams.ts
|
|
909
937
|
/**
|
|
@@ -930,7 +958,6 @@ function useRouteParams(route) {
|
|
|
930
958
|
const routeId = route.id;
|
|
931
959
|
return useRouteContext("useRouteParams", routeId).params;
|
|
932
960
|
}
|
|
933
|
-
|
|
934
961
|
//#endregion
|
|
935
962
|
//#region src/hooks/useRouteState.ts
|
|
936
963
|
/**
|
|
@@ -958,7 +985,6 @@ function useRouteState(route) {
|
|
|
958
985
|
const routeId = route.id;
|
|
959
986
|
return useRouteContext("useRouteState", routeId).state;
|
|
960
987
|
}
|
|
961
|
-
|
|
962
988
|
//#endregion
|
|
963
989
|
//#region src/hooks/useRouteData.ts
|
|
964
990
|
/**
|
|
@@ -989,7 +1015,6 @@ function useRouteData(route) {
|
|
|
989
1015
|
const routeId = route.id;
|
|
990
1016
|
return useRouteContext("useRouteData", routeId).data;
|
|
991
1017
|
}
|
|
992
|
-
|
|
993
1018
|
//#endregion
|
|
994
1019
|
//#region src/hooks/useIsPending.ts
|
|
995
1020
|
/**
|
|
@@ -1000,7 +1025,7 @@ function useIsPending() {
|
|
|
1000
1025
|
if (!context) throw new Error("useIsPending must be used within a Router");
|
|
1001
1026
|
return context.isPending;
|
|
1002
1027
|
}
|
|
1003
|
-
|
|
1004
1028
|
//#endregion
|
|
1005
1029
|
export { Outlet, Router, bindRoute, hardNavigate, hardReload, route, routeState, useBlocker, useIsPending, useLocation, useRouteData, useRouteParams, useRouteState, useSearchParams };
|
|
1030
|
+
|
|
1006
1031
|
//# sourceMappingURL=index.mjs.map
|