@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.
Files changed (79) hide show
  1. package/LICENSE +21 -0
  2. package/build/cjs/defer.js +39 -0
  3. package/build/cjs/defer.js.map +1 -0
  4. package/build/cjs/fileRoute.js +29 -0
  5. package/build/cjs/fileRoute.js.map +1 -0
  6. package/build/cjs/index.js +89 -0
  7. package/build/cjs/{packages/router-core/src/index.js.map → index.js.map} +1 -1
  8. package/build/cjs/{packages/router-core/src/path.js → path.js} +45 -56
  9. package/build/cjs/path.js.map +1 -0
  10. package/build/cjs/{packages/router-core/src/qss.js → qss.js} +10 -15
  11. package/build/cjs/qss.js.map +1 -0
  12. package/build/cjs/route.js +114 -0
  13. package/build/cjs/route.js.map +1 -0
  14. package/build/cjs/router.js +1277 -0
  15. package/build/cjs/router.js.map +1 -0
  16. package/build/cjs/scroll-restoration.js +139 -0
  17. package/build/cjs/scroll-restoration.js.map +1 -0
  18. package/build/cjs/{packages/router-core/src/searchParams.js → searchParams.js} +32 -19
  19. package/build/cjs/searchParams.js.map +1 -0
  20. package/build/cjs/utils.js +132 -0
  21. package/build/cjs/utils.js.map +1 -0
  22. package/build/esm/index.js +1565 -2106
  23. package/build/esm/index.js.map +1 -1
  24. package/build/stats-html.html +59 -49
  25. package/build/stats-react.json +219 -241
  26. package/build/types/defer.d.ts +19 -0
  27. package/build/types/fileRoute.d.ts +35 -0
  28. package/build/types/index.d.ts +13 -611
  29. package/build/types/link.d.ts +96 -0
  30. package/build/types/path.d.ts +16 -0
  31. package/build/types/qss.d.ts +2 -0
  32. package/build/types/route.d.ts +261 -0
  33. package/build/types/routeInfo.d.ts +22 -0
  34. package/build/types/router.d.ts +265 -0
  35. package/build/types/scroll-restoration.d.ts +6 -0
  36. package/build/types/searchParams.d.ts +5 -0
  37. package/build/types/utils.d.ts +51 -0
  38. package/build/umd/index.development.js +1917 -2070
  39. package/build/umd/index.development.js.map +1 -1
  40. package/build/umd/index.production.js +23 -2
  41. package/build/umd/index.production.js.map +1 -1
  42. package/package.json +13 -7
  43. package/src/defer.ts +55 -0
  44. package/src/fileRoute.ts +156 -0
  45. package/src/index.ts +5 -11
  46. package/src/link.ts +149 -123
  47. package/src/path.ts +37 -17
  48. package/src/qss.ts +1 -1
  49. package/src/route.ts +861 -231
  50. package/src/routeInfo.ts +47 -205
  51. package/src/router.ts +1818 -952
  52. package/src/scroll-restoration.ts +179 -0
  53. package/src/searchParams.ts +31 -9
  54. package/src/utils.ts +106 -43
  55. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -33
  56. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
  57. package/build/cjs/node_modules/@babel/runtime/helpers/esm/extends.js +0 -33
  58. package/build/cjs/node_modules/@babel/runtime/helpers/esm/extends.js.map +0 -1
  59. package/build/cjs/node_modules/history/index.js +0 -815
  60. package/build/cjs/node_modules/history/index.js.map +0 -1
  61. package/build/cjs/node_modules/tiny-invariant/dist/esm/tiny-invariant.js +0 -30
  62. package/build/cjs/node_modules/tiny-invariant/dist/esm/tiny-invariant.js.map +0 -1
  63. package/build/cjs/packages/router-core/src/index.js +0 -58
  64. package/build/cjs/packages/router-core/src/path.js.map +0 -1
  65. package/build/cjs/packages/router-core/src/qss.js.map +0 -1
  66. package/build/cjs/packages/router-core/src/route.js +0 -161
  67. package/build/cjs/packages/router-core/src/route.js.map +0 -1
  68. package/build/cjs/packages/router-core/src/routeConfig.js +0 -69
  69. package/build/cjs/packages/router-core/src/routeConfig.js.map +0 -1
  70. package/build/cjs/packages/router-core/src/routeMatch.js +0 -266
  71. package/build/cjs/packages/router-core/src/routeMatch.js.map +0 -1
  72. package/build/cjs/packages/router-core/src/router.js +0 -789
  73. package/build/cjs/packages/router-core/src/router.js.map +0 -1
  74. package/build/cjs/packages/router-core/src/searchParams.js.map +0 -1
  75. package/build/cjs/packages/router-core/src/utils.js +0 -118
  76. package/build/cjs/packages/router-core/src/utils.js.map +0 -1
  77. package/src/frameworks.ts +0 -12
  78. package/src/routeConfig.ts +0 -495
  79. 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 {};