@tanstack/react-router 0.0.1-beta.193 → 0.0.1-beta.194
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/react.js +1 -13
- package/build/cjs/react.js.map +1 -1
- package/build/esm/index.js +1 -13
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +98 -98
- package/build/types/react.d.ts +8 -10
- package/build/umd/index.development.js +2 -14
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/react.tsx +13 -27
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-router",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "0.0.1-beta.
|
|
4
|
+
"version": "0.0.1-beta.194",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://tanstack.com/router",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"tiny-warning": "^1.0.3",
|
|
45
45
|
"@tanstack/react-store": "^0.0.1",
|
|
46
46
|
"@gisatcz/cross-package-react-context": "^0.2.0",
|
|
47
|
-
"@tanstack/router-core": "0.0.1-beta.
|
|
47
|
+
"@tanstack/router-core": "0.0.1-beta.194"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "rollup --config rollup.config.js"
|
package/src/react.tsx
CHANGED
|
@@ -39,6 +39,8 @@ import {
|
|
|
39
39
|
AnyPathParams,
|
|
40
40
|
Expand,
|
|
41
41
|
ResolveAllParams,
|
|
42
|
+
DeepMergeAll,
|
|
43
|
+
IsAny,
|
|
42
44
|
} from '@tanstack/router-core'
|
|
43
45
|
|
|
44
46
|
declare module '@tanstack/router-core' {
|
|
@@ -124,12 +126,15 @@ declare module '@tanstack/router-core' {
|
|
|
124
126
|
TParentRoute,
|
|
125
127
|
TParams
|
|
126
128
|
>,
|
|
127
|
-
TParentContext extends RouteConstraints['TParentContext'] = TParentRoute['types']['routeContext'],
|
|
128
|
-
TAllParentContext extends RouteConstraints['TAllParentContext'] = TParentRoute['types']['context'],
|
|
129
129
|
TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext,
|
|
130
|
-
TAllContext extends RouteConstraints['TAllContext'] =
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
TAllContext extends RouteConstraints['TAllContext'] = Expand<
|
|
131
|
+
DeepMergeAll<
|
|
132
|
+
[
|
|
133
|
+
IsAny<TParentRoute['types']['context'], {}>,
|
|
134
|
+
TLoaderContext,
|
|
135
|
+
TRouteContext,
|
|
136
|
+
]
|
|
137
|
+
>
|
|
133
138
|
>,
|
|
134
139
|
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
135
140
|
TChildren extends RouteConstraints['TChildren'] = unknown,
|
|
@@ -141,12 +146,9 @@ declare module '@tanstack/router-core' {
|
|
|
141
146
|
useLoader: <TSelected = TLoader>(opts?: {
|
|
142
147
|
select?: (search: TLoader) => TSelected
|
|
143
148
|
}) => UseLoaderResult<TSelected>
|
|
144
|
-
|
|
149
|
+
useRouteContext: <TSelected = TAllContext>(opts?: {
|
|
145
150
|
select?: (search: TAllContext) => TSelected
|
|
146
151
|
}) => TSelected
|
|
147
|
-
useRouteContext: <TSelected = TRouteContext>(opts?: {
|
|
148
|
-
select?: (search: TRouteContext) => TSelected
|
|
149
|
-
}) => TSelected
|
|
150
152
|
useSearch: <TSelected = TFullSearchSchema>(opts?: {
|
|
151
153
|
select?: (search: TFullSearchSchema) => TSelected
|
|
152
154
|
}) => TSelected
|
|
@@ -208,12 +210,9 @@ export type RouteProps<
|
|
|
208
210
|
useMatch: <TSelected = TAllContext>(opts?: {
|
|
209
211
|
select?: (search: TAllContext) => TSelected
|
|
210
212
|
}) => TSelected
|
|
211
|
-
|
|
213
|
+
useRouteContext: <TSelected = TAllContext>(opts?: {
|
|
212
214
|
select?: (search: TAllContext) => TSelected
|
|
213
215
|
}) => TSelected
|
|
214
|
-
useRouteContext: <TSelected = TRouteContext>(opts?: {
|
|
215
|
-
select?: (search: TRouteContext) => TSelected
|
|
216
|
-
}) => TSelected
|
|
217
216
|
useSearch: <TSelected = TFullSearchSchema>(opts?: {
|
|
218
217
|
select?: (search: TFullSearchSchema) => TSelected
|
|
219
218
|
}) => TSelected
|
|
@@ -265,19 +264,11 @@ Route.__onInit = (route) => {
|
|
|
265
264
|
useLoader: (opts = {}) => {
|
|
266
265
|
return useLoader({ ...opts, from: route.id }) as any
|
|
267
266
|
},
|
|
268
|
-
useContext: (opts: any = {}) => {
|
|
269
|
-
return useMatch({
|
|
270
|
-
...opts,
|
|
271
|
-
from: route.id,
|
|
272
|
-
select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),
|
|
273
|
-
} as any)
|
|
274
|
-
},
|
|
275
267
|
useRouteContext: (opts: any = {}) => {
|
|
276
268
|
return useMatch({
|
|
277
269
|
...opts,
|
|
278
270
|
from: route.id,
|
|
279
|
-
select: (d: any) =>
|
|
280
|
-
opts?.select ? opts.select(d.routeContext) : d.routeContext,
|
|
271
|
+
select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),
|
|
281
272
|
} as any)
|
|
282
273
|
},
|
|
283
274
|
useSearch: (opts = {}) => {
|
|
@@ -659,7 +650,6 @@ function Matches() {
|
|
|
659
650
|
return React.createElement(ErrorComponent, {
|
|
660
651
|
...props,
|
|
661
652
|
useMatch: route.useMatch,
|
|
662
|
-
useContext: route.useContext,
|
|
663
653
|
useRouteContext: route.useRouteContext,
|
|
664
654
|
useSearch: route.useSearch,
|
|
665
655
|
useParams: route.useParams,
|
|
@@ -999,7 +989,6 @@ function Match({ matchIds }: { matchIds: string[] }) {
|
|
|
999
989
|
return React.createElement(routeErrorComponent, {
|
|
1000
990
|
...props,
|
|
1001
991
|
useMatch: route.useMatch,
|
|
1002
|
-
useContext: route.useContext,
|
|
1003
992
|
useRouteContext: route.useRouteContext,
|
|
1004
993
|
useSearch: route.useSearch,
|
|
1005
994
|
useParams: route.useParams,
|
|
@@ -1013,7 +1002,6 @@ function Match({ matchIds }: { matchIds: string[] }) {
|
|
|
1013
1002
|
<ResolvedSuspenseBoundary
|
|
1014
1003
|
fallback={React.createElement(PendingComponent, {
|
|
1015
1004
|
useMatch: route.useMatch,
|
|
1016
|
-
useContext: route.useContext,
|
|
1017
1005
|
useRouteContext: route.useRouteContext,
|
|
1018
1006
|
useSearch: route.useSearch,
|
|
1019
1007
|
useParams: route.useParams,
|
|
@@ -1059,7 +1047,6 @@ function MatchInner({
|
|
|
1059
1047
|
return React.createElement(PendingComponent, {
|
|
1060
1048
|
useLoader: route.useLoader,
|
|
1061
1049
|
useMatch: route.useMatch,
|
|
1062
|
-
useContext: route.useContext,
|
|
1063
1050
|
useRouteContext: route.useRouteContext,
|
|
1064
1051
|
useSearch: route.useSearch,
|
|
1065
1052
|
useParams: route.useParams,
|
|
@@ -1073,7 +1060,6 @@ function MatchInner({
|
|
|
1073
1060
|
return React.createElement(comp, {
|
|
1074
1061
|
useLoader: route.useLoader,
|
|
1075
1062
|
useMatch: route.useMatch,
|
|
1076
|
-
useContext: route.useContext as any,
|
|
1077
1063
|
useRouteContext: route.useRouteContext as any,
|
|
1078
1064
|
useSearch: route.useSearch,
|
|
1079
1065
|
useParams: route.useParams as any,
|