@tanstack/preact-hotkeys 0.20.3 → 0.20.4
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.
- package/dist/useHotkey.d.ts +5 -2
- package/dist/useHotkeyRecorder.d.ts +3 -2
- package/dist/utils.js +1 -1
- package/package.json +2 -2
package/dist/useHotkey.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { AppHotkey, HotkeyCallback, HotkeyCallbackContextFor, RegisterableHotkey } from "@tanstack/hotkeys";
|
|
2
2
|
import { AdapterAppHotkeyOptions, AdapterChordOptions, AdapterCommonOptions, AdapterHotkeyOptions, AdapterOptionsFor, AdapterSequenceOptions } from "@tanstack/hotkeys/adapter";
|
|
3
3
|
import { RefObject } from "preact";
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* A Preact ref, element, document, or window to listen on. A `null` or
|
|
6
|
+
* `undefined` target, or a ref that is still unset, waits for the element.
|
|
7
|
+
*/
|
|
8
|
+
export type UseHotkeyTarget = RefObject<HTMLElement | null | undefined> | HTMLElement | Document | Window | null;
|
|
6
9
|
/** Options shared by chords and sequences. */
|
|
7
10
|
export type UseHotkeyOptions = AdapterHotkeyOptions<UseHotkeyTarget>;
|
|
8
11
|
/** Options for a chord such as `'Mod+S'`. */
|
|
@@ -24,8 +24,9 @@ export interface PreactHotkeyRecorder<THotkey extends Hotkey = Hotkey> {
|
|
|
24
24
|
* `commitKeys: 'none'`), after `idleTimeoutMs`, or when it reaches `maxSteps`,
|
|
25
25
|
* and `onRecord` receives a chord (one step) or a sequence.
|
|
26
26
|
*
|
|
27
|
-
* Escape cancels
|
|
28
|
-
* when nothing is
|
|
27
|
+
* Escape cancels, and so do Tab and Shift+Tab unless `recordTab` is set.
|
|
28
|
+
* Backspace/Delete removes the last step, or calls `onClear` when nothing is
|
|
29
|
+
* recorded.
|
|
29
30
|
*
|
|
30
31
|
* @param options - Configuration options for the recorder
|
|
31
32
|
* @returns The recorder state and controls
|
package/dist/utils.js
CHANGED
|
@@ -6,7 +6,7 @@ function isRef(value) {
|
|
|
6
6
|
return value !== null && typeof value === "object" && "current" in value;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Resolves a hook target. A null target, or a ref that is still
|
|
9
|
+
* Resolves a hook target. A null target, or a ref that is still unset, skips
|
|
10
10
|
* registration. Omit the target to listen on the document.
|
|
11
11
|
*/
|
|
12
12
|
function resolveTarget(target) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/preact-hotkeys",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.4",
|
|
4
4
|
"description": "Preact adapter for TanStack Hotkeys",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"skills"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tanstack/hotkeys": "0.
|
|
38
|
+
"@tanstack/hotkeys": "0.26.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@preact/preset-vite": "^2.10.6",
|