import type { RouteData } from './types'; /** * Single recorded navigation. Each `` stores a stack of these * so it can replay previously rendered routes when the user navigates back * or forward. * * `entryId` correlates the entry with `history.state.entryId`, so the popstate * handler can find the right entry when the user clicks the browser's * back/forward buttons. */ export interface NavigationEntry { routeName: string; params: RouteData; target?: string; urlSegments: string[]; entryId: number; fragment?: string; } /** * Encapsulated back/forward history for a single route target. * Behaves like the browser's own history stack: pushing a new entry while * the index sits in the middle of the stack truncates the forward entries. * * @example * const history = new NavigationHistory(); * history.record({ routeName: 'home', params: {}, urlSegments: [''], entryId: 1 }); * history.record({ routeName: 'user', params: { id: 'a' }, urlSegments: ['users', 'a'], entryId: 2 }); * history.canGoBack(); // true * history.back(); // returns the 'home' entry * history.canGoForward(); // true */ export declare class NavigationHistory { private entries; private currentIndex; record(entry: NavigationEntry): void; canGoBack(): boolean; canGoForward(): boolean; back(): NavigationEntry | undefined; forward(): NavigationEntry | undefined; /** * Move the index to the entry with the given `entryId`. Used by the * popstate handler to keep the per-target index in sync with the * browser's global history position. */ setIndexById(entryId: number): NavigationEntry | undefined; current(): NavigationEntry | undefined; /** @internal Used by tests. */ size(): number; }