///
import type { Transaction, TransactionContext } from '@sentry/types';
export declare type Action = 'PUSH' | 'REPLACE' | 'POP';
export declare type Location = {
pathname: string;
action?: Action;
} & Record;
export declare type ReactRouterInstrumentation = (startTransaction: (context: TransactionContext) => T | undefined, startTransactionOnPageLoad?: boolean, startTransactionOnLocationChange?: boolean) => void;
export interface NonIndexRouteObject {
caseSensitive?: boolean;
children?: RouteObject[];
element?: React.ReactNode | null;
errorElement?: React.ReactNode | null;
index?: any;
path?: string;
}
export interface IndexRouteObject {
caseSensitive?: boolean;
children?: undefined;
element?: React.ReactNode | null;
errorElement?: React.ReactNode | null;
index: any;
path?: string;
}
export declare type RouteObject = (IndexRouteObject | NonIndexRouteObject) & Record;
export declare type Params = {
readonly [key in Key]: string | undefined;
};
export declare type UseRoutes = (routes: RouteObject[], locationArg?: Partial | string) => React.ReactElement | null;
export interface RouteMatch {
/**
* The names and values of dynamic parameters in the URL.
*/
params: Params;
/**
* The portion of the URL pathname that was matched.
*/
pathname: string;
/**
* The portion of the URL pathname that was matched before child routes.
*/
pathnameBase: string;
/**
* The route object that was used to match.
*/
route: RouteObject;
}
export declare type UseEffect = (cb: () => void, deps: unknown[]) => void;
export declare type UseLocation = () => Location;
export declare type UseNavigationType = () => Action;
export declare type RouteObjectArrayAlias = any;
export declare type RouteMatchAlias = any;
export declare type CreateRoutesFromChildren = (children: JSX.Element[]) => RouteObjectArrayAlias;
export declare type MatchRoutes = (routes: RouteObjectArrayAlias, location: Location) => RouteMatchAlias[] | null;
export declare type ShouldRevalidateFunction = (args: any) => boolean;
interface DataFunctionArgs {
request: Request;
params: Params;
}
declare type LoaderFunctionArgs = DataFunctionArgs;
declare type ActionFunctionArgs = DataFunctionArgs;
export interface LoaderFunction {
(args: LoaderFunctionArgs): Promise | Response | Promise | any;
}
export interface ActionFunction {
(args: ActionFunctionArgs): Promise | Response | Promise | any;
}
declare type AgnosticBaseRouteObject = {
caseSensitive?: boolean;
path?: string;
id?: string;
loader?: LoaderFunction;
action?: ActionFunction;
hasErrorBoundary?: boolean;
shouldRevalidate?: ShouldRevalidateFunction;
handle?: any;
};
export declare type AgnosticIndexRouteObject = AgnosticBaseRouteObject & Record;
export declare type AgnosticNonIndexRouteObject = AgnosticBaseRouteObject & Record;
export declare type AgnosticDataIndexRouteObject = AgnosticIndexRouteObject & {
id: string;
};
export declare type AgnosticDataNonIndexRouteObject = AgnosticNonIndexRouteObject & {
children?: AgnosticDataRouteObject[];
id: string;
};
export interface AgnosticRouteMatch {
params: Params;
pathname: string;
pathnameBase: string;
route: RouteObjectType;
}
export declare type AgnosticDataRouteMatch = AgnosticRouteMatch;
interface UseMatchesMatch {
id: string;
pathname: string;
params: AgnosticRouteMatch['params'];
data: unknown;
handle: unknown;
}
export interface GetScrollRestorationKeyFunction {
(location: Location, matches: UseMatchesMatch[]): string | null;
}
export interface Path {
pathname: string;
search: string;
hash: string;
}
export interface RouterSubscriber {
(state: TState): void;
}
export interface GetScrollPositionFunction {
(): number;
}
declare type LinkNavigateOptions = {
replace?: boolean;
state?: any;
preventScrollReset?: boolean;
};
export declare type AgnosticDataRouteObject = AgnosticDataIndexRouteObject | AgnosticDataNonIndexRouteObject;
export declare type To = string | Partial;
export declare type HydrationState = any;
export declare type FormMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
export declare type FormEncType = 'application/x-www-form-urlencoded' | 'multipart/form-data';
export declare type RouterNavigateOptions = LinkNavigateOptions | SubmissionNavigateOptions;
export declare type AgnosticRouteObject = AgnosticIndexRouteObject | AgnosticNonIndexRouteObject;
declare type SubmissionNavigateOptions = {
replace?: boolean;
state?: any;
formMethod?: FormMethod;
formEncType?: FormEncType;
formData: FormData;
};
export interface RouterInit {
basename: string;
routes: AgnosticRouteObject[];
history: History;
hydrationData?: HydrationState;
}
export declare type NavigationStates = {
Idle: any;
Loading: any;
Submitting: any;
};
export declare type Navigation = NavigationStates[keyof NavigationStates];
export declare type RouteData = any;
export declare type Fetcher = any;
export declare enum HistoryAction {
Pop = "POP",
Push = "PUSH",
Replace = "REPLACE"
}
export interface RouterState {
historyAction: Action | HistoryAction | any;
location: any;
}
export interface Router {
state: TState;
subscribe(fn: RouterSubscriber): () => void;
}
export declare type CreateRouterFunction = Router> = (routes: RouteObject[], opts?: any) => TRouter;
export {};
//# sourceMappingURL=types.d.ts.map