@lumino/keyboard
Advanced tools
Comparing version 1.8.2 to 2.0.0-alpha.0
@@ -44,3 +44,3 @@ // Copyright (c) Jupyter Development Team. | ||
*/ | ||
var KeycodeLayout = /** @class */ (function () { | ||
class KeycodeLayout { | ||
/** | ||
@@ -55,4 +55,3 @@ * Construct a new keycode layout. | ||
*/ | ||
function KeycodeLayout(name, codes, modifierKeys) { | ||
if (modifierKeys === void 0) { modifierKeys = []; } | ||
constructor(name, codes, modifierKeys = []) { | ||
this.name = name; | ||
@@ -68,5 +67,5 @@ this._codes = codes; | ||
*/ | ||
KeycodeLayout.prototype.keys = function () { | ||
keys() { | ||
return Object.keys(this._keys); | ||
}; | ||
} | ||
/** | ||
@@ -79,5 +78,5 @@ * Test whether the given key is a valid value for the layout. | ||
*/ | ||
KeycodeLayout.prototype.isValidKey = function (key) { | ||
isValidKey(key) { | ||
return key in this._keys; | ||
}; | ||
} | ||
/** | ||
@@ -90,5 +89,5 @@ * Test whether the given key is a modifier key. | ||
*/ | ||
KeycodeLayout.prototype.isModifierKey = function (key) { | ||
isModifierKey(key) { | ||
return key in this._modifierKeys; | ||
}; | ||
} | ||
/** | ||
@@ -102,7 +101,6 @@ * Get the key for a `'keydown'` event. | ||
*/ | ||
KeycodeLayout.prototype.keyForKeydownEvent = function (event) { | ||
keyForKeydownEvent(event) { | ||
return this._codes[event.keyCode] || ''; | ||
}; | ||
return KeycodeLayout; | ||
}()); | ||
} | ||
} | ||
/** | ||
@@ -120,4 +118,4 @@ * The namespace for the `KeycodeLayout` class statics. | ||
function extractKeys(codes) { | ||
var keys = Object.create(null); | ||
for (var c in codes) { | ||
let keys = Object.create(null); | ||
for (let c in codes) { | ||
keys[codes[c]] = true; | ||
@@ -136,4 +134,4 @@ } | ||
function convertToKeySet(keys) { | ||
var keySet = Object(null); | ||
for (var i = 0, n = keys.length; i < n; ++i) { | ||
let keySet = Object(null); | ||
for (let i = 0, n = keys.length; i < n; ++i) { | ||
keySet[keys[i]] = true; | ||
@@ -166,3 +164,3 @@ } | ||
*/ | ||
var EN_US = new KeycodeLayout('en-us', { | ||
const EN_US = new KeycodeLayout('en-us', { | ||
8: 'Backspace', | ||
@@ -169,0 +167,0 @@ 9: 'Tab', |
@@ -5,3 +5,3 @@ (function (global, factory) { | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.lumino_keyboard = {})); | ||
}(this, (function (exports) { 'use strict'; | ||
})(this, (function (exports) { 'use strict'; | ||
@@ -51,3 +51,3 @@ // Copyright (c) Jupyter Development Team. | ||
*/ | ||
exports.KeycodeLayout = /** @class */ (function () { | ||
class KeycodeLayout { | ||
/** | ||
@@ -62,4 +62,3 @@ * Construct a new keycode layout. | ||
*/ | ||
function KeycodeLayout(name, codes, modifierKeys) { | ||
if (modifierKeys === void 0) { modifierKeys = []; } | ||
constructor(name, codes, modifierKeys = []) { | ||
this.name = name; | ||
@@ -75,5 +74,5 @@ this._codes = codes; | ||
*/ | ||
KeycodeLayout.prototype.keys = function () { | ||
keys() { | ||
return Object.keys(this._keys); | ||
}; | ||
} | ||
/** | ||
@@ -86,5 +85,5 @@ * Test whether the given key is a valid value for the layout. | ||
*/ | ||
KeycodeLayout.prototype.isValidKey = function (key) { | ||
isValidKey(key) { | ||
return key in this._keys; | ||
}; | ||
} | ||
/** | ||
@@ -97,5 +96,5 @@ * Test whether the given key is a modifier key. | ||
*/ | ||
KeycodeLayout.prototype.isModifierKey = function (key) { | ||
isModifierKey(key) { | ||
return key in this._modifierKeys; | ||
}; | ||
} | ||
/** | ||
@@ -109,7 +108,6 @@ * Get the key for a `'keydown'` event. | ||
*/ | ||
KeycodeLayout.prototype.keyForKeydownEvent = function (event) { | ||
keyForKeydownEvent(event) { | ||
return this._codes[event.keyCode] || ''; | ||
}; | ||
return KeycodeLayout; | ||
}()); | ||
} | ||
} | ||
/** | ||
@@ -127,4 +125,4 @@ * The namespace for the `KeycodeLayout` class statics. | ||
function extractKeys(codes) { | ||
var keys = Object.create(null); | ||
for (var c in codes) { | ||
let keys = Object.create(null); | ||
for (let c in codes) { | ||
keys[codes[c]] = true; | ||
@@ -143,4 +141,4 @@ } | ||
function convertToKeySet(keys) { | ||
var keySet = Object(null); | ||
for (var i = 0, n = keys.length; i < n; ++i) { | ||
let keySet = Object(null); | ||
for (let i = 0, n = keys.length; i < n; ++i) { | ||
keySet[keys[i]] = true; | ||
@@ -151,3 +149,3 @@ } | ||
KeycodeLayout.convertToKeySet = convertToKeySet; | ||
})(exports.KeycodeLayout || (exports.KeycodeLayout = {})); | ||
})(KeycodeLayout || (KeycodeLayout = {})); | ||
/** | ||
@@ -174,3 +172,3 @@ * A keycode-based keyboard layout for US English keyboards. | ||
*/ | ||
var EN_US = new exports.KeycodeLayout('en-us', { | ||
const EN_US = new KeycodeLayout('en-us', { | ||
8: 'Backspace', | ||
@@ -289,2 +287,3 @@ 9: 'Tab', | ||
exports.EN_US = EN_US; | ||
exports.KeycodeLayout = KeycodeLayout; | ||
exports.getKeyboardLayout = getKeyboardLayout; | ||
@@ -295,3 +294,3 @@ exports.setKeyboardLayout = setKeyboardLayout; | ||
}))); | ||
})); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).lumino_keyboard={})}(this,(function(e){"use strict";var t;e.KeycodeLayout=function(){function e(t,o,n){void 0===n&&(n=[]),this.name=t,this._codes=o,this._keys=e.extractKeys(o),this._modifierKeys=e.convertToKeySet(n)}return e.prototype.keys=function(){return Object.keys(this._keys)},e.prototype.isValidKey=function(e){return e in this._keys},e.prototype.isModifierKey=function(e){return e in this._modifierKeys},e.prototype.keyForKeydownEvent=function(e){return this._codes[e.keyCode]||""},e}(),(t=e.KeycodeLayout||(e.KeycodeLayout={})).extractKeys=function(e){var t=Object.create(null);for(var o in e)t[e[o]]=!0;return t},t.convertToKeySet=function(e){for(var t=Object(null),o=0,n=e.length;o<n;++o)t[e[o]]=!0;return t};var o,n=new e.KeycodeLayout("en-us",{8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",27:"Escape",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"Meta",93:"ContextMenu",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Meta"},["Shift","Ctrl","Alt","Meta"]);!function(e){e.keyboardLayout=n}(o||(o={})),e.EN_US=n,e.getKeyboardLayout=function(){return o.keyboardLayout},e.setKeyboardLayout=function(e){o.keyboardLayout=e},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).lumino_keyboard={})}(this,(function(e){"use strict";class t{constructor(e,o,n=[]){this.name=e,this._codes=o,this._keys=t.extractKeys(o),this._modifierKeys=t.convertToKeySet(n)}keys(){return Object.keys(this._keys)}isValidKey(e){return e in this._keys}isModifierKey(e){return e in this._modifierKeys}keyForKeydownEvent(e){return this._codes[e.keyCode]||""}}!function(e){e.extractKeys=function(e){let t=Object.create(null);for(let o in e)t[e[o]]=!0;return t},e.convertToKeySet=function(e){let t=Object(null);for(let o=0,n=e.length;o<n;++o)t[e[o]]=!0;return t}}(t||(t={}));const o=new t("en-us",{8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",27:"Escape",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"Meta",93:"ContextMenu",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Meta"},["Shift","Ctrl","Alt","Meta"]);var n;!function(e){e.keyboardLayout=o}(n||(n={})),e.EN_US=o,e.KeycodeLayout=t,e.getKeyboardLayout=function(){return n.keyboardLayout},e.setKeyboardLayout=function(e){n.keyboardLayout=e},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.min.js.map |
{ | ||
"name": "@lumino/keyboard", | ||
"version": "1.8.2", | ||
"version": "2.0.0-alpha.0", | ||
"description": "Lumino Keyboard", | ||
@@ -14,9 +14,3 @@ "homepage": "https://github.com/jupyterlab/lumino", | ||
"license": "BSD-3-Clause", | ||
"author": "S. Chris Colbert <sccolbert@gmail.com>", | ||
"contributors": [ | ||
"A. T. Darian <git@darian.email>", | ||
"Dave Willmer <dave.willmer@gmail.com>", | ||
"S. Chris Colbert <sccolbert@gmail.com>", | ||
"Steven Silvester <steven.silvester@gmail.com>" | ||
], | ||
"author": "Project Jupyter", | ||
"main": "dist/index.js", | ||
@@ -39,3 +33,2 @@ "jsdelivr": "dist/index.min.js", | ||
"clean:test": "rimraf tests/build", | ||
"docs": "typedoc --options tdoptions.json src", | ||
"minimize": "terser dist/index.js -c -m --source-map \"content='dist/index.js.map',url='index.min.js.map'\" -o dist/index.min.js", | ||
@@ -50,4 +43,9 @@ "test": "npm run test:firefox-headless", | ||
}, | ||
"typedoc": { | ||
"entryPoint": "./src/index.ts", | ||
"displayName": "keyboard" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "^7.6.0", | ||
"@rollup/plugin-node-resolve": "^13.3.0", | ||
"@types/chai": "^3.4.35", | ||
@@ -63,14 +61,13 @@ "@types/mocha": "^2.2.39", | ||
"mocha": "^9.0.3", | ||
"postcss": "^8.4.14", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.56.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-postcss": "^4.0.0", | ||
"rollup": "^2.77.2", | ||
"rollup-plugin-postcss": "^4.0.2", | ||
"rollup-plugin-sourcemaps": "^0.6.3", | ||
"simulate-event": "^1.4.0", | ||
"terser": "^5.7.1", | ||
"tslib": "^2.3.0", | ||
"typedoc": "~0.15.0", | ||
"typescript": "~3.6.0", | ||
"webpack": "^4.41.3", | ||
"webpack-cli": "^3.3.10" | ||
"tslib": "^2.4.0", | ||
"typedoc": "~0.23.9", | ||
"typescript": "~4.7.3", | ||
"webpack": "^5.74.0", | ||
"webpack-cli": "^4.10.0" | ||
}, | ||
@@ -77,0 +74,0 @@ "publishConfig": { |
@@ -189,2 +189,1 @@ /** | ||
export declare const EN_US: IKeyboardLayout; | ||
//# sourceMappingURL=index.d.ts.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
70629
9
1083
1
1