import { RouteConfig, RouteMatch } from './types.js'; export type RouteState = { state?: any; skipTransition?: boolean; id: string; isSearch?: boolean; }; export type PreviousLocation = { pathname: string; search: string; hash: string; }; /** * Calls the given callback when the location changes. */ export declare function useOnLocationChange(callback: (location: Location, state: RouteState, prev: PreviousLocation) => void): void; /** * Returns the best matching route for the given path from the * list of supplied routes. */ export declare function useMatchingRouteForPath(path: string, routes: RouteConfig[] | null): RouteMatch | null; /** * Returns the full list of matching routes for the given path. * A path will match exactly one leaf route; this is the traversal * from the root to that leaf. * * The path can be relative to the current location or absolute. */ export declare function useRouteMatchesForPath(fullPath: string): RouteMatch[]; export declare function useMatchingRoutes(): RouteMatch[]; /** * Returns the matched path params for the current route. */ export declare function useParams>(): Shape; /** * Returns the current level's matching route. */ export declare function useMatchingRoute(): RouteMatch | null; /** * Returns the next matching route for the current level (the * child of the current route that matches the current path, if any). */ export declare function useNextMatchingRoute(): RouteMatch | null; /** * Provides a method you can call to navigate to a new path, with * state and options to skip React transitions. */ export declare function useNavigate(): (to: string, { replace, skipTransition, state, preserveScroll, preserveQuery, }?: { replace?: boolean; skipTransition?: boolean; state?: any; preserveScroll?: boolean; preserveQuery?: boolean; }) => void; /** * Returns a match against the currently active routes at the current level for the * given path. * * For example, if the current location is /foo/bar/baz, and this * hook is called in a component at level /foo/bar, the match will * return a match for /baz, but not /qux or /foo. */ export declare function useMatch({ path, end }: { path: string; end?: boolean; }): RouteMatch | null; /** * Returns current query (search) params and a method to update * them which either takes previous and returns a new URLSearchParams, * accepts a URLSearchParams object outright. */ export declare function useSearchParams(): readonly [URLSearchParams, (params: URLSearchParams | ((old: URLSearchParams) => URLSearchParams), options?: { state?: any; skipTransition?: boolean; replace?: boolean; }) => void]; /** * Returns the current route state (additional data you can attach * to route changes in useNavigate or as a prop to Link). */ export declare function useRouteState(): any; /** * Allows custom handling of scroll restoration. * Provide a function to get the current scroll position and a function to * restore the scroll position by applying it. * This allows you full control to track scrolling in a custom element, * wait for animations, etc. */ export declare function useScrollRestoration({ onGetScrollPosition, onScrollRestored, debug, id, }: { /** * Return the current scroll position for the current route. * Return false to keep the previous known position. */ onGetScrollPosition: () => [number, number] | false; onScrollRestored: (position: [number, number], isFirstVisit: boolean) => void; debug?: boolean; /** * If you are restoring multiple scroll containers which may be * rendered at the same time, you should provide a unique ID * for each one so they get assigned the correct scroll position. */ id?: string; }): void;