@tanstack/lit-hotkeys 0.15.5 → 0.16.1

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/README.md CHANGED
@@ -51,7 +51,7 @@
51
51
  # TanStack Hotkeys
52
52
 
53
53
  > [!NOTE]
54
- > TanStack Hotkeys is alpha. We are actively developing the library and are open to feedback and contributions.
54
+ > TanStack Hotkeys is in beta. We are actively developing the library and are open to feedback and contributions.
55
55
 
56
56
  Type-safe keyboard shortcuts for the web. Template-string bindings, parsed objects, a cross-platform `Mod` key, a singleton Hotkey Manager, and utilities for cheatsheet UIs—built to stay SSR-friendly.
57
57
 
@@ -1,8 +1,12 @@
1
1
  import { AppHotkeyControllerOptions, HotkeyControllerOptionsFor } from "../controllers/hotkey.js";
2
- import { AppHotkey, HotkeyCallback, RegisterableHotkey } from "@tanstack/hotkeys";
2
+ import { AppHotkey, HotkeyCallback, HotkeyCallbackContext, HotkeyCallbackContextFor, RegisterableHotkey } from "@tanstack/hotkeys";
3
3
  import { LitElement } from "lit";
4
4
  //#region src/decorators/hotkey.d.ts
5
- type HotkeyDecorator = <T extends HotkeyCallback>(proto: LitElement, propertyKey: string, descriptor?: TypedPropertyDescriptor<T>) => void;
5
+ /**
6
+ * A method decorator. The method's context parameter can be typed as the
7
+ * context for the decorated hotkey's kind, such as `HotkeyChordCallbackContext`.
8
+ */
9
+ type HotkeyDecorator<TContext extends HotkeyCallbackContext = HotkeyCallbackContext> = <T extends HotkeyCallback<TContext>>(proto: LitElement, propertyKey: string, descriptor?: TypedPropertyDescriptor<T>) => void;
6
10
  /**
7
11
  * Decorator that registers a hotkey on the element when it connects and
8
12
  * unregisters when it disconnects: a chord such as `'Mod+S'`, a sequence such
@@ -24,5 +28,5 @@ type HotkeyDecorator = <T extends HotkeyCallback>(proto: LitElement, propertyKey
24
28
  * ```
25
29
  */
26
30
  export declare function hotkey<T extends AppHotkey>(hotkey: T, options?: AppHotkeyControllerOptions<T>): HotkeyDecorator;
27
- export declare function hotkey<T extends RegisterableHotkey>(hotkey: T, options?: HotkeyControllerOptionsFor<T>): HotkeyDecorator;
31
+ export declare function hotkey<const T extends RegisterableHotkey>(hotkey: T, options?: HotkeyControllerOptionsFor<T>): HotkeyDecorator<HotkeyCallbackContextFor<T>>;
28
32
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/lit-hotkeys",
3
- "version": "0.15.5",
3
+ "version": "0.16.1",
4
4
  "description": "Lit adapter for TanStack Hotkeys",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "dist"
34
34
  ],
35
35
  "dependencies": {
36
- "@tanstack/hotkeys": "0.15.1"
36
+ "@tanstack/hotkeys": "0.16.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "lit": "^3.3.3"