/** * The unified sheet pan — one gesture implementation for every drag mode. * Merged mechanically from lynx-navigation's inline `BottomSheet` pan * (handle-attached, persistent floor, `openToLift` snap candidates) and * `SheetDragController` (full-surface arbitration against an adopted * inner scrollable, drag-to-dismiss, gen-stamped claims). * * Two attachment shapes: * - **handle** (`surface: false`, default): the caller attaches the pan * to a dedicated handle/grabber element — touches there always drag * the sheet, so ownership is claimed at `onStart` and no arbitration * runs. A raw `` body keeps scrolling untouched. * - **surface** (`surface: true`): the caller attaches the pan to the * whole sheet surface and provides the `ScrollDragHost` SVs; ownership * resolves on the first `onUpdate` frame through `decideDragOwner` * (see math.ts for the 8-step table). CONTENT-owned gestures are * *passive*: the pan stays activated but writes nothing and makes no * BG hops — the native scroll runs concurrently by construction. On * web a browser-claimed scroll `pointercancel`s us into the no-op * `owner !== OWNER_SHEET` onEnd branch. * * **Settle-grab correctness** (ported verbatim): claiming cancels any * in-flight settle tween via lynx-motion's `cancelAnimation` (a plain SV * write does NOT cancel), and stamps a claim generation the caller's BG * hops carry — so delayed settle/dismiss work can compare-and-bail when * a newer gesture superseded it, and grabbing the sheet mid-settle can't * fight the tween. * * MT/BG split: all handlers run on MT and write the reveal SV directly * per frame (auto-flushing, #681); BG hops only at claim (`onClaim`) and * release (`onRelease`). Worklet locals cross to BG as ARGUMENTS. */ import { Gesture, type SharedValue } from '@sigx/lynx'; import type { SheetEngine } from './engine.js'; /** Minimum movement before the gesture activates (lets taps pass through). */ export declare const MIN_DISTANCE = 6; /** `onRelease` kind: the sheet settled at a snap candidate. */ export declare const RELEASE_SNAP = 0; /** `onRelease` kind: the release projected past the dismiss line. */ export declare const RELEASE_DISMISS = 1; export interface SheetPanConfig { /** Full-surface arbitration mode (requires the scroll SVs below). */ surface?: boolean; /** Height of the always-claims chrome zone (surface mode). */ grabberPx?: number; /** `'grabber'` drag mode: only the chrome zone claims, body never drags. */ grabberOnly?: boolean; /** Activation slop; default 6 (the inline sheet's tap-friendly value). */ minDistance?: number; /** Adopted inner scrollable's live offset (`ScrollDragHost.scrollOffsetY`). */ scrollOffsetY?: SharedValue; /** Adopted-scrollable presence flag (`ScrollDragHost.hasVerticalScroll`). */ hasVerticalScroll?: SharedValue; /** * BG hop at claim, carrying the claim generation — the route adapter * stamps its gen signal + takes the gesture scroll-lock here. Omit * for sheets with no claim-time BG work (the inline handle pan). */ onClaim?: (gen: number) => void; /** * BG hop at release: `kind` is `RELEASE_SNAP` (with the candidate * index the sheet is settling toward) or `RELEASE_DISMISS` (index * `-1`). `gen` is the claim generation for compare-and-bail. The * inline sheet debounce-emits its snap event here; the route adapter * gen-guards its settle/dismiss commit. */ onRelease: (kind: number, candidateIndex: number, gen: number) => void; } /** * Build the pan gesture for a sheet engine. Call at component setup and * attach with `useGestureDetector(ref, pan)` — to the handle element in * handle mode, the whole sheet surface in surface mode. */ export declare function createSheetPan(engine: SheetEngine, cfg: SheetPanConfig): ReturnType; //# sourceMappingURL=drag.d.ts.map