@pyreon/hotkeys 0.18.0 → 0.20.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.
@@ -5386,7 +5386,7 @@ var drawChart = (function (exports) {
5386
5386
  </script>
5387
5387
  <script>
5388
5388
  /*<!--*/
5389
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"uid":"7a21fee1-1","name":"parse.ts"},{"uid":"7a21fee1-3","name":"registry.ts"},{"uid":"7a21fee1-5","name":"use-hotkey.ts"},{"uid":"7a21fee1-7","name":"use-hotkey-scope.ts"},{"uid":"7a21fee1-9","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"7a21fee1-1":{"renderedLength":1941,"gzipLength":838,"brotliLength":0,"metaUid":"7a21fee1-0"},"7a21fee1-3":{"renderedLength":3232,"gzipLength":1141,"brotliLength":0,"metaUid":"7a21fee1-2"},"7a21fee1-5":{"renderedLength":496,"gzipLength":295,"brotliLength":0,"metaUid":"7a21fee1-4"},"7a21fee1-7":{"renderedLength":421,"gzipLength":264,"brotliLength":0,"metaUid":"7a21fee1-6"},"7a21fee1-9":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"7a21fee1-8"}},"nodeMetas":{"7a21fee1-0":{"id":"/src/parse.ts","moduleParts":{"index.js":"7a21fee1-1"},"imported":[],"importedBy":[{"uid":"7a21fee1-8"},{"uid":"7a21fee1-2"}]},"7a21fee1-2":{"id":"/src/registry.ts","moduleParts":{"index.js":"7a21fee1-3"},"imported":[{"uid":"7a21fee1-11"},{"uid":"7a21fee1-0"}],"importedBy":[{"uid":"7a21fee1-8"},{"uid":"7a21fee1-4"},{"uid":"7a21fee1-6"}]},"7a21fee1-4":{"id":"/src/use-hotkey.ts","moduleParts":{"index.js":"7a21fee1-5"},"imported":[{"uid":"7a21fee1-10"},{"uid":"7a21fee1-2"}],"importedBy":[{"uid":"7a21fee1-8"}]},"7a21fee1-6":{"id":"/src/use-hotkey-scope.ts","moduleParts":{"index.js":"7a21fee1-7"},"imported":[{"uid":"7a21fee1-10"},{"uid":"7a21fee1-2"}],"importedBy":[{"uid":"7a21fee1-8"}]},"7a21fee1-8":{"id":"/src/index.ts","moduleParts":{"index.js":"7a21fee1-9"},"imported":[{"uid":"7a21fee1-4"},{"uid":"7a21fee1-6"},{"uid":"7a21fee1-2"},{"uid":"7a21fee1-0"}],"importedBy":[],"isEntry":true},"7a21fee1-10":{"id":"@pyreon/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"7a21fee1-4"},{"uid":"7a21fee1-6"}]},"7a21fee1-11":{"id":"@pyreon/reactivity","moduleParts":{},"imported":[],"importedBy":[{"uid":"7a21fee1-2"}]}},"env":{"rollup":"4.23.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
5389
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"uid":"fb969f01-1","name":"parse.ts"},{"uid":"fb969f01-3","name":"registry.ts"},{"uid":"fb969f01-5","name":"use-hotkey.ts"},{"uid":"fb969f01-7","name":"use-hotkey-scope.ts"},{"uid":"fb969f01-9","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"fb969f01-1":{"renderedLength":1941,"gzipLength":838,"brotliLength":0,"metaUid":"fb969f01-0"},"fb969f01-3":{"renderedLength":3276,"gzipLength":1146,"brotliLength":0,"metaUid":"fb969f01-2"},"fb969f01-5":{"renderedLength":496,"gzipLength":295,"brotliLength":0,"metaUid":"fb969f01-4"},"fb969f01-7":{"renderedLength":421,"gzipLength":264,"brotliLength":0,"metaUid":"fb969f01-6"},"fb969f01-9":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"fb969f01-8"}},"nodeMetas":{"fb969f01-0":{"id":"/src/parse.ts","moduleParts":{"index.js":"fb969f01-1"},"imported":[],"importedBy":[{"uid":"fb969f01-8"},{"uid":"fb969f01-2"}]},"fb969f01-2":{"id":"/src/registry.ts","moduleParts":{"index.js":"fb969f01-3"},"imported":[{"uid":"fb969f01-11"},{"uid":"fb969f01-0"}],"importedBy":[{"uid":"fb969f01-8"},{"uid":"fb969f01-4"},{"uid":"fb969f01-6"}]},"fb969f01-4":{"id":"/src/use-hotkey.ts","moduleParts":{"index.js":"fb969f01-5"},"imported":[{"uid":"fb969f01-10"},{"uid":"fb969f01-2"}],"importedBy":[{"uid":"fb969f01-8"}]},"fb969f01-6":{"id":"/src/use-hotkey-scope.ts","moduleParts":{"index.js":"fb969f01-7"},"imported":[{"uid":"fb969f01-10"},{"uid":"fb969f01-2"}],"importedBy":[{"uid":"fb969f01-8"}]},"fb969f01-8":{"id":"/src/index.ts","moduleParts":{"index.js":"fb969f01-9"},"imported":[{"uid":"fb969f01-4"},{"uid":"fb969f01-6"},{"uid":"fb969f01-2"},{"uid":"fb969f01-0"}],"importedBy":[],"isEntry":true},"fb969f01-10":{"id":"@pyreon/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"fb969f01-4"},{"uid":"fb969f01-6"}]},"fb969f01-11":{"id":"@pyreon/reactivity","moduleParts":{},"imported":[],"importedBy":[{"uid":"fb969f01-2"}]}},"env":{"rollup":"4.23.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
5390
5390
 
5391
5391
  const run = () => {
5392
5392
  const width = window.innerWidth;
package/lib/index.js CHANGED
@@ -107,6 +107,7 @@ function attachListener() {
107
107
  window.addEventListener("keydown", keydownHandler);
108
108
  }
109
109
  function detachListener() {
110
+ if (typeof window === "undefined") return;
110
111
  if (!listenerAttached || !keydownHandler) return;
111
112
  window.removeEventListener("keydown", keydownHandler);
112
113
  listenerAttached = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyreon/hotkeys",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "Reactive keyboard shortcut management for Pyreon — scope-aware, conflict detection",
5
5
  "homepage": "https://github.com/pyreon/pyreon/tree/main/packages/hotkeys#readme",
6
6
  "bugs": {
@@ -43,13 +43,13 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@happy-dom/global-registrator": "^20.8.9",
46
- "@pyreon/core": "^0.18.0",
46
+ "@pyreon/core": "^0.20.0",
47
47
  "@pyreon/manifest": "0.13.1",
48
- "@pyreon/reactivity": "^0.18.0",
48
+ "@pyreon/reactivity": "^0.20.0",
49
49
  "@vitus-labs/tools-lint": "^2.3.0"
50
50
  },
51
51
  "dependencies": {
52
- "@pyreon/core": "^0.18.0",
53
- "@pyreon/reactivity": "^0.18.0"
52
+ "@pyreon/core": "^0.20.0",
53
+ "@pyreon/reactivity": "^0.20.0"
54
54
  }
55
55
  }
package/src/registry.ts CHANGED
@@ -68,6 +68,7 @@ function attachListener(): void {
68
68
  }
69
69
 
70
70
  function detachListener(): void {
71
+ if (typeof window === 'undefined') return
71
72
  if (!listenerAttached || !keydownHandler) return
72
73
  window.removeEventListener('keydown', keydownHandler)
73
74
  listenerAttached = false