@tanstack/react-router 0.0.1-beta.219 → 0.0.1-beta.220
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/Matches.js.map +1 -1
- package/build/cjs/RouterProvider.js +51 -17
- package/build/cjs/RouterProvider.js.map +1 -1
- package/build/cjs/awaited.js +45 -0
- package/build/cjs/awaited.js.map +1 -0
- package/build/cjs/defer.js +39 -0
- package/build/cjs/defer.js.map +1 -0
- package/build/cjs/index.js +7 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/router.js +0 -43
- package/build/cjs/router.js.map +1 -1
- package/build/cjs/utils.js +6 -0
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +602 -559
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +392 -329
- package/build/types/RouterProvider.d.ts +5 -0
- package/build/types/awaited.d.ts +8 -0
- package/build/types/defer.d.ts +19 -0
- package/build/types/index.d.ts +2 -0
- package/build/types/utils.d.ts +1 -0
- package/build/umd/index.development.js +606 -558
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/Matches.tsx +1 -1
- package/src/RouterProvider.tsx +85 -24
- package/src/awaited.tsx +40 -40
- package/src/defer.ts +48 -48
- package/src/index.tsx +2 -2
- package/src/router.ts +0 -50
- package/src/utils.ts +7 -0
|
@@ -27,6 +27,7 @@ export type LoadFn = (opts?: {
|
|
|
27
27
|
__dehydratedMatches?: DehydratedRouteMatch[];
|
|
28
28
|
}) => Promise<void>;
|
|
29
29
|
export type BuildLocationFn<TRouteTree extends AnyRoute> = (opts: BuildNextOptions) => ParsedLocation;
|
|
30
|
+
export type InjectedHtmlEntry = string | (() => Promise<string> | string);
|
|
30
31
|
export type RouterContext<TRouteTree extends AnyRoute> = {
|
|
31
32
|
buildLink: BuildLinkFn<TRouteTree>;
|
|
32
33
|
state: RouterState<TRouteTree>;
|
|
@@ -40,6 +41,10 @@ export type RouterContext<TRouteTree extends AnyRoute> = {
|
|
|
40
41
|
buildLocation: BuildLocationFn<TRouteTree>;
|
|
41
42
|
subscribe: Router<TRouteTree>['subscribe'];
|
|
42
43
|
resetNextScrollRef: React.MutableRefObject<boolean>;
|
|
44
|
+
injectedHtmlRef: React.MutableRefObject<InjectedHtmlEntry[]>;
|
|
45
|
+
injectHtml: (entry: InjectedHtmlEntry) => void;
|
|
46
|
+
dehydrateData: <T>(key: any, getData: T | (() => Promise<T> | T)) => () => void;
|
|
47
|
+
hydrateData: <T>(key: any) => T | undefined;
|
|
43
48
|
};
|
|
44
49
|
export declare const routerContext: React.Context<RouterContext<any>>;
|
|
45
50
|
export declare class SearchParamError extends Error {
|
package/build/types/awaited.d.ts
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DeferredPromise } from './defer';
|
|
2
|
+
export type AwaitOptions<T> = {
|
|
3
|
+
promise: DeferredPromise<T>;
|
|
4
|
+
};
|
|
5
|
+
export declare function useAwaited<T>({ promise }: AwaitOptions<T>): [T];
|
|
6
|
+
export declare function Await<T>(props: AwaitOptions<T> & {
|
|
7
|
+
children: (result: T) => JSX.Element;
|
|
8
|
+
}): JSX.Element;
|
package/build/types/defer.d.ts
CHANGED
|
@@ -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;
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from '@tanstack/history';
|
|
2
2
|
export { default as invariant } from 'tiny-invariant';
|
|
3
3
|
export { default as warning } from 'tiny-warning';
|
|
4
|
+
export * from './awaited';
|
|
5
|
+
export * from './defer';
|
|
4
6
|
export * from './CatchBoundary';
|
|
5
7
|
export * from './fileRoute';
|
|
6
8
|
export * from './history';
|
package/build/types/utils.d.ts
CHANGED
|
@@ -63,3 +63,4 @@ export declare function useRouteContext<TRouteTree extends AnyRoute = Registered
|
|
|
63
63
|
select?: (search: TRouteContext) => TSelected;
|
|
64
64
|
}): TStrict extends true ? TSelected : TSelected | undefined;
|
|
65
65
|
export declare const useLayoutEffect: typeof React.useLayoutEffect;
|
|
66
|
+
export declare function escapeJSON(jsonString: string): string;
|