blade
Version:
React at the edge.
42 lines (41 loc) • 2.02 kB
TypeScript
import "../../index-l2pJm30F.js";
import { c as PageFetchingOptions, o as SetExistingCookie, s as CustomNavigator } from "../../context-CIJX_XuL.js";
import "../../index-D9P9itFa-C0Jtggx-.js";
import "react";
//#region private/client/hooks.d.ts
interface RootTransitionOptions extends PageFetchingOptions {
/**
* Whether to read the page from the local cache. This will also cause the page to get
* retrieved again after it was rendered, to make sure it is up-to-date and a
* subscription for updates is established.
*/
acceptCache?: boolean;
/**
* Update the query string parameters in the address bar of the browser immediately,
* instead of waiting for the page to be rendered on the server and returned.
*/
immediatelyUpdateQueryParams?: boolean;
}
//#endregion
//#region public/universal/hooks.d.ts
declare const useParams: <TParams extends Record<string, unknown> | Array<string> = Record<string, string | Array<string>>, TResult extends Record<string, unknown> | Array<string> = (TParams extends Array<string> ? { [K in TParams[number]]: string } : TParams)>() => TResult;
declare const useLocation: () => URL;
declare const useNavigator: () => CustomNavigator;
declare const usePopulatePathname: () => (pathname: string, extraParams?: {
[key: string]: string | string[];
}) => string;
interface RedirectOptions extends Pick<RootTransitionOptions, 'immediatelyUpdateQueryParams'> {
/**
* Extra parameters to be used when populating the pathname.
*
* For example, if the pathname passed to `redirect` is `/user/[id]`, and `extraParams`
* contains `id: '123'`, the resulting pathname will automatically be `/user/123`.
*/
extraParams?: {
[key: string]: string;
};
}
declare const useRedirect: () => (pathname: string, options?: RedirectOptions) => void;
declare const useCookie: <T extends string | null>(name: string) => [T | null, SetExistingCookie<T>];
//#endregion
export { useCookie, useLocation, useNavigator, useParams, usePopulatePathname, useRedirect };