@becklyn/next 2.0.1 → 2.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.
@@ -0,0 +1,3 @@
1
+ import { DependencyList } from "react";
2
+ export declare const useShortcut: (key: string | string[], callback: (e: KeyboardEvent) => void, deps?: DependencyList) => void;
3
+ //# sourceMappingURL=shortcut.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortcut.d.ts","sourceRoot":"","sources":["../../../lib/shortcut.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAa,MAAM,OAAO,CAAC;AAElD,eAAO,MAAM,WAAW,GACpB,KAAK,MAAM,GAAG,MAAM,EAAE,EACtB,UAAU,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,EACpC,OAAO,cAAc,SAkCxB,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useShortcut = void 0;
4
+ const react_1 = require("react");
5
+ const useShortcut = (key, callback, deps) => {
6
+ (0, react_1.useEffect)(() => {
7
+ const onKeyDown = (e) => {
8
+ let input = "";
9
+ if (e.metaKey) {
10
+ input += "meta-";
11
+ }
12
+ if (e.altKey) {
13
+ input += "alt-";
14
+ }
15
+ if (e.shiftKey) {
16
+ input += "shift-";
17
+ }
18
+ if (e.ctrlKey) {
19
+ input += "ctrl-";
20
+ }
21
+ input += e.key;
22
+ console.log(input);
23
+ if (Array.isArray(key) ? key.includes(input) : input === key) {
24
+ callback(e);
25
+ }
26
+ };
27
+ document.addEventListener("keydown", onKeyDown);
28
+ return () => document.removeEventListener("keydown", onKeyDown);
29
+ // eslint-disable-next-line react-hooks/exhaustive-deps
30
+ }, deps);
31
+ };
32
+ exports.useShortcut = useShortcut;
@@ -0,0 +1,3 @@
1
+ import { DependencyList } from "react";
2
+ export declare const useShortcut: (key: string | string[], callback: (e: KeyboardEvent) => void, deps?: DependencyList) => void;
3
+ //# sourceMappingURL=shortcut.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortcut.d.ts","sourceRoot":"","sources":["../../../lib/shortcut.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAa,MAAM,OAAO,CAAC;AAElD,eAAO,MAAM,WAAW,GACpB,KAAK,MAAM,GAAG,MAAM,EAAE,EACtB,UAAU,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,EACpC,OAAO,cAAc,SAkCxB,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useShortcut = void 0;
4
+ const react_1 = require("react");
5
+ const useShortcut = (key, callback, deps) => {
6
+ (0, react_1.useEffect)(() => {
7
+ const onKeyDown = (e) => {
8
+ let input = "";
9
+ if (e.metaKey) {
10
+ input += "meta-";
11
+ }
12
+ if (e.altKey) {
13
+ input += "alt-";
14
+ }
15
+ if (e.shiftKey) {
16
+ input += "shift-";
17
+ }
18
+ if (e.ctrlKey) {
19
+ input += "ctrl-";
20
+ }
21
+ input += e.key;
22
+ console.log(input);
23
+ if (Array.isArray(key) ? key.includes(input) : input === key) {
24
+ callback(e);
25
+ }
26
+ };
27
+ document.addEventListener("keydown", onKeyDown);
28
+ return () => document.removeEventListener("keydown", onKeyDown);
29
+ // eslint-disable-next-line react-hooks/exhaustive-deps
30
+ }, deps);
31
+ };
32
+ exports.useShortcut = useShortcut;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@becklyn/next",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "lint": "eslint . --max-warnings 0 && prettier --check \"./**/*.{ts,tsx}\"",
@@ -9,18 +9,18 @@
9
9
  "prepublishOnly": "npm run lint && npm run build"
10
10
  },
11
11
  "dependencies": {
12
- "@contentful/rich-text-react-renderer": "^16.0.1",
12
+ "@contentful/rich-text-react-renderer": "^16.0.2",
13
13
  "keen-slider": "^6.8.6",
14
- "sass": "^1.89.1"
14
+ "sass": "^1.89.2"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@becklyn/eslint": "*",
18
18
  "@becklyn/tsconfig": "*",
19
- "@contentful/rich-text-types": "^17.0.0",
20
- "@types/node": "^22.15.29",
21
- "@types/react": "^19.1.6",
22
- "@types/react-dom": "^19.1.5",
23
- "next": "^15.3.3",
19
+ "@contentful/rich-text-types": "^17.0.1",
20
+ "@types/node": "^22.15.34",
21
+ "@types/react": "^19.1.8",
22
+ "@types/react-dom": "^19.1.6",
23
+ "next": "^15.3.4",
24
24
  "react": "^19.1.0",
25
25
  "typescript": "^5.8.3"
26
26
  },