@tanstack/react-router 1.0.8 → 1.0.9
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/build/cjs/RouterProvider.js.map +1 -1
- package/build/cjs/link.js.map +1 -1
- package/build/cjs/useNavigate.js.map +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +351 -351
- package/build/types/RouterProvider.d.ts +1 -1
- package/build/types/link.d.ts +10 -10
- package/build/types/useNavigate.d.ts +5 -5
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/RouterProvider.tsx +2 -2
- package/src/link.tsx +15 -15
- package/src/useNavigate.tsx +10 -10
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-router",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.9",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://tanstack.com/router",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@tanstack/store": "^0.1.3",
|
|
45
45
|
"tiny-invariant": "^1.3.1",
|
|
46
46
|
"tiny-warning": "^1.0.3",
|
|
47
|
-
"@tanstack/history": "1.0.
|
|
47
|
+
"@tanstack/history": "1.0.9"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "rollup --config rollup.config.js"
|
package/src/RouterProvider.tsx
CHANGED
|
@@ -41,9 +41,9 @@ export interface MatchLocation {
|
|
|
41
41
|
|
|
42
42
|
export type NavigateFn<TRouteTree extends AnyRoute> = <
|
|
43
43
|
TFrom extends RoutePaths<TRouteTree> | string = string,
|
|
44
|
-
TTo extends string
|
|
44
|
+
TTo extends string = '',
|
|
45
45
|
TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,
|
|
46
|
-
TMaskTo extends string
|
|
46
|
+
TMaskTo extends string = '',
|
|
47
47
|
>(
|
|
48
48
|
opts: NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,
|
|
49
49
|
) => Promise<void>
|
package/src/link.tsx
CHANGED
|
@@ -118,9 +118,9 @@ export type RelativeToPathAutoComplete<
|
|
|
118
118
|
export type NavigateOptions<
|
|
119
119
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
120
120
|
TFrom extends RoutePaths<TRouteTree> | string = string,
|
|
121
|
-
TTo extends string
|
|
121
|
+
TTo extends string = '',
|
|
122
122
|
TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,
|
|
123
|
-
TMaskTo extends string
|
|
123
|
+
TMaskTo extends string = '',
|
|
124
124
|
> = ToOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & {
|
|
125
125
|
// `replace` is a boolean that determines whether the navigation should replace the current history entry or push a new one.
|
|
126
126
|
replace?: boolean
|
|
@@ -132,9 +132,9 @@ export type NavigateOptions<
|
|
|
132
132
|
export type ToOptions<
|
|
133
133
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
134
134
|
TFrom extends RoutePaths<TRouteTree> | string = string,
|
|
135
|
-
TTo extends string
|
|
135
|
+
TTo extends string = '',
|
|
136
136
|
TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,
|
|
137
|
-
TMaskTo extends string
|
|
137
|
+
TMaskTo extends string = '',
|
|
138
138
|
> = ToSubOptions<TRouteTree, TFrom, TTo> & {
|
|
139
139
|
mask?: ToMaskOptions<TRouteTree, TMaskFrom, TMaskTo>
|
|
140
140
|
}
|
|
@@ -142,7 +142,7 @@ export type ToOptions<
|
|
|
142
142
|
export type ToMaskOptions<
|
|
143
143
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
144
144
|
TMaskFrom extends RoutePaths<TRouteTree> | string = string,
|
|
145
|
-
TMaskTo extends string
|
|
145
|
+
TMaskTo extends string = '',
|
|
146
146
|
> = ToSubOptions<TRouteTree, TMaskFrom, TMaskTo> & {
|
|
147
147
|
unmaskOnReload?: boolean
|
|
148
148
|
}
|
|
@@ -150,7 +150,7 @@ export type ToMaskOptions<
|
|
|
150
150
|
export type ToSubOptions<
|
|
151
151
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
152
152
|
TFrom extends RoutePaths<TRouteTree> | string = string,
|
|
153
|
-
TTo extends string
|
|
153
|
+
TTo extends string = '',
|
|
154
154
|
TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>,
|
|
155
155
|
> = {
|
|
156
156
|
to?: ToPathOption<TRouteTree, TFrom, TTo>
|
|
@@ -174,7 +174,7 @@ export type ParamOptions<
|
|
|
174
174
|
TResolved,
|
|
175
175
|
TParamVariant extends 'allParams' | 'fullSearchSchema',
|
|
176
176
|
TFromParams = Expand<RouteByPath<TRouteTree, TFrom>['types'][TParamVariant]>,
|
|
177
|
-
TToParams = TTo extends
|
|
177
|
+
TToParams = TTo extends ''
|
|
178
178
|
? TFromParams
|
|
179
179
|
: never extends TResolved
|
|
180
180
|
? Expand<RouteByPath<TRouteTree, TTo>['types'][TParamVariant]>
|
|
@@ -212,7 +212,7 @@ export type PathParamOptions<
|
|
|
212
212
|
export type ToPathOption<
|
|
213
213
|
TRouteTree extends AnyRoute = AnyRoute,
|
|
214
214
|
TFrom extends RoutePaths<TRouteTree> | string = string,
|
|
215
|
-
TTo extends string
|
|
215
|
+
TTo extends string = '',
|
|
216
216
|
> =
|
|
217
217
|
| TTo
|
|
218
218
|
| RelativeToPathAutoComplete<
|
|
@@ -224,7 +224,7 @@ export type ToPathOption<
|
|
|
224
224
|
export type ToIdOption<
|
|
225
225
|
TRouteTree extends AnyRoute = AnyRoute,
|
|
226
226
|
TFrom extends RoutePaths<TRouteTree> | undefined = undefined,
|
|
227
|
-
TTo extends string
|
|
227
|
+
TTo extends string = '',
|
|
228
228
|
> =
|
|
229
229
|
| TTo
|
|
230
230
|
| RelativeToPathAutoComplete<
|
|
@@ -242,9 +242,9 @@ export interface ActiveOptions {
|
|
|
242
242
|
export type LinkOptions<
|
|
243
243
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
244
244
|
TFrom extends RoutePaths<TRouteTree> | string = string,
|
|
245
|
-
TTo extends string
|
|
245
|
+
TTo extends string = '',
|
|
246
246
|
TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,
|
|
247
|
-
TMaskTo extends string
|
|
247
|
+
TMaskTo extends string = '',
|
|
248
248
|
> = NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & {
|
|
249
249
|
// The standard anchor tag target attribute
|
|
250
250
|
target?: HTMLAnchorElement['target']
|
|
@@ -334,9 +334,9 @@ const preloadWarning = 'Error preloading route! ☝️'
|
|
|
334
334
|
export function useLinkProps<
|
|
335
335
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
336
336
|
TFrom extends RoutePaths<TRouteTree> | string = string,
|
|
337
|
-
TTo extends string
|
|
337
|
+
TTo extends string = '',
|
|
338
338
|
TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,
|
|
339
|
-
TMaskTo extends string
|
|
339
|
+
TMaskTo extends string = '',
|
|
340
340
|
>(
|
|
341
341
|
options: UseLinkPropsOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,
|
|
342
342
|
): React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
@@ -553,9 +553,9 @@ export interface LinkComponent<TProps extends Record<string, any> = {}> {
|
|
|
553
553
|
<
|
|
554
554
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
555
555
|
TFrom extends RoutePaths<TRouteTree> | string = string,
|
|
556
|
-
TTo extends string
|
|
556
|
+
TTo extends string = '',
|
|
557
557
|
TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,
|
|
558
|
-
TMaskTo extends string
|
|
558
|
+
TMaskTo extends string = '',
|
|
559
559
|
>(
|
|
560
560
|
props: LinkProps<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &
|
|
561
561
|
TProps &
|
package/src/useNavigate.tsx
CHANGED
|
@@ -20,9 +20,9 @@ export function useNavigate<
|
|
|
20
20
|
return React.useCallback(
|
|
21
21
|
<
|
|
22
22
|
TFrom extends RoutePaths<TRouteTree> | string = TDefaultFrom,
|
|
23
|
-
TTo extends string
|
|
23
|
+
TTo extends string = '',
|
|
24
24
|
TMaskFrom extends RoutePaths<TRouteTree>| string = TFrom,
|
|
25
|
-
TMaskTo extends string
|
|
25
|
+
TMaskTo extends string = '',
|
|
26
26
|
>({
|
|
27
27
|
from,
|
|
28
28
|
...rest
|
|
@@ -54,9 +54,9 @@ export function useNavigate<
|
|
|
54
54
|
export function Navigate<
|
|
55
55
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
56
56
|
TFrom extends RoutePaths<TRouteTree> | string = string,
|
|
57
|
-
TTo extends string
|
|
57
|
+
TTo extends string = '',
|
|
58
58
|
TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,
|
|
59
|
-
TMaskTo extends string
|
|
59
|
+
TMaskTo extends string = '',
|
|
60
60
|
>(props: NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>): null {
|
|
61
61
|
const { navigate } = useRouter()
|
|
62
62
|
const match = useMatch({ strict: false })
|
|
@@ -74,18 +74,18 @@ export function Navigate<
|
|
|
74
74
|
export type UseLinkPropsOptions<
|
|
75
75
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
76
76
|
TFrom extends RoutePaths<TRouteTree> | string = string,
|
|
77
|
-
TTo extends string
|
|
77
|
+
TTo extends string = '',
|
|
78
78
|
TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,
|
|
79
|
-
TMaskTo extends string
|
|
79
|
+
TMaskTo extends string = '',
|
|
80
80
|
> = ActiveLinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &
|
|
81
81
|
React.AnchorHTMLAttributes<HTMLAnchorElement>
|
|
82
82
|
|
|
83
83
|
export type LinkProps<
|
|
84
84
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
85
85
|
TFrom extends RoutePaths<TRouteTree> | string = string,
|
|
86
|
-
TTo extends string
|
|
86
|
+
TTo extends string = '',
|
|
87
87
|
TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,
|
|
88
|
-
TMaskTo extends string
|
|
88
|
+
TMaskTo extends string = '',
|
|
89
89
|
> = ActiveLinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> &
|
|
90
90
|
Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {
|
|
91
91
|
// If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns
|
|
@@ -97,9 +97,9 @@ export type LinkProps<
|
|
|
97
97
|
export type ActiveLinkOptions<
|
|
98
98
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
99
99
|
TFrom extends RoutePaths<TRouteTree> | string = string,
|
|
100
|
-
TTo extends string
|
|
100
|
+
TTo extends string = '',
|
|
101
101
|
TMaskFrom extends RoutePaths<TRouteTree> | string = TFrom,
|
|
102
|
-
TMaskTo extends string
|
|
102
|
+
TMaskTo extends string = '',
|
|
103
103
|
> = LinkOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo> & {
|
|
104
104
|
// A function that returns additional props for the `active` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)
|
|
105
105
|
activeProps?:
|