/** * A fixed-width digit mask: `99:99`, `99.99.9999`. * * Fixed means every character keeps its position. Clearing a digit in the middle leaves a hole * rather than pulling the rest left, which is what a date or a time wants: deleting the month * out of `11.11.2025` must not turn the year into the month. * * `9` marks a slot that takes a digit. Every other character is a literal the caret steps over * and the user cannot type into. */ export interface MaskSelection { start: number; end: number; } export interface MaskState { value: string; selection: MaskSelection | null; } /** The mask indices that take a digit, in order. */ export declare function slotIndices(mask: string): number[]; /** The mask with every slot empty: `__.__.____`. */ export declare function emptyMask(mask: string, placeholder: string): string; /** * Any string as one character per mask index, so slots can be read and written by position. * * Every other function here assumes a value exactly as long as the mask, with literals where the * mask has them. Putting a value through this is what guarantees that, whether it came from a * keystroke, from a consumer's state, or from nothing at all. */ export declare function toMask(value: string, mask: string, placeholder: string): string; /** * Where the caret belongs when the field is entered: the first slot with no digit in it. * * A mask is as wide when empty as when full, so a click lands wherever it likes, and clicking at * the end of `__.__.____` would otherwise leave the caret past every slot with nowhere to put the * next digit. */ export declare function firstEmptyCaret(value: string, mask: string, placeholder: string): number; /** * What the field should show after the browser has changed its raw text, and where the caret * belongs. * * Works from the edit rather than from key events, so a paste, a drag, a replaced selection, an * autofill and a keystroke all arrive the same way. */ export declare function maskChange(previous: string, raw: string, caret: number, mask: string, placeholder: string): MaskState; /** Whether a masked value holds no digits at all, so the field reads as empty. */ export declare function isBlank(value: string, mask: string): boolean;