import { Params } from "next/dist/server/request/params"; import { Infer } from "superstruct"; import { RouteInfo, Router, RouterOptions } from "./create-router"; import { QueryParams, RoutesDefinition } from "./types"; export interface TransitionOptions { shallow?: boolean; locale?: string | false; scroll?: boolean; unstable_skipClientCache?: boolean; } type QueryParamsResult> = [ Nullable extends true ? Infer> | null : Infer>, { push: (params: Infer>, options?: TransitionOptions) => Promise; replace: (params: Infer>, options?: TransitionOptions) => Promise; } ]; /** * The client router – a superset of `createRouter` (`@uxf/router`) that adds the React hooks. * Lives in a separate client-only module (`@uxf/router/client`) because it imports `next/navigation` * and `next/router`, which are not safe to pull into React Server Components. */ export type ClientRouter> = Router & { useRouteInfo: () => RouteInfo | null; /** * @deprecated use useQueryParamsStatic or useQueryParams instead */ useQueryParamsDeprecated: () => QueryParams; /** * Returns path params merged with search params */ usePageParams: () => Params | null; useQueryParams: (routeName: T) => QueryParamsResult; useQueryParamsStatic: (routeName: T) => QueryParamsResult; }; /** * Creates the client router – everything `createRouter` returns plus the React hooks * (`useQueryParams`, `useQueryParamsStatic`, `usePageParams`, `useRouteInfo`). * * Use this in client components. For server-safe usage (including React Server Components) use * `createRouter` from `@uxf/router` instead. */ export declare function createClientRouter>(routes: RouteList, routerOptions: RouterOptions): ClientRouter; export {};