@tanstack/react-router 0.0.1-alpha.0
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/_virtual/_rollupPluginBabelHelpers.js +49 -0
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/build/cjs/index.js +364 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/location-core/build/esm/index.js +2214 -0
- package/build/cjs/location-core/build/esm/index.js.map +1 -0
- package/build/cjs/react-location/src/index.js +311 -0
- package/build/cjs/react-location/src/index.js.map +1 -0
- package/build/cjs/react-router/src/index.js +413 -0
- package/build/cjs/react-router/src/index.js.map +1 -0
- package/build/cjs/router-core/build/esm/index.js +2330 -0
- package/build/cjs/router-core/build/esm/index.js.map +1 -0
- package/build/cjs/src/index.js +335 -0
- package/build/cjs/src/index.js.map +1 -0
- package/build/esm/index.js +2686 -0
- package/build/esm/index.js.map +1 -0
- package/build/stats-html.html +4034 -0
- package/build/stats-react.json +129 -0
- package/build/types/createRoutes.test.d.ts +0 -0
- package/build/types/index.d.ts +68 -0
- package/build/types/qss.d.ts +2 -0
- package/build/umd/index.development.js +2737 -0
- package/build/umd/index.development.js.map +1 -0
- package/build/umd/index.production.js +22 -0
- package/build/umd/index.production.js.map +1 -0
- package/package.json +50 -0
- package/src/createRoutes.test.tsx +310 -0
- package/src/index.tsx +568 -0
- package/src/qss.ts +53 -0
|
@@ -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": "9dec-29",
|
|
11
|
+
"name": "\u0000rollupPluginBabelHelpers.js"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "packages",
|
|
15
|
+
"children": [
|
|
16
|
+
{
|
|
17
|
+
"name": "router-core/build/esm/index.js",
|
|
18
|
+
"uid": "9dec-31"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "react-router/src/index.tsx",
|
|
22
|
+
"uid": "9dec-33"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"isRoot": true
|
|
30
|
+
},
|
|
31
|
+
"nodeParts": {
|
|
32
|
+
"9dec-29": {
|
|
33
|
+
"renderedLength": 798,
|
|
34
|
+
"gzipLength": 366,
|
|
35
|
+
"brotliLength": 0,
|
|
36
|
+
"mainUid": "9dec-28"
|
|
37
|
+
},
|
|
38
|
+
"9dec-31": {
|
|
39
|
+
"renderedLength": 68622,
|
|
40
|
+
"gzipLength": 14235,
|
|
41
|
+
"brotliLength": 0,
|
|
42
|
+
"mainUid": "9dec-30"
|
|
43
|
+
},
|
|
44
|
+
"9dec-33": {
|
|
45
|
+
"renderedLength": 11931,
|
|
46
|
+
"gzipLength": 3038,
|
|
47
|
+
"brotliLength": 0,
|
|
48
|
+
"mainUid": "9dec-32"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"nodeMetas": {
|
|
52
|
+
"9dec-28": {
|
|
53
|
+
"id": "\u0000rollupPluginBabelHelpers.js",
|
|
54
|
+
"moduleParts": {
|
|
55
|
+
"index.production.js": "9dec-29"
|
|
56
|
+
},
|
|
57
|
+
"imported": [],
|
|
58
|
+
"importedBy": [
|
|
59
|
+
{
|
|
60
|
+
"uid": "9dec-32"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"9dec-30": {
|
|
65
|
+
"id": "/packages/router-core/build/esm/index.js",
|
|
66
|
+
"moduleParts": {
|
|
67
|
+
"index.production.js": "9dec-31"
|
|
68
|
+
},
|
|
69
|
+
"imported": [],
|
|
70
|
+
"importedBy": [
|
|
71
|
+
{
|
|
72
|
+
"uid": "9dec-32"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"9dec-32": {
|
|
77
|
+
"id": "/packages/react-router/src/index.tsx",
|
|
78
|
+
"moduleParts": {
|
|
79
|
+
"index.production.js": "9dec-33"
|
|
80
|
+
},
|
|
81
|
+
"imported": [
|
|
82
|
+
{
|
|
83
|
+
"uid": "9dec-28"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"uid": "9dec-34"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"uid": "9dec-35"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"uid": "9dec-30"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"importedBy": [],
|
|
96
|
+
"isEntry": true
|
|
97
|
+
},
|
|
98
|
+
"9dec-34": {
|
|
99
|
+
"id": "react",
|
|
100
|
+
"moduleParts": {},
|
|
101
|
+
"imported": [],
|
|
102
|
+
"importedBy": [
|
|
103
|
+
{
|
|
104
|
+
"uid": "9dec-32"
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"isExternal": true
|
|
108
|
+
},
|
|
109
|
+
"9dec-35": {
|
|
110
|
+
"id": "use-sync-external-store/shim",
|
|
111
|
+
"moduleParts": {},
|
|
112
|
+
"imported": [],
|
|
113
|
+
"importedBy": [
|
|
114
|
+
{
|
|
115
|
+
"uid": "9dec-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
|
+
}
|
|
File without changes
|
|
@@ -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 };
|