/** * Utility functions for nv-fieldslider. */ /** * Gets the number of decimal places in a number. * @param {number} num - The number to check * @returns {number} The number of decimal places */ export declare function getDecimalPlaces(num: number): number; /** * Clamp a value between min and max. * @param {number} value - The value to clamp * @param {number} min - The minimum boundary * @param {number} max - The maximum boundary * @returns {number} The clamped value */ export declare function clamp(value: number, min: number, max: number): number; /** * Calculate the percentage position of a value within a range. * @param {number} value - The value to convert to percentage * @param {number} min - The minimum value of the range * @param {number} max - The maximum value of the range * @returns {number} The percentage (0-100) */ export declare function valueToPercent(value: number, min: number, max: number): number; /** * Snap a value to the nearest step. * An unusable step means "no stepping", so the value is only clamped: dividing * by a step of `0` returned `NaN` and the thumb lost its value entirely. * @param {number} value - The value to snap * @param {number} min - The minimum boundary * @param {number} max - The maximum boundary * @param {number} step - The step size * @returns {number} The snapped value */ export declare function snapToStep(value: number, min: number, max: number, step: number): number; /** * The most ticks the track will draw. Beyond this the marks are closer than a * pixel anyway, and generating them costs more than it shows. */ export declare const MAX_TICKS = 10000; /** * Whether a step can actually advance a value from a given point. * A step of `0` never moves, a negative one moves away from `max`, and `NaN` or * `Infinity` compare false forever — each turns a `v += step` loop into an * endless one. So does a step too small to register at `from`'s magnitude: * `1 + Number.MIN_VALUE === 1`, so the loop stands still there while every * check says the step is positive and finite. * @param {number} step - The step size to check. * @param {number} from - The value the step has to move; defaults to 0. * @returns {boolean} True when the step can be stepped with. */ export declare function isUsableStep(step: number, from?: number): boolean; /** * Generate tick values for the slider. * The track falls back to its bounds when the step cannot walk it: one that * never advances (`step={0}` with `showTicks` used to hang the tab, buffering * millions of ticks a second), and one so fine that it would draw more than * {@link MAX_TICKS} marks — `0.000001` across `0…100` is a hundred million of * them, which is a hang in all but name. * @param {number} min - The minimum value * @param {number} max - The maximum value * @param {number} step - The step size * @returns {number[]} Array of tick values */ export declare function generateTicks(min: number, max: number, step: number): number[]; /** * Snap a value to the nearest tick mark. * @param {number} value - The value to snap * @param {object[]} ticks - Array of tick objects * @returns {number} The value of the closest tick */ export declare function snapToTicks(value: number, ticks: { /** The value of the tick */ value: number; }[]): number; /** * Format a numeric value for display, preserving trailing zeros based on step precision * @param {number} value - The value to format * @param {number} step - The step size that determines decimal precision * @returns {string} Formatted value string with appropriate decimal places */ export declare function formatValueForDisplay(value: number, step: number): string;