react-hotkeys-hook 4.0.1 → 4.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-hotkeys-hook",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "repository": "https://JohannesKlauss@github.com/JohannesKlauss/react-keymap-hook.git",
5
5
  "homepage": "https://johannesklauss.github.io/react-hotkeys-hook/",
6
6
  "author": "Johannes Klauss",
@@ -43,21 +43,21 @@
43
43
  "trailingComma": "es5"
44
44
  },
45
45
  "devDependencies": {
46
- "@babel/core": "7.18.9",
46
+ "@babel/core": "7.20.2",
47
47
  "@babel/plugin-proposal-class-properties": "7.18.6",
48
- "@babel/plugin-transform-react-jsx": "7.18.6",
49
- "@babel/preset-env": "7.18.9",
48
+ "@babel/plugin-transform-react-jsx": "7.19.0",
49
+ "@babel/preset-env": "7.20.2",
50
50
  "@babel/preset-react": "7.18.6",
51
51
  "@babel/preset-typescript": "7.18.6",
52
52
  "@testing-library/jest-dom": "5.16.5",
53
53
  "@testing-library/react": "13.3.0",
54
54
  "@testing-library/react-hooks": "8.0.1",
55
55
  "@testing-library/user-event": "14.4.3",
56
- "@types/jest": "29.2.1",
56
+ "@types/jest": "29.2.2",
57
57
  "@types/lodash": "^4.14.182",
58
58
  "@types/react": "18.0.15",
59
59
  "@types/react-dom": "18.0.6",
60
- "esbuild": "0.14.49",
60
+ "esbuild": "0.15.13",
61
61
  "eslint-plugin-prettier": "4.2.1",
62
62
  "jest": "29.2.2",
63
63
  "jest-environment-jsdom": "29.2.2",
@@ -39,13 +39,15 @@ export function removeFromCurrentlyPressedKeys(key: string | string[]): void {
39
39
  }
40
40
 
41
41
  (() => {
42
- window.addEventListener('DOMContentLoaded', () => {
43
- document.addEventListener('keydown', e => {
44
- pushToCurrentlyPressedKeys(e.key)
42
+ if (typeof window !== 'undefined') {
43
+ window.addEventListener('DOMContentLoaded', () => {
44
+ document.addEventListener('keydown', e => {
45
+ pushToCurrentlyPressedKeys(e.key)
46
+ })
47
+
48
+ document.addEventListener('keyup', e => {
49
+ removeFromCurrentlyPressedKeys(e.key)
50
+ })
45
51
  })
46
-
47
- document.addEventListener('keyup', e => {
48
- removeFromCurrentlyPressedKeys(e.key)
49
- })
50
- })
52
+ }
51
53
  })()
@@ -1,5 +1,5 @@
1
1
  import { useRef } from 'react'
2
- import { isEqual } from 'lodash'
2
+ import isEqual from 'lodash/isEqual'
3
3
 
4
4
  export default function useDeepEqualMemo<T>(value: T) {
5
5
  const ref = useRef<T | undefined>(undefined)