@tanstack/hotkeys 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +121 -45
  3. package/dist/constants.cjs +444 -0
  4. package/dist/constants.cjs.map +1 -0
  5. package/dist/constants.d.cts +226 -0
  6. package/dist/constants.d.ts +226 -0
  7. package/dist/constants.js +428 -0
  8. package/dist/constants.js.map +1 -0
  9. package/dist/format.cjs +178 -0
  10. package/dist/format.cjs.map +1 -0
  11. package/dist/format.d.cts +110 -0
  12. package/dist/format.d.ts +110 -0
  13. package/dist/format.js +175 -0
  14. package/dist/format.js.map +1 -0
  15. package/dist/hotkey-manager.cjs +420 -0
  16. package/dist/hotkey-manager.cjs.map +1 -0
  17. package/dist/hotkey-manager.d.cts +207 -0
  18. package/dist/hotkey-manager.d.ts +207 -0
  19. package/dist/hotkey-manager.js +419 -0
  20. package/dist/hotkey-manager.js.map +1 -0
  21. package/dist/hotkey.d.cts +278 -0
  22. package/dist/hotkey.d.ts +278 -0
  23. package/dist/index.cjs +54 -0
  24. package/dist/index.d.cts +11 -0
  25. package/dist/index.d.ts +11 -0
  26. package/dist/index.js +11 -0
  27. package/dist/key-state-tracker.cjs +197 -0
  28. package/dist/key-state-tracker.cjs.map +1 -0
  29. package/dist/key-state-tracker.d.cts +107 -0
  30. package/dist/key-state-tracker.d.ts +107 -0
  31. package/dist/key-state-tracker.js +196 -0
  32. package/dist/key-state-tracker.js.map +1 -0
  33. package/dist/match.cjs +143 -0
  34. package/dist/match.cjs.map +1 -0
  35. package/dist/match.d.cts +79 -0
  36. package/dist/match.d.ts +79 -0
  37. package/dist/match.js +141 -0
  38. package/dist/match.js.map +1 -0
  39. package/dist/parse.cjs +266 -0
  40. package/dist/parse.cjs.map +1 -0
  41. package/dist/parse.d.cts +169 -0
  42. package/dist/parse.d.ts +169 -0
  43. package/dist/parse.js +258 -0
  44. package/dist/parse.js.map +1 -0
  45. package/dist/recorder.cjs +177 -0
  46. package/dist/recorder.cjs.map +1 -0
  47. package/dist/recorder.d.cts +108 -0
  48. package/dist/recorder.d.ts +108 -0
  49. package/dist/recorder.js +177 -0
  50. package/dist/recorder.js.map +1 -0
  51. package/dist/sequence.cjs +242 -0
  52. package/dist/sequence.cjs.map +1 -0
  53. package/dist/sequence.d.cts +109 -0
  54. package/dist/sequence.d.ts +109 -0
  55. package/dist/sequence.js +240 -0
  56. package/dist/sequence.js.map +1 -0
  57. package/dist/validate.cjs +116 -0
  58. package/dist/validate.cjs.map +1 -0
  59. package/dist/validate.d.cts +56 -0
  60. package/dist/validate.d.ts +56 -0
  61. package/dist/validate.js +114 -0
  62. package/dist/validate.js.map +1 -0
  63. package/package.json +55 -7
  64. package/src/constants.ts +514 -0
  65. package/src/format.ts +261 -0
  66. package/src/hotkey-manager.ts +822 -0
  67. package/src/hotkey.ts +411 -0
  68. package/src/index.ts +10 -0
  69. package/src/key-state-tracker.ts +249 -0
  70. package/src/match.ts +222 -0
  71. package/src/parse.ts +368 -0
  72. package/src/recorder.ts +266 -0
  73. package/src/sequence.ts +391 -0
  74. package/src/validate.ts +171 -0
@@ -0,0 +1,278 @@
1
+ //#region src/hotkey.d.ts
2
+ /**
3
+ * All supported modifier key names, including aliases.
4
+ * - Control/Ctrl: The Control key
5
+ * - Shift: The Shift key
6
+ * - Alt/Option: The Alt key (Option on macOS)
7
+ * - Command/Cmd: The Command key (macOS only)
8
+ * - CommandOrControl/Mod: Command on macOS, Control on other platforms
9
+ */
10
+ type Modifier = 'Control' | 'Ctrl' | 'Shift' | 'Alt' | 'Option' | 'Command' | 'Cmd' | 'CommandOrControl' | 'Mod';
11
+ /**
12
+ * Canonical modifier names that map to KeyboardEvent properties.
13
+ */
14
+ type CanonicalModifier = 'Control' | 'Shift' | 'Alt' | 'Meta';
15
+ /**
16
+ * Letter keys A-Z (case-insensitive in matching).
17
+ */
18
+ type LetterKey = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z';
19
+ /**
20
+ * Number keys 0-9.
21
+ */
22
+ type NumberKey = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
23
+ /**
24
+ * Function keys F1-F12.
25
+ */
26
+ type FunctionKey = 'F1' | 'F2' | 'F3' | 'F4' | 'F5' | 'F6' | 'F7' | 'F8' | 'F9' | 'F10' | 'F11' | 'F12';
27
+ /**
28
+ * Navigation keys for cursor movement.
29
+ */
30
+ type NavigationKey = 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' | 'Home' | 'End' | 'PageUp' | 'PageDown';
31
+ /**
32
+ * Editing and special keys.
33
+ */
34
+ type EditingKey = 'Enter' | 'Escape' | 'Space' | 'Tab' | 'Backspace' | 'Delete';
35
+ /**
36
+ * Punctuation keys commonly used in keyboard shortcuts.
37
+ * These are the literal characters as they appear in KeyboardEvent.key
38
+ * (layout-dependent, typically US keyboard layout).
39
+ */
40
+ type PunctuationKey = '/' | '[' | ']' | '\\' | '=' | '-' | ',' | '.' | '`';
41
+ /**
42
+ * Keys that don't change their value when Shift is pressed.
43
+ * These keys produce the same `KeyboardEvent.key` value whether Shift is held or not.
44
+ *
45
+ * Excludes NumberKey (Shift+1 produces '!' on US layout) and PunctuationKey
46
+ * (Shift+',' produces '<' on US layout).
47
+ *
48
+ * Used in hotkey type definitions to prevent layout-dependent issues when Shift
49
+ * is part of the modifier combination.
50
+ */
51
+ type NonPunctuationKey = LetterKey | NumberKey | EditingKey | NavigationKey | FunctionKey;
52
+ /**
53
+ * All supported non-modifier keys.
54
+ */
55
+ type Key = NonPunctuationKey | PunctuationKey;
56
+ /**
57
+ * Keys that can be tracked as "held" (pressed down).
58
+ * Includes both modifier keys and regular keys.
59
+ */
60
+ type HeldKey = CanonicalModifier | Key;
61
+ /**
62
+ * Single modifier + key combinations.
63
+ * Uses canonical modifiers (4) + Mod (1) = 5 modifiers.
64
+ * Shift combinations exclude PunctuationKey to avoid layout-dependent issues.
65
+ *
66
+ * The `Mod` modifier is platform-adaptive:
67
+ * - **macOS**: Resolves to `Meta` (Command key ⌘)
68
+ * - **Windows/Linux**: Resolves to `Control` (Ctrl key)
69
+ *
70
+ * This enables cross-platform hotkey definitions that automatically adapt to the platform.
71
+ * For example, `Mod+S` becomes `Command+S` on Mac and `Ctrl+S` on Windows/Linux.
72
+ */
73
+ type SingleModifierHotkey = `Control+${Key}` | `Alt+${Key}` | `Shift+${NonPunctuationKey}` | `Meta+${Key}` | `Mod+${Key}`;
74
+ /**
75
+ * Two modifier + key combinations.
76
+ * Shift combinations exclude Numbers and PunctuationKeys to avoid layout-dependent issues.
77
+ *
78
+ * **Platform-adaptive `Mod` combinations:**
79
+ * - `Mod+Alt` and `Mod+Shift` are included (safe on all platforms)
80
+ * - `Mod+Control` and `Mod+Meta` are excluded because they create duplicate modifiers:
81
+ * - `Mod+Control` duplicates `Control` on Windows/Linux (Mod = Control)
82
+ * - `Mod+Meta` duplicates `Meta` on macOS (Mod = Meta)
83
+ */
84
+ type TwoModifierHotkey = `Control+Alt+${Key}` | `Control+Shift+${NonPunctuationKey}` | `Control+Meta+${Key}` | `Alt+Shift+${NonPunctuationKey}` | `Alt+Meta+${Key}` | `Shift+Meta+${NonPunctuationKey}` | `Mod+Alt+${Key}` | `Mod+Shift+${NonPunctuationKey}`;
85
+ /**
86
+ * Three modifier + key combinations.
87
+ * Shift combinations exclude Numbers and PunctuationKeys to avoid layout-dependent issues.
88
+ *
89
+ * **Platform-adaptive `Mod` combinations:**
90
+ * - `Mod+Alt+Shift` is included (safe on all platforms)
91
+ * - `Mod+Control+Shift` and `Mod+Shift+Meta` are excluded because they create duplicate modifiers:
92
+ * - `Mod+Control+Shift` duplicates `Control` on Windows/Linux (Mod = Control)
93
+ * - `Mod+Shift+Meta` duplicates `Meta` on macOS (Mod = Meta)
94
+ */
95
+ type ThreeModifierHotkey = `Control+Alt+Shift+${NonPunctuationKey}` | `Control+Alt+Meta+${Key}` | `Control+Shift+Meta+${NonPunctuationKey}` | `Alt+Shift+Meta+${NonPunctuationKey}` | `Mod+Alt+Shift+${NonPunctuationKey}`;
96
+ /**
97
+ * Four modifier + key combinations.
98
+ * Shift combinations exclude Numbers and PunctuationKeys to avoid layout-dependent issues.
99
+ *
100
+ * Only the canonical `Control+Alt+Shift+Meta` combination is included.
101
+ *
102
+ * **Why no `Mod` combinations?**
103
+ * Since `Mod` resolves to either `Control` (Windows/Linux) or `Meta` (macOS), any
104
+ * four-modifier combination with `Mod` would create duplicate modifiers on one platform.
105
+ * For example:
106
+ * - `Mod+Control+Alt+Shift` → duplicates `Control` on Windows/Linux
107
+ * - `Mod+Alt+Shift+Meta` → duplicates `Meta` on macOS
108
+ */
109
+ type FourModifierHotkey = `Control+Alt+Shift+Meta+${NonPunctuationKey}`;
110
+ /**
111
+ * A type-safe hotkey string.
112
+ *
113
+ * Provides autocomplete for:
114
+ * - All single keys (letters, numbers, function keys, navigation, editing, punctuation)
115
+ * - Single modifier + common key (Control+S, Mod+A, Mod+/, etc.)
116
+ * - Two modifiers + common key (Mod+Shift+S, Control+Alt+A, etc.)
117
+ * - Three modifiers + common key (Control+Alt+Shift+A, Mod+Alt+Shift+S, etc.)
118
+ * - Four modifiers + common key (Control+Alt+Shift+Meta+A, etc.)
119
+ *
120
+ * ## Modifier Names
121
+ *
122
+ * Use canonical modifier names:
123
+ * - `Control` (not Ctrl) - The Control key
124
+ * - `Alt` (not Option) - The Alt key (Option on macOS)
125
+ * - `Meta` (not Command/Cmd) - The Meta/Command key (macOS only)
126
+ * - `Shift` - The Shift key
127
+ *
128
+ * ## Platform-Adaptive `Mod` Modifier
129
+ *
130
+ * The `Mod` modifier is a special platform-adaptive modifier that automatically resolves
131
+ * to the "primary modifier" on each platform:
132
+ *
133
+ * - **macOS**: `Mod` → `Meta` (Command key ⌘)
134
+ * - **Windows/Linux**: `Mod` → `Control` (Ctrl key)
135
+ *
136
+ * This enables cross-platform hotkey definitions that work correctly on all platforms
137
+ * without platform-specific code. The `Mod` modifier is resolved at runtime based on
138
+ * the detected platform.
139
+ *
140
+ * **When to use `Mod` vs platform-specific modifiers:**
141
+ * - Use `Mod` for cross-platform shortcuts (e.g., `Mod+S` for save)
142
+ * - Use `Meta` or `Control` when you need platform-specific behavior
143
+ * - Use `Mod` when you want your shortcuts to follow platform conventions automatically
144
+ *
145
+ * **Limitations:**
146
+ * - `Mod+Control` and `Mod+Meta` combinations are not allowed (they create duplicate
147
+ * modifiers on one platform)
148
+ * - In four-modifier combinations, only canonical modifiers are allowed (no `Mod`)
149
+ *
150
+ * @example
151
+ * ```ts
152
+ * // Cross-platform shortcuts (recommended)
153
+ * const save: Hotkey = 'Mod+S' // Command+S on Mac, Ctrl+S on Windows/Linux
154
+ * const saveAs: Hotkey = 'Mod+Shift+S' // Command+Shift+S on Mac, Ctrl+Shift+S elsewhere
155
+ * const comment: Hotkey = 'Mod+/' // Command+/ on Mac, Ctrl+/ elsewhere
156
+ *
157
+ * // Platform-specific shortcuts
158
+ * const macOnly: Hotkey = 'Meta+S' // Command+S on Mac only
159
+ * const windowsOnly: Hotkey = 'Control+S' // Ctrl+S on Windows/Linux only
160
+ * ```
161
+ */
162
+ type Hotkey = Key | SingleModifierHotkey | TwoModifierHotkey | ThreeModifierHotkey | FourModifierHotkey;
163
+ /**
164
+ * A parsed representation of a hotkey string.
165
+ *
166
+ * This interface provides a flexible fallback when the `Hotkey` type doesn't
167
+ * fit your use case. You can pass a `ParsedHotkey` directly to hotkey functions
168
+ * instead of a hotkey string, allowing for more dynamic or complex scenarios
169
+ * that aren't covered by the type-safe `Hotkey` union.
170
+ *
171
+ * @example
172
+ * ```ts
173
+ * // Type-safe hotkey string
174
+ * useHotkey('Mod+S', handler)
175
+ *
176
+ * // Fallback: parsed hotkey for dynamic scenarios
177
+ * const parsed = parseHotkey(userInput)
178
+ * useHotkey(parsed, handler) // Works even if userInput isn't in Hotkey type
179
+ * ```
180
+ */
181
+ interface ParsedHotkey {
182
+ /** The non-modifier key (e.g., 'S', 'Escape', 'F1', '/', '['). Can be any string for flexibility. */
183
+ key: Key | (string & {});
184
+ /** Whether the Control key is required */
185
+ ctrl: boolean;
186
+ /** Whether the Shift key is required */
187
+ shift: boolean;
188
+ /** Whether the Alt key is required */
189
+ alt: boolean;
190
+ /** Whether the Meta (Command) key is required */
191
+ meta: boolean;
192
+ /** List of canonical modifier names that are required, in canonical order */
193
+ modifiers: Array<CanonicalModifier>;
194
+ }
195
+ /**
196
+ * A raw hotkey object for programmatic registration.
197
+ *
198
+ * Like `ParsedHotkey` but without `modifiers` (derived from booleans)
199
+ * and with optional modifier booleans (default to `false` when omitted).
200
+ * Use with `HotkeyManager.register()` and `useHotkey()` when you prefer
201
+ * object form over a string.
202
+ *
203
+ * The `mod` modifier is platform-adaptive: Command on macOS, Control on Windows/Linux.
204
+ * Pass `platform` when converting to ParsedHotkey (e.g., via `options.platform`).
205
+ *
206
+ * @example
207
+ * ```ts
208
+ * useHotkey({ key: 'S', mod: true }, handler) // Mod+S (cross-platform)
209
+ * useHotkey({ key: 'S', ctrl: true }, handler) // Control+S
210
+ * useHotkey({ key: 'Escape' }, handler) // Escape (no modifiers)
211
+ * useHotkey({ key: 'A', shift: true, meta: true }, handler) // Shift+Meta+A
212
+ * useHotkey({ key: 'S', mod: true, shift: true }, handler) // Mod+Shift+S
213
+ * ```
214
+ */
215
+ interface RawHotkey {
216
+ /** The non-modifier key (e.g., 'S', 'Escape', 'F1'). */
217
+ key: Key | (string & {});
218
+ /** Platform-adaptive modifier: Command on macOS, Control on Windows/Linux. Defaults to false. */
219
+ mod?: boolean;
220
+ /** Whether the Control key is required. Defaults to false. */
221
+ ctrl?: boolean;
222
+ /** Whether the Shift key is required. Defaults to false. */
223
+ shift?: boolean;
224
+ /** Whether the Alt key is required. Defaults to false. */
225
+ alt?: boolean;
226
+ /** Whether the Meta (Command) key is required. Defaults to false. */
227
+ meta?: boolean;
228
+ }
229
+ /**
230
+ * A hotkey that can be passed to `HotkeyManager.register()` and `useHotkey()`.
231
+ * Either a type-safe string (`Hotkey`) or a raw object (`RawHotkey`).
232
+ */
233
+ type RegisterableHotkey = Hotkey | RawHotkey;
234
+ /**
235
+ * Options for formatting hotkeys for display.
236
+ */
237
+ interface FormatDisplayOptions {
238
+ /** The target platform. Defaults to auto-detection. */
239
+ platform?: 'mac' | 'windows' | 'linux';
240
+ }
241
+ /**
242
+ * Result of validating a hotkey string.
243
+ */
244
+ interface ValidationResult {
245
+ /** Whether the hotkey is valid (can still have warnings) */
246
+ valid: boolean;
247
+ /** Warning messages about potential issues */
248
+ warnings: Array<string>;
249
+ /** Error messages about invalid syntax */
250
+ errors: Array<string>;
251
+ }
252
+ /**
253
+ * Context passed to hotkey callbacks along with the keyboard event.
254
+ */
255
+ interface HotkeyCallbackContext {
256
+ /** The original hotkey string that was registered */
257
+ hotkey: Hotkey;
258
+ /** The parsed representation of the hotkey */
259
+ parsedHotkey: ParsedHotkey;
260
+ }
261
+ /**
262
+ * Callback function type for hotkey handlers.
263
+ *
264
+ * @param event - The keyboard event that triggered the hotkey
265
+ * @param context - Additional context including the hotkey and parsed hotkey
266
+ *
267
+ * @example
268
+ * ```ts
269
+ * const handler: HotkeyCallback = (event, { hotkey, parsedHotkey }) => {
270
+ * console.log(`Hotkey ${hotkey} was pressed`)
271
+ * console.log(`Modifiers:`, parsedHotkey.modifiers)
272
+ * }
273
+ * ```
274
+ */
275
+ type HotkeyCallback = (event: KeyboardEvent, context: HotkeyCallbackContext) => void;
276
+ //#endregion
277
+ export { CanonicalModifier, EditingKey, FormatDisplayOptions, FunctionKey, HeldKey, Hotkey, HotkeyCallback, HotkeyCallbackContext, Key, LetterKey, Modifier, NavigationKey, NumberKey, ParsedHotkey, PunctuationKey, RawHotkey, RegisterableHotkey, ValidationResult };
278
+ //# sourceMappingURL=hotkey.d.cts.map
@@ -0,0 +1,278 @@
1
+ //#region src/hotkey.d.ts
2
+ /**
3
+ * All supported modifier key names, including aliases.
4
+ * - Control/Ctrl: The Control key
5
+ * - Shift: The Shift key
6
+ * - Alt/Option: The Alt key (Option on macOS)
7
+ * - Command/Cmd: The Command key (macOS only)
8
+ * - CommandOrControl/Mod: Command on macOS, Control on other platforms
9
+ */
10
+ type Modifier = 'Control' | 'Ctrl' | 'Shift' | 'Alt' | 'Option' | 'Command' | 'Cmd' | 'CommandOrControl' | 'Mod';
11
+ /**
12
+ * Canonical modifier names that map to KeyboardEvent properties.
13
+ */
14
+ type CanonicalModifier = 'Control' | 'Shift' | 'Alt' | 'Meta';
15
+ /**
16
+ * Letter keys A-Z (case-insensitive in matching).
17
+ */
18
+ type LetterKey = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z';
19
+ /**
20
+ * Number keys 0-9.
21
+ */
22
+ type NumberKey = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
23
+ /**
24
+ * Function keys F1-F12.
25
+ */
26
+ type FunctionKey = 'F1' | 'F2' | 'F3' | 'F4' | 'F5' | 'F6' | 'F7' | 'F8' | 'F9' | 'F10' | 'F11' | 'F12';
27
+ /**
28
+ * Navigation keys for cursor movement.
29
+ */
30
+ type NavigationKey = 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' | 'Home' | 'End' | 'PageUp' | 'PageDown';
31
+ /**
32
+ * Editing and special keys.
33
+ */
34
+ type EditingKey = 'Enter' | 'Escape' | 'Space' | 'Tab' | 'Backspace' | 'Delete';
35
+ /**
36
+ * Punctuation keys commonly used in keyboard shortcuts.
37
+ * These are the literal characters as they appear in KeyboardEvent.key
38
+ * (layout-dependent, typically US keyboard layout).
39
+ */
40
+ type PunctuationKey = '/' | '[' | ']' | '\\' | '=' | '-' | ',' | '.' | '`';
41
+ /**
42
+ * Keys that don't change their value when Shift is pressed.
43
+ * These keys produce the same `KeyboardEvent.key` value whether Shift is held or not.
44
+ *
45
+ * Excludes NumberKey (Shift+1 produces '!' on US layout) and PunctuationKey
46
+ * (Shift+',' produces '<' on US layout).
47
+ *
48
+ * Used in hotkey type definitions to prevent layout-dependent issues when Shift
49
+ * is part of the modifier combination.
50
+ */
51
+ type NonPunctuationKey = LetterKey | NumberKey | EditingKey | NavigationKey | FunctionKey;
52
+ /**
53
+ * All supported non-modifier keys.
54
+ */
55
+ type Key = NonPunctuationKey | PunctuationKey;
56
+ /**
57
+ * Keys that can be tracked as "held" (pressed down).
58
+ * Includes both modifier keys and regular keys.
59
+ */
60
+ type HeldKey = CanonicalModifier | Key;
61
+ /**
62
+ * Single modifier + key combinations.
63
+ * Uses canonical modifiers (4) + Mod (1) = 5 modifiers.
64
+ * Shift combinations exclude PunctuationKey to avoid layout-dependent issues.
65
+ *
66
+ * The `Mod` modifier is platform-adaptive:
67
+ * - **macOS**: Resolves to `Meta` (Command key ⌘)
68
+ * - **Windows/Linux**: Resolves to `Control` (Ctrl key)
69
+ *
70
+ * This enables cross-platform hotkey definitions that automatically adapt to the platform.
71
+ * For example, `Mod+S` becomes `Command+S` on Mac and `Ctrl+S` on Windows/Linux.
72
+ */
73
+ type SingleModifierHotkey = `Control+${Key}` | `Alt+${Key}` | `Shift+${NonPunctuationKey}` | `Meta+${Key}` | `Mod+${Key}`;
74
+ /**
75
+ * Two modifier + key combinations.
76
+ * Shift combinations exclude Numbers and PunctuationKeys to avoid layout-dependent issues.
77
+ *
78
+ * **Platform-adaptive `Mod` combinations:**
79
+ * - `Mod+Alt` and `Mod+Shift` are included (safe on all platforms)
80
+ * - `Mod+Control` and `Mod+Meta` are excluded because they create duplicate modifiers:
81
+ * - `Mod+Control` duplicates `Control` on Windows/Linux (Mod = Control)
82
+ * - `Mod+Meta` duplicates `Meta` on macOS (Mod = Meta)
83
+ */
84
+ type TwoModifierHotkey = `Control+Alt+${Key}` | `Control+Shift+${NonPunctuationKey}` | `Control+Meta+${Key}` | `Alt+Shift+${NonPunctuationKey}` | `Alt+Meta+${Key}` | `Shift+Meta+${NonPunctuationKey}` | `Mod+Alt+${Key}` | `Mod+Shift+${NonPunctuationKey}`;
85
+ /**
86
+ * Three modifier + key combinations.
87
+ * Shift combinations exclude Numbers and PunctuationKeys to avoid layout-dependent issues.
88
+ *
89
+ * **Platform-adaptive `Mod` combinations:**
90
+ * - `Mod+Alt+Shift` is included (safe on all platforms)
91
+ * - `Mod+Control+Shift` and `Mod+Shift+Meta` are excluded because they create duplicate modifiers:
92
+ * - `Mod+Control+Shift` duplicates `Control` on Windows/Linux (Mod = Control)
93
+ * - `Mod+Shift+Meta` duplicates `Meta` on macOS (Mod = Meta)
94
+ */
95
+ type ThreeModifierHotkey = `Control+Alt+Shift+${NonPunctuationKey}` | `Control+Alt+Meta+${Key}` | `Control+Shift+Meta+${NonPunctuationKey}` | `Alt+Shift+Meta+${NonPunctuationKey}` | `Mod+Alt+Shift+${NonPunctuationKey}`;
96
+ /**
97
+ * Four modifier + key combinations.
98
+ * Shift combinations exclude Numbers and PunctuationKeys to avoid layout-dependent issues.
99
+ *
100
+ * Only the canonical `Control+Alt+Shift+Meta` combination is included.
101
+ *
102
+ * **Why no `Mod` combinations?**
103
+ * Since `Mod` resolves to either `Control` (Windows/Linux) or `Meta` (macOS), any
104
+ * four-modifier combination with `Mod` would create duplicate modifiers on one platform.
105
+ * For example:
106
+ * - `Mod+Control+Alt+Shift` → duplicates `Control` on Windows/Linux
107
+ * - `Mod+Alt+Shift+Meta` → duplicates `Meta` on macOS
108
+ */
109
+ type FourModifierHotkey = `Control+Alt+Shift+Meta+${NonPunctuationKey}`;
110
+ /**
111
+ * A type-safe hotkey string.
112
+ *
113
+ * Provides autocomplete for:
114
+ * - All single keys (letters, numbers, function keys, navigation, editing, punctuation)
115
+ * - Single modifier + common key (Control+S, Mod+A, Mod+/, etc.)
116
+ * - Two modifiers + common key (Mod+Shift+S, Control+Alt+A, etc.)
117
+ * - Three modifiers + common key (Control+Alt+Shift+A, Mod+Alt+Shift+S, etc.)
118
+ * - Four modifiers + common key (Control+Alt+Shift+Meta+A, etc.)
119
+ *
120
+ * ## Modifier Names
121
+ *
122
+ * Use canonical modifier names:
123
+ * - `Control` (not Ctrl) - The Control key
124
+ * - `Alt` (not Option) - The Alt key (Option on macOS)
125
+ * - `Meta` (not Command/Cmd) - The Meta/Command key (macOS only)
126
+ * - `Shift` - The Shift key
127
+ *
128
+ * ## Platform-Adaptive `Mod` Modifier
129
+ *
130
+ * The `Mod` modifier is a special platform-adaptive modifier that automatically resolves
131
+ * to the "primary modifier" on each platform:
132
+ *
133
+ * - **macOS**: `Mod` → `Meta` (Command key ⌘)
134
+ * - **Windows/Linux**: `Mod` → `Control` (Ctrl key)
135
+ *
136
+ * This enables cross-platform hotkey definitions that work correctly on all platforms
137
+ * without platform-specific code. The `Mod` modifier is resolved at runtime based on
138
+ * the detected platform.
139
+ *
140
+ * **When to use `Mod` vs platform-specific modifiers:**
141
+ * - Use `Mod` for cross-platform shortcuts (e.g., `Mod+S` for save)
142
+ * - Use `Meta` or `Control` when you need platform-specific behavior
143
+ * - Use `Mod` when you want your shortcuts to follow platform conventions automatically
144
+ *
145
+ * **Limitations:**
146
+ * - `Mod+Control` and `Mod+Meta` combinations are not allowed (they create duplicate
147
+ * modifiers on one platform)
148
+ * - In four-modifier combinations, only canonical modifiers are allowed (no `Mod`)
149
+ *
150
+ * @example
151
+ * ```ts
152
+ * // Cross-platform shortcuts (recommended)
153
+ * const save: Hotkey = 'Mod+S' // Command+S on Mac, Ctrl+S on Windows/Linux
154
+ * const saveAs: Hotkey = 'Mod+Shift+S' // Command+Shift+S on Mac, Ctrl+Shift+S elsewhere
155
+ * const comment: Hotkey = 'Mod+/' // Command+/ on Mac, Ctrl+/ elsewhere
156
+ *
157
+ * // Platform-specific shortcuts
158
+ * const macOnly: Hotkey = 'Meta+S' // Command+S on Mac only
159
+ * const windowsOnly: Hotkey = 'Control+S' // Ctrl+S on Windows/Linux only
160
+ * ```
161
+ */
162
+ type Hotkey = Key | SingleModifierHotkey | TwoModifierHotkey | ThreeModifierHotkey | FourModifierHotkey;
163
+ /**
164
+ * A parsed representation of a hotkey string.
165
+ *
166
+ * This interface provides a flexible fallback when the `Hotkey` type doesn't
167
+ * fit your use case. You can pass a `ParsedHotkey` directly to hotkey functions
168
+ * instead of a hotkey string, allowing for more dynamic or complex scenarios
169
+ * that aren't covered by the type-safe `Hotkey` union.
170
+ *
171
+ * @example
172
+ * ```ts
173
+ * // Type-safe hotkey string
174
+ * useHotkey('Mod+S', handler)
175
+ *
176
+ * // Fallback: parsed hotkey for dynamic scenarios
177
+ * const parsed = parseHotkey(userInput)
178
+ * useHotkey(parsed, handler) // Works even if userInput isn't in Hotkey type
179
+ * ```
180
+ */
181
+ interface ParsedHotkey {
182
+ /** The non-modifier key (e.g., 'S', 'Escape', 'F1', '/', '['). Can be any string for flexibility. */
183
+ key: Key | (string & {});
184
+ /** Whether the Control key is required */
185
+ ctrl: boolean;
186
+ /** Whether the Shift key is required */
187
+ shift: boolean;
188
+ /** Whether the Alt key is required */
189
+ alt: boolean;
190
+ /** Whether the Meta (Command) key is required */
191
+ meta: boolean;
192
+ /** List of canonical modifier names that are required, in canonical order */
193
+ modifiers: Array<CanonicalModifier>;
194
+ }
195
+ /**
196
+ * A raw hotkey object for programmatic registration.
197
+ *
198
+ * Like `ParsedHotkey` but without `modifiers` (derived from booleans)
199
+ * and with optional modifier booleans (default to `false` when omitted).
200
+ * Use with `HotkeyManager.register()` and `useHotkey()` when you prefer
201
+ * object form over a string.
202
+ *
203
+ * The `mod` modifier is platform-adaptive: Command on macOS, Control on Windows/Linux.
204
+ * Pass `platform` when converting to ParsedHotkey (e.g., via `options.platform`).
205
+ *
206
+ * @example
207
+ * ```ts
208
+ * useHotkey({ key: 'S', mod: true }, handler) // Mod+S (cross-platform)
209
+ * useHotkey({ key: 'S', ctrl: true }, handler) // Control+S
210
+ * useHotkey({ key: 'Escape' }, handler) // Escape (no modifiers)
211
+ * useHotkey({ key: 'A', shift: true, meta: true }, handler) // Shift+Meta+A
212
+ * useHotkey({ key: 'S', mod: true, shift: true }, handler) // Mod+Shift+S
213
+ * ```
214
+ */
215
+ interface RawHotkey {
216
+ /** The non-modifier key (e.g., 'S', 'Escape', 'F1'). */
217
+ key: Key | (string & {});
218
+ /** Platform-adaptive modifier: Command on macOS, Control on Windows/Linux. Defaults to false. */
219
+ mod?: boolean;
220
+ /** Whether the Control key is required. Defaults to false. */
221
+ ctrl?: boolean;
222
+ /** Whether the Shift key is required. Defaults to false. */
223
+ shift?: boolean;
224
+ /** Whether the Alt key is required. Defaults to false. */
225
+ alt?: boolean;
226
+ /** Whether the Meta (Command) key is required. Defaults to false. */
227
+ meta?: boolean;
228
+ }
229
+ /**
230
+ * A hotkey that can be passed to `HotkeyManager.register()` and `useHotkey()`.
231
+ * Either a type-safe string (`Hotkey`) or a raw object (`RawHotkey`).
232
+ */
233
+ type RegisterableHotkey = Hotkey | RawHotkey;
234
+ /**
235
+ * Options for formatting hotkeys for display.
236
+ */
237
+ interface FormatDisplayOptions {
238
+ /** The target platform. Defaults to auto-detection. */
239
+ platform?: 'mac' | 'windows' | 'linux';
240
+ }
241
+ /**
242
+ * Result of validating a hotkey string.
243
+ */
244
+ interface ValidationResult {
245
+ /** Whether the hotkey is valid (can still have warnings) */
246
+ valid: boolean;
247
+ /** Warning messages about potential issues */
248
+ warnings: Array<string>;
249
+ /** Error messages about invalid syntax */
250
+ errors: Array<string>;
251
+ }
252
+ /**
253
+ * Context passed to hotkey callbacks along with the keyboard event.
254
+ */
255
+ interface HotkeyCallbackContext {
256
+ /** The original hotkey string that was registered */
257
+ hotkey: Hotkey;
258
+ /** The parsed representation of the hotkey */
259
+ parsedHotkey: ParsedHotkey;
260
+ }
261
+ /**
262
+ * Callback function type for hotkey handlers.
263
+ *
264
+ * @param event - The keyboard event that triggered the hotkey
265
+ * @param context - Additional context including the hotkey and parsed hotkey
266
+ *
267
+ * @example
268
+ * ```ts
269
+ * const handler: HotkeyCallback = (event, { hotkey, parsedHotkey }) => {
270
+ * console.log(`Hotkey ${hotkey} was pressed`)
271
+ * console.log(`Modifiers:`, parsedHotkey.modifiers)
272
+ * }
273
+ * ```
274
+ */
275
+ type HotkeyCallback = (event: KeyboardEvent, context: HotkeyCallbackContext) => void;
276
+ //#endregion
277
+ export { CanonicalModifier, EditingKey, FormatDisplayOptions, FunctionKey, HeldKey, Hotkey, HotkeyCallback, HotkeyCallbackContext, Key, LetterKey, Modifier, NavigationKey, NumberKey, ParsedHotkey, PunctuationKey, RawHotkey, RegisterableHotkey, ValidationResult };
278
+ //# sourceMappingURL=hotkey.d.ts.map
package/dist/index.cjs ADDED
@@ -0,0 +1,54 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_constants = require('./constants.cjs');
3
+ const require_parse = require('./parse.cjs');
4
+ const require_format = require('./format.cjs');
5
+ const require_match = require('./match.cjs');
6
+ const require_hotkey_manager = require('./hotkey-manager.cjs');
7
+ const require_key_state_tracker = require('./key-state-tracker.cjs');
8
+ const require_recorder = require('./recorder.cjs');
9
+ const require_sequence = require('./sequence.cjs');
10
+ const require_validate = require('./validate.cjs');
11
+
12
+ exports.ALL_KEYS = require_constants.ALL_KEYS;
13
+ exports.EDITING_KEYS = require_constants.EDITING_KEYS;
14
+ exports.FUNCTION_KEYS = require_constants.FUNCTION_KEYS;
15
+ exports.HotkeyManager = require_hotkey_manager.HotkeyManager;
16
+ exports.HotkeyRecorder = require_recorder.HotkeyRecorder;
17
+ exports.KEY_DISPLAY_SYMBOLS = require_constants.KEY_DISPLAY_SYMBOLS;
18
+ exports.KeyStateTracker = require_key_state_tracker.KeyStateTracker;
19
+ exports.LETTER_KEYS = require_constants.LETTER_KEYS;
20
+ exports.MAC_MODIFIER_SYMBOLS = require_constants.MAC_MODIFIER_SYMBOLS;
21
+ exports.MODIFIER_ALIASES = require_constants.MODIFIER_ALIASES;
22
+ exports.MODIFIER_KEYS = require_constants.MODIFIER_KEYS;
23
+ exports.MODIFIER_ORDER = require_constants.MODIFIER_ORDER;
24
+ exports.NAVIGATION_KEYS = require_constants.NAVIGATION_KEYS;
25
+ exports.NUMBER_KEYS = require_constants.NUMBER_KEYS;
26
+ exports.PUNCTUATION_KEYS = require_constants.PUNCTUATION_KEYS;
27
+ exports.STANDARD_MODIFIER_LABELS = require_constants.STANDARD_MODIFIER_LABELS;
28
+ exports.SequenceManager = require_sequence.SequenceManager;
29
+ exports.assertValidHotkey = require_validate.assertValidHotkey;
30
+ exports.checkHotkey = require_validate.checkHotkey;
31
+ exports.convertToModFormat = require_parse.convertToModFormat;
32
+ exports.createHotkeyHandler = require_match.createHotkeyHandler;
33
+ exports.createMultiHotkeyHandler = require_match.createMultiHotkeyHandler;
34
+ exports.createSequenceMatcher = require_sequence.createSequenceMatcher;
35
+ exports.detectPlatform = require_constants.detectPlatform;
36
+ exports.formatForDisplay = require_format.formatForDisplay;
37
+ exports.formatHotkey = require_format.formatHotkey;
38
+ exports.formatKeyForDebuggingDisplay = require_format.formatKeyForDebuggingDisplay;
39
+ exports.formatWithLabels = require_format.formatWithLabels;
40
+ exports.getHotkeyManager = require_hotkey_manager.getHotkeyManager;
41
+ exports.getKeyStateTracker = require_key_state_tracker.getKeyStateTracker;
42
+ exports.getSequenceManager = require_sequence.getSequenceManager;
43
+ exports.hasNonModifierKey = require_parse.hasNonModifierKey;
44
+ exports.isModifier = require_parse.isModifier;
45
+ exports.isModifierKey = require_parse.isModifierKey;
46
+ exports.keyboardEventToHotkey = require_parse.keyboardEventToHotkey;
47
+ exports.matchesKeyboardEvent = require_match.matchesKeyboardEvent;
48
+ exports.normalizeHotkey = require_parse.normalizeHotkey;
49
+ exports.normalizeKeyName = require_constants.normalizeKeyName;
50
+ exports.parseHotkey = require_parse.parseHotkey;
51
+ exports.parseKeyboardEvent = require_parse.parseKeyboardEvent;
52
+ exports.rawHotkeyToParsedHotkey = require_parse.rawHotkeyToParsedHotkey;
53
+ exports.resolveModifier = require_constants.resolveModifier;
54
+ exports.validateHotkey = require_validate.validateHotkey;
@@ -0,0 +1,11 @@
1
+ import { CanonicalModifier, EditingKey, FormatDisplayOptions, FunctionKey, HeldKey, Hotkey, HotkeyCallback, HotkeyCallbackContext, Key, LetterKey, Modifier, NavigationKey, NumberKey, ParsedHotkey, PunctuationKey, RawHotkey, RegisterableHotkey, ValidationResult } from "./hotkey.cjs";
2
+ import { ALL_KEYS, EDITING_KEYS, FUNCTION_KEYS, KEY_DISPLAY_SYMBOLS, LETTER_KEYS, MAC_MODIFIER_SYMBOLS, MODIFIER_ALIASES, MODIFIER_KEYS, MODIFIER_ORDER, NAVIGATION_KEYS, NUMBER_KEYS, PUNCTUATION_KEYS, STANDARD_MODIFIER_LABELS, detectPlatform, normalizeKeyName, resolveModifier } from "./constants.cjs";
3
+ import { FormatKeyDebuggingOptions, formatForDisplay, formatHotkey, formatKeyForDebuggingDisplay, formatWithLabels } from "./format.cjs";
4
+ import { ConflictBehavior, HotkeyManager, HotkeyOptions, HotkeyRegistration, HotkeyRegistrationHandle, getHotkeyManager } from "./hotkey-manager.cjs";
5
+ import { KeyStateTracker, KeyStateTrackerState, getKeyStateTracker } from "./key-state-tracker.cjs";
6
+ import { CreateHotkeyHandlerOptions, createHotkeyHandler, createMultiHotkeyHandler, matchesKeyboardEvent } from "./match.cjs";
7
+ import { convertToModFormat, hasNonModifierKey, isModifier, isModifierKey, keyboardEventToHotkey, normalizeHotkey, parseHotkey, parseKeyboardEvent, rawHotkeyToParsedHotkey } from "./parse.cjs";
8
+ import { HotkeyRecorder, HotkeyRecorderOptions, HotkeyRecorderState } from "./recorder.cjs";
9
+ import { HotkeySequence, SequenceManager, SequenceOptions, createSequenceMatcher, getSequenceManager } from "./sequence.cjs";
10
+ import { assertValidHotkey, checkHotkey, validateHotkey } from "./validate.cjs";
11
+ export { ALL_KEYS, CanonicalModifier, ConflictBehavior, CreateHotkeyHandlerOptions, EDITING_KEYS, EditingKey, FUNCTION_KEYS, FormatDisplayOptions, FormatKeyDebuggingOptions, FunctionKey, HeldKey, Hotkey, HotkeyCallback, HotkeyCallbackContext, HotkeyManager, HotkeyOptions, HotkeyRecorder, HotkeyRecorderOptions, HotkeyRecorderState, HotkeyRegistration, HotkeyRegistrationHandle, HotkeySequence, KEY_DISPLAY_SYMBOLS, Key, KeyStateTracker, KeyStateTrackerState, LETTER_KEYS, LetterKey, MAC_MODIFIER_SYMBOLS, MODIFIER_ALIASES, MODIFIER_KEYS, MODIFIER_ORDER, Modifier, NAVIGATION_KEYS, NUMBER_KEYS, NavigationKey, NumberKey, PUNCTUATION_KEYS, ParsedHotkey, PunctuationKey, RawHotkey, RegisterableHotkey, STANDARD_MODIFIER_LABELS, SequenceManager, SequenceOptions, ValidationResult, assertValidHotkey, checkHotkey, convertToModFormat, createHotkeyHandler, createMultiHotkeyHandler, createSequenceMatcher, detectPlatform, formatForDisplay, formatHotkey, formatKeyForDebuggingDisplay, formatWithLabels, getHotkeyManager, getKeyStateTracker, getSequenceManager, hasNonModifierKey, isModifier, isModifierKey, keyboardEventToHotkey, matchesKeyboardEvent, normalizeHotkey, normalizeKeyName, parseHotkey, parseKeyboardEvent, rawHotkeyToParsedHotkey, resolveModifier, validateHotkey };
@@ -0,0 +1,11 @@
1
+ import { CanonicalModifier, EditingKey, FormatDisplayOptions, FunctionKey, HeldKey, Hotkey, HotkeyCallback, HotkeyCallbackContext, Key, LetterKey, Modifier, NavigationKey, NumberKey, ParsedHotkey, PunctuationKey, RawHotkey, RegisterableHotkey, ValidationResult } from "./hotkey.js";
2
+ import { ALL_KEYS, EDITING_KEYS, FUNCTION_KEYS, KEY_DISPLAY_SYMBOLS, LETTER_KEYS, MAC_MODIFIER_SYMBOLS, MODIFIER_ALIASES, MODIFIER_KEYS, MODIFIER_ORDER, NAVIGATION_KEYS, NUMBER_KEYS, PUNCTUATION_KEYS, STANDARD_MODIFIER_LABELS, detectPlatform, normalizeKeyName, resolveModifier } from "./constants.js";
3
+ import { FormatKeyDebuggingOptions, formatForDisplay, formatHotkey, formatKeyForDebuggingDisplay, formatWithLabels } from "./format.js";
4
+ import { ConflictBehavior, HotkeyManager, HotkeyOptions, HotkeyRegistration, HotkeyRegistrationHandle, getHotkeyManager } from "./hotkey-manager.js";
5
+ import { KeyStateTracker, KeyStateTrackerState, getKeyStateTracker } from "./key-state-tracker.js";
6
+ import { CreateHotkeyHandlerOptions, createHotkeyHandler, createMultiHotkeyHandler, matchesKeyboardEvent } from "./match.js";
7
+ import { convertToModFormat, hasNonModifierKey, isModifier, isModifierKey, keyboardEventToHotkey, normalizeHotkey, parseHotkey, parseKeyboardEvent, rawHotkeyToParsedHotkey } from "./parse.js";
8
+ import { HotkeyRecorder, HotkeyRecorderOptions, HotkeyRecorderState } from "./recorder.js";
9
+ import { HotkeySequence, SequenceManager, SequenceOptions, createSequenceMatcher, getSequenceManager } from "./sequence.js";
10
+ import { assertValidHotkey, checkHotkey, validateHotkey } from "./validate.js";
11
+ export { ALL_KEYS, CanonicalModifier, ConflictBehavior, CreateHotkeyHandlerOptions, EDITING_KEYS, EditingKey, FUNCTION_KEYS, FormatDisplayOptions, FormatKeyDebuggingOptions, FunctionKey, HeldKey, Hotkey, HotkeyCallback, HotkeyCallbackContext, HotkeyManager, HotkeyOptions, HotkeyRecorder, HotkeyRecorderOptions, HotkeyRecorderState, HotkeyRegistration, HotkeyRegistrationHandle, HotkeySequence, KEY_DISPLAY_SYMBOLS, Key, KeyStateTracker, KeyStateTrackerState, LETTER_KEYS, LetterKey, MAC_MODIFIER_SYMBOLS, MODIFIER_ALIASES, MODIFIER_KEYS, MODIFIER_ORDER, Modifier, NAVIGATION_KEYS, NUMBER_KEYS, NavigationKey, NumberKey, PUNCTUATION_KEYS, ParsedHotkey, PunctuationKey, RawHotkey, RegisterableHotkey, STANDARD_MODIFIER_LABELS, SequenceManager, SequenceOptions, ValidationResult, assertValidHotkey, checkHotkey, convertToModFormat, createHotkeyHandler, createMultiHotkeyHandler, createSequenceMatcher, detectPlatform, formatForDisplay, formatHotkey, formatKeyForDebuggingDisplay, formatWithLabels, getHotkeyManager, getKeyStateTracker, getSequenceManager, hasNonModifierKey, isModifier, isModifierKey, keyboardEventToHotkey, matchesKeyboardEvent, normalizeHotkey, normalizeKeyName, parseHotkey, parseKeyboardEvent, rawHotkeyToParsedHotkey, resolveModifier, validateHotkey };
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ import { ALL_KEYS, EDITING_KEYS, FUNCTION_KEYS, KEY_DISPLAY_SYMBOLS, LETTER_KEYS, MAC_MODIFIER_SYMBOLS, MODIFIER_ALIASES, MODIFIER_KEYS, MODIFIER_ORDER, NAVIGATION_KEYS, NUMBER_KEYS, PUNCTUATION_KEYS, STANDARD_MODIFIER_LABELS, detectPlatform, normalizeKeyName, resolveModifier } from "./constants.js";
2
+ import { convertToModFormat, hasNonModifierKey, isModifier, isModifierKey, keyboardEventToHotkey, normalizeHotkey, parseHotkey, parseKeyboardEvent, rawHotkeyToParsedHotkey } from "./parse.js";
3
+ import { formatForDisplay, formatHotkey, formatKeyForDebuggingDisplay, formatWithLabels } from "./format.js";
4
+ import { createHotkeyHandler, createMultiHotkeyHandler, matchesKeyboardEvent } from "./match.js";
5
+ import { HotkeyManager, getHotkeyManager } from "./hotkey-manager.js";
6
+ import { KeyStateTracker, getKeyStateTracker } from "./key-state-tracker.js";
7
+ import { HotkeyRecorder } from "./recorder.js";
8
+ import { SequenceManager, createSequenceMatcher, getSequenceManager } from "./sequence.js";
9
+ import { assertValidHotkey, checkHotkey, validateHotkey } from "./validate.js";
10
+
11
+ export { ALL_KEYS, EDITING_KEYS, FUNCTION_KEYS, HotkeyManager, HotkeyRecorder, KEY_DISPLAY_SYMBOLS, KeyStateTracker, LETTER_KEYS, MAC_MODIFIER_SYMBOLS, MODIFIER_ALIASES, MODIFIER_KEYS, MODIFIER_ORDER, NAVIGATION_KEYS, NUMBER_KEYS, PUNCTUATION_KEYS, STANDARD_MODIFIER_LABELS, SequenceManager, assertValidHotkey, checkHotkey, convertToModFormat, createHotkeyHandler, createMultiHotkeyHandler, createSequenceMatcher, detectPlatform, formatForDisplay, formatHotkey, formatKeyForDebuggingDisplay, formatWithLabels, getHotkeyManager, getKeyStateTracker, getSequenceManager, hasNonModifierKey, isModifier, isModifierKey, keyboardEventToHotkey, matchesKeyboardEvent, normalizeHotkey, normalizeKeyName, parseHotkey, parseKeyboardEvent, rawHotkeyToParsedHotkey, resolveModifier, validateHotkey };