@tanstack/react-router 0.0.1-alpha.1 → 0.0.1-alpha.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/build/stats-html.html +1 -1
- package/build/stats-react.json +129 -0
- package/build/types/index.d.ts +68 -0
- package/package.json +3 -3
package/build/stats-html.html
CHANGED
|
@@ -4014,7 +4014,7 @@ var drawChart = (function (exports) {
|
|
|
4014
4014
|
</script>
|
|
4015
4015
|
<script>
|
|
4016
4016
|
/*<!--*/
|
|
4017
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"
|
|
4017
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"uid":"bdf7-21","name":"\u0000rollupPluginBabelHelpers.js"},{"name":"packages","children":[{"name":"router-core/build/esm/index.js","uid":"bdf7-23"},{"name":"react-router/src/index.tsx","uid":"bdf7-25"}]}]}],"isRoot":true},"nodeParts":{"bdf7-21":{"renderedLength":798,"gzipLength":366,"brotliLength":0,"mainUid":"bdf7-20"},"bdf7-23":{"renderedLength":68622,"gzipLength":14235,"brotliLength":0,"mainUid":"bdf7-22"},"bdf7-25":{"renderedLength":11931,"gzipLength":3038,"brotliLength":0,"mainUid":"bdf7-24"}},"nodeMetas":{"bdf7-20":{"id":"\u0000rollupPluginBabelHelpers.js","moduleParts":{"index.production.js":"bdf7-21"},"imported":[],"importedBy":[{"uid":"bdf7-24"}]},"bdf7-22":{"id":"/packages/router-core/build/esm/index.js","moduleParts":{"index.production.js":"bdf7-23"},"imported":[],"importedBy":[{"uid":"bdf7-24"}]},"bdf7-24":{"id":"/packages/react-router/src/index.tsx","moduleParts":{"index.production.js":"bdf7-25"},"imported":[{"uid":"bdf7-20"},{"uid":"bdf7-26"},{"uid":"bdf7-27"},{"uid":"bdf7-22"}],"importedBy":[],"isEntry":true},"bdf7-26":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"bdf7-24"}],"isExternal":true},"bdf7-27":{"id":"use-sync-external-store/shim","moduleParts":{},"imported":[],"importedBy":[{"uid":"bdf7-24"}],"isExternal":true}},"env":{"rollup":"2.77.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
4018
4018
|
|
|
4019
4019
|
const run = () => {
|
|
4020
4020
|
const width = window.innerWidth;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"tree": {
|
|
4
|
+
"name": "root",
|
|
5
|
+
"children": [
|
|
6
|
+
{
|
|
7
|
+
"name": "index.production.js",
|
|
8
|
+
"children": [
|
|
9
|
+
{
|
|
10
|
+
"uid": "bdf7-29",
|
|
11
|
+
"name": "\u0000rollupPluginBabelHelpers.js"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "packages",
|
|
15
|
+
"children": [
|
|
16
|
+
{
|
|
17
|
+
"name": "router-core/build/esm/index.js",
|
|
18
|
+
"uid": "bdf7-31"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "react-router/src/index.tsx",
|
|
22
|
+
"uid": "bdf7-33"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"isRoot": true
|
|
30
|
+
},
|
|
31
|
+
"nodeParts": {
|
|
32
|
+
"bdf7-29": {
|
|
33
|
+
"renderedLength": 798,
|
|
34
|
+
"gzipLength": 366,
|
|
35
|
+
"brotliLength": 0,
|
|
36
|
+
"mainUid": "bdf7-28"
|
|
37
|
+
},
|
|
38
|
+
"bdf7-31": {
|
|
39
|
+
"renderedLength": 68622,
|
|
40
|
+
"gzipLength": 14235,
|
|
41
|
+
"brotliLength": 0,
|
|
42
|
+
"mainUid": "bdf7-30"
|
|
43
|
+
},
|
|
44
|
+
"bdf7-33": {
|
|
45
|
+
"renderedLength": 11931,
|
|
46
|
+
"gzipLength": 3038,
|
|
47
|
+
"brotliLength": 0,
|
|
48
|
+
"mainUid": "bdf7-32"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"nodeMetas": {
|
|
52
|
+
"bdf7-28": {
|
|
53
|
+
"id": "\u0000rollupPluginBabelHelpers.js",
|
|
54
|
+
"moduleParts": {
|
|
55
|
+
"index.production.js": "bdf7-29"
|
|
56
|
+
},
|
|
57
|
+
"imported": [],
|
|
58
|
+
"importedBy": [
|
|
59
|
+
{
|
|
60
|
+
"uid": "bdf7-32"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"bdf7-30": {
|
|
65
|
+
"id": "/packages/router-core/build/esm/index.js",
|
|
66
|
+
"moduleParts": {
|
|
67
|
+
"index.production.js": "bdf7-31"
|
|
68
|
+
},
|
|
69
|
+
"imported": [],
|
|
70
|
+
"importedBy": [
|
|
71
|
+
{
|
|
72
|
+
"uid": "bdf7-32"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"bdf7-32": {
|
|
77
|
+
"id": "/packages/react-router/src/index.tsx",
|
|
78
|
+
"moduleParts": {
|
|
79
|
+
"index.production.js": "bdf7-33"
|
|
80
|
+
},
|
|
81
|
+
"imported": [
|
|
82
|
+
{
|
|
83
|
+
"uid": "bdf7-28"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"uid": "bdf7-34"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"uid": "bdf7-35"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"uid": "bdf7-30"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"importedBy": [],
|
|
96
|
+
"isEntry": true
|
|
97
|
+
},
|
|
98
|
+
"bdf7-34": {
|
|
99
|
+
"id": "react",
|
|
100
|
+
"moduleParts": {},
|
|
101
|
+
"imported": [],
|
|
102
|
+
"importedBy": [
|
|
103
|
+
{
|
|
104
|
+
"uid": "bdf7-32"
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"isExternal": true
|
|
108
|
+
},
|
|
109
|
+
"bdf7-35": {
|
|
110
|
+
"id": "use-sync-external-store/shim",
|
|
111
|
+
"moduleParts": {},
|
|
112
|
+
"imported": [],
|
|
113
|
+
"importedBy": [
|
|
114
|
+
{
|
|
115
|
+
"uid": "bdf7-32"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"isExternal": true
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"env": {
|
|
122
|
+
"rollup": "2.77.2"
|
|
123
|
+
},
|
|
124
|
+
"options": {
|
|
125
|
+
"gzip": true,
|
|
126
|
+
"brotli": false,
|
|
127
|
+
"sourcemap": false
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-router
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) TanStack
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
import { AnyRouteConfig, RouteConfig, AnyAllRouteInfo, AllRouteInfo, RootRouteId, RouteMatch, DefaultAllRouteInfo, AnyRouteInfo, RouteInfo, ToOptions, MatchRouteOptions, RouteInfoByPath, ResolveRelativePath, NoInfer, ValidFromPath, LinkOptions, RouterOptions, Router } from '@tanstack/router-core';
|
|
13
|
+
export * from '@tanstack/router-core';
|
|
14
|
+
|
|
15
|
+
declare module '@tanstack/router-core' {
|
|
16
|
+
interface FrameworkGenerics {
|
|
17
|
+
Element: React.ReactNode;
|
|
18
|
+
AsyncElement: (opts: {
|
|
19
|
+
params: Record<string, string>;
|
|
20
|
+
}) => Promise<React.ReactNode>;
|
|
21
|
+
SyncOrAsyncElement: React.ReactNode | FrameworkGenerics['AsyncElement'];
|
|
22
|
+
}
|
|
23
|
+
interface Router<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>> extends Pick<Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][RootRouteId]>, 'linkProps' | 'Link' | 'MatchRoute'> {
|
|
24
|
+
useRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(routeId: TId) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>;
|
|
25
|
+
useMatch: <TId extends keyof TAllRouteInfo['routeInfoById']>(routeId: TId) => RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>;
|
|
26
|
+
}
|
|
27
|
+
interface Route<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TRouteInfo extends AnyRouteInfo = RouteInfo> {
|
|
28
|
+
linkProps: <TTo extends string = '.'>(props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> & React.AnchorHTMLAttributes<HTMLAnchorElement>) => React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
29
|
+
Link: <TTo extends string = '.'>(props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> & React.AnchorHTMLAttributes<HTMLAnchorElement> & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {
|
|
30
|
+
children?: React.ReactNode | ((state: {
|
|
31
|
+
isActive: boolean;
|
|
32
|
+
}) => React.ReactNode);
|
|
33
|
+
}) => JSX.Element;
|
|
34
|
+
MatchRoute: <TTo extends string = '.'>(props: ToOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> & MatchRouteOptions & {
|
|
35
|
+
children?: React.ReactNode | ((params: RouteInfoByPath<TAllRouteInfo, ResolveRelativePath<TRouteInfo['fullPath'], NoInfer<TTo>>>['allParams']) => React.ReactNode);
|
|
36
|
+
}) => JSX.Element;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
declare type LinkPropsOptions<TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo, TFrom extends ValidFromPath<TAllRouteInfo> = '/', TTo extends string = '.'> = LinkOptions<TAllRouteInfo, TFrom, TTo> & {
|
|
40
|
+
activeProps?: React.AnchorHTMLAttributes<HTMLAnchorElement> | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>);
|
|
41
|
+
inactiveProps?: React.AnchorHTMLAttributes<HTMLAnchorElement> | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>);
|
|
42
|
+
};
|
|
43
|
+
declare type PromptProps = {
|
|
44
|
+
message: string;
|
|
45
|
+
when?: boolean | any;
|
|
46
|
+
children?: React.ReactNode;
|
|
47
|
+
};
|
|
48
|
+
declare type MatchesProviderProps = {
|
|
49
|
+
value: RouteMatch[];
|
|
50
|
+
children: React.ReactNode;
|
|
51
|
+
};
|
|
52
|
+
declare function MatchesProvider(props: MatchesProviderProps): JSX.Element;
|
|
53
|
+
declare function createReactRouter<TRouteConfig extends AnyRouteConfig = RouteConfig>(opts: RouterOptions<TRouteConfig>): Router<TRouteConfig>;
|
|
54
|
+
declare type RouterProps<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo> = RouterOptions<TRouteConfig> & {
|
|
55
|
+
router: Router<TRouteConfig, TAllRouteInfo>;
|
|
56
|
+
children?: React.ReactNode;
|
|
57
|
+
};
|
|
58
|
+
declare function RouterProvider<TRouteConfig extends AnyRouteConfig = RouteConfig, TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo>({ children, router, ...rest }: RouterProps<TRouteConfig, TAllRouteInfo>): JSX.Element;
|
|
59
|
+
declare function useRouter(): Router;
|
|
60
|
+
declare function useMatches(): RouteMatch[];
|
|
61
|
+
declare function useParentMatches(): RouteMatch[];
|
|
62
|
+
declare function useMatch<T>(): RouteMatch;
|
|
63
|
+
declare function Outlet(): JSX.Element | null;
|
|
64
|
+
declare function DefaultCatchBoundary({ error }: {
|
|
65
|
+
error: any;
|
|
66
|
+
}): JSX.Element;
|
|
67
|
+
|
|
68
|
+
export { DefaultCatchBoundary, MatchesProvider, MatchesProviderProps, Outlet, PromptProps, RouterProps, RouterProvider, createReactRouter, useMatch, useMatches, useParentMatches, useRouter };
|
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-alpha.
|
|
4
|
+
"version": "0.0.1-alpha.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://react-router.tanstack.com/",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"node": ">=12"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
|
-
"build",
|
|
34
|
+
"build/**",
|
|
35
35
|
"src"
|
|
36
36
|
],
|
|
37
37
|
"peerDependencies": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@babel/runtime": "^7.16.7",
|
|
43
|
-
"@tanstack/router-core": "0.0.1-alpha.
|
|
43
|
+
"@tanstack/router-core": "0.0.1-alpha.2",
|
|
44
44
|
"use-sync-external-store": "^1.2.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|