import { Ranger } from "sharekit"; import { type TemplateResult } from "lit"; import { SuperInput } from "../../internal/super-input.js"; type RangeValue = number | number[]; /** * {@linkcode Range} is similar to ``. * * Value accepts number, or array. * * Number has 1 handle, the array has the number of its elements. * * @fires range - Fires when the value changes. * @category input */ declare class Range extends SuperInput { /** * Minimum value. */ min: number; /** * Maximum value. */ max: number; /** * Sliding step length. */ step: number; /** * Whether to display the range vertically. */ vertical: boolean; /** * Value, or each of values, will render a handle. * * Accepts number or array of numbers. */ value: V; /** * The default of `{@linkcode this.value}`. */ default: V; protected _root: HTMLElement; protected _handles: NodeListOf; lastFocus?: number; protected _ranger: Ranger; private __focusStack; get range(): V extends number ? false : true; /** * Return values in the form of an array. */ get rangeValue(): number[]; /** * Pad the value to the specified length. */ padValue(len: number, value?: number): number[]; attributeChangedCallback(name: string, _old: string | null, value: string | null): void; get observedRecord(): Record; protected render(): TemplateResult<1>; protected _renderHandle(index: number): TemplateResult<1>; private __keydownEvent; /** * Focuses the handle at the given index, updates the focus stack. * @param index - The index of the handle to focus. */ focusHandle(index: number): void; /** * Removes the focus from the currently focused handle. */ blurHandle(): void; /** * Creates a keydown event handler that updates the value of the range based on arrow key presses. * @param index - The index of the handle to update. * @returns A function that handles the keydown event and updates the range value. */ protected createKeydownEvent(index: number): (e: KeyboardEvent) => void; /** * Creates a mouse down event handler that focuses the handle at the given index and sets the value of the range. * @param index - The index of the handle to focus. * @returns A function that handles the mouse down event and updates the range value. */ protected createMouseDown(index: number): (e: MouseEvent) => void; /** * Creates a function that sets the value of the range at the given index. * @param index - The index of the value to set. * @returns A function that sets the value of the range. */ protected createSetValue(index: number): (value: number) => void; /** * Compute value from event. * @returns The value closest to the event client position. */ protected _computeValue({ clientX, clientY }: MouseEvent): number; /** * Handles the mouse down event on the root element of the range component. * Computes the closest value to the mouse position, sets the value, and focuses the corresponding handle. * @param e - The mouse down event object. */ protected _handleMousedownRoot(e: MouseEvent): void; /** * Creates a mouse down event handler that focuses the handle at the given index and sets the value of the range. * @param index - The index of the handle to focus. * @returns A function that handles the mouse down event and updates the range value. */ protected createMousedownListener(mouseMoveCallback: (arg0: number) => void): (e: MouseEvent) => void; /** * Creates a mouse move event handler that updates the range value based on the mouse position. * @param callback - A function to call with the new value when the mouse is moved. * @returns A function that handles the mouse move event and updates the range value. */ protected createMousemoveListener(callback: (newValue: number) => void): (e: MouseEvent) => void; protected _connectedInit(): void; reset(): void; sort(): V; toSorted(): V; } export default Range; export { Range };