/** * Wheel input, in the units the rest of the stack wants. * * A DOM wheel event describes travel, not intent: the same flick arrives as * one 120px jump from a notched mouse, a stream of 4px slivers from a * trackpad, or three "lines" from Firefox. Anything downstream that counts * discrete steps has to put those back together itself. */ export declare const WHEEL_MODE_LINE = 1; export declare const WHEEL_MODE_PAGE = 2; /** CSS pixels per line when a browser reports a wheel in line mode * (Firefox does, for notched mice). Matches the default line box. */ export declare const WHEEL_LINE_PX = 16; /** Lines a wheel notch conventionally travels, so line-mode deltas can be * turned back into detents. */ export declare const WHEEL_LINES_PER_DETENT = 3; /** CSS pixels per detent for browsers that report notched wheels in pixel * mode on a whole-detent grid (Chrome and Edge on Windows and Linux). * macOS reports a notch as a fraction of this and lets its own scroll * acceleration vary it, so a wheel there is not recognisable by size. */ export declare const WHEEL_DETENT_PX = 120; /** * Idle gap that ends a scroll sequence. * * Long enough to bridge the frame cadence of a macOS momentum tail so one * flick stays one gesture: the source is latched for the length of a * sequence, and a tail split in two could have its second half reread as * a notched wheel. Short enough that the next scroll starts fresh. * * A touch drag doesn't wait for it — `touchend` ends that sequence at the * moment the finger leaves the glass. */ export declare const SCROLL_STOP_MS = 280; /** * Whole rows a notched wheel should travel, or 0 for anything that is not a * notched wheel and should keep the browser's own scrolling. * * A notch is 120 CSS px whatever the font is, so left to the browser it lands * mid-row. A terminal can only show whole rows, so the offset that position * maps to is rounded, and the render loop writes the rounding back to * `scrollTop` once the gesture settles — a jerk of up to half a row, in * whichever direction the remainder fell, arriving as late as the next cursor * blink. Every notch leaves a different remainder, so the jerks alternate: * at a 19px cell, twelve notches moved 6 or 7 rows apiece and snapped back by * +6, -7, -1, +5, -8, -2, +4, -9, -3, +3, +9, -4 px. * * Rounding the *travel* instead keeps the surface on the row grid, so there is * no remainder to write back and every notch moves the same distance. The * distance is still the notch's own 120px worth of rows, so the wheel keeps * the speed the browser was giving it. * * Pixel-precise devices are deliberately left alone: a trackpad means the * fraction it reports, and being continuous it settles once per gesture rather * than once per notch. macOS varies a notch's size with its own scroll * acceleration, which is why a wheel there is not recognisable by size and * falls here too. */ export declare function notchedRows(e: WheelEvent, rowHeightPx: number): number; /** * Accumulates wheel travel into whole detents. * * One detent is what an app reading the mouse expects per wheel report — * three lines, by the convention every terminal app follows. Sending one * report per DOM event instead makes a trackpad, which emits an event per * frame, scroll roughly twenty times too fast; sending none until a whole * detent has accumulated makes a notched wheel feel dead. Carrying the * fraction between events of the same gesture does both. */ export declare class WheelDetents { private accum; private lastAt; /** * Whole detents completed by this event, sign following `deltaY` * (negative = away from the user). `lineHeightPx` and `pageLines` are * the reader's own geometry, which is what "a line" and "a page" mean to * the app being scrolled. */ take(e: WheelEvent, lineHeightPx: number, pageLines: number, now: number): number; reset(): void; private detentsFor; } //# sourceMappingURL=wheel.d.ts.map