Merge remote-tracking branch 'origin' into staging

This commit is contained in:
Francisco Hodge 2019-07-14 17:11:32 -04:00
commit 2113229d61
13 changed files with 743 additions and 378 deletions

View File

@ -1,6 +1,6 @@
/*!
*
* simple-keyboard v2.24.0
* simple-keyboard v2.24.1
* https://github.com/hodgef/simple-keyboard
*
* Copyright (c) Francisco Hodge (https://github.com/hodgef)
@ -8,5 +8,5 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/body,html{margin:0;padding:0}.simple-keyboard{font-family:HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:border-box;overflow:hidden;touch-action:manipulation}.simple-keyboard .hg-row{display:flex}.simple-keyboard .hg-row:not(:last-child){margin-bottom:5px}.simple-keyboard .hg-row .hg-button-container,.simple-keyboard .hg-row .hg-button:not(:last-child){margin-right:5px}.simple-keyboard .hg-row>div:last-child{margin-right:0}.simple-keyboard .hg-row .hg-button-container{display:flex}.simple-keyboard .hg-button{display:inline-block;flex-grow:1;cursor:pointer}.simple-keyboard .hg-button span{pointer-events:none}.simple-keyboard.hg-theme-default{background-color:rgba(0,0,0,.1);padding:5px;border-radius:5px}.simple-keyboard.hg-theme-default .hg-button{box-shadow:0 0 3px -1px rgba(0,0,0,.3);height:40px;border-radius:5px;box-sizing:border-box;padding:5px;background:#fff;border-bottom:1px solid #b5b5b5;cursor:pointer;display:flex;align-items:center;justify-content:center}.simple-keyboard button.hg-button{border-width:0;outline:0;font-size:inherit}.simple-keyboard.hg-theme-default:not(.hg-touch-events) .hg-button:active{background:#e4e4e4}.simple-keyboard.hg-theme-default.hg-layout-numeric .hg-button{width:33.3%;height:60px;align-items:center;display:flex;justify-content:center}.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadadd,.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadenter{height:85px}.simple-keyboard.hg-theme-default .hg-button.hg-button-numpad0{width:105px}.simple-keyboard.hg-theme-default .hg-button.hg-button-com{max-width:85px}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn.hg-button-at{max-width:45px}.simple-keyboard.hg-theme-default .hg-button.hg-selectedButton{background:rgba(5,25,70,.53);color:#fff}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=".com"]{max-width:82px}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn="@"]{max-width:60px}
*/body,html{margin:0;padding:0}.simple-keyboard{font-family:HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:border-box;overflow:hidden;touch-action:manipulation}.simple-keyboard .hg-row{display:flex}.simple-keyboard .hg-row:not(:last-child){margin-bottom:5px}.simple-keyboard .hg-row .hg-button-container,.simple-keyboard .hg-row .hg-button:not(:last-child){margin-right:5px}.simple-keyboard .hg-row>div:last-child{margin-right:0}.simple-keyboard .hg-row .hg-button-container{display:flex}.simple-keyboard .hg-button{display:inline-block;flex-grow:1;cursor:pointer}.simple-keyboard .hg-button span{pointer-events:none}.simple-keyboard.hg-theme-default{background-color:rgba(0,0,0,.1);padding:5px;border-radius:5px}.simple-keyboard.hg-theme-default .hg-button{box-shadow:0 0 3px -1px rgba(0,0,0,.3);height:40px;border-radius:5px;box-sizing:border-box;padding:5px;background:#fff;border-bottom:1px solid #b5b5b5;cursor:pointer;display:flex;align-items:center;justify-content:center}.simple-keyboard button.hg-button{border-width:0;outline:0;font-size:inherit}.simple-keyboard.hg-theme-default.hg-layout-numeric .hg-button{width:33.3%;height:60px;align-items:center;display:flex;justify-content:center}.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadadd,.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadenter{height:85px}.simple-keyboard.hg-theme-default .hg-button.hg-button-numpad0{width:105px}.simple-keyboard.hg-theme-default .hg-button.hg-button-com{max-width:85px}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn.hg-button-at{max-width:45px}.simple-keyboard.hg-theme-default .hg-button.hg-selectedButton{background:rgba(5,25,70,.53);color:#fff}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=".com"]{max-width:82px}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn="@"]{max-width:60px}
/*# sourceMappingURL=index.css.map */

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*!
*
* simple-keyboard v2.24.0 (Non-minified build)
* simple-keyboard v2.24.1 (Non-minified build)
* https://github.com/hodgef/simple-keyboard
*
* Copyright (c) Francisco Hodge (https://github.com/hodgef)
@ -8,4 +8,4 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/body,html{margin:0;padding:0}.simple-keyboard{font-family:HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:border-box;overflow:hidden;touch-action:manipulation}.simple-keyboard .hg-row{display:flex}.simple-keyboard .hg-row:not(:last-child){margin-bottom:5px}.simple-keyboard .hg-row .hg-button-container,.simple-keyboard .hg-row .hg-button:not(:last-child){margin-right:5px}.simple-keyboard .hg-row>div:last-child{margin-right:0}.simple-keyboard .hg-row .hg-button-container{display:flex}.simple-keyboard .hg-button{display:inline-block;flex-grow:1;cursor:pointer}.simple-keyboard .hg-button span{pointer-events:none}.simple-keyboard.hg-theme-default{background-color:rgba(0,0,0,.1);padding:5px;border-radius:5px}.simple-keyboard.hg-theme-default .hg-button{box-shadow:0 0 3px -1px rgba(0,0,0,.3);height:40px;border-radius:5px;box-sizing:border-box;padding:5px;background:#fff;border-bottom:1px solid #b5b5b5;cursor:pointer;display:flex;align-items:center;justify-content:center}.simple-keyboard button.hg-button{border-width:0;outline:0;font-size:inherit}.simple-keyboard.hg-theme-default:not(.hg-touch-events) .hg-button:active{background:#e4e4e4}.simple-keyboard.hg-theme-default.hg-layout-numeric .hg-button{width:33.3%;height:60px;align-items:center;display:flex;justify-content:center}.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadadd,.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadenter{height:85px}.simple-keyboard.hg-theme-default .hg-button.hg-button-numpad0{width:105px}.simple-keyboard.hg-theme-default .hg-button.hg-button-com{max-width:85px}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn.hg-button-at{max-width:45px}.simple-keyboard.hg-theme-default .hg-button.hg-selectedButton{background:rgba(5,25,70,.53);color:#fff}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=".com"]{max-width:82px}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn="@"]{max-width:60px}
*/body,html{margin:0;padding:0}.simple-keyboard{font-family:HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:border-box;overflow:hidden;touch-action:manipulation}.simple-keyboard .hg-row{display:flex}.simple-keyboard .hg-row:not(:last-child){margin-bottom:5px}.simple-keyboard .hg-row .hg-button-container,.simple-keyboard .hg-row .hg-button:not(:last-child){margin-right:5px}.simple-keyboard .hg-row>div:last-child{margin-right:0}.simple-keyboard .hg-row .hg-button-container{display:flex}.simple-keyboard .hg-button{display:inline-block;flex-grow:1;cursor:pointer}.simple-keyboard .hg-button span{pointer-events:none}.simple-keyboard.hg-theme-default{background-color:rgba(0,0,0,.1);padding:5px;border-radius:5px}.simple-keyboard.hg-theme-default .hg-button{box-shadow:0 0 3px -1px rgba(0,0,0,.3);height:40px;border-radius:5px;box-sizing:border-box;padding:5px;background:#fff;border-bottom:1px solid #b5b5b5;cursor:pointer;display:flex;align-items:center;justify-content:center}.simple-keyboard button.hg-button{border-width:0;outline:0;font-size:inherit}.simple-keyboard.hg-theme-default.hg-layout-numeric .hg-button{width:33.3%;height:60px;align-items:center;display:flex;justify-content:center}.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadadd,.simple-keyboard.hg-theme-default .hg-button.hg-button-numpadenter{height:85px}.simple-keyboard.hg-theme-default .hg-button.hg-button-numpad0{width:105px}.simple-keyboard.hg-theme-default .hg-button.hg-button-com{max-width:85px}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn.hg-button-at{max-width:45px}.simple-keyboard.hg-theme-default .hg-button.hg-selectedButton{background:rgba(5,25,70,.53);color:#fff}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn=".com"]{max-width:82px}.simple-keyboard.hg-theme-default .hg-button.hg-standardBtn[data-skbtn="@"]{max-width:60px}

5
build/index.d.ts vendored
View File

@ -133,6 +133,11 @@ declare module 'simple-keyboard' {
*/
onKeyPress?: (button: string) => any;
/**
* Executes the callback function on key release.
*/
onKeyReleased?: (button: string) => any;
/**
* Executes the callback function on input change. Returns the current input's string.
*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*!
*
* simple-keyboard v2.24.0 (Non-minified build)
* simple-keyboard v2.24.1 (Non-minified build)
* https://github.com/hodgef/simple-keyboard
*
* Copyright (c) Francisco Hodge (https://github.com/hodgef)
@ -995,15 +995,15 @@
* Handles button mouseup
*/ }, {
key: "handleButtonMouseUp",
value: function handleButtonMouseUp() {
value: function handleButtonMouseUp(button) {
this.isMouseHold = false;
if (this.holdInteractionTimeout) {
clearTimeout(this.holdInteractionTimeout);
/**
* Calling onKeyReleased
*/ }
if (typeof this.options.onKeyReleased === "function") {
this.options.onKeyReleased();
if (button && typeof this.options.onKeyReleased === "function") {
this.options.onKeyReleased(button);
}
}
/**
@ -1328,7 +1328,7 @@
this.caretEventHandler(event);
}
/**
* Called by {@link caretEventHandler} when an event that warrants a cursor position update is triggered
* Called by {@link setEventListeners} when an event that warrants a cursor position update is triggered
*/ }, {
key: "caretEventHandler",
value: function caretEventHandler(event) {
@ -1684,11 +1684,11 @@
_this10.handleButtonClicked(button);
_this10.handleButtonMouseDown(button, e);
};
buttonDOM.onpointerup = function(e) {
_this10.handleButtonMouseUp();
buttonDOM.onpointerup = function() {
return _this10.handleButtonMouseUp(button);
};
buttonDOM.onpointercancel = function(e) {
return _this10.handleButtonMouseUp();
buttonDOM.onpointercancel = function() {
return _this10.handleButtonMouseUp(button);
};
} else {
/**
@ -1700,11 +1700,11 @@
_this10.handleButtonClicked(button);
_this10.handleButtonMouseDown(button, e);
};
buttonDOM.ontouchend = function(e) {
return _this10.handleButtonMouseUp();
buttonDOM.ontouchend = function() {
return _this10.handleButtonMouseUp(button);
};
buttonDOM.ontouchcancel = function(e) {
return _this10.handleButtonMouseUp();
buttonDOM.ontouchcancel = function() {
return _this10.handleButtonMouseUp(button);
};
} else {
/**
@ -1714,7 +1714,10 @@
_this10.handleButtonClicked(button);
};
buttonDOM.onmousedown = function(e) {
_this10.handleButtonMouseDown(button, e);
return _this10.handleButtonMouseDown(button, e);
};
buttonDOM.onmouseup = function() {
return _this10.handleButtonMouseUp(button);
};
}
}
@ -1767,10 +1770,10 @@
} else if (useTouchEvents) {
/**
* Handling ontouchend, ontouchcancel
*/ document.ontouchend = function(e) {
*/ document.ontouchend = function() {
return _this10.handleButtonMouseUp();
};
document.ontouchcancel = function(e) {
document.ontouchcancel = function() {
return _this10.handleButtonMouseUp();
};
} else if (!useTouchEvents) {

964
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "simple-keyboard",
"version": "2.24.0",
"version": "2.24.1",
"description": "On-screen Javascript Virtual Keyboard",
"main": "build/index.js",
"types": "build/index.d.ts",
@ -40,35 +40,35 @@
],
"license": "MIT",
"devDependencies": {
"@babel/core": "7.4.5",
"@babel/core": "7.5.4",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "^7.4.4",
"@svgr/webpack": "4.3.0",
"@typescript-eslint/eslint-plugin": "1.9.0",
"@typescript-eslint/parser": "1.9.0",
"babel-eslint": "10.0.1",
"@svgr/webpack": "4.3.1",
"@typescript-eslint/eslint-plugin": "1.12.0",
"@typescript-eslint/parser": "1.12.0",
"babel-eslint": "10.0.2",
"babel-jest": "24.8.0",
"babel-loader": "8.0.6",
"babel-plugin-named-asset-import": "^0.3.2",
"babel-preset-react-app": "^9.0.0",
"case-sensitive-paths-webpack-plugin": "2.2.0",
"copy-webpack-plugin": "^5.0.3",
"css-loader": "2.1.1",
"css-loader": "3.0.0",
"dotenv": "8.0.0",
"dotenv-expand": "5.1.0",
"eslint": "^5.16.0",
"eslint-config-react-app": "^4.0.1",
"eslint-loader": "2.1.2",
"eslint-plugin-flowtype": "3.9.1",
"eslint-plugin-import": "2.17.3",
"eslint-plugin-jsx-a11y": "6.2.1",
"eslint-plugin-react": "7.13.0",
"eslint-loader": "2.2.1",
"eslint-plugin-flowtype": "3.10.4",
"eslint-plugin-import": "2.18.0",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-react": "7.14.2",
"eslint-plugin-react-hooks": "^1.5.0",
"file-loader": "3.0.1",
"fs-extra": "8.0.1",
"html-webpack-plugin": "4.0.0-beta.5",
"file-loader": "4.0.0",
"fs-extra": "8.1.0",
"html-webpack-plugin": "4.0.0-beta.7",
"identity-obj-proxy": "3.0.0",
"is-wsl": "^2.0.0",
"jest": "24.8.0",
@ -76,12 +76,12 @@
"jest-resolve": "24.8.0",
"jest-watch-typeahead": "0.3.1",
"mini-css-extract-plugin": "0.7.0",
"optimize-css-assets-webpack-plugin": "5.0.1",
"pnp-webpack-plugin": "1.4.3",
"optimize-css-assets-webpack-plugin": "5.0.3",
"pnp-webpack-plugin": "1.5.0",
"postcss-flexbugs-fixes": "4.1.0",
"postcss-loader": "3.0.0",
"postcss-normalize": "7.0.0",
"postcss-preset-env": "6.6.0",
"postcss-normalize": "8.0.1",
"postcss-preset-env": "6.7.0",
"postcss-safe-parser": "4.0.1",
"prettier": "^1.17.0",
"prettier-webpack-plugin": "^1.2.0",
@ -91,13 +91,13 @@
"react-dom": "^16.8.6",
"resolve": "1.11.1",
"sass-loader": "7.1.0",
"semver": "6.1.1",
"semver": "6.2.0",
"style-loader": "0.23.1",
"terser-webpack-plugin": "1.3.0",
"uglifyjs-webpack-plugin": "^2.1.2",
"url-loader": "1.1.2",
"webpack": "4.33.0",
"webpack-dev-server": "3.5.1",
"url-loader": "2.0.1",
"webpack": "4.35.3",
"webpack-dev-server": "3.7.2",
"webpack-manifest-plugin": "2.0.4",
"workbox-webpack-plugin": "4.3.1"
},

View File

@ -133,6 +133,11 @@ declare module 'simple-keyboard' {
*/
onKeyPress?: (button: string) => any;
/**
* Executes the callback function on key release.
*/
onKeyReleased?: (button: string) => any;
/**
* Executes the callback function on input change. Returns the current input's string.
*/

View File

@ -78,10 +78,6 @@ html {
font-size: inherit;
}
.simple-keyboard.hg-theme-default:not(.hg-touch-events) .hg-button:active {
background: #e4e4e4;
}
.simple-keyboard.hg-theme-default.hg-layout-numeric .hg-button {
width: 33.3%;
height: 60px;

View File

@ -295,15 +295,15 @@ class SimpleKeyboard {
/**
* Handles button mouseup
*/
handleButtonMouseUp() {
handleButtonMouseUp(button) {
this.isMouseHold = false;
if (this.holdInteractionTimeout) clearTimeout(this.holdInteractionTimeout);
/**
* Calling onKeyReleased
*/
if (typeof this.options.onKeyReleased === "function")
this.options.onKeyReleased();
if (button && typeof this.options.onKeyReleased === "function")
this.options.onKeyReleased(button);
}
/**
@ -672,7 +672,7 @@ class SimpleKeyboard {
}
/**
* Called by {@link caretEventHandler} when an event that warrants a cursor position update is triggered
* Called by {@link setEventListeners} when an event that warrants a cursor position update is triggered
*/
caretEventHandler(event) {
let targetTagName;
@ -757,9 +757,9 @@ class SimpleKeyboard {
themeObj.class
)
) {
buttonThemesParsed[themeButton] = `${themeParsed} ${
themeObj.class
}`;
buttonThemesParsed[
themeButton
] = `${themeParsed} ${themeObj.class}`;
}
} else {
buttonThemesParsed[themeButton] = themeObj.class;
@ -986,9 +986,7 @@ class SimpleKeyboard {
*/
let containerDOM = document.createElement("div");
containerDOM.className += "hg-button-container";
let containerUID = `${
this.options.layoutName
}-r${rowIndex}c${arrIndex}`;
let containerUID = `${this.options.layoutName}-r${rowIndex}c${arrIndex}`;
containerDOM.setAttribute("data-skUID", containerUID);
/**
@ -1073,9 +1071,7 @@ class SimpleKeyboard {
/**
* Adding themeClass, layoutClass to keyboardDOM
*/
this.keyboardDOM.className += ` ${this.options.theme} ${layoutClass} ${
this.keyboardPluginClasses
} ${useTouchEventsClass}`;
this.keyboardDOM.className += ` ${this.options.theme} ${layoutClass} ${this.keyboardPluginClasses} ${useTouchEventsClass}`;
/**
* Iterating through each row
@ -1168,10 +1164,8 @@ class SimpleKeyboard {
this.handleButtonClicked(button);
this.handleButtonMouseDown(button, e);
};
buttonDOM.onpointerup = e => {
this.handleButtonMouseUp();
};
buttonDOM.onpointercancel = e => this.handleButtonMouseUp();
buttonDOM.onpointerup = () => this.handleButtonMouseUp(button);
buttonDOM.onpointercancel = () => this.handleButtonMouseUp(button);
} else {
/**
* Fallback for browsers not supporting PointerEvents
@ -1184,8 +1178,8 @@ class SimpleKeyboard {
this.handleButtonClicked(button);
this.handleButtonMouseDown(button, e);
};
buttonDOM.ontouchend = e => this.handleButtonMouseUp();
buttonDOM.ontouchcancel = e => this.handleButtonMouseUp();
buttonDOM.ontouchend = () => this.handleButtonMouseUp(button);
buttonDOM.ontouchcancel = () => this.handleButtonMouseUp(button);
} else {
/**
* Handle mouse events
@ -1194,9 +1188,8 @@ class SimpleKeyboard {
this.isMouseHold = false;
this.handleButtonClicked(button);
};
buttonDOM.onmousedown = e => {
this.handleButtonMouseDown(button, e);
};
buttonDOM.onmousedown = e => this.handleButtonMouseDown(button, e);
buttonDOM.onmouseup = () => this.handleButtonMouseUp(button);
}
}
@ -1278,8 +1271,8 @@ class SimpleKeyboard {
/**
* Handling ontouchend, ontouchcancel
*/
document.ontouchend = e => this.handleButtonMouseUp();
document.ontouchcancel = e => this.handleButtonMouseUp();
document.ontouchend = () => this.handleButtonMouseUp();
document.ontouchcancel = () => this.handleButtonMouseUp();
} else if (!useTouchEvents) {
/**
* Handling mouseup

View File

@ -1281,10 +1281,12 @@ it('Keyboard onKeyReleased will work', () => {
let pressed = false;
let firedTimes = 0;
let buttonPressed;
let keyboard = new Keyboard({
onKeyReleased: () => {
onKeyReleased: button => {
pressed = true;
buttonPressed = button;
firedTimes++;
},
debug: true
@ -1295,4 +1297,5 @@ it('Keyboard onKeyReleased will work', () => {
expect(pressed).toBeTruthy();
expect(firedTimes).toBe(1);
expect(buttonPressed).toBe("q");
});