@tanstack/hotkeys 0.8.0 → 0.10.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 (109) hide show
  1. package/README.md +15 -1
  2. package/dist/{manager.utils.js → _event-target.js} +2 -41
  3. package/dist/_keyboard-event.js +75 -0
  4. package/dist/_match.js +48 -0
  5. package/dist/_named-keys.d.ts +6 -0
  6. package/dist/_named-keys.js +65 -0
  7. package/dist/_recorder-chord.js +42 -0
  8. package/dist/_recording-guard.js +55 -0
  9. package/dist/_registration.js +49 -0
  10. package/dist/conflicts.d.ts +36 -0
  11. package/dist/conflicts.js +54 -0
  12. package/dist/constants.d.ts +16 -144
  13. package/dist/constants.js +55 -172
  14. package/dist/display-labels.d.ts +90 -0
  15. package/dist/display-labels.js +112 -0
  16. package/dist/format.d.ts +48 -12
  17. package/dist/format.js +35 -39
  18. package/dist/hint.d.ts +20 -0
  19. package/dist/hint.js +23 -0
  20. package/dist/hotkey-manager.d.ts +14 -12
  21. package/dist/hotkey-manager.js +70 -21
  22. package/dist/hotkey-recorder.d.ts +8 -8
  23. package/dist/hotkey-recorder.js +74 -15
  24. package/dist/hotkey-sequence-recorder.d.ts +13 -9
  25. package/dist/hotkey-sequence-recorder.js +90 -28
  26. package/dist/{hotkey.d.ts → hotkey.types.d.ts} +58 -126
  27. package/dist/index.d.ts +14 -9
  28. package/dist/index.js +10 -6
  29. package/dist/key-state-tracker.d.ts +4 -7
  30. package/dist/key-state-tracker.js +30 -27
  31. package/dist/key.types.d.ts +79 -0
  32. package/dist/match.d.ts +24 -11
  33. package/dist/match.js +19 -30
  34. package/dist/parse.d.ts +18 -15
  35. package/dist/parse.js +39 -22
  36. package/dist/platform.d.ts +41 -0
  37. package/dist/platform.js +52 -0
  38. package/dist/recorder-options.d.ts +31 -0
  39. package/dist/sequence-manager.d.ts +27 -15
  40. package/dist/sequence-manager.js +61 -30
  41. package/dist/validate.d.ts +16 -8
  42. package/dist/validate.js +8 -13
  43. package/package.json +8 -13
  44. package/dist/constants.cjs +0 -535
  45. package/dist/constants.cjs.map +0 -1
  46. package/dist/constants.d.cts +0 -290
  47. package/dist/constants.js.map +0 -1
  48. package/dist/format.cjs +0 -91
  49. package/dist/format.cjs.map +0 -1
  50. package/dist/format.d.cts +0 -60
  51. package/dist/format.js.map +0 -1
  52. package/dist/hotkey-manager.cjs +0 -383
  53. package/dist/hotkey-manager.cjs.map +0 -1
  54. package/dist/hotkey-manager.d.cts +0 -230
  55. package/dist/hotkey-manager.js.map +0 -1
  56. package/dist/hotkey-recorder.cjs +0 -179
  57. package/dist/hotkey-recorder.cjs.map +0 -1
  58. package/dist/hotkey-recorder.d.cts +0 -116
  59. package/dist/hotkey-recorder.js.map +0 -1
  60. package/dist/hotkey-sequence-recorder.cjs +0 -192
  61. package/dist/hotkey-sequence-recorder.cjs.map +0 -1
  62. package/dist/hotkey-sequence-recorder.d.cts +0 -79
  63. package/dist/hotkey-sequence-recorder.js.map +0 -1
  64. package/dist/hotkey.d.cts +0 -301
  65. package/dist/index.cjs +0 -63
  66. package/dist/index.d.cts +0 -13
  67. package/dist/key-state-tracker.cjs +0 -197
  68. package/dist/key-state-tracker.cjs.map +0 -1
  69. package/dist/key-state-tracker.d.cts +0 -107
  70. package/dist/key-state-tracker.js.map +0 -1
  71. package/dist/manager.utils.cjs +0 -115
  72. package/dist/manager.utils.cjs.map +0 -1
  73. package/dist/manager.utils.d.cts +0 -13
  74. package/dist/manager.utils.d.ts +0 -13
  75. package/dist/manager.utils.js.map +0 -1
  76. package/dist/match.cjs +0 -153
  77. package/dist/match.cjs.map +0 -1
  78. package/dist/match.d.cts +0 -85
  79. package/dist/match.js.map +0 -1
  80. package/dist/parse.cjs +0 -228
  81. package/dist/parse.cjs.map +0 -1
  82. package/dist/parse.d.cts +0 -128
  83. package/dist/parse.js.map +0 -1
  84. package/dist/recorder-chord.cjs +0 -18
  85. package/dist/recorder-chord.cjs.map +0 -1
  86. package/dist/recorder-chord.js +0 -18
  87. package/dist/recorder-chord.js.map +0 -1
  88. package/dist/sequence-manager.cjs +0 -415
  89. package/dist/sequence-manager.cjs.map +0 -1
  90. package/dist/sequence-manager.d.cts +0 -157
  91. package/dist/sequence-manager.js.map +0 -1
  92. package/dist/validate.cjs +0 -116
  93. package/dist/validate.cjs.map +0 -1
  94. package/dist/validate.d.cts +0 -56
  95. package/dist/validate.js.map +0 -1
  96. package/src/constants.ts +0 -603
  97. package/src/format.ts +0 -142
  98. package/src/hotkey-manager.ts +0 -759
  99. package/src/hotkey-recorder.ts +0 -272
  100. package/src/hotkey-sequence-recorder.ts +0 -328
  101. package/src/hotkey.ts +0 -436
  102. package/src/index.ts +0 -11
  103. package/src/key-state-tracker.ts +0 -249
  104. package/src/manager.utils.ts +0 -231
  105. package/src/match.ts +0 -259
  106. package/src/parse.ts +0 -328
  107. package/src/recorder-chord.ts +0 -25
  108. package/src/sequence-manager.ts +0 -734
  109. package/src/validate.ts +0 -171
@@ -1,79 +0,0 @@
1
- import { HotkeySequence } from "./sequence-manager.cjs";
2
- import { Store } from "@tanstack/store";
3
-
4
- //#region src/hotkey-sequence-recorder.d.ts
5
- /**
6
- * How the user can commit a recorded sequence from the keyboard.
7
- * - `'enter'`: plain Enter (no modifiers) commits when at least one step exists.
8
- * - `'none'`: only {@link HotkeySequenceRecorder.commit} finishes recording (or idle timeout if set).
9
- */
10
- type HotkeySequenceRecorderCommitKeys = 'enter' | 'none';
11
- /**
12
- * State interface for the HotkeySequenceRecorder.
13
- */
14
- interface HotkeySequenceRecorderState {
15
- /** Whether recording is currently active */
16
- isRecording: boolean;
17
- /** Chords captured so far in the current recording session */
18
- steps: HotkeySequence;
19
- /** The last successfully committed sequence, or null if none / after starting a new session */
20
- recordedSequence: HotkeySequence | null;
21
- }
22
- /**
23
- * Options for configuring a HotkeySequenceRecorder instance.
24
- */
25
- interface HotkeySequenceRecorderOptions {
26
- /** Callback when a sequence is successfully recorded (including empty array when cleared) */
27
- onRecord: (sequence: HotkeySequence) => void;
28
- /** Optional callback when recording is cancelled (Escape pressed) */
29
- onCancel?: () => void;
30
- /** Optional callback when the sequence is cleared (Backspace/Delete with no steps) */
31
- onClear?: () => void;
32
- /**
33
- * Whether plain Enter commits the current steps. Ignored when {@link commitKeys} is `'none'`.
34
- * @default true
35
- */
36
- commitOnEnter?: boolean;
37
- /**
38
- * Keyboard commit mode. When `'none'`, use {@link HotkeySequenceRecorder.commit} (and optional idle timeout).
39
- * @default 'enter'
40
- */
41
- commitKeys?: HotkeySequenceRecorderCommitKeys;
42
- /**
43
- * Milliseconds of inactivity after the **last completed chord** before auto-committing.
44
- * The timer does not run while waiting for the first chord (`steps.length === 0`).
45
- */
46
- idleTimeoutMs?: number;
47
- /**
48
- * Whether to ignore keyboard events from input-like elements (text inputs,
49
- * textarea, select, contenteditable). When true, typing in inputs passes
50
- * through normally instead of being captured as a sequence recording.
51
- * Escape always works regardless of this setting.
52
- * @default true
53
- */
54
- ignoreInputs?: boolean;
55
- }
56
- /**
57
- * Framework-agnostic class for recording multi-chord sequences (Vim-style shortcuts).
58
- *
59
- * Each step is captured like a single hotkey chord. Press **Enter** (no modifiers) to commit
60
- * when {@link HotkeySequenceRecorderOptions.commitKeys} is `'enter'` (default), **Escape** to cancel,
61
- * **Backspace/Delete** to remove the last step or clear when empty.
62
- */
63
- declare class HotkeySequenceRecorder {
64
- #private;
65
- readonly store: Store<HotkeySequenceRecorderState>;
66
- constructor(options: HotkeySequenceRecorderOptions);
67
- setOptions(options: Partial<HotkeySequenceRecorderOptions>): void;
68
- start(): void;
69
- /**
70
- * Commit the current steps as a sequence. No-op if fewer than one step.
71
- */
72
- commit(): void;
73
- stop(): void;
74
- cancel(): void;
75
- destroy(): void;
76
- }
77
- //#endregion
78
- export { HotkeySequenceRecorder, HotkeySequenceRecorderCommitKeys, HotkeySequenceRecorderOptions, HotkeySequenceRecorderState };
79
- //# sourceMappingURL=hotkey-sequence-recorder.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hotkey-sequence-recorder.js","names":["#options","#platform","#idleTimer","#clearIdleTimer","#keydownHandler","#finishWithoutCommitCallback","#patchSteps","#scheduleIdleTimer","#addListener","#removeListener"],"sources":["../src/hotkey-sequence-recorder.ts"],"sourcesContent":["import { Store } from '@tanstack/store'\nimport { detectPlatform } from './constants'\nimport { isInputElement } from './manager.utils'\nimport { hotkeyChordFromKeydown } from './recorder-chord'\nimport type { HotkeySequence } from './sequence-manager'\n\n/**\n * How the user can commit a recorded sequence from the keyboard.\n * - `'enter'`: plain Enter (no modifiers) commits when at least one step exists.\n * - `'none'`: only {@link HotkeySequenceRecorder.commit} finishes recording (or idle timeout if set).\n */\nexport type HotkeySequenceRecorderCommitKeys = 'enter' | 'none'\n\n/**\n * State interface for the HotkeySequenceRecorder.\n */\nexport interface HotkeySequenceRecorderState {\n /** Whether recording is currently active */\n isRecording: boolean\n /** Chords captured so far in the current recording session */\n steps: HotkeySequence\n /** The last successfully committed sequence, or null if none / after starting a new session */\n recordedSequence: HotkeySequence | null\n}\n\n/**\n * Options for configuring a HotkeySequenceRecorder instance.\n */\nexport interface HotkeySequenceRecorderOptions {\n /** Callback when a sequence is successfully recorded (including empty array when cleared) */\n onRecord: (sequence: HotkeySequence) => void\n /** Optional callback when recording is cancelled (Escape pressed) */\n onCancel?: () => void\n /** Optional callback when the sequence is cleared (Backspace/Delete with no steps) */\n onClear?: () => void\n /**\n * Whether plain Enter commits the current steps. Ignored when {@link commitKeys} is `'none'`.\n * @default true\n */\n commitOnEnter?: boolean\n /**\n * Keyboard commit mode. When `'none'`, use {@link HotkeySequenceRecorder.commit} (and optional idle timeout).\n * @default 'enter'\n */\n commitKeys?: HotkeySequenceRecorderCommitKeys\n /**\n * Milliseconds of inactivity after the **last completed chord** before auto-committing.\n * The timer does not run while waiting for the first chord (`steps.length === 0`).\n */\n idleTimeoutMs?: number\n /**\n * Whether to ignore keyboard events from input-like elements (text inputs,\n * textarea, select, contenteditable). When true, typing in inputs passes\n * through normally instead of being captured as a sequence recording.\n * Escape always works regardless of this setting.\n * @default true\n */\n ignoreInputs?: boolean\n}\n\nconst defaultHotkeySequenceRecorderOptions: Pick<\n HotkeySequenceRecorderOptions,\n 'commitOnEnter' | 'commitKeys'\n> = {\n commitOnEnter: true,\n commitKeys: 'enter',\n}\n\nfunction resolvedCommitOnEnter(\n options: HotkeySequenceRecorderOptions,\n): boolean {\n if (options.commitKeys === 'none') {\n return false\n }\n return options.commitOnEnter !== false\n}\n\n/**\n * Framework-agnostic class for recording multi-chord sequences (Vim-style shortcuts).\n *\n * Each step is captured like a single hotkey chord. Press **Enter** (no modifiers) to commit\n * when {@link HotkeySequenceRecorderOptions.commitKeys} is `'enter'` (default), **Escape** to cancel,\n * **Backspace/Delete** to remove the last step or clear when empty.\n */\nexport class HotkeySequenceRecorder {\n readonly store: Store<HotkeySequenceRecorderState> =\n new Store<HotkeySequenceRecorderState>({\n isRecording: false,\n steps: [],\n recordedSequence: null,\n })\n\n #keydownHandler: ((event: KeyboardEvent) => void) | null = null\n #options: HotkeySequenceRecorderOptions\n #platform: 'mac' | 'windows' | 'linux'\n #idleTimer: ReturnType<typeof setTimeout> | null = null\n\n constructor(options: HotkeySequenceRecorderOptions) {\n this.#options = {\n ...defaultHotkeySequenceRecorderOptions,\n ...options,\n }\n this.#platform = detectPlatform()\n }\n\n setOptions(options: Partial<HotkeySequenceRecorderOptions>): void {\n this.#options = {\n ...defaultHotkeySequenceRecorderOptions,\n ...this.#options,\n ...options,\n }\n }\n\n #clearIdleTimer(): void {\n if (this.#idleTimer !== null) {\n clearTimeout(this.#idleTimer)\n this.#idleTimer = null\n }\n }\n\n #scheduleIdleTimer(): void {\n this.#clearIdleTimer()\n const ms = this.#options.idleTimeoutMs\n if (ms === undefined || ms <= 0) {\n return\n }\n const steps = this.store.state.steps\n if (steps.length === 0) {\n return\n }\n this.#idleTimer = setTimeout(() => {\n this.#idleTimer = null\n if (!this.#keydownHandler) {\n return\n }\n if (this.store.state.steps.length >= 1) {\n this.commit()\n }\n }, ms)\n }\n\n #patchSteps(updater: (prev: HotkeySequence) => HotkeySequence): void {\n this.store.setState((s) => ({\n ...s,\n steps: updater(s.steps),\n }))\n }\n\n start(): void {\n if (this.#keydownHandler) {\n return\n }\n\n this.#clearIdleTimer()\n this.store.setState(() => ({\n isRecording: true,\n steps: [],\n recordedSequence: null,\n }))\n\n const handler = (event: KeyboardEvent) => {\n if (!this.#keydownHandler) {\n return\n }\n\n // If ignoreInputs is enabled (default) and focus is in an input element,\n // let the event pass through so the user can type normally.\n // Escape is the exception — it should always cancel recording.\n if (this.#options.ignoreInputs !== false) {\n const activeEl =\n typeof document !== 'undefined' ? document.activeElement : null\n if (isInputElement(activeEl) && event.key !== 'Escape') {\n return\n }\n }\n\n event.preventDefault()\n event.stopPropagation()\n\n if (event.key === 'Escape') {\n this.cancel()\n return\n }\n\n if (event.key === 'Backspace' || event.key === 'Delete') {\n if (\n !event.ctrlKey &&\n !event.shiftKey &&\n !event.altKey &&\n !event.metaKey\n ) {\n const steps = this.store.state.steps\n if (steps.length === 0) {\n this.#options.onClear?.()\n this.#options.onRecord([])\n this.#finishWithoutCommitCallback()\n return\n }\n this.#patchSteps((prev) => prev.slice(0, -1))\n const next = this.store.state.steps\n if (next.length === 0) {\n this.#clearIdleTimer()\n } else {\n this.#scheduleIdleTimer()\n }\n return\n }\n }\n\n const enterCommits =\n resolvedCommitOnEnter(this.#options) &&\n event.key === 'Enter' &&\n !event.ctrlKey &&\n !event.shiftKey &&\n !event.altKey &&\n !event.metaKey\n\n if (enterCommits && this.store.state.steps.length >= 1) {\n this.commit()\n return\n }\n\n if (enterCommits && this.store.state.steps.length === 0) {\n return\n }\n\n const finalHotkey = hotkeyChordFromKeydown(event, this.#platform)\n if (finalHotkey === null) {\n return\n }\n\n this.#patchSteps((prev) => [...prev, finalHotkey])\n this.#scheduleIdleTimer()\n }\n\n this.#keydownHandler = handler\n this.#addListener(handler)\n }\n\n /**\n * Commit the current steps as a sequence. No-op if fewer than one step.\n */\n commit(): void {\n const steps = this.store.state.steps\n if (steps.length < 1) {\n return\n }\n\n const sequence = [...steps]\n\n if (this.#keydownHandler) {\n this.#removeListener(this.#keydownHandler)\n this.#keydownHandler = null\n }\n this.#clearIdleTimer()\n\n this.store.setState(() => ({\n isRecording: false,\n steps: [],\n recordedSequence: sequence,\n }))\n\n this.#options.onRecord(sequence)\n }\n\n #finishWithoutCommitCallback(): void {\n if (this.#keydownHandler) {\n this.#removeListener(this.#keydownHandler)\n this.#keydownHandler = null\n }\n this.#clearIdleTimer()\n this.store.setState(() => ({\n isRecording: false,\n steps: [],\n recordedSequence: null,\n }))\n }\n\n stop(): void {\n if (this.#keydownHandler) {\n this.#removeListener(this.#keydownHandler)\n this.#keydownHandler = null\n }\n this.#clearIdleTimer()\n this.store.setState(() => ({\n isRecording: false,\n steps: [],\n recordedSequence: null,\n }))\n }\n\n cancel(): void {\n if (this.#keydownHandler) {\n this.#removeListener(this.#keydownHandler)\n this.#keydownHandler = null\n }\n this.#clearIdleTimer()\n this.store.setState(() => ({\n isRecording: false,\n steps: [],\n recordedSequence: null,\n }))\n this.#options.onCancel?.()\n }\n\n #addListener(handler: (event: KeyboardEvent) => void): void {\n if (typeof document === 'undefined') {\n return\n }\n document.addEventListener('keydown', handler, true)\n }\n\n #removeListener(handler: (event: KeyboardEvent) => void): void {\n if (typeof document === 'undefined') {\n return\n }\n document.removeEventListener('keydown', handler, true)\n }\n\n destroy(): void {\n this.stop()\n this.store.setState(() => ({\n isRecording: false,\n steps: [],\n recordedSequence: null,\n }))\n }\n}\n"],"mappings":"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"}
package/dist/hotkey.d.cts DELETED
@@ -1,301 +0,0 @@
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
- * Includes both modifier keys and regular keys.
58
- */
59
- type IndividualKey = CanonicalModifier | Key;
60
- /**
61
- * Single modifier + key combinations.
62
- * Uses canonical modifiers (4) + Mod (1) = 5 modifiers.
63
- * Shift combinations exclude PunctuationKey to avoid layout-dependent issues.
64
- *
65
- * The `Mod` modifier is platform-adaptive:
66
- * - **macOS**: Resolves to `Meta` (Command key ⌘)
67
- * - **Windows/Linux**: Resolves to `Control` (Ctrl key)
68
- *
69
- * This enables cross-platform hotkey definitions that automatically adapt to the platform.
70
- * For example, `Mod+S` becomes `Command+S` on Mac and `Ctrl+S` on Windows/Linux.
71
- */
72
- type SingleModifierHotkey = `Control+${Key}` | `Alt+${Key}` | `Shift+${NonPunctuationKey}` | `Meta+${Key}` | `Mod+${Key}`;
73
- /**
74
- * Two modifier + key combinations.
75
- * Shift combinations exclude Numbers and PunctuationKeys to avoid layout-dependent issues.
76
- *
77
- * **Platform-adaptive `Mod` combinations:**
78
- * - `Mod+Alt` and `Mod+Shift` are included (safe on all platforms)
79
- * - `Mod+Control` and `Mod+Meta` are excluded because they create duplicate modifiers:
80
- * - `Mod+Control` duplicates `Control` on Windows/Linux (Mod = Control)
81
- * - `Mod+Meta` duplicates `Meta` on macOS (Mod = Meta)
82
- */
83
- 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}`;
84
- /**
85
- * Three modifier + key combinations.
86
- * Shift combinations exclude Numbers and PunctuationKeys to avoid layout-dependent issues.
87
- *
88
- * **Platform-adaptive `Mod` combinations:**
89
- * - `Mod+Alt+Shift` is included (safe on all platforms)
90
- * - `Mod+Control+Shift` and `Mod+Shift+Meta` are excluded because they create duplicate modifiers:
91
- * - `Mod+Control+Shift` duplicates `Control` on Windows/Linux (Mod = Control)
92
- * - `Mod+Shift+Meta` duplicates `Meta` on macOS (Mod = Meta)
93
- */
94
- type ThreeModifierHotkey = `Control+Alt+Shift+${NonPunctuationKey}` | `Control+Alt+Meta+${Key}` | `Control+Shift+Meta+${NonPunctuationKey}` | `Alt+Shift+Meta+${NonPunctuationKey}` | `Mod+Alt+Shift+${NonPunctuationKey}`;
95
- /**
96
- * Four modifier + key combinations.
97
- * Shift combinations exclude Numbers and PunctuationKeys to avoid layout-dependent issues.
98
- *
99
- * Only the canonical `Control+Alt+Shift+Meta` combination is included.
100
- *
101
- * **Why no `Mod` combinations?**
102
- * Since `Mod` resolves to either `Control` (Windows/Linux) or `Meta` (macOS), any
103
- * four-modifier combination with `Mod` would create duplicate modifiers on one platform.
104
- * For example:
105
- * - `Mod+Control+Alt+Shift` → duplicates `Control` on Windows/Linux
106
- * - `Mod+Alt+Shift+Meta` → duplicates `Meta` on macOS
107
- */
108
- type FourModifierHotkey = `Control+Alt+Shift+Meta+${NonPunctuationKey}`;
109
- /**
110
- * A type-safe hotkey string.
111
- *
112
- * Provides autocomplete for:
113
- * - All single keys (letters, numbers, function keys, navigation, editing, punctuation)
114
- * - Single modifier + common key (Control+S, Mod+A, Mod+/, etc.)
115
- * - Two modifiers + common key (Mod+Shift+S, Control+Alt+A, etc.)
116
- * - Three modifiers + common key (Control+Alt+Shift+A, Mod+Alt+Shift+S, etc.)
117
- * - Four modifiers + common key (Control+Alt+Shift+Meta+A, etc.)
118
- *
119
- * ## Modifier Names
120
- *
121
- * Use canonical modifier names:
122
- * - `Control` (not Ctrl) - The Control key
123
- * - `Alt` (not Option) - The Alt key (Option on macOS)
124
- * - `Meta` (not Command/Cmd) - The Meta/Command key (macOS only)
125
- * - `Shift` - The Shift key
126
- *
127
- * ## Platform-Adaptive `Mod` Modifier
128
- *
129
- * The `Mod` modifier is a special platform-adaptive modifier that automatically resolves
130
- * to the "primary modifier" on each platform:
131
- *
132
- * - **macOS**: `Mod` → `Meta` (Command key ⌘)
133
- * - **Windows/Linux**: `Mod` → `Control` (Ctrl key)
134
- *
135
- * This enables cross-platform hotkey definitions that work correctly on all platforms
136
- * without platform-specific code. The `Mod` modifier is resolved at runtime based on
137
- * the detected platform.
138
- *
139
- * **When to use `Mod` vs platform-specific modifiers:**
140
- * - Use `Mod` for cross-platform shortcuts (e.g., `Mod+S` for save)
141
- * - Use `Meta` or `Control` when you need platform-specific behavior
142
- * - Use `Mod` when you want your shortcuts to follow platform conventions automatically
143
- *
144
- * **Limitations:**
145
- * - `Mod+Control` and `Mod+Meta` combinations are not allowed (they create duplicate
146
- * modifiers on one platform)
147
- * - In four-modifier combinations, only canonical modifiers are allowed (no `Mod`)
148
- *
149
- * @example
150
- * ```ts
151
- * // Cross-platform shortcuts (recommended)
152
- * const save: Hotkey = 'Mod+S' // Command+S on Mac, Ctrl+S on Windows/Linux
153
- * const saveAs: Hotkey = 'Mod+Shift+S' // Command+Shift+S on Mac, Ctrl+Shift+S elsewhere
154
- * const comment: Hotkey = 'Mod+/' // Command+/ on Mac, Ctrl+/ elsewhere
155
- *
156
- * // Platform-specific shortcuts
157
- * const macOnly: Hotkey = 'Meta+S' // Command+S on Mac only
158
- * const windowsOnly: Hotkey = 'Control+S' // Ctrl+S on Windows/Linux only
159
- * ```
160
- */
161
- type Hotkey = Key | SingleModifierHotkey | TwoModifierHotkey | ThreeModifierHotkey | FourModifierHotkey;
162
- /**
163
- * A parsed representation of a hotkey string.
164
- *
165
- * This interface provides a flexible fallback when the `Hotkey` type doesn't
166
- * fit your use case. You can pass a `ParsedHotkey` directly to hotkey functions
167
- * instead of a hotkey string, allowing for more dynamic or complex scenarios
168
- * that aren't covered by the type-safe `Hotkey` union.
169
- *
170
- * @example
171
- * ```ts
172
- * // Type-safe hotkey string
173
- * useHotkey('Mod+S', handler)
174
- *
175
- * // Fallback: parsed hotkey for dynamic scenarios
176
- * const parsed = parseHotkey(userInput)
177
- * useHotkey(parsed, handler) // Works even if userInput isn't in Hotkey type
178
- * ```
179
- */
180
- interface ParsedHotkey {
181
- /** The non-modifier key (e.g., 'S', 'Escape', 'F1', '/', '['). Can be any string for flexibility. */
182
- key: Key | (string & {});
183
- /** Whether the Control key is required */
184
- ctrl: boolean;
185
- /** Whether the Shift key is required */
186
- shift: boolean;
187
- /** Whether the Alt key is required */
188
- alt: boolean;
189
- /** Whether the Meta (Command) key is required */
190
- meta: boolean;
191
- /** List of canonical modifier names that are required, in canonical order */
192
- modifiers: Array<CanonicalModifier>;
193
- }
194
- /**
195
- * A raw hotkey object for programmatic registration.
196
- *
197
- * Like `ParsedHotkey` but without `modifiers` (derived from booleans)
198
- * and with optional modifier booleans (default to `false` when omitted).
199
- * Use with `HotkeyManager.register()` and `useHotkey()` when you prefer
200
- * object form over a string.
201
- *
202
- * The `mod` modifier is platform-adaptive: Command on macOS, Control on Windows/Linux.
203
- * Pass `platform` when converting to ParsedHotkey (e.g., via `options.platform`).
204
- *
205
- * @example
206
- * ```ts
207
- * useHotkey({ key: 'S', mod: true }, handler) // Mod+S (cross-platform)
208
- * useHotkey({ key: 'S', ctrl: true }, handler) // Control+S
209
- * useHotkey({ key: 'Escape' }, handler) // Escape (no modifiers)
210
- * useHotkey({ key: 'A', shift: true, meta: true }, handler) // Shift+Meta+A
211
- * useHotkey({ key: 'S', mod: true, shift: true }, handler) // Mod+Shift+S
212
- * ```
213
- */
214
- interface RawHotkey {
215
- /** The non-modifier key (e.g., 'S', 'Escape', 'F1'). */
216
- key: Key | (string & {});
217
- /** Platform-adaptive modifier: Command on macOS, Control on Windows/Linux. Defaults to false. */
218
- mod?: boolean;
219
- /** Whether the Control key is required. Defaults to false. */
220
- ctrl?: boolean;
221
- /** Whether the Shift key is required. Defaults to false. */
222
- shift?: boolean;
223
- /** Whether the Alt key is required. Defaults to false. */
224
- alt?: boolean;
225
- /** Whether the Meta (Command) key is required. Defaults to false. */
226
- meta?: boolean;
227
- }
228
- /**
229
- * A hotkey that can be passed to `HotkeyManager.register()` and `useHotkey()`.
230
- * Either a type-safe string (`Hotkey`) or a raw object (`RawHotkey`).
231
- */
232
- type RegisterableHotkey = Hotkey | RawHotkey;
233
- /**
234
- * Options for formatting hotkeys for display.
235
- */
236
- interface FormatDisplayOptions {
237
- /** The target platform. Defaults to auto-detection. */
238
- platform?: 'mac' | 'windows' | 'linux';
239
- /** Whether to use symbols for the display. Defaults to true. */
240
- useSymbols?: boolean;
241
- /** Override the separator between display tokens. Defaults to platform-specific formatting when null/undefined. */
242
- separatorToken?: string | null;
243
- }
244
- /**
245
- * Result of validating a hotkey string.
246
- */
247
- interface ValidationResult {
248
- /** Whether the hotkey is valid (can still have warnings) */
249
- valid: boolean;
250
- /** Warning messages about potential issues */
251
- warnings: Array<string>;
252
- /** Error messages about invalid syntax */
253
- errors: Array<string>;
254
- }
255
- /**
256
- * Context passed to hotkey callbacks along with the keyboard event.
257
- */
258
- interface HotkeyCallbackContext {
259
- /** The original hotkey string that was registered */
260
- hotkey: Hotkey;
261
- /** The parsed representation of the hotkey */
262
- parsedHotkey: ParsedHotkey;
263
- }
264
- /**
265
- * Callback function type for hotkey handlers.
266
- *
267
- * @param event - The keyboard event that triggered the hotkey
268
- * @param context - Additional context including the hotkey and parsed hotkey
269
- *
270
- * @example
271
- * ```ts
272
- * const handler: HotkeyCallback = (event, { hotkey, parsedHotkey }) => {
273
- * console.log(`Hotkey ${hotkey} was pressed`)
274
- * console.log(`Modifiers:`, parsedHotkey.modifiers)
275
- * }
276
- * ```
277
- */
278
- type HotkeyCallback = (event: KeyboardEvent, context: HotkeyCallbackContext) => void;
279
- /**
280
- * Metadata for hotkey and sequence registrations.
281
- * Includes `name` and `description` by default. Extend via declaration merging:
282
- *
283
- * @example
284
- * ```ts
285
- * declare module '@tanstack/hotkeys' {
286
- * interface HotkeyMeta {
287
- * category?: string
288
- * icon?: string
289
- * }
290
- * }
291
- * ```
292
- */
293
- interface HotkeyMeta {
294
- /** Human-readable name for this hotkey (e.g., "Save Document") */
295
- name?: string;
296
- /** Description of what this hotkey does */
297
- description?: string;
298
- }
299
- //#endregion
300
- export { CanonicalModifier, EditingKey, FormatDisplayOptions, FunctionKey, Hotkey, HotkeyCallback, HotkeyCallbackContext, HotkeyMeta, IndividualKey, Key, LetterKey, Modifier, NavigationKey, NumberKey, ParsedHotkey, PunctuationKey, RawHotkey, RegisterableHotkey, ValidationResult };
301
- //# sourceMappingURL=hotkey.d.cts.map
package/dist/index.cjs DELETED
@@ -1,63 +0,0 @@
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_hotkey_recorder = require('./hotkey-recorder.cjs');
9
- const require_hotkey_sequence_recorder = require('./hotkey-sequence-recorder.cjs');
10
- const require_sequence_manager = require('./sequence-manager.cjs');
11
- const require_validate = require('./validate.cjs');
12
-
13
- exports.ALL_KEYS = require_constants.ALL_KEYS;
14
- exports.DEFAULT_SEQUENCE_TIMEOUT = require_sequence_manager.DEFAULT_SEQUENCE_TIMEOUT;
15
- exports.EDITING_KEYS = require_constants.EDITING_KEYS;
16
- exports.FUNCTION_KEYS = require_constants.FUNCTION_KEYS;
17
- exports.HotkeyManager = require_hotkey_manager.HotkeyManager;
18
- exports.HotkeyRecorder = require_hotkey_recorder.HotkeyRecorder;
19
- exports.HotkeySequenceRecorder = require_hotkey_sequence_recorder.HotkeySequenceRecorder;
20
- exports.KEY_DISPLAY_SYMBOLS = require_constants.KEY_DISPLAY_SYMBOLS;
21
- exports.KeyStateTracker = require_key_state_tracker.KeyStateTracker;
22
- exports.LETTER_KEYS = require_constants.LETTER_KEYS;
23
- exports.LINUX_MODIFIER_LABELS = require_constants.LINUX_MODIFIER_LABELS;
24
- exports.MAC_MODIFIER_LABELS = require_constants.MAC_MODIFIER_LABELS;
25
- exports.MAC_MODIFIER_SYMBOLS = require_constants.MAC_MODIFIER_SYMBOLS;
26
- exports.MODIFIER_ALIASES = require_constants.MODIFIER_ALIASES;
27
- exports.MODIFIER_KEYS = require_constants.MODIFIER_KEYS;
28
- exports.MODIFIER_ORDER = require_constants.MODIFIER_ORDER;
29
- exports.NAVIGATION_KEYS = require_constants.NAVIGATION_KEYS;
30
- exports.NUMBER_KEYS = require_constants.NUMBER_KEYS;
31
- exports.PUNCTUATION_CODE_MAP = require_constants.PUNCTUATION_CODE_MAP;
32
- exports.PUNCTUATION_KEYS = require_constants.PUNCTUATION_KEYS;
33
- exports.PUNCTUATION_KEY_DISPLAY_LABELS = require_constants.PUNCTUATION_KEY_DISPLAY_LABELS;
34
- exports.SequenceManager = require_sequence_manager.SequenceManager;
35
- exports.WINDOWS_MODIFIER_LABELS = require_constants.WINDOWS_MODIFIER_LABELS;
36
- exports.assertValidHotkey = require_validate.assertValidHotkey;
37
- exports.checkHotkey = require_validate.checkHotkey;
38
- exports.createHotkeyHandler = require_match.createHotkeyHandler;
39
- exports.createMultiHotkeyHandler = require_match.createMultiHotkeyHandler;
40
- exports.createSequenceMatcher = require_sequence_manager.createSequenceMatcher;
41
- exports.detectPlatform = require_constants.detectPlatform;
42
- exports.formatForDisplay = require_format.formatForDisplay;
43
- exports.formatHotkey = require_format.formatHotkey;
44
- exports.formatHotkeySequence = require_format.formatHotkeySequence;
45
- exports.formatWithLabels = require_format.formatWithLabels;
46
- exports.getHotkeyManager = require_hotkey_manager.getHotkeyManager;
47
- exports.getKeyStateTracker = require_key_state_tracker.getKeyStateTracker;
48
- exports.getSequenceManager = require_sequence_manager.getSequenceManager;
49
- exports.hasNonModifierKey = require_parse.hasNonModifierKey;
50
- exports.isModifierKey = require_parse.isModifierKey;
51
- exports.isSingleLetterKey = require_constants.isSingleLetterKey;
52
- exports.matchesKeyboardEvent = require_match.matchesKeyboardEvent;
53
- exports.normalizeHotkey = require_parse.normalizeHotkey;
54
- exports.normalizeHotkeyFromEvent = require_parse.normalizeHotkeyFromEvent;
55
- exports.normalizeHotkeyFromParsed = require_parse.normalizeHotkeyFromParsed;
56
- exports.normalizeKeyName = require_constants.normalizeKeyName;
57
- exports.normalizeRegisterableHotkey = require_parse.normalizeRegisterableHotkey;
58
- exports.parseHotkey = require_parse.parseHotkey;
59
- exports.parseKeyboardEvent = require_parse.parseKeyboardEvent;
60
- exports.rawHotkeyToParsedHotkey = require_parse.rawHotkeyToParsedHotkey;
61
- exports.resolveModifier = require_constants.resolveModifier;
62
- exports.toHotkeyRegistrationView = require_hotkey_manager.toHotkeyRegistrationView;
63
- exports.validateHotkey = require_validate.validateHotkey;
package/dist/index.d.cts DELETED
@@ -1,13 +0,0 @@
1
- import { CanonicalModifier, EditingKey, FormatDisplayOptions, FunctionKey, Hotkey, HotkeyCallback, HotkeyCallbackContext, HotkeyMeta, IndividualKey, 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, LINUX_MODIFIER_LABELS, MAC_MODIFIER_LABELS, MAC_MODIFIER_SYMBOLS, MODIFIER_ALIASES, MODIFIER_KEYS, MODIFIER_ORDER, NAVIGATION_KEYS, NUMBER_KEYS, PUNCTUATION_CODE_MAP, PUNCTUATION_KEYS, PUNCTUATION_KEY_DISPLAY_LABELS, WINDOWS_MODIFIER_LABELS, detectPlatform, isSingleLetterKey, normalizeKeyName, resolveModifier } from "./constants.cjs";
3
- import { formatForDisplay, formatHotkey, formatHotkeySequence, formatWithLabels } from "./format.cjs";
4
- import { ConflictBehavior } from "./manager.utils.cjs";
5
- import { HotkeyManager, HotkeyOptions, HotkeyRegistration, HotkeyRegistrationHandle, HotkeyRegistrationView, getHotkeyManager, toHotkeyRegistrationView } from "./hotkey-manager.cjs";
6
- import { KeyStateTracker, KeyStateTrackerState, getKeyStateTracker } from "./key-state-tracker.cjs";
7
- import { CreateHotkeyHandlerOptions, createHotkeyHandler, createMultiHotkeyHandler, matchesKeyboardEvent } from "./match.cjs";
8
- import { hasNonModifierKey, isModifierKey, normalizeHotkey, normalizeHotkeyFromEvent, normalizeHotkeyFromParsed, normalizeRegisterableHotkey, parseHotkey, parseKeyboardEvent, rawHotkeyToParsedHotkey } from "./parse.cjs";
9
- import { HotkeyRecorder, HotkeyRecorderOptions, HotkeyRecorderState } from "./hotkey-recorder.cjs";
10
- import { DEFAULT_SEQUENCE_TIMEOUT, HotkeySequence, SequenceManager, SequenceOptions, SequenceRegistrationHandle, SequenceRegistrationView, createSequenceMatcher, getSequenceManager } from "./sequence-manager.cjs";
11
- import { HotkeySequenceRecorder, HotkeySequenceRecorderCommitKeys, HotkeySequenceRecorderOptions, HotkeySequenceRecorderState } from "./hotkey-sequence-recorder.cjs";
12
- import { assertValidHotkey, checkHotkey, validateHotkey } from "./validate.cjs";
13
- export { ALL_KEYS, CanonicalModifier, ConflictBehavior, CreateHotkeyHandlerOptions, DEFAULT_SEQUENCE_TIMEOUT, EDITING_KEYS, EditingKey, FUNCTION_KEYS, FormatDisplayOptions, FunctionKey, Hotkey, HotkeyCallback, HotkeyCallbackContext, HotkeyManager, HotkeyMeta, HotkeyOptions, HotkeyRecorder, HotkeyRecorderOptions, HotkeyRecorderState, HotkeyRegistration, HotkeyRegistrationHandle, HotkeyRegistrationView, HotkeySequence, HotkeySequenceRecorder, HotkeySequenceRecorderCommitKeys, HotkeySequenceRecorderOptions, HotkeySequenceRecorderState, IndividualKey, KEY_DISPLAY_SYMBOLS, Key, KeyStateTracker, KeyStateTrackerState, LETTER_KEYS, LINUX_MODIFIER_LABELS, LetterKey, MAC_MODIFIER_LABELS, MAC_MODIFIER_SYMBOLS, MODIFIER_ALIASES, MODIFIER_KEYS, MODIFIER_ORDER, Modifier, NAVIGATION_KEYS, NUMBER_KEYS, NavigationKey, NumberKey, PUNCTUATION_CODE_MAP, PUNCTUATION_KEYS, PUNCTUATION_KEY_DISPLAY_LABELS, ParsedHotkey, PunctuationKey, RawHotkey, RegisterableHotkey, SequenceManager, SequenceOptions, SequenceRegistrationHandle, SequenceRegistrationView, ValidationResult, WINDOWS_MODIFIER_LABELS, assertValidHotkey, checkHotkey, createHotkeyHandler, createMultiHotkeyHandler, createSequenceMatcher, detectPlatform, formatForDisplay, formatHotkey, formatHotkeySequence, formatWithLabels, getHotkeyManager, getKeyStateTracker, getSequenceManager, hasNonModifierKey, isModifierKey, isSingleLetterKey, matchesKeyboardEvent, normalizeHotkey, normalizeHotkeyFromEvent, normalizeHotkeyFromParsed, normalizeKeyName, normalizeRegisterableHotkey, parseHotkey, parseKeyboardEvent, rawHotkeyToParsedHotkey, resolveModifier, toHotkeyRegistrationView, validateHotkey };