@tanstack/router-core 0.0.1-beta.2 → 0.0.1-beta.201
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/defer.js +39 -0
- package/build/cjs/defer.js.map +1 -0
- package/build/cjs/fileRoute.js +29 -0
- package/build/cjs/fileRoute.js.map +1 -0
- package/build/cjs/index.js +89 -0
- package/build/cjs/{packages/router-core/src/index.js.map → index.js.map} +1 -1
- package/build/cjs/{packages/router-core/src/path.js → path.js} +45 -56
- package/build/cjs/path.js.map +1 -0
- package/build/cjs/{packages/router-core/src/qss.js → qss.js} +10 -15
- package/build/cjs/qss.js.map +1 -0
- package/build/cjs/route.js +114 -0
- package/build/cjs/route.js.map +1 -0
- package/build/cjs/router.js +1277 -0
- package/build/cjs/router.js.map +1 -0
- package/build/cjs/scroll-restoration.js +139 -0
- package/build/cjs/scroll-restoration.js.map +1 -0
- package/build/cjs/{packages/router-core/src/searchParams.js → searchParams.js} +32 -19
- package/build/cjs/searchParams.js.map +1 -0
- package/build/cjs/utils.js +132 -0
- package/build/cjs/utils.js.map +1 -0
- package/build/esm/index.js +1565 -2106
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +59 -49
- package/build/stats-react.json +219 -241
- package/build/types/defer.d.ts +19 -0
- package/build/types/fileRoute.d.ts +35 -0
- package/build/types/index.d.ts +13 -611
- package/build/types/link.d.ts +96 -0
- package/build/types/path.d.ts +16 -0
- package/build/types/qss.d.ts +2 -0
- package/build/types/route.d.ts +261 -0
- package/build/types/routeInfo.d.ts +22 -0
- package/build/types/router.d.ts +265 -0
- package/build/types/scroll-restoration.d.ts +6 -0
- package/build/types/searchParams.d.ts +5 -0
- package/build/types/utils.d.ts +51 -0
- package/build/umd/index.development.js +1917 -2070
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +23 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +13 -7
- package/src/defer.ts +55 -0
- package/src/fileRoute.ts +156 -0
- package/src/index.ts +5 -11
- package/src/link.ts +149 -123
- package/src/path.ts +37 -17
- package/src/qss.ts +1 -1
- package/src/route.ts +861 -231
- package/src/routeInfo.ts +47 -205
- package/src/router.ts +1818 -952
- package/src/scroll-restoration.ts +179 -0
- package/src/searchParams.ts +31 -9
- package/src/utils.ts +106 -43
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -33
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/build/cjs/node_modules/@babel/runtime/helpers/esm/extends.js +0 -33
- package/build/cjs/node_modules/@babel/runtime/helpers/esm/extends.js.map +0 -1
- package/build/cjs/node_modules/history/index.js +0 -815
- package/build/cjs/node_modules/history/index.js.map +0 -1
- package/build/cjs/node_modules/tiny-invariant/dist/esm/tiny-invariant.js +0 -30
- package/build/cjs/node_modules/tiny-invariant/dist/esm/tiny-invariant.js.map +0 -1
- package/build/cjs/packages/router-core/src/index.js +0 -58
- package/build/cjs/packages/router-core/src/path.js.map +0 -1
- package/build/cjs/packages/router-core/src/qss.js.map +0 -1
- package/build/cjs/packages/router-core/src/route.js +0 -161
- package/build/cjs/packages/router-core/src/route.js.map +0 -1
- package/build/cjs/packages/router-core/src/routeConfig.js +0 -69
- package/build/cjs/packages/router-core/src/routeConfig.js.map +0 -1
- package/build/cjs/packages/router-core/src/routeMatch.js +0 -266
- package/build/cjs/packages/router-core/src/routeMatch.js.map +0 -1
- package/build/cjs/packages/router-core/src/router.js +0 -789
- package/build/cjs/packages/router-core/src/router.js.map +0 -1
- package/build/cjs/packages/router-core/src/searchParams.js.map +0 -1
- package/build/cjs/packages/router-core/src/utils.js +0 -118
- package/build/cjs/packages/router-core/src/utils.js.map +0 -1
- package/src/frameworks.ts +0 -12
- package/src/routeConfig.ts +0 -495
- package/src/routeMatch.ts +0 -374
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type DeferredPromiseState<T> = {
|
|
2
|
+
uid: string;
|
|
3
|
+
} & ({
|
|
4
|
+
status: 'pending';
|
|
5
|
+
data?: T;
|
|
6
|
+
error?: unknown;
|
|
7
|
+
} | {
|
|
8
|
+
status: 'success';
|
|
9
|
+
data: T;
|
|
10
|
+
} | {
|
|
11
|
+
status: 'error';
|
|
12
|
+
data?: T;
|
|
13
|
+
error: unknown;
|
|
14
|
+
});
|
|
15
|
+
export type DeferredPromise<T> = Promise<T> & {
|
|
16
|
+
__deferredState: DeferredPromiseState<T>;
|
|
17
|
+
};
|
|
18
|
+
export declare function defer<T>(_promise: Promise<T>): DeferredPromise<T>;
|
|
19
|
+
export declare function isDehydratedDeferred(obj: any): boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AnyRoute, ResolveFullPath, RouteContext, AnyContext, RouteOptions, InferFullSearchSchema, UpdatableRouteOptions, Route, AnyPathParams, RootRouteId, TrimPathLeft, RouteConstraints } from './route';
|
|
2
|
+
import { Expand, IsAny } from './utils';
|
|
3
|
+
export interface FileRoutesByPath {
|
|
4
|
+
}
|
|
5
|
+
type Replace<S extends string, From extends string, To extends string> = S extends `${infer Start}${From}${infer Rest}` ? `${Start}${To}${Replace<Rest, From, To>}` : S;
|
|
6
|
+
export type TrimLeft<T extends string, S extends string> = T extends `${S}${infer U}` ? U : T;
|
|
7
|
+
export type TrimRight<T extends string, S extends string> = T extends `${infer U}${S}` ? U : T;
|
|
8
|
+
export type Trim<T extends string, S extends string> = TrimLeft<TrimRight<T, S>, S>;
|
|
9
|
+
export type RemoveUnderScores<T extends string> = Replace<Replace<TrimRight<TrimLeft<T, '/_'>, '_'>, '_/', '/'>, '/_', '/'>;
|
|
10
|
+
export type ResolveFilePath<TParentRoute extends AnyRoute, TFilePath extends string> = TParentRoute['id'] extends RootRouteId ? TrimPathLeft<TFilePath> : Replace<TrimPathLeft<TFilePath>, TrimPathLeft<TParentRoute['types']['customId']>, ''>;
|
|
11
|
+
export type FileRoutePath<TParentRoute extends AnyRoute, TFilePath extends string> = ResolveFilePath<TParentRoute, TFilePath> extends `_${infer _}` ? string : ResolveFilePath<TParentRoute, TFilePath>;
|
|
12
|
+
export declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TId extends RouteConstraints['TId'] = TFilePath, TPath extends RouteConstraints['TPath'] = FileRoutePath<TParentRoute, TFilePath>, TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, RemoveUnderScores<TPath>>> {
|
|
13
|
+
path: TFilePath;
|
|
14
|
+
constructor(path: TFilePath);
|
|
15
|
+
createRoute: <TLoaderContext extends Record<string, any> = {}, TLoader = unknown, TSearchSchema extends import("./route").AnySearchSchema = {}, TFullSearchSchema extends import("./route").AnySearchSchema = Expand<import("./utils").DeepMerge<InferFullSearchSchema<TParentRoute>, TSearchSchema>>, TParams extends Record<string, any> = (TrimLeft<TrimRight<import("./link").Split<TPath, true>[number], "_">, "_"> extends infer T ? T extends TrimLeft<TrimRight<import("./link").Split<TPath, true>[number], "_">, "_"> ? T extends `$${infer L}` ? L : never : never : never) extends never ? AnyPathParams : Record<TrimLeft<TrimRight<import("./link").Split<TPath, true>[number], "_">, "_"> extends infer T ? T extends TrimLeft<TrimRight<import("./link").Split<TPath, true>[number], "_">, "_"> ? T extends `$${infer L}` ? L : never : never : never, string>, TAllParams extends Record<string, any> = IsAny<TParentRoute["types"]["allParams"], TParams, TParentRoute["types"]["allParams"] & TParams>, TRouteContext extends RouteContext = RouteContext, TContext extends AnyContext = Expand<import("./utils").DeepMerge<IsAny<TParentRoute["types"]["context"], {}, TParentRoute["types"]["context"]>, import("./utils").DeepMerge<TLoaderContext, import("./utils").DeepMerge<TRouteContext, {}>>>>, TRouterContext extends AnyContext = AnyContext, TChildren extends unknown = unknown, TRouteTree extends AnyRoute = AnyRoute>(options: Omit<RouteOptions<TParentRoute, string, string, TLoaderContext, TLoader, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TContext>, "id" | "path" | "getParentRoute"> & {
|
|
16
|
+
meta?: import("./route").RouteMeta | undefined;
|
|
17
|
+
} & {
|
|
18
|
+
caseSensitive?: boolean | undefined;
|
|
19
|
+
wrapInSuspense?: boolean | undefined;
|
|
20
|
+
component?: (() => unknown) | undefined;
|
|
21
|
+
errorComponent?: (() => unknown) | undefined;
|
|
22
|
+
pendingComponent?: (() => unknown) | undefined;
|
|
23
|
+
preSearchFilters?: import("./route").SearchFilter<TFullSearchSchema, TFullSearchSchema>[] | undefined;
|
|
24
|
+
postSearchFilters?: import("./route").SearchFilter<TFullSearchSchema, TFullSearchSchema>[] | undefined;
|
|
25
|
+
preloadMaxAge?: number | undefined;
|
|
26
|
+
maxAge?: number | undefined;
|
|
27
|
+
gcMaxAge?: number | undefined;
|
|
28
|
+
onError?: ((err: any) => void) | undefined;
|
|
29
|
+
onEnter?: ((match: import("./router").AnyRouteMatch) => void) | undefined;
|
|
30
|
+
onTransition?: ((match: import("./router").AnyRouteMatch) => void) | undefined;
|
|
31
|
+
onLeave?: ((match: import("./router").AnyRouteMatch) => void) | undefined;
|
|
32
|
+
reloadOnWindowFocus?: boolean | undefined;
|
|
33
|
+
}) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TLoaderContext, TLoader, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TRouteContext, TContext, TRouterContext, TChildren, TRouteTree>;
|
|
34
|
+
}
|
|
35
|
+
export {};
|