🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@hydroperx/inputaction

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hydroperx/inputaction - npm Package Compare versions

Comparing version
1.1.1
to
1.1.2
+7
-2
dist/Input.d.ts

@@ -72,2 +72,5 @@ import { InputActionAtom, InputActionKeyName } from "./InputAction";

*
* Check the [repository's respective source](https://github.com/hydroperx/inputaction.js/blob/master/src/Input.ts)
* for resulting key names in case you need overriding them.
*
* @param param Either an action name or a series of action atoms.

@@ -78,2 +81,5 @@ */

* Returns the display text of an individual key name.
*
* Check the [repository's respective source](https://github.com/hydroperx/inputaction.js/blob/master/src/Input.ts)
* for resulting key names in case you need overriding them.
*/

@@ -87,4 +93,3 @@ static keyNameDisplay(name: InputActionKeyName): string;

/**
* Updates the action map.
* @fires Input#actionsUpdated
* Updates the action map, firing the `actionsUpdated` event.
*/

@@ -91,0 +96,0 @@ setActions(map: Record<string, InputActionAtom[]>): void;

@@ -74,2 +74,5 @@ import { navigatorKeyToThis, } from "./InputAction";

*
* Check the [repository's respective source](https://github.com/hydroperx/inputaction.js/blob/master/src/Input.ts)
* for resulting key names in case you need overriding them.
*
* @param param Either an action name or a series of action atoms.

@@ -96,2 +99,5 @@ */

}
if (key.meta) {
parts.push("Meta");
}
parts.push(Input.keyNameDisplay(key.key));

@@ -105,5 +111,12 @@ return parts.join("+");

* Returns the display text of an individual key name.
*
* Check the [repository's respective source](https://github.com/hydroperx/inputaction.js/blob/master/src/Input.ts)
* for resulting key names in case you need overriding them.
*/
static keyNameDisplay(name) {
switch (name) {
case "meta":
return "Meta";
case "fn":
return "Fn";
case "escape":

@@ -139,2 +152,14 @@ return "Esc";

return ";";
case "delete":
return "Delete";
case "pageUp":
return "Pg Up";
case "pageDown":
return "Pg Dn";
case "home":
return "Home";
case "end":
return "End";
case "capsLock":
return "Caps Lock";
default:

@@ -151,4 +176,3 @@ return name.toUpperCase();

/**
* Updates the action map.
* @fires Input#actionsUpdated
* Updates the action map, firing the `actionsUpdated` event.
*/

@@ -190,2 +214,3 @@ setActions(map) {

(inputActionKey.shift ? pressedState.shift : !pressedState.shift) &&
(inputActionKey.meta ? pressedState.meta : !pressedState.meta) &&
(inputActionKey.alt ? pressedState.alt : !pressedState.alt);

@@ -216,2 +241,3 @@ if (pressed) {

(inputActionKey.shift ? pressedState.shift : !pressedState.shift) &&
(inputActionKey.meta ? pressedState.meta : !pressedState.meta) &&
(inputActionKey.alt ? pressedState.alt : !pressedState.alt);

@@ -251,2 +277,3 @@ if (pressed && pressedState.pressedTimestamp > Date.now() - 15) {

shift: false,
meta: false,
alt: false,

@@ -260,2 +287,3 @@ };

state.shift = evt.shiftKey;
state.meta = evt.metaKey;
state.alt = evt.altKey;

@@ -282,2 +310,3 @@ // Dispatch pressed event

shift: false,
meta: false,
alt: false,

@@ -290,2 +319,3 @@ };

state.shift = false;
state.meta = false;
state.alt = false;

@@ -292,0 +322,0 @@ // Dispatch released event

@@ -26,7 +26,13 @@ /**

shift?: boolean;
/**
* Whether the meta key is used (e.g. the Windows Logo or Mac Command key).
*/
meta?: boolean;
};
/**
* Part of the Input API. It is used to identify the name of a specific user input key.
*
* The `"meta"` key corresponds to the Windows logo or Mac Command key.
*/
export type InputActionKeyName = "leftArrow" | "rightArrow" | "upArrow" | "downArrow" | "spacebar" | "enter" | "backspace" | "minus" | "plus" | "tab" | "escape" | "assign" | "comma" | "dot" | "semicolon" | "f1" | "f2" | "f3" | "f4" | "f5" | "f6" | "f7" | "f8" | "f9" | "f10" | "f11" | "f12" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
export type InputActionKeyName = "meta" | "fn" | "home" | "end" | "leftArrow" | "rightArrow" | "upArrow" | "downArrow" | "spacebar" | "enter" | "backspace" | "minus" | "plus" | "tab" | "escape" | "assign" | "comma" | "dot" | "semicolon" | "delete" | "pageUp" | "pageDown" | "capsLock" | "f1" | "f2" | "f3" | "f4" | "f5" | "f6" | "f7" | "f8" | "f9" | "f10" | "f11" | "f12" | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
export declare function navigatorKeyToThis(name: string): InputActionKeyName | undefined;

@@ -6,2 +6,6 @@ const mapNavigatorKeyToThis = new Map([

["arrowdown", "downArrow"],
["left", "leftArrow"],
["right", "rightArrow"],
["up", "upArrow"],
["down", "downArrow"],
["escape", "escape"],

@@ -20,2 +24,12 @@ [" ", "spacebar"],

[";", "semicolon"],
["meta", "meta"],
["os", "meta"],
["fn", "fn"],
["delete", "delete"],
["del", "delete"],
["pageup", "pageUp"],
["pagedown", "pageDown"],
["home", "home"],
["end", "end"],
["capslock", "capsLock"],
]);

@@ -22,0 +36,0 @@ export function navigatorKeyToThis(name) {

{
"name": "@hydroperx/inputaction",
"version": "1.1.1",
"version": "1.1.2",
"description": "Input actions library.",

@@ -12,2 +12,3 @@ "repository": "https://github.com/hydroperx/inputaction.js",

"build": "tsc",
"doc": "npx typedoc --plugin typedoc-plugin-markdown",
"prepublishOnly": "npm run build"

@@ -27,4 +28,6 @@ },

"@types/assert": "^1.5.10",
"typedoc": "^0.28.7",
"typedoc-plugin-markdown": "^4.7.1",
"typescript": "~5.6.2"
}
}
# Input action
<p align="center">
<a href="./docs/globals.md"><img src="https://img.shields.io/badge/TypeScript%20API%20Documentation-gray"></a>
</p>
Input action library for web applications.

@@ -4,0 +8,0 @@