import { applyAction } from '$app/forms'; import { afterNavigate, beforeNavigate, goto, invalidate, invalidateAll, prefetch, prefetchRoutes } from '$app/navigation'; import { CSRPageNode, CSRPageNodeLoader, CSRRoute, Uses } from 'types'; export interface Client { // public API, exposed via $app/navigation after_navigate: typeof afterNavigate; before_navigate: typeof beforeNavigate; disable_scroll_handling: () => void; goto: typeof goto; invalidate: typeof invalidate; invalidateAll: typeof invalidateAll; prefetch: typeof prefetch; prefetch_routes: typeof prefetchRoutes; apply_action: typeof applyAction; // private API _hydrate: (opts: { status: number; error: App.PageError; node_ids: number[]; params: Record; routeId: string | null; data: Array; form: Record | null; }) => Promise; _start_router: () => void; } export type NavigationIntent = { /** `url.pathname + url.search` */ id: string; /** Whether we are invalidating or navigating */ invalidating: boolean; /** The route parameters */ params: Record; /** The route that matches `path` */ route: CSRRoute; /** The destination URL */ url: URL; }; export type NavigationResult = NavigationRedirect | NavigationFinished; export type NavigationRedirect = { type: 'redirect'; location: string; }; export type NavigationFinished = { type: 'loaded'; state: NavigationState; props: Record; }; export type BranchNode = { node: CSRPageNode; loader: CSRPageNodeLoader; server: DataNode | null; shared: DataNode | null; data: Record | null; }; export interface DataNode { type: 'data'; data: Record | null; uses: Uses; } export interface NavigationState { branch: Array; error: App.PageError | null; params: Record; route: CSRRoute | null; session_id: number; url: URL; }