@tanstack/angular-hotkeys 0.17.0 → 0.18.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.
- package/dist/_injectSelector.js +20 -0
- package/dist/hotkeys-provider.js +3 -3
- package/dist/injectHeldKeyCodes.js +1 -1
- package/dist/injectHeldKeys.js +1 -1
- package/dist/injectHotkeyHint.js +1 -1
- package/dist/injectHotkeyRegistrations.js +1 -1
- package/dist/injectHotkeyScopesState.js +1 -1
- package/dist/injectKeyHold.js +1 -1
- package/package.json +2 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DestroyRef, inject, linkedSignal } from "@angular/core";
|
|
2
|
+
|
|
3
|
+
//#region src/_injectSelector.ts
|
|
4
|
+
/**
|
|
5
|
+
* Subscribes to a store until the injection context is destroyed and returns
|
|
6
|
+
* a signal of the selected value, which updates when it changes (by `===`).
|
|
7
|
+
* Must be called in an injection context.
|
|
8
|
+
*/
|
|
9
|
+
function injectSelector(store, selector) {
|
|
10
|
+
const destroyRef = inject(DestroyRef);
|
|
11
|
+
const selected = linkedSignal(() => selector(store.get()));
|
|
12
|
+
const { unsubscribe } = store.subscribe((state) => {
|
|
13
|
+
selected.set(selector(state));
|
|
14
|
+
});
|
|
15
|
+
destroyRef.onDestroy(unsubscribe);
|
|
16
|
+
return selected.asReadonly();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { injectSelector };
|
package/dist/hotkeys-provider.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { publishAppHotkeysStore } from "@tanstack/hotkeys";
|
|
2
2
|
import { DestroyRef, InjectionToken, Injector, computed, effect, inject, runInInjectionContext, signal } from "@angular/core";
|
|
3
|
-
import { activateHotkeysProviderScope, getHotkeysProviderScopeKey, mergeHotkeysProviderDefaults } from "@tanstack/hotkeys/adapter";
|
|
3
|
+
import { activateHotkeysProviderScope, createAppHotkeysStore, getHotkeysProviderScopeKey, mergeHotkeysProviderDefaults } from "@tanstack/hotkeys/adapter";
|
|
4
4
|
|
|
5
5
|
//#region src/hotkeys-provider.ts
|
|
6
6
|
const NO_APP_HOTKEYS = signal(null).asReadonly();
|
|
@@ -27,7 +27,7 @@ function createHotkeysContext(options) {
|
|
|
27
27
|
let store = null;
|
|
28
28
|
let appHotkeysState = parent.appHotkeysState;
|
|
29
29
|
if (appHotkeys) {
|
|
30
|
-
store =
|
|
30
|
+
store = createAppHotkeysStore(appHotkeys, {
|
|
31
31
|
customHotkeys,
|
|
32
32
|
onCustomHotkeysChange
|
|
33
33
|
});
|
package/dist/injectHeldKeys.js
CHANGED
package/dist/injectHotkeyHint.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { injectHotkeysContext } from "./hotkeys-provider.js";
|
|
2
|
+
import { injectSelector } from "./_injectSelector.js";
|
|
2
3
|
import { getHotkeyManager, getKeyStateTracker, isAppHotkey, matchesHeldModifiers, resolveAppHotkey } from "@tanstack/hotkeys";
|
|
3
4
|
import { computed } from "@angular/core";
|
|
4
|
-
import { injectSelector } from "@tanstack/angular-store";
|
|
5
5
|
|
|
6
6
|
//#region src/injectHotkeyHint.ts
|
|
7
7
|
/**
|
package/dist/injectKeyHold.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/angular-hotkeys",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Angular adapter for TanStack Hotkeys",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,8 +37,7 @@
|
|
|
37
37
|
"skills"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@tanstack/
|
|
41
|
-
"@tanstack/hotkeys": "0.18.0"
|
|
40
|
+
"@tanstack/hotkeys": "0.20.0"
|
|
42
41
|
},
|
|
43
42
|
"peerDependencies": {
|
|
44
43
|
"@angular/common": ">=19.0.0",
|