import { HotkeySequence } from "./sequence-manager.js"; import { Store } from "@tanstack/store"; //#region src/hotkey-sequence-recorder.d.ts /** * How the user can commit a recorded sequence from the keyboard. * - `'enter'`: plain Enter (no modifiers) commits when at least one step exists. * - `'none'`: only {@link HotkeySequenceRecorder.commit} finishes recording (or idle timeout if set). */ type HotkeySequenceRecorderCommitKeys = 'enter' | 'none'; /** * State interface for the HotkeySequenceRecorder. */ interface HotkeySequenceRecorderState { /** Whether recording is currently active */ isRecording: boolean; /** Chords captured so far in the current recording session */ steps: HotkeySequence; /** The last successfully committed sequence, or null if none / after starting a new session */ recordedSequence: HotkeySequence | null; } /** * Options for configuring a HotkeySequenceRecorder instance. */ interface HotkeySequenceRecorderOptions { /** Callback when a sequence is successfully recorded (including empty array when cleared) */ onRecord: (sequence: HotkeySequence) => void; /** Optional callback when recording is cancelled (Escape pressed) */ onCancel?: () => void; /** Optional callback when the sequence is cleared (Backspace/Delete with no steps) */ onClear?: () => void; /** * Whether plain Enter commits the current steps. Ignored when {@link commitKeys} is `'none'`. * @default true */ commitOnEnter?: boolean; /** * Keyboard commit mode. When `'none'`, use {@link HotkeySequenceRecorder.commit} (and optional idle timeout). * @default 'enter' */ commitKeys?: HotkeySequenceRecorderCommitKeys; /** * Milliseconds of inactivity after the **last completed chord** before auto-committing. * The timer does not run while waiting for the first chord (`steps.length === 0`). */ idleTimeoutMs?: number; /** * Whether to ignore keyboard events from input-like elements (text inputs, * textarea, select, contenteditable). When true, typing in inputs passes * through normally instead of being captured as a sequence recording. * Escape always works regardless of this setting. * @default true */ ignoreInputs?: boolean; } /** * Framework-agnostic class for recording multi-chord sequences (Vim-style shortcuts). * * Each step is captured like a single hotkey chord. Press **Enter** (no modifiers) to commit * when {@link HotkeySequenceRecorderOptions.commitKeys} is `'enter'` (default), **Escape** to cancel, * **Backspace/Delete** to remove the last step or clear when empty. */ declare class HotkeySequenceRecorder { #private; readonly store: Store; constructor(options: HotkeySequenceRecorderOptions); setOptions(options: Partial): void; start(): void; /** * Commit the current steps as a sequence. No-op if fewer than one step. */ commit(): void; stop(): void; cancel(): void; destroy(): void; } //#endregion export { HotkeySequenceRecorder, HotkeySequenceRecorderCommitKeys, HotkeySequenceRecorderOptions, HotkeySequenceRecorderState }; //# sourceMappingURL=hotkey-sequence-recorder.d.ts.map