/** * createTimePicker - the HEADLESS core behind : a runes-based * state machine for an analog clock-dial time picker (12/24-hour, minute * snapping, hour->minute auto-switch, keyboard) plus the pure dial geometry * (tick coordinates + hand endpoint) and **prop-getters** you spread onto YOUR * OWN markup. The DOM-bound pieces - pointer capture + `getBoundingClientRect` * hit-testing - stay in the styled component; this core exposes `SIZE`/`C` and a * pure `pointerSelect(angle, dist)` so the component only has to convert an event * into an angle. * * ```svelte * * : * ``` */ export type TimeValue = Date | string | number | null; export type TimeSelection = 'hour' | 'minute'; export type TimeFormat = '12-hour' | '24-hour'; /** A clock-face number and its computed position on the dial. */ export type DialTick = { label: string; x: number; y: number; value: number; ring: 'outer' | 'inner'; }; /** Reactive inputs are getters; callbacks are closures. */ export type TimePickerConfig = { /** Date, "HH:MM[:SS]" string, or epoch ms. */ value: () => TimeValue; /** Fires with a Date (today's date carrying the picked time). */ onChange?: (value: Date) => void; format?: () => TimeFormat; minuteInterval?: () => number; /** After picking an hour, jump the dial to minutes. Default true. */ autoSwitchToMinutes?: () => boolean; disabled?: () => boolean; readonly?: () => boolean; /** Which dial opens first. */ selection?: () => TimeSelection; }; /** Parse a time value to { h, m }, falling back to "now" (pure). */ export declare function parseTimeValue(v: TimeValue): { h: number; m: number; }; export declare function createTimePicker(config: TimePickerConfig): { SIZE: number; C: number; readonly hours: number; readonly minutes: number; readonly selection: TimeSelection; readonly is12: boolean; readonly isInteractive: boolean; readonly displayHour: number; readonly isPm: boolean; readonly mm: string; readonly hourTicks: DialTick[]; readonly minuteTicks: DialTick[]; readonly handEnd: { x: number; y: number; }; isActiveHour: (t: DialTick) => boolean; setSelection: (s: TimeSelection) => void; setMinute: (m: number) => void; setAmPm: (pm: boolean) => void; pointerSelect: (angle: number, dist: number) => void; endPointer: () => void; onKeydown: (e: KeyboardEvent) => void; now: () => void; /** The hour / minute segment button in the header. */ segProps(which: TimeSelection): { type: "button"; disabled: boolean; onclick: () => void; }; /** An AM / PM toggle button (12-hour mode). */ ampmProps(pm: boolean): { type: "button"; disabled: boolean; onclick: () => void; }; /** The clock dial: ARIA slider semantics + keyboard. Pointer capture stays in * the component (it needs the DOM element). */ dialProps(): { role: "slider"; tabindex: number; 'aria-label': string; 'aria-valuenow': number; 'aria-valuemin': number; 'aria-valuemax': number; onkeydown: (e: KeyboardEvent) => void; }; /** The Now footer button. */ nowProps(): { type: "button"; disabled: boolean; onclick: () => void; }; }; export type TimePicker = ReturnType;