@tanstack/lit-hotkeys 0.12.0 → 0.13.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.
Files changed (93) hide show
  1. package/dist/constants.js +1 -2
  2. package/dist/controllers/held-key-codes.d.ts +2 -5
  3. package/dist/controllers/held-key-codes.js +6 -3
  4. package/dist/controllers/held-keys.d.ts +2 -5
  5. package/dist/controllers/held-keys.js +6 -3
  6. package/dist/controllers/hotkey-hint.d.ts +2 -5
  7. package/dist/controllers/hotkey-hint.js +6 -3
  8. package/dist/controllers/hotkey-recorder.d.ts +2 -5
  9. package/dist/controllers/hotkey-recorder.js +11 -4
  10. package/dist/controllers/hotkey-registrations.d.ts +2 -5
  11. package/dist/controllers/hotkey-registrations.js +6 -4
  12. package/dist/controllers/hotkey-sequence-recorder.d.ts +2 -5
  13. package/dist/controllers/hotkey-sequence-recorder.js +13 -5
  14. package/dist/controllers/hotkey-sequence.d.ts +2 -5
  15. package/dist/controllers/hotkey-sequence.js +7 -2
  16. package/dist/controllers/hotkey.d.ts +2 -5
  17. package/dist/controllers/hotkey.js +7 -2
  18. package/dist/controllers/index.d.ts +2 -1
  19. package/dist/controllers/key-hold.d.ts +2 -5
  20. package/dist/controllers/key-hold.js +7 -3
  21. package/dist/decorators/hotkey-sequence.d.ts +2 -5
  22. package/dist/decorators/hotkey-sequence.js +1 -2
  23. package/dist/decorators/hotkey.d.ts +2 -5
  24. package/dist/decorators/hotkey.js +1 -2
  25. package/dist/decorators/index.d.ts +2 -1
  26. package/dist/index.d.ts +2 -0
  27. package/package.json +9 -14
  28. package/dist/constants.cjs +0 -27
  29. package/dist/constants.cjs.map +0 -1
  30. package/dist/constants.js.map +0 -1
  31. package/dist/controllers/held-key-codes.cjs +0 -61
  32. package/dist/controllers/held-key-codes.cjs.map +0 -1
  33. package/dist/controllers/held-key-codes.d.cts +0 -45
  34. package/dist/controllers/held-key-codes.js.map +0 -1
  35. package/dist/controllers/held-keys.cjs +0 -58
  36. package/dist/controllers/held-keys.cjs.map +0 -1
  37. package/dist/controllers/held-keys.d.cts +0 -44
  38. package/dist/controllers/held-keys.js.map +0 -1
  39. package/dist/controllers/hotkey-hint.cjs +0 -47
  40. package/dist/controllers/hotkey-hint.cjs.map +0 -1
  41. package/dist/controllers/hotkey-hint.d.cts +0 -27
  42. package/dist/controllers/hotkey-hint.js.map +0 -1
  43. package/dist/controllers/hotkey-recorder.cjs +0 -104
  44. package/dist/controllers/hotkey-recorder.cjs.map +0 -1
  45. package/dist/controllers/hotkey-recorder.d.cts +0 -75
  46. package/dist/controllers/hotkey-recorder.js.map +0 -1
  47. package/dist/controllers/hotkey-registrations.cjs +0 -70
  48. package/dist/controllers/hotkey-registrations.cjs.map +0 -1
  49. package/dist/controllers/hotkey-registrations.d.cts +0 -44
  50. package/dist/controllers/hotkey-registrations.js.map +0 -1
  51. package/dist/controllers/hotkey-sequence-recorder.cjs +0 -117
  52. package/dist/controllers/hotkey-sequence-recorder.cjs.map +0 -1
  53. package/dist/controllers/hotkey-sequence-recorder.d.cts +0 -83
  54. package/dist/controllers/hotkey-sequence-recorder.js.map +0 -1
  55. package/dist/controllers/hotkey-sequence.cjs +0 -58
  56. package/dist/controllers/hotkey-sequence.cjs.map +0 -1
  57. package/dist/controllers/hotkey-sequence.d.cts +0 -45
  58. package/dist/controllers/hotkey-sequence.js.map +0 -1
  59. package/dist/controllers/hotkey.cjs +0 -60
  60. package/dist/controllers/hotkey.cjs.map +0 -1
  61. package/dist/controllers/hotkey.d.cts +0 -45
  62. package/dist/controllers/hotkey.js.map +0 -1
  63. package/dist/controllers/index.d.cts +0 -9
  64. package/dist/controllers/key-hold.cjs +0 -78
  65. package/dist/controllers/key-hold.cjs.map +0 -1
  66. package/dist/controllers/key-hold.d.cts +0 -62
  67. package/dist/controllers/key-hold.js.map +0 -1
  68. package/dist/decorators/hotkey-sequence.cjs +0 -45
  69. package/dist/decorators/hotkey-sequence.cjs.map +0 -1
  70. package/dist/decorators/hotkey-sequence.d.cts +0 -28
  71. package/dist/decorators/hotkey-sequence.js.map +0 -1
  72. package/dist/decorators/hotkey.cjs +0 -44
  73. package/dist/decorators/hotkey.cjs.map +0 -1
  74. package/dist/decorators/hotkey.d.cts +0 -27
  75. package/dist/decorators/hotkey.js.map +0 -1
  76. package/dist/decorators/index.d.cts +0 -2
  77. package/dist/index.cjs +0 -31
  78. package/dist/index.d.cts +0 -13
  79. package/src/constants.ts +0 -23
  80. package/src/controllers/held-key-codes.ts +0 -67
  81. package/src/controllers/held-keys.ts +0 -64
  82. package/src/controllers/hotkey-hint.ts +0 -56
  83. package/src/controllers/hotkey-recorder.ts +0 -120
  84. package/src/controllers/hotkey-registrations.ts +0 -89
  85. package/src/controllers/hotkey-sequence-recorder.ts +0 -141
  86. package/src/controllers/hotkey-sequence.ts +0 -82
  87. package/src/controllers/hotkey.ts +0 -96
  88. package/src/controllers/index.ts +0 -9
  89. package/src/controllers/key-hold.ts +0 -88
  90. package/src/decorators/hotkey-sequence.ts +0 -68
  91. package/src/decorators/hotkey.ts +0 -70
  92. package/src/decorators/index.ts +0 -2
  93. package/src/index.ts +0 -6
package/dist/constants.js CHANGED
@@ -21,5 +21,4 @@ const HOTKEY_SEQUENCE_DEFAULT_OPTIONS = {
21
21
  };
22
22
 
23
23
  //#endregion
24
- export { HOTKEY_DEFAULT_OPTIONS, HOTKEY_SEQUENCE_DEFAULT_OPTIONS };
25
- //# sourceMappingURL=constants.js.map
24
+ export { HOTKEY_DEFAULT_OPTIONS, HOTKEY_SEQUENCE_DEFAULT_OPTIONS };
@@ -1,5 +1,4 @@
1
1
  import { ReactiveController, ReactiveControllerHost } from "lit";
2
-
3
2
  //#region src/controllers/held-key-codes.d.ts
4
3
  /**
5
4
  * A Lit ReactiveController that tracks all currently held key names to their physical `event.code` values.
@@ -23,7 +22,7 @@ import { ReactiveController, ReactiveControllerHost } from "lit";
23
22
  * }
24
23
  * ```
25
24
  */
26
- declare class HeldKeyCodesController implements ReactiveController {
25
+ export declare class HeldKeyCodesController implements ReactiveController {
27
26
  private _host;
28
27
  /** The unsubscribe function to unsubscribe from the tracker store. */
29
28
  private _unsubscribe;
@@ -40,6 +39,4 @@ declare class HeldKeyCodesController implements ReactiveController {
40
39
  /** Unsubscribes from the tracker store and stops tracking the held key codes. */
41
40
  hostDisconnected(): void;
42
41
  }
43
- //#endregion
44
- export { HeldKeyCodesController };
45
- //# sourceMappingURL=held-key-codes.d.ts.map
42
+ //#endregion
@@ -24,6 +24,11 @@ import { getKeyStateTracker } from "@tanstack/hotkeys";
24
24
  * ```
25
25
  */
26
26
  var HeldKeyCodesController = class {
27
+ _host;
28
+ /** The unsubscribe function to unsubscribe from the tracker store. */
29
+ _unsubscribe;
30
+ /** The currently held key names to their physical `event.code` values. */
31
+ _value = {};
27
32
  /** Map of currently held key names to their physical `event.code` values. */
28
33
  get value() {
29
34
  return this._value;
@@ -33,7 +38,6 @@ var HeldKeyCodesController = class {
33
38
  */
34
39
  constructor(_host) {
35
40
  this._host = _host;
36
- this._value = {};
37
41
  this._host.addController(this);
38
42
  }
39
43
  /** Subscribes to the tracker store and updates the internal state when changes occur. */
@@ -57,5 +61,4 @@ var HeldKeyCodesController = class {
57
61
  };
58
62
 
59
63
  //#endregion
60
- export { HeldKeyCodesController };
61
- //# sourceMappingURL=held-key-codes.js.map
64
+ export { HeldKeyCodesController };
@@ -1,5 +1,4 @@
1
1
  import { ReactiveController, ReactiveControllerHost } from "lit";
2
-
3
2
  //#region src/controllers/held-keys.d.ts
4
3
  /**
5
4
  * A Lit ReactiveController that tracks all currently held keyboard keys.
@@ -22,7 +21,7 @@ import { ReactiveController, ReactiveControllerHost } from "lit";
22
21
  * }
23
22
  * ```
24
23
  */
25
- declare class HeldKeysController implements ReactiveController {
24
+ export declare class HeldKeysController implements ReactiveController {
26
25
  private _host;
27
26
  /** The unsubscribe function to unsubscribe from the tracker store. */
28
27
  private _unsubscribe;
@@ -39,6 +38,4 @@ declare class HeldKeysController implements ReactiveController {
39
38
  /** Unsubscribes from the tracker store and stops tracking the held keys. */
40
39
  hostDisconnected(): void;
41
40
  }
42
- //#endregion
43
- export { HeldKeysController };
44
- //# sourceMappingURL=held-keys.d.ts.map
41
+ //#endregion
@@ -23,6 +23,11 @@ import { getKeyStateTracker } from "@tanstack/hotkeys";
23
23
  * ```
24
24
  */
25
25
  var HeldKeysController = class {
26
+ _host;
27
+ /** The unsubscribe function to unsubscribe from the tracker store. */
28
+ _unsubscribe;
29
+ /** The currently held key names. */
30
+ _value = [];
26
31
  /** Array of currently held key names. */
27
32
  get value() {
28
33
  return this._value;
@@ -32,7 +37,6 @@ var HeldKeysController = class {
32
37
  */
33
38
  constructor(_host) {
34
39
  this._host = _host;
35
- this._value = [];
36
40
  this._host.addController(this);
37
41
  }
38
42
  /** Subscribes to the tracker store and updates the internal state when changes occur. */
@@ -54,5 +58,4 @@ var HeldKeysController = class {
54
58
  };
55
59
 
56
60
  //#endregion
57
- export { HeldKeysController };
58
- //# sourceMappingURL=held-keys.js.map
61
+ export { HeldKeysController };
@@ -1,9 +1,8 @@
1
1
  import { HeldModifierOptions, RegisterableHotkey } from "@tanstack/hotkeys";
2
2
  import { ReactiveController, ReactiveControllerHost } from "lit";
3
-
4
3
  //#region src/controllers/hotkey-hint.d.ts
5
4
  /** Modifier hint controller. Getter arguments can read reactive host properties. */
6
- declare class HotkeyHintController implements ReactiveController {
5
+ export declare class HotkeyHintController implements ReactiveController {
7
6
  private host;
8
7
  private hotkey;
9
8
  private options;
@@ -22,6 +21,4 @@ declare class HotkeyHintController implements ReactiveController {
22
21
  /** Recomputes visibility and reports whether the host needs another render. */
23
22
  private update;
24
23
  }
25
- //#endregion
26
- export { HotkeyHintController };
27
- //# sourceMappingURL=hotkey-hint.d.ts.map
24
+ //#endregion
@@ -3,12 +3,16 @@ import { getKeyStateTracker, matchesHeldModifiers } from "@tanstack/hotkeys";
3
3
  //#region src/controllers/hotkey-hint.ts
4
4
  /** Modifier hint controller. Getter arguments can read reactive host properties. */
5
5
  var HotkeyHintController = class {
6
+ host;
7
+ hotkey;
8
+ options;
9
+ unsubscribe;
10
+ visible = false;
6
11
  /** Attaches to the host; getter arguments can read changing reactive properties. */
7
12
  constructor(host, hotkey, options = {}) {
8
13
  this.host = host;
9
14
  this.hotkey = hotkey;
10
15
  this.options = options;
11
- this.visible = false;
12
16
  host.addController(this);
13
17
  }
14
18
  /** Current visibility; combine with the action’s enabled state when rendering. */
@@ -43,5 +47,4 @@ var HotkeyHintController = class {
43
47
  };
44
48
 
45
49
  //#endregion
46
- export { HotkeyHintController };
47
- //# sourceMappingURL=hotkey-hint.js.map
50
+ export { HotkeyHintController };
@@ -1,6 +1,5 @@
1
1
  import { Hotkey, HotkeyRecorderOptions } from "@tanstack/hotkeys";
2
2
  import { ReactiveController, ReactiveControllerHost } from "lit";
3
-
4
3
  //#region src/controllers/hotkey-recorder.d.ts
5
4
  /**
6
5
  * A Lit ReactiveController that records keyboard shortcuts.
@@ -37,7 +36,7 @@ import { ReactiveController, ReactiveControllerHost } from "lit";
37
36
  * }
38
37
  * ```
39
38
  */
40
- declare class HotkeyRecorderController implements ReactiveController {
39
+ export declare class HotkeyRecorderController implements ReactiveController {
41
40
  private _host;
42
41
  private _options;
43
42
  /** The recorder instance. */
@@ -70,6 +69,4 @@ declare class HotkeyRecorderController implements ReactiveController {
70
69
  /** Cancel recording without saving. */
71
70
  cancelRecording(): void;
72
71
  }
73
- //#endregion
74
- export { HotkeyRecorderController };
75
- //# sourceMappingURL=hotkey-recorder.d.ts.map
72
+ //#endregion
@@ -37,6 +37,16 @@ import { HotkeyRecorder } from "@tanstack/hotkeys";
37
37
  * ```
38
38
  */
39
39
  var HotkeyRecorderController = class {
40
+ _host;
41
+ _options;
42
+ /** The recorder instance. */
43
+ _recorder;
44
+ /** The unsubscribe function to unsubscribe from the recorder store. */
45
+ _unsubscribe;
46
+ /** Whether recording is currently active. */
47
+ _isRecording = false;
48
+ /** The currently recorded hotkey (for live preview). */
49
+ _recordedHotkey = null;
40
50
  /** Whether recording is currently active. */
41
51
  get isRecording() {
42
52
  return this._isRecording;
@@ -52,8 +62,6 @@ var HotkeyRecorderController = class {
52
62
  constructor(_host, _options) {
53
63
  this._host = _host;
54
64
  this._options = _options;
55
- this._isRecording = false;
56
- this._recordedHotkey = null;
57
65
  this._recorder = new HotkeyRecorder(_options);
58
66
  this._host.addController(this);
59
67
  }
@@ -100,5 +108,4 @@ var HotkeyRecorderController = class {
100
108
  };
101
109
 
102
110
  //#endregion
103
- export { HotkeyRecorderController };
104
- //# sourceMappingURL=hotkey-recorder.js.map
111
+ export { HotkeyRecorderController };
@@ -1,6 +1,5 @@
1
1
  import { HotkeyRegistrationView, SequenceRegistrationView } from "@tanstack/hotkeys";
2
2
  import { ReactiveController, ReactiveControllerHost } from "lit";
3
-
4
3
  //#region src/controllers/hotkey-registrations.d.ts
5
4
  /**
6
5
  * A Lit ReactiveController that tracks all hotkey and sequence registrations.
@@ -25,7 +24,7 @@ import { ReactiveController, ReactiveControllerHost } from "lit";
25
24
  * }
26
25
  * ```
27
26
  */
28
- declare class HotkeyRegistrationsController implements ReactiveController {
27
+ export declare class HotkeyRegistrationsController implements ReactiveController {
29
28
  private _host;
30
29
  private _unsubscribeHotkeys;
31
30
  private _unsubscribeSequences;
@@ -39,6 +38,4 @@ declare class HotkeyRegistrationsController implements ReactiveController {
39
38
  hostConnected(): void;
40
39
  hostDisconnected(): void;
41
40
  }
42
- //#endregion
43
- export { HotkeyRegistrationsController };
44
- //# sourceMappingURL=hotkey-registrations.d.ts.map
41
+ //#endregion
@@ -25,6 +25,11 @@ import { getHotkeyManager, getSequenceManager, toHotkeyRegistrationView } from "
25
25
  * ```
26
26
  */
27
27
  var HotkeyRegistrationsController = class {
28
+ _host;
29
+ _unsubscribeHotkeys;
30
+ _unsubscribeSequences;
31
+ _hotkeys = [];
32
+ _sequences = [];
28
33
  /** All registered hotkeys (public view, no callbacks). */
29
34
  get hotkeys() {
30
35
  return this._hotkeys;
@@ -35,8 +40,6 @@ var HotkeyRegistrationsController = class {
35
40
  }
36
41
  constructor(_host) {
37
42
  this._host = _host;
38
- this._hotkeys = [];
39
- this._sequences = [];
40
43
  this._host.addController(this);
41
44
  }
42
45
  hostConnected() {
@@ -66,5 +69,4 @@ var HotkeyRegistrationsController = class {
66
69
  };
67
70
 
68
71
  //#endregion
69
- export { HotkeyRegistrationsController };
70
- //# sourceMappingURL=hotkey-registrations.js.map
72
+ export { HotkeyRegistrationsController };
@@ -1,6 +1,5 @@
1
1
  import { HotkeySequence, HotkeySequenceRecorderOptions } from "@tanstack/hotkeys";
2
2
  import { ReactiveController, ReactiveControllerHost } from "lit";
3
-
4
3
  //#region src/controllers/hotkey-sequence-recorder.d.ts
5
4
  /**
6
5
  * A Lit ReactiveController that records multi-chord sequences (Vim-style shortcuts).
@@ -39,7 +38,7 @@ import { ReactiveController, ReactiveControllerHost } from "lit";
39
38
  * }
40
39
  * ```
41
40
  */
42
- declare class HotkeySequenceRecorderController implements ReactiveController {
41
+ export declare class HotkeySequenceRecorderController implements ReactiveController {
43
42
  private _host;
44
43
  private _options;
45
44
  /** The recorder instance. */
@@ -78,6 +77,4 @@ declare class HotkeySequenceRecorderController implements ReactiveController {
78
77
  /** Commit current steps as a sequence (no-op if empty). */
79
78
  commitRecording(): void;
80
79
  }
81
- //#endregion
82
- export { HotkeySequenceRecorderController };
83
- //# sourceMappingURL=hotkey-sequence-recorder.d.ts.map
80
+ //#endregion
@@ -39,6 +39,18 @@ import { HotkeySequenceRecorder } from "@tanstack/hotkeys";
39
39
  * ```
40
40
  */
41
41
  var HotkeySequenceRecorderController = class {
42
+ _host;
43
+ _options;
44
+ /** The recorder instance. */
45
+ _recorder;
46
+ /** The unsubscribe function. */
47
+ _unsubscribe;
48
+ /** Whether recording is currently active. */
49
+ _isRecording = false;
50
+ /** Chords captured in the current session. */
51
+ _steps = [];
52
+ /** Last committed sequence, or null if none. */
53
+ _recordedSequence = null;
42
54
  /** Whether recording is currently active. */
43
55
  get isRecording() {
44
56
  return this._isRecording;
@@ -58,9 +70,6 @@ var HotkeySequenceRecorderController = class {
58
70
  constructor(_host, _options) {
59
71
  this._host = _host;
60
72
  this._options = _options;
61
- this._isRecording = false;
62
- this._steps = [];
63
- this._recordedSequence = null;
64
73
  this._recorder = new HotkeySequenceRecorder(_options);
65
74
  this._host.addController(this);
66
75
  }
@@ -113,5 +122,4 @@ var HotkeySequenceRecorderController = class {
113
122
  };
114
123
 
115
124
  //#endregion
116
- export { HotkeySequenceRecorderController };
117
- //# sourceMappingURL=hotkey-sequence-recorder.js.map
125
+ export { HotkeySequenceRecorderController };
@@ -1,6 +1,5 @@
1
1
  import { HotkeyCallback, HotkeySequence, SequenceOptions } from "@tanstack/hotkeys";
2
2
  import { ReactiveController, ReactiveControllerHost } from "lit";
3
-
4
3
  //#region src/controllers/hotkey-sequence.d.ts
5
4
  /**
6
5
  * A Lit ReactiveController that registers a keyboard sequence (e.g. Vim-style)
@@ -18,7 +17,7 @@ import { ReactiveController, ReactiveControllerHost } from "lit";
18
17
  * }
19
18
  * ```
20
19
  */
21
- declare class HotkeySequenceController implements ReactiveController {
20
+ export declare class HotkeySequenceController implements ReactiveController {
22
21
  private _host;
23
22
  private _sequence;
24
23
  private _callback;
@@ -40,6 +39,4 @@ declare class HotkeySequenceController implements ReactiveController {
40
39
  /** Unregisters the sequence when the host is disconnected from the DOM. */
41
40
  hostDisconnected(): void;
42
41
  }
43
- //#endregion
44
- export { HotkeySequenceController };
45
- //# sourceMappingURL=hotkey-sequence.d.ts.map
42
+ //#endregion
@@ -19,6 +19,12 @@ import { getSequenceManager } from "@tanstack/hotkeys";
19
19
  * ```
20
20
  */
21
21
  var HotkeySequenceController = class {
22
+ _host;
23
+ _sequence;
24
+ _callback;
25
+ _options;
26
+ /** The sequence registration handle. */
27
+ _registration;
22
28
  /**
23
29
  * @param _host - The Lit component that owns this controller (use `this` and pass it to `addController()`).
24
30
  * @param _sequence - The key sequence to listen for (e.g. `['G', 'G']`).
@@ -54,5 +60,4 @@ var HotkeySequenceController = class {
54
60
  };
55
61
 
56
62
  //#endregion
57
- export { HotkeySequenceController };
58
- //# sourceMappingURL=hotkey-sequence.js.map
63
+ export { HotkeySequenceController };
@@ -1,6 +1,5 @@
1
1
  import { HotkeyCallback, HotkeyOptions, RegisterableHotkey } from "@tanstack/hotkeys";
2
2
  import { ReactiveController, ReactiveControllerHost } from "lit";
3
-
4
3
  //#region src/controllers/hotkey.d.ts
5
4
  /**
6
5
  * A Lit ReactiveController that registers a keyboard hotkey when the host
@@ -18,7 +17,7 @@ import { ReactiveController, ReactiveControllerHost } from "lit";
18
17
  * }
19
18
  * ```
20
19
  */
21
- declare class HotkeyController implements ReactiveController {
20
+ export declare class HotkeyController implements ReactiveController {
22
21
  private _host;
23
22
  private _hotkey;
24
23
  private _callback;
@@ -40,6 +39,4 @@ declare class HotkeyController implements ReactiveController {
40
39
  /** Unregisters the hotkey when the host is disconnected from the DOM. */
41
40
  hostDisconnected(): void;
42
41
  }
43
- //#endregion
44
- export { HotkeyController };
45
- //# sourceMappingURL=hotkey.d.ts.map
42
+ //#endregion
@@ -19,6 +19,12 @@ import { detectPlatform, formatHotkey, getHotkeyManager, rawHotkeyToParsedHotkey
19
19
  * ```
20
20
  */
21
21
  var HotkeyController = class {
22
+ _host;
23
+ _hotkey;
24
+ _callback;
25
+ _options;
26
+ /** The hotkey registration handle. */
27
+ _registration;
22
28
  /**
23
29
  * @param _host - The Lit component that owns this controller (use `this` and pass it to `addController()`).
24
30
  * @param _hotkey - The key or key combo to listen for (e.g. `'Mod+S'` or a raw hotkey object).
@@ -56,5 +62,4 @@ var HotkeyController = class {
56
62
  };
57
63
 
58
64
  //#endregion
59
- export { HotkeyController };
60
- //# sourceMappingURL=hotkey.js.map
65
+ export { HotkeyController };
@@ -6,4 +6,5 @@ import { HotkeyRegistrationsController } from "./hotkey-registrations.js";
6
6
  import { HotkeySequenceController } from "./hotkey-sequence.js";
7
7
  import { HotkeySequenceRecorderController } from "./hotkey-sequence-recorder.js";
8
8
  import { KeyHoldController } from "./key-hold.js";
9
- import { HotkeyHintController } from "./hotkey-hint.js";
9
+ import { HotkeyHintController } from "./hotkey-hint.js";
10
+ export { HeldKeyCodesController, HeldKeysController, HotkeyController, HotkeyHintController, HotkeyRecorderController, HotkeyRegistrationsController, HotkeySequenceController, HotkeySequenceRecorderController, KeyHoldController };
@@ -1,6 +1,5 @@
1
1
  import { IndividualKey } from "@tanstack/hotkeys";
2
2
  import { ReactiveController, ReactiveControllerHost } from "lit";
3
-
4
3
  //#region src/controllers/key-hold.d.ts
5
4
  /**
6
5
  * A Lit ReactiveController that tracks whether a specific key is currently held.
@@ -40,7 +39,7 @@ import { ReactiveController, ReactiveControllerHost } from "lit";
40
39
  * }
41
40
  * ```
42
41
  */
43
- declare class KeyHoldController implements ReactiveController {
42
+ export declare class KeyHoldController implements ReactiveController {
44
43
  private _host;
45
44
  private _key;
46
45
  /** The unsubscribe function to unsubscribe from the tracker store. */
@@ -57,6 +56,4 @@ declare class KeyHoldController implements ReactiveController {
57
56
  hostConnected(): void;
58
57
  hostDisconnected(): void;
59
58
  }
60
- //#endregion
61
- export { KeyHoldController };
62
- //# sourceMappingURL=key-hold.d.ts.map
59
+ //#endregion
@@ -40,6 +40,12 @@ import { getKeyStateTracker } from "@tanstack/hotkeys";
40
40
  * ```
41
41
  */
42
42
  var KeyHoldController = class {
43
+ _host;
44
+ _key;
45
+ /** The unsubscribe function to unsubscribe from the tracker store. */
46
+ _unsubscribe;
47
+ /** Whether the tracked key is currently held down. */
48
+ _value = false;
43
49
  /** Whether the tracked key is currently held down. */
44
50
  get value() {
45
51
  return this._value;
@@ -51,7 +57,6 @@ var KeyHoldController = class {
51
57
  constructor(_host, _key) {
52
58
  this._host = _host;
53
59
  this._key = _key;
54
- this._value = false;
55
60
  this._host.addController(this);
56
61
  }
57
62
  hostConnected() {
@@ -74,5 +79,4 @@ var KeyHoldController = class {
74
79
  };
75
80
 
76
81
  //#endregion
77
- export { KeyHoldController };
78
- //# sourceMappingURL=key-hold.js.map
82
+ export { KeyHoldController };
@@ -1,6 +1,5 @@
1
1
  import { HotkeyCallback, HotkeySequence, SequenceOptions } from "@tanstack/hotkeys";
2
2
  import { LitElement } from "lit";
3
-
4
3
  //#region src/decorators/hotkey-sequence.d.ts
5
4
  /**
6
5
  * Decorator that registers a keyboard sequence (e.g. Vim-style) on the element
@@ -22,7 +21,5 @@ import { LitElement } from "lit";
22
21
  * }
23
22
  * ```
24
23
  */
25
- declare function hotkeySequence(sequence: HotkeySequence, options?: SequenceOptions): <T extends HotkeyCallback>(proto: LitElement, methodName: string, descriptor: TypedPropertyDescriptor<T>) => void;
26
- //#endregion
27
- export { hotkeySequence };
28
- //# sourceMappingURL=hotkey-sequence.d.ts.map
24
+ export declare function hotkeySequence(sequence: HotkeySequence, options?: SequenceOptions): <T extends HotkeyCallback>(proto: LitElement, methodName: string, descriptor: TypedPropertyDescriptor<T>) => void;
25
+ //#endregion
@@ -41,5 +41,4 @@ function hotkeySequence(sequence, options = HOTKEY_SEQUENCE_DEFAULT_OPTIONS) {
41
41
  }
42
42
 
43
43
  //#endregion
44
- export { hotkeySequence };
45
- //# sourceMappingURL=hotkey-sequence.js.map
44
+ export { hotkeySequence };
@@ -1,6 +1,5 @@
1
1
  import { HotkeyCallback, HotkeyOptions, RegisterableHotkey } from "@tanstack/hotkeys";
2
2
  import { LitElement } from "lit";
3
-
4
3
  //#region src/decorators/hotkey.d.ts
5
4
  /**
6
5
  * Decorator that registers a keyboard hotkey on the element when it connects
@@ -21,7 +20,5 @@ import { LitElement } from "lit";
21
20
  * }
22
21
  * ```
23
22
  */
24
- declare function hotkey(hotkey: RegisterableHotkey, options?: HotkeyOptions): <T extends HotkeyCallback>(proto: LitElement, propertyKey: string, descriptor?: TypedPropertyDescriptor<T>) => void;
25
- //#endregion
26
- export { hotkey };
27
- //# sourceMappingURL=hotkey.d.ts.map
23
+ export declare function hotkey(hotkey: RegisterableHotkey, options?: HotkeyOptions): <T extends HotkeyCallback>(proto: LitElement, propertyKey: string, descriptor?: TypedPropertyDescriptor<T>) => void;
24
+ //#endregion
@@ -40,5 +40,4 @@ function hotkey(hotkey, options = HOTKEY_DEFAULT_OPTIONS) {
40
40
  }
41
41
 
42
42
  //#endregion
43
- export { hotkey };
44
- //# sourceMappingURL=hotkey.js.map
43
+ export { hotkey };
@@ -1,2 +1,3 @@
1
1
  import { hotkeySequence } from "./hotkey-sequence.js";
2
- import { hotkey } from "./hotkey.js";
2
+ import { hotkey } from "./hotkey.js";
3
+ export { hotkey, hotkeySequence };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { hotkeySequence } from "./decorators/hotkey-sequence.js";
2
2
  import { hotkey } from "./decorators/hotkey.js";
3
+ import "./decorators/index.js";
3
4
  import { HeldKeyCodesController } from "./controllers/held-key-codes.js";
4
5
  import { HeldKeysController } from "./controllers/held-keys.js";
5
6
  import { HotkeyController } from "./controllers/hotkey.js";
@@ -9,5 +10,6 @@ import { HotkeySequenceController } from "./controllers/hotkey-sequence.js";
9
10
  import { HotkeySequenceRecorderController } from "./controllers/hotkey-sequence-recorder.js";
10
11
  import { KeyHoldController } from "./controllers/key-hold.js";
11
12
  import { HotkeyHintController } from "./controllers/hotkey-hint.js";
13
+ import "./controllers/index.js";
12
14
  export * from "@tanstack/hotkeys";
13
15
  export { HeldKeyCodesController, HeldKeysController, HotkeyController, HotkeyHintController, HotkeyRecorderController, HotkeyRegistrationsController, HotkeySequenceController, HotkeySequenceRecorderController, KeyHoldController, hotkey, hotkeySequence };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/lit-hotkeys",
3
- "version": "0.12.0",
3
+ "version": "0.13.1",
4
4
  "description": "Lit adapter for TanStack Hotkeys",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -20,29 +20,23 @@
20
20
  "keys"
21
21
  ],
22
22
  "type": "module",
23
- "main": "./dist/index.cjs",
24
- "module": "./dist/index.js",
25
- "types": "./dist/index.d.cts",
23
+ "types": "./dist/index.d.ts",
26
24
  "exports": {
27
- ".": {
28
- "import": "./dist/index.js",
29
- "require": "./dist/index.cjs"
30
- },
25
+ ".": "./dist/index.js",
31
26
  "./package.json": "./package.json"
32
27
  },
33
28
  "sideEffects": false,
34
29
  "engines": {
35
- "node": ">=18"
30
+ "node": ">=20"
36
31
  },
37
32
  "files": [
38
- "dist",
39
- "src"
33
+ "dist"
40
34
  ],
41
35
  "dependencies": {
42
- "@tanstack/hotkeys": "0.9.0"
36
+ "@tanstack/hotkeys": "0.10.1"
43
37
  },
44
38
  "devDependencies": {
45
- "lit": "^3.3.2"
39
+ "lit": "^3.3.3"
46
40
  },
47
41
  "peerDependencies": {
48
42
  "lit": ">=3.0.0"
@@ -55,6 +49,7 @@
55
49
  "test:lib": "vitest --passWithNoTests",
56
50
  "test:lib:dev": "pnpm test:lib --watch",
57
51
  "test:types": "tsc",
58
- "build": "tsdown"
52
+ "build": "tsdown",
53
+ "test:build": "publint --strict && node ../../scripts/verify-package.ts"
59
54
  }
60
55
  }
@@ -1,27 +0,0 @@
1
-
2
- //#region src/constants.ts
3
- const HOTKEY_DEFAULT_OPTIONS = {
4
- enabled: true,
5
- preventDefault: true,
6
- stopPropagation: true,
7
- eventType: "keydown",
8
- requireReset: false,
9
- ignoreInputs: void 0,
10
- platform: void 0,
11
- conflictBehavior: "warn"
12
- };
13
- const HOTKEY_SEQUENCE_DEFAULT_OPTIONS = {
14
- enabled: true,
15
- timeout: 1e3,
16
- preventDefault: true,
17
- stopPropagation: true,
18
- eventType: "keydown",
19
- ignoreInputs: void 0,
20
- platform: void 0,
21
- conflictBehavior: "warn"
22
- };
23
-
24
- //#endregion
25
- exports.HOTKEY_DEFAULT_OPTIONS = HOTKEY_DEFAULT_OPTIONS;
26
- exports.HOTKEY_SEQUENCE_DEFAULT_OPTIONS = HOTKEY_SEQUENCE_DEFAULT_OPTIONS;
27
- //# sourceMappingURL=constants.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.cjs","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import type { HotkeyOptions, SequenceOptions } from '@tanstack/hotkeys'\n\nexport const HOTKEY_DEFAULT_OPTIONS: HotkeyOptions = {\n enabled: true,\n preventDefault: true,\n stopPropagation: true,\n eventType: 'keydown',\n requireReset: false,\n ignoreInputs: undefined, // smart default: false for Mod+S, true for single keys\n platform: undefined, // auto-detected\n conflictBehavior: 'warn',\n}\n\nexport const HOTKEY_SEQUENCE_DEFAULT_OPTIONS: SequenceOptions = {\n enabled: true,\n timeout: 1000,\n preventDefault: true,\n stopPropagation: true,\n eventType: 'keydown',\n ignoreInputs: undefined, // smart default: false for Mod+S, true for single keys\n platform: undefined, // auto-detected\n conflictBehavior: 'warn',\n}\n"],"mappings":";;AAEA,MAAa,yBAAwC;CACnD,SAAS;CACT,gBAAgB;CAChB,iBAAiB;CACjB,WAAW;CACX,cAAc;CACd,cAAc;CACd,UAAU;CACV,kBAAkB;CACnB;AAED,MAAa,kCAAmD;CAC9D,SAAS;CACT,SAAS;CACT,gBAAgB;CAChB,iBAAiB;CACjB,WAAW;CACX,cAAc;CACd,UAAU;CACV,kBAAkB;CACnB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["import type { HotkeyOptions, SequenceOptions } from '@tanstack/hotkeys'\n\nexport const HOTKEY_DEFAULT_OPTIONS: HotkeyOptions = {\n enabled: true,\n preventDefault: true,\n stopPropagation: true,\n eventType: 'keydown',\n requireReset: false,\n ignoreInputs: undefined, // smart default: false for Mod+S, true for single keys\n platform: undefined, // auto-detected\n conflictBehavior: 'warn',\n}\n\nexport const HOTKEY_SEQUENCE_DEFAULT_OPTIONS: SequenceOptions = {\n enabled: true,\n timeout: 1000,\n preventDefault: true,\n stopPropagation: true,\n eventType: 'keydown',\n ignoreInputs: undefined, // smart default: false for Mod+S, true for single keys\n platform: undefined, // auto-detected\n conflictBehavior: 'warn',\n}\n"],"mappings":";AAEA,MAAa,yBAAwC;CACnD,SAAS;CACT,gBAAgB;CAChB,iBAAiB;CACjB,WAAW;CACX,cAAc;CACd,cAAc;CACd,UAAU;CACV,kBAAkB;CACnB;AAED,MAAa,kCAAmD;CAC9D,SAAS;CACT,SAAS;CACT,gBAAgB;CAChB,iBAAiB;CACjB,WAAW;CACX,cAAc;CACd,UAAU;CACV,kBAAkB;CACnB"}