Socket
Socket
Sign inDemoInstall

@github/hotkey

Package Overview
Dependencies
Maintainers
15
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@github/hotkey - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

9

dist/hotkey.js
import { macosSymbolLayerKeys } from './macos-symbol-layer';
const normalizedHotkeyBrand = Symbol('normalizedHotkey');
const syntheticKeyNames = {
' ': 'Space',
'+': 'Plus'
};
export function eventToHotkeyString(event, platform = navigator.platform) {
var _a;
var _a, _b;
const { ctrlKey, altKey, metaKey, key } = event;

@@ -14,3 +18,4 @@ const hotkeyString = [];

const nonOptionPlaneKey = matchApplePlatform.test(platform) ? (_a = macosSymbolLayerKeys[key]) !== null && _a !== void 0 ? _a : key : key;
hotkeyString.push(nonOptionPlaneKey);
const syntheticKey = (_b = syntheticKeyNames[nonOptionPlaneKey]) !== null && _b !== void 0 ? _b : nonOptionPlaneKey;
hotkeyString.push(syntheticKey);
}

@@ -17,0 +22,0 @@ return hotkeyString.join('+');

@@ -165,4 +165,8 @@ class Leaf {

const syntheticKeyNames = {
' ': 'Space',
'+': 'Plus'
};
function eventToHotkeyString(event, platform = navigator.platform) {
var _a;
var _a, _b;
const { ctrlKey, altKey, metaKey, key } = event;

@@ -177,3 +181,4 @@ const hotkeyString = [];

const nonOptionPlaneKey = matchApplePlatform.test(platform) ? (_a = macosSymbolLayerKeys[key]) !== null && _a !== void 0 ? _a : key : key;
hotkeyString.push(nonOptionPlaneKey);
const syntheticKey = (_b = syntheticKeyNames[nonOptionPlaneKey]) !== null && _b !== void 0 ? _b : nonOptionPlaneKey;
hotkeyString.push(syntheticKey);
}

@@ -180,0 +185,0 @@ return hotkeyString.join('+');

{
"name": "@github/hotkey",
"version": "2.2.0",
"version": "2.3.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -112,3 +112,4 @@ # Hotkey Behavior

3. Due to the inconsistent lowercasing of `event.key` on Mac and iOS when `Meta` is pressed along with `Shift`, it is recommended to avoid hotkey strings containing both `Mod` and `Shift`.
7. You can use the comma key `,` as a hotkey, e.g. `a,,` would activate if the user typed `a` or `,`. `Control+,,x` would activate for `Control+,` or `x`.
7. `"Plus"` and `"Space"` are special key names to represent the `+` and ` ` keys respectively, because these symbols cannot be represented in the normal hotkey string syntax.
8. You can use the comma key `,` as a hotkey, e.g. `a,,` would activate if the user typed `a` or `,`. `Control+,,x` would activate for `Control+,` or `x`.

@@ -115,0 +116,0 @@ ### Example

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc