/** * A STRIP THAT SCROLLS SIDEWAYS — the two questions it has to answer, as * arithmetic, because neither can be answered from a rendered box in a unit * test and both are wrong in ways nothing on screen shows. * * `stripEdges` — which end still has content behind it, so the strip can SAY it * scrolls. A scroller whose last visible item ends flush with its edge is the * same picture as a strip holding everything there is, and a swipe nobody has a * reason to try hides whatever is past the fold. * * `scrollToShow` — where the strip has to stand for one item to be wholly * inside it. A reader arrives at a record already at its fourth stage, and a * strip that opens at the first stage has hidden the one thing the reader came * to see. */ /** A box's own edges, in any one coordinate system — viewport, page, it does * not matter, as long as both boxes are read in the same one. */ export interface StripEdge { left: number; right: number; } /** * Is there content behind either end? * * A sub-pixel remainder is not a hidden item: a rounded box reports a * `scrollWidth` a fraction over its `clientWidth` at plenty of widths that fit. * `scrollLeft` is negative in a right-to-left strip, so the distance travelled * is read as a magnitude and the answer holds in both directions. */ export declare function stripEdges(scrollLeft: number, scrollWidth: number, clientWidth: number): { behind: boolean; ahead: boolean; }; /** * The `scrollLeft` that brings `item` wholly inside `box`, or `null` when it is * already there — null rather than the current position, so a caller never * writes a scroll that would move nothing and the "already in view" case is one * the type states. * * It scrolls the SHORTER way: an item past the trailing edge comes to that edge * and no further, which keeps the stages before it on screen — a strip that * centred the current stage would scroll the run's beginning out of sight to * put the reader in the middle of a box with room for both. * * `pad` is what is left showing of whatever is behind the item, so the strip * reads as continuing rather than as starting there. */ export declare function scrollToShow(box: StripEdge, item: StripEdge, scrollLeft: number, pad?: number): number | null;