@tanstack/hotkeys-devtools 0.1.3 → 0.2.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.
|
@@ -17,14 +17,14 @@ function HotkeysContextProvider(props) {
|
|
|
17
17
|
createEffect(() => {
|
|
18
18
|
const unsubscribe = manager.registrations.subscribe(() => {
|
|
19
19
|
setRegistrations(Array.from(manager.registrations.state.values()));
|
|
20
|
-
});
|
|
20
|
+
}).unsubscribe;
|
|
21
21
|
onCleanup(() => unsubscribe());
|
|
22
22
|
});
|
|
23
23
|
createEffect(() => {
|
|
24
24
|
const unsubscribe = tracker.store.subscribe(() => {
|
|
25
25
|
setHeldKeys(tracker.store.state.heldKeys);
|
|
26
26
|
setHeldCodes(tracker.store.state.heldCodes);
|
|
27
|
-
});
|
|
27
|
+
}).unsubscribe;
|
|
28
28
|
onCleanup(() => unsubscribe());
|
|
29
29
|
});
|
|
30
30
|
return createComponent(HotkeysDevtoolsContext.Provider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HotkeysContextProvider.js","names":["createContext","createEffect","createSignal","onCleanup","useContext","HotkeyManager","KeyStateTracker","Accessor","HotkeyRegistration","HotkeysDevtoolsContextType","registrations","Array","heldKeys","heldCodes","Record","HotkeysDevtoolsContext","HotkeysContextProvider","props","children","manager","getInstance","tracker","setRegistrations","from","state","values","setHeldKeys","store","setHeldCodes","unsubscribe","subscribe","_$createComponent","Provider","value","useHotkeysDevtoolsState"],"sources":["../src/HotkeysContextProvider.tsx"],"sourcesContent":["import {\n createContext,\n createEffect,\n createSignal,\n onCleanup,\n useContext,\n} from 'solid-js'\nimport { HotkeyManager, KeyStateTracker } from '@tanstack/hotkeys'\nimport type { Accessor } from 'solid-js'\nimport type { HotkeyRegistration } from '@tanstack/hotkeys'\n\ninterface HotkeysDevtoolsContextType {\n registrations: Accessor<Array<HotkeyRegistration>>\n heldKeys: Accessor<Array<string>>\n heldCodes: Accessor<Record<string, string>>\n}\n\nconst HotkeysDevtoolsContext = createContext<HotkeysDevtoolsContextType>({\n registrations: () => [],\n heldKeys: () => [],\n heldCodes: () => ({}),\n})\n\nexport function HotkeysContextProvider(props: { children: any }) {\n const manager = HotkeyManager.getInstance()\n const tracker = KeyStateTracker.getInstance()\n\n // Create local signals that will be updated by subscriptions\n const [registrations, setRegistrations] = createSignal<\n Array<HotkeyRegistration>\n >(Array.from(manager.registrations.state.values()))\n const [heldKeys, setHeldKeys] = createSignal<Array<string>>(\n tracker.store.state.heldKeys,\n )\n const [heldCodes, setHeldCodes] = createSignal<Record<string, string>>(\n tracker.store.state.heldCodes,\n )\n\n // Subscribe to HotkeyManager registrations store\n createEffect(() => {\n const unsubscribe = manager.registrations.subscribe(() => {\n setRegistrations(Array.from(manager.registrations.state.values()))\n })\n onCleanup(() => unsubscribe())\n })\n\n // Subscribe to KeyStateTracker store\n createEffect(() => {\n const unsubscribe = tracker.store.subscribe(() => {\n setHeldKeys(tracker.store.state.heldKeys)\n setHeldCodes(tracker.store.state.heldCodes)\n })\n onCleanup(() => unsubscribe())\n })\n\n return (\n <HotkeysDevtoolsContext.Provider\n value={{ registrations, heldKeys, heldCodes }}\n >\n {props.children}\n </HotkeysDevtoolsContext.Provider>\n )\n}\n\nexport function useHotkeysDevtoolsState() {\n return useContext(HotkeysDevtoolsContext)\n}\n"],"mappings":";;;;;AAiBA,MAAMe,yBAAyBf,cAA0C;CACvEU,qBAAqB,EAAE;CACvBE,gBAAgB,EAAE;CAClBC,kBAAkB,EAAE;CACrB,CAAC;AAEF,SAAgBG,uBAAuBC,OAA0B;CAC/D,MAAME,UAAUd,cAAce,aAAa;CAC3C,MAAMC,UAAUf,gBAAgBc,aAAa;CAG7C,MAAM,CAACV,eAAeY,oBAAoBpB,aAExCS,MAAMY,KAAKJ,QAAQT,cAAcc,MAAMC,QAAQ,CAAC,CAAC;CACnD,MAAM,CAACb,UAAUc,eAAexB,aAC9BmB,QAAQM,MAAMH,MAAMZ,SACrB;CACD,MAAM,CAACC,WAAWe,gBAAgB1B,aAChCmB,QAAQM,MAAMH,MAAMX,UACrB;AAGDZ,oBAAmB;EACjB,MAAM4B,cAAcV,QAAQT,cAAcoB,gBAAgB;AACxDR,oBAAiBX,MAAMY,KAAKJ,QAAQT,cAAcc,MAAMC,QAAQ,CAAC,CAAC;IAClE;
|
|
1
|
+
{"version":3,"file":"HotkeysContextProvider.js","names":["createContext","createEffect","createSignal","onCleanup","useContext","HotkeyManager","KeyStateTracker","Accessor","HotkeyRegistration","HotkeysDevtoolsContextType","registrations","Array","heldKeys","heldCodes","Record","HotkeysDevtoolsContext","HotkeysContextProvider","props","children","manager","getInstance","tracker","setRegistrations","from","state","values","setHeldKeys","store","setHeldCodes","unsubscribe","subscribe","_$createComponent","Provider","value","useHotkeysDevtoolsState"],"sources":["../src/HotkeysContextProvider.tsx"],"sourcesContent":["import {\n createContext,\n createEffect,\n createSignal,\n onCleanup,\n useContext,\n} from 'solid-js'\nimport { HotkeyManager, KeyStateTracker } from '@tanstack/hotkeys'\nimport type { Accessor } from 'solid-js'\nimport type { HotkeyRegistration } from '@tanstack/hotkeys'\n\ninterface HotkeysDevtoolsContextType {\n registrations: Accessor<Array<HotkeyRegistration>>\n heldKeys: Accessor<Array<string>>\n heldCodes: Accessor<Record<string, string>>\n}\n\nconst HotkeysDevtoolsContext = createContext<HotkeysDevtoolsContextType>({\n registrations: () => [],\n heldKeys: () => [],\n heldCodes: () => ({}),\n})\n\nexport function HotkeysContextProvider(props: { children: any }) {\n const manager = HotkeyManager.getInstance()\n const tracker = KeyStateTracker.getInstance()\n\n // Create local signals that will be updated by subscriptions\n const [registrations, setRegistrations] = createSignal<\n Array<HotkeyRegistration>\n >(Array.from(manager.registrations.state.values()))\n const [heldKeys, setHeldKeys] = createSignal<Array<string>>(\n tracker.store.state.heldKeys,\n )\n const [heldCodes, setHeldCodes] = createSignal<Record<string, string>>(\n tracker.store.state.heldCodes,\n )\n\n // Subscribe to HotkeyManager registrations store\n createEffect(() => {\n const unsubscribe = manager.registrations.subscribe(() => {\n setRegistrations(Array.from(manager.registrations.state.values()))\n }).unsubscribe\n onCleanup(() => unsubscribe())\n })\n\n // Subscribe to KeyStateTracker store\n createEffect(() => {\n const unsubscribe = tracker.store.subscribe(() => {\n setHeldKeys(tracker.store.state.heldKeys)\n setHeldCodes(tracker.store.state.heldCodes)\n }).unsubscribe\n onCleanup(() => unsubscribe())\n })\n\n return (\n <HotkeysDevtoolsContext.Provider\n value={{ registrations, heldKeys, heldCodes }}\n >\n {props.children}\n </HotkeysDevtoolsContext.Provider>\n )\n}\n\nexport function useHotkeysDevtoolsState() {\n return useContext(HotkeysDevtoolsContext)\n}\n"],"mappings":";;;;;AAiBA,MAAMe,yBAAyBf,cAA0C;CACvEU,qBAAqB,EAAE;CACvBE,gBAAgB,EAAE;CAClBC,kBAAkB,EAAE;CACrB,CAAC;AAEF,SAAgBG,uBAAuBC,OAA0B;CAC/D,MAAME,UAAUd,cAAce,aAAa;CAC3C,MAAMC,UAAUf,gBAAgBc,aAAa;CAG7C,MAAM,CAACV,eAAeY,oBAAoBpB,aAExCS,MAAMY,KAAKJ,QAAQT,cAAcc,MAAMC,QAAQ,CAAC,CAAC;CACnD,MAAM,CAACb,UAAUc,eAAexB,aAC9BmB,QAAQM,MAAMH,MAAMZ,SACrB;CACD,MAAM,CAACC,WAAWe,gBAAgB1B,aAChCmB,QAAQM,MAAMH,MAAMX,UACrB;AAGDZ,oBAAmB;EACjB,MAAM4B,cAAcV,QAAQT,cAAcoB,gBAAgB;AACxDR,oBAAiBX,MAAMY,KAAKJ,QAAQT,cAAcc,MAAMC,QAAQ,CAAC,CAAC;IAClE,CAACI;AACH1B,kBAAgB0B,aAAa,CAAC;GAC9B;AAGF5B,oBAAmB;EACjB,MAAM4B,cAAcR,QAAQM,MAAMG,gBAAgB;AAChDJ,eAAYL,QAAQM,MAAMH,MAAMZ,SAAS;AACzCgB,gBAAaP,QAAQM,MAAMH,MAAMX,UAAU;IAC3C,CAACgB;AACH1B,kBAAgB0B,aAAa,CAAC;GAC9B;AAEF,QAAAE,gBACGhB,uBAAuBiB,UAAQ;EAC9BC,OAAO;GAAEvB;GAAeE;GAAUC;GAAW;EAAA,IAAAK,WAAA;AAAA,UAE5CD,MAAMC;;EAAQ,CAAA;;AAKrB,SAAgBgB,0BAA0B;AACxC,QAAO9B,WAAWW,uBAAuB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/hotkeys-devtools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Devtools for TanStack Hotkeys",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"src"
|
|
38
38
|
],
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@tanstack/hotkeys": "0.
|
|
40
|
+
"@tanstack/hotkeys": "0.2.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@tanstack/devtools-ui": "^0.4.4",
|
|
@@ -40,7 +40,7 @@ export function HotkeysContextProvider(props: { children: any }) {
|
|
|
40
40
|
createEffect(() => {
|
|
41
41
|
const unsubscribe = manager.registrations.subscribe(() => {
|
|
42
42
|
setRegistrations(Array.from(manager.registrations.state.values()))
|
|
43
|
-
})
|
|
43
|
+
}).unsubscribe
|
|
44
44
|
onCleanup(() => unsubscribe())
|
|
45
45
|
})
|
|
46
46
|
|
|
@@ -49,7 +49,7 @@ export function HotkeysContextProvider(props: { children: any }) {
|
|
|
49
49
|
const unsubscribe = tracker.store.subscribe(() => {
|
|
50
50
|
setHeldKeys(tracker.store.state.heldKeys)
|
|
51
51
|
setHeldCodes(tracker.store.state.heldCodes)
|
|
52
|
-
})
|
|
52
|
+
}).unsubscribe
|
|
53
53
|
onCleanup(() => unsubscribe())
|
|
54
54
|
})
|
|
55
55
|
|