@tanstack/react-router 1.84.4 → 1.85.2
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/cjs/RouterProvider.cjs.map +1 -1
- package/dist/cjs/RouterProvider.d.cts +3 -3
- package/dist/cjs/router.cjs +3 -1
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +13 -13
- package/dist/cjs/routerContext.d.cts +1 -1
- package/dist/esm/RouterProvider.d.ts +3 -3
- package/dist/esm/RouterProvider.js.map +1 -1
- package/dist/esm/router.d.ts +13 -13
- package/dist/esm/router.js +3 -1
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/routerContext.d.ts +1 -1
- package/package.json +3 -3
- package/src/RouterProvider.tsx +4 -1
- package/src/router.ts +20 -6
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Router } from './router.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
export declare function getRouterContext(): React.Context<Router<any, any, any, Record<string, any>, Record<string, any>>>;
|
|
3
|
+
export declare function getRouterContext(): React.Context<Router<any, any, any, import('@tanstack/history').RouterHistory, Record<string, any>, Record<string, any>>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-router",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.85.2",
|
|
4
4
|
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@testing-library/jest-dom": "^6.6.3",
|
|
60
60
|
"@testing-library/react": "^16.0.1",
|
|
61
61
|
"@types/jsesc": "^3.0.3",
|
|
62
|
-
"@vitejs/plugin-react": "^4.3.
|
|
62
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
63
63
|
"combinate": "^1.1.11",
|
|
64
64
|
"react": "^18.2.0",
|
|
65
65
|
"react-dom": "^18.2.0",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"react": ">=18",
|
|
70
70
|
"react-dom": ">=18",
|
|
71
|
-
"@tanstack/router-generator": "1.
|
|
71
|
+
"@tanstack/router-generator": "1.85.2"
|
|
72
72
|
},
|
|
73
73
|
"peerDependenciesMeta": {
|
|
74
74
|
"@tanstack/router-generator": {
|
package/src/RouterProvider.tsx
CHANGED
|
@@ -107,6 +107,7 @@ export type RouterProps<
|
|
|
107
107
|
TRouter['routeTree'],
|
|
108
108
|
NonNullable<TRouter['options']['trailingSlash']>,
|
|
109
109
|
NonNullable<TRouter['options']['defaultStructuralSharing']>,
|
|
110
|
+
TRouter['history'],
|
|
110
111
|
TDehydrated
|
|
111
112
|
>,
|
|
112
113
|
'context'
|
|
@@ -114,13 +115,15 @@ export type RouterProps<
|
|
|
114
115
|
router: Router<
|
|
115
116
|
TRouter['routeTree'],
|
|
116
117
|
NonNullable<TRouter['options']['trailingSlash']>,
|
|
117
|
-
NonNullable<TRouter['options']['defaultStructuralSharing']
|
|
118
|
+
NonNullable<TRouter['options']['defaultStructuralSharing']>,
|
|
119
|
+
TRouter['history']
|
|
118
120
|
>
|
|
119
121
|
context?: Partial<
|
|
120
122
|
RouterOptions<
|
|
121
123
|
TRouter['routeTree'],
|
|
122
124
|
NonNullable<TRouter['options']['trailingSlash']>,
|
|
123
125
|
NonNullable<TRouter['options']['defaultStructuralSharing']>,
|
|
126
|
+
TRouter['history'],
|
|
124
127
|
TDehydrated
|
|
125
128
|
>['context']
|
|
126
129
|
>
|
package/src/router.ts
CHANGED
|
@@ -110,12 +110,13 @@ export interface Register {
|
|
|
110
110
|
// router: Router
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
export type AnyRouter = Router<any, any, any, any, any>
|
|
113
|
+
export type AnyRouter = Router<any, any, any, any, any, any>
|
|
114
114
|
|
|
115
115
|
export type AnyRouterWithContext<TContext> = Router<
|
|
116
116
|
AnyRouteWithContext<TContext>,
|
|
117
117
|
any,
|
|
118
118
|
any,
|
|
119
|
+
any,
|
|
119
120
|
any
|
|
120
121
|
>
|
|
121
122
|
|
|
@@ -173,6 +174,7 @@ export interface RouterOptions<
|
|
|
173
174
|
TRouteTree extends AnyRoute,
|
|
174
175
|
TTrailingSlashOption extends TrailingSlashOption,
|
|
175
176
|
TDefaultStructuralSharingOption extends boolean = false,
|
|
177
|
+
TRouterHistory extends RouterHistory = RouterHistory,
|
|
176
178
|
TDehydrated extends Record<string, any> = Record<string, any>,
|
|
177
179
|
TSerializedError extends Record<string, any> = Record<string, any>,
|
|
178
180
|
> {
|
|
@@ -184,7 +186,7 @@ export interface RouterOptions<
|
|
|
184
186
|
* @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#history-property)
|
|
185
187
|
* @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/history-types)
|
|
186
188
|
*/
|
|
187
|
-
history?:
|
|
189
|
+
history?: TRouterHistory
|
|
188
190
|
/**
|
|
189
191
|
* A function that will be used to stringify search params when generating links.
|
|
190
192
|
*
|
|
@@ -552,6 +554,7 @@ export type RouterConstructorOptions<
|
|
|
552
554
|
TRouteTree extends AnyRoute,
|
|
553
555
|
TTrailingSlashOption extends TrailingSlashOption,
|
|
554
556
|
TDefaultStructuralSharingOption extends boolean,
|
|
557
|
+
TRouterHistory extends RouterHistory,
|
|
555
558
|
TDehydrated extends Record<string, any>,
|
|
556
559
|
TSerializedError extends Record<string, any>,
|
|
557
560
|
> = Omit<
|
|
@@ -559,6 +562,7 @@ export type RouterConstructorOptions<
|
|
|
559
562
|
TRouteTree,
|
|
560
563
|
TTrailingSlashOption,
|
|
561
564
|
TDefaultStructuralSharingOption,
|
|
565
|
+
TRouterHistory,
|
|
562
566
|
TDehydrated,
|
|
563
567
|
TSerializedError
|
|
564
568
|
>,
|
|
@@ -657,6 +661,7 @@ export function createRouter<
|
|
|
657
661
|
TRouteTree extends AnyRoute,
|
|
658
662
|
TTrailingSlashOption extends TrailingSlashOption,
|
|
659
663
|
TDefaultStructuralSharingOption extends boolean,
|
|
664
|
+
TRouterHistory extends RouterHistory = RouterHistory,
|
|
660
665
|
TDehydrated extends Record<string, any> = Record<string, any>,
|
|
661
666
|
TSerializedError extends Record<string, any> = Record<string, any>,
|
|
662
667
|
>(
|
|
@@ -666,6 +671,7 @@ export function createRouter<
|
|
|
666
671
|
TRouteTree,
|
|
667
672
|
TTrailingSlashOption,
|
|
668
673
|
TDefaultStructuralSharingOption,
|
|
674
|
+
TRouterHistory,
|
|
669
675
|
TDehydrated,
|
|
670
676
|
TSerializedError
|
|
671
677
|
>,
|
|
@@ -674,6 +680,7 @@ export function createRouter<
|
|
|
674
680
|
TRouteTree,
|
|
675
681
|
TTrailingSlashOption,
|
|
676
682
|
TDefaultStructuralSharingOption,
|
|
683
|
+
TRouterHistory,
|
|
677
684
|
TDehydrated,
|
|
678
685
|
TSerializedError
|
|
679
686
|
>(options)
|
|
@@ -690,6 +697,7 @@ export class Router<
|
|
|
690
697
|
in out TRouteTree extends AnyRoute,
|
|
691
698
|
in out TTrailingSlashOption extends TrailingSlashOption,
|
|
692
699
|
in out TDefaultStructuralSharingOption extends boolean,
|
|
700
|
+
in out TRouterHistory extends RouterHistory = RouterHistory,
|
|
693
701
|
in out TDehydrated extends Record<string, any> = Record<string, any>,
|
|
694
702
|
in out TSerializedError extends Record<string, any> = Record<string, any>,
|
|
695
703
|
> {
|
|
@@ -729,6 +737,7 @@ export class Router<
|
|
|
729
737
|
TRouteTree,
|
|
730
738
|
TTrailingSlashOption,
|
|
731
739
|
TDefaultStructuralSharingOption,
|
|
740
|
+
TRouterHistory,
|
|
732
741
|
TDehydrated,
|
|
733
742
|
TSerializedError
|
|
734
743
|
>,
|
|
@@ -738,7 +747,7 @@ export class Router<
|
|
|
738
747
|
},
|
|
739
748
|
'stringifySearch' | 'parseSearch' | 'context'
|
|
740
749
|
>
|
|
741
|
-
history!:
|
|
750
|
+
history!: TRouterHistory
|
|
742
751
|
latestLocation!: ParsedLocation<FullSearchSchema<TRouteTree>>
|
|
743
752
|
basepath!: string
|
|
744
753
|
routeTree!: TRouteTree
|
|
@@ -756,6 +765,7 @@ export class Router<
|
|
|
756
765
|
TRouteTree,
|
|
757
766
|
TTrailingSlashOption,
|
|
758
767
|
TDefaultStructuralSharingOption,
|
|
768
|
+
TRouterHistory,
|
|
759
769
|
TDehydrated,
|
|
760
770
|
TSerializedError
|
|
761
771
|
>,
|
|
@@ -788,6 +798,7 @@ export class Router<
|
|
|
788
798
|
TRouteTree,
|
|
789
799
|
TTrailingSlashOption,
|
|
790
800
|
TDefaultStructuralSharingOption,
|
|
801
|
+
TRouterHistory,
|
|
791
802
|
TDehydrated,
|
|
792
803
|
TSerializedError
|
|
793
804
|
>,
|
|
@@ -837,11 +848,11 @@ export class Router<
|
|
|
837
848
|
) {
|
|
838
849
|
this.history =
|
|
839
850
|
this.options.history ??
|
|
840
|
-
(this.isServer
|
|
851
|
+
((this.isServer
|
|
841
852
|
? createMemoryHistory({
|
|
842
853
|
initialEntries: [this.basepath || '/'],
|
|
843
854
|
})
|
|
844
|
-
: createBrowserHistory())
|
|
855
|
+
: createBrowserHistory()) as TRouterHistory)
|
|
845
856
|
this.latestLocation = this.parseLocation()
|
|
846
857
|
}
|
|
847
858
|
|
|
@@ -867,7 +878,8 @@ export class Router<
|
|
|
867
878
|
if (
|
|
868
879
|
typeof window !== 'undefined' &&
|
|
869
880
|
'CSS' in window &&
|
|
870
|
-
|
|
881
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
882
|
+
typeof window.CSS?.supports === 'function'
|
|
871
883
|
) {
|
|
872
884
|
this.isViewTransitionTypesSupported = window.CSS.supports(
|
|
873
885
|
'selector(:active-view-transition-type(a)',
|
|
@@ -2772,6 +2784,7 @@ export class Router<
|
|
|
2772
2784
|
TRouteTree,
|
|
2773
2785
|
TTrailingSlashOption,
|
|
2774
2786
|
TDefaultStructuralSharingOption,
|
|
2787
|
+
TRouterHistory,
|
|
2775
2788
|
TDehydrated,
|
|
2776
2789
|
TSerializedError
|
|
2777
2790
|
>,
|
|
@@ -2852,6 +2865,7 @@ export class Router<
|
|
|
2852
2865
|
TRouteTree,
|
|
2853
2866
|
TTrailingSlashOption,
|
|
2854
2867
|
TDefaultStructuralSharingOption,
|
|
2868
|
+
TRouterHistory,
|
|
2855
2869
|
TDehydrated,
|
|
2856
2870
|
TSerializedError
|
|
2857
2871
|
>,
|