/** * Headless time state. No DOM, no formatting, no side effects. * * Time is stored as a single "seconds of day" integer rather than a * {hours, minutes, meridiem} triple. That one change removes most of the * arithmetic bugs the v2 implementation carried, because there is only ever * one number to keep consistent. */ export declare const SECONDS_PER_DAY = 86400; export type HourCycle = 'h11' | 'h12' | 'h23' | 'h24'; export type Meridiem = 'am' | 'pm'; export type TimeField = 'hours' | 'minutes' | 'seconds'; export interface TimeParts { hours: number; minutes: number; seconds: number; } export interface TimeValidity { badInput: boolean; valueMissing: boolean; rangeUnderflow: boolean; rangeOverflow: boolean; } export interface TimeControllerOptions { hourCycle?: HourCycle | undefined; minuteStep?: number | undefined; secondStep?: number | undefined; withSeconds?: boolean | undefined; min?: string | null | undefined; max?: string | null | undefined; required?: boolean | undefined; } export declare const toSecondsOfDay: ({ hours, minutes, seconds, }: TimeParts) => number; export declare const fromSecondsOfDay: (value: number) => TimeParts; /** * Parses the machine format only (`HH:mm` / `HH:mm:ss`), the same shape * `.value` uses. Lenient human input is `parse.ts`'s job. * * Returns `null` for invalid input. Note that a valid `"00:00"` yields `0`, * so callers must compare against `null` and never rely on truthiness. */ export declare const parseTimeValue: (value: string) => number | null; export declare const toTimeValue: (value: number, withSeconds?: boolean) => string; /** `h11`/`h12` show a 12-hour dial and therefore need a meridiem control. */ export declare const is12HourCycle: (cycle: HourCycle) => boolean; export declare const toDisplayHours: (hours: number, cycle: HourCycle) => number; export declare class TimeController { #private; hourCycle: HourCycle; minuteStep: number; secondStep: number; required: boolean; min: string | null; max: string | null; constructor(options?: TimeControllerOptions); get value(): string | null; set value(next: string | null); /** Seconds since midnight, or `null` when empty. */ get secondsOfDay(): number | null; set secondsOfDay(next: number | null); get withSeconds(): boolean; set withSeconds(next: boolean); /** Marks an unparseable human edit without discarding the last good value. */ setBadInput(next: boolean): void; get parts(): TimeParts | null; get meridiem(): Meridiem | null; set meridiem(next: Meridiem); get displayHours(): number | null; /** * Steps one field, wrapping within that field only. * * Fields do not carry into one another: incrementing 09:59 by a minute gives * 09:00, not 10:00. This matches ``, where each segment is * an independent spinbutton, and is what the ARIA spinbutton role implies. */ step(field: TimeField, direction: number): void; /** * A reversed range (min > max) describes a window that crosses midnight, * e.g. min="22:00" max="06:00" for a night shift. The HTML spec defines this * behaviour for ``, so it is mirrored here. */ get inRange(): boolean; get validity(): TimeValidity; get valid(): boolean; } //# sourceMappingURL=controller.d.ts.map