@fluojs/react 0.1.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/LICENSE +21 -0
- package/README.ko.md +715 -0
- package/README.md +729 -0
- package/dist/client/errors.d.ts +12 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/errors.js +19 -0
- package/dist/client/hooks.d.ts +38 -0
- package/dist/client/hooks.d.ts.map +1 -0
- package/dist/client/hooks.js +56 -0
- package/dist/client/link.d.ts +13 -0
- package/dist/client/link.d.ts.map +1 -0
- package/dist/client/link.js +39 -0
- package/dist/client/provider.d.ts +12 -0
- package/dist/client/provider.d.ts.map +1 -0
- package/dist/client/provider.js +54 -0
- package/dist/client/search-params.d.ts +17 -0
- package/dist/client/search-params.d.ts.map +1 -0
- package/dist/client/search-params.js +39 -0
- package/dist/client/snapshot.d.ts +15 -0
- package/dist/client/snapshot.d.ts.map +1 -0
- package/dist/client/snapshot.js +57 -0
- package/dist/client/store.d.ts +26 -0
- package/dist/client/store.d.ts.map +1 -0
- package/dist/client/store.js +138 -0
- package/dist/client/types.d.ts +63 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +1 -0
- package/dist/client.d.ts +9 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +5 -0
- package/dist/decorators.d.ts +80 -0
- package/dist/decorators.d.ts.map +1 -0
- package/dist/decorators.js +194 -0
- package/dist/experimental/rsc-diagnostics.d.ts +13 -0
- package/dist/experimental/rsc-diagnostics.d.ts.map +1 -0
- package/dist/experimental/rsc-diagnostics.js +58 -0
- package/dist/experimental/rsc-flight-response.d.ts +15 -0
- package/dist/experimental/rsc-flight-response.d.ts.map +1 -0
- package/dist/experimental/rsc-flight-response.js +76 -0
- package/dist/experimental/rsc-manifest.d.ts +13 -0
- package/dist/experimental/rsc-manifest.d.ts.map +1 -0
- package/dist/experimental/rsc-manifest.js +88 -0
- package/dist/experimental/rsc-types.d.ts +118 -0
- package/dist/experimental/rsc-types.d.ts.map +1 -0
- package/dist/experimental/rsc-types.js +50 -0
- package/dist/experimental/rsc.d.ts +11 -0
- package/dist/experimental/rsc.d.ts.map +1 -0
- package/dist/experimental/rsc.js +8 -0
- package/dist/experimental/server-functions-client.d.ts +14 -0
- package/dist/experimental/server-functions-client.d.ts.map +1 -0
- package/dist/experimental/server-functions-client.js +120 -0
- package/dist/experimental/server-functions-configuration.d.ts +17 -0
- package/dist/experimental/server-functions-configuration.d.ts.map +1 -0
- package/dist/experimental/server-functions-configuration.js +68 -0
- package/dist/experimental/server-functions-errors.d.ts +19 -0
- package/dist/experimental/server-functions-errors.d.ts.map +1 -0
- package/dist/experimental/server-functions-errors.js +22 -0
- package/dist/experimental/server-functions-reference.d.ts +22 -0
- package/dist/experimental/server-functions-reference.d.ts.map +1 -0
- package/dist/experimental/server-functions-reference.js +76 -0
- package/dist/experimental/server-functions-serialization.d.ts +37 -0
- package/dist/experimental/server-functions-serialization.d.ts.map +1 -0
- package/dist/experimental/server-functions-serialization.js +158 -0
- package/dist/experimental/server-functions-server.d.ts +14 -0
- package/dist/experimental/server-functions-server.d.ts.map +1 -0
- package/dist/experimental/server-functions-server.js +176 -0
- package/dist/experimental/server-functions-types.d.ts +86 -0
- package/dist/experimental/server-functions-types.d.ts.map +1 -0
- package/dist/experimental/server-functions-types.js +35 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/module.d.ts +40 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +58 -0
- package/dist/render-stream.d.ts +27 -0
- package/dist/render-stream.d.ts.map +1 -0
- package/dist/render-stream.js +135 -0
- package/dist/render.d.ts +50 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +201 -0
- package/dist/server-entry.d.ts +87 -0
- package/dist/server-entry.d.ts.map +1 -0
- package/dist/server-entry.js +126 -0
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/vite/asset-utils.d.ts +57 -0
- package/dist/vite/asset-utils.d.ts.map +1 -0
- package/dist/vite/asset-utils.js +184 -0
- package/dist/vite/create-asset-manifest.d.ts +9 -0
- package/dist/vite/create-asset-manifest.d.ts.map +1 -0
- package/dist/vite/create-asset-manifest.js +127 -0
- package/dist/vite/diagnostics.d.ts +27 -0
- package/dist/vite/diagnostics.d.ts.map +1 -0
- package/dist/vite/diagnostics.js +47 -0
- package/dist/vite/parse-manifest.d.ts +18 -0
- package/dist/vite/parse-manifest.d.ts.map +1 -0
- package/dist/vite/parse-manifest.js +168 -0
- package/dist/vite/types.d.ts +187 -0
- package/dist/vite/types.d.ts.map +1 -0
- package/dist/vite/types.js +59 -0
- package/dist/vite.d.ts +3 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Error codes emitted when browser navigation cannot honor the client router contract. */
|
|
2
|
+
export type ReactClientNavigationErrorCode = 'browser-unavailable' | 'unsupported-destination';
|
|
3
|
+
/** Typed client navigation failure with a stable machine-readable code. */
|
|
4
|
+
export declare class ReactClientNavigationError extends Error {
|
|
5
|
+
readonly code: ReactClientNavigationErrorCode;
|
|
6
|
+
constructor(code: ReactClientNavigationErrorCode, message: string);
|
|
7
|
+
}
|
|
8
|
+
/** Error thrown when route hooks are rendered without a client router provider. */
|
|
9
|
+
export declare class ReactClientRouterContextError extends Error {
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/client/errors.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,MAAM,8BAA8B,GAAG,qBAAqB,GAAG,yBAAyB,CAAC;AAE/F,2EAA2E;AAC3E,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,IAAI,EAAE,8BAA8B,CAAC;gBAElC,IAAI,EAAE,8BAA8B,EAAE,OAAO,EAAE,MAAM;CAKlE;AAED,mFAAmF;AACnF,qBAAa,6BAA8B,SAAQ,KAAK;;CAKvD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Error codes emitted when browser navigation cannot honor the client router contract. */
|
|
2
|
+
|
|
3
|
+
/** Typed client navigation failure with a stable machine-readable code. */
|
|
4
|
+
export class ReactClientNavigationError extends Error {
|
|
5
|
+
code;
|
|
6
|
+
constructor(code, message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.name = 'ReactClientNavigationError';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Error thrown when route hooks are rendered without a client router provider. */
|
|
14
|
+
export class ReactClientRouterContextError extends Error {
|
|
15
|
+
constructor() {
|
|
16
|
+
super('React client route hooks require ReactClientRouterProvider.');
|
|
17
|
+
this.name = 'ReactClientRouterContextError';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ReactNavigationSnapshot, ReactReadonlySearchParams, ReactRouter, ReactRouteSnapshot } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Read the router operations bound to the hydrated browser document.
|
|
4
|
+
*
|
|
5
|
+
* @returns Router operations for full-document navigation and history traversal.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useRouter(): ReactRouter;
|
|
8
|
+
/**
|
|
9
|
+
* Read the current HTTP route pathname and subscribe to history updates.
|
|
10
|
+
*
|
|
11
|
+
* @returns The pathname from the current immutable route snapshot.
|
|
12
|
+
*/
|
|
13
|
+
export declare function usePathname(): string;
|
|
14
|
+
/**
|
|
15
|
+
* Read the path params supplied by the latest server-owned HTTP route match.
|
|
16
|
+
*
|
|
17
|
+
* @returns The server-matched path parameter snapshot.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useParams(): Readonly<Record<string, string>>;
|
|
20
|
+
/**
|
|
21
|
+
* Read an immutable search parameter snapshot and subscribe to history updates.
|
|
22
|
+
*
|
|
23
|
+
* @returns Read-only search parameters from the current route snapshot.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useSearchParams(): ReactReadonlySearchParams;
|
|
26
|
+
/**
|
|
27
|
+
* Read the current navigation lifecycle state.
|
|
28
|
+
*
|
|
29
|
+
* @returns The current navigation status, type, and optional destination.
|
|
30
|
+
*/
|
|
31
|
+
export declare function useNavigation(): ReactNavigationSnapshot;
|
|
32
|
+
/**
|
|
33
|
+
* Read the complete route-state snapshot for the active HTTP document.
|
|
34
|
+
*
|
|
35
|
+
* @returns The immutable route snapshot shared by the provider.
|
|
36
|
+
*/
|
|
37
|
+
export declare function useRouterState(): ReactRouteSnapshot;
|
|
38
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/client/hooks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACvB,yBAAyB,EACzB,WAAW,EACX,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,WAAW,CAEvC;AAED;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,yBAAyB,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,uBAAuB,CAEvD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,kBAAkB,CAGnD"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useSyncExternalStore } from 'react';
|
|
2
|
+
import { useClientNavigationStore } from './provider.js';
|
|
3
|
+
/**
|
|
4
|
+
* Read the router operations bound to the hydrated browser document.
|
|
5
|
+
*
|
|
6
|
+
* @returns Router operations for full-document navigation and history traversal.
|
|
7
|
+
*/
|
|
8
|
+
export function useRouter() {
|
|
9
|
+
return useClientNavigationStore().router;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Read the current HTTP route pathname and subscribe to history updates.
|
|
14
|
+
*
|
|
15
|
+
* @returns The pathname from the current immutable route snapshot.
|
|
16
|
+
*/
|
|
17
|
+
export function usePathname() {
|
|
18
|
+
return useRouterState().pathname;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Read the path params supplied by the latest server-owned HTTP route match.
|
|
23
|
+
*
|
|
24
|
+
* @returns The server-matched path parameter snapshot.
|
|
25
|
+
*/
|
|
26
|
+
export function useParams() {
|
|
27
|
+
return useRouterState().params;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Read an immutable search parameter snapshot and subscribe to history updates.
|
|
32
|
+
*
|
|
33
|
+
* @returns Read-only search parameters from the current route snapshot.
|
|
34
|
+
*/
|
|
35
|
+
export function useSearchParams() {
|
|
36
|
+
return useRouterState().searchParams;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Read the current navigation lifecycle state.
|
|
41
|
+
*
|
|
42
|
+
* @returns The current navigation status, type, and optional destination.
|
|
43
|
+
*/
|
|
44
|
+
export function useNavigation() {
|
|
45
|
+
return useRouterState().navigation;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Read the complete route-state snapshot for the active HTTP document.
|
|
50
|
+
*
|
|
51
|
+
* @returns The immutable route snapshot shared by the provider.
|
|
52
|
+
*/
|
|
53
|
+
export function useRouterState() {
|
|
54
|
+
const store = useClientNavigationStore();
|
|
55
|
+
return useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
56
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type AnchorHTMLAttributes, type ReactElement } from 'react';
|
|
2
|
+
/** Props accepted by the progressive-enhancement-friendly client navigation anchor. */
|
|
3
|
+
export type LinkProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & {
|
|
4
|
+
readonly href: string | URL;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Render a real anchor that upgrades same-origin primary clicks after hydration.
|
|
8
|
+
*
|
|
9
|
+
* @param props Anchor props plus a required navigation destination.
|
|
10
|
+
* @returns A semantic anchor that falls back to ordinary document navigation without JavaScript.
|
|
11
|
+
*/
|
|
12
|
+
export declare function Link({ children, href, onClick, target, ...anchorProps }: LinkProps): ReactElement;
|
|
13
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/client/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,oBAAoB,EAAmB,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrG,uFAAuF;AACvF,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,GAAG;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;CAC7B,CAAC;AAMF;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,EAAE,SAAS,GAAG,YAAY,CAsBjG"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createElement } from 'react';
|
|
2
|
+
import { useClientNavigationStore } from './provider.js';
|
|
3
|
+
|
|
4
|
+
/** Props accepted by the progressive-enhancement-friendly client navigation anchor. */
|
|
5
|
+
|
|
6
|
+
function hasNavigationModifier(event) {
|
|
7
|
+
return event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Render a real anchor that upgrades same-origin primary clicks after hydration.
|
|
12
|
+
*
|
|
13
|
+
* @param props Anchor props plus a required navigation destination.
|
|
14
|
+
* @returns A semantic anchor that falls back to ordinary document navigation without JavaScript.
|
|
15
|
+
*/
|
|
16
|
+
export function Link({
|
|
17
|
+
children,
|
|
18
|
+
href,
|
|
19
|
+
onClick,
|
|
20
|
+
target,
|
|
21
|
+
...anchorProps
|
|
22
|
+
}) {
|
|
23
|
+
const store = useClientNavigationStore();
|
|
24
|
+
const hrefValue = String(href);
|
|
25
|
+
const handleClick = event => {
|
|
26
|
+
onClick?.(event);
|
|
27
|
+
if (event.defaultPrevented || event.button !== 0 || hasNavigationModifier(event) || anchorProps.download !== undefined || target !== undefined && target !== '_self' || !store.canHandleLink(href)) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
store.router.push(href);
|
|
32
|
+
};
|
|
33
|
+
return createElement('a', {
|
|
34
|
+
...anchorProps,
|
|
35
|
+
href: hrefValue,
|
|
36
|
+
onClick: handleClick,
|
|
37
|
+
target
|
|
38
|
+
}, children);
|
|
39
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ClientNavigationStore } from './store.js';
|
|
2
|
+
import type { ReactClientRouterProviderProps } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Provide one HTTP request route snapshot to client navigation hooks during SSR and hydration.
|
|
5
|
+
*
|
|
6
|
+
* @param props Initial route snapshot and descendants that consume client route state.
|
|
7
|
+
* @returns A context provider that binds browser navigation only after hydration.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ReactClientRouterProvider({ children, initialSnapshot }: ReactClientRouterProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<ClientNavigationStore | null>>;
|
|
10
|
+
/** Read the provider-owned navigation store for public hooks and `Link`. */
|
|
11
|
+
export declare function useClientNavigationStore(): ClientNavigationStore;
|
|
12
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/client/provider.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,qBAAqB,EAE3B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAC;AAwBjE;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE,8BAA8B,yGAWtG;AAED,4EAA4E;AAC5E,wBAAgB,wBAAwB,IAAI,qBAAqB,CAMhE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createContext, createElement, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import { ReactClientRouterContextError } from './errors.js';
|
|
3
|
+
import { createClientNavigationStore } from './store.js';
|
|
4
|
+
const ClientRouterContext = createContext(null);
|
|
5
|
+
function createBrowserEnvironment(browser) {
|
|
6
|
+
return {
|
|
7
|
+
assign: href => browser.location.assign(href),
|
|
8
|
+
back: () => browser.history.back(),
|
|
9
|
+
currentHref: () => browser.location.href,
|
|
10
|
+
reload: () => browser.location.reload(),
|
|
11
|
+
replace: href => browser.location.replace(href),
|
|
12
|
+
subscribe(listener) {
|
|
13
|
+
const handleHashChange = () => listener('hashchange');
|
|
14
|
+
const handlePopState = () => listener('popstate');
|
|
15
|
+
browser.addEventListener('hashchange', handleHashChange);
|
|
16
|
+
browser.addEventListener('popstate', handlePopState);
|
|
17
|
+
return () => {
|
|
18
|
+
browser.removeEventListener('hashchange', handleHashChange);
|
|
19
|
+
browser.removeEventListener('popstate', handlePopState);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Provide one HTTP request route snapshot to client navigation hooks during SSR and hydration.
|
|
27
|
+
*
|
|
28
|
+
* @param props Initial route snapshot and descendants that consume client route state.
|
|
29
|
+
* @returns A context provider that binds browser navigation only after hydration.
|
|
30
|
+
*/
|
|
31
|
+
export function ReactClientRouterProvider({
|
|
32
|
+
children,
|
|
33
|
+
initialSnapshot
|
|
34
|
+
}) {
|
|
35
|
+
const [store] = useState(() => createClientNavigationStore(initialSnapshot));
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (typeof window === 'undefined') {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
return store.connect(createBrowserEnvironment(window));
|
|
41
|
+
}, [store]);
|
|
42
|
+
return createElement(ClientRouterContext.Provider, {
|
|
43
|
+
value: store
|
|
44
|
+
}, children);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Read the provider-owned navigation store for public hooks and `Link`. */
|
|
48
|
+
export function useClientNavigationStore() {
|
|
49
|
+
const store = useContext(ClientRouterContext);
|
|
50
|
+
if (store === null) {
|
|
51
|
+
throw new ReactClientRouterContextError();
|
|
52
|
+
}
|
|
53
|
+
return store;
|
|
54
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactReadonlySearchParams } from './types.js';
|
|
2
|
+
/** Immutable wrapper around a native `URLSearchParams` snapshot. */
|
|
3
|
+
export declare class ReadonlySearchParams implements ReactReadonlySearchParams {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(search: string);
|
|
6
|
+
get size(): number;
|
|
7
|
+
[Symbol.iterator](): URLSearchParamsIterator<[string, string]>;
|
|
8
|
+
entries(): URLSearchParamsIterator<[string, string]>;
|
|
9
|
+
forEach(callback: (value: string, key: string, searchParams: ReactReadonlySearchParams) => void): void;
|
|
10
|
+
get(name: string): string | null;
|
|
11
|
+
getAll(name: string): string[];
|
|
12
|
+
has(name: string, value?: string): boolean;
|
|
13
|
+
keys(): URLSearchParamsIterator<string>;
|
|
14
|
+
toString(): string;
|
|
15
|
+
values(): URLSearchParamsIterator<string>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=search-params.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-params.d.ts","sourceRoot":"","sources":["../../src/client/search-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAE5D,oEAAoE;AACpE,qBAAa,oBAAqB,YAAW,yBAAyB;;gBAGxD,MAAM,EAAE,MAAM;IAI1B,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,uBAAuB,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAI9D,OAAO,IAAI,uBAAuB,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAIpD,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,yBAAyB,KAAK,IAAI,GAAG,IAAI;IAMtG,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIhC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE;IAI9B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO;IAI1C,IAAI,IAAI,uBAAuB,CAAC,MAAM,CAAC;IAIvC,QAAQ,IAAI,MAAM;IAIlB,MAAM,IAAI,uBAAuB,CAAC,MAAM,CAAC;CAG1C"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Immutable wrapper around a native `URLSearchParams` snapshot. */
|
|
2
|
+
export class ReadonlySearchParams {
|
|
3
|
+
#searchParams;
|
|
4
|
+
constructor(search) {
|
|
5
|
+
this.#searchParams = new URLSearchParams(search);
|
|
6
|
+
}
|
|
7
|
+
get size() {
|
|
8
|
+
return this.#searchParams.size;
|
|
9
|
+
}
|
|
10
|
+
[Symbol.iterator]() {
|
|
11
|
+
return this.#searchParams[Symbol.iterator]();
|
|
12
|
+
}
|
|
13
|
+
entries() {
|
|
14
|
+
return this.#searchParams.entries();
|
|
15
|
+
}
|
|
16
|
+
forEach(callback) {
|
|
17
|
+
this.#searchParams.forEach((value, key) => {
|
|
18
|
+
callback(value, key, this);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
get(name) {
|
|
22
|
+
return this.#searchParams.get(name);
|
|
23
|
+
}
|
|
24
|
+
getAll(name) {
|
|
25
|
+
return this.#searchParams.getAll(name);
|
|
26
|
+
}
|
|
27
|
+
has(name, value) {
|
|
28
|
+
return value === undefined ? this.#searchParams.has(name) : this.#searchParams.has(name, value);
|
|
29
|
+
}
|
|
30
|
+
keys() {
|
|
31
|
+
return this.#searchParams.keys();
|
|
32
|
+
}
|
|
33
|
+
toString() {
|
|
34
|
+
return this.#searchParams.toString();
|
|
35
|
+
}
|
|
36
|
+
values() {
|
|
37
|
+
return this.#searchParams.values();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNavigationSnapshot, ReactRouteSnapshot, ReactRouteSnapshotInput } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a defensive route-state snapshot from an HTTP request URL and matched path params.
|
|
4
|
+
*
|
|
5
|
+
* @param input Request-owned URL and matched path params shared with hydration.
|
|
6
|
+
* @returns An immutable URL snapshot suitable for `ReactClientRouterProvider`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createReactRouteSnapshot(input: ReactRouteSnapshotInput): ReactRouteSnapshot;
|
|
9
|
+
/** Rebuild a route snapshot after browser history activates a URL. */
|
|
10
|
+
export declare function createSnapshotFromHref(href: string, params: Readonly<Record<string, string>>, navigation: ReactNavigationSnapshot): ReactRouteSnapshot;
|
|
11
|
+
/** Preserve route URL state while producing a new navigation lifecycle snapshot. */
|
|
12
|
+
export declare function createSnapshotWithNavigation(snapshot: ReactRouteSnapshot, navigation: ReactNavigationSnapshot): ReactRouteSnapshot;
|
|
13
|
+
/** Normalize an absolute browser URL to the request-relative route snapshot form. */
|
|
14
|
+
export declare function toSnapshotUrl(href: string): string;
|
|
15
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/client/snapshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AASpB;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,uBAAuB,GAAG,kBAAkB,CAW3F;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACxC,UAAU,EAAE,uBAAuB,GAClC,kBAAkB,CAWpB;AAED,oFAAoF;AACpF,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,kBAAkB,EAC5B,UAAU,EAAE,uBAAuB,GAClC,kBAAkB,CAEpB;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ReadonlySearchParams } from './search-params.js';
|
|
2
|
+
const ROUTE_SNAPSHOT_BASE_URL = 'https://fluo.invalid/';
|
|
3
|
+
const IDLE_NAVIGATION = Object.freeze({
|
|
4
|
+
status: 'idle',
|
|
5
|
+
type: null
|
|
6
|
+
});
|
|
7
|
+
function toRouteUrl(url) {
|
|
8
|
+
return `${url.pathname}${url.search}${url.hash}`;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Create a defensive route-state snapshot from an HTTP request URL and matched path params.
|
|
13
|
+
*
|
|
14
|
+
* @param input Request-owned URL and matched path params shared with hydration.
|
|
15
|
+
* @returns An immutable URL snapshot suitable for `ReactClientRouterProvider`.
|
|
16
|
+
*/
|
|
17
|
+
export function createReactRouteSnapshot(input) {
|
|
18
|
+
const url = new URL(input.url, ROUTE_SNAPSHOT_BASE_URL);
|
|
19
|
+
return Object.freeze({
|
|
20
|
+
hash: url.hash,
|
|
21
|
+
navigation: IDLE_NAVIGATION,
|
|
22
|
+
params: Object.freeze({
|
|
23
|
+
...input.params
|
|
24
|
+
}),
|
|
25
|
+
pathname: url.pathname,
|
|
26
|
+
searchParams: new ReadonlySearchParams(url.search),
|
|
27
|
+
url: toRouteUrl(url)
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Rebuild a route snapshot after browser history activates a URL. */
|
|
32
|
+
export function createSnapshotFromHref(href, params, navigation) {
|
|
33
|
+
const url = new URL(href, ROUTE_SNAPSHOT_BASE_URL);
|
|
34
|
+
return Object.freeze({
|
|
35
|
+
hash: url.hash,
|
|
36
|
+
navigation: Object.freeze(navigation),
|
|
37
|
+
params: Object.freeze({
|
|
38
|
+
...params
|
|
39
|
+
}),
|
|
40
|
+
pathname: url.pathname,
|
|
41
|
+
searchParams: new ReadonlySearchParams(url.search),
|
|
42
|
+
url: toRouteUrl(url)
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Preserve route URL state while producing a new navigation lifecycle snapshot. */
|
|
47
|
+
export function createSnapshotWithNavigation(snapshot, navigation) {
|
|
48
|
+
return Object.freeze({
|
|
49
|
+
...snapshot,
|
|
50
|
+
navigation: Object.freeze(navigation)
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Normalize an absolute browser URL to the request-relative route snapshot form. */
|
|
55
|
+
export function toSnapshotUrl(href) {
|
|
56
|
+
return toRouteUrl(new URL(href));
|
|
57
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ReactRouter, ReactRouteSnapshot } from './types.js';
|
|
2
|
+
/** Browser operations required by the HTTP-first navigation store. */
|
|
3
|
+
export type ClientNavigationEnvironment = {
|
|
4
|
+
readonly assign: (href: string) => void;
|
|
5
|
+
readonly back: () => void;
|
|
6
|
+
readonly currentHref: () => string;
|
|
7
|
+
readonly reload: () => void;
|
|
8
|
+
readonly replace: (href: string) => void;
|
|
9
|
+
readonly subscribe: (listener: (eventType: 'hashchange' | 'popstate') => void) => () => void;
|
|
10
|
+
};
|
|
11
|
+
/** Internal observable store shared by the provider, hooks, and progressive `Link`. */
|
|
12
|
+
export type ClientNavigationStore = {
|
|
13
|
+
readonly canHandleLink: (href: string | URL) => boolean;
|
|
14
|
+
readonly connect: (environment: ClientNavigationEnvironment) => () => void;
|
|
15
|
+
readonly getSnapshot: () => ReactRouteSnapshot;
|
|
16
|
+
readonly router: ReactRouter;
|
|
17
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Create the client navigation store used by `ReactClientRouterProvider`.
|
|
21
|
+
*
|
|
22
|
+
* @param initialSnapshot Request-owned route state used for SSR and hydration.
|
|
23
|
+
* @returns A store whose router delegates rendering and validation to browser HTTP navigation.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createClientNavigationStore(initialSnapshot: ReactRouteSnapshot): ClientNavigationStore;
|
|
26
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/client/store.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAGV,WAAW,EACX,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,sEAAsE;AACtE,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,YAAY,GAAG,UAAU,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;CAC9F,CAAC;AAEF,uFAAuF;AACvF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,KAAK,OAAO,CAAC;IACxD,QAAQ,CAAC,OAAO,EAAE,CAAC,WAAW,EAAE,2BAA2B,KAAK,MAAM,IAAI,CAAC;IAC3E,QAAQ,CAAC,WAAW,EAAE,MAAM,kBAAkB,CAAC;IAC/C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;CAC1D,CAAC;AAgBF;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,eAAe,EAAE,kBAAkB,GAAG,qBAAqB,CAmJtG"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { ReactClientNavigationError } from './errors.js';
|
|
2
|
+
import { createSnapshotFromHref, createSnapshotWithNavigation, toSnapshotUrl } from './snapshot.js';
|
|
3
|
+
|
|
4
|
+
/** Browser operations required by the HTTP-first navigation store. */
|
|
5
|
+
|
|
6
|
+
/** Internal observable store shared by the provider, hooks, and progressive `Link`. */
|
|
7
|
+
|
|
8
|
+
function createNavigationSnapshot(status, type, destination) {
|
|
9
|
+
return destination === undefined ? {
|
|
10
|
+
status,
|
|
11
|
+
type
|
|
12
|
+
} : {
|
|
13
|
+
destination,
|
|
14
|
+
status,
|
|
15
|
+
type
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function isHttpProtocol(protocol) {
|
|
19
|
+
return protocol === 'http:' || protocol === 'https:';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Create the client navigation store used by `ReactClientRouterProvider`.
|
|
24
|
+
*
|
|
25
|
+
* @param initialSnapshot Request-owned route state used for SSR and hydration.
|
|
26
|
+
* @returns A store whose router delegates rendering and validation to browser HTTP navigation.
|
|
27
|
+
*/
|
|
28
|
+
export function createClientNavigationStore(initialSnapshot) {
|
|
29
|
+
let environment = null;
|
|
30
|
+
let snapshot = initialSnapshot;
|
|
31
|
+
const listeners = new Set();
|
|
32
|
+
const publish = nextSnapshot => {
|
|
33
|
+
snapshot = nextSnapshot;
|
|
34
|
+
for (const listener of listeners) {
|
|
35
|
+
listener();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const createSnapshotForHref = (href, navigation) => {
|
|
39
|
+
const pathname = new URL(href).pathname;
|
|
40
|
+
const params = pathname === snapshot.pathname ? snapshot.params : {};
|
|
41
|
+
return createSnapshotFromHref(href, params, navigation);
|
|
42
|
+
};
|
|
43
|
+
const requireEnvironment = () => {
|
|
44
|
+
if (environment === null) {
|
|
45
|
+
throw new ReactClientNavigationError('browser-unavailable', 'React client navigation is unavailable before hydration or outside a browser.');
|
|
46
|
+
}
|
|
47
|
+
return environment;
|
|
48
|
+
};
|
|
49
|
+
const resolveDestination = href => {
|
|
50
|
+
const browser = requireEnvironment();
|
|
51
|
+
const current = new URL(browser.currentHref());
|
|
52
|
+
const destination = new URL(href, current);
|
|
53
|
+
if (!isHttpProtocol(destination.protocol) || destination.origin !== current.origin) {
|
|
54
|
+
throw new ReactClientNavigationError('unsupported-destination', 'useRouter() supports only same-origin HTTP or HTTPS destinations.');
|
|
55
|
+
}
|
|
56
|
+
return destination;
|
|
57
|
+
};
|
|
58
|
+
const navigateDocument = (href, type) => {
|
|
59
|
+
let destination;
|
|
60
|
+
try {
|
|
61
|
+
destination = resolveDestination(href);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
publish(createSnapshotWithNavigation(snapshot, createNavigationSnapshot('error', type, String(href))));
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
const destinationUrl = toSnapshotUrl(destination.href);
|
|
67
|
+
if (destinationUrl === snapshot.url) {
|
|
68
|
+
publish(createSnapshotWithNavigation(snapshot, createNavigationSnapshot('skipped', type, destinationUrl)));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
publish(createSnapshotWithNavigation(snapshot, createNavigationSnapshot('navigating', type, destinationUrl)));
|
|
72
|
+
const browser = requireEnvironment();
|
|
73
|
+
try {
|
|
74
|
+
if (type === 'push') {
|
|
75
|
+
browser.assign(destination.href);
|
|
76
|
+
} else {
|
|
77
|
+
browser.replace(destination.href);
|
|
78
|
+
}
|
|
79
|
+
} catch (error) {
|
|
80
|
+
publish(createSnapshotWithNavigation(snapshot, createNavigationSnapshot('error', type, destinationUrl)));
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const router = Object.freeze({
|
|
85
|
+
back() {
|
|
86
|
+
const browser = requireEnvironment();
|
|
87
|
+
publish(createSnapshotWithNavigation(snapshot, createNavigationSnapshot('navigating', 'back')));
|
|
88
|
+
browser.back();
|
|
89
|
+
},
|
|
90
|
+
push(href) {
|
|
91
|
+
navigateDocument(href, 'push');
|
|
92
|
+
},
|
|
93
|
+
refresh() {
|
|
94
|
+
const browser = requireEnvironment();
|
|
95
|
+
publish(createSnapshotWithNavigation(snapshot, createNavigationSnapshot('refreshing', 'refresh')));
|
|
96
|
+
browser.reload();
|
|
97
|
+
},
|
|
98
|
+
replace(href) {
|
|
99
|
+
navigateDocument(href, 'replace');
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
canHandleLink(href) {
|
|
104
|
+
if (environment === null) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
const current = new URL(environment.currentHref());
|
|
108
|
+
const destination = new URL(href, current);
|
|
109
|
+
return isHttpProtocol(destination.protocol) && destination.origin === current.origin;
|
|
110
|
+
},
|
|
111
|
+
connect(nextEnvironment) {
|
|
112
|
+
environment = nextEnvironment;
|
|
113
|
+
const unsubscribe = nextEnvironment.subscribe(eventType => {
|
|
114
|
+
const currentHref = nextEnvironment.currentHref();
|
|
115
|
+
const currentUrl = toSnapshotUrl(currentHref);
|
|
116
|
+
const navigation = snapshot.navigation;
|
|
117
|
+
const routerNavigationType = eventType === 'hashchange' && navigation.status === 'navigating' && navigation.destination === currentUrl && (navigation.type === 'push' || navigation.type === 'replace') ? navigation.type : null;
|
|
118
|
+
publish(createSnapshotForHref(currentHref, routerNavigationType === null ? createNavigationSnapshot('complete', 'back') : createNavigationSnapshot('complete', routerNavigationType, currentUrl)));
|
|
119
|
+
});
|
|
120
|
+
const currentHref = nextEnvironment.currentHref();
|
|
121
|
+
if (toSnapshotUrl(currentHref) !== snapshot.url) {
|
|
122
|
+
publish(createSnapshotForHref(currentHref, snapshot.navigation));
|
|
123
|
+
}
|
|
124
|
+
return () => {
|
|
125
|
+
unsubscribe();
|
|
126
|
+
if (environment === nextEnvironment) {
|
|
127
|
+
environment = null;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
getSnapshot: () => snapshot,
|
|
132
|
+
router,
|
|
133
|
+
subscribe(listener) {
|
|
134
|
+
listeners.add(listener);
|
|
135
|
+
return () => listeners.delete(listener);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** Navigation methods that can change or revalidate the active browser document. */
|
|
3
|
+
export type ReactNavigationType = 'push' | 'replace' | 'back' | 'refresh';
|
|
4
|
+
/** Observable lifecycle states for HTTP-first client navigation. */
|
|
5
|
+
export type ReactNavigationStatus = 'idle' | 'navigating' | 'refreshing' | 'complete' | 'error' | 'skipped';
|
|
6
|
+
/** Immutable navigation lifecycle information exposed to hydrated components. */
|
|
7
|
+
export type ReactNavigationSnapshot = {
|
|
8
|
+
readonly destination?: string;
|
|
9
|
+
readonly status: ReactNavigationStatus;
|
|
10
|
+
readonly type: ReactNavigationType | null;
|
|
11
|
+
};
|
|
12
|
+
/** Read-only URL search parameter surface returned by `useSearchParams()`. */
|
|
13
|
+
export interface ReactReadonlySearchParams extends Iterable<[string, string]> {
|
|
14
|
+
/** Number of search parameter entries, including duplicate keys. */
|
|
15
|
+
readonly size: number;
|
|
16
|
+
/** Iterate over search parameter entries in source order. */
|
|
17
|
+
entries(): URLSearchParamsIterator<[string, string]>;
|
|
18
|
+
/** Iterate over each search parameter pair in source order. */
|
|
19
|
+
forEach(callback: (value: string, key: string, searchParams: ReactReadonlySearchParams) => void): void;
|
|
20
|
+
/** Read the first value for a search parameter key. */
|
|
21
|
+
get(name: string): string | null;
|
|
22
|
+
/** Read every value for a search parameter key. */
|
|
23
|
+
getAll(name: string): string[];
|
|
24
|
+
/** Check whether a search parameter key, optionally with one value, exists. */
|
|
25
|
+
has(name: string, value?: string): boolean;
|
|
26
|
+
/** Iterate over search parameter keys in source order. */
|
|
27
|
+
keys(): URLSearchParamsIterator<string>;
|
|
28
|
+
/** Serialize the search parameter snapshot without the leading question mark. */
|
|
29
|
+
toString(): string;
|
|
30
|
+
/** Iterate over search parameter values in source order. */
|
|
31
|
+
values(): URLSearchParamsIterator<string>;
|
|
32
|
+
}
|
|
33
|
+
/** HTTP-owned route state shared between server rendering and client hydration. */
|
|
34
|
+
export type ReactRouteSnapshot = {
|
|
35
|
+
readonly hash: string;
|
|
36
|
+
readonly navigation: ReactNavigationSnapshot;
|
|
37
|
+
readonly params: Readonly<Record<string, string>>;
|
|
38
|
+
readonly pathname: string;
|
|
39
|
+
readonly searchParams: ReactReadonlySearchParams;
|
|
40
|
+
readonly url: string;
|
|
41
|
+
};
|
|
42
|
+
/** Input used to create an immutable route snapshot at the HTTP application boundary. */
|
|
43
|
+
export type ReactRouteSnapshotInput = {
|
|
44
|
+
readonly params?: Readonly<Record<string, string>>;
|
|
45
|
+
readonly url: string | URL;
|
|
46
|
+
};
|
|
47
|
+
/** Browser navigation operations exposed by `useRouter()`. */
|
|
48
|
+
export interface ReactRouter {
|
|
49
|
+
/** Delegate traversal to browser history semantics. */
|
|
50
|
+
back(): void;
|
|
51
|
+
/** Start same-origin full-document navigation and add a history entry. */
|
|
52
|
+
push(href: string | URL): void;
|
|
53
|
+
/** Revalidate the current page with a full-document reload. */
|
|
54
|
+
refresh(): void;
|
|
55
|
+
/** Start same-origin full-document navigation and replace the current history entry. */
|
|
56
|
+
replace(href: string | URL): void;
|
|
57
|
+
}
|
|
58
|
+
/** Props for the request-scoped client router state provider. */
|
|
59
|
+
export type ReactClientRouterProviderProps = {
|
|
60
|
+
readonly children?: ReactNode;
|
|
61
|
+
readonly initialSnapshot: ReactRouteSnapshot;
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,oFAAoF;AACpF,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAE1E,oEAAoE;AACpE,MAAM,MAAM,qBAAqB,GAC7B,MAAM,GACN,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,OAAO,GACP,SAAS,CAAC;AAEd,iFAAiF;AACjF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC3C,CAAC;AAEF,8EAA8E;AAC9E,MAAM,WAAW,yBAA0B,SAAQ,QAAQ,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3E,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,OAAO,IAAI,uBAAuB,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,+DAA+D;IAC/D,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,yBAAyB,KAAK,IAAI,GAAG,IAAI,CAAC;IACvG,uDAAuD;IACvD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACjC,mDAAmD;IACnD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC/B,+EAA+E;IAC/E,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3C,0DAA0D;IAC1D,IAAI,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACxC,iFAAiF;IACjF,QAAQ,IAAI,MAAM,CAAC;IACnB,4DAA4D;IAC5D,MAAM,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED,mFAAmF;AACnF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,yBAAyB,CAAC;IACjD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,yFAAyF;AACzF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CAC5B,CAAC;AAEF,8DAA8D;AAC9D,MAAM,WAAW,WAAW;IAC1B,uDAAuD;IACvD,IAAI,IAAI,IAAI,CAAC;IACb,0EAA0E;IAC1E,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC;IAC/B,+DAA+D;IAC/D,OAAO,IAAI,IAAI,CAAC;IAChB,wFAAwF;IACxF,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC;CACnC;AAED,iEAAiE;AACjE,MAAM,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,eAAe,EAAE,kBAAkB,CAAC;CAC9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|