import type { Router } from "@real-router/core"; export interface DirectionTracker { destroy: () => void; } /** * Track navigation direction (forward / back) and write it to * `` on every leave. CSS / JS readers consume * the attribute via `html[data-nav-direction="back"]` selectors or * `document.documentElement.dataset.navDirection`. * * Mechanism-agnostic — works identically whether downstream UI uses CSS * `@keyframes`, View Transitions pseudo-elements, or library state * (motion's `motion.div initial={{ x: ... }}`). * * Implementation: * - On install, set `data-nav-direction="forward"` baseline. * - Attach a `popstate` listener that flips an internal flag to * `true`. Browser back/forward navigation triggers popstate; user * clicks on `` / programmatic `router.navigate(...)` do not. * - On every `subscribeLeave`, write * `popstateFlag ? "back" : "forward"` and reset the flag. * * Returns `{ destroy }` to clean up the listener and clear the dataset * attribute. */ export declare function createDirectionTracker(router: Router): DirectionTracker;