@tanstack/hotkeys-devtools 0.0.1 → 0.1.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.
Files changed (41) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +121 -45
  3. package/dist/HotkeysContextProvider.js +47 -0
  4. package/dist/HotkeysContextProvider.js.map +1 -0
  5. package/dist/HotkeysDevtools.js +14 -0
  6. package/dist/HotkeysDevtools.js.map +1 -0
  7. package/dist/components/ActionButtons.js +33 -0
  8. package/dist/components/ActionButtons.js.map +1 -0
  9. package/dist/components/DetailsPanel.js +268 -0
  10. package/dist/components/DetailsPanel.js.map +1 -0
  11. package/dist/components/HeldKeysTopbar.js +75 -0
  12. package/dist/components/HeldKeysTopbar.js.map +1 -0
  13. package/dist/components/HotkeyList.js +188 -0
  14. package/dist/components/HotkeyList.js.map +1 -0
  15. package/dist/components/Shell.js +98 -0
  16. package/dist/components/Shell.js.map +1 -0
  17. package/dist/core.d.ts +24 -0
  18. package/dist/core.js +9 -0
  19. package/dist/core.js.map +1 -0
  20. package/dist/index.d.ts +16 -0
  21. package/dist/index.js +10 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/production.d.ts +2 -0
  24. package/dist/production.js +5 -0
  25. package/dist/styles/tokens.js +301 -0
  26. package/dist/styles/tokens.js.map +1 -0
  27. package/dist/styles/use-styles.js +496 -0
  28. package/dist/styles/use-styles.js.map +1 -0
  29. package/package.json +59 -7
  30. package/src/HotkeysContextProvider.tsx +67 -0
  31. package/src/HotkeysDevtools.tsx +10 -0
  32. package/src/components/ActionButtons.tsx +25 -0
  33. package/src/components/DetailsPanel.tsx +298 -0
  34. package/src/components/HeldKeysTopbar.tsx +42 -0
  35. package/src/components/HotkeyList.tsx +248 -0
  36. package/src/components/Shell.tsx +101 -0
  37. package/src/core.tsx +11 -0
  38. package/src/index.ts +10 -0
  39. package/src/production.ts +5 -0
  40. package/src/styles/tokens.ts +305 -0
  41. package/src/styles/use-styles.ts +493 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tanner Linsley
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,45 +1,121 @@
1
- # @tanstack/hotkeys-devtools
2
-
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
4
-
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
6
-
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
8
-
9
- ## Purpose
10
-
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@tanstack/hotkeys-devtools`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
15
-
16
- ## What is OIDC Trusted Publishing?
17
-
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
19
-
20
- ## Setup Instructions
21
-
22
- To properly configure OIDC trusted publishing for this package:
23
-
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
28
-
29
- ## DO NOT USE THIS PACKAGE
30
-
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
36
-
37
- ## More Information
38
-
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
42
-
43
- ---
44
-
45
- **Maintained for OIDC setup purposes only**
1
+ <div align="center">
2
+ <img src="./media/header_hotkeys.png" alt="TanStack Hotkeys" />
3
+ </div>
4
+
5
+ <br />
6
+
7
+ <div align="center">
8
+ <a href="https://www.npmjs.com/package/@tanstack/hotkeys" target="\_parent">
9
+ <img alt="" src="https://img.shields.io/npm/dm/@tanstack/hotkeys.svg" alt="npm downloads" />
10
+ </a>
11
+ <a href="https://github.com/TanStack/hotkeys" target="\_parent">
12
+ <img alt="" src="https://img.shields.io/github/stars/TanStack/hotkeys.svg?style=social&label=Star" alt="GitHub stars" />
13
+ </a>
14
+ <a href="https://bundlephobia.com/result?p=@tanstack/react-hotkeys@latest" target="\_parent">
15
+ <img alt="" src="https://badgen.net/bundlephobia/minzip/@tanstack/react-hotkeys@latest" alt="Bundle size" />
16
+ </a>
17
+ </div>
18
+
19
+ <div align="center">
20
+ <a href="#badge">
21
+ <img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
22
+ </a>
23
+ <a href="#badge">
24
+ <img src="https://img.shields.io/github/v/release/tanstack/hotkeys" alt="Release"/>
25
+ </a>
26
+ <a href="https://twitter.com/tan_stack">
27
+ <img src="https://img.shields.io/twitter/follow/tan_stack.svg?style=social" alt="Follow @TanStack"/>
28
+ </a>
29
+ </div>
30
+
31
+ <div align="center">
32
+
33
+ ### [Become a Sponsor!](https://github.com/sponsors/tannerlinsley/)
34
+
35
+ </div>
36
+
37
+ # TanStack Hotkeys
38
+
39
+ > [!NOTE]
40
+ > TanStack Hotkeys is pre-alpha (prototyping phase). We are actively developing the library and are open to feedback and contributions.
41
+
42
+ 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.
43
+
44
+ - Type-safe bindings — template strings (`Mod+Shift+S`, `Escape`) or parsed objects for full control
45
+ - Flexible options `keydown`/`keyup`, `preventDefault`, `stopPropagation`, conditional enabled, `requireReset`
46
+ - Cross-platform Mod — maps to Cmd on macOS and Ctrl on Windows/Linux
47
+ - Batteries included — validation + matching, sequences (Vim-style), key-state tracking, recorder UI helpers, React hooks, and devtools (in progress)
48
+
49
+ ### <a href="https://tanstack.com/hotkeys">Read the docs →</a>
50
+
51
+ <br />
52
+
53
+ > [!NOTE]
54
+ > You may know **TanStack Hotkeys** by our adapter names, too!
55
+ >
56
+ > - [**React Hotkeys**](https://tanstack.com/hotkeys/latest/docs/framework/react/react-hotkeys)
57
+ > - Solid Hotkeys – needs a contributor!
58
+ > - Angular Hotkeys – needs a contributor!
59
+ > - Svelte Hotkeys – needs a contributor!
60
+ > - Vue Hotkeys – needs a contributor!
61
+
62
+ ## Get Involved
63
+
64
+ - We welcome issues and pull requests!
65
+ - Participate in [GitHub discussions](https://github.com/TanStack/hotkeys/discussions)
66
+ - Chat with the community on [Discord](https://discord.com/invite/WrRKjPJ)
67
+ - See [CONTRIBUTING.md](./CONTRIBUTING.md) for setup instructions
68
+
69
+ ## Partners
70
+
71
+ <div align="center">
72
+
73
+ <table align="center">
74
+ <tr>
75
+ <td>
76
+ <a href="https://www.coderabbit.ai/?via=tanstack&dub_id=aCcEEdAOqqutX6OS" >
77
+ <picture>
78
+ <source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/coderabbit-dark-D643Zkrv.svg" height="40" />
79
+ <source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/coderabbit-light-CIzGLYU_.svg" height="40" />
80
+ <img src="https://tanstack.com/assets/coderabbit-light-DVMJ2jHi.svg" height="40" alt="CodeRabbit" />
81
+ </picture>
82
+ </a>
83
+ </td>
84
+ <td>
85
+ <a href="https://www.cloudflare.com?utm_source=tanstack">
86
+ <picture>
87
+ <source media="(prefers-color-scheme: dark)" srcset="https://tanstack.com/assets/cloudflare-white-Co-Tyjbl.svg" height="60" />
88
+ <source media="(prefers-color-scheme: light)" srcset="https://tanstack.com/assets/cloudflare-black-6Ojsn8yh.svg" height="60" />
89
+ <img src="https://tanstack.com/assets/cloudflare-black-CPufaW0B.svg" height="60" alt="Cloudflare" />
90
+ </picture>
91
+ </a>
92
+ </td>
93
+ </tr>
94
+ </table>
95
+
96
+ <div align="center">
97
+ <img src="media/partner_logo.svg" alt="Keys & you?" height="65">
98
+ <p>
99
+ We're looking for TanStack Hotkeys Partners to join our mission! Partner with us to push the boundaries of TanStack Hotkeys and build amazing things together.
100
+ </p>
101
+ <a href="mailto:partners@tanstack.com?subject=TanStack Hotkeys Partnership"><b>LET'S CHAT</b></a>
102
+ </div>
103
+
104
+ </div>
105
+
106
+ ## Explore the TanStack Ecosystem
107
+
108
+ - <a href="https://github.com/tanstack/config"><b>TanStack Config</b></a> – Tooling for JS/TS packages
109
+ - <a href="https://github.com/tanstack/db"><b>TanStack DB</b></a> – Reactive sync client store
110
+ - <a href="https://github.com/tanstack/devtools"><b>TanStack DevTools</b></a> – Unified devtools panel
111
+ - <a href="https://github.com/tanstack/form"><b>TanStack Form</b></a> – Type‑safe form state
112
+ - <a href="https://github.com/tanstack/hotkeys"><b>TanStack Hotkeys</b></a> – Type‑safe keyboard shortcuts
113
+ - <a href="https://github.com/tanstack/query"><b>TanStack Query</b></a> – Async state & caching
114
+ - <a href="https://github.com/tanstack/ranger"><b>TanStack Ranger</b></a> – Range & slider primitives
115
+ - <a href="https://github.com/tanstack/router"><b>TanStack Router</b></a> – Type‑safe routing, caching & URL state
116
+ - <a href="https://github.com/tanstack/start"><b>TanStack Start</b></a> – Full‑stack SSR & streaming
117
+ - <a href="https://github.com/tanstack/store"><b>TanStack Store</b></a> – Reactive data store
118
+ - <a href="https://github.com/tanstack/table"><b>TanStack Table</b></a> – Headless datagrids
119
+ - <a href="https://github.com/tanstack/virtual"><b>TanStack Virtual</b></a> – Virtualized rendering
120
+
121
+ … and more at <a href="https://tanstack.com"><b>TanStack.com »</b></a>
@@ -0,0 +1,47 @@
1
+ import { createContext, createEffect, createSignal, onCleanup, useContext } from "solid-js";
2
+ import { createComponent } from "solid-js/web";
3
+ import { HotkeyManager, KeyStateTracker } from "@tanstack/hotkeys";
4
+
5
+ //#region src/HotkeysContextProvider.tsx
6
+ const HotkeysDevtoolsContext = createContext({
7
+ registrations: () => [],
8
+ heldKeys: () => [],
9
+ heldCodes: () => ({})
10
+ });
11
+ function HotkeysContextProvider(props) {
12
+ const manager = HotkeyManager.getInstance();
13
+ const tracker = KeyStateTracker.getInstance();
14
+ const [registrations, setRegistrations] = createSignal(Array.from(manager.registrations.state.values()));
15
+ const [heldKeys, setHeldKeys] = createSignal(tracker.store.state.heldKeys);
16
+ const [heldCodes, setHeldCodes] = createSignal(tracker.store.state.heldCodes);
17
+ createEffect(() => {
18
+ const unsubscribe = manager.registrations.subscribe(() => {
19
+ setRegistrations(Array.from(manager.registrations.state.values()));
20
+ });
21
+ onCleanup(() => unsubscribe());
22
+ });
23
+ createEffect(() => {
24
+ const unsubscribe = tracker.store.subscribe(() => {
25
+ setHeldKeys(tracker.store.state.heldKeys);
26
+ setHeldCodes(tracker.store.state.heldCodes);
27
+ });
28
+ onCleanup(() => unsubscribe());
29
+ });
30
+ return createComponent(HotkeysDevtoolsContext.Provider, {
31
+ value: {
32
+ registrations,
33
+ heldKeys,
34
+ heldCodes
35
+ },
36
+ get children() {
37
+ return props.children;
38
+ }
39
+ });
40
+ }
41
+ function useHotkeysDevtoolsState() {
42
+ return useContext(HotkeysDevtoolsContext);
43
+ }
44
+
45
+ //#endregion
46
+ export { HotkeysContextProvider, useHotkeysDevtoolsState };
47
+ //# sourceMappingURL=HotkeysContextProvider.js.map
@@ -0,0 +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;AACFtB,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;AACFV,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"}
@@ -0,0 +1,14 @@
1
+ import { HotkeysContextProvider } from "./HotkeysContextProvider.js";
2
+ import { Shell } from "./components/Shell.js";
3
+ import { createComponent } from "solid-js/web";
4
+
5
+ //#region src/HotkeysDevtools.tsx
6
+ function HotkeysDevtools() {
7
+ return createComponent(HotkeysContextProvider, { get children() {
8
+ return createComponent(Shell, {});
9
+ } });
10
+ }
11
+
12
+ //#endregion
13
+ export { HotkeysDevtools as default };
14
+ //# sourceMappingURL=HotkeysDevtools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HotkeysDevtools.js","names":["HotkeysContextProvider","Shell","HotkeysDevtools","_$createComponent","children"],"sources":["../src/HotkeysDevtools.tsx"],"sourcesContent":["import { HotkeysContextProvider } from './HotkeysContextProvider'\nimport { Shell } from './components/Shell'\n\nexport default function HotkeysDevtools() {\n return (\n <HotkeysContextProvider>\n <Shell />\n </HotkeysContextProvider>\n )\n}\n"],"mappings":";;;;;AAGA,SAAwBE,kBAAkB;AACxC,QAAAC,gBACGH,wBAAsB,EAAA,IAAAI,WAAA;AAAA,SAAAD,gBACpBF,OAAK,EAAA,CAAA;IAAA,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { useStyles } from "../styles/use-styles.js";
2
+ import { className, delegateEvents, effect, template } from "solid-js/web";
3
+ import { HotkeyManager } from "@tanstack/hotkeys";
4
+
5
+ //#region src/components/ActionButtons.tsx
6
+ var _tmpl$ = /* @__PURE__ */ template(`<div><button><span></span>Trigger`);
7
+ function ActionButtons(props) {
8
+ const styles = useStyles();
9
+ const handleTrigger = () => {
10
+ HotkeyManager.getInstance().triggerRegistration(props.registration.id);
11
+ };
12
+ return (() => {
13
+ var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
14
+ _el$2.$$mousedown = handleTrigger;
15
+ effect((_p$) => {
16
+ var _v$ = styles().actionsRow, _v$2 = styles().actionButton, _v$3 = styles().actionDotGreen;
17
+ _v$ !== _p$.e && className(_el$, _p$.e = _v$);
18
+ _v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
19
+ _v$3 !== _p$.a && className(_el$3, _p$.a = _v$3);
20
+ return _p$;
21
+ }, {
22
+ e: void 0,
23
+ t: void 0,
24
+ a: void 0
25
+ });
26
+ return _el$;
27
+ })();
28
+ }
29
+ delegateEvents(["mousedown"]);
30
+
31
+ //#endregion
32
+ export { ActionButtons };
33
+ //# sourceMappingURL=ActionButtons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionButtons.js","names":["HotkeyManager","useStyles","HotkeyRegistration","ActionButtonsProps","registration","ActionButtons","props","styles","handleTrigger","manager","getInstance","triggerRegistration","id","_el$","_tmpl$","_el$2","firstChild","_el$3","$$mousedown","_$effect","_p$","_v$","actionsRow","_v$2","actionButton","_v$3","actionDotGreen","e","_$className","t","a","undefined","_$delegateEvents"],"sources":["../../src/components/ActionButtons.tsx"],"sourcesContent":["import { HotkeyManager } from '@tanstack/hotkeys'\nimport { useStyles } from '../styles/use-styles'\nimport type { HotkeyRegistration } from '@tanstack/hotkeys'\n\ntype ActionButtonsProps = {\n registration: HotkeyRegistration\n}\n\nexport function ActionButtons(props: ActionButtonsProps) {\n const styles = useStyles()\n\n const handleTrigger = () => {\n const manager = HotkeyManager.getInstance()\n manager.triggerRegistration(props.registration.id)\n }\n\n return (\n <div class={styles().actionsRow}>\n <button class={styles().actionButton} onMouseDown={handleTrigger}>\n <span class={styles().actionDotGreen} />\n Trigger\n </button>\n </div>\n )\n}\n"],"mappings":";;;;;;AAQA,SAAgBK,cAAcC,OAA2B;CACvD,MAAMC,SAASN,WAAW;CAE1B,MAAMO,sBAAsB;AAE1BC,EADgBT,cAAcU,aAAa,CACnCC,oBAAoBL,MAAMF,aAAaQ,GAAG;;AAGpD,eAAA;EAAA,IAAAC,OAAAC,QAAA,EAAAC,QAAAF,KAAAG,YAAAC,QAAAF,MAAAC;AAAAD,QAAAG,cAEuDV;AAAaW,UAAAC,QAAA;GAAA,IAAAC,MADtDd,QAAQ,CAACe,YAAUC,OACdhB,QAAQ,CAACiB,cAAYC,OACrBlB,QAAQ,CAACmB;AAAcL,WAAAD,IAAAO,KAAAC,UAAAf,MAAAO,IAAAO,IAAAN,IAAA;AAAAE,YAAAH,IAAAS,KAAAD,UAAAb,OAAAK,IAAAS,IAAAN,KAAA;AAAAE,YAAAL,IAAAU,KAAAF,UAAAX,OAAAG,IAAAU,IAAAL,KAAA;AAAA,UAAAL;KAAA;GAAAO,GAAAI;GAAAF,GAAAE;GAAAD,GAAAC;GAAA,CAAA;AAAA,SAAAlB;KAAA;;AAK3CmB,eAAA,CAAA,YAAA,CAAA"}
@@ -0,0 +1,268 @@
1
+ import { useHotkeysDevtoolsState } from "../HotkeysContextProvider.js";
2
+ import { useStyles } from "../styles/use-styles.js";
3
+ import { ActionButtons } from "./ActionButtons.js";
4
+ import { For, Show, createMemo } from "solid-js";
5
+ import { className, createComponent, effect, insert, template } from "solid-js/web";
6
+ import { formatForDisplay } from "@tanstack/hotkeys";
7
+
8
+ //#region src/components/DetailsPanel.tsx
9
+ var _tmpl$ = /* @__PURE__ */ template(`<div>`), _tmpl$2 = /* @__PURE__ */ template(`<div>Select a hotkey from the list to view its details`), _tmpl$3 = /* @__PURE__ */ template(`<div><div></div><div><div>ID</div><div></div><div>Raw</div><div></div><div>Target</div><div>`), _tmpl$4 = /* @__PURE__ */ template(`<div><div>Conflicts (<!>)</div><div>`), _tmpl$5 = /* @__PURE__ */ template(`<div><div><div>Key Breakdown</div><div></div></div><div><div>Actions</div></div><div><div>Options</div><div><div><span>enabled</span><span></span></div><div><span>eventType</span><span></span></div><div><span>preventDefault</span><span></span></div><div><span>stopPropagation</span><span></span></div><div><span>ignoreInputs</span><span></span></div><div><span>requireReset</span><span></span></div><div><span>conflictBehavior</span><span></span></div><div><span>hasFired</span><span>`), _tmpl$6 = /* @__PURE__ */ template(`<span>+`), _tmpl$7 = /* @__PURE__ */ template(`<span>`), _tmpl$8 = /* @__PURE__ */ template(`<div><span></span> <!>: <!> (<!>) on `), _tmpl$9 = /* @__PURE__ */ template(`<div><span>scope</span> <!>: <!> (<!>) on `);
10
+ function getTargetDescription(target) {
11
+ if (typeof document !== "undefined" && target === document) return "document";
12
+ if (typeof window !== "undefined" && target === window) return "window";
13
+ if (target instanceof HTMLElement) return `${target.tagName.toLowerCase()}${target.id ? `#${target.id}` : ""}${target.className ? `.${target.className.split(" ").join(".")}` : ""}`;
14
+ return "element";
15
+ }
16
+ function findTargetConflicts(registration, all) {
17
+ return all.filter((other) => other.id !== registration.id && other.hotkey === registration.hotkey && other.options.eventType === registration.options.eventType && other.target === registration.target);
18
+ }
19
+ function findScopeConflicts(registration, all) {
20
+ return all.filter((other) => other.id !== registration.id && other.hotkey === registration.hotkey && other.options.eventType === registration.options.eventType && other.target !== registration.target);
21
+ }
22
+ function getConflictItemStyle(behavior, isSameTarget) {
23
+ if (!isSameTarget) return "conflictItemScope";
24
+ if (behavior === "allow") return "conflictItemAllow";
25
+ if (behavior === "error") return "conflictItemError";
26
+ return "conflictItem";
27
+ }
28
+ function getConflictLabel(behavior, isSameTarget) {
29
+ if (!isSameTarget) return "scope";
30
+ if (behavior === "allow") return "allowed";
31
+ if (behavior === "error") return "error";
32
+ if (behavior === "replace") return "replaced";
33
+ return "warning";
34
+ }
35
+ function DetailsPanel(props) {
36
+ const styles = useStyles();
37
+ const state = useHotkeysDevtoolsState();
38
+ return (() => {
39
+ var _el$ = _tmpl$();
40
+ insert(_el$, createComponent(Show, {
41
+ get when() {
42
+ return props.selectedRegistration();
43
+ },
44
+ get fallback() {
45
+ return (() => {
46
+ var _el$2 = _tmpl$2();
47
+ effect(() => className(_el$2, styles().noSelection));
48
+ return _el$2;
49
+ })();
50
+ },
51
+ children: (reg) => {
52
+ const parsed = () => reg().parsedHotkey;
53
+ const targetConflicts = createMemo(() => findTargetConflicts(reg(), state.registrations()));
54
+ const scopeConflicts = createMemo(() => findScopeConflicts(reg(), state.registrations()));
55
+ const allConflicts = createMemo(() => [...targetConflicts(), ...scopeConflicts()]);
56
+ const conflictBehavior = () => reg().options.conflictBehavior ?? "warn";
57
+ const keyParts = createMemo(() => {
58
+ const parts = [];
59
+ const p = parsed();
60
+ if (p.ctrl) parts.push("Ctrl");
61
+ if (p.shift) parts.push("Shift");
62
+ if (p.alt) parts.push("Alt");
63
+ if (p.meta) parts.push("Meta");
64
+ parts.push(p.key);
65
+ return parts;
66
+ });
67
+ return [(() => {
68
+ var _el$3 = _tmpl$3(), _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling, _el$6 = _el$5.firstChild, _el$7 = _el$6.nextSibling, _el$8 = _el$7.nextSibling, _el$9 = _el$8.nextSibling, _el$0 = _el$9.nextSibling, _el$1 = _el$0.nextSibling;
69
+ insert(_el$4, () => formatForDisplay(reg().hotkey));
70
+ insert(_el$7, () => reg().id);
71
+ insert(_el$9, () => reg().hotkey);
72
+ insert(_el$1, () => getTargetDescription(reg().target));
73
+ effect((_p$) => {
74
+ var _v$ = styles().stateHeader, _v$2 = styles().stateTitle, _v$3 = styles().infoGrid, _v$4 = styles().infoLabel, _v$5 = styles().infoValueMono, _v$6 = styles().infoLabel, _v$7 = styles().infoValueMono, _v$8 = styles().infoLabel, _v$9 = styles().infoValueMono;
75
+ _v$ !== _p$.e && className(_el$3, _p$.e = _v$);
76
+ _v$2 !== _p$.t && className(_el$4, _p$.t = _v$2);
77
+ _v$3 !== _p$.a && className(_el$5, _p$.a = _v$3);
78
+ _v$4 !== _p$.o && className(_el$6, _p$.o = _v$4);
79
+ _v$5 !== _p$.i && className(_el$7, _p$.i = _v$5);
80
+ _v$6 !== _p$.n && className(_el$8, _p$.n = _v$6);
81
+ _v$7 !== _p$.s && className(_el$9, _p$.s = _v$7);
82
+ _v$8 !== _p$.h && className(_el$0, _p$.h = _v$8);
83
+ _v$9 !== _p$.r && className(_el$1, _p$.r = _v$9);
84
+ return _p$;
85
+ }, {
86
+ e: void 0,
87
+ t: void 0,
88
+ a: void 0,
89
+ o: void 0,
90
+ i: void 0,
91
+ n: void 0,
92
+ s: void 0,
93
+ h: void 0,
94
+ r: void 0
95
+ });
96
+ return _el$3;
97
+ })(), (() => {
98
+ var _el$10 = _tmpl$5(), _el$11 = _el$10.firstChild, _el$12 = _el$11.firstChild, _el$13 = _el$12.nextSibling, _el$14 = _el$11.nextSibling, _el$15 = _el$14.firstChild, _el$16 = _el$14.nextSibling, _el$17 = _el$16.firstChild, _el$19 = _el$17.nextSibling.firstChild, _el$20 = _el$19.firstChild, _el$21 = _el$20.nextSibling, _el$22 = _el$19.nextSibling, _el$23 = _el$22.firstChild, _el$24 = _el$23.nextSibling, _el$25 = _el$22.nextSibling, _el$26 = _el$25.firstChild, _el$27 = _el$26.nextSibling, _el$28 = _el$25.nextSibling, _el$29 = _el$28.firstChild, _el$30 = _el$29.nextSibling, _el$31 = _el$28.nextSibling, _el$32 = _el$31.firstChild, _el$33 = _el$32.nextSibling, _el$34 = _el$31.nextSibling, _el$35 = _el$34.firstChild, _el$36 = _el$35.nextSibling, _el$37 = _el$34.nextSibling, _el$38 = _el$37.firstChild, _el$39 = _el$38.nextSibling, _el$40 = _el$37.nextSibling, _el$41 = _el$40.firstChild, _el$42 = _el$41.nextSibling;
99
+ insert(_el$13, createComponent(For, {
100
+ get each() {
101
+ return keyParts();
102
+ },
103
+ children: (part, i) => [createComponent(Show, {
104
+ get when() {
105
+ return i() > 0;
106
+ },
107
+ get children() {
108
+ var _el$49 = _tmpl$6();
109
+ effect(() => className(_el$49, styles().keyBreakdownPlus));
110
+ return _el$49;
111
+ }
112
+ }), (() => {
113
+ var _el$50 = _tmpl$7();
114
+ insert(_el$50, part);
115
+ effect(() => className(_el$50, styles().keyCapLarge));
116
+ return _el$50;
117
+ })()]
118
+ }));
119
+ insert(_el$14, createComponent(ActionButtons, { get registration() {
120
+ return reg();
121
+ } }), null);
122
+ insert(_el$21, () => String(reg().options.enabled !== false));
123
+ insert(_el$24, () => reg().options.eventType ?? "keydown");
124
+ insert(_el$27, () => String(!!reg().options.preventDefault));
125
+ insert(_el$30, () => String(!!reg().options.stopPropagation));
126
+ insert(_el$33, () => String(reg().options.ignoreInputs !== false));
127
+ insert(_el$36, () => String(!!reg().options.requireReset));
128
+ insert(_el$39, conflictBehavior);
129
+ insert(_el$42, () => String(reg().hasFired));
130
+ insert(_el$10, createComponent(Show, {
131
+ get when() {
132
+ return allConflicts().length > 0;
133
+ },
134
+ get children() {
135
+ var _el$43 = _tmpl$4(), _el$44 = _el$43.firstChild, _el$47 = _el$44.firstChild.nextSibling;
136
+ _el$47.nextSibling;
137
+ var _el$48 = _el$44.nextSibling;
138
+ insert(_el$44, () => allConflicts().length, _el$47);
139
+ insert(_el$48, createComponent(For, {
140
+ get each() {
141
+ return targetConflicts();
142
+ },
143
+ children: (conflict) => {
144
+ const itemStyle = () => getConflictItemStyle(conflictBehavior(), true);
145
+ const label = () => getConflictLabel(conflictBehavior(), true);
146
+ return (() => {
147
+ var _el$51 = _tmpl$8(), _el$52 = _el$51.firstChild, _el$59 = _el$52.nextSibling.nextSibling, _el$60 = _el$59.nextSibling.nextSibling, _el$61 = _el$60.nextSibling.nextSibling;
148
+ _el$61.nextSibling;
149
+ insert(_el$52, label);
150
+ insert(_el$51, () => conflict.id, _el$59);
151
+ insert(_el$51, () => formatForDisplay(conflict.hotkey), _el$60);
152
+ insert(_el$51, () => conflict.options.eventType ?? "keydown", _el$61);
153
+ insert(_el$51, () => getTargetDescription(conflict.target), null);
154
+ effect(() => className(_el$51, styles()[itemStyle()]));
155
+ return _el$51;
156
+ })();
157
+ }
158
+ }), null);
159
+ insert(_el$48, createComponent(For, {
160
+ get each() {
161
+ return scopeConflicts();
162
+ },
163
+ children: (conflict) => (() => {
164
+ var _el$62 = _tmpl$9(), _el$70 = _el$62.firstChild.nextSibling.nextSibling, _el$71 = _el$70.nextSibling.nextSibling, _el$72 = _el$71.nextSibling.nextSibling;
165
+ _el$72.nextSibling;
166
+ insert(_el$62, () => conflict.id, _el$70);
167
+ insert(_el$62, () => formatForDisplay(conflict.hotkey), _el$71);
168
+ insert(_el$62, () => conflict.options.eventType ?? "keydown", _el$72);
169
+ insert(_el$62, () => getTargetDescription(conflict.target), null);
170
+ effect(() => className(_el$62, styles().conflictItemScope));
171
+ return _el$62;
172
+ })()
173
+ }), null);
174
+ effect((_p$) => {
175
+ var _v$0 = styles().detailSection, _v$1 = styles().detailSectionHeader, _v$10 = styles().conflictList;
176
+ _v$0 !== _p$.e && className(_el$43, _p$.e = _v$0);
177
+ _v$1 !== _p$.t && className(_el$44, _p$.t = _v$1);
178
+ _v$10 !== _p$.a && className(_el$48, _p$.a = _v$10);
179
+ return _p$;
180
+ }, {
181
+ e: void 0,
182
+ t: void 0,
183
+ a: void 0
184
+ });
185
+ return _el$43;
186
+ }
187
+ }), null);
188
+ effect((_p$) => {
189
+ var _v$11 = styles().detailsGrid, _v$12 = styles().detailSection, _v$13 = styles().detailSectionHeader, _v$14 = styles().keyBreakdown, _v$15 = styles().detailSection, _v$16 = styles().detailSectionHeader, _v$17 = styles().detailSection, _v$18 = styles().detailSectionHeader, _v$19 = styles().optionRow, _v$20 = styles().optionLabel, _v$21 = reg().options.enabled !== false ? styles().optionValueTrue : styles().optionValueFalse, _v$22 = styles().optionRow, _v$23 = styles().optionLabel, _v$24 = styles().optionValue, _v$25 = styles().optionRow, _v$26 = styles().optionLabel, _v$27 = reg().options.preventDefault ? styles().optionValueTrue : styles().optionValueFalse, _v$28 = styles().optionRow, _v$29 = styles().optionLabel, _v$30 = reg().options.stopPropagation ? styles().optionValueTrue : styles().optionValueFalse, _v$31 = styles().optionRow, _v$32 = styles().optionLabel, _v$33 = reg().options.ignoreInputs !== false ? styles().optionValueTrue : styles().optionValueFalse, _v$34 = styles().optionRow, _v$35 = styles().optionLabel, _v$36 = reg().options.requireReset ? styles().optionValueTrue : styles().optionValueFalse, _v$37 = styles().optionRow, _v$38 = styles().optionLabel, _v$39 = styles().optionValue, _v$40 = styles().optionRow, _v$41 = styles().optionLabel, _v$42 = reg().hasFired ? styles().optionValueTrue : styles().optionValueFalse;
190
+ _v$11 !== _p$.e && className(_el$10, _p$.e = _v$11);
191
+ _v$12 !== _p$.t && className(_el$11, _p$.t = _v$12);
192
+ _v$13 !== _p$.a && className(_el$12, _p$.a = _v$13);
193
+ _v$14 !== _p$.o && className(_el$13, _p$.o = _v$14);
194
+ _v$15 !== _p$.i && className(_el$14, _p$.i = _v$15);
195
+ _v$16 !== _p$.n && className(_el$15, _p$.n = _v$16);
196
+ _v$17 !== _p$.s && className(_el$16, _p$.s = _v$17);
197
+ _v$18 !== _p$.h && className(_el$17, _p$.h = _v$18);
198
+ _v$19 !== _p$.r && className(_el$19, _p$.r = _v$19);
199
+ _v$20 !== _p$.d && className(_el$20, _p$.d = _v$20);
200
+ _v$21 !== _p$.l && className(_el$21, _p$.l = _v$21);
201
+ _v$22 !== _p$.u && className(_el$22, _p$.u = _v$22);
202
+ _v$23 !== _p$.c && className(_el$23, _p$.c = _v$23);
203
+ _v$24 !== _p$.w && className(_el$24, _p$.w = _v$24);
204
+ _v$25 !== _p$.m && className(_el$25, _p$.m = _v$25);
205
+ _v$26 !== _p$.f && className(_el$26, _p$.f = _v$26);
206
+ _v$27 !== _p$.y && className(_el$27, _p$.y = _v$27);
207
+ _v$28 !== _p$.g && className(_el$28, _p$.g = _v$28);
208
+ _v$29 !== _p$.p && className(_el$29, _p$.p = _v$29);
209
+ _v$30 !== _p$.b && className(_el$30, _p$.b = _v$30);
210
+ _v$31 !== _p$.T && className(_el$31, _p$.T = _v$31);
211
+ _v$32 !== _p$.A && className(_el$32, _p$.A = _v$32);
212
+ _v$33 !== _p$.O && className(_el$33, _p$.O = _v$33);
213
+ _v$34 !== _p$.I && className(_el$34, _p$.I = _v$34);
214
+ _v$35 !== _p$.S && className(_el$35, _p$.S = _v$35);
215
+ _v$36 !== _p$.W && className(_el$36, _p$.W = _v$36);
216
+ _v$37 !== _p$.C && className(_el$37, _p$.C = _v$37);
217
+ _v$38 !== _p$.B && className(_el$38, _p$.B = _v$38);
218
+ _v$39 !== _p$.v && className(_el$39, _p$.v = _v$39);
219
+ _v$40 !== _p$.k && className(_el$40, _p$.k = _v$40);
220
+ _v$41 !== _p$.x && className(_el$41, _p$.x = _v$41);
221
+ _v$42 !== _p$.j && className(_el$42, _p$.j = _v$42);
222
+ return _p$;
223
+ }, {
224
+ e: void 0,
225
+ t: void 0,
226
+ a: void 0,
227
+ o: void 0,
228
+ i: void 0,
229
+ n: void 0,
230
+ s: void 0,
231
+ h: void 0,
232
+ r: void 0,
233
+ d: void 0,
234
+ l: void 0,
235
+ u: void 0,
236
+ c: void 0,
237
+ w: void 0,
238
+ m: void 0,
239
+ f: void 0,
240
+ y: void 0,
241
+ g: void 0,
242
+ p: void 0,
243
+ b: void 0,
244
+ T: void 0,
245
+ A: void 0,
246
+ O: void 0,
247
+ I: void 0,
248
+ S: void 0,
249
+ W: void 0,
250
+ C: void 0,
251
+ B: void 0,
252
+ v: void 0,
253
+ k: void 0,
254
+ x: void 0,
255
+ j: void 0
256
+ });
257
+ return _el$10;
258
+ })()];
259
+ }
260
+ }));
261
+ effect(() => className(_el$, styles().stateDetails));
262
+ return _el$;
263
+ })();
264
+ }
265
+
266
+ //#endregion
267
+ export { DetailsPanel };
268
+ //# sourceMappingURL=DetailsPanel.js.map