///
import { default as _createBrowserHistory } from './createBrowserHistory';
import { default as _createHashHistory } from './createHashHistory';
import { default as _createMemoryHistory } from './createMemoryHistory';
export declare const createHistory: typeof _createBrowserHistory;
export declare const createHashHistory: typeof _createHashHistory;
export declare const createMemoryHistory: typeof _createMemoryHistory;
declare const _default: {
createHistory: typeof _createBrowserHistory;
createHashHistory: typeof _createHashHistory;
createMemoryHistory: typeof _createMemoryHistory;
};
export default _default;
export { default as useBasename } from './useBasename';
export { default as useBeforeUnload } from './useBeforeUnload';
export { default as useQueries } from './useQueries';
export { default as Actions } from './Actions';
export * from './Actions';
import type Actions from './Actions';
import type { ParsedUrlQuery, ParsedUrlQueryInput } from 'querystring';
import type { Hook } from './runTransitionHook';
export type { HistoryWithBFOL } from './useBeforeUnload';
export interface BaseLocation {
pathname?: string;
search?: string;
hash?: string;
state?: unknown;
}
export interface Location extends Required {
key: string;
action: Actions;
}
export interface BLWithBasename extends BaseLocation {
basename?: string;
}
export interface ILWithBasename extends Location {
basename: string;
}
export interface BLWithQuery extends BaseLocation {
query?: ParsedUrlQueryInput;
}
export interface ILWithQuery extends Location {
query: ParsedUrlQuery;
}
export interface BLWithBQ extends BaseLocation {
basename?: string;
query?: ParsedUrlQueryInput;
}
export interface ILWithBQ extends Location {
basename: string;
query: ParsedUrlQuery;
}
export interface LocationTypeMap {
NORMAL: {
Base: BaseLocation;
Intact: Location;
};
BASENAME: {
Base: BLWithBasename;
Intact: ILWithBasename;
};
QUERY: {
Base: BLWithQuery;
Intact: ILWithQuery;
};
BQ: {
Base: BLWithBQ;
Intact: ILWithBQ;
};
}
export declare type LocationType = keyof LocationTypeMap;
export declare type LocationTypeLoader = CLT extends 'BASENAME' ? FLT extends 'NORMAL' | 'BASENAME' ? 'BASENAME' : 'BQ' : FLT extends 'NORMAL' | 'QUERY' ? 'QUERY' : 'BQ';
export interface PathCoder {
encodePath: (path: string) => string;
decodePath: (path: string) => string;
}
export interface PathCoders {
hashbang: PathCoder;
noslash: PathCoder;
slash: PathCoder;
}
export interface StringifyQuery {
(query: object): string;
}
export interface ParseQueryString {
(query: string): ParsedUrlQuery;
}
export interface GetUserConfirmation {
(message: string, callback: Function): void;
}
export interface HistoryOptions {
keyLength?: number;
forceRefresh?: boolean;
queryKey?: string;
hashType?: keyof PathCoders;
basename?: string;
stringifyQuery?: StringifyQuery;
parseQueryString?: ParseQueryString;
entries?: Location[];
current?: number;
getUserConfirmation?: GetUserConfirmation;
}
export interface PushLocation {
(location: Location): boolean;
}
export interface ReplaceLocation {
(location: Location): boolean;
}
export interface GetCurrentLocation {
(): IL;
}
export interface Unlisten {
(): void;
}
export interface ListenBefore {
(hook: Hook): Unlisten;
}
export interface Listen {
(hook: Hook): Unlisten;
}
export interface TransitionTo {
(nextLocation: IL): void;
}
export interface Push {
(input: BL | string, silence?: boolean): void;
}
export interface Replace {
(input: BL | string, silence?: boolean): void;
}
export interface Go {
(n: number): void;
}
export interface GoBack {
(): void;
}
export interface GoForward {
(): void;
}
export interface CreatePath {
(location: BLWithBQ | string): string;
}
export interface CreateHref {
(location: BL | string): string;
}
export interface CreateKey {
(): string;
}
export interface CreateLocation {
(input?: BL | string, action?: Actions, key?: string): IL;
}
export interface History {
getCurrentLocation: GetCurrentLocation;
listenBefore: ListenBefore;
listen: Listen;
transitionTo: TransitionTo;
push: Push;
replace: Replace;
go: Go;
goBack: GoBack;
goForward: GoForward;
createKey: CreateKey;
createPath: CreatePath;
createHref: CreateHref;
createLocation: CreateLocation;
}
export interface CreateHistory {
(options?: HistoryOptions): History;
}
export declare type LTFromCH> = CH extends CreateHistory ? LT : never;