mirror of
https://github.com/S2-/gitlit
synced 2025-08-03 12:50:04 +02:00
initial commit
This commit is contained in:
9
app/node_modules/electron-is-accelerator/.jshintrc
generated
vendored
Normal file
9
app/node_modules/electron-is-accelerator/.jshintrc
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"undef": true,
|
||||
"unused": "vars",
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"eqnull": true,
|
||||
"esnext": true,
|
||||
"indent": 4
|
||||
}
|
37
app/node_modules/electron-is-accelerator/.npmignore
generated
vendored
Normal file
37
app/node_modules/electron-is-accelerator/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules
|
||||
jspm_packages
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
4
app/node_modules/electron-is-accelerator/.travis.yml
generated
vendored
Normal file
4
app/node_modules/electron-is-accelerator/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 'stable'
|
||||
sudo: false
|
21
app/node_modules/electron-is-accelerator/LICENSE
generated
vendored
Normal file
21
app/node_modules/electron-is-accelerator/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016 Thomas Brouard
|
||||
|
||||
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.
|
25
app/node_modules/electron-is-accelerator/README.md
generated
vendored
Normal file
25
app/node_modules/electron-is-accelerator/README.md
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# electron-is-accelerator
|
||||
|
||||
Check if a string is a valid [Electron accelerator](https://github.com/electron/electron/blob/master/docs/api/accelerator.md) and return a boolean. This module can be used to validate user defined accelerators before using them with [MenuItems](http://electron.atom.io/docs/api/menu-item/).
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
$ npm install --save electron-is-accelerator
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var isAccelerator = require("electron-is-accelerator");
|
||||
|
||||
isAccelerator("CommandOrControl+Shift+Z"); // true
|
||||
isAccelerator("CommandOrControl+F9"); // true
|
||||
isAccelerator("CommandOrContrl+F9"); // false
|
||||
isAccelerator("A+Z"); // false
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2016 Thomas Brouard
|
21
app/node_modules/electron-is-accelerator/index.js
generated
vendored
Normal file
21
app/node_modules/electron-is-accelerator/index.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
const modifiers = /^(Command|Cmd|Control|Ctrl|CommandOrControl|CmdOrCtrl|Alt|Option|AltGr|Shift|Super)$/;
|
||||
const keyCodes = /^([0-9A-Z)!@#$%^&*(:+<_>?~{|}";=,\-./`[\\\]']|F1*[1-9]|F10|F2[0-4]|Plus|Space|Tab|Backspace|Delete|Insert|Return|Enter|Up|Down|Left|Right|Home|End|PageUp|PageDown|Escape|Esc|VolumeUp|VolumeDown|VolumeMute|MediaNextTrack|MediaPreviousTrack|MediaStop|MediaPlayPause|PrintScreen)$/;
|
||||
|
||||
module.exports = function (str) {
|
||||
let parts = str.split("+");
|
||||
let keyFound = false;
|
||||
return parts.every((val, index) => {
|
||||
const isKey = keyCodes.test(val);
|
||||
const isModifier = modifiers.test(val);
|
||||
if (isKey) {
|
||||
// Key must be unique
|
||||
if (keyFound) return false;
|
||||
keyFound = true;
|
||||
}
|
||||
// Key is required
|
||||
if (index === parts.length - 1 && !keyFound) return false;
|
||||
return isKey || isModifier;
|
||||
});
|
||||
};
|
54
app/node_modules/electron-is-accelerator/package.json
generated
vendored
Normal file
54
app/node_modules/electron-is-accelerator/package.json
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"_from": "electron-is-accelerator@^0.1.0",
|
||||
"_id": "electron-is-accelerator@0.1.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-UJ5RDCala1Xhf4Y6SwThEYRqsns=",
|
||||
"_location": "/electron-is-accelerator",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "electron-is-accelerator@^0.1.0",
|
||||
"name": "electron-is-accelerator",
|
||||
"escapedName": "electron-is-accelerator",
|
||||
"rawSpec": "^0.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/electron-localshortcut"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/electron-is-accelerator/-/electron-is-accelerator-0.1.2.tgz",
|
||||
"_shasum": "509e510c26a56b55e17f863a4b04e111846ab27b",
|
||||
"_spec": "electron-is-accelerator@^0.1.0",
|
||||
"_where": "E:\\projects\\p\\gitlit\\app\\node_modules\\electron-localshortcut",
|
||||
"author": {
|
||||
"name": "brrd"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/brrd/electron-is-accelerator/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Check if a string is a valid Electron accelerator",
|
||||
"devDependencies": {
|
||||
"ava": "^0.17.0",
|
||||
"jshint": "^2.9.4"
|
||||
},
|
||||
"homepage": "https://github.com/brrd/electron-is-accelerator",
|
||||
"keywords": [
|
||||
"electron",
|
||||
"accelerator"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "electron-is-accelerator",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/brrd/electron-is-accelerator.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jshint *.js && ava"
|
||||
},
|
||||
"version": "0.1.2"
|
||||
}
|
96
app/node_modules/electron-is-accelerator/test.js
generated
vendored
Normal file
96
app/node_modules/electron-is-accelerator/test.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
import test from 'ava';
|
||||
import isAccelerator from '.';
|
||||
|
||||
const keys = [
|
||||
'0',
|
||||
'1',
|
||||
'9',
|
||||
'A',
|
||||
'G',
|
||||
'Z',
|
||||
'F1',
|
||||
'F5',
|
||||
'F24',
|
||||
'~',
|
||||
'!',
|
||||
'@',
|
||||
'#',
|
||||
'Plus',
|
||||
'Space',
|
||||
'Tab',
|
||||
'Backspace',
|
||||
'Delete',
|
||||
'Insert',
|
||||
'Return',
|
||||
'Enter',
|
||||
'Up',
|
||||
'Down',
|
||||
'Left',
|
||||
'Right',
|
||||
'Home',
|
||||
'End',
|
||||
'PageUp',
|
||||
'PageDown',
|
||||
'Escape',
|
||||
'Esc',
|
||||
'VolumeUp',
|
||||
'VolumeDown',
|
||||
'VolumeMute',
|
||||
'MediaNextTrack',
|
||||
'MediaPreviousTrack',
|
||||
'MediaStop',
|
||||
'MediaPlayPause',
|
||||
'PrintScreen'
|
||||
];
|
||||
|
||||
const modifiers = [
|
||||
'Command',
|
||||
'Cmd',
|
||||
'Control',
|
||||
'Ctrl',
|
||||
'CommandOrControl',
|
||||
'CmdOrCtrl',
|
||||
'Alt',
|
||||
'Option',
|
||||
'AltGr',
|
||||
'Shift',
|
||||
'Super'
|
||||
];
|
||||
|
||||
test('multiple modifier', t => t.true(isAccelerator('CommandOrControl+Shift+Z')));
|
||||
test('multiple keys', t => t.false(isAccelerator('A+Z')));
|
||||
test('typos', t => t.false(isAccelerator('CommandOrContol+A')));
|
||||
test('modifiers without keys', t => t.false(isAccelerator('CmdOrCtrl')));
|
||||
test('multiple modifiers without keys', t => t.false(isAccelerator('CmdOrCtrl+Ctrl')));
|
||||
test('empty string', t => t.false(isAccelerator('')));
|
||||
|
||||
// tests to check each modifiers
|
||||
modifiers.forEach(mod => test(
|
||||
mod + ' modifier',
|
||||
t => t.true(
|
||||
isAccelerator(mod + '+A')
|
||||
)
|
||||
));
|
||||
|
||||
// tests to check all keys
|
||||
keys.forEach(key => test(
|
||||
key + ' key',
|
||||
t => t.true(
|
||||
isAccelerator(key)
|
||||
)
|
||||
));
|
||||
|
||||
// tests to check every combination of modifier and key
|
||||
const testSequence = (sequence) => test(
|
||||
`${sequence} sequence`,
|
||||
t => t.true(
|
||||
isAccelerator(`${sequence}`)
|
||||
)
|
||||
);
|
||||
|
||||
modifiers.forEach(mod =>
|
||||
keys.forEach(key => {
|
||||
testSequence(`${mod}+${key}`);
|
||||
testSequence(`${key}+${mod}`);
|
||||
})
|
||||
);
|
Reference in New Issue
Block a user