@tanstack/solid-hotkeys 0.9.1 → 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 (39) hide show
  1. package/dist/createHeldKeyCodes.cjs +2 -2
  2. package/dist/createHeldKeyCodes.cjs.map +1 -1
  3. package/dist/createHeldKeyCodes.d.cts +1 -1
  4. package/dist/createHeldKeyCodes.d.ts +1 -1
  5. package/dist/createHeldKeyCodes.js +3 -3
  6. package/dist/createHeldKeyCodes.js.map +1 -1
  7. package/dist/createHeldKeys.cjs +2 -2
  8. package/dist/createHeldKeys.cjs.map +1 -1
  9. package/dist/createHeldKeys.d.cts +1 -1
  10. package/dist/createHeldKeys.d.ts +1 -1
  11. package/dist/createHeldKeys.js +3 -3
  12. package/dist/createHeldKeys.js.map +1 -1
  13. package/dist/createHotkeyRecorder.cjs +3 -3
  14. package/dist/createHotkeyRecorder.cjs.map +1 -1
  15. package/dist/createHotkeyRecorder.d.cts +1 -1
  16. package/dist/createHotkeyRecorder.d.ts +1 -1
  17. package/dist/createHotkeyRecorder.js +4 -4
  18. package/dist/createHotkeyRecorder.js.map +1 -1
  19. package/dist/createHotkeyRegistrations.cjs +2 -2
  20. package/dist/createHotkeyRegistrations.cjs.map +1 -1
  21. package/dist/createHotkeyRegistrations.js +3 -3
  22. package/dist/createHotkeyRegistrations.js.map +1 -1
  23. package/dist/createHotkeySequenceRecorder.cjs +3 -3
  24. package/dist/createHotkeySequenceRecorder.cjs.map +1 -1
  25. package/dist/createHotkeySequenceRecorder.js +4 -4
  26. package/dist/createHotkeySequenceRecorder.js.map +1 -1
  27. package/dist/createKeyHold.cjs +2 -2
  28. package/dist/createKeyHold.cjs.map +1 -1
  29. package/dist/createKeyHold.d.cts +1 -1
  30. package/dist/createKeyHold.d.ts +1 -1
  31. package/dist/createKeyHold.js +3 -3
  32. package/dist/createKeyHold.js.map +1 -1
  33. package/package.json +4 -4
  34. package/src/createHeldKeyCodes.ts +3 -3
  35. package/src/createHeldKeys.ts +3 -3
  36. package/src/createHotkeyRecorder.ts +5 -5
  37. package/src/createHotkeyRegistrations.ts +3 -3
  38. package/src/createHotkeySequenceRecorder.ts +4 -4
  39. package/src/createKeyHold.ts +3 -3
@@ -8,7 +8,7 @@ let _tanstack_solid_store = require("@tanstack/solid-store");
8
8
  * This is useful for debugging which physical key was pressed (e.g. distinguishing
9
9
  * left vs right Shift via "ShiftLeft" / "ShiftRight").
10
10
  *
11
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
11
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
12
12
  * to the global KeyStateTracker.
13
13
  *
14
14
  * @returns Signal accessor for record mapping normalized key names to their `event.code` values
@@ -34,7 +34,7 @@ let _tanstack_solid_store = require("@tanstack/solid-store");
34
34
  * ```
35
35
  */
36
36
  function createHeldKeyCodes() {
37
- return (0, _tanstack_solid_store.useStore)((0, _tanstack_hotkeys.getKeyStateTracker)().store, (state) => state.heldCodes);
37
+ return (0, _tanstack_solid_store.useSelector)((0, _tanstack_hotkeys.getKeyStateTracker)().store, (state) => state.heldCodes);
38
38
  }
39
39
 
40
40
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"createHeldKeyCodes.cjs","names":[],"sources":["../src/createHeldKeyCodes.ts"],"sourcesContent":["import { useStore } from '@tanstack/solid-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * SolidJS primitive that returns a signal of a map from currently held key names to their physical `event.code` values.\n *\n * This is useful for debugging which physical key was pressed (e.g. distinguishing\n * left vs right Shift via \"ShiftLeft\" / \"ShiftRight\").\n *\n * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe\n * to the global KeyStateTracker.\n *\n * @returns Signal accessor for record mapping normalized key names to their `event.code` values\n *\n * @example\n * ```tsx\n * function KeyDebugDisplay() {\n * const heldKeys = createHeldKeys()\n * const heldCodes = createHeldKeyCodes()\n *\n * return (\n * <div>\n * <For each={heldKeys()}>\n * {(key) => (\n * <kbd>\n * {key} <small>{heldCodes()[key]}</small>\n * </kbd>\n * )}\n * </For>\n * </div>\n * )\n * }\n * ```\n */\nexport function createHeldKeyCodes(): () => Record<string, string> {\n const tracker = getKeyStateTracker()\n return useStore(tracker.store, (state) => state.heldCodes)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAgB,qBAAmD;AAEjE,uFADoC,CACZ,QAAQ,UAAU,MAAM,UAAU"}
1
+ {"version":3,"file":"createHeldKeyCodes.cjs","names":[],"sources":["../src/createHeldKeyCodes.ts"],"sourcesContent":["import { useSelector } from '@tanstack/solid-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * SolidJS primitive that returns a signal of a map from currently held key names to their physical `event.code` values.\n *\n * This is useful for debugging which physical key was pressed (e.g. distinguishing\n * left vs right Shift via \"ShiftLeft\" / \"ShiftRight\").\n *\n * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe\n * to the global KeyStateTracker.\n *\n * @returns Signal accessor for record mapping normalized key names to their `event.code` values\n *\n * @example\n * ```tsx\n * function KeyDebugDisplay() {\n * const heldKeys = createHeldKeys()\n * const heldCodes = createHeldKeyCodes()\n *\n * return (\n * <div>\n * <For each={heldKeys()}>\n * {(key) => (\n * <kbd>\n * {key} <small>{heldCodes()[key]}</small>\n * </kbd>\n * )}\n * </For>\n * </div>\n * )\n * }\n * ```\n */\nexport function createHeldKeyCodes(): () => Record<string, string> {\n const tracker = getKeyStateTracker()\n return useSelector(tracker.store, (state) => state.heldCodes)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAgB,qBAAmD;AAEjE,0FADoC,CACT,QAAQ,UAAU,MAAM,UAAU"}
@@ -5,7 +5,7 @@
5
5
  * This is useful for debugging which physical key was pressed (e.g. distinguishing
6
6
  * left vs right Shift via "ShiftLeft" / "ShiftRight").
7
7
  *
8
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
8
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
9
9
  * to the global KeyStateTracker.
10
10
  *
11
11
  * @returns Signal accessor for record mapping normalized key names to their `event.code` values
@@ -5,7 +5,7 @@
5
5
  * This is useful for debugging which physical key was pressed (e.g. distinguishing
6
6
  * left vs right Shift via "ShiftLeft" / "ShiftRight").
7
7
  *
8
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
8
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
9
9
  * to the global KeyStateTracker.
10
10
  *
11
11
  * @returns Signal accessor for record mapping normalized key names to their `event.code` values
@@ -1,5 +1,5 @@
1
1
  import { getKeyStateTracker } from "@tanstack/hotkeys";
2
- import { useStore } from "@tanstack/solid-store";
2
+ import { useSelector } from "@tanstack/solid-store";
3
3
 
4
4
  //#region src/createHeldKeyCodes.ts
5
5
  /**
@@ -8,7 +8,7 @@ import { useStore } from "@tanstack/solid-store";
8
8
  * This is useful for debugging which physical key was pressed (e.g. distinguishing
9
9
  * left vs right Shift via "ShiftLeft" / "ShiftRight").
10
10
  *
11
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
11
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
12
12
  * to the global KeyStateTracker.
13
13
  *
14
14
  * @returns Signal accessor for record mapping normalized key names to their `event.code` values
@@ -34,7 +34,7 @@ import { useStore } from "@tanstack/solid-store";
34
34
  * ```
35
35
  */
36
36
  function createHeldKeyCodes() {
37
- return useStore(getKeyStateTracker().store, (state) => state.heldCodes);
37
+ return useSelector(getKeyStateTracker().store, (state) => state.heldCodes);
38
38
  }
39
39
 
40
40
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"createHeldKeyCodes.js","names":[],"sources":["../src/createHeldKeyCodes.ts"],"sourcesContent":["import { useStore } from '@tanstack/solid-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * SolidJS primitive that returns a signal of a map from currently held key names to their physical `event.code` values.\n *\n * This is useful for debugging which physical key was pressed (e.g. distinguishing\n * left vs right Shift via \"ShiftLeft\" / \"ShiftRight\").\n *\n * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe\n * to the global KeyStateTracker.\n *\n * @returns Signal accessor for record mapping normalized key names to their `event.code` values\n *\n * @example\n * ```tsx\n * function KeyDebugDisplay() {\n * const heldKeys = createHeldKeys()\n * const heldCodes = createHeldKeyCodes()\n *\n * return (\n * <div>\n * <For each={heldKeys()}>\n * {(key) => (\n * <kbd>\n * {key} <small>{heldCodes()[key]}</small>\n * </kbd>\n * )}\n * </For>\n * </div>\n * )\n * }\n * ```\n */\nexport function createHeldKeyCodes(): () => Record<string, string> {\n const tracker = getKeyStateTracker()\n return useStore(tracker.store, (state) => state.heldCodes)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAgB,qBAAmD;AAEjE,QAAO,SADS,oBAAoB,CACZ,QAAQ,UAAU,MAAM,UAAU"}
1
+ {"version":3,"file":"createHeldKeyCodes.js","names":[],"sources":["../src/createHeldKeyCodes.ts"],"sourcesContent":["import { useSelector } from '@tanstack/solid-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * SolidJS primitive that returns a signal of a map from currently held key names to their physical `event.code` values.\n *\n * This is useful for debugging which physical key was pressed (e.g. distinguishing\n * left vs right Shift via \"ShiftLeft\" / \"ShiftRight\").\n *\n * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe\n * to the global KeyStateTracker.\n *\n * @returns Signal accessor for record mapping normalized key names to their `event.code` values\n *\n * @example\n * ```tsx\n * function KeyDebugDisplay() {\n * const heldKeys = createHeldKeys()\n * const heldCodes = createHeldKeyCodes()\n *\n * return (\n * <div>\n * <For each={heldKeys()}>\n * {(key) => (\n * <kbd>\n * {key} <small>{heldCodes()[key]}</small>\n * </kbd>\n * )}\n * </For>\n * </div>\n * )\n * }\n * ```\n */\nexport function createHeldKeyCodes(): () => Record<string, string> {\n const tracker = getKeyStateTracker()\n return useSelector(tracker.store, (state) => state.heldCodes)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAgB,qBAAmD;AAEjE,QAAO,YADS,oBAAoB,CACT,QAAQ,UAAU,MAAM,UAAU"}
@@ -5,7 +5,7 @@ let _tanstack_solid_store = require("@tanstack/solid-store");
5
5
  /**
6
6
  * SolidJS primitive that returns a signal of currently held keyboard keys.
7
7
  *
8
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
8
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
9
9
  * to the global KeyStateTracker and updates whenever keys are pressed
10
10
  * or released.
11
11
  *
@@ -25,7 +25,7 @@ let _tanstack_solid_store = require("@tanstack/solid-store");
25
25
  * ```
26
26
  */
27
27
  function createHeldKeys() {
28
- return (0, _tanstack_solid_store.useStore)((0, _tanstack_hotkeys.getKeyStateTracker)().store, (state) => state.heldKeys);
28
+ return (0, _tanstack_solid_store.useSelector)((0, _tanstack_hotkeys.getKeyStateTracker)().store, (state) => state.heldKeys);
29
29
  }
30
30
 
31
31
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"createHeldKeys.cjs","names":[],"sources":["../src/createHeldKeys.ts"],"sourcesContent":["import { useStore } from '@tanstack/solid-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * SolidJS primitive that returns a signal of currently held keyboard keys.\n *\n * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe\n * to the global KeyStateTracker and updates whenever keys are pressed\n * or released.\n *\n * @returns Signal accessor for array of currently held key names\n *\n * @example\n * ```tsx\n * function KeyDisplay() {\n * const heldKeys = createHeldKeys()\n *\n * return (\n * <div>\n * Currently pressed: {heldKeys().join(' + ') || 'None'}\n * </div>\n * )\n * }\n * ```\n */\nexport function createHeldKeys(): () => Array<string> {\n const tracker = getKeyStateTracker()\n return useStore(tracker.store, (state) => state.heldKeys)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,iBAAsC;AAEpD,uFADoC,CACZ,QAAQ,UAAU,MAAM,SAAS"}
1
+ {"version":3,"file":"createHeldKeys.cjs","names":[],"sources":["../src/createHeldKeys.ts"],"sourcesContent":["import { useSelector } from '@tanstack/solid-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * SolidJS primitive that returns a signal of currently held keyboard keys.\n *\n * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe\n * to the global KeyStateTracker and updates whenever keys are pressed\n * or released.\n *\n * @returns Signal accessor for array of currently held key names\n *\n * @example\n * ```tsx\n * function KeyDisplay() {\n * const heldKeys = createHeldKeys()\n *\n * return (\n * <div>\n * Currently pressed: {heldKeys().join(' + ') || 'None'}\n * </div>\n * )\n * }\n * ```\n */\nexport function createHeldKeys(): () => Array<string> {\n const tracker = getKeyStateTracker()\n return useSelector(tracker.store, (state) => state.heldKeys)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,iBAAsC;AAEpD,0FADoC,CACT,QAAQ,UAAU,MAAM,SAAS"}
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * SolidJS primitive that returns a signal of currently held keyboard keys.
4
4
  *
5
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
5
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
6
6
  * to the global KeyStateTracker and updates whenever keys are pressed
7
7
  * or released.
8
8
  *
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * SolidJS primitive that returns a signal of currently held keyboard keys.
4
4
  *
5
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
5
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
6
6
  * to the global KeyStateTracker and updates whenever keys are pressed
7
7
  * or released.
8
8
  *
@@ -1,11 +1,11 @@
1
1
  import { getKeyStateTracker } from "@tanstack/hotkeys";
2
- import { useStore } from "@tanstack/solid-store";
2
+ import { useSelector } from "@tanstack/solid-store";
3
3
 
4
4
  //#region src/createHeldKeys.ts
5
5
  /**
6
6
  * SolidJS primitive that returns a signal of currently held keyboard keys.
7
7
  *
8
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
8
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
9
9
  * to the global KeyStateTracker and updates whenever keys are pressed
10
10
  * or released.
11
11
  *
@@ -25,7 +25,7 @@ import { useStore } from "@tanstack/solid-store";
25
25
  * ```
26
26
  */
27
27
  function createHeldKeys() {
28
- return useStore(getKeyStateTracker().store, (state) => state.heldKeys);
28
+ return useSelector(getKeyStateTracker().store, (state) => state.heldKeys);
29
29
  }
30
30
 
31
31
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"createHeldKeys.js","names":[],"sources":["../src/createHeldKeys.ts"],"sourcesContent":["import { useStore } from '@tanstack/solid-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * SolidJS primitive that returns a signal of currently held keyboard keys.\n *\n * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe\n * to the global KeyStateTracker and updates whenever keys are pressed\n * or released.\n *\n * @returns Signal accessor for array of currently held key names\n *\n * @example\n * ```tsx\n * function KeyDisplay() {\n * const heldKeys = createHeldKeys()\n *\n * return (\n * <div>\n * Currently pressed: {heldKeys().join(' + ') || 'None'}\n * </div>\n * )\n * }\n * ```\n */\nexport function createHeldKeys(): () => Array<string> {\n const tracker = getKeyStateTracker()\n return useStore(tracker.store, (state) => state.heldKeys)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,iBAAsC;AAEpD,QAAO,SADS,oBAAoB,CACZ,QAAQ,UAAU,MAAM,SAAS"}
1
+ {"version":3,"file":"createHeldKeys.js","names":[],"sources":["../src/createHeldKeys.ts"],"sourcesContent":["import { useSelector } from '@tanstack/solid-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\n\n/**\n * SolidJS primitive that returns a signal of currently held keyboard keys.\n *\n * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe\n * to the global KeyStateTracker and updates whenever keys are pressed\n * or released.\n *\n * @returns Signal accessor for array of currently held key names\n *\n * @example\n * ```tsx\n * function KeyDisplay() {\n * const heldKeys = createHeldKeys()\n *\n * return (\n * <div>\n * Currently pressed: {heldKeys().join(' + ') || 'None'}\n * </div>\n * )\n * }\n * ```\n */\nexport function createHeldKeys(): () => Array<string> {\n const tracker = getKeyStateTracker()\n return useSelector(tracker.store, (state) => state.heldKeys)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,iBAAsC;AAEpD,QAAO,YADS,oBAAoB,CACT,QAAQ,UAAU,MAAM,SAAS"}
@@ -12,7 +12,7 @@ let _tanstack_solid_store = require("@tanstack/solid-store");
12
12
  * to hotkey strings, and handling edge cases like Escape to cancel or Backspace/Delete
13
13
  * to clear.
14
14
  *
15
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
15
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
16
16
  * to the recorder's store state (same pattern as useHotkeyRecorder in React).
17
17
  *
18
18
  * @param options - Configuration options for the recorder (or accessor function)
@@ -52,8 +52,8 @@ function createHotkeyRecorder(options) {
52
52
  ...defaultOptions.hotkeyRecorder,
53
53
  ...resolvedOptions
54
54
  });
55
- const isRecording = (0, _tanstack_solid_store.useStore)(recorder.store, (state) => state.isRecording);
56
- const recordedHotkey = (0, _tanstack_solid_store.useStore)(recorder.store, (state) => state.recordedHotkey);
55
+ const isRecording = (0, _tanstack_solid_store.useSelector)(recorder.store, (state) => state.isRecording);
56
+ const recordedHotkey = (0, _tanstack_solid_store.useSelector)(recorder.store, (state) => state.recordedHotkey);
57
57
  (0, solid_js.createEffect)(() => {
58
58
  const resolved = typeof options === "function" ? options() : options;
59
59
  recorder.setOptions({
@@ -1 +1 @@
1
- {"version":3,"file":"createHotkeyRecorder.cjs","names":["useDefaultHotkeysOptions","HotkeyRecorder"],"sources":["../src/createHotkeyRecorder.ts"],"sourcesContent":["import { createEffect, onCleanup } from 'solid-js'\nimport { useStore } from '@tanstack/solid-store'\nimport { HotkeyRecorder } from '@tanstack/hotkeys'\nimport { useDefaultHotkeysOptions } from './HotkeysProvider'\nimport type { Hotkey, HotkeyRecorderOptions } from '@tanstack/hotkeys'\n\nexport interface SolidHotkeyRecorder {\n /** Whether recording is currently active */\n isRecording: () => boolean\n /** The currently recorded hotkey (for live preview) */\n recordedHotkey: () => Hotkey | null\n /** Start recording a new hotkey */\n startRecording: () => void\n /** Stop recording (same as cancel) */\n stopRecording: () => void\n /** Cancel recording without saving */\n cancelRecording: () => void\n}\n\n/**\n * SolidJS primitive for recording keyboard shortcuts.\n *\n * This primitive provides a thin wrapper around the framework-agnostic `HotkeyRecorder`\n * class, managing all the complexity of capturing keyboard events, converting them\n * to hotkey strings, and handling edge cases like Escape to cancel or Backspace/Delete\n * to clear.\n *\n * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe\n * to the recorder's store state (same pattern as useHotkeyRecorder in React).\n *\n * @param options - Configuration options for the recorder (or accessor function)\n * @returns An object with recording state signals and control functions\n *\n * @example\n * ```tsx\n * function ShortcutSettings() {\n * const [shortcut, setShortcut] = createSignal<Hotkey>('Mod+S')\n *\n * const recorder = createHotkeyRecorder({\n * onRecord: (hotkey) => {\n * setShortcut(hotkey)\n * },\n * onCancel: () => {\n * console.log('Recording cancelled')\n * },\n * })\n *\n * return (\n * <div>\n * <button onClick={recorder.startRecording}>\n * {recorder.isRecording() ? 'Recording...' : 'Edit Shortcut'}\n * </button>\n * <Show when={recorder.recordedHotkey()}>\n * <div>Recording: {recorder.recordedHotkey()}</div>\n * </Show>\n * </div>\n * )\n * }\n * ```\n */\nexport function createHotkeyRecorder(\n options: HotkeyRecorderOptions | (() => HotkeyRecorderOptions),\n): SolidHotkeyRecorder {\n const defaultOptions = useDefaultHotkeysOptions()\n\n const resolvedOptions = typeof options === 'function' ? options() : options\n const mergedOptions = {\n ...defaultOptions.hotkeyRecorder,\n ...resolvedOptions,\n } as HotkeyRecorderOptions\n\n // Create recorder once synchronously (matches React's useRef pattern)\n const recorder = new HotkeyRecorder(mergedOptions)\n\n // Subscribe to recorder state using useStore (same pattern as useHotkeyRecorder)\n const isRecording = useStore(recorder.store, (state) => state.isRecording)\n const recordedHotkey = useStore(\n recorder.store,\n (state) => state.recordedHotkey,\n )\n\n // Sync options on every effect run (matches React's sync on render)\n createEffect(() => {\n const resolved = typeof options === 'function' ? options() : options\n recorder.setOptions({\n ...defaultOptions.hotkeyRecorder,\n ...resolved,\n } as HotkeyRecorderOptions)\n })\n\n // Cleanup on unmount\n onCleanup(() => {\n recorder.destroy()\n })\n\n return {\n isRecording,\n recordedHotkey,\n startRecording: () => recorder.start(),\n stopRecording: () => recorder.stop(),\n cancelRecording: () => recorder.cancel(),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,SAAgB,qBACd,SACqB;CACrB,MAAM,iBAAiBA,kDAA0B;CAEjD,MAAM,kBAAkB,OAAO,YAAY,aAAa,SAAS,GAAG;CAOpE,MAAM,WAAW,IAAIC,iCANC;EACpB,GAAG,eAAe;EAClB,GAAG;EACJ,CAGiD;CAGlD,MAAM,kDAAuB,SAAS,QAAQ,UAAU,MAAM,YAAY;CAC1E,MAAM,qDACJ,SAAS,QACR,UAAU,MAAM,eAClB;AAGD,kCAAmB;EACjB,MAAM,WAAW,OAAO,YAAY,aAAa,SAAS,GAAG;AAC7D,WAAS,WAAW;GAClB,GAAG,eAAe;GAClB,GAAG;GACJ,CAA0B;GAC3B;AAGF,+BAAgB;AACd,WAAS,SAAS;GAClB;AAEF,QAAO;EACL;EACA;EACA,sBAAsB,SAAS,OAAO;EACtC,qBAAqB,SAAS,MAAM;EACpC,uBAAuB,SAAS,QAAQ;EACzC"}
1
+ {"version":3,"file":"createHotkeyRecorder.cjs","names":["useDefaultHotkeysOptions","HotkeyRecorder"],"sources":["../src/createHotkeyRecorder.ts"],"sourcesContent":["import { createEffect, onCleanup } from 'solid-js'\nimport { useSelector } from '@tanstack/solid-store'\nimport { HotkeyRecorder } from '@tanstack/hotkeys'\nimport { useDefaultHotkeysOptions } from './HotkeysProvider'\nimport type { Hotkey, HotkeyRecorderOptions } from '@tanstack/hotkeys'\n\nexport interface SolidHotkeyRecorder {\n /** Whether recording is currently active */\n isRecording: () => boolean\n /** The currently recorded hotkey (for live preview) */\n recordedHotkey: () => Hotkey | null\n /** Start recording a new hotkey */\n startRecording: () => void\n /** Stop recording (same as cancel) */\n stopRecording: () => void\n /** Cancel recording without saving */\n cancelRecording: () => void\n}\n\n/**\n * SolidJS primitive for recording keyboard shortcuts.\n *\n * This primitive provides a thin wrapper around the framework-agnostic `HotkeyRecorder`\n * class, managing all the complexity of capturing keyboard events, converting them\n * to hotkey strings, and handling edge cases like Escape to cancel or Backspace/Delete\n * to clear.\n *\n * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe\n * to the recorder's store state (same pattern as useHotkeyRecorder in React).\n *\n * @param options - Configuration options for the recorder (or accessor function)\n * @returns An object with recording state signals and control functions\n *\n * @example\n * ```tsx\n * function ShortcutSettings() {\n * const [shortcut, setShortcut] = createSignal<Hotkey>('Mod+S')\n *\n * const recorder = createHotkeyRecorder({\n * onRecord: (hotkey) => {\n * setShortcut(hotkey)\n * },\n * onCancel: () => {\n * console.log('Recording cancelled')\n * },\n * })\n *\n * return (\n * <div>\n * <button onClick={recorder.startRecording}>\n * {recorder.isRecording() ? 'Recording...' : 'Edit Shortcut'}\n * </button>\n * <Show when={recorder.recordedHotkey()}>\n * <div>Recording: {recorder.recordedHotkey()}</div>\n * </Show>\n * </div>\n * )\n * }\n * ```\n */\nexport function createHotkeyRecorder(\n options: HotkeyRecorderOptions | (() => HotkeyRecorderOptions),\n): SolidHotkeyRecorder {\n const defaultOptions = useDefaultHotkeysOptions()\n\n const resolvedOptions = typeof options === 'function' ? options() : options\n const mergedOptions = {\n ...defaultOptions.hotkeyRecorder,\n ...resolvedOptions,\n } as HotkeyRecorderOptions\n\n // Create recorder once synchronously (matches React's useRef pattern)\n const recorder = new HotkeyRecorder(mergedOptions)\n\n // Subscribe to recorder state using useSelector (same pattern as useHotkeyRecorder)\n const isRecording = useSelector(recorder.store, (state) => state.isRecording)\n const recordedHotkey = useSelector(\n recorder.store,\n (state) => state.recordedHotkey,\n )\n\n // Sync options on every effect run (matches React's sync on render)\n createEffect(() => {\n const resolved = typeof options === 'function' ? options() : options\n recorder.setOptions({\n ...defaultOptions.hotkeyRecorder,\n ...resolved,\n } as HotkeyRecorderOptions)\n })\n\n // Cleanup on unmount\n onCleanup(() => {\n recorder.destroy()\n })\n\n return {\n isRecording,\n recordedHotkey,\n startRecording: () => recorder.start(),\n stopRecording: () => recorder.stop(),\n cancelRecording: () => recorder.cancel(),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,SAAgB,qBACd,SACqB;CACrB,MAAM,iBAAiBA,kDAA0B;CAEjD,MAAM,kBAAkB,OAAO,YAAY,aAAa,SAAS,GAAG;CAOpE,MAAM,WAAW,IAAIC,iCANC;EACpB,GAAG,eAAe;EAClB,GAAG;EACJ,CAGiD;CAGlD,MAAM,qDAA0B,SAAS,QAAQ,UAAU,MAAM,YAAY;CAC7E,MAAM,wDACJ,SAAS,QACR,UAAU,MAAM,eAClB;AAGD,kCAAmB;EACjB,MAAM,WAAW,OAAO,YAAY,aAAa,SAAS,GAAG;AAC7D,WAAS,WAAW;GAClB,GAAG,eAAe;GAClB,GAAG;GACJ,CAA0B;GAC3B;AAGF,+BAAgB;AACd,WAAS,SAAS;GAClB;AAEF,QAAO;EACL;EACA;EACA,sBAAsB,SAAS,OAAO;EACtC,qBAAqB,SAAS,MAAM;EACpC,uBAAuB,SAAS,QAAQ;EACzC"}
@@ -21,7 +21,7 @@ interface SolidHotkeyRecorder {
21
21
  * to hotkey strings, and handling edge cases like Escape to cancel or Backspace/Delete
22
22
  * to clear.
23
23
  *
24
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
24
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
25
25
  * to the recorder's store state (same pattern as useHotkeyRecorder in React).
26
26
  *
27
27
  * @param options - Configuration options for the recorder (or accessor function)
@@ -21,7 +21,7 @@ interface SolidHotkeyRecorder {
21
21
  * to hotkey strings, and handling edge cases like Escape to cancel or Backspace/Delete
22
22
  * to clear.
23
23
  *
24
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
24
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
25
25
  * to the recorder's store state (same pattern as useHotkeyRecorder in React).
26
26
  *
27
27
  * @param options - Configuration options for the recorder (or accessor function)
@@ -1,7 +1,7 @@
1
1
  import { useDefaultHotkeysOptions } from "./HotkeysProvider.js";
2
2
  import { HotkeyRecorder } from "@tanstack/hotkeys";
3
3
  import { createEffect, onCleanup } from "solid-js";
4
- import { useStore } from "@tanstack/solid-store";
4
+ import { useSelector } from "@tanstack/solid-store";
5
5
 
6
6
  //#region src/createHotkeyRecorder.ts
7
7
  /**
@@ -12,7 +12,7 @@ import { useStore } from "@tanstack/solid-store";
12
12
  * to hotkey strings, and handling edge cases like Escape to cancel or Backspace/Delete
13
13
  * to clear.
14
14
  *
15
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
15
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
16
16
  * to the recorder's store state (same pattern as useHotkeyRecorder in React).
17
17
  *
18
18
  * @param options - Configuration options for the recorder (or accessor function)
@@ -52,8 +52,8 @@ function createHotkeyRecorder(options) {
52
52
  ...defaultOptions.hotkeyRecorder,
53
53
  ...resolvedOptions
54
54
  });
55
- const isRecording = useStore(recorder.store, (state) => state.isRecording);
56
- const recordedHotkey = useStore(recorder.store, (state) => state.recordedHotkey);
55
+ const isRecording = useSelector(recorder.store, (state) => state.isRecording);
56
+ const recordedHotkey = useSelector(recorder.store, (state) => state.recordedHotkey);
57
57
  createEffect(() => {
58
58
  const resolved = typeof options === "function" ? options() : options;
59
59
  recorder.setOptions({
@@ -1 +1 @@
1
- {"version":3,"file":"createHotkeyRecorder.js","names":[],"sources":["../src/createHotkeyRecorder.ts"],"sourcesContent":["import { createEffect, onCleanup } from 'solid-js'\nimport { useStore } from '@tanstack/solid-store'\nimport { HotkeyRecorder } from '@tanstack/hotkeys'\nimport { useDefaultHotkeysOptions } from './HotkeysProvider'\nimport type { Hotkey, HotkeyRecorderOptions } from '@tanstack/hotkeys'\n\nexport interface SolidHotkeyRecorder {\n /** Whether recording is currently active */\n isRecording: () => boolean\n /** The currently recorded hotkey (for live preview) */\n recordedHotkey: () => Hotkey | null\n /** Start recording a new hotkey */\n startRecording: () => void\n /** Stop recording (same as cancel) */\n stopRecording: () => void\n /** Cancel recording without saving */\n cancelRecording: () => void\n}\n\n/**\n * SolidJS primitive for recording keyboard shortcuts.\n *\n * This primitive provides a thin wrapper around the framework-agnostic `HotkeyRecorder`\n * class, managing all the complexity of capturing keyboard events, converting them\n * to hotkey strings, and handling edge cases like Escape to cancel or Backspace/Delete\n * to clear.\n *\n * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe\n * to the recorder's store state (same pattern as useHotkeyRecorder in React).\n *\n * @param options - Configuration options for the recorder (or accessor function)\n * @returns An object with recording state signals and control functions\n *\n * @example\n * ```tsx\n * function ShortcutSettings() {\n * const [shortcut, setShortcut] = createSignal<Hotkey>('Mod+S')\n *\n * const recorder = createHotkeyRecorder({\n * onRecord: (hotkey) => {\n * setShortcut(hotkey)\n * },\n * onCancel: () => {\n * console.log('Recording cancelled')\n * },\n * })\n *\n * return (\n * <div>\n * <button onClick={recorder.startRecording}>\n * {recorder.isRecording() ? 'Recording...' : 'Edit Shortcut'}\n * </button>\n * <Show when={recorder.recordedHotkey()}>\n * <div>Recording: {recorder.recordedHotkey()}</div>\n * </Show>\n * </div>\n * )\n * }\n * ```\n */\nexport function createHotkeyRecorder(\n options: HotkeyRecorderOptions | (() => HotkeyRecorderOptions),\n): SolidHotkeyRecorder {\n const defaultOptions = useDefaultHotkeysOptions()\n\n const resolvedOptions = typeof options === 'function' ? options() : options\n const mergedOptions = {\n ...defaultOptions.hotkeyRecorder,\n ...resolvedOptions,\n } as HotkeyRecorderOptions\n\n // Create recorder once synchronously (matches React's useRef pattern)\n const recorder = new HotkeyRecorder(mergedOptions)\n\n // Subscribe to recorder state using useStore (same pattern as useHotkeyRecorder)\n const isRecording = useStore(recorder.store, (state) => state.isRecording)\n const recordedHotkey = useStore(\n recorder.store,\n (state) => state.recordedHotkey,\n )\n\n // Sync options on every effect run (matches React's sync on render)\n createEffect(() => {\n const resolved = typeof options === 'function' ? options() : options\n recorder.setOptions({\n ...defaultOptions.hotkeyRecorder,\n ...resolved,\n } as HotkeyRecorderOptions)\n })\n\n // Cleanup on unmount\n onCleanup(() => {\n recorder.destroy()\n })\n\n return {\n isRecording,\n recordedHotkey,\n startRecording: () => recorder.start(),\n stopRecording: () => recorder.stop(),\n cancelRecording: () => recorder.cancel(),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,SAAgB,qBACd,SACqB;CACrB,MAAM,iBAAiB,0BAA0B;CAEjD,MAAM,kBAAkB,OAAO,YAAY,aAAa,SAAS,GAAG;CAOpE,MAAM,WAAW,IAAI,eANC;EACpB,GAAG,eAAe;EAClB,GAAG;EACJ,CAGiD;CAGlD,MAAM,cAAc,SAAS,SAAS,QAAQ,UAAU,MAAM,YAAY;CAC1E,MAAM,iBAAiB,SACrB,SAAS,QACR,UAAU,MAAM,eAClB;AAGD,oBAAmB;EACjB,MAAM,WAAW,OAAO,YAAY,aAAa,SAAS,GAAG;AAC7D,WAAS,WAAW;GAClB,GAAG,eAAe;GAClB,GAAG;GACJ,CAA0B;GAC3B;AAGF,iBAAgB;AACd,WAAS,SAAS;GAClB;AAEF,QAAO;EACL;EACA;EACA,sBAAsB,SAAS,OAAO;EACtC,qBAAqB,SAAS,MAAM;EACpC,uBAAuB,SAAS,QAAQ;EACzC"}
1
+ {"version":3,"file":"createHotkeyRecorder.js","names":[],"sources":["../src/createHotkeyRecorder.ts"],"sourcesContent":["import { createEffect, onCleanup } from 'solid-js'\nimport { useSelector } from '@tanstack/solid-store'\nimport { HotkeyRecorder } from '@tanstack/hotkeys'\nimport { useDefaultHotkeysOptions } from './HotkeysProvider'\nimport type { Hotkey, HotkeyRecorderOptions } from '@tanstack/hotkeys'\n\nexport interface SolidHotkeyRecorder {\n /** Whether recording is currently active */\n isRecording: () => boolean\n /** The currently recorded hotkey (for live preview) */\n recordedHotkey: () => Hotkey | null\n /** Start recording a new hotkey */\n startRecording: () => void\n /** Stop recording (same as cancel) */\n stopRecording: () => void\n /** Cancel recording without saving */\n cancelRecording: () => void\n}\n\n/**\n * SolidJS primitive for recording keyboard shortcuts.\n *\n * This primitive provides a thin wrapper around the framework-agnostic `HotkeyRecorder`\n * class, managing all the complexity of capturing keyboard events, converting them\n * to hotkey strings, and handling edge cases like Escape to cancel or Backspace/Delete\n * to clear.\n *\n * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe\n * to the recorder's store state (same pattern as useHotkeyRecorder in React).\n *\n * @param options - Configuration options for the recorder (or accessor function)\n * @returns An object with recording state signals and control functions\n *\n * @example\n * ```tsx\n * function ShortcutSettings() {\n * const [shortcut, setShortcut] = createSignal<Hotkey>('Mod+S')\n *\n * const recorder = createHotkeyRecorder({\n * onRecord: (hotkey) => {\n * setShortcut(hotkey)\n * },\n * onCancel: () => {\n * console.log('Recording cancelled')\n * },\n * })\n *\n * return (\n * <div>\n * <button onClick={recorder.startRecording}>\n * {recorder.isRecording() ? 'Recording...' : 'Edit Shortcut'}\n * </button>\n * <Show when={recorder.recordedHotkey()}>\n * <div>Recording: {recorder.recordedHotkey()}</div>\n * </Show>\n * </div>\n * )\n * }\n * ```\n */\nexport function createHotkeyRecorder(\n options: HotkeyRecorderOptions | (() => HotkeyRecorderOptions),\n): SolidHotkeyRecorder {\n const defaultOptions = useDefaultHotkeysOptions()\n\n const resolvedOptions = typeof options === 'function' ? options() : options\n const mergedOptions = {\n ...defaultOptions.hotkeyRecorder,\n ...resolvedOptions,\n } as HotkeyRecorderOptions\n\n // Create recorder once synchronously (matches React's useRef pattern)\n const recorder = new HotkeyRecorder(mergedOptions)\n\n // Subscribe to recorder state using useSelector (same pattern as useHotkeyRecorder)\n const isRecording = useSelector(recorder.store, (state) => state.isRecording)\n const recordedHotkey = useSelector(\n recorder.store,\n (state) => state.recordedHotkey,\n )\n\n // Sync options on every effect run (matches React's sync on render)\n createEffect(() => {\n const resolved = typeof options === 'function' ? options() : options\n recorder.setOptions({\n ...defaultOptions.hotkeyRecorder,\n ...resolved,\n } as HotkeyRecorderOptions)\n })\n\n // Cleanup on unmount\n onCleanup(() => {\n recorder.destroy()\n })\n\n return {\n isRecording,\n recordedHotkey,\n startRecording: () => recorder.start(),\n stopRecording: () => recorder.stop(),\n cancelRecording: () => recorder.cancel(),\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,SAAgB,qBACd,SACqB;CACrB,MAAM,iBAAiB,0BAA0B;CAEjD,MAAM,kBAAkB,OAAO,YAAY,aAAa,SAAS,GAAG;CAOpE,MAAM,WAAW,IAAI,eANC;EACpB,GAAG,eAAe;EAClB,GAAG;EACJ,CAGiD;CAGlD,MAAM,cAAc,YAAY,SAAS,QAAQ,UAAU,MAAM,YAAY;CAC7E,MAAM,iBAAiB,YACrB,SAAS,QACR,UAAU,MAAM,eAClB;AAGD,oBAAmB;EACjB,MAAM,WAAW,OAAO,YAAY,aAAa,SAAS,GAAG;AAC7D,WAAS,WAAW;GAClB,GAAG,eAAe;GAClB,GAAG;GACJ,CAA0B;GAC3B;AAGF,iBAAgB;AACd,WAAS,SAAS;GAClB;AAEF,QAAO;EACL;EACA;EACA,sBAAsB,SAAS,OAAO;EACtC,qBAAqB,SAAS,MAAM;EACpC,uBAAuB,SAAS,QAAQ;EACzC"}
@@ -16,8 +16,8 @@ function createHotkeyRegistrations() {
16
16
  const hotkeyManager = (0, _tanstack_hotkeys.getHotkeyManager)();
17
17
  const sequenceManager = (0, _tanstack_hotkeys.getSequenceManager)();
18
18
  return {
19
- hotkeys: (0, _tanstack_solid_store.useStore)(hotkeyManager.registrations, (state) => Array.from(state.values()).map(_tanstack_hotkeys.toHotkeyRegistrationView)),
20
- sequences: (0, _tanstack_solid_store.useStore)(sequenceManager.registrations, (state) => Array.from(state.values()))
19
+ hotkeys: (0, _tanstack_solid_store.useSelector)(hotkeyManager.registrations, (state) => Array.from(state.values()).map(_tanstack_hotkeys.toHotkeyRegistrationView)),
20
+ sequences: (0, _tanstack_solid_store.useSelector)(sequenceManager.registrations, (state) => Array.from(state.values()))
21
21
  };
22
22
  }
23
23
 
@@ -1 +1 @@
1
- {"version":3,"file":"createHotkeyRegistrations.cjs","names":["toHotkeyRegistrationView"],"sources":["../src/createHotkeyRegistrations.ts"],"sourcesContent":["import { useStore } from '@tanstack/solid-store'\nimport {\n getHotkeyManager,\n getSequenceManager,\n toHotkeyRegistrationView,\n} from '@tanstack/hotkeys'\nimport type {\n HotkeyRegistrationView,\n SequenceRegistrationView,\n} from '@tanstack/hotkeys'\n\n/**\n * Return type for createHotkeyRegistrations.\n */\nexport interface HotkeyRegistrationsResult {\n /** Accessor for all registered hotkeys (public view, no callbacks) */\n hotkeys: () => Array<HotkeyRegistrationView>\n /** Accessor for all registered sequences */\n sequences: () => Array<SequenceRegistrationView>\n}\n\n/**\n * Solid primitive that reactively reads all hotkey and sequence registrations\n * from the singleton managers.\n *\n * This is a standalone primitive that does NOT require the HotkeysProvider.\n * It subscribes to both HotkeyManager and SequenceManager stores and\n * triggers reactivity when registrations change.\n *\n * @returns Object with `hotkeys` and `sequences` signal accessors\n */\nexport function createHotkeyRegistrations(): HotkeyRegistrationsResult {\n const hotkeyManager = getHotkeyManager()\n const sequenceManager = getSequenceManager()\n\n const hotkeys = useStore(hotkeyManager.registrations, (state) =>\n Array.from(state.values()).map(toHotkeyRegistrationView),\n )\n\n const sequences = useStore(sequenceManager.registrations, (state) =>\n Array.from(state.values()),\n )\n\n return { hotkeys, sequences }\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,SAAgB,4BAAuD;CACrE,MAAM,yDAAkC;CACxC,MAAM,6DAAsC;AAU5C,QAAO;EAAE,6CARgB,cAAc,gBAAgB,UACrD,MAAM,KAAK,MAAM,QAAQ,CAAC,CAAC,IAAIA,2CAAyB,CACzD;EAMiB,+CAJS,gBAAgB,gBAAgB,UACzD,MAAM,KAAK,MAAM,QAAQ,CAAC,CAC3B;EAE4B"}
1
+ {"version":3,"file":"createHotkeyRegistrations.cjs","names":["toHotkeyRegistrationView"],"sources":["../src/createHotkeyRegistrations.ts"],"sourcesContent":["import { useSelector } from '@tanstack/solid-store'\nimport {\n getHotkeyManager,\n getSequenceManager,\n toHotkeyRegistrationView,\n} from '@tanstack/hotkeys'\nimport type {\n HotkeyRegistrationView,\n SequenceRegistrationView,\n} from '@tanstack/hotkeys'\n\n/**\n * Return type for createHotkeyRegistrations.\n */\nexport interface HotkeyRegistrationsResult {\n /** Accessor for all registered hotkeys (public view, no callbacks) */\n hotkeys: () => Array<HotkeyRegistrationView>\n /** Accessor for all registered sequences */\n sequences: () => Array<SequenceRegistrationView>\n}\n\n/**\n * Solid primitive that reactively reads all hotkey and sequence registrations\n * from the singleton managers.\n *\n * This is a standalone primitive that does NOT require the HotkeysProvider.\n * It subscribes to both HotkeyManager and SequenceManager stores and\n * triggers reactivity when registrations change.\n *\n * @returns Object with `hotkeys` and `sequences` signal accessors\n */\nexport function createHotkeyRegistrations(): HotkeyRegistrationsResult {\n const hotkeyManager = getHotkeyManager()\n const sequenceManager = getSequenceManager()\n\n const hotkeys = useSelector(hotkeyManager.registrations, (state) =>\n Array.from(state.values()).map(toHotkeyRegistrationView),\n )\n\n const sequences = useSelector(sequenceManager.registrations, (state) =>\n Array.from(state.values()),\n )\n\n return { hotkeys, sequences }\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,SAAgB,4BAAuD;CACrE,MAAM,yDAAkC;CACxC,MAAM,6DAAsC;AAU5C,QAAO;EAAE,gDARmB,cAAc,gBAAgB,UACxD,MAAM,KAAK,MAAM,QAAQ,CAAC,CAAC,IAAIA,2CAAyB,CACzD;EAMiB,kDAJY,gBAAgB,gBAAgB,UAC5D,MAAM,KAAK,MAAM,QAAQ,CAAC,CAC3B;EAE4B"}
@@ -1,5 +1,5 @@
1
1
  import { getHotkeyManager, getSequenceManager, toHotkeyRegistrationView } from "@tanstack/hotkeys";
2
- import { useStore } from "@tanstack/solid-store";
2
+ import { useSelector } from "@tanstack/solid-store";
3
3
 
4
4
  //#region src/createHotkeyRegistrations.ts
5
5
  /**
@@ -16,8 +16,8 @@ function createHotkeyRegistrations() {
16
16
  const hotkeyManager = getHotkeyManager();
17
17
  const sequenceManager = getSequenceManager();
18
18
  return {
19
- hotkeys: useStore(hotkeyManager.registrations, (state) => Array.from(state.values()).map(toHotkeyRegistrationView)),
20
- sequences: useStore(sequenceManager.registrations, (state) => Array.from(state.values()))
19
+ hotkeys: useSelector(hotkeyManager.registrations, (state) => Array.from(state.values()).map(toHotkeyRegistrationView)),
20
+ sequences: useSelector(sequenceManager.registrations, (state) => Array.from(state.values()))
21
21
  };
22
22
  }
23
23
 
@@ -1 +1 @@
1
- {"version":3,"file":"createHotkeyRegistrations.js","names":[],"sources":["../src/createHotkeyRegistrations.ts"],"sourcesContent":["import { useStore } from '@tanstack/solid-store'\nimport {\n getHotkeyManager,\n getSequenceManager,\n toHotkeyRegistrationView,\n} from '@tanstack/hotkeys'\nimport type {\n HotkeyRegistrationView,\n SequenceRegistrationView,\n} from '@tanstack/hotkeys'\n\n/**\n * Return type for createHotkeyRegistrations.\n */\nexport interface HotkeyRegistrationsResult {\n /** Accessor for all registered hotkeys (public view, no callbacks) */\n hotkeys: () => Array<HotkeyRegistrationView>\n /** Accessor for all registered sequences */\n sequences: () => Array<SequenceRegistrationView>\n}\n\n/**\n * Solid primitive that reactively reads all hotkey and sequence registrations\n * from the singleton managers.\n *\n * This is a standalone primitive that does NOT require the HotkeysProvider.\n * It subscribes to both HotkeyManager and SequenceManager stores and\n * triggers reactivity when registrations change.\n *\n * @returns Object with `hotkeys` and `sequences` signal accessors\n */\nexport function createHotkeyRegistrations(): HotkeyRegistrationsResult {\n const hotkeyManager = getHotkeyManager()\n const sequenceManager = getSequenceManager()\n\n const hotkeys = useStore(hotkeyManager.registrations, (state) =>\n Array.from(state.values()).map(toHotkeyRegistrationView),\n )\n\n const sequences = useStore(sequenceManager.registrations, (state) =>\n Array.from(state.values()),\n )\n\n return { hotkeys, sequences }\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,SAAgB,4BAAuD;CACrE,MAAM,gBAAgB,kBAAkB;CACxC,MAAM,kBAAkB,oBAAoB;AAU5C,QAAO;EAAE,SARO,SAAS,cAAc,gBAAgB,UACrD,MAAM,KAAK,MAAM,QAAQ,CAAC,CAAC,IAAI,yBAAyB,CACzD;EAMiB,WAJA,SAAS,gBAAgB,gBAAgB,UACzD,MAAM,KAAK,MAAM,QAAQ,CAAC,CAC3B;EAE4B"}
1
+ {"version":3,"file":"createHotkeyRegistrations.js","names":[],"sources":["../src/createHotkeyRegistrations.ts"],"sourcesContent":["import { useSelector } from '@tanstack/solid-store'\nimport {\n getHotkeyManager,\n getSequenceManager,\n toHotkeyRegistrationView,\n} from '@tanstack/hotkeys'\nimport type {\n HotkeyRegistrationView,\n SequenceRegistrationView,\n} from '@tanstack/hotkeys'\n\n/**\n * Return type for createHotkeyRegistrations.\n */\nexport interface HotkeyRegistrationsResult {\n /** Accessor for all registered hotkeys (public view, no callbacks) */\n hotkeys: () => Array<HotkeyRegistrationView>\n /** Accessor for all registered sequences */\n sequences: () => Array<SequenceRegistrationView>\n}\n\n/**\n * Solid primitive that reactively reads all hotkey and sequence registrations\n * from the singleton managers.\n *\n * This is a standalone primitive that does NOT require the HotkeysProvider.\n * It subscribes to both HotkeyManager and SequenceManager stores and\n * triggers reactivity when registrations change.\n *\n * @returns Object with `hotkeys` and `sequences` signal accessors\n */\nexport function createHotkeyRegistrations(): HotkeyRegistrationsResult {\n const hotkeyManager = getHotkeyManager()\n const sequenceManager = getSequenceManager()\n\n const hotkeys = useSelector(hotkeyManager.registrations, (state) =>\n Array.from(state.values()).map(toHotkeyRegistrationView),\n )\n\n const sequences = useSelector(sequenceManager.registrations, (state) =>\n Array.from(state.values()),\n )\n\n return { hotkeys, sequences }\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,SAAgB,4BAAuD;CACrE,MAAM,gBAAgB,kBAAkB;CACxC,MAAM,kBAAkB,oBAAoB;AAU5C,QAAO;EAAE,SARO,YAAY,cAAc,gBAAgB,UACxD,MAAM,KAAK,MAAM,QAAQ,CAAC,CAAC,IAAI,yBAAyB,CACzD;EAMiB,WAJA,YAAY,gBAAgB,gBAAgB,UAC5D,MAAM,KAAK,MAAM,QAAQ,CAAC,CAC3B;EAE4B"}
@@ -14,9 +14,9 @@ function createHotkeySequenceRecorder(options) {
14
14
  ...defaultOptions.hotkeySequenceRecorder,
15
15
  ...resolvedOptions
16
16
  });
17
- const isRecording = (0, _tanstack_solid_store.useStore)(recorder.store, (state) => state.isRecording);
18
- const steps = (0, _tanstack_solid_store.useStore)(recorder.store, (state) => state.steps);
19
- const recordedSequence = (0, _tanstack_solid_store.useStore)(recorder.store, (state) => state.recordedSequence);
17
+ const isRecording = (0, _tanstack_solid_store.useSelector)(recorder.store, (state) => state.isRecording);
18
+ const steps = (0, _tanstack_solid_store.useSelector)(recorder.store, (state) => state.steps);
19
+ const recordedSequence = (0, _tanstack_solid_store.useSelector)(recorder.store, (state) => state.recordedSequence);
20
20
  (0, solid_js.createEffect)(() => {
21
21
  const resolved = typeof options === "function" ? options() : options;
22
22
  recorder.setOptions({
@@ -1 +1 @@
1
- {"version":3,"file":"createHotkeySequenceRecorder.cjs","names":["useDefaultHotkeysOptions","HotkeySequenceRecorder"],"sources":["../src/createHotkeySequenceRecorder.ts"],"sourcesContent":["import { createEffect, onCleanup } from 'solid-js'\nimport { useStore } from '@tanstack/solid-store'\nimport { HotkeySequenceRecorder } from '@tanstack/hotkeys'\nimport { useDefaultHotkeysOptions } from './HotkeysProvider'\nimport type {\n HotkeySequence,\n HotkeySequenceRecorderOptions,\n} from '@tanstack/hotkeys'\n\nexport interface SolidHotkeySequenceRecorder {\n isRecording: () => boolean\n steps: () => HotkeySequence\n recordedSequence: () => HotkeySequence | null\n startRecording: () => void\n stopRecording: () => void\n cancelRecording: () => void\n commitRecording: () => void\n}\n\n/**\n * SolidJS primitive for recording multi-chord sequences (Vim-style shortcuts).\n */\nexport function createHotkeySequenceRecorder(\n options:\n | HotkeySequenceRecorderOptions\n | (() => HotkeySequenceRecorderOptions),\n): SolidHotkeySequenceRecorder {\n const defaultOptions = useDefaultHotkeysOptions()\n\n const resolvedOptions = typeof options === 'function' ? options() : options\n const mergedOptions = {\n ...defaultOptions.hotkeySequenceRecorder,\n ...resolvedOptions,\n } as HotkeySequenceRecorderOptions\n\n const recorder = new HotkeySequenceRecorder(mergedOptions)\n\n const isRecording = useStore(recorder.store, (state) => state.isRecording)\n const steps = useStore(recorder.store, (state) => state.steps)\n const recordedSequence = useStore(\n recorder.store,\n (state) => state.recordedSequence,\n )\n\n createEffect(() => {\n const resolved = typeof options === 'function' ? options() : options\n recorder.setOptions({\n ...defaultOptions.hotkeySequenceRecorder,\n ...resolved,\n } as HotkeySequenceRecorderOptions)\n })\n\n onCleanup(() => {\n recorder.destroy()\n })\n\n return {\n isRecording,\n steps,\n recordedSequence,\n startRecording: () => recorder.start(),\n stopRecording: () => recorder.stop(),\n cancelRecording: () => recorder.cancel(),\n commitRecording: () => recorder.commit(),\n }\n}\n"],"mappings":";;;;;;;;;AAsBA,SAAgB,6BACd,SAG6B;CAC7B,MAAM,iBAAiBA,kDAA0B;CAEjD,MAAM,kBAAkB,OAAO,YAAY,aAAa,SAAS,GAAG;CAMpE,MAAM,WAAW,IAAIC,yCALC;EACpB,GAAG,eAAe;EAClB,GAAG;EACJ,CAEyD;CAE1D,MAAM,kDAAuB,SAAS,QAAQ,UAAU,MAAM,YAAY;CAC1E,MAAM,4CAAiB,SAAS,QAAQ,UAAU,MAAM,MAAM;CAC9D,MAAM,uDACJ,SAAS,QACR,UAAU,MAAM,iBAClB;AAED,kCAAmB;EACjB,MAAM,WAAW,OAAO,YAAY,aAAa,SAAS,GAAG;AAC7D,WAAS,WAAW;GAClB,GAAG,eAAe;GAClB,GAAG;GACJ,CAAkC;GACnC;AAEF,+BAAgB;AACd,WAAS,SAAS;GAClB;AAEF,QAAO;EACL;EACA;EACA;EACA,sBAAsB,SAAS,OAAO;EACtC,qBAAqB,SAAS,MAAM;EACpC,uBAAuB,SAAS,QAAQ;EACxC,uBAAuB,SAAS,QAAQ;EACzC"}
1
+ {"version":3,"file":"createHotkeySequenceRecorder.cjs","names":["useDefaultHotkeysOptions","HotkeySequenceRecorder"],"sources":["../src/createHotkeySequenceRecorder.ts"],"sourcesContent":["import { createEffect, onCleanup } from 'solid-js'\nimport { useSelector } from '@tanstack/solid-store'\nimport { HotkeySequenceRecorder } from '@tanstack/hotkeys'\nimport { useDefaultHotkeysOptions } from './HotkeysProvider'\nimport type {\n HotkeySequence,\n HotkeySequenceRecorderOptions,\n} from '@tanstack/hotkeys'\n\nexport interface SolidHotkeySequenceRecorder {\n isRecording: () => boolean\n steps: () => HotkeySequence\n recordedSequence: () => HotkeySequence | null\n startRecording: () => void\n stopRecording: () => void\n cancelRecording: () => void\n commitRecording: () => void\n}\n\n/**\n * SolidJS primitive for recording multi-chord sequences (Vim-style shortcuts).\n */\nexport function createHotkeySequenceRecorder(\n options:\n | HotkeySequenceRecorderOptions\n | (() => HotkeySequenceRecorderOptions),\n): SolidHotkeySequenceRecorder {\n const defaultOptions = useDefaultHotkeysOptions()\n\n const resolvedOptions = typeof options === 'function' ? options() : options\n const mergedOptions = {\n ...defaultOptions.hotkeySequenceRecorder,\n ...resolvedOptions,\n } as HotkeySequenceRecorderOptions\n\n const recorder = new HotkeySequenceRecorder(mergedOptions)\n\n const isRecording = useSelector(recorder.store, (state) => state.isRecording)\n const steps = useSelector(recorder.store, (state) => state.steps)\n const recordedSequence = useSelector(\n recorder.store,\n (state) => state.recordedSequence,\n )\n\n createEffect(() => {\n const resolved = typeof options === 'function' ? options() : options\n recorder.setOptions({\n ...defaultOptions.hotkeySequenceRecorder,\n ...resolved,\n } as HotkeySequenceRecorderOptions)\n })\n\n onCleanup(() => {\n recorder.destroy()\n })\n\n return {\n isRecording,\n steps,\n recordedSequence,\n startRecording: () => recorder.start(),\n stopRecording: () => recorder.stop(),\n cancelRecording: () => recorder.cancel(),\n commitRecording: () => recorder.commit(),\n }\n}\n"],"mappings":";;;;;;;;;AAsBA,SAAgB,6BACd,SAG6B;CAC7B,MAAM,iBAAiBA,kDAA0B;CAEjD,MAAM,kBAAkB,OAAO,YAAY,aAAa,SAAS,GAAG;CAMpE,MAAM,WAAW,IAAIC,yCALC;EACpB,GAAG,eAAe;EAClB,GAAG;EACJ,CAEyD;CAE1D,MAAM,qDAA0B,SAAS,QAAQ,UAAU,MAAM,YAAY;CAC7E,MAAM,+CAAoB,SAAS,QAAQ,UAAU,MAAM,MAAM;CACjE,MAAM,0DACJ,SAAS,QACR,UAAU,MAAM,iBAClB;AAED,kCAAmB;EACjB,MAAM,WAAW,OAAO,YAAY,aAAa,SAAS,GAAG;AAC7D,WAAS,WAAW;GAClB,GAAG,eAAe;GAClB,GAAG;GACJ,CAAkC;GACnC;AAEF,+BAAgB;AACd,WAAS,SAAS;GAClB;AAEF,QAAO;EACL;EACA;EACA;EACA,sBAAsB,SAAS,OAAO;EACtC,qBAAqB,SAAS,MAAM;EACpC,uBAAuB,SAAS,QAAQ;EACxC,uBAAuB,SAAS,QAAQ;EACzC"}
@@ -1,7 +1,7 @@
1
1
  import { useDefaultHotkeysOptions } from "./HotkeysProvider.js";
2
2
  import { HotkeySequenceRecorder } from "@tanstack/hotkeys";
3
3
  import { createEffect, onCleanup } from "solid-js";
4
- import { useStore } from "@tanstack/solid-store";
4
+ import { useSelector } from "@tanstack/solid-store";
5
5
 
6
6
  //#region src/createHotkeySequenceRecorder.ts
7
7
  /**
@@ -14,9 +14,9 @@ function createHotkeySequenceRecorder(options) {
14
14
  ...defaultOptions.hotkeySequenceRecorder,
15
15
  ...resolvedOptions
16
16
  });
17
- const isRecording = useStore(recorder.store, (state) => state.isRecording);
18
- const steps = useStore(recorder.store, (state) => state.steps);
19
- const recordedSequence = useStore(recorder.store, (state) => state.recordedSequence);
17
+ const isRecording = useSelector(recorder.store, (state) => state.isRecording);
18
+ const steps = useSelector(recorder.store, (state) => state.steps);
19
+ const recordedSequence = useSelector(recorder.store, (state) => state.recordedSequence);
20
20
  createEffect(() => {
21
21
  const resolved = typeof options === "function" ? options() : options;
22
22
  recorder.setOptions({
@@ -1 +1 @@
1
- {"version":3,"file":"createHotkeySequenceRecorder.js","names":[],"sources":["../src/createHotkeySequenceRecorder.ts"],"sourcesContent":["import { createEffect, onCleanup } from 'solid-js'\nimport { useStore } from '@tanstack/solid-store'\nimport { HotkeySequenceRecorder } from '@tanstack/hotkeys'\nimport { useDefaultHotkeysOptions } from './HotkeysProvider'\nimport type {\n HotkeySequence,\n HotkeySequenceRecorderOptions,\n} from '@tanstack/hotkeys'\n\nexport interface SolidHotkeySequenceRecorder {\n isRecording: () => boolean\n steps: () => HotkeySequence\n recordedSequence: () => HotkeySequence | null\n startRecording: () => void\n stopRecording: () => void\n cancelRecording: () => void\n commitRecording: () => void\n}\n\n/**\n * SolidJS primitive for recording multi-chord sequences (Vim-style shortcuts).\n */\nexport function createHotkeySequenceRecorder(\n options:\n | HotkeySequenceRecorderOptions\n | (() => HotkeySequenceRecorderOptions),\n): SolidHotkeySequenceRecorder {\n const defaultOptions = useDefaultHotkeysOptions()\n\n const resolvedOptions = typeof options === 'function' ? options() : options\n const mergedOptions = {\n ...defaultOptions.hotkeySequenceRecorder,\n ...resolvedOptions,\n } as HotkeySequenceRecorderOptions\n\n const recorder = new HotkeySequenceRecorder(mergedOptions)\n\n const isRecording = useStore(recorder.store, (state) => state.isRecording)\n const steps = useStore(recorder.store, (state) => state.steps)\n const recordedSequence = useStore(\n recorder.store,\n (state) => state.recordedSequence,\n )\n\n createEffect(() => {\n const resolved = typeof options === 'function' ? options() : options\n recorder.setOptions({\n ...defaultOptions.hotkeySequenceRecorder,\n ...resolved,\n } as HotkeySequenceRecorderOptions)\n })\n\n onCleanup(() => {\n recorder.destroy()\n })\n\n return {\n isRecording,\n steps,\n recordedSequence,\n startRecording: () => recorder.start(),\n stopRecording: () => recorder.stop(),\n cancelRecording: () => recorder.cancel(),\n commitRecording: () => recorder.commit(),\n }\n}\n"],"mappings":";;;;;;;;;AAsBA,SAAgB,6BACd,SAG6B;CAC7B,MAAM,iBAAiB,0BAA0B;CAEjD,MAAM,kBAAkB,OAAO,YAAY,aAAa,SAAS,GAAG;CAMpE,MAAM,WAAW,IAAI,uBALC;EACpB,GAAG,eAAe;EAClB,GAAG;EACJ,CAEyD;CAE1D,MAAM,cAAc,SAAS,SAAS,QAAQ,UAAU,MAAM,YAAY;CAC1E,MAAM,QAAQ,SAAS,SAAS,QAAQ,UAAU,MAAM,MAAM;CAC9D,MAAM,mBAAmB,SACvB,SAAS,QACR,UAAU,MAAM,iBAClB;AAED,oBAAmB;EACjB,MAAM,WAAW,OAAO,YAAY,aAAa,SAAS,GAAG;AAC7D,WAAS,WAAW;GAClB,GAAG,eAAe;GAClB,GAAG;GACJ,CAAkC;GACnC;AAEF,iBAAgB;AACd,WAAS,SAAS;GAClB;AAEF,QAAO;EACL;EACA;EACA;EACA,sBAAsB,SAAS,OAAO;EACtC,qBAAqB,SAAS,MAAM;EACpC,uBAAuB,SAAS,QAAQ;EACxC,uBAAuB,SAAS,QAAQ;EACzC"}
1
+ {"version":3,"file":"createHotkeySequenceRecorder.js","names":[],"sources":["../src/createHotkeySequenceRecorder.ts"],"sourcesContent":["import { createEffect, onCleanup } from 'solid-js'\nimport { useSelector } from '@tanstack/solid-store'\nimport { HotkeySequenceRecorder } from '@tanstack/hotkeys'\nimport { useDefaultHotkeysOptions } from './HotkeysProvider'\nimport type {\n HotkeySequence,\n HotkeySequenceRecorderOptions,\n} from '@tanstack/hotkeys'\n\nexport interface SolidHotkeySequenceRecorder {\n isRecording: () => boolean\n steps: () => HotkeySequence\n recordedSequence: () => HotkeySequence | null\n startRecording: () => void\n stopRecording: () => void\n cancelRecording: () => void\n commitRecording: () => void\n}\n\n/**\n * SolidJS primitive for recording multi-chord sequences (Vim-style shortcuts).\n */\nexport function createHotkeySequenceRecorder(\n options:\n | HotkeySequenceRecorderOptions\n | (() => HotkeySequenceRecorderOptions),\n): SolidHotkeySequenceRecorder {\n const defaultOptions = useDefaultHotkeysOptions()\n\n const resolvedOptions = typeof options === 'function' ? options() : options\n const mergedOptions = {\n ...defaultOptions.hotkeySequenceRecorder,\n ...resolvedOptions,\n } as HotkeySequenceRecorderOptions\n\n const recorder = new HotkeySequenceRecorder(mergedOptions)\n\n const isRecording = useSelector(recorder.store, (state) => state.isRecording)\n const steps = useSelector(recorder.store, (state) => state.steps)\n const recordedSequence = useSelector(\n recorder.store,\n (state) => state.recordedSequence,\n )\n\n createEffect(() => {\n const resolved = typeof options === 'function' ? options() : options\n recorder.setOptions({\n ...defaultOptions.hotkeySequenceRecorder,\n ...resolved,\n } as HotkeySequenceRecorderOptions)\n })\n\n onCleanup(() => {\n recorder.destroy()\n })\n\n return {\n isRecording,\n steps,\n recordedSequence,\n startRecording: () => recorder.start(),\n stopRecording: () => recorder.stop(),\n cancelRecording: () => recorder.cancel(),\n commitRecording: () => recorder.commit(),\n }\n}\n"],"mappings":";;;;;;;;;AAsBA,SAAgB,6BACd,SAG6B;CAC7B,MAAM,iBAAiB,0BAA0B;CAEjD,MAAM,kBAAkB,OAAO,YAAY,aAAa,SAAS,GAAG;CAMpE,MAAM,WAAW,IAAI,uBALC;EACpB,GAAG,eAAe;EAClB,GAAG;EACJ,CAEyD;CAE1D,MAAM,cAAc,YAAY,SAAS,QAAQ,UAAU,MAAM,YAAY;CAC7E,MAAM,QAAQ,YAAY,SAAS,QAAQ,UAAU,MAAM,MAAM;CACjE,MAAM,mBAAmB,YACvB,SAAS,QACR,UAAU,MAAM,iBAClB;AAED,oBAAmB;EACjB,MAAM,WAAW,OAAO,YAAY,aAAa,SAAS,GAAG;AAC7D,WAAS,WAAW;GAClB,GAAG,eAAe;GAClB,GAAG;GACJ,CAAkC;GACnC;AAEF,iBAAgB;AACd,WAAS,SAAS;GAClB;AAEF,QAAO;EACL;EACA;EACA;EACA,sBAAsB,SAAS,OAAO;EACtC,qBAAqB,SAAS,MAAM;EACpC,uBAAuB,SAAS,QAAQ;EACxC,uBAAuB,SAAS,QAAQ;EACzC"}
@@ -6,7 +6,7 @@ let _tanstack_solid_store = require("@tanstack/solid-store");
6
6
  /**
7
7
  * SolidJS primitive that returns whether a specific key is currently being held.
8
8
  *
9
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
9
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
10
10
  * to the global KeyStateTracker and uses a selector to determine if the
11
11
  * specified key is held.
12
12
  *
@@ -44,7 +44,7 @@ let _tanstack_solid_store = require("@tanstack/solid-store");
44
44
  * ```
45
45
  */
46
46
  function createKeyHold(key) {
47
- const heldKeysSelector = (0, _tanstack_solid_store.useStore)((0, _tanstack_hotkeys.getKeyStateTracker)().store, (state) => state.heldKeys);
47
+ const heldKeysSelector = (0, _tanstack_solid_store.useSelector)((0, _tanstack_hotkeys.getKeyStateTracker)().store, (state) => state.heldKeys);
48
48
  return (0, solid_js.createMemo)(() => {
49
49
  const normalizedKey = (typeof key === "function" ? key() : key).toLowerCase();
50
50
  return heldKeysSelector().some((heldKey) => heldKey.toLowerCase() === normalizedKey);
@@ -1 +1 @@
1
- {"version":3,"file":"createKeyHold.cjs","names":[],"sources":["../src/createKeyHold.ts"],"sourcesContent":["import { createMemo } from 'solid-js'\nimport { useStore } from '@tanstack/solid-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\nimport type { IndividualKey } from '@tanstack/hotkeys'\n\n/**\n * SolidJS primitive that returns whether a specific key is currently being held.\n *\n * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe\n * to the global KeyStateTracker and uses a selector to determine if the\n * specified key is held.\n *\n * @param key - The key to check (e.g., 'Shift', 'Control', 'A') - can be an accessor function\n * @returns Signal accessor that returns true if the key is currently held down\n *\n * @example\n * ```tsx\n * function ShiftIndicator() {\n * const isShiftHeld = createKeyHold('Shift')\n *\n * return (\n * <div style={{ opacity: isShiftHeld() ? 1 : 0.5 }}>\n * {isShiftHeld() ? 'Shift is pressed!' : 'Press Shift'}\n * </div>\n * )\n * }\n * ```\n *\n * @example\n * ```tsx\n * function ModifierIndicators() {\n * const ctrl = createKeyHold('Control')\n * const shift = createKeyHold('Shift')\n * const alt = createKeyHold('Alt')\n *\n * return (\n * <div>\n * <span style={{ opacity: ctrl() ? 1 : 0.3 }}>Ctrl</span>\n * <span style={{ opacity: shift() ? 1 : 0.3 }}>Shift</span>\n * <span style={{ opacity: alt() ? 1 : 0.3 }}>Alt</span>\n * </div>\n * )\n * }\n * ```\n */\nexport function createKeyHold(\n key: IndividualKey | (() => IndividualKey),\n): () => boolean {\n const tracker = getKeyStateTracker()\n const heldKeysSelector = useStore(tracker.store, (state) => state.heldKeys)\n\n return createMemo(() => {\n const resolvedKey = typeof key === 'function' ? key() : key\n const normalizedKey = resolvedKey.toLowerCase()\n return heldKeysSelector().some(\n (heldKey) => heldKey.toLowerCase() === normalizedKey,\n )\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,cACd,KACe;CAEf,MAAM,kGAD8B,CACM,QAAQ,UAAU,MAAM,SAAS;AAE3E,uCAAwB;EAEtB,MAAM,iBADc,OAAO,QAAQ,aAAa,KAAK,GAAG,KACtB,aAAa;AAC/C,SAAO,kBAAkB,CAAC,MACvB,YAAY,QAAQ,aAAa,KAAK,cACxC;GACD"}
1
+ {"version":3,"file":"createKeyHold.cjs","names":[],"sources":["../src/createKeyHold.ts"],"sourcesContent":["import { createMemo } from 'solid-js'\nimport { useSelector } from '@tanstack/solid-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\nimport type { IndividualKey } from '@tanstack/hotkeys'\n\n/**\n * SolidJS primitive that returns whether a specific key is currently being held.\n *\n * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe\n * to the global KeyStateTracker and uses a selector to determine if the\n * specified key is held.\n *\n * @param key - The key to check (e.g., 'Shift', 'Control', 'A') - can be an accessor function\n * @returns Signal accessor that returns true if the key is currently held down\n *\n * @example\n * ```tsx\n * function ShiftIndicator() {\n * const isShiftHeld = createKeyHold('Shift')\n *\n * return (\n * <div style={{ opacity: isShiftHeld() ? 1 : 0.5 }}>\n * {isShiftHeld() ? 'Shift is pressed!' : 'Press Shift'}\n * </div>\n * )\n * }\n * ```\n *\n * @example\n * ```tsx\n * function ModifierIndicators() {\n * const ctrl = createKeyHold('Control')\n * const shift = createKeyHold('Shift')\n * const alt = createKeyHold('Alt')\n *\n * return (\n * <div>\n * <span style={{ opacity: ctrl() ? 1 : 0.3 }}>Ctrl</span>\n * <span style={{ opacity: shift() ? 1 : 0.3 }}>Shift</span>\n * <span style={{ opacity: alt() ? 1 : 0.3 }}>Alt</span>\n * </div>\n * )\n * }\n * ```\n */\nexport function createKeyHold(\n key: IndividualKey | (() => IndividualKey),\n): () => boolean {\n const tracker = getKeyStateTracker()\n const heldKeysSelector = useSelector(tracker.store, (state) => state.heldKeys)\n\n return createMemo(() => {\n const resolvedKey = typeof key === 'function' ? key() : key\n const normalizedKey = resolvedKey.toLowerCase()\n return heldKeysSelector().some(\n (heldKey) => heldKey.toLowerCase() === normalizedKey,\n )\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,cACd,KACe;CAEf,MAAM,qGAD8B,CACS,QAAQ,UAAU,MAAM,SAAS;AAE9E,uCAAwB;EAEtB,MAAM,iBADc,OAAO,QAAQ,aAAa,KAAK,GAAG,KACtB,aAAa;AAC/C,SAAO,kBAAkB,CAAC,MACvB,YAAY,QAAQ,aAAa,KAAK,cACxC;GACD"}
@@ -4,7 +4,7 @@ import { IndividualKey } from "@tanstack/hotkeys";
4
4
  /**
5
5
  * SolidJS primitive that returns whether a specific key is currently being held.
6
6
  *
7
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
7
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
8
8
  * to the global KeyStateTracker and uses a selector to determine if the
9
9
  * specified key is held.
10
10
  *
@@ -4,7 +4,7 @@ import { IndividualKey } from "@tanstack/hotkeys";
4
4
  /**
5
5
  * SolidJS primitive that returns whether a specific key is currently being held.
6
6
  *
7
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
7
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
8
8
  * to the global KeyStateTracker and uses a selector to determine if the
9
9
  * specified key is held.
10
10
  *
@@ -1,12 +1,12 @@
1
1
  import { getKeyStateTracker } from "@tanstack/hotkeys";
2
2
  import { createMemo } from "solid-js";
3
- import { useStore } from "@tanstack/solid-store";
3
+ import { useSelector } from "@tanstack/solid-store";
4
4
 
5
5
  //#region src/createKeyHold.ts
6
6
  /**
7
7
  * SolidJS primitive that returns whether a specific key is currently being held.
8
8
  *
9
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
9
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
10
10
  * to the global KeyStateTracker and uses a selector to determine if the
11
11
  * specified key is held.
12
12
  *
@@ -44,7 +44,7 @@ import { useStore } from "@tanstack/solid-store";
44
44
  * ```
45
45
  */
46
46
  function createKeyHold(key) {
47
- const heldKeysSelector = useStore(getKeyStateTracker().store, (state) => state.heldKeys);
47
+ const heldKeysSelector = useSelector(getKeyStateTracker().store, (state) => state.heldKeys);
48
48
  return createMemo(() => {
49
49
  const normalizedKey = (typeof key === "function" ? key() : key).toLowerCase();
50
50
  return heldKeysSelector().some((heldKey) => heldKey.toLowerCase() === normalizedKey);
@@ -1 +1 @@
1
- {"version":3,"file":"createKeyHold.js","names":[],"sources":["../src/createKeyHold.ts"],"sourcesContent":["import { createMemo } from 'solid-js'\nimport { useStore } from '@tanstack/solid-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\nimport type { IndividualKey } from '@tanstack/hotkeys'\n\n/**\n * SolidJS primitive that returns whether a specific key is currently being held.\n *\n * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe\n * to the global KeyStateTracker and uses a selector to determine if the\n * specified key is held.\n *\n * @param key - The key to check (e.g., 'Shift', 'Control', 'A') - can be an accessor function\n * @returns Signal accessor that returns true if the key is currently held down\n *\n * @example\n * ```tsx\n * function ShiftIndicator() {\n * const isShiftHeld = createKeyHold('Shift')\n *\n * return (\n * <div style={{ opacity: isShiftHeld() ? 1 : 0.5 }}>\n * {isShiftHeld() ? 'Shift is pressed!' : 'Press Shift'}\n * </div>\n * )\n * }\n * ```\n *\n * @example\n * ```tsx\n * function ModifierIndicators() {\n * const ctrl = createKeyHold('Control')\n * const shift = createKeyHold('Shift')\n * const alt = createKeyHold('Alt')\n *\n * return (\n * <div>\n * <span style={{ opacity: ctrl() ? 1 : 0.3 }}>Ctrl</span>\n * <span style={{ opacity: shift() ? 1 : 0.3 }}>Shift</span>\n * <span style={{ opacity: alt() ? 1 : 0.3 }}>Alt</span>\n * </div>\n * )\n * }\n * ```\n */\nexport function createKeyHold(\n key: IndividualKey | (() => IndividualKey),\n): () => boolean {\n const tracker = getKeyStateTracker()\n const heldKeysSelector = useStore(tracker.store, (state) => state.heldKeys)\n\n return createMemo(() => {\n const resolvedKey = typeof key === 'function' ? key() : key\n const normalizedKey = resolvedKey.toLowerCase()\n return heldKeysSelector().some(\n (heldKey) => heldKey.toLowerCase() === normalizedKey,\n )\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,cACd,KACe;CAEf,MAAM,mBAAmB,SADT,oBAAoB,CACM,QAAQ,UAAU,MAAM,SAAS;AAE3E,QAAO,iBAAiB;EAEtB,MAAM,iBADc,OAAO,QAAQ,aAAa,KAAK,GAAG,KACtB,aAAa;AAC/C,SAAO,kBAAkB,CAAC,MACvB,YAAY,QAAQ,aAAa,KAAK,cACxC;GACD"}
1
+ {"version":3,"file":"createKeyHold.js","names":[],"sources":["../src/createKeyHold.ts"],"sourcesContent":["import { createMemo } from 'solid-js'\nimport { useSelector } from '@tanstack/solid-store'\nimport { getKeyStateTracker } from '@tanstack/hotkeys'\nimport type { IndividualKey } from '@tanstack/hotkeys'\n\n/**\n * SolidJS primitive that returns whether a specific key is currently being held.\n *\n * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe\n * to the global KeyStateTracker and uses a selector to determine if the\n * specified key is held.\n *\n * @param key - The key to check (e.g., 'Shift', 'Control', 'A') - can be an accessor function\n * @returns Signal accessor that returns true if the key is currently held down\n *\n * @example\n * ```tsx\n * function ShiftIndicator() {\n * const isShiftHeld = createKeyHold('Shift')\n *\n * return (\n * <div style={{ opacity: isShiftHeld() ? 1 : 0.5 }}>\n * {isShiftHeld() ? 'Shift is pressed!' : 'Press Shift'}\n * </div>\n * )\n * }\n * ```\n *\n * @example\n * ```tsx\n * function ModifierIndicators() {\n * const ctrl = createKeyHold('Control')\n * const shift = createKeyHold('Shift')\n * const alt = createKeyHold('Alt')\n *\n * return (\n * <div>\n * <span style={{ opacity: ctrl() ? 1 : 0.3 }}>Ctrl</span>\n * <span style={{ opacity: shift() ? 1 : 0.3 }}>Shift</span>\n * <span style={{ opacity: alt() ? 1 : 0.3 }}>Alt</span>\n * </div>\n * )\n * }\n * ```\n */\nexport function createKeyHold(\n key: IndividualKey | (() => IndividualKey),\n): () => boolean {\n const tracker = getKeyStateTracker()\n const heldKeysSelector = useSelector(tracker.store, (state) => state.heldKeys)\n\n return createMemo(() => {\n const resolvedKey = typeof key === 'function' ? key() : key\n const normalizedKey = resolvedKey.toLowerCase()\n return heldKeysSelector().some(\n (heldKey) => heldKey.toLowerCase() === normalizedKey,\n )\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,cACd,KACe;CAEf,MAAM,mBAAmB,YADT,oBAAoB,CACS,QAAQ,UAAU,MAAM,SAAS;AAE9E,QAAO,iBAAiB;EAEtB,MAAM,iBADc,OAAO,QAAQ,aAAa,KAAK,GAAG,KACtB,aAAa;AAC/C,SAAO,kBAAkB,CAAC,MACvB,YAAY,QAAQ,aAAa,KAAK,cACxC;GACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/solid-hotkeys",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "description": "SolidJS adapter for TanStack Hotkeys",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -42,14 +42,14 @@
42
42
  "src"
43
43
  ],
44
44
  "dependencies": {
45
- "@tanstack/solid-store": "^0.9.3",
46
- "@tanstack/hotkeys": "0.7.1"
45
+ "@tanstack/solid-store": "^0.11.0",
46
+ "@tanstack/hotkeys": "0.8.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@solidjs/testing-library": "^0.8.10",
50
50
  "@testing-library/jest-dom": "^6.9.1",
51
51
  "solid-js": "^1.9.12",
52
- "vite-plugin-solid": "^2.11.11"
52
+ "vite-plugin-solid": "^2.11.12"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "solid-js": ">=1.7.0"
@@ -1,4 +1,4 @@
1
- import { useStore } from '@tanstack/solid-store'
1
+ import { useSelector } from '@tanstack/solid-store'
2
2
  import { getKeyStateTracker } from '@tanstack/hotkeys'
3
3
 
4
4
  /**
@@ -7,7 +7,7 @@ import { getKeyStateTracker } from '@tanstack/hotkeys'
7
7
  * This is useful for debugging which physical key was pressed (e.g. distinguishing
8
8
  * left vs right Shift via "ShiftLeft" / "ShiftRight").
9
9
  *
10
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
10
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
11
11
  * to the global KeyStateTracker.
12
12
  *
13
13
  * @returns Signal accessor for record mapping normalized key names to their `event.code` values
@@ -34,5 +34,5 @@ import { getKeyStateTracker } from '@tanstack/hotkeys'
34
34
  */
35
35
  export function createHeldKeyCodes(): () => Record<string, string> {
36
36
  const tracker = getKeyStateTracker()
37
- return useStore(tracker.store, (state) => state.heldCodes)
37
+ return useSelector(tracker.store, (state) => state.heldCodes)
38
38
  }
@@ -1,10 +1,10 @@
1
- import { useStore } from '@tanstack/solid-store'
1
+ import { useSelector } from '@tanstack/solid-store'
2
2
  import { getKeyStateTracker } from '@tanstack/hotkeys'
3
3
 
4
4
  /**
5
5
  * SolidJS primitive that returns a signal of currently held keyboard keys.
6
6
  *
7
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
7
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
8
8
  * to the global KeyStateTracker and updates whenever keys are pressed
9
9
  * or released.
10
10
  *
@@ -25,5 +25,5 @@ import { getKeyStateTracker } from '@tanstack/hotkeys'
25
25
  */
26
26
  export function createHeldKeys(): () => Array<string> {
27
27
  const tracker = getKeyStateTracker()
28
- return useStore(tracker.store, (state) => state.heldKeys)
28
+ return useSelector(tracker.store, (state) => state.heldKeys)
29
29
  }
@@ -1,5 +1,5 @@
1
1
  import { createEffect, onCleanup } from 'solid-js'
2
- import { useStore } from '@tanstack/solid-store'
2
+ import { useSelector } from '@tanstack/solid-store'
3
3
  import { HotkeyRecorder } from '@tanstack/hotkeys'
4
4
  import { useDefaultHotkeysOptions } from './HotkeysProvider'
5
5
  import type { Hotkey, HotkeyRecorderOptions } from '@tanstack/hotkeys'
@@ -25,7 +25,7 @@ export interface SolidHotkeyRecorder {
25
25
  * to hotkey strings, and handling edge cases like Escape to cancel or Backspace/Delete
26
26
  * to clear.
27
27
  *
28
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
28
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
29
29
  * to the recorder's store state (same pattern as useHotkeyRecorder in React).
30
30
  *
31
31
  * @param options - Configuration options for the recorder (or accessor function)
@@ -72,9 +72,9 @@ export function createHotkeyRecorder(
72
72
  // Create recorder once synchronously (matches React's useRef pattern)
73
73
  const recorder = new HotkeyRecorder(mergedOptions)
74
74
 
75
- // Subscribe to recorder state using useStore (same pattern as useHotkeyRecorder)
76
- const isRecording = useStore(recorder.store, (state) => state.isRecording)
77
- const recordedHotkey = useStore(
75
+ // Subscribe to recorder state using useSelector (same pattern as useHotkeyRecorder)
76
+ const isRecording = useSelector(recorder.store, (state) => state.isRecording)
77
+ const recordedHotkey = useSelector(
78
78
  recorder.store,
79
79
  (state) => state.recordedHotkey,
80
80
  )
@@ -1,4 +1,4 @@
1
- import { useStore } from '@tanstack/solid-store'
1
+ import { useSelector } from '@tanstack/solid-store'
2
2
  import {
3
3
  getHotkeyManager,
4
4
  getSequenceManager,
@@ -33,11 +33,11 @@ export function createHotkeyRegistrations(): HotkeyRegistrationsResult {
33
33
  const hotkeyManager = getHotkeyManager()
34
34
  const sequenceManager = getSequenceManager()
35
35
 
36
- const hotkeys = useStore(hotkeyManager.registrations, (state) =>
36
+ const hotkeys = useSelector(hotkeyManager.registrations, (state) =>
37
37
  Array.from(state.values()).map(toHotkeyRegistrationView),
38
38
  )
39
39
 
40
- const sequences = useStore(sequenceManager.registrations, (state) =>
40
+ const sequences = useSelector(sequenceManager.registrations, (state) =>
41
41
  Array.from(state.values()),
42
42
  )
43
43
 
@@ -1,5 +1,5 @@
1
1
  import { createEffect, onCleanup } from 'solid-js'
2
- import { useStore } from '@tanstack/solid-store'
2
+ import { useSelector } from '@tanstack/solid-store'
3
3
  import { HotkeySequenceRecorder } from '@tanstack/hotkeys'
4
4
  import { useDefaultHotkeysOptions } from './HotkeysProvider'
5
5
  import type {
@@ -35,9 +35,9 @@ export function createHotkeySequenceRecorder(
35
35
 
36
36
  const recorder = new HotkeySequenceRecorder(mergedOptions)
37
37
 
38
- const isRecording = useStore(recorder.store, (state) => state.isRecording)
39
- const steps = useStore(recorder.store, (state) => state.steps)
40
- const recordedSequence = useStore(
38
+ const isRecording = useSelector(recorder.store, (state) => state.isRecording)
39
+ const steps = useSelector(recorder.store, (state) => state.steps)
40
+ const recordedSequence = useSelector(
41
41
  recorder.store,
42
42
  (state) => state.recordedSequence,
43
43
  )
@@ -1,12 +1,12 @@
1
1
  import { createMemo } from 'solid-js'
2
- import { useStore } from '@tanstack/solid-store'
2
+ import { useSelector } from '@tanstack/solid-store'
3
3
  import { getKeyStateTracker } from '@tanstack/hotkeys'
4
4
  import type { IndividualKey } from '@tanstack/hotkeys'
5
5
 
6
6
  /**
7
7
  * SolidJS primitive that returns whether a specific key is currently being held.
8
8
  *
9
- * This primitive uses `useStore` from `@tanstack/solid-store` to subscribe
9
+ * This primitive uses `useSelector` from `@tanstack/solid-store` to subscribe
10
10
  * to the global KeyStateTracker and uses a selector to determine if the
11
11
  * specified key is held.
12
12
  *
@@ -47,7 +47,7 @@ export function createKeyHold(
47
47
  key: IndividualKey | (() => IndividualKey),
48
48
  ): () => boolean {
49
49
  const tracker = getKeyStateTracker()
50
- const heldKeysSelector = useStore(tracker.store, (state) => state.heldKeys)
50
+ const heldKeysSelector = useSelector(tracker.store, (state) => state.heldKeys)
51
51
 
52
52
  return createMemo(() => {
53
53
  const resolvedKey = typeof key === 'function' ? key() : key