@tanstack/angular-hotkeys 0.21.0 → 0.21.2
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/_injectSelector.js +1 -2
- package/dist/_zone.js +1 -2
- package/dist/hotkeys-provider.d.ts +3 -5
- package/dist/hotkeys-provider.js +1 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/injectAppHotkeys.d.ts +1 -3
- package/dist/injectAppHotkeys.js +2 -3
- package/dist/injectFormatForDisplay.d.ts +1 -3
- package/dist/injectFormatForDisplay.js +1 -2
- package/dist/injectHeldKeyCodes.d.ts +1 -3
- package/dist/injectHeldKeyCodes.js +1 -2
- package/dist/injectHeldKeys.d.ts +1 -3
- package/dist/injectHeldKeys.js +1 -2
- package/dist/injectHotkey.d.ts +1 -2
- package/dist/injectHotkey.js +1 -2
- package/dist/injectHotkeyHint.d.ts +1 -3
- package/dist/injectHotkeyHint.js +2 -3
- package/dist/injectHotkeyRecorder.d.ts +1 -3
- package/dist/injectHotkeyRecorder.js +1 -2
- package/dist/injectHotkeyRegistrations.d.ts +1 -3
- package/dist/injectHotkeyRegistrations.js +1 -2
- package/dist/injectHotkeyScopesState.d.ts +1 -3
- package/dist/injectHotkeyScopesState.js +1 -2
- package/dist/injectHotkeys.d.ts +1 -3
- package/dist/injectHotkeys.js +1 -2
- package/dist/injectKeyHold.d.ts +1 -3
- package/dist/injectKeyHold.js +1 -2
- package/package.json +8 -8
- package/skills/angular-hotkeys/references/app-hotkeys.md +1 -1
package/dist/_injectSelector.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DestroyRef, inject, linkedSignal } from "@angular/core";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/_injectSelector.ts
|
|
4
4
|
/**
|
|
5
5
|
* Subscribes to a store until the injection context is destroyed and returns
|
|
6
6
|
* a signal of the selected value, which updates when it changes (by `===`).
|
|
@@ -16,5 +16,4 @@ function injectSelector(store, selector) {
|
|
|
16
16
|
return selected.asReadonly();
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
//#endregion
|
|
20
19
|
export { injectSelector };
|
package/dist/_zone.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NgZone, inject } from "@angular/core";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/_zone.ts
|
|
4
4
|
/**
|
|
5
5
|
* Runs `fn` outside the Angular zone, so core listeners it attaches don't
|
|
6
6
|
* run change detection on every event. Zoneless apps call `fn` directly.
|
|
@@ -10,5 +10,4 @@ function runOutsideZone(fn) {
|
|
|
10
10
|
return inject(NgZone).runOutsideAngular(fn);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
//#endregion
|
|
14
13
|
export { runOutsideZone };
|
|
@@ -2,7 +2,6 @@ import { InjectHotkeyCommonOptions } from "./injectHotkey.js";
|
|
|
2
2
|
import { AppHotkeys, AppHotkeysState, AppHotkeysStore, CustomHotkeys, HotkeyChordRecorderOptions, HotkeyPlatform, HotkeySequenceRecorderOptions } from "@tanstack/hotkeys";
|
|
3
3
|
import { InjectionToken, Provider, Signal } from "@angular/core";
|
|
4
4
|
import { HotkeysProviderScopeProps } from "@tanstack/hotkeys/adapter";
|
|
5
|
-
//#region src/hotkeys-provider.d.ts
|
|
6
5
|
export interface HotkeysProviderOptions {
|
|
7
6
|
/**
|
|
8
7
|
* The user's platform, for labels from `injectFormatForDisplay`, hotkeys,
|
|
@@ -45,8 +44,8 @@ export interface ProvideHotkeysOptions {
|
|
|
45
44
|
/**
|
|
46
45
|
* The user's saved custom hotkeys. When the value changes, such as after
|
|
47
46
|
* saved data loads or the user signs in, it replaces the current custom
|
|
48
|
-
* hotkeys. `undefined` leaves them unchanged; `null` clears them.
|
|
49
|
-
* entries are ignored
|
|
47
|
+
* hotkeys. `undefined` leaves them unchanged; `null` clears them. Unknown
|
|
48
|
+
* ids and invalid entries are ignored.
|
|
50
49
|
*/
|
|
51
50
|
customHotkeys?: MaybeGetter<CustomHotkeys | null | undefined>;
|
|
52
51
|
/** Called with the custom hotkeys after every change, ready to save. */
|
|
@@ -144,5 +143,4 @@ export declare function provideHotkeys(options?: ProvideHotkeysOptions): Provide
|
|
|
144
143
|
* provider's scope.
|
|
145
144
|
*/
|
|
146
145
|
export declare function injectHotkeysContext(): HotkeysContextValue;
|
|
147
|
-
export declare function injectDefaultHotkeysOptions(): HotkeysProviderOptions;
|
|
148
|
-
//#endregion
|
|
146
|
+
export declare function injectDefaultHotkeysOptions(): HotkeysProviderOptions;
|
package/dist/hotkeys-provider.js
CHANGED
|
@@ -2,7 +2,7 @@ import { publishAppHotkeysStore } from "@tanstack/hotkeys";
|
|
|
2
2
|
import { DestroyRef, InjectionToken, Injector, computed, effect, inject, runInInjectionContext, signal, untracked } from "@angular/core";
|
|
3
3
|
import { activateHotkeysProviderScope, createAppHotkeysStore, getHotkeysProviderScopeKey, mergeHotkeysProviderDefaults } from "@tanstack/hotkeys/adapter";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/hotkeys-provider.ts
|
|
6
6
|
const NO_APP_HOTKEYS = signal(null).asReadonly();
|
|
7
7
|
const ROOT_CONTEXT = {
|
|
8
8
|
defaultOptions: {},
|
|
@@ -154,5 +154,4 @@ function injectDefaultHotkeysOptions() {
|
|
|
154
154
|
return injectHotkeysContext().defaultOptions;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
//#endregion
|
|
158
157
|
export { HOTKEYS_INJECTION_TOKEN, injectDefaultHotkeysOptions, injectHotkeysContext, provideHotkeys };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InjectAppHotkeyOptions, InjectHotkeyChordOptions, InjectHotkeyCommonOptions, InjectHotkeyOptions, InjectHotkeyOptionsFor, InjectHotkeySequenceOptions, InjectHotkeyTarget, injectHotkey } from "./injectHotkey.js";
|
|
2
1
|
import { HOTKEYS_INJECTION_TOKEN, HotkeysContextValue, HotkeysProviderOptions, MaybeGetter, ProvideHotkeysOptions, injectDefaultHotkeysOptions, injectHotkeysContext, provideHotkeys } from "./hotkeys-provider.js";
|
|
2
|
+
import { InjectAppHotkeyOptions, InjectHotkeyChordOptions, InjectHotkeyCommonOptions, InjectHotkeyOptions, InjectHotkeyOptionsFor, InjectHotkeySequenceOptions, InjectHotkeyTarget, injectHotkey } from "./injectHotkey.js";
|
|
3
3
|
import { InjectHotkeyDefinition, injectHotkeys } from "./injectHotkeys.js";
|
|
4
4
|
import { injectHeldKeys } from "./injectHeldKeys.js";
|
|
5
5
|
import { injectHeldKeyCodes } from "./injectHeldKeyCodes.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HOTKEYS_INJECTION_TOKEN, injectDefaultHotkeysOptions, injectHotkeysContext, provideHotkeys } from "./hotkeys-provider.js";
|
|
2
|
-
import { injectHotkeys } from "./injectHotkeys.js";
|
|
3
2
|
import { injectHotkey } from "./injectHotkey.js";
|
|
3
|
+
import { injectHotkeys } from "./injectHotkeys.js";
|
|
4
4
|
import { injectHeldKeys } from "./injectHeldKeys.js";
|
|
5
5
|
import { injectHeldKeyCodes } from "./injectHeldKeyCodes.js";
|
|
6
6
|
import { injectKeyHold } from "./injectKeyHold.js";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AppHotkey, AppHotkeyListItem, CustomHotkeys, Hotkey, RegisteredAppHotkeys } from "@tanstack/hotkeys";
|
|
2
2
|
import { Signal } from "@angular/core";
|
|
3
|
-
//#region src/injectAppHotkeys.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Returns a signal of the effective app hotkeys from `provideHotkeys`, typed
|
|
6
5
|
* by `Register`: each declaration with the user's custom hotkey applied.
|
|
@@ -41,5 +40,4 @@ export interface InjectCustomHotkeysResult {
|
|
|
41
40
|
* registered app hotkey immediately and are passed to `onCustomHotkeysChange`
|
|
42
41
|
* from `provideHotkeys`, ready to save.
|
|
43
42
|
*/
|
|
44
|
-
export declare function injectCustomHotkeys(): InjectCustomHotkeysResult;
|
|
45
|
-
//#endregion
|
|
43
|
+
export declare function injectCustomHotkeys(): InjectCustomHotkeysResult;
|
package/dist/injectAppHotkeys.js
CHANGED
|
@@ -2,10 +2,10 @@ import { injectHotkeysContext } from "./hotkeys-provider.js";
|
|
|
2
2
|
import { injectHotkeyRegistrations } from "./injectHotkeyRegistrations.js";
|
|
3
3
|
import { computed } from "@angular/core";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/injectAppHotkeys.ts
|
|
6
6
|
function injectRequiredStore(name) {
|
|
7
7
|
const context = injectHotkeysContext();
|
|
8
|
-
if (!context.appHotkeysStore) throw new Error(
|
|
8
|
+
if (!context.appHotkeysStore) throw new Error(`[hotkeys] ${name} requires provideHotkeys with appHotkeys`);
|
|
9
9
|
return {
|
|
10
10
|
store: context.appHotkeysStore,
|
|
11
11
|
state: context.appHotkeysState
|
|
@@ -62,5 +62,4 @@ function injectCustomHotkeys() {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
//#endregion
|
|
66
65
|
export { injectAppHotkeyList, injectAppHotkeys, injectCustomHotkeys };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { formatForDisplay } from "@tanstack/hotkeys";
|
|
2
|
-
//#region src/injectFormatForDisplay.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Returns `formatForDisplay` with the provider's `platform` as the default,
|
|
5
4
|
* so labels match the user's platform. Call it in an injection context, such
|
|
@@ -21,5 +20,4 @@ import { formatForDisplay } from "@tanstack/hotkeys";
|
|
|
21
20
|
* }
|
|
22
21
|
* ```
|
|
23
22
|
*/
|
|
24
|
-
export declare function injectFormatForDisplay(): typeof formatForDisplay;
|
|
25
|
-
//#endregion
|
|
23
|
+
export declare function injectFormatForDisplay(): typeof formatForDisplay;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { injectHotkeysContext } from "./hotkeys-provider.js";
|
|
2
2
|
import { formatForDisplay } from "@tanstack/hotkeys";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/injectFormatForDisplay.ts
|
|
5
5
|
/**
|
|
6
6
|
* Returns `formatForDisplay` with the provider's `platform` as the default,
|
|
7
7
|
* so labels match the user's platform. Call it in an injection context, such
|
|
@@ -31,5 +31,4 @@ function injectFormatForDisplay() {
|
|
|
31
31
|
}));
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
//#endregion
|
|
35
34
|
export { injectFormatForDisplay };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Signal } from "@angular/core";
|
|
2
|
-
//#region src/injectHeldKeyCodes.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Angular inject-based API that returns a signal of a map from held key names to their physical `event.code` values.
|
|
5
4
|
*
|
|
@@ -23,5 +22,4 @@ import { Signal } from "@angular/core";
|
|
|
23
22
|
* }
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
|
-
export declare function injectHeldKeyCodes(): Signal<Record<string, string>>;
|
|
27
|
-
//#endregion
|
|
25
|
+
export declare function injectHeldKeyCodes(): Signal<Record<string, string>>;
|
|
@@ -2,7 +2,7 @@ import { injectSelector } from "./_injectSelector.js";
|
|
|
2
2
|
import { runOutsideZone } from "./_zone.js";
|
|
3
3
|
import { getKeyStateTracker } from "@tanstack/hotkeys";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/injectHeldKeyCodes.ts
|
|
6
6
|
/**
|
|
7
7
|
* Angular inject-based API that returns a signal of a map from held key names to their physical `event.code` values.
|
|
8
8
|
*
|
|
@@ -31,5 +31,4 @@ function injectHeldKeyCodes() {
|
|
|
31
31
|
return injectSelector(tracker.store, (state) => state.heldCodes);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
//#endregion
|
|
35
34
|
export { injectHeldKeyCodes };
|
package/dist/injectHeldKeys.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Signal } from "@angular/core";
|
|
2
|
-
//#region src/injectHeldKeys.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Angular inject-based API that returns a signal of currently held keyboard keys.
|
|
5
4
|
*
|
|
@@ -18,5 +17,4 @@ import { Signal } from "@angular/core";
|
|
|
18
17
|
* }
|
|
19
18
|
* ```
|
|
20
19
|
*/
|
|
21
|
-
export declare function injectHeldKeys(): Signal<Array<string>>;
|
|
22
|
-
//#endregion
|
|
20
|
+
export declare function injectHeldKeys(): Signal<Array<string>>;
|
package/dist/injectHeldKeys.js
CHANGED
|
@@ -2,7 +2,7 @@ import { injectSelector } from "./_injectSelector.js";
|
|
|
2
2
|
import { runOutsideZone } from "./_zone.js";
|
|
3
3
|
import { getKeyStateTracker } from "@tanstack/hotkeys";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/injectHeldKeys.ts
|
|
6
6
|
/**
|
|
7
7
|
* Angular inject-based API that returns a signal of currently held keyboard keys.
|
|
8
8
|
*
|
|
@@ -26,5 +26,4 @@ function injectHeldKeys() {
|
|
|
26
26
|
return injectSelector(tracker.store, (state) => state.heldKeys);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
//#endregion
|
|
30
29
|
export { injectHeldKeys };
|
package/dist/injectHotkey.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AppHotkey, HotkeyCallback, HotkeyCallbackContextFor, RegisterableHotkey, Target } from "@tanstack/hotkeys";
|
|
2
2
|
import { ElementRef, Signal } from "@angular/core";
|
|
3
3
|
import { AdapterAppHotkeyOptions, AdapterChordOptions, AdapterCommonOptions, AdapterHotkeyOptions, AdapterOptionsFor, AdapterSequenceOptions } from "@tanstack/hotkeys/adapter";
|
|
4
|
-
//#region src/injectHotkey.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* The element to listen on: an element, an `ElementRef`, or a signal of
|
|
7
6
|
* either, such as `viewChild<ElementRef>('panel')`. A `null` target, or a
|
|
@@ -47,4 +46,4 @@ type MaybeGetter<T> = T | (() => T);
|
|
|
47
46
|
*/
|
|
48
47
|
export declare function injectHotkey<T extends AppHotkey>(hotkey: MaybeGetter<T | null | undefined>, callback: HotkeyCallback, options?: MaybeGetter<InjectAppHotkeyOptions<T>>): void;
|
|
49
48
|
export declare function injectHotkey<const T extends RegisterableHotkey>(hotkey: MaybeGetter<T | null | undefined>, callback: HotkeyCallback<HotkeyCallbackContextFor<T>>, options?: MaybeGetter<InjectHotkeyOptionsFor<T>>): void;
|
|
50
|
-
|
|
49
|
+
export {};
|
package/dist/injectHotkey.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { injectHotkeys } from "./injectHotkeys.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/injectHotkey.ts
|
|
4
4
|
function injectHotkey(hotkey, callback, options = {}) {
|
|
5
5
|
injectHotkeys(() => [{
|
|
6
6
|
hotkey: typeof hotkey === "function" ? hotkey() : hotkey,
|
|
@@ -9,5 +9,4 @@ function injectHotkey(hotkey, callback, options = {}) {
|
|
|
9
9
|
}]);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
//#endregion
|
|
13
12
|
export { injectHotkey };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AppHotkey, HeldModifierOptions, RegisterableHotkey } from "@tanstack/hotkeys";
|
|
2
2
|
import { Signal } from "@angular/core";
|
|
3
|
-
//#region src/injectHotkeyHint.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Returns a signal indicating whether held modifiers reveal this shortcut.
|
|
6
5
|
* The hint shows only while the hotkey can fire: some registration of it is
|
|
@@ -10,5 +9,4 @@ import { Signal } from "@angular/core";
|
|
|
10
9
|
* unbound). No hotkey (`undefined`, `null`, or `''`) returns false. This
|
|
11
10
|
* helper does not register a shortcut. A hotkey on an element counts only while focus is inside it.
|
|
12
11
|
*/
|
|
13
|
-
export declare function injectHotkeyHint(hotkey: RegisterableHotkey | AppHotkey | null | undefined | (() => RegisterableHotkey | AppHotkey | null | undefined), options?: HeldModifierOptions | (() => HeldModifierOptions)): Signal<boolean>;
|
|
14
|
-
//#endregion
|
|
12
|
+
export declare function injectHotkeyHint(hotkey: RegisterableHotkey | AppHotkey | null | undefined | (() => RegisterableHotkey | AppHotkey | null | undefined), options?: HeldModifierOptions | (() => HeldModifierOptions)): Signal<boolean>;
|
package/dist/injectHotkeyHint.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { injectHotkeysContext } from "./hotkeys-provider.js";
|
|
2
1
|
import { injectSelector } from "./_injectSelector.js";
|
|
3
2
|
import { runOutsideZone } from "./_zone.js";
|
|
3
|
+
import { injectHotkeysContext } from "./hotkeys-provider.js";
|
|
4
4
|
import { getHotkeyManager, getKeyStateTracker, isAppHotkey, matchesHeldModifiers, resolveAppHotkey } from "@tanstack/hotkeys";
|
|
5
5
|
import { computed } from "@angular/core";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// src/injectHotkeyHint.ts
|
|
8
8
|
/**
|
|
9
9
|
* Returns a signal indicating whether held modifiers reveal this shortcut.
|
|
10
10
|
* The hint shows only while the hotkey can fire: some registration of it is
|
|
@@ -27,5 +27,4 @@ function injectHotkeyHint(hotkey, options = {}) {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
//#endregion
|
|
31
30
|
export { injectHotkeyHint };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Hotkey, HotkeyChord, HotkeyChordRecorderOptions, HotkeyRecorderOptions, HotkeySequence, HotkeySequenceRecorderOptions } from "@tanstack/hotkeys";
|
|
2
|
-
//#region src/injectHotkeyRecorder.d.ts
|
|
3
2
|
export interface AngularHotkeyRecorder<THotkey extends Hotkey = Hotkey> {
|
|
4
3
|
/** Whether recording is currently active */
|
|
5
4
|
readonly isRecording: () => boolean;
|
|
@@ -51,5 +50,4 @@ export declare function injectHotkeyRecorder(options: HotkeyChordRecorderOptions
|
|
|
51
50
|
export declare function injectHotkeyRecorder(options: HotkeySequenceRecorderOptions): AngularHotkeyRecorder;
|
|
52
51
|
export declare function injectHotkeyRecorder(options: () => HotkeySequenceRecorderOptions): AngularHotkeyRecorder;
|
|
53
52
|
export declare function injectHotkeyRecorder(options: () => HotkeyChordRecorderOptions): AngularHotkeyRecorder<HotkeyChord>;
|
|
54
|
-
export declare function injectHotkeyRecorder(options: () => HotkeyRecorderOptions): AngularHotkeyRecorder;
|
|
55
|
-
//#endregion
|
|
53
|
+
export declare function injectHotkeyRecorder(options: () => HotkeyRecorderOptions): AngularHotkeyRecorder;
|
|
@@ -3,7 +3,7 @@ import { HotkeyRecorder } from "@tanstack/hotkeys";
|
|
|
3
3
|
import { DestroyRef, NgZone, computed, effect, inject, linkedSignal, untracked } from "@angular/core";
|
|
4
4
|
import { withDefaults } from "@tanstack/hotkeys/adapter";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/injectHotkeyRecorder.ts
|
|
7
7
|
function injectHotkeyRecorder(options) {
|
|
8
8
|
const defaultOptions = injectDefaultHotkeysOptions();
|
|
9
9
|
const destroyRef = inject(DestroyRef);
|
|
@@ -55,5 +55,4 @@ function injectLazyStore(storeSignal, selector) {
|
|
|
55
55
|
return slice.asReadonly();
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
//#endregion
|
|
59
58
|
export { injectHotkeyRecorder };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { HotkeyRegistrationView } from "@tanstack/hotkeys";
|
|
2
2
|
import { Signal } from "@angular/core";
|
|
3
|
-
//#region src/injectHotkeyRegistrations.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Angular inject-based API that reactively reads every hotkey registration,
|
|
6
5
|
* chords and sequences, from the singleton HotkeyManager. Narrow each view
|
|
@@ -24,5 +23,4 @@ import { Signal } from "@angular/core";
|
|
|
24
23
|
* }
|
|
25
24
|
* ```
|
|
26
25
|
*/
|
|
27
|
-
export declare function injectHotkeyRegistrations(): Signal<Array<HotkeyRegistrationView>>;
|
|
28
|
-
//#endregion
|
|
26
|
+
export declare function injectHotkeyRegistrations(): Signal<Array<HotkeyRegistrationView>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { injectSelector } from "./_injectSelector.js";
|
|
2
2
|
import { getHotkeyManager, toHotkeyRegistrationView } from "@tanstack/hotkeys";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/injectHotkeyRegistrations.ts
|
|
5
5
|
/**
|
|
6
6
|
* Angular inject-based API that reactively reads every hotkey registration,
|
|
7
7
|
* chords and sequences, from the singleton HotkeyManager. Narrow each view
|
|
@@ -29,5 +29,4 @@ function injectHotkeyRegistrations() {
|
|
|
29
29
|
return injectSelector(getHotkeyManager().registrations, (state) => Array.from(state.values()).map(toHotkeyRegistrationView));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
//#endregion
|
|
33
32
|
export { injectHotkeyRegistrations };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { HotkeyScopesState } from "@tanstack/hotkeys";
|
|
2
2
|
import { Signal } from "@angular/core";
|
|
3
|
-
//#region src/injectHotkeyScopesState.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Angular inject-based API that returns a signal of the hotkey manager's
|
|
6
5
|
* scope state: the active scopes, the exclusive scope that owns the keyboard,
|
|
@@ -23,5 +22,4 @@ import { Signal } from "@angular/core";
|
|
|
23
22
|
* }
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
|
-
export declare function injectHotkeyScopesState(): Signal<HotkeyScopesState>;
|
|
27
|
-
//#endregion
|
|
25
|
+
export declare function injectHotkeyScopesState(): Signal<HotkeyScopesState>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { injectSelector } from "./_injectSelector.js";
|
|
2
2
|
import { getHotkeyManager } from "@tanstack/hotkeys";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/injectHotkeyScopesState.ts
|
|
5
5
|
/**
|
|
6
6
|
* Angular inject-based API that returns a signal of the hotkey manager's
|
|
7
7
|
* scope state: the active scopes, the exclusive scope that owns the keyboard,
|
|
@@ -28,5 +28,4 @@ function injectHotkeyScopesState() {
|
|
|
28
28
|
return injectSelector(getHotkeyManager().scopes, (state) => state);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
//#endregion
|
|
32
31
|
export { injectHotkeyScopesState };
|
package/dist/injectHotkeys.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { InjectHotkeyCommonOptions, InjectHotkeyTarget } from "./injectHotkey.js";
|
|
2
2
|
import { AdapterHotkeyDefinition } from "@tanstack/hotkeys/adapter";
|
|
3
|
-
//#region src/injectHotkeys.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* One hotkey for `injectHotkeys`. Chords accept `requireReset`; sequences
|
|
6
5
|
* accept `timeout`; hotkeys of unknown kind accept only shared options.
|
|
@@ -25,5 +24,4 @@ export type InjectHotkeyDefinition = AdapterHotkeyDefinition<InjectHotkeyTarget>
|
|
|
25
24
|
* ])
|
|
26
25
|
* ```
|
|
27
26
|
*/
|
|
28
|
-
export declare function injectHotkeys(hotkeys: ReadonlyArray<InjectHotkeyDefinition> | (() => ReadonlyArray<InjectHotkeyDefinition>), commonOptions?: InjectHotkeyCommonOptions | (() => InjectHotkeyCommonOptions)): void;
|
|
29
|
-
//#endregion
|
|
27
|
+
export declare function injectHotkeys(hotkeys: ReadonlyArray<InjectHotkeyDefinition> | (() => ReadonlyArray<InjectHotkeyDefinition>), commonOptions?: InjectHotkeyCommonOptions | (() => InjectHotkeyCommonOptions)): void;
|
package/dist/injectHotkeys.js
CHANGED
|
@@ -2,7 +2,7 @@ import { injectHotkeysContext } from "./hotkeys-provider.js";
|
|
|
2
2
|
import { DestroyRef, ElementRef, NgZone, effect, inject, untracked } from "@angular/core";
|
|
3
3
|
import { createHotkeyBindings, prepareHotkeyDefinitions } from "@tanstack/hotkeys/adapter";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/injectHotkeys.ts
|
|
6
6
|
/**
|
|
7
7
|
* Angular inject-based API for registering several hotkeys at once: chords,
|
|
8
8
|
* sequences, and app hotkeys. Pass a getter for a reactive list.
|
|
@@ -46,5 +46,4 @@ function injectHotkeys(hotkeys, commonOptions = {}) {
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
//#endregion
|
|
50
49
|
export { injectHotkeys };
|
package/dist/injectKeyHold.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IndividualKey } from "@tanstack/hotkeys";
|
|
2
2
|
import { Signal } from "@angular/core";
|
|
3
|
-
//#region src/injectKeyHold.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Angular inject-based API that returns a signal that is true when the given key is held.
|
|
6
5
|
*
|
|
@@ -34,5 +33,4 @@ import { Signal } from "@angular/core";
|
|
|
34
33
|
* }
|
|
35
34
|
* ```
|
|
36
35
|
*/
|
|
37
|
-
export declare function injectKeyHold(key: IndividualKey | (() => IndividualKey)): Signal<boolean>;
|
|
38
|
-
//#endregion
|
|
36
|
+
export declare function injectKeyHold(key: IndividualKey | (() => IndividualKey)): Signal<boolean>;
|
package/dist/injectKeyHold.js
CHANGED
|
@@ -3,7 +3,7 @@ import { runOutsideZone } from "./_zone.js";
|
|
|
3
3
|
import { getKeyStateTracker } from "@tanstack/hotkeys";
|
|
4
4
|
import { computed } from "@angular/core";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/injectKeyHold.ts
|
|
7
7
|
/**
|
|
8
8
|
* Angular inject-based API that returns a signal that is true when the given key is held.
|
|
9
9
|
*
|
|
@@ -46,5 +46,4 @@ function injectKeyHold(key) {
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
//#endregion
|
|
50
49
|
export { injectKeyHold };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/angular-hotkeys",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.2",
|
|
4
4
|
"description": "Angular adapter for TanStack Hotkeys",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,24 +37,24 @@
|
|
|
37
37
|
"skills"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@tanstack/hotkeys": "0.
|
|
40
|
+
"@tanstack/hotkeys": "0.25.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@angular/common": ">=19.0.0",
|
|
44
44
|
"@angular/core": ">=19.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@angular/common": "^22.2.
|
|
48
|
-
"@angular/core": "^22.2.
|
|
49
|
-
"@angular/platform-browser-dynamic": "^22.2.
|
|
47
|
+
"@angular/common": "^22.2.5",
|
|
48
|
+
"@angular/core": "^22.2.5",
|
|
49
|
+
"@angular/platform-browser-dynamic": "^22.2.5",
|
|
50
50
|
"typescript": "6.0.3",
|
|
51
51
|
"zone.js": "~0.16.3"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"clean": "premove ./build ./dist",
|
|
55
|
-
"lint": "
|
|
56
|
-
"lint:fix": "
|
|
57
|
-
"test:
|
|
55
|
+
"lint": "oxlint ./src",
|
|
56
|
+
"lint:fix": "oxlint ./src --fix",
|
|
57
|
+
"test:oxlint": "oxlint ./src",
|
|
58
58
|
"test:lib": "vitest --passWithNoTests",
|
|
59
59
|
"test:lib:dev": "pnpm test:lib --watch",
|
|
60
60
|
"test:types": "tsc",
|
|
@@ -20,8 +20,8 @@ declare module '@tanstack/angular-hotkeys' {
|
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
22
|
import { provideHotkeys } from '@tanstack/angular-hotkeys'
|
|
23
|
-
import type { CustomHotkeys } from '@tanstack/angular-hotkeys'
|
|
24
23
|
import { appHotkeys } from './app-hotkeys'
|
|
24
|
+
import type { CustomHotkeys } from '@tanstack/angular-hotkeys'
|
|
25
25
|
|
|
26
26
|
const saved: CustomHotkeys = JSON.parse(localStorage.getItem('hotkeys') ?? '{}')
|
|
27
27
|
|