@tanstack/router-core 0.0.1-beta.161 → 0.0.1-beta.162
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/fileRoute.js.map +1 -1
- package/build/cjs/route.js.map +1 -1
- package/build/cjs/router.js.map +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +114 -114
- package/build/types/index.d.ts +22 -22
- 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/fileRoute.ts +5 -5
- package/src/link.ts +8 -8
- package/src/route.ts +13 -13
- package/src/routeInfo.ts +2 -2
- package/src/router.ts +11 -11
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/router-core",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "0.0.1-beta.
|
|
4
|
+
"version": "0.0.1-beta.162",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://tanstack.com/router",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"tiny-invariant": "^1.3.1",
|
|
44
44
|
"tiny-warning": "^1.0.3",
|
|
45
45
|
"@gisatcz/cross-package-react-context": "^0.2.0",
|
|
46
|
-
"@tanstack/react-store": "0.0.1-beta.
|
|
46
|
+
"@tanstack/react-store": "0.0.1-beta.162"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "rollup --config rollup.config.js",
|
package/src/fileRoute.ts
CHANGED
|
@@ -59,7 +59,7 @@ export type ResolveFilePath<
|
|
|
59
59
|
? TrimPathLeft<TFilePath>
|
|
60
60
|
: Replace<
|
|
61
61
|
TrimPathLeft<TFilePath>,
|
|
62
|
-
TrimPathLeft<TParentRoute['
|
|
62
|
+
TrimPathLeft<TParentRoute['types']['customId']>,
|
|
63
63
|
''
|
|
64
64
|
>
|
|
65
65
|
|
|
@@ -96,14 +96,14 @@ export class FileRoute<
|
|
|
96
96
|
? AnyPathParams
|
|
97
97
|
: Record<ParsePathParams<TPath>, RouteConstraints['TPath']>,
|
|
98
98
|
TAllParams extends RouteConstraints['TAllParams'] = MergeParamsFromParent<
|
|
99
|
-
TParentRoute['
|
|
99
|
+
TParentRoute['types']['allParams'],
|
|
100
100
|
TParams
|
|
101
101
|
>,
|
|
102
|
-
TParentContext extends RouteConstraints['TParentContext'] = TParentRoute['
|
|
103
|
-
TAllParentContext extends RouteConstraints['TId'] = TParentRoute['
|
|
102
|
+
TParentContext extends RouteConstraints['TParentContext'] = TParentRoute['types']['routeContext'],
|
|
103
|
+
TAllParentContext extends RouteConstraints['TId'] = TParentRoute['types']['context'],
|
|
104
104
|
TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext,
|
|
105
105
|
TContext extends RouteConstraints['TAllContext'] = MergeParamsFromParent<
|
|
106
|
-
TParentRoute['
|
|
106
|
+
TParentRoute['types']['context'],
|
|
107
107
|
TRouteContext
|
|
108
108
|
>,
|
|
109
109
|
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
package/src/link.ts
CHANGED
|
@@ -152,17 +152,17 @@ export type SearchParamOptions<
|
|
|
152
152
|
TFromSchema = UnionToIntersection<
|
|
153
153
|
FullSearchSchema<TRouteTree> & RouteByPath<TRouteTree, TFrom> extends never
|
|
154
154
|
? {}
|
|
155
|
-
: RouteByPath<TRouteTree, TFrom>['
|
|
155
|
+
: RouteByPath<TRouteTree, TFrom>['types']['fullSearchSchema']
|
|
156
156
|
>,
|
|
157
157
|
// Find the schema for the new path, and make optional any keys
|
|
158
158
|
// that are already defined in the current schema
|
|
159
159
|
TToSchema = Partial<
|
|
160
|
-
RouteByPath<TRouteTree, TFrom>['
|
|
160
|
+
RouteByPath<TRouteTree, TFrom>['types']['fullSearchSchema']
|
|
161
161
|
> &
|
|
162
162
|
Omit<
|
|
163
|
-
RouteByPath<TRouteTree, TTo>['
|
|
163
|
+
RouteByPath<TRouteTree, TTo>['types']['fullSearchSchema'],
|
|
164
164
|
keyof PickRequired<
|
|
165
|
-
RouteByPath<TRouteTree, TFrom>['
|
|
165
|
+
RouteByPath<TRouteTree, TFrom>['types']['fullSearchSchema']
|
|
166
166
|
>
|
|
167
167
|
>,
|
|
168
168
|
TFromFullSchema = UnionToIntersection<
|
|
@@ -188,14 +188,14 @@ export type PathParamOptions<
|
|
|
188
188
|
TFromSchema = UnionToIntersection<
|
|
189
189
|
RouteByPath<TRouteTree, TFrom> extends never
|
|
190
190
|
? {}
|
|
191
|
-
: RouteByPath<TRouteTree, TFrom>['
|
|
191
|
+
: RouteByPath<TRouteTree, TFrom>['types']['allParams']
|
|
192
192
|
>,
|
|
193
193
|
// Find the schema for the new path, and make optional any keys
|
|
194
194
|
// that are already defined in the current schema
|
|
195
|
-
TToSchema = Partial<RouteByPath<TRouteTree, TFrom>['
|
|
195
|
+
TToSchema = Partial<RouteByPath<TRouteTree, TFrom>['types']['allParams']> &
|
|
196
196
|
Omit<
|
|
197
|
-
RouteByPath<TRouteTree, TTo>['
|
|
198
|
-
keyof PickRequired<RouteByPath<TRouteTree, TFrom>['
|
|
197
|
+
RouteByPath<TRouteTree, TTo>['types']['allParams'],
|
|
198
|
+
keyof PickRequired<RouteByPath<TRouteTree, TFrom>['types']['allParams']>
|
|
199
199
|
>,
|
|
200
200
|
TFromFullParams = UnionToIntersection<AllParams<TRouteTree> & TFromSchema>,
|
|
201
201
|
TToFullParams = UnionToIntersection<AllParams<TRouteTree> & TToSchema>,
|
package/src/route.ts
CHANGED
|
@@ -81,12 +81,12 @@ export type ComponentFromRoute<TRoute> = RegisteredRouteComponent<
|
|
|
81
81
|
>
|
|
82
82
|
|
|
83
83
|
export type RouteLoaderFromRoute<TRoute extends AnyRoute> = LoaderFn<
|
|
84
|
-
TRoute['
|
|
85
|
-
TRoute['
|
|
86
|
-
TRoute['
|
|
87
|
-
TRoute['
|
|
88
|
-
TRoute['
|
|
89
|
-
TRoute['
|
|
84
|
+
TRoute['types']['loader'],
|
|
85
|
+
TRoute['types']['searchSchema'],
|
|
86
|
+
TRoute['types']['fullSearchSchema'],
|
|
87
|
+
TRoute['types']['allParams'],
|
|
88
|
+
TRoute['types']['routeContext'],
|
|
89
|
+
TRoute['types']['context']
|
|
90
90
|
>
|
|
91
91
|
|
|
92
92
|
export type RouteProps<
|
|
@@ -443,13 +443,13 @@ export type ResolveId<
|
|
|
443
443
|
|
|
444
444
|
export type InferFullSearchSchema<TRoute> = TRoute extends {
|
|
445
445
|
isRoot: true
|
|
446
|
-
|
|
446
|
+
types: {
|
|
447
447
|
searchSchema: infer TSearchSchema
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
? TSearchSchema
|
|
451
451
|
: TRoute extends {
|
|
452
|
-
|
|
452
|
+
types: {
|
|
453
453
|
fullSearchSchema: infer TFullSearchSchema
|
|
454
454
|
}
|
|
455
455
|
}
|
|
@@ -542,21 +542,21 @@ export class Route<
|
|
|
542
542
|
string
|
|
543
543
|
>,
|
|
544
544
|
TAllParams extends RouteConstraints['TAllParams'] = MergeParamsFromParent<
|
|
545
|
-
TParentRoute['
|
|
545
|
+
TParentRoute['types']['allParams'],
|
|
546
546
|
TParams
|
|
547
547
|
>,
|
|
548
|
-
TParentContext extends RouteConstraints['TParentContext'] = TParentRoute['
|
|
549
|
-
TAllParentContext extends RouteConstraints['TAllParentContext'] = TParentRoute['
|
|
548
|
+
TParentContext extends RouteConstraints['TParentContext'] = TParentRoute['types']['routeContext'],
|
|
549
|
+
TAllParentContext extends RouteConstraints['TAllParentContext'] = TParentRoute['types']['context'],
|
|
550
550
|
TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext,
|
|
551
551
|
TAllContext extends RouteConstraints['TAllContext'] = MergeParamsFromParent<
|
|
552
|
-
TParentRoute['
|
|
552
|
+
TParentRoute['types']['context'],
|
|
553
553
|
TRouteContext
|
|
554
554
|
>,
|
|
555
555
|
TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,
|
|
556
556
|
TChildren extends RouteConstraints['TChildren'] = unknown,
|
|
557
557
|
TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,
|
|
558
558
|
> {
|
|
559
|
-
|
|
559
|
+
types!: {
|
|
560
560
|
parentRoute: TParentRoute
|
|
561
561
|
path: TPath
|
|
562
562
|
to: TrimPathRight<TFullPath>
|
package/src/routeInfo.ts
CHANGED
|
@@ -63,9 +63,9 @@ export type RoutePaths<TRouteTree extends AnyRoute> =
|
|
|
63
63
|
| '/'
|
|
64
64
|
|
|
65
65
|
export type FullSearchSchema<TRouteTree extends AnyRoute> = MergeUnion<
|
|
66
|
-
ParseRoute<TRouteTree>['
|
|
66
|
+
ParseRoute<TRouteTree>['types']['fullSearchSchema']
|
|
67
67
|
> & {}
|
|
68
68
|
|
|
69
69
|
export type AllParams<TRouteTree extends AnyRoute> = MergeUnion<
|
|
70
|
-
ParseRoute<TRouteTree>['
|
|
70
|
+
ParseRoute<TRouteTree>['types']['allParams']
|
|
71
71
|
>
|
package/src/router.ts
CHANGED
|
@@ -114,7 +114,7 @@ export interface RouteMatch<
|
|
|
114
114
|
key?: string
|
|
115
115
|
routeId: string
|
|
116
116
|
pathname: string
|
|
117
|
-
params: TRoute['
|
|
117
|
+
params: TRoute['types']['allParams']
|
|
118
118
|
status: 'pending' | 'success' | 'error'
|
|
119
119
|
isFetching: boolean
|
|
120
120
|
invalid: boolean
|
|
@@ -124,13 +124,13 @@ export interface RouteMatch<
|
|
|
124
124
|
updatedAt: number
|
|
125
125
|
invalidAt: number
|
|
126
126
|
preloadInvalidAt: number
|
|
127
|
-
loaderData: TRoute['
|
|
127
|
+
loaderData: TRoute['types']['loader']
|
|
128
128
|
loadPromise?: Promise<void>
|
|
129
129
|
__resolveLoadPromise?: () => void
|
|
130
|
-
routeContext: TRoute['
|
|
131
|
-
context: TRoute['
|
|
132
|
-
routeSearch: TRoute['
|
|
133
|
-
search: FullSearchSchema<TRouteTree> & TRoute['
|
|
130
|
+
routeContext: TRoute['types']['routeContext']
|
|
131
|
+
context: TRoute['types']['context']
|
|
132
|
+
routeSearch: TRoute['types']['searchSchema']
|
|
133
|
+
search: FullSearchSchema<TRouteTree> & TRoute['types']['fullSearchSchema']
|
|
134
134
|
fetchedAt: number
|
|
135
135
|
abortController: AbortController
|
|
136
136
|
}
|
|
@@ -138,12 +138,12 @@ export interface RouteMatch<
|
|
|
138
138
|
export type AnyRouteMatch = RouteMatch<AnyRoute, AnyRoute>
|
|
139
139
|
|
|
140
140
|
export type RouterContextOptions<TRouteTree extends AnyRoute> =
|
|
141
|
-
AnyContext extends TRouteTree['
|
|
141
|
+
AnyContext extends TRouteTree['types']['routerContext']
|
|
142
142
|
? {
|
|
143
|
-
context?: TRouteTree['
|
|
143
|
+
context?: TRouteTree['types']['routerContext']
|
|
144
144
|
}
|
|
145
145
|
: {
|
|
146
|
-
context: TRouteTree['
|
|
146
|
+
context: TRouteTree['types']['routerContext']
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
export interface RouterOptions<
|
|
@@ -172,7 +172,7 @@ export interface RouterOptions<
|
|
|
172
172
|
basepath?: string
|
|
173
173
|
createRoute?: (opts: { route: AnyRoute; router: AnyRouter }) => void
|
|
174
174
|
onRouteChange?: () => void
|
|
175
|
-
context?: TRouteTree['
|
|
175
|
+
context?: TRouteTree['types']['routerContext']
|
|
176
176
|
Wrap?: React.ComponentType<{
|
|
177
177
|
children: React.ReactNode
|
|
178
178
|
dehydratedState?: TDehydrated
|
|
@@ -1089,7 +1089,7 @@ export class Router<
|
|
|
1089
1089
|
>(
|
|
1090
1090
|
location: ToOptions<TRouteTree, TFrom, TTo>,
|
|
1091
1091
|
opts?: MatchRouteOptions,
|
|
1092
|
-
): false | RouteById<TRouteTree, TResolved>['
|
|
1092
|
+
): false | RouteById<TRouteTree, TResolved>['types']['allParams'] => {
|
|
1093
1093
|
location = {
|
|
1094
1094
|
...location,
|
|
1095
1095
|
to: location.to
|