/** * Where the slides are and where the slider can stop. * * All positions are logical px along the way of the slides: 0 is the start * edge of the track. Right-to-left pages and sliders that go down need * nothing special past `measure()`. * */ import type { Options, Place } from './index.js'; /** What `measure()` reads of the page; plugins may change it to lay out. */ export interface Measured { /** Slides lie on top of each other: the `stack` plugin says so. */ stack?: boolean; /** The slides follow each other downwards. */ y: boolean; /** Reading direction is right to left. */ rtl: boolean; /** Width of the viewport. */ width: number; /** Height of the viewport. */ height: number; /** * Its length along the way of the slides: the width, or the height of a * slider that goes down. */ span: number; /** Gap between slides. */ gap: number; /** Start edge of each slide. */ left: number[]; /** Width of each slide. */ size: number[]; } export interface Layout extends Measured { /** * Whether the slider loops (false when the option is on but there are * too few slides for it). */ loop: boolean; /** Length of one round when looping. */ length: number; /** * Start edge of each slide in the viewport when the slider rests on it. */ rest: number[]; /** Positions the slider can stop at. */ snaps: number[]; /** The snap each slide belongs to. */ snapOf: number[]; } export declare const mod: (value: number, n: number) => number; /** * Reads the layout from the page, in fractions of a pixel: slides that are * a third of the view wide would otherwise drift apart by their rounding. * * @param root The slider: its box is the viewport. * @param track Parent of the slides. * @param slides The slides. * @param options Slider options. * @param moved How far each slide is moved by its own * translation at the moment. * @param shape Gets what was measured and may change it: * for plugins that lay out another way. * @return Layout. */ export declare function measure(root: HTMLElement, track: HTMLElement, slides: HTMLElement[], options: Options, moved?: number[], shape?: (measured: Measured) => void): Layout; /** * Derives the snap points from the measured slides. * * @param measured `y`, `rtl`, `width`, `height`, `span`, `gap`, * `left`, `size`. * @param options Slider options: `loop`, `align`, `group`, * `contain`. * @return Layout. */ export declare function arrange(measured: Measured, options: Options): Layout; /** * The position of a snap. When looping, indexes run on past both ends: * -1 is the last snap one round before. * * @param layout Layout. * @param index Snap index. * @return Position. */ export declare function positionOf(layout: Layout, index: number): number; /** * The snap closest to a position. * * @param layout Layout. * @param position Position. * @return Snap index, running on past both ends when looping. */ export declare function nearest(layout: Layout, position: number): number; /** * Where each slide is for a position. * * @param layout Layout. * @param position Position of the slider. * @param out One object per slide, filled with `x` (start * edge in the viewport), `p` (distance from its * resting place in slides: 1 is one slide after * the active one), `share` (how much of it is in * the view, 0 to 1) and `visible`. * @return `out`. */ export declare function place(layout: Layout, position: number, out: Place[]): Place[]; /** * Past its ends a slider follows only a part of the way. * * @param layout Layout. * @param position Where the pointer would have it. * @return Where it is. */ export declare function resist(layout: Layout, position: number): number;