/** * A global keyboard shortcut, parsed from a combo string. Shared by `CommandPalette` (toggles the * dialog), `SearchInput` (focuses the field) and `DropdownMenu` (opens the menu) so all three read * `"mod+k"` the same way (gh#1250). */ export type ShortcutSpec = { key: string; mod: boolean; shift: boolean; alt: boolean; meta: boolean; ctrl: boolean; }; /** `"mod+shift+p"` → its parts. `true` is `mod+k`. */ export declare function parseShortcut(shortcut: boolean | string): ShortcutSpec | null; export declare function shortcutMatches(spec: ShortcutSpec, event: KeyboardEvent): boolean; /** The hint a trigger shows: `mod+shift+p` → `⌘⇧P`. */ export declare function shortcutHint(spec: ShortcutSpec): string; /** * Is focus somewhere the user is TYPING — an input, a textarea, a select, a contenteditable or an * ARIA textbox/combobox? A bare key is text there: `"/"` typed into a dialog field is a slash, * not "focus the search box" (gh#1264, measured: typing `a/b` lost the `/`). */ export declare function isEditableTarget(target: EventTarget | null): boolean; /** * Should this keydown run the shortcut? The ONE gate every global shortcut goes through: * - never during IME composition (the key belongs to the conversion, gh#1054); * - never from inside a dialog/menu/listbox that does not contain `owner` (gh#1267); * - the combo must match; * - a shortcut with NO command modifier (`"/"`, `"f"`, `"shift+?"`) is ignored while focus is in * an editable element, where that key is text. A modified one (`"mod+k"`) still fires there — * no text field types ⌘K — which is how GitHub's and Linear's palettes behave. */ export declare function shouldHandleShortcut(spec: ShortcutSpec, event: KeyboardEvent, owner?: Element | null): boolean; /** * The `aria-keyshortcuts` value for a spec (WAI-ARIA 1.2: modifiers then key, `+`-joined, with * `Control`/`Meta`/`Alt`/`Shift` spelled out and a letter upper-cased): `mod+k` → `Meta+K` on * Apple platforms, `Control+K` elsewhere; `"/"` → `/` (gh#1267). */ export declare function ariaKeyShortcuts(spec: ShortcutSpec): string;