planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

3
node_modules/is-hotkey/.babelrc generated vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"presets": ["env"]
}

11
node_modules/is-hotkey/.github/workflows/actions.yml generated vendored Normal file
View File

@@ -0,0 +1,11 @@
name: actions
on: [push, pull_request]
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- run: yarn && yarn build && yarn test && yarn lint
env:
CI: true

6
node_modules/is-hotkey/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,6 @@
language: node_js
node_js:
- stable
cache:
yarn: true

9
node_modules/is-hotkey/License.md generated vendored Normal file
View File

@@ -0,0 +1,9 @@
The MIT License
Copyright © 2017, [Ian Storm Taylor](https://ianstormtaylor.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

122
node_modules/is-hotkey/Readme.md generated vendored Normal file
View File

@@ -0,0 +1,122 @@
### `is-hotkey`
A simple way to check whether a browser event matches a hotkey.
<br/>
### Features
- Uses a simple, natural syntax for expressing hotkeys—`mod+s`, `cmd+alt+space`, etc.
- Accepts `mod` for the classic "`cmd` on Mac, `ctrl` on Windows" use case.
- Can use either `event.which` (default) or `event.key` to work regardless of keyboard layout.
- Can be curried to reduce parsing and increase performance when needed.
- Is very lightweight, weighing in at `< 1kb` minified and gzipped.
<br/>
### Example
The most basic usage...
```js
import isHotkey from 'is-hotkey'
function onKeyDown(e) {
if (isHotkey('mod+s', e)) {
...
}
}
```
Or, you can curry the hotkey string for better performance, since it is only parsed once...
```js
import isHotkey from 'is-hotkey'
const isSaveHotkey = isHotkey('mod+s')
function onKeyDown(e) {
if (isSaveHotkey(e)) {
...
}
}
```
That's it!
<br/>
### Why?
There are tons of hotkey libraries, but they're often coupled to the view layer, or they bind events globally, or all kinds of weird things. You don't really want them to bind the events for you, you can do that yourself.
Instead, you want to just check whether a single event matches a hotkey. And you want to define your hotkeys in the standard-but-non-trivial-to-parse syntax that everyone knows.
But most libraries don't expose their parsing logic. And even for the ones that do expose their hotkey parsing logic, pulling in an entire library just to check a hotkey string is overkill.
So... this is a simple and lightweight hotkey checker!
<br/>
### API
```js
import isHotkey from 'is-hotkey'
isHotkey('mod+s')(event)
isHotkey('mod+s', { byKey: true })(event)
isHotkey('mod+s', event)
isHotkey('mod+s', { byKey: true }, event)
```
You can either pass `hotkey, [options], event` in which case the hotkey will be parsed and compared immediately. Or you can passed just `hotkey, [options]` to receive a curried checking function that you can re-use for multiple events.
```js
isHotkey('mod+a')
isHotkey('Control+S')
isHotkey('cmd+opt+d')
itHotkey('Meta+DownArrow')
itHotkey('cmd+down')
```
The API is case-insentive, and has all of the conveniences you'd expect—`cmd` vs. `Meta`, `opt` vs. `Alt`, `down` vs. `DownArrow`, etc.
It also accepts `mod` for the classic "`cmd` on Mac, `ctrl` on Windows" use case.
```js
import isHotkey from 'is-hotkey'
import { isCodeHotkey, isKeyHotkey } from 'is-hotkey'
isHotkey('mod+s')(event)
isHotkey('mod+s', { byKey: true })(event)
isCodeHotkey('mod+s', event)
isKeyHotkey('mod+s', event)
```
By default the hotkey string is checked using `event.which`. But you can also pass in `byKey: true` to compare using the [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) API, which stays the same regardless of keyboard layout.
Or to reduce the noise if you are defining lots of hotkeys, you can use the `isCodeHotkey` and `isKeyHotkey` helpers that are exported.
```js
import { toKeyName, toKeyCode } from 'is-hotkey'
toKeyName('cmd') // "meta"
toKeyName('a') // "a"
toKeyCode('shift') // 16
toKeyCode('a') // 65
```
You can also use the exposed `toKeyName` and `toKeyCode` helpers, in case you want to add the same level of convenience to your own APIs.
```js
import { parseHotkey, compareHotkey } from 'is-hotkey'
const hotkey = parseHotkey('mod+s', { byKey: true })
const passes = compareHotkey(hotkey, event)
```
You can also go even more low-level with the exposed `parseHotkey` and `compareHotkey` functions, which are what the default `isHotkey` export uses under the covers, in case you have more advanced needs.

249
node_modules/is-hotkey/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,249 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Constants.
*/
var IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
var MODIFIERS = {
alt: 'altKey',
control: 'ctrlKey',
meta: 'metaKey',
shift: 'shiftKey'
};
var ALIASES = {
add: '+',
break: 'pause',
cmd: 'meta',
command: 'meta',
ctl: 'control',
ctrl: 'control',
del: 'delete',
down: 'arrowdown',
esc: 'escape',
ins: 'insert',
left: 'arrowleft',
mod: IS_MAC ? 'meta' : 'control',
opt: 'alt',
option: 'alt',
return: 'enter',
right: 'arrowright',
space: ' ',
spacebar: ' ',
up: 'arrowup',
win: 'meta',
windows: 'meta'
};
var CODES = {
backspace: 8,
tab: 9,
enter: 13,
shift: 16,
control: 17,
alt: 18,
pause: 19,
capslock: 20,
escape: 27,
' ': 32,
pageup: 33,
pagedown: 34,
end: 35,
home: 36,
arrowleft: 37,
arrowup: 38,
arrowright: 39,
arrowdown: 40,
insert: 45,
delete: 46,
meta: 91,
numlock: 144,
scrolllock: 145,
';': 186,
'=': 187,
',': 188,
'-': 189,
'.': 190,
'/': 191,
'`': 192,
'[': 219,
'\\': 220,
']': 221,
'\'': 222
};
for (var f = 1; f < 20; f++) {
CODES['f' + f] = 111 + f;
}
/**
* Is hotkey?
*/
function isHotkey(hotkey, options, event) {
if (options && !('byKey' in options)) {
event = options;
options = null;
}
if (!Array.isArray(hotkey)) {
hotkey = [hotkey];
}
var array = hotkey.map(function (string) {
return parseHotkey(string, options);
});
var check = function check(e) {
return array.some(function (object) {
return compareHotkey(object, e);
});
};
var ret = event == null ? check : check(event);
return ret;
}
function isCodeHotkey(hotkey, event) {
return isHotkey(hotkey, event);
}
function isKeyHotkey(hotkey, event) {
return isHotkey(hotkey, { byKey: true }, event);
}
/**
* Parse.
*/
function parseHotkey(hotkey, options) {
var byKey = options && options.byKey;
var ret = {};
// Special case to handle the `+` key since we use it as a separator.
hotkey = hotkey.replace('++', '+add');
var values = hotkey.split('+');
var length = values.length;
// Ensure that all the modifiers are set to false unless the hotkey has them.
for (var k in MODIFIERS) {
ret[MODIFIERS[k]] = false;
}
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var value = _step.value;
var optional = value.endsWith('?') && value.length > 1;
if (optional) {
value = value.slice(0, -1);
}
var name = toKeyName(value);
var modifier = MODIFIERS[name];
if (value.length > 1 && !modifier && !ALIASES[value] && !CODES[name]) {
throw new TypeError('Unknown modifier: "' + value + '"');
}
if (length === 1 || !modifier) {
if (byKey) {
ret.key = name;
} else {
ret.which = toKeyCode(value);
}
}
if (modifier) {
ret[modifier] = optional ? null : true;
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
return ret;
}
/**
* Compare.
*/
function compareHotkey(object, event) {
for (var key in object) {
var expected = object[key];
var actual = void 0;
if (expected == null) {
continue;
}
if (key === 'key' && event.key != null) {
actual = event.key.toLowerCase();
} else if (key === 'which') {
actual = expected === 91 && event.which === 93 ? 91 : event.which;
} else {
actual = event[key];
}
if (actual == null && expected === false) {
continue;
}
if (actual !== expected) {
return false;
}
}
return true;
}
/**
* Utils.
*/
function toKeyCode(name) {
name = toKeyName(name);
var code = CODES[name] || name.toUpperCase().charCodeAt(0);
return code;
}
function toKeyName(name) {
name = name.toLowerCase();
name = ALIASES[name] || name;
return name;
}
/**
* Export.
*/
exports.default = isHotkey;
exports.isHotkey = isHotkey;
exports.isCodeHotkey = isCodeHotkey;
exports.isKeyHotkey = isKeyHotkey;
exports.parseHotkey = parseHotkey;
exports.compareHotkey = compareHotkey;
exports.toKeyCode = toKeyCode;
exports.toKeyName = toKeyName;

263
node_modules/is-hotkey/lib/is-hotkey.umd.js generated vendored Normal file
View File

@@ -0,0 +1,263 @@
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(['exports'], factory);
} else if (typeof exports !== "undefined") {
factory(exports);
} else {
var mod = {
exports: {}
};
factory(mod.exports);
global.index = mod.exports;
}
})(this, function (exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Constants.
*/
var IS_MAC = typeof window != 'undefined' && /Mac|iPod|iPhone|iPad/.test(window.navigator.platform);
var MODIFIERS = {
alt: 'altKey',
control: 'ctrlKey',
meta: 'metaKey',
shift: 'shiftKey'
};
var ALIASES = {
add: '+',
break: 'pause',
cmd: 'meta',
command: 'meta',
ctl: 'control',
ctrl: 'control',
del: 'delete',
down: 'arrowdown',
esc: 'escape',
ins: 'insert',
left: 'arrowleft',
mod: IS_MAC ? 'meta' : 'control',
opt: 'alt',
option: 'alt',
return: 'enter',
right: 'arrowright',
space: ' ',
spacebar: ' ',
up: 'arrowup',
win: 'meta',
windows: 'meta'
};
var CODES = {
backspace: 8,
tab: 9,
enter: 13,
shift: 16,
control: 17,
alt: 18,
pause: 19,
capslock: 20,
escape: 27,
' ': 32,
pageup: 33,
pagedown: 34,
end: 35,
home: 36,
arrowleft: 37,
arrowup: 38,
arrowright: 39,
arrowdown: 40,
insert: 45,
delete: 46,
meta: 91,
numlock: 144,
scrolllock: 145,
';': 186,
'=': 187,
',': 188,
'-': 189,
'.': 190,
'/': 191,
'`': 192,
'[': 219,
'\\': 220,
']': 221,
'\'': 222
};
for (var f = 1; f < 20; f++) {
CODES['f' + f] = 111 + f;
}
/**
* Is hotkey?
*/
function isHotkey(hotkey, options, event) {
if (options && !('byKey' in options)) {
event = options;
options = null;
}
if (!Array.isArray(hotkey)) {
hotkey = [hotkey];
}
var array = hotkey.map(function (string) {
return parseHotkey(string, options);
});
var check = function check(e) {
return array.some(function (object) {
return compareHotkey(object, e);
});
};
var ret = event == null ? check : check(event);
return ret;
}
function isCodeHotkey(hotkey, event) {
return isHotkey(hotkey, event);
}
function isKeyHotkey(hotkey, event) {
return isHotkey(hotkey, { byKey: true }, event);
}
/**
* Parse.
*/
function parseHotkey(hotkey, options) {
var byKey = options && options.byKey;
var ret = {};
// Special case to handle the `+` key since we use it as a separator.
hotkey = hotkey.replace('++', '+add');
var values = hotkey.split('+');
var length = values.length;
// Ensure that all the modifiers are set to false unless the hotkey has them.
for (var k in MODIFIERS) {
ret[MODIFIERS[k]] = false;
}
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var value = _step.value;
var optional = value.endsWith('?') && value.length > 1;
if (optional) {
value = value.slice(0, -1);
}
var name = toKeyName(value);
var modifier = MODIFIERS[name];
if (value.length > 1 && !modifier && !ALIASES[value] && !CODES[name]) {
throw new TypeError('Unknown modifier: "' + value + '"');
}
if (length === 1 || !modifier) {
if (byKey) {
ret.key = name;
} else {
ret.which = toKeyCode(value);
}
}
if (modifier) {
ret[modifier] = optional ? null : true;
}
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
return ret;
}
/**
* Compare.
*/
function compareHotkey(object, event) {
for (var key in object) {
var expected = object[key];
var actual = void 0;
if (expected == null) {
continue;
}
if (key === 'key' && event.key != null) {
actual = event.key.toLowerCase();
} else if (key === 'which') {
actual = expected === 91 && event.which === 93 ? 91 : event.which;
} else {
actual = event[key];
}
if (actual == null && expected === false) {
continue;
}
if (actual !== expected) {
return false;
}
}
return true;
}
/**
* Utils.
*/
function toKeyCode(name) {
name = toKeyName(name);
var code = CODES[name] || name.toUpperCase().charCodeAt(0);
return code;
}
function toKeyName(name) {
name = name.toLowerCase();
name = ALIASES[name] || name;
return name;
}
/**
* Export.
*/
exports.default = isHotkey;
exports.isHotkey = isHotkey;
exports.isCodeHotkey = isCodeHotkey;
exports.isKeyHotkey = isKeyHotkey;
exports.parseHotkey = parseHotkey;
exports.compareHotkey = compareHotkey;
exports.toKeyCode = toKeyCode;
exports.toKeyName = toKeyName;
});

38
node_modules/is-hotkey/package.json generated vendored Normal file
View File

@@ -0,0 +1,38 @@
{
"name": "is-hotkey",
"description": "Check whether a browser event matches a hotkey.",
"version": "0.2.0",
"license": "MIT",
"repository": "git://github.com/ianstormtaylor/is-hotkey.git",
"main": "./lib/index.js",
"scripts": {
"build": "babel ./src --out-dir ./lib",
"build:umd": "babel --plugins transform-es2015-modules-umd ./src -o ./lib/is-hotkey.umd.js",
"clean": "rm -rf ./lib ./node_modules",
"prepublish": "yarn run build && yarn run build:umd",
"release": "np",
"test": "yarn run build && mocha",
"watch": "babel ./lib --out-dir ./lib --watch"
},
"devDependencies": {
"babel-cli": "^6.10.1",
"babel-plugin-transform-es2015-modules-umd": "^6.24.1",
"babel-preset-env": "^1.6.1",
"mocha": "^3.2.0"
},
"keywords": [
"code",
"combo",
"event",
"hotkey",
"key",
"keycode",
"keycodes",
"keycombo",
"keydown",
"keyup",
"mousetrap",
"shortcut",
"which"
]
}

222
node_modules/is-hotkey/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,222 @@
/**
* Constants.
*/
const IS_MAC = (
typeof window != 'undefined' &&
/Mac|iPod|iPhone|iPad/.test(window.navigator.platform)
)
const MODIFIERS = {
alt: 'altKey',
control: 'ctrlKey',
meta: 'metaKey',
shift: 'shiftKey',
}
const ALIASES = {
add: '+',
break: 'pause',
cmd: 'meta',
command: 'meta',
ctl: 'control',
ctrl: 'control',
del: 'delete',
down: 'arrowdown',
esc: 'escape',
ins: 'insert',
left: 'arrowleft',
mod: IS_MAC ? 'meta' : 'control',
opt: 'alt',
option: 'alt',
return: 'enter',
right: 'arrowright',
space: ' ',
spacebar: ' ',
up: 'arrowup',
win: 'meta',
windows: 'meta',
}
const CODES = {
backspace: 8,
tab: 9,
enter: 13,
shift: 16,
control: 17,
alt: 18,
pause: 19,
capslock: 20,
escape: 27,
' ': 32,
pageup: 33,
pagedown: 34,
end: 35,
home: 36,
arrowleft: 37,
arrowup: 38,
arrowright: 39,
arrowdown: 40,
insert: 45,
delete: 46,
meta: 91,
numlock: 144,
scrolllock: 145,
';': 186,
'=': 187,
',': 188,
'-': 189,
'.': 190,
'/': 191,
'`': 192,
'[': 219,
'\\': 220,
']': 221,
'\'': 222,
}
for (var f = 1; f < 20; f++) {
CODES['f' + f] = 111 + f
}
/**
* Is hotkey?
*/
function isHotkey(hotkey, options, event) {
if (options && !('byKey' in options)) {
event = options
options = null
}
if (!Array.isArray(hotkey)) {
hotkey = [hotkey]
}
const array = hotkey.map(string => parseHotkey(string, options))
const check = e => array.some(object => compareHotkey(object, e))
const ret = event == null ? check : check(event)
return ret
}
function isCodeHotkey(hotkey, event) {
return isHotkey(hotkey, event)
}
function isKeyHotkey(hotkey, event) {
return isHotkey(hotkey, { byKey: true }, event)
}
/**
* Parse.
*/
function parseHotkey(hotkey, options) {
const byKey = options && options.byKey
const ret = {}
// Special case to handle the `+` key since we use it as a separator.
hotkey = hotkey.replace('++', '+add')
const values = hotkey.split('+')
const { length } = values
// Ensure that all the modifiers are set to false unless the hotkey has them.
for (const k in MODIFIERS) {
ret[MODIFIERS[k]] = false
}
for (let value of values) {
const optional = value.endsWith('?') && value.length > 1;
if (optional) {
value = value.slice(0, -1)
}
const name = toKeyName(value)
const modifier = MODIFIERS[name]
if (value.length > 1 && !modifier && !ALIASES[value] && !CODES[name]) {
throw new TypeError(`Unknown modifier: "${value}"`)
}
if (length === 1 || !modifier) {
if (byKey) {
ret.key = name
} else {
ret.which = toKeyCode(value)
}
}
if (modifier) {
ret[modifier] = optional ? null : true
}
}
return ret
}
/**
* Compare.
*/
function compareHotkey(object, event) {
for (const key in object) {
const expected = object[key]
let actual
if (expected == null) {
continue
}
if (key === 'key' && event.key != null) {
actual = event.key.toLowerCase()
} else if (key === 'which') {
actual = expected === 91 && event.which === 93 ? 91 : event.which
} else {
actual = event[key]
}
if (actual == null && expected === false) {
continue
}
if (actual !== expected) {
return false
}
}
return true
}
/**
* Utils.
*/
function toKeyCode(name) {
name = toKeyName(name)
const code = CODES[name] || name.toUpperCase().charCodeAt(0)
return code
}
function toKeyName(name) {
name = name.toLowerCase()
name = ALIASES[name] || name
return name
}
/**
* Export.
*/
export default isHotkey
export {
isHotkey,
isCodeHotkey,
isKeyHotkey,
parseHotkey,
compareHotkey,
toKeyCode,
toKeyName,
}