/** * Voice-input shortcut logic. * Canonical chord format: lowercase, '+' separated modifiers in order ctrl, alt, shift, meta, then key. */ export type ShortcutModifier = 'ctrl' | 'alt' | 'shift' | 'meta'; export declare const SHORTCUT_MODIFIERS: readonly ShortcutModifier[]; export declare const SHORTCUT_MAX_LENGTH = 64; export interface ParsedShortcut { readonly modifiers: readonly ShortcutModifier[]; readonly key: string; } /** Map a modifier keydown/keyup to its canonical token. */ export declare function modifierTokenFromEvent(event: { readonly key?: string; readonly code?: string; }): ShortcutModifier | null; /** Parse a canonical chord into modifiers and key token; null on malformed input. */ export declare function parseShortcut(chord: string): ParsedShortcut | null; /** Rebuild a canonical chord from any valid token order; null on malformed input. */ export declare function normalizeShortcut(chord: string): string | null; export declare function shortcutFromModifiers(modifiers: readonly ShortcutModifier[]): string | null; export type ShortcutRejectReason = 'typing-key' | 'invalid'; /** Determine whether a shortcut chord should be rejected as invalid or a bare typing key. */ export declare function shortcutRejectReason(chord: string): ShortcutRejectReason | null; export declare function isValidStoredShortcut(chord: string): boolean; /** True when the chord is valid but collides with a browser/OS-reserved combination. */ export declare function isReservedShortcut(chord: string): boolean; type ModifierSourceEvent = { readonly code?: string; readonly key?: string; readonly ctrlKey: boolean; readonly altKey: boolean; readonly shiftKey: boolean; readonly metaKey: boolean; readonly getModifierState?: (key: string) => boolean; }; /** Read held modifiers from a keyboard event. */ export declare function modifiersFromEvent(event: ModifierSourceEvent, fromKey?: boolean): readonly ShortcutModifier[]; /** Build the canonical chord from a keydown; null when the event carries no capturable key. */ export declare function shortcutFromEvent(event: ModifierSourceEvent & { readonly code: string; }): string | null; /** Merge remembered held modifiers with the current event (macOS Control can vanish from the second keydown). */ export declare function shortcutFromEventAndHeld(event: ModifierSourceEvent & { readonly code: string; }, held: readonly ShortcutModifier[]): string | null; export interface ShortcutRecorderState { readonly held: readonly ShortcutModifier[]; readonly peak: readonly ShortcutModifier[]; } export declare const EMPTY_SHORTCUT_RECORDER: ShortcutRecorderState; export type ShortcutRecorderInput = ModifierSourceEvent & { readonly type: 'keydown' | 'keyup'; readonly key: string; readonly code: string; readonly repeat?: boolean; }; export type ShortcutRecorderDecision = { kind: 'ignore'; state: ShortcutRecorderState; } | { kind: 'cancel'; state: ShortcutRecorderState; } | { kind: 'update'; state: ShortcutRecorderState; } | { kind: 'commit'; state: ShortcutRecorderState; chord: string; }; /** Advance the shortcut recorder state based on a key event. */ export declare function reduceShortcutRecorder(state: ShortcutRecorderState, event: ShortcutRecorderInput): ShortcutRecorderDecision; /** True when a keydown event matches the stored chord, with strict modifier equality. */ export declare function matchesShortcut(chord: string, event: ModifierSourceEvent & { readonly code: string; }): boolean; /** True when the pressed key is a modifier key itself. */ export declare function isModifierKeyEvent(event: { readonly key: string; readonly code?: string; }): boolean; /** Render a canonical-order modifier list for live capture feedback (no key yet). */ export declare function formatModifierChord(modifiers: readonly ShortcutModifier[], platform: 'mac' | 'win' | 'linux'): string; /** Render a stored chord for display; platform only changes the primary modifier labels. */ export declare function formatShortcut(chord: string, platform: 'mac' | 'win' | 'linux'): string; export {};