browser-shortcuts 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.
package/dist/vue.d.cts ADDED
@@ -0,0 +1,101 @@
1
+ import { InjectionKey, App } from 'vue';
2
+
3
+ declare const KEYBINDS: {
4
+ 'CTRL+SHIFT+F': "toggleFullScreen";
5
+ 'CMD+SHIFT+F': "toggleFullScreen";
6
+ 'CTRL+SHIFT+G': "toggleGrid";
7
+ 'CMD+SHIFT+G': "toggleGrid";
8
+ 'CTRL+SHIFT+H': "toggleHelp";
9
+ 'CMD+SHIFT+H': "toggleHelp";
10
+ ESCAPE: "closeOverlay";
11
+ 'CTRL+Z': "undo";
12
+ 'CMD+Z': "undo";
13
+ 'CTRL+SHIFT+Z': "redo";
14
+ 'CMD+SHIFT+Z': "redo";
15
+ 'CTRL+Y': "redo";
16
+ DELETE: "delete";
17
+ BACKSPACE: "delete";
18
+ 'CTRL+A': "selectAll";
19
+ 'CMD+A': "selectAll";
20
+ 'CTRL+C': "copy";
21
+ 'CMD+C': "copy";
22
+ 'CTRL+V': "paste";
23
+ 'CMD+V': "paste";
24
+ 'CTRL+S': "save";
25
+ 'CMD+S': "save";
26
+ DOUBLE_LEFT_BUTTON: "zoomIn";
27
+ LEFT_BUTTON: "leftMouseButton";
28
+ MIDDLE_BUTTON: "middleMouseButton";
29
+ RIGHT_BUTTON: "rightMouseButton";
30
+ };
31
+ /** A key combination string understood by {@link KEYBINDS}, e.g. `"CTRL+SHIFT+F"`. */
32
+ type Keybind = keyof typeof KEYBINDS;
33
+
34
+ /** Callback invoked when a bound shortcut fires. */
35
+ type ShortcutListener = (event: Event) => void;
36
+ /**
37
+ * Framework-agnostic keyboard, mouse and wheel shortcut dispatcher.
38
+ *
39
+ * Listens for the most commonly used input events (`keydown`, `keyup`,
40
+ * `mousedown`, `mouseup`, `dblclick`, `contextmenu` and `wheel`) on a target
41
+ * (`window` by default), converts each into a {@link Keybind} string, and
42
+ * dispatches it to any listeners registered with {@link on} as well as the
43
+ * static bindings declared in `KEYBINDS`.
44
+ *
45
+ * Every framework adapter in this package (React, Vue, Svelte, Angular,
46
+ * Solid, Preact) wraps a single instance of this class in that framework's
47
+ * own idioms (context/provider, composable, store, service, etc.).
48
+ */
49
+ declare class ShortcutsManager {
50
+ private listeners;
51
+ private target;
52
+ private cleanup;
53
+ /** Registers `callback` to run whenever `shortcut` is triggered. */
54
+ on: (shortcut: Keybind, callback: ShortcutListener) => void;
55
+ /** Removes a `callback` previously registered with {@link on}. */
56
+ off: (shortcut: Keybind, callback: ShortcutListener) => void;
57
+ private emit;
58
+ private triggerShortcut;
59
+ /**
60
+ * Starts listening on `target` (`window` by default). Returns a disposer
61
+ * that removes the listeners; safe to call multiple times.
62
+ */
63
+ attach: (target?: EventTarget) => (() => void);
64
+ /** Stops listening. Safe to call even if {@link attach} was never called. */
65
+ detach: () => void;
66
+ }
67
+
68
+ declare const ShortcutsInjectionKey: InjectionKey<ShortcutsManager>;
69
+ /**
70
+ * Vue plugin that installs a single {@link ShortcutsManager} for the whole
71
+ * app and attaches its listeners for the app's lifetime.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * import { createApp } from 'vue';
76
+ * import { ShortcutsPlugin } from 'browser-shortcuts/vue';
77
+ *
78
+ * createApp(App).use(ShortcutsPlugin).mount('#app');
79
+ * ```
80
+ */
81
+ declare const ShortcutsPlugin: {
82
+ install(app: App): void;
83
+ };
84
+ /**
85
+ * Returns the app-wide {@link ShortcutsManager}. If the plugin was not
86
+ * installed (e.g. in a component test), a local instance is created and
87
+ * attached/detached with the component's lifecycle.
88
+ */
89
+ declare function useShortcutsManager(): ShortcutsManager;
90
+ /**
91
+ * Subscribes `callback` to `shortcut` for as long as the calling component
92
+ * is mounted.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * useShortcut('CTRL+SHIFT+F', () => (fullScreen.value = !fullScreen.value));
97
+ * ```
98
+ */
99
+ declare function useShortcut(shortcut: Keybind, callback: ShortcutListener): void;
100
+
101
+ export { type ShortcutListener, ShortcutsInjectionKey, ShortcutsPlugin, useShortcut, useShortcutsManager };
package/dist/vue.d.ts ADDED
@@ -0,0 +1,101 @@
1
+ import { InjectionKey, App } from 'vue';
2
+
3
+ declare const KEYBINDS: {
4
+ 'CTRL+SHIFT+F': "toggleFullScreen";
5
+ 'CMD+SHIFT+F': "toggleFullScreen";
6
+ 'CTRL+SHIFT+G': "toggleGrid";
7
+ 'CMD+SHIFT+G': "toggleGrid";
8
+ 'CTRL+SHIFT+H': "toggleHelp";
9
+ 'CMD+SHIFT+H': "toggleHelp";
10
+ ESCAPE: "closeOverlay";
11
+ 'CTRL+Z': "undo";
12
+ 'CMD+Z': "undo";
13
+ 'CTRL+SHIFT+Z': "redo";
14
+ 'CMD+SHIFT+Z': "redo";
15
+ 'CTRL+Y': "redo";
16
+ DELETE: "delete";
17
+ BACKSPACE: "delete";
18
+ 'CTRL+A': "selectAll";
19
+ 'CMD+A': "selectAll";
20
+ 'CTRL+C': "copy";
21
+ 'CMD+C': "copy";
22
+ 'CTRL+V': "paste";
23
+ 'CMD+V': "paste";
24
+ 'CTRL+S': "save";
25
+ 'CMD+S': "save";
26
+ DOUBLE_LEFT_BUTTON: "zoomIn";
27
+ LEFT_BUTTON: "leftMouseButton";
28
+ MIDDLE_BUTTON: "middleMouseButton";
29
+ RIGHT_BUTTON: "rightMouseButton";
30
+ };
31
+ /** A key combination string understood by {@link KEYBINDS}, e.g. `"CTRL+SHIFT+F"`. */
32
+ type Keybind = keyof typeof KEYBINDS;
33
+
34
+ /** Callback invoked when a bound shortcut fires. */
35
+ type ShortcutListener = (event: Event) => void;
36
+ /**
37
+ * Framework-agnostic keyboard, mouse and wheel shortcut dispatcher.
38
+ *
39
+ * Listens for the most commonly used input events (`keydown`, `keyup`,
40
+ * `mousedown`, `mouseup`, `dblclick`, `contextmenu` and `wheel`) on a target
41
+ * (`window` by default), converts each into a {@link Keybind} string, and
42
+ * dispatches it to any listeners registered with {@link on} as well as the
43
+ * static bindings declared in `KEYBINDS`.
44
+ *
45
+ * Every framework adapter in this package (React, Vue, Svelte, Angular,
46
+ * Solid, Preact) wraps a single instance of this class in that framework's
47
+ * own idioms (context/provider, composable, store, service, etc.).
48
+ */
49
+ declare class ShortcutsManager {
50
+ private listeners;
51
+ private target;
52
+ private cleanup;
53
+ /** Registers `callback` to run whenever `shortcut` is triggered. */
54
+ on: (shortcut: Keybind, callback: ShortcutListener) => void;
55
+ /** Removes a `callback` previously registered with {@link on}. */
56
+ off: (shortcut: Keybind, callback: ShortcutListener) => void;
57
+ private emit;
58
+ private triggerShortcut;
59
+ /**
60
+ * Starts listening on `target` (`window` by default). Returns a disposer
61
+ * that removes the listeners; safe to call multiple times.
62
+ */
63
+ attach: (target?: EventTarget) => (() => void);
64
+ /** Stops listening. Safe to call even if {@link attach} was never called. */
65
+ detach: () => void;
66
+ }
67
+
68
+ declare const ShortcutsInjectionKey: InjectionKey<ShortcutsManager>;
69
+ /**
70
+ * Vue plugin that installs a single {@link ShortcutsManager} for the whole
71
+ * app and attaches its listeners for the app's lifetime.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * import { createApp } from 'vue';
76
+ * import { ShortcutsPlugin } from 'browser-shortcuts/vue';
77
+ *
78
+ * createApp(App).use(ShortcutsPlugin).mount('#app');
79
+ * ```
80
+ */
81
+ declare const ShortcutsPlugin: {
82
+ install(app: App): void;
83
+ };
84
+ /**
85
+ * Returns the app-wide {@link ShortcutsManager}. If the plugin was not
86
+ * installed (e.g. in a component test), a local instance is created and
87
+ * attached/detached with the component's lifecycle.
88
+ */
89
+ declare function useShortcutsManager(): ShortcutsManager;
90
+ /**
91
+ * Subscribes `callback` to `shortcut` for as long as the calling component
92
+ * is mounted.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * useShortcut('CTRL+SHIFT+F', () => (fullScreen.value = !fullScreen.value));
97
+ * ```
98
+ */
99
+ declare function useShortcut(shortcut: Keybind, callback: ShortcutListener): void;
100
+
101
+ export { type ShortcutListener, ShortcutsInjectionKey, ShortcutsPlugin, useShortcut, useShortcutsManager };
package/dist/vue.js ADDED
@@ -0,0 +1,277 @@
1
+ // src/config/shortcuts.ts
2
+ var KEYBINDS = {
3
+ "CTRL+SHIFT+F": "toggleFullScreen",
4
+ "CMD+SHIFT+F": "toggleFullScreen",
5
+ "CTRL+SHIFT+G": "toggleGrid",
6
+ "CMD+SHIFT+G": "toggleGrid",
7
+ "CTRL+SHIFT+H": "toggleHelp",
8
+ "CMD+SHIFT+H": "toggleHelp",
9
+ ESCAPE: "closeOverlay",
10
+ "CTRL+Z": "undo",
11
+ "CMD+Z": "undo",
12
+ "CTRL+SHIFT+Z": "redo",
13
+ "CMD+SHIFT+Z": "redo",
14
+ "CTRL+Y": "redo",
15
+ DELETE: "delete",
16
+ BACKSPACE: "delete",
17
+ "CTRL+A": "selectAll",
18
+ "CMD+A": "selectAll",
19
+ "CTRL+C": "copy",
20
+ "CMD+C": "copy",
21
+ "CTRL+V": "paste",
22
+ "CMD+V": "paste",
23
+ "CTRL+S": "save",
24
+ "CMD+S": "save",
25
+ DOUBLE_LEFT_BUTTON: "zoomIn",
26
+ LEFT_BUTTON: "leftMouseButton",
27
+ MIDDLE_BUTTON: "middleMouseButton",
28
+ RIGHT_BUTTON: "rightMouseButton"
29
+ };
30
+ var SHORTCUTS = {
31
+ toggleFullScreen: (event) => {
32
+ console.log("toggleFullScreen", event);
33
+ },
34
+ toggleGrid: (event) => {
35
+ console.log("toggleGrid", event);
36
+ },
37
+ toggleHelp: (event) => {
38
+ console.log("toggleHelp", event);
39
+ },
40
+ closeOverlay: (event) => {
41
+ console.log("closeOverlay", event);
42
+ },
43
+ undo: (event) => {
44
+ console.log("undo", event);
45
+ },
46
+ redo: (event) => {
47
+ console.log("redo", event);
48
+ },
49
+ delete: (event) => {
50
+ console.log("delete", event);
51
+ },
52
+ selectAll: (event) => {
53
+ console.log("selectAll", event);
54
+ },
55
+ copy: (event) => {
56
+ console.log("copy", event);
57
+ },
58
+ paste: (event) => {
59
+ console.log("paste", event);
60
+ },
61
+ save: (event) => {
62
+ console.log("save", event);
63
+ },
64
+ zoomIn: (event) => {
65
+ console.log("zoomIn", event);
66
+ },
67
+ leftMouseButton: (event) => {
68
+ console.log("leftMouseButton", event);
69
+ },
70
+ middleMouseButton: (event) => {
71
+ console.log("middleMouseButton", event);
72
+ },
73
+ rightMouseButton: (event) => {
74
+ console.log("rightMouseButton", event);
75
+ }
76
+ };
77
+ var shortcuts_default = KEYBINDS;
78
+
79
+ // src/utils/misc.ts
80
+ var IS_MAC = typeof navigator !== "undefined" && navigator.platform.toUpperCase().indexOf("MAC") >= 0;
81
+ var IS_NOT_TOUCH_DEVICE = (() => {
82
+ if (typeof window === "undefined" || typeof navigator === "undefined") {
83
+ return false;
84
+ }
85
+ return !("ontouchstart" in window || navigator.maxTouchPoints > 0 || "msMaxTouchPoints" in navigator && navigator.msMaxTouchPoints > 0);
86
+ })();
87
+ var MOUSE_BUTTONS = ["LEFT_BUTTON", "MIDDLE_BUTTON", "RIGHT_BUTTON"];
88
+ function buildShortcutString(key, event) {
89
+ return [
90
+ IS_MAC && event.metaKey ? "CMD" : "",
91
+ event.ctrlKey ? "CTRL" : "",
92
+ event.altKey ? "ALT" : "",
93
+ event.shiftKey ? "SHIFT" : "",
94
+ key.toUpperCase()
95
+ ].filter(Boolean).join("+");
96
+ }
97
+
98
+ // src/core/shortcuts-manager.ts
99
+ var ShortcutsManager = class {
100
+ constructor() {
101
+ this.listeners = /* @__PURE__ */ new Map();
102
+ /** Registers `callback` to run whenever `shortcut` is triggered. */
103
+ this.on = (shortcut, callback) => {
104
+ var _a;
105
+ if (!this.listeners.has(shortcut)) {
106
+ this.listeners.set(shortcut, /* @__PURE__ */ new Set());
107
+ }
108
+ (_a = this.listeners.get(shortcut)) == null ? void 0 : _a.add(callback);
109
+ };
110
+ /** Removes a `callback` previously registered with {@link on}. */
111
+ this.off = (shortcut, callback) => {
112
+ var _a;
113
+ (_a = this.listeners.get(shortcut)) == null ? void 0 : _a.delete(callback);
114
+ };
115
+ this.emit = (shortcut, event) => {
116
+ var _a;
117
+ (_a = this.listeners.get(shortcut)) == null ? void 0 : _a.forEach((callback) => callback(event));
118
+ };
119
+ this.triggerShortcut = (shortcut, event) => {
120
+ var _a, _b;
121
+ this.emit(shortcut, event);
122
+ const action = shortcuts_default[shortcut];
123
+ if (action) {
124
+ event.preventDefault();
125
+ if (typeof action === "string") {
126
+ (_b = (_a = SHORTCUTS)[action]) == null ? void 0 : _b.call(_a, event);
127
+ } else {
128
+ action(event);
129
+ }
130
+ }
131
+ };
132
+ /**
133
+ * Starts listening on `target` (`window` by default). Returns a disposer
134
+ * that removes the listeners; safe to call multiple times.
135
+ */
136
+ this.attach = (target = window) => {
137
+ this.detach();
138
+ this.target = target;
139
+ const handleKeyDown = (event) => {
140
+ const keyboardEvent = event;
141
+ this.triggerShortcut(
142
+ buildShortcutString(keyboardEvent.key, keyboardEvent),
143
+ event
144
+ );
145
+ };
146
+ const handleKeyUp = (event) => {
147
+ const keyboardEvent = event;
148
+ this.triggerShortcut(
149
+ buildShortcutString(`${keyboardEvent.key}_UP`, keyboardEvent),
150
+ event
151
+ );
152
+ };
153
+ const handleMouseDown = (event) => {
154
+ const mouseEvent = event;
155
+ this.triggerShortcut(
156
+ buildShortcutString(MOUSE_BUTTONS[mouseEvent.button], mouseEvent),
157
+ event
158
+ );
159
+ };
160
+ const handleMouseUp = (event) => {
161
+ const mouseEvent = event;
162
+ this.triggerShortcut(
163
+ buildShortcutString(
164
+ `${MOUSE_BUTTONS[mouseEvent.button]}_UP`,
165
+ mouseEvent
166
+ ),
167
+ event
168
+ );
169
+ };
170
+ const handleDoubleClick = (event) => {
171
+ const mouseEvent = event;
172
+ this.triggerShortcut(
173
+ buildShortcutString(
174
+ `DOUBLE_${MOUSE_BUTTONS[mouseEvent.button]}`,
175
+ mouseEvent
176
+ ),
177
+ event
178
+ );
179
+ };
180
+ const handleContextMenu = (event) => {
181
+ this.triggerShortcut(
182
+ buildShortcutString("RIGHT_BUTTON", event),
183
+ event
184
+ );
185
+ };
186
+ const handleWheel = (event) => {
187
+ const wheelEvent = event;
188
+ const direction = wheelEvent.deltaY < 0 ? "WHEEL_UP" : "WHEEL_DOWN";
189
+ this.triggerShortcut(buildShortcutString(direction, wheelEvent), event);
190
+ };
191
+ target.addEventListener("keydown", handleKeyDown);
192
+ target.addEventListener("keyup", handleKeyUp);
193
+ target.addEventListener("mousedown", handleMouseDown);
194
+ target.addEventListener("mouseup", handleMouseUp);
195
+ target.addEventListener("dblclick", handleDoubleClick);
196
+ target.addEventListener("contextmenu", handleContextMenu);
197
+ target.addEventListener("wheel", handleWheel, { passive: true });
198
+ this.cleanup = () => {
199
+ target.removeEventListener("keydown", handleKeyDown);
200
+ target.removeEventListener("keyup", handleKeyUp);
201
+ target.removeEventListener("mousedown", handleMouseDown);
202
+ target.removeEventListener("mouseup", handleMouseUp);
203
+ target.removeEventListener("dblclick", handleDoubleClick);
204
+ target.removeEventListener("contextmenu", handleContextMenu);
205
+ target.removeEventListener("wheel", handleWheel);
206
+ this.target = void 0;
207
+ this.cleanup = void 0;
208
+ };
209
+ return this.cleanup;
210
+ };
211
+ /** Stops listening. Safe to call even if {@link attach} was never called. */
212
+ this.detach = () => {
213
+ var _a;
214
+ (_a = this.cleanup) == null ? void 0 : _a.call(this);
215
+ };
216
+ }
217
+ };
218
+
219
+ // src/vue/index.ts
220
+ import {
221
+ getCurrentInstance,
222
+ inject,
223
+ onBeforeUnmount,
224
+ onMounted,
225
+ provide,
226
+ watch
227
+ } from "vue";
228
+ var ShortcutsInjectionKey = /* @__PURE__ */ Symbol(
229
+ "browser-shortcuts"
230
+ );
231
+ var ShortcutsPlugin = {
232
+ install(app) {
233
+ const manager = new ShortcutsManager();
234
+ manager.attach();
235
+ app.provide(ShortcutsInjectionKey, manager);
236
+ }
237
+ };
238
+ function useShortcutsManager() {
239
+ const injected = inject(ShortcutsInjectionKey, null);
240
+ if (injected) {
241
+ return injected;
242
+ }
243
+ const manager = new ShortcutsManager();
244
+ if (getCurrentInstance()) {
245
+ onMounted(() => {
246
+ const dispose = manager.attach();
247
+ onBeforeUnmount(dispose);
248
+ });
249
+ provide(ShortcutsInjectionKey, manager);
250
+ } else {
251
+ manager.attach();
252
+ }
253
+ return manager;
254
+ }
255
+ function useShortcut(shortcut, callback) {
256
+ const manager = useShortcutsManager();
257
+ onMounted(() => {
258
+ manager.on(shortcut, callback);
259
+ });
260
+ onBeforeUnmount(() => {
261
+ manager.off(shortcut, callback);
262
+ });
263
+ watch(
264
+ () => shortcut,
265
+ (next, prev) => {
266
+ manager.off(prev, callback);
267
+ manager.on(next, callback);
268
+ }
269
+ );
270
+ }
271
+ export {
272
+ ShortcutsInjectionKey,
273
+ ShortcutsPlugin,
274
+ useShortcut,
275
+ useShortcutsManager
276
+ };
277
+ //# sourceMappingURL=vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/config/shortcuts.ts","../src/utils/misc.ts","../src/core/shortcuts-manager.ts","../src/vue/index.ts"],"sourcesContent":["/**\n * Maps a keybind string (e.g. `\"CTRL+SHIFT+F\"`) to either the name of a\n * {@link SHORTCUTS} entry or an inline handler.\n *\n * Prefer referencing a named entry in {@link SHORTCUTS} so the same action\n * can be triggered programmatically (e.g. from a command palette) using the\n * same {@link Shortcut} name.\n */\nexport type KeybindAction = Shortcut | ((event: Event) => void);\n\nconst KEYBINDS = {\n 'CTRL+SHIFT+F': 'toggleFullScreen',\n 'CMD+SHIFT+F': 'toggleFullScreen',\n 'CTRL+SHIFT+G': 'toggleGrid',\n 'CMD+SHIFT+G': 'toggleGrid',\n 'CTRL+SHIFT+H': 'toggleHelp',\n 'CMD+SHIFT+H': 'toggleHelp',\n ESCAPE: 'closeOverlay',\n 'CTRL+Z': 'undo',\n 'CMD+Z': 'undo',\n 'CTRL+SHIFT+Z': 'redo',\n 'CMD+SHIFT+Z': 'redo',\n 'CTRL+Y': 'redo',\n DELETE: 'delete',\n BACKSPACE: 'delete',\n 'CTRL+A': 'selectAll',\n 'CMD+A': 'selectAll',\n 'CTRL+C': 'copy',\n 'CMD+C': 'copy',\n 'CTRL+V': 'paste',\n 'CMD+V': 'paste',\n 'CTRL+S': 'save',\n 'CMD+S': 'save',\n DOUBLE_LEFT_BUTTON: 'zoomIn',\n LEFT_BUTTON: 'leftMouseButton',\n MIDDLE_BUTTON: 'middleMouseButton',\n RIGHT_BUTTON: 'rightMouseButton',\n} satisfies { [key: string]: KeybindAction };\n\n/**\n * Named shortcut handlers, keyed by {@link Shortcut} name. Referenced from\n * {@link KEYBINDS} by name so the same action can be triggered from\n * multiple bindings (or invoked directly, outside of any input event).\n */\nexport const SHORTCUTS = {\n toggleFullScreen: (event: Event) => {\n console.log('toggleFullScreen', event);\n },\n toggleGrid: (event: Event) => {\n console.log('toggleGrid', event);\n },\n toggleHelp: (event: Event) => {\n console.log('toggleHelp', event);\n },\n closeOverlay: (event: Event) => {\n console.log('closeOverlay', event);\n },\n undo: (event: Event) => {\n console.log('undo', event);\n },\n redo: (event: Event) => {\n console.log('redo', event);\n },\n delete: (event: Event) => {\n console.log('delete', event);\n },\n selectAll: (event: Event) => {\n console.log('selectAll', event);\n },\n copy: (event: Event) => {\n console.log('copy', event);\n },\n paste: (event: Event) => {\n console.log('paste', event);\n },\n save: (event: Event) => {\n console.log('save', event);\n },\n zoomIn: (event: Event) => {\n console.log('zoomIn', event);\n },\n leftMouseButton: (event: Event) => {\n console.log('leftMouseButton', event);\n },\n middleMouseButton: (event: Event) => {\n console.log('middleMouseButton', event);\n },\n rightMouseButton: (event: Event) => {\n console.log('rightMouseButton', event);\n },\n};\n\n/** A key combination string understood by {@link KEYBINDS}, e.g. `\"CTRL+SHIFT+F\"`. */\nexport type Keybind = keyof typeof KEYBINDS;\n\n/** The name of a handler registered in {@link SHORTCUTS}. */\nexport type Shortcut = keyof typeof SHORTCUTS;\n\nexport default KEYBINDS;\n","import type { Keybind } from '@/config';\n\n/** Whether the current platform reports itself as macOS (used to prefer `CMD` over `CTRL`). */\nexport const IS_MAC =\n typeof navigator !== 'undefined' &&\n navigator.platform.toUpperCase().indexOf('MAC') >= 0;\n\n/** Whether the current device supports mouse/keyboard input rather than touch only. */\nexport const IS_NOT_TOUCH_DEVICE = (() => {\n if (typeof window === 'undefined' || typeof navigator === 'undefined') {\n return false;\n }\n return !(\n 'ontouchstart' in window ||\n navigator.maxTouchPoints > 0 ||\n ('msMaxTouchPoints' in navigator &&\n (navigator.msMaxTouchPoints as number) > 0)\n );\n})();\n\n/** Names for `MouseEvent.button` values 0, 1 and 2, in that order. */\nexport const MOUSE_BUTTONS = ['LEFT_BUTTON', 'MIDDLE_BUTTON', 'RIGHT_BUTTON'];\n\n/**\n * Builds a {@link Keybind} string (e.g. `\"CTRL+SHIFT+F\"`) from a base key\n * name and the modifier keys held during the triggering event.\n *\n * @param key - The key or button name, e.g. `\"F\"` or `\"LEFT_BUTTON\"`.\n * @param event - The DOM event the key combination is derived from.\n */\nexport function buildShortcutString(\n key: string,\n event: KeyboardEvent | MouseEvent | WheelEvent,\n): Keybind {\n return [\n IS_MAC && event.metaKey ? 'CMD' : '',\n event.ctrlKey ? 'CTRL' : '',\n event.altKey ? 'ALT' : '',\n event.shiftKey ? 'SHIFT' : '',\n key.toUpperCase(),\n ]\n .filter(Boolean)\n .join('+') as Keybind;\n}\n","import KEYBINDS, {\n SHORTCUTS,\n type Keybind,\n type KeybindAction,\n type Shortcut,\n} from '@/config/shortcuts';\nimport { buildShortcutString, MOUSE_BUTTONS } from '@/utils/misc';\n\n/** Callback invoked when a bound shortcut fires. */\nexport type ShortcutListener = (event: Event) => void;\n\n/**\n * Framework-agnostic keyboard, mouse and wheel shortcut dispatcher.\n *\n * Listens for the most commonly used input events (`keydown`, `keyup`,\n * `mousedown`, `mouseup`, `dblclick`, `contextmenu` and `wheel`) on a target\n * (`window` by default), converts each into a {@link Keybind} string, and\n * dispatches it to any listeners registered with {@link on} as well as the\n * static bindings declared in `KEYBINDS`.\n *\n * Every framework adapter in this package (React, Vue, Svelte, Angular,\n * Solid, Preact) wraps a single instance of this class in that framework's\n * own idioms (context/provider, composable, store, service, etc.).\n */\nexport class ShortcutsManager {\n private listeners = new Map<Keybind, Set<ShortcutListener>>();\n private target: EventTarget | undefined;\n private cleanup: (() => void) | undefined;\n\n /** Registers `callback` to run whenever `shortcut` is triggered. */\n on = (shortcut: Keybind, callback: ShortcutListener): void => {\n if (!this.listeners.has(shortcut)) {\n this.listeners.set(shortcut, new Set());\n }\n this.listeners.get(shortcut)?.add(callback);\n };\n\n /** Removes a `callback` previously registered with {@link on}. */\n off = (shortcut: Keybind, callback: ShortcutListener): void => {\n this.listeners.get(shortcut)?.delete(callback);\n };\n\n private emit = (shortcut: Keybind, event: Event): void => {\n this.listeners.get(shortcut)?.forEach((callback) => callback(event));\n };\n\n private triggerShortcut = (shortcut: Keybind, event: Event): void => {\n this.emit(shortcut, event);\n\n const action = KEYBINDS[shortcut] as KeybindAction | undefined;\n if (action) {\n event.preventDefault();\n if (typeof action === 'string') {\n SHORTCUTS[action as Shortcut]?.(event);\n } else {\n action(event);\n }\n }\n };\n\n /**\n * Starts listening on `target` (`window` by default). Returns a disposer\n * that removes the listeners; safe to call multiple times.\n */\n attach = (target: EventTarget = window): (() => void) => {\n this.detach();\n this.target = target;\n\n const handleKeyDown = (event: Event) => {\n const keyboardEvent = event as KeyboardEvent;\n this.triggerShortcut(\n buildShortcutString(keyboardEvent.key, keyboardEvent),\n event,\n );\n };\n\n const handleKeyUp = (event: Event) => {\n const keyboardEvent = event as KeyboardEvent;\n this.triggerShortcut(\n buildShortcutString(`${keyboardEvent.key}_UP`, keyboardEvent),\n event,\n );\n };\n\n const handleMouseDown = (event: Event) => {\n const mouseEvent = event as MouseEvent;\n this.triggerShortcut(\n buildShortcutString(MOUSE_BUTTONS[mouseEvent.button], mouseEvent),\n event,\n );\n };\n\n const handleMouseUp = (event: Event) => {\n const mouseEvent = event as MouseEvent;\n this.triggerShortcut(\n buildShortcutString(\n `${MOUSE_BUTTONS[mouseEvent.button]}_UP`,\n mouseEvent,\n ),\n event,\n );\n };\n\n const handleDoubleClick = (event: Event) => {\n const mouseEvent = event as MouseEvent;\n this.triggerShortcut(\n buildShortcutString(\n `DOUBLE_${MOUSE_BUTTONS[mouseEvent.button]}`,\n mouseEvent,\n ),\n event,\n );\n };\n\n const handleContextMenu = (event: Event) => {\n this.triggerShortcut(\n buildShortcutString('RIGHT_BUTTON', event as MouseEvent),\n event,\n );\n };\n\n const handleWheel = (event: Event) => {\n const wheelEvent = event as WheelEvent;\n const direction = wheelEvent.deltaY < 0 ? 'WHEEL_UP' : 'WHEEL_DOWN';\n this.triggerShortcut(buildShortcutString(direction, wheelEvent), event);\n };\n\n target.addEventListener('keydown', handleKeyDown);\n target.addEventListener('keyup', handleKeyUp);\n target.addEventListener('mousedown', handleMouseDown);\n target.addEventListener('mouseup', handleMouseUp);\n target.addEventListener('dblclick', handleDoubleClick);\n target.addEventListener('contextmenu', handleContextMenu);\n target.addEventListener('wheel', handleWheel, { passive: true });\n\n this.cleanup = () => {\n target.removeEventListener('keydown', handleKeyDown);\n target.removeEventListener('keyup', handleKeyUp);\n target.removeEventListener('mousedown', handleMouseDown);\n target.removeEventListener('mouseup', handleMouseUp);\n target.removeEventListener('dblclick', handleDoubleClick);\n target.removeEventListener('contextmenu', handleContextMenu);\n target.removeEventListener('wheel', handleWheel);\n this.target = undefined;\n this.cleanup = undefined;\n };\n\n return this.cleanup;\n };\n\n /** Stops listening. Safe to call even if {@link attach} was never called. */\n detach = (): void => {\n this.cleanup?.();\n };\n}\n","import type { Keybind } from '@/config';\nimport { ShortcutsManager, type ShortcutListener } from '@/core/shortcuts-manager';\nimport {\n getCurrentInstance,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n watch,\n type App,\n type InjectionKey,\n} from 'vue';\n\nexport type { ShortcutListener } from '@/core/shortcuts-manager';\n\nexport const ShortcutsInjectionKey: InjectionKey<ShortcutsManager> = Symbol(\n 'browser-shortcuts',\n);\n\n/**\n * Vue plugin that installs a single {@link ShortcutsManager} for the whole\n * app and attaches its listeners for the app's lifetime.\n *\n * @example\n * ```ts\n * import { createApp } from 'vue';\n * import { ShortcutsPlugin } from 'browser-shortcuts/vue';\n *\n * createApp(App).use(ShortcutsPlugin).mount('#app');\n * ```\n */\nexport const ShortcutsPlugin = {\n install(app: App) {\n const manager = new ShortcutsManager();\n manager.attach();\n app.provide(ShortcutsInjectionKey, manager);\n },\n};\n\n/**\n * Returns the app-wide {@link ShortcutsManager}. If the plugin was not\n * installed (e.g. in a component test), a local instance is created and\n * attached/detached with the component's lifecycle.\n */\nexport function useShortcutsManager(): ShortcutsManager {\n const injected = inject(ShortcutsInjectionKey, null);\n if (injected) {\n return injected;\n }\n\n const manager = new ShortcutsManager();\n\n if (getCurrentInstance()) {\n onMounted(() => {\n const dispose = manager.attach();\n onBeforeUnmount(dispose);\n });\n provide(ShortcutsInjectionKey, manager);\n } else {\n manager.attach();\n }\n\n return manager;\n}\n\n/**\n * Subscribes `callback` to `shortcut` for as long as the calling component\n * is mounted.\n *\n * @example\n * ```ts\n * useShortcut('CTRL+SHIFT+F', () => (fullScreen.value = !fullScreen.value));\n * ```\n */\nexport function useShortcut(\n shortcut: Keybind,\n callback: ShortcutListener,\n): void {\n const manager = useShortcutsManager();\n\n onMounted(() => {\n manager.on(shortcut, callback);\n });\n\n onBeforeUnmount(() => {\n manager.off(shortcut, callback);\n });\n\n watch(\n () => shortcut,\n (next, prev) => {\n manager.off(prev, callback);\n manager.on(next, callback);\n },\n );\n}\n"],"mappings":";AAUA,IAAM,WAAW;AAAA,EACf,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AAAA,EACT,gBAAgB;AAAA,EAChB,eAAe;AAAA,E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AOO,SAAS,sBAAwC;AACtD,QAAM,WAAW,OAAO,uBAAuB,IAAI;AACnD,MAAI,UAAU;AACZ,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,IAAI,iBAAiB;AAErC,MAAI,mBAAmB,GAAG;AACxB,cAAU,MAAM;AACd,YAAM,UAAU,QAAQ,OAAO;AAC/B,sBAAgB,OAAO;AAAA,IACzB,CAAC;AACD,YAAQ,uBAAuB,OAAO;AAAA,EACxC,OAAO;AACL,YAAQ,OAAO;AAAA,EACjB;AAEA,SAAO;AACT;AAWO,SAAS,YACd,UACA,UACM;AACN,QAAM,UAAU,oBAAoB;AAEpC,YAAU,MAAM;AACd,YAAQ,GAAG,UAAU,QAAQ;AAAA,EAC/B,CAAC;AAED,kBAAgB,MAAM;AACpB,YAAQ,IAAI,UAAU,QAAQ;AAAA,EAChC,CAAC;AAED;AAAA,IACE,MAAM;AAAA,IACN,CAAC,MAAM,SAAS;AACd,cAAQ,IAAI,MAAM,QAAQ;AAC1B,cAAQ,GAAG,MAAM,QAAQ;AAAA,IAC3B;AAAA,EACF;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,104 @@
1
+ {
2
+ "name": "browser-shortcuts",
3
+ "version": "0.1.0",
4
+ "description": "Declarative keyboard, mouse and wheel shortcuts for React, Preact, Vue, Svelte, Solid and Angular.",
5
+ "license": "MIT",
6
+ "author": "Antonio Okoro",
7
+ "keywords": [
8
+ "shortcuts",
9
+ "keybindings",
10
+ "hotkeys",
11
+ "keyboard",
12
+ "react",
13
+ "preact",
14
+ "vue",
15
+ "svelte",
16
+ "solid",
17
+ "angular"
18
+ ],
19
+ "sideEffects": false,
20
+ "type": "module",
21
+ "main": "./dist/index.cjs",
22
+ "module": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js",
28
+ "require": "./dist/index.cjs"
29
+ },
30
+ "./react": {
31
+ "types": "./dist/react.d.ts",
32
+ "import": "./dist/react.js",
33
+ "require": "./dist/react.cjs"
34
+ },
35
+ "./preact": {
36
+ "types": "./dist/preact.d.ts",
37
+ "import": "./dist/preact.js",
38
+ "require": "./dist/preact.cjs"
39
+ },
40
+ "./vue": {
41
+ "types": "./dist/vue.d.ts",
42
+ "import": "./dist/vue.js",
43
+ "require": "./dist/vue.cjs"
44
+ },
45
+ "./svelte": {
46
+ "types": "./dist/svelte.d.ts",
47
+ "import": "./dist/svelte.js",
48
+ "require": "./dist/svelte.cjs"
49
+ },
50
+ "./solid": {
51
+ "types": "./dist/solid.d.ts",
52
+ "import": "./dist/solid.js",
53
+ "require": "./dist/solid.cjs"
54
+ },
55
+ "./angular": {
56
+ "types": "./dist/angular.d.ts",
57
+ "import": "./dist/angular.js",
58
+ "require": "./dist/angular.cjs"
59
+ },
60
+ "./package.json": "./package.json"
61
+ },
62
+ "files": [
63
+ "dist",
64
+ "README.md",
65
+ "LICENSE"
66
+ ],
67
+ "scripts": {
68
+ "build": "tsup",
69
+ "dev": "tsup --watch",
70
+ "lint": "eslint src",
71
+ "prepublishOnly": "npm run build"
72
+ },
73
+ "peerDependencies": {
74
+ "@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0",
75
+ "preact": "^10.0.0",
76
+ "react": "^18.0.0 || ^19.0.0",
77
+ "react-dom": "^18.0.0 || ^19.0.0",
78
+ "solid-js": "^1.8.0",
79
+ "svelte": "^4.0.0 || ^5.0.0",
80
+ "vue": "^3.3.0"
81
+ },
82
+ "peerDependenciesMeta": {
83
+ "@angular/core": { "optional": true },
84
+ "preact": { "optional": true },
85
+ "react": { "optional": true },
86
+ "react-dom": { "optional": true },
87
+ "solid-js": { "optional": true },
88
+ "svelte": { "optional": true },
89
+ "vue": { "optional": true }
90
+ },
91
+ "devDependencies": {
92
+ "@angular/core": "^19.0.0",
93
+ "@types/react": "^19",
94
+ "@types/react-dom": "^19",
95
+ "preact": "^10.24.3",
96
+ "react": "19.2.8",
97
+ "react-dom": "19.2.8",
98
+ "solid-js": "^1.9.3",
99
+ "svelte": "^5.0.0",
100
+ "tsup": "^8.5.1",
101
+ "typescript": "^5",
102
+ "vue": "^3.5.0"
103
+ }
104
+ }