/** * Swipe-Back Detector * * Detects native edge swipe-back / swipe-forward gestures (iOS Safari, Android * system back gesture) purely from touch event sequences. We deliberately do * NOT depend on popstate because: * * - iOS 16+ has a regression (WebKit 248303) where swipe-back skips popstate * when history entries were created without user interaction. * - popstate doesn't tell us *how* the navigation happened — header back-button, * keyboard shortcut, history.back() and edge-swipe all look identical. * * Heuristic * 1. touchstart with a single touch starting within EDGE_THRESHOLD px of either * vertical edge of the layout viewport → record a candidate. * 2. touchmove that is horizontally dominant AND moves *away* from that edge * by more than MOVE_THRESHOLD → mark candidate as "moved". * Multi-touch, vertically-dominant motion, or losing the tracked finger all * drop the candidate. * 3. touchend with cumulative |dx| ≥ FINAL_DISTANCE in the correct direction * → settle as a swipe. * touchcancel after horizontal commitment also counts: the browser took the * gesture over, which is exactly what edge-swipe-back does on iOS. * In some environments (notably iOS WKWebView), the OS commits the gesture * and dispatches `touchend` instead of `touchcancel`, with `clientX` * reported in the now document-translated coordinate space — `dx` flips * sign and fails the in-direction recheck above. When the in-direction * check fails but `|dx| ≥ FINAL_DISTANCE` and `moved` was set during * touchmove, treat it as the same takeover signal: the magnitude survives * translation, while keeping the FINAL_DISTANCE floor rejects weak or * cancelled gestures, matching pre-patch behavior in normal browsers. * * Settling arms an "active" flag. The flag auto-expires after EXPIRE_WINDOW so * a successful gesture that wasn't actually a navigation (e.g. user dragged a * right-anchored sheet) doesn't poison subsequent navigations. * * The flag also has a `stickyActive` mirror that lives one extra macrotask past * `onPageEnter()`, so an OUT/IN pair queued together (which can fire in either * order across adapters) reads the same value. * * Mac trackpad and Magic Trackpad swipes don't dispatch touch events on web, so * they go unhandled here. That's intentional — we'd rather miss-detect those * than false-positive them. */ export declare function createSwipeBackDetector(): { initialize: () => void; destroy: () => void; isSwipeBack: () => boolean; onPageEnter: () => void; }; //# sourceMappingURL=create-swipe-back-detector.d.ts.map