@tanstack/react-router 0.0.1-beta.16 → 0.0.1-beta.160
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/LICENSE +21 -0
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -19
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/build/cjs/index.js +649 -0
- package/build/cjs/index.js.map +1 -0
- package/build/esm/index.js +510 -2738
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +59 -49
- package/build/stats-react.json +157 -46
- package/build/types/index.d.ts +127 -61
- package/build/umd/index.development.js +2100 -2383
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +25 -4
- package/build/umd/index.production.js.map +1 -1
- package/package.json +11 -11
- package/src/index.tsx +949 -468
- package/build/cjs/react-router/src/index.js +0 -413
- package/build/cjs/react-router/src/index.js.map +0 -1
- package/build/cjs/router-core/build/esm/index.js +0 -2497
- package/build/cjs/router-core/build/esm/index.js.map +0 -1
package/build/stats-react.json
CHANGED
|
@@ -7,19 +7,40 @@
|
|
|
7
7
|
"name": "index.production.js",
|
|
8
8
|
"children": [
|
|
9
9
|
{
|
|
10
|
-
"uid": "
|
|
10
|
+
"uid": "284f-167",
|
|
11
11
|
"name": "\u0000rollupPluginBabelHelpers.js"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"name": "packages",
|
|
15
15
|
"children": [
|
|
16
|
+
{
|
|
17
|
+
"name": "store/build/esm/index.js",
|
|
18
|
+
"uid": "284f-169"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "react-store/build/esm/index.js",
|
|
22
|
+
"uid": "284f-171"
|
|
23
|
+
},
|
|
16
24
|
{
|
|
17
25
|
"name": "router-core/build/esm/index.js",
|
|
18
|
-
"uid": "
|
|
26
|
+
"uid": "284f-177"
|
|
19
27
|
},
|
|
20
28
|
{
|
|
21
29
|
"name": "react-router/src/index.tsx",
|
|
22
|
-
"uid": "
|
|
30
|
+
"uid": "284f-179"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "node_modules/.pnpm",
|
|
36
|
+
"children": [
|
|
37
|
+
{
|
|
38
|
+
"name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
|
|
39
|
+
"uid": "284f-173"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
|
|
43
|
+
"uid": "284f-175"
|
|
23
44
|
}
|
|
24
45
|
]
|
|
25
46
|
}
|
|
@@ -29,111 +50,201 @@
|
|
|
29
50
|
"isRoot": true
|
|
30
51
|
},
|
|
31
52
|
"nodeParts": {
|
|
32
|
-
"
|
|
33
|
-
"renderedLength":
|
|
34
|
-
"gzipLength":
|
|
53
|
+
"284f-167": {
|
|
54
|
+
"renderedLength": 429,
|
|
55
|
+
"gzipLength": 238,
|
|
56
|
+
"brotliLength": 0,
|
|
57
|
+
"mainUid": "284f-166"
|
|
58
|
+
},
|
|
59
|
+
"284f-169": {
|
|
60
|
+
"renderedLength": 1843,
|
|
61
|
+
"gzipLength": 644,
|
|
62
|
+
"brotliLength": 0,
|
|
63
|
+
"mainUid": "284f-168"
|
|
64
|
+
},
|
|
65
|
+
"284f-171": {
|
|
66
|
+
"renderedLength": 1006,
|
|
67
|
+
"gzipLength": 479,
|
|
35
68
|
"brotliLength": 0,
|
|
36
|
-
"mainUid": "
|
|
69
|
+
"mainUid": "284f-170"
|
|
37
70
|
},
|
|
38
|
-
"
|
|
39
|
-
"renderedLength":
|
|
40
|
-
"gzipLength":
|
|
71
|
+
"284f-173": {
|
|
72
|
+
"renderedLength": 181,
|
|
73
|
+
"gzipLength": 129,
|
|
41
74
|
"brotliLength": 0,
|
|
42
|
-
"mainUid": "
|
|
75
|
+
"mainUid": "284f-172"
|
|
43
76
|
},
|
|
44
|
-
"
|
|
45
|
-
"renderedLength":
|
|
46
|
-
"gzipLength":
|
|
77
|
+
"284f-175": {
|
|
78
|
+
"renderedLength": 44,
|
|
79
|
+
"gzipLength": 62,
|
|
47
80
|
"brotliLength": 0,
|
|
48
|
-
"mainUid": "
|
|
81
|
+
"mainUid": "284f-174"
|
|
82
|
+
},
|
|
83
|
+
"284f-177": {
|
|
84
|
+
"renderedLength": 56742,
|
|
85
|
+
"gzipLength": 13356,
|
|
86
|
+
"brotliLength": 0,
|
|
87
|
+
"mainUid": "284f-176"
|
|
88
|
+
},
|
|
89
|
+
"284f-179": {
|
|
90
|
+
"renderedLength": 17095,
|
|
91
|
+
"gzipLength": 3814,
|
|
92
|
+
"brotliLength": 0,
|
|
93
|
+
"mainUid": "284f-178"
|
|
49
94
|
}
|
|
50
95
|
},
|
|
51
96
|
"nodeMetas": {
|
|
52
|
-
"
|
|
97
|
+
"284f-166": {
|
|
53
98
|
"id": "\u0000rollupPluginBabelHelpers.js",
|
|
54
99
|
"moduleParts": {
|
|
55
|
-
"index.production.js": "
|
|
100
|
+
"index.production.js": "284f-167"
|
|
56
101
|
},
|
|
57
102
|
"imported": [],
|
|
58
103
|
"importedBy": [
|
|
59
104
|
{
|
|
60
|
-
"uid": "
|
|
105
|
+
"uid": "284f-178"
|
|
61
106
|
}
|
|
62
107
|
]
|
|
63
108
|
},
|
|
64
|
-
"
|
|
65
|
-
"id": "/packages/
|
|
109
|
+
"284f-168": {
|
|
110
|
+
"id": "/packages/store/build/esm/index.js",
|
|
66
111
|
"moduleParts": {
|
|
67
|
-
"index.production.js": "
|
|
112
|
+
"index.production.js": "284f-169"
|
|
68
113
|
},
|
|
69
114
|
"imported": [],
|
|
70
115
|
"importedBy": [
|
|
71
116
|
{
|
|
72
|
-
"uid": "
|
|
117
|
+
"uid": "284f-170"
|
|
73
118
|
}
|
|
74
119
|
]
|
|
75
120
|
},
|
|
76
|
-
"
|
|
77
|
-
"id": "/packages/react-
|
|
121
|
+
"284f-170": {
|
|
122
|
+
"id": "/packages/react-store/build/esm/index.js",
|
|
78
123
|
"moduleParts": {
|
|
79
|
-
"index.production.js": "
|
|
124
|
+
"index.production.js": "284f-171"
|
|
80
125
|
},
|
|
81
126
|
"imported": [
|
|
82
127
|
{
|
|
83
|
-
"uid": "
|
|
128
|
+
"uid": "284f-181"
|
|
84
129
|
},
|
|
85
130
|
{
|
|
86
|
-
"uid": "
|
|
87
|
-
}
|
|
131
|
+
"uid": "284f-168"
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"importedBy": [
|
|
88
135
|
{
|
|
89
|
-
"uid": "
|
|
136
|
+
"uid": "284f-178"
|
|
90
137
|
},
|
|
91
138
|
{
|
|
92
|
-
"uid": "
|
|
139
|
+
"uid": "284f-176"
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
"284f-172": {
|
|
144
|
+
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
|
|
145
|
+
"moduleParts": {
|
|
146
|
+
"index.production.js": "284f-173"
|
|
147
|
+
},
|
|
148
|
+
"imported": [],
|
|
149
|
+
"importedBy": [
|
|
150
|
+
{
|
|
151
|
+
"uid": "284f-178"
|
|
93
152
|
},
|
|
94
153
|
{
|
|
95
|
-
"uid": "
|
|
154
|
+
"uid": "284f-176"
|
|
96
155
|
}
|
|
97
|
-
]
|
|
98
|
-
"importedBy": [],
|
|
99
|
-
"isEntry": true
|
|
156
|
+
]
|
|
100
157
|
},
|
|
101
|
-
"
|
|
102
|
-
"id": "
|
|
103
|
-
"moduleParts": {
|
|
158
|
+
"284f-174": {
|
|
159
|
+
"id": "/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
|
|
160
|
+
"moduleParts": {
|
|
161
|
+
"index.production.js": "284f-175"
|
|
162
|
+
},
|
|
104
163
|
"imported": [],
|
|
105
164
|
"importedBy": [
|
|
106
165
|
{
|
|
107
|
-
"uid": "
|
|
166
|
+
"uid": "284f-178"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"uid": "284f-176"
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
"284f-176": {
|
|
174
|
+
"id": "/packages/router-core/build/esm/index.js",
|
|
175
|
+
"moduleParts": {
|
|
176
|
+
"index.production.js": "284f-177"
|
|
177
|
+
},
|
|
178
|
+
"imported": [
|
|
179
|
+
{
|
|
180
|
+
"uid": "284f-172"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"uid": "284f-174"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"uid": "284f-170"
|
|
108
187
|
}
|
|
109
188
|
],
|
|
110
|
-
"
|
|
189
|
+
"importedBy": [
|
|
190
|
+
{
|
|
191
|
+
"uid": "284f-178"
|
|
192
|
+
}
|
|
193
|
+
]
|
|
111
194
|
},
|
|
112
|
-
"
|
|
113
|
-
"id": "
|
|
195
|
+
"284f-178": {
|
|
196
|
+
"id": "/packages/react-router/src/index.tsx",
|
|
197
|
+
"moduleParts": {
|
|
198
|
+
"index.production.js": "284f-179"
|
|
199
|
+
},
|
|
200
|
+
"imported": [
|
|
201
|
+
{
|
|
202
|
+
"uid": "284f-166"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"uid": "284f-180"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"uid": "284f-170"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"uid": "284f-172"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"uid": "284f-174"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"uid": "284f-176"
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
"importedBy": [],
|
|
221
|
+
"isEntry": true
|
|
222
|
+
},
|
|
223
|
+
"284f-180": {
|
|
224
|
+
"id": "react",
|
|
114
225
|
"moduleParts": {},
|
|
115
226
|
"imported": [],
|
|
116
227
|
"importedBy": [
|
|
117
228
|
{
|
|
118
|
-
"uid": "
|
|
229
|
+
"uid": "284f-178"
|
|
119
230
|
}
|
|
120
231
|
],
|
|
121
232
|
"isExternal": true
|
|
122
233
|
},
|
|
123
|
-
"
|
|
124
|
-
"id": "
|
|
234
|
+
"284f-181": {
|
|
235
|
+
"id": "use-sync-external-store/shim/with-selector",
|
|
125
236
|
"moduleParts": {},
|
|
126
237
|
"imported": [],
|
|
127
238
|
"importedBy": [
|
|
128
239
|
{
|
|
129
|
-
"uid": "
|
|
240
|
+
"uid": "284f-170"
|
|
130
241
|
}
|
|
131
242
|
],
|
|
132
243
|
"isExternal": true
|
|
133
244
|
}
|
|
134
245
|
},
|
|
135
246
|
"env": {
|
|
136
|
-
"rollup": "2.
|
|
247
|
+
"rollup": "2.79.1"
|
|
137
248
|
},
|
|
138
249
|
"options": {
|
|
139
250
|
"gzip": true,
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router
|
|
2
|
+
* @tanstack/react-router/src/index.tsx
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) TanStack
|
|
5
5
|
*
|
|
@@ -8,80 +8,146 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import * as
|
|
12
|
-
import {
|
|
11
|
+
import * as _tanstack_router_core from '@tanstack/router-core';
|
|
12
|
+
import { RouteConstraints, AnyRoute, ResolveFullPath, ResolveId, ResolveFullSearchSchema, ParsePathParams, MergeParamsFromParent, RouteContext, AnyContext, UseLoaderResult, AnyRouteProps, RoutePaths, RegisteredRouter, LinkOptions, ToOptions, MatchRouteOptions, RouteByPath, ResolveRelativePath, NavigateOptions, RouterOptions, Router, RouteMatch, RouteIds, RouteById, ParseRoute, RoutesById, AllParams } from '@tanstack/router-core';
|
|
13
13
|
export * from '@tanstack/router-core';
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
import { NoInfer } from '@tanstack/react-store';
|
|
16
|
+
export { useStore } from '@tanstack/react-store';
|
|
16
17
|
|
|
17
|
-
declare type SyncRouteComponent = (props?: {}) => React.ReactNode;
|
|
18
|
-
declare type RouteComponent = SyncRouteComponent & {
|
|
19
|
-
preload?: () => Promise<{
|
|
20
|
-
default: SyncRouteComponent;
|
|
21
|
-
}>;
|
|
22
|
-
};
|
|
23
18
|
declare module '@tanstack/router-core' {
|
|
24
|
-
interface
|
|
25
|
-
|
|
19
|
+
interface RegisterRouteComponent<TProps extends Record<string, any>> {
|
|
20
|
+
RouteComponent: RouteComponent<TProps>;
|
|
26
21
|
}
|
|
27
|
-
interface
|
|
28
|
-
|
|
29
|
-
useRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(routeId: TId) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>;
|
|
30
|
-
useMatch: <TId extends keyof TAllRouteInfo['routeInfoById'], TStrict extends true | false = true>(routeId: TId, opts?: {
|
|
31
|
-
strict?: TStrict;
|
|
32
|
-
}) => TStrict extends true ? RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]> : RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]> | undefined;
|
|
33
|
-
linkProps: <TTo extends string = '.'>(props: LinkPropsOptions<TAllRouteInfo, '/', TTo> & React.AnchorHTMLAttributes<HTMLAnchorElement>) => React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
34
|
-
Link: <TTo extends string = '.'>(props: LinkPropsOptions<TAllRouteInfo, '/', TTo> & React.AnchorHTMLAttributes<HTMLAnchorElement> & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {
|
|
35
|
-
children?: React.ReactNode | ((state: {
|
|
36
|
-
isActive: boolean;
|
|
37
|
-
}) => React.ReactNode);
|
|
38
|
-
}) => JSX.Element;
|
|
39
|
-
MatchRoute: <TTo extends string = '.'>(props: ToOptions<TAllRouteInfo, '/', TTo> & MatchRouteOptions & {
|
|
40
|
-
children?: React.ReactNode | ((params: RouteInfoByPath<TAllRouteInfo, ResolveRelativePath<'/', NoInfer<TTo>>>['allParams']) => React.ReactNode);
|
|
41
|
-
}) => JSX.Element;
|
|
22
|
+
interface RegisterRouteErrorComponent<TProps extends Record<string, any>> {
|
|
23
|
+
RouteErrorComponent: RouteComponent<TProps>;
|
|
42
24
|
}
|
|
43
|
-
interface Route<
|
|
44
|
-
|
|
45
|
-
strict?:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}) =>
|
|
25
|
+
interface Route<TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, TLoader = unknown, TSearchSchema extends RouteConstraints['TSearchSchema'] = {}, TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends RouteConstraints['TParams'] = Record<ParsePathParams<TPath>, string>, TAllParams extends RouteConstraints['TAllParams'] = MergeParamsFromParent<TParentRoute['__types']['allParams'], TParams>, TParentContext extends RouteConstraints['TParentContext'] = TParentRoute['__types']['routeContext'], TAllParentContext extends RouteConstraints['TAllParentContext'] = TParentRoute['__types']['context'], TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext, TAllContext extends RouteConstraints['TAllContext'] = MergeParamsFromParent<TParentRoute['__types']['context'], TRouteContext>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TChildren extends RouteConstraints['TChildren'] = unknown, TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute> {
|
|
26
|
+
useMatch: <TStrict extends boolean = true, TSelected = TAllContext>(opts?: {
|
|
27
|
+
strict?: TStrict;
|
|
28
|
+
select?: (search: TAllContext) => TSelected;
|
|
29
|
+
}) => TStrict extends true ? TSelected : TSelected | undefined;
|
|
30
|
+
useLoader: <TStrict extends boolean = true, TSelected = TLoader>(opts?: {
|
|
31
|
+
strict?: TStrict;
|
|
32
|
+
select?: (search: TLoader) => TSelected;
|
|
33
|
+
}) => TStrict extends true ? UseLoaderResult<TSelected> : UseLoaderResult<TSelected> | undefined;
|
|
34
|
+
useContext: <TStrict extends boolean = true, TSelected = TAllContext>(opts?: {
|
|
35
|
+
strict?: TStrict;
|
|
36
|
+
select?: (search: TAllContext) => TSelected;
|
|
37
|
+
}) => TStrict extends true ? TSelected : TSelected | undefined;
|
|
38
|
+
useRouteContext: <TStrict extends boolean = true, TSelected = TRouteContext>(opts?: {
|
|
39
|
+
strict?: TStrict;
|
|
40
|
+
select?: (search: TRouteContext) => TSelected;
|
|
41
|
+
}) => TStrict extends true ? TSelected : TSelected | undefined;
|
|
42
|
+
useSearch: <TStrict extends boolean = true, TSelected = TFullSearchSchema>(opts?: {
|
|
43
|
+
strict?: TStrict;
|
|
44
|
+
select?: (search: TFullSearchSchema) => TSelected;
|
|
45
|
+
}) => TStrict extends true ? TSelected : TSelected | undefined;
|
|
46
|
+
useParams: <TStrict extends boolean = true, TSelected = TAllParams>(opts?: {
|
|
47
|
+
strict?: TStrict;
|
|
48
|
+
select?: (search: TAllParams) => TSelected;
|
|
49
|
+
}) => TStrict extends true ? TSelected : TSelected | undefined;
|
|
56
50
|
}
|
|
57
51
|
}
|
|
58
|
-
|
|
52
|
+
type ReactNode = any;
|
|
53
|
+
type SyncRouteComponent<TProps> = ((props: TProps) => ReactNode) | React.LazyExoticComponent<(props: TProps) => ReactNode>;
|
|
54
|
+
type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {
|
|
55
|
+
preload?: () => Promise<void>;
|
|
56
|
+
};
|
|
57
|
+
type RouteErrorComponent = AsyncRouteComponent<RouteErrorComponentProps>;
|
|
58
|
+
type RouteErrorComponentProps = {
|
|
59
|
+
error: Error;
|
|
60
|
+
info: {
|
|
61
|
+
componentStack: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
type AnyRouteComponent = RouteComponent<AnyRouteProps>;
|
|
65
|
+
type RouteComponent<TProps> = AsyncRouteComponent<TProps>;
|
|
66
|
+
declare function lazyRouteComponent<T extends Record<string, any>, TKey extends keyof T = 'default'>(importer: () => Promise<T>, exportName?: TKey): T[TKey] extends (props: infer TProps) => any ? AsyncRouteComponent<TProps> : never;
|
|
67
|
+
type LinkPropsOptions<TFrom extends RoutePaths<RegisteredRouter['routeTree']> = '/', TTo extends string = ''> = LinkOptions<RegisteredRouter['routeTree'], TFrom, TTo> & {
|
|
59
68
|
activeProps?: React.AnchorHTMLAttributes<HTMLAnchorElement> | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>);
|
|
60
69
|
inactiveProps?: React.AnchorHTMLAttributes<HTMLAnchorElement> | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>);
|
|
70
|
+
startTransition?: boolean;
|
|
61
71
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
72
|
+
type MakeUseMatchRouteOptions<TFrom extends RoutePaths<RegisteredRouter['routeTree']> = '/', TTo extends string = ''> = ToOptions<RegisteredRouter['routeTree'], TFrom, TTo> & MatchRouteOptions;
|
|
73
|
+
type MakeMatchRouteOptions<TFrom extends RoutePaths<RegisteredRouter['routeTree']> = '/', TTo extends string = ''> = ToOptions<RegisteredRouter['routeTree'], TFrom, TTo> & MatchRouteOptions & {
|
|
74
|
+
children?: ((params?: RouteByPath<RegisteredRouter['routeTree'], ResolveRelativePath<TFrom, NoInfer<TTo>>>['__types']['allParams']) => ReactNode) | React.ReactNode;
|
|
75
|
+
};
|
|
76
|
+
type MakeLinkPropsOptions<TFrom extends string = '/', TTo extends string = ''> = LinkPropsOptions<TFrom, TTo> & React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
77
|
+
type MakeLinkOptions<TFrom extends RoutePaths<RegisteredRouter['routeTree']> = '/', TTo extends string = ''> = LinkPropsOptions<TFrom, TTo> & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {
|
|
78
|
+
children?: React.ReactNode | ((state: {
|
|
79
|
+
isActive: boolean;
|
|
80
|
+
}) => React.ReactNode);
|
|
66
81
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
82
|
+
type PromptProps = {
|
|
83
|
+
message: string;
|
|
84
|
+
condition?: boolean | any;
|
|
85
|
+
children?: ReactNode;
|
|
70
86
|
};
|
|
71
|
-
declare function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
87
|
+
declare function useLinkProps<TFrom extends string = '/', TTo extends string = ''>(options: MakeLinkPropsOptions<TFrom, TTo>): React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
88
|
+
interface LinkComponent<TProps extends Record<string, any> = {}> {
|
|
89
|
+
<TFrom extends RoutePaths<RegisteredRouter['routeTree']> = '/', TTo extends string = ''>(props: MakeLinkOptions<TFrom, TTo> & TProps & React.RefAttributes<HTMLAnchorElement>): ReactNode;
|
|
90
|
+
}
|
|
91
|
+
declare const Link: LinkComponent;
|
|
92
|
+
declare function Navigate<TFrom extends RoutePaths<RegisteredRouter['routeTree']> = '/', TTo extends string = ''>(props: NavigateOptions<RegisteredRouter['routeTree'], TFrom, TTo>): null;
|
|
93
|
+
declare const matchIdsContext: React.Context<string[]>;
|
|
94
|
+
declare const routerContext: React.Context<_tanstack_router_core.AnyRouter>;
|
|
95
|
+
type RouterProps<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TDehydrated extends Record<string, any> = Record<string, any>> = Omit<RouterOptions<TRouteTree, TDehydrated>, 'context'> & {
|
|
96
|
+
router: Router<TRouteTree>;
|
|
97
|
+
context?: Partial<RouterOptions<TRouteTree, TDehydrated>['context']>;
|
|
76
98
|
};
|
|
77
|
-
declare function
|
|
78
|
-
|
|
79
|
-
|
|
99
|
+
declare function useRouterState<TSelected = RegisteredRouter['state']>(opts?: {
|
|
100
|
+
select: (state: RegisteredRouter['state']) => TSelected;
|
|
101
|
+
}): TSelected;
|
|
102
|
+
declare function RouterProvider<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TDehydrated extends Record<string, any> = Record<string, any>>({ router, ...rest }: RouterProps<TRouteTree, TDehydrated>): JSX.Element;
|
|
103
|
+
declare function useRouter(): RegisteredRouter;
|
|
104
|
+
declare function useMatches<T = RouteMatch[]>(opts?: {
|
|
105
|
+
select?: (matches: RouteMatch[]) => T;
|
|
106
|
+
}): T;
|
|
107
|
+
declare function useMatch<TFrom extends RouteIds<RegisteredRouter['routeTree']>, TStrict extends boolean = true, TRouteMatchState = RouteMatch<RegisteredRouter['routeTree'], RouteById<RegisteredRouter['routeTree'], TFrom>>, TSelected = TRouteMatchState>(opts?: {
|
|
108
|
+
from: TFrom;
|
|
109
|
+
strict?: TStrict;
|
|
110
|
+
select?: (match: TRouteMatchState) => TSelected;
|
|
111
|
+
}): TStrict extends true ? TRouteMatchState : TRouteMatchState | undefined;
|
|
112
|
+
type RouteFromIdOrRoute<T> = T extends ParseRoute<RegisteredRouter['routeTree']> ? T : T extends RouteIds<RegisteredRouter['routeTree']> ? RoutesById<RegisteredRouter['routeTree']>[T] : T extends string ? RouteIds<RegisteredRouter['routeTree']> : never;
|
|
113
|
+
declare function useLoader<TFrom extends RouteIds<RegisteredRouter['routeTree']>, TStrict extends boolean = true, TLoader = RouteById<RegisteredRouter['routeTree'], TFrom>['__types']['loader'], TSelected = TLoader>(opts?: {
|
|
114
|
+
from: TFrom;
|
|
115
|
+
strict?: TStrict;
|
|
116
|
+
select?: (search: TLoader) => TSelected;
|
|
117
|
+
}): TStrict extends true ? TSelected : TSelected | undefined;
|
|
118
|
+
declare function useRouterContext<TFrom extends RouteIds<RegisteredRouter['routeTree']>, TStrict extends boolean = true, TContext = RouteById<RegisteredRouter['routeTree'], TFrom>['__types']['context'], TSelected = TContext>(opts?: {
|
|
119
|
+
from: TFrom;
|
|
120
|
+
strict?: TStrict;
|
|
121
|
+
select?: (search: TContext) => TSelected;
|
|
122
|
+
}): TStrict extends true ? TSelected : TSelected | undefined;
|
|
123
|
+
declare function useRouteContext<TFrom extends RouteIds<RegisteredRouter['routeTree']>, TStrict extends boolean = true, TRouteContext = RouteById<RegisteredRouter['routeTree'], TFrom>['__types']['routeContext'], TSelected = TRouteContext>(opts?: {
|
|
124
|
+
from: TFrom;
|
|
125
|
+
strict?: TStrict;
|
|
126
|
+
select?: (search: TRouteContext) => TSelected;
|
|
127
|
+
}): TStrict extends true ? TSelected : TSelected | undefined;
|
|
128
|
+
declare function useSearch<TFrom extends RouteIds<RegisteredRouter['routeTree']>, TStrict extends boolean = true, TSearch = RouteById<RegisteredRouter['routeTree'], TFrom>['__types']['fullSearchSchema'], TSelected = TSearch>(opts?: {
|
|
129
|
+
from: TFrom;
|
|
130
|
+
strict?: TStrict;
|
|
131
|
+
select?: (search: TSearch) => TSelected;
|
|
132
|
+
}): TStrict extends true ? TSelected : TSelected | undefined;
|
|
133
|
+
declare function useParams<TFrom extends RouteIds<RegisteredRouter['routeTree']> = '/', TDefaultSelected = AllParams<RegisteredRouter['routeTree']> & RouteById<RegisteredRouter['routeTree'], TFrom>['__types']['allParams'], TSelected = TDefaultSelected>(opts?: {
|
|
134
|
+
from: TFrom;
|
|
135
|
+
select?: (search: TDefaultSelected) => TSelected;
|
|
136
|
+
}): TSelected;
|
|
137
|
+
declare function useNavigate<TDefaultFrom extends RoutePaths<RegisteredRouter['routeTree']> = '/'>(defaultOpts?: {
|
|
138
|
+
from?: TDefaultFrom;
|
|
139
|
+
}): <TFrom extends unknown = TDefaultFrom, TTo extends string = "">(opts?: NavigateOptions<any, TFrom, TTo> | undefined) => Promise<void>;
|
|
140
|
+
declare function useMatchRoute(): <TFrom extends string = "/", TTo extends string = "">(opts: MakeUseMatchRouteOptions<TFrom, TTo>) => any;
|
|
141
|
+
declare function MatchRoute<TFrom extends string = '/', TTo extends string = ''>(props: MakeMatchRouteOptions<TFrom, TTo>): any;
|
|
80
142
|
declare function Outlet(): JSX.Element | null;
|
|
81
|
-
declare function
|
|
143
|
+
declare function useInjectHtml(): (html: string | (() => Promise<string> | string)) => void;
|
|
144
|
+
declare function useDehydrate(): <T>(key: any, data: T | (() => T | Promise<T>)) => () => T | undefined;
|
|
145
|
+
declare function useHydrate(): <T = unknown>(key: any) => T;
|
|
146
|
+
declare function ErrorComponent({ error }: {
|
|
82
147
|
error: any;
|
|
83
148
|
}): JSX.Element;
|
|
84
|
-
declare function
|
|
85
|
-
declare function
|
|
149
|
+
declare function useBlocker(message: string, condition?: boolean | any): void;
|
|
150
|
+
declare function Block({ message, condition, children }: PromptProps): any;
|
|
151
|
+
declare function shallow<T>(objA: T, objB: T): boolean;
|
|
86
152
|
|
|
87
|
-
export {
|
|
153
|
+
export { AnyRouteComponent, AsyncRouteComponent, Block, ErrorComponent, Link, LinkComponent, LinkPropsOptions, MakeLinkOptions, MakeLinkPropsOptions, MakeMatchRouteOptions, MakeUseMatchRouteOptions, MatchRoute, Navigate, Outlet, PromptProps, RouteComponent, RouteErrorComponent, RouteErrorComponentProps, RouteFromIdOrRoute, RouterProps, RouterProvider, SyncRouteComponent, lazyRouteComponent, matchIdsContext, routerContext, shallow, useBlocker, useDehydrate, useHydrate, useInjectHtml, useLinkProps, useLoader, useMatch, useMatchRoute, useMatches, useNavigate, useParams, useRouteContext, useRouter, useRouterContext, useRouterState, useSearch };
|