Compare commits

...

46 Commits

Author SHA1 Message Date
Francisco Hodge
56fc194ad6 Added physicalKeyboardHighlightPress option. Fixes #735 2020-10-20 20:54:31 -04:00
Francisco Hodge
114f82525f Build update 2020-10-20 18:29:14 +00:00
Francisco Hodge
dd34621720 2.31.12 2020-10-20 18:29:09 +00:00
Francisco Hodge
0aac95f608 Update stale.yml 2020-10-20 14:27:11 -04:00
Francisco Hodge
6c8c34dfe1 Build update 2020-10-19 23:38:38 +00:00
Francisco Hodge
54082f1b95 2.31.11 2020-10-19 23:38:33 +00:00
dependabot-preview[bot]
a949ee7926 Merge pull request #744 from hodgef/dependabot/npm_and_yarn/resolve-1.18.1 2020-10-19 23:37:06 +00:00
Francisco Hodge
e0a055284e Build update 2020-10-19 23:35:03 +00:00
Francisco Hodge
1f4f46a1a2 2.31.10 2020-10-19 23:34:58 +00:00
dependabot-preview[bot]
28ba4daf8c Bump resolve from 1.17.0 to 1.18.1
Bumps [resolve](https://github.com/browserify/resolve) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/browserify/resolve/releases)
- [Commits](https://github.com/browserify/resolve/compare/v1.17.0...v1.18.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-19 23:34:11 +00:00
dependabot-preview[bot]
337ded8311 Merge pull request #746 from hodgef/dependabot/npm_and_yarn/jest-resolve-26.6.0 2020-10-19 23:33:21 +00:00
Francisco Hodge
6edc53285a Build update 2020-10-19 23:33:02 +00:00
Francisco Hodge
3511e26c6d 2.31.9 2020-10-19 23:32:57 +00:00
dependabot-preview[bot]
2edf58291b Merge pull request #747 from hodgef/dependabot/npm_and_yarn/babel-jest-26.6.0 2020-10-19 23:31:28 +00:00
dependabot-preview[bot]
86c9251861 Bump jest-resolve from 26.5.2 to 26.6.0
Bumps [jest-resolve](https://github.com/facebook/jest/tree/HEAD/packages/jest-resolve) from 26.5.2 to 26.6.0.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v26.6.0/packages/jest-resolve)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-19 23:30:44 +00:00
Francisco Hodge
92414394ee Build update 2020-10-19 23:29:10 +00:00
Francisco Hodge
3db163a406 2.31.8 2020-10-19 23:29:05 +00:00
dependabot-preview[bot]
4c8001bba5 Bump babel-jest from 26.5.2 to 26.6.0
Bumps [babel-jest](https://github.com/facebook/jest/tree/HEAD/packages/babel-jest) from 26.5.2 to 26.6.0.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v26.6.0/packages/babel-jest)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-19 23:28:48 +00:00
dependabot-preview[bot]
e6b9cc43e0 Merge pull request #745 from hodgef/dependabot/npm_and_yarn/jest-26.6.0 2020-10-19 23:27:47 +00:00
Francisco Hodge
cf0507a097 Build update 2020-10-19 23:25:27 +00:00
Francisco Hodge
bc65517097 2.31.7 2020-10-19 23:25:22 +00:00
dependabot-preview[bot]
3d1dbea26b Bump jest from 26.5.3 to 26.6.0
Bumps [jest](https://github.com/facebook/jest) from 26.5.3 to 26.6.0.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v26.5.3...v26.6.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-19 23:25:12 +00:00
dependabot-preview[bot]
d2f271bce3 Merge pull request #743 from hodgef/dependabot/npm_and_yarn/mini-css-extract-plugin-1.1.0 2020-10-19 23:24:12 +00:00
dependabot-preview[bot]
ce2f132433 Bump mini-css-extract-plugin from 1.0.0 to 1.1.0
Bumps [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/webpack-contrib/mini-css-extract-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/mini-css-extract-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v1.0.0...v1.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-19 23:21:27 +00:00
Francisco Hodge
78544a2aee Build update 2020-10-17 11:30:13 +00:00
Francisco Hodge
5ddfcdcb5c 2.31.6 2020-10-17 11:30:07 +00:00
dependabot-preview[bot]
808fdd4a8d Merge pull request #740 from hodgef/dependabot/npm_and_yarn/babel/plugin-proposal-class-properties-7.12.1 2020-10-17 11:28:46 +00:00
dependabot-preview[bot]
dcb4b116f6 Bump @babel/plugin-proposal-class-properties from 7.10.4 to 7.12.1
Bumps [@babel/plugin-proposal-class-properties](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-proposal-class-properties) from 7.10.4 to 7.12.1.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.1/packages/babel-plugin-proposal-class-properties)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-17 11:25:46 +00:00
Francisco Hodge
9257beac1c Build update 2020-10-17 11:16:16 +00:00
Francisco Hodge
2580003ba2 2.31.5 2020-10-17 11:16:10 +00:00
dependabot-preview[bot]
f19464a245 Merge pull request #738 from hodgef/dependabot/npm_and_yarn/babel/preset-react-7.12.1 2020-10-17 11:14:42 +00:00
dependabot-preview[bot]
3a410b6700 Bump @babel/preset-react from 7.10.4 to 7.12.1
Bumps [@babel/preset-react](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-react) from 7.10.4 to 7.12.1.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.1/packages/babel-preset-react)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-17 11:12:09 +00:00
Francisco Hodge
010bfdb9b5 Build update 2020-10-16 23:03:31 +00:00
Francisco Hodge
f6d2ff182a 2.31.4 2020-10-16 23:03:25 +00:00
dependabot-preview[bot]
83850686eb Merge pull request #741 from hodgef/dependabot/npm_and_yarn/babel/core-7.12.3 2020-10-16 23:01:58 +00:00
Francisco Hodge
97120ce00e Build update 2020-10-16 23:00:33 +00:00
Francisco Hodge
cff0d2f6f2 2.31.3 2020-10-16 23:00:28 +00:00
dependabot-preview[bot]
1aa6c3f483 Bump @babel/core from 7.12.0 to 7.12.3
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.12.0 to 7.12.3.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.3/packages/babel-core)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-16 22:59:22 +00:00
dependabot-preview[bot]
d2991c7452 Merge pull request #739 from hodgef/dependabot/npm_and_yarn/react-dom-16.14.0 2020-10-16 22:59:12 +00:00
Francisco Hodge
4b79de583d Build update 2020-10-16 22:57:29 +00:00
Francisco Hodge
47650485a3 2.31.2 2020-10-16 22:57:24 +00:00
dependabot-preview[bot]
b844990e98 Bump react-dom from 16.13.1 to 16.14.0
Bumps [react-dom](https://github.com/facebook/react/tree/HEAD/packages/react-dom) from 16.13.1 to 16.14.0.
- [Release notes](https://github.com/facebook/react/releases)
- [Changelog](https://github.com/facebook/react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/react/commits/v16.14.0/packages/react-dom)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-16 22:56:44 +00:00
dependabot-preview[bot]
d4f7b45ffc Merge pull request #737 from hodgef/dependabot/npm_and_yarn/babel/preset-env-7.12.1 2020-10-16 22:55:47 +00:00
dependabot-preview[bot]
4bdff64f39 Bump @babel/preset-env from 7.12.0 to 7.12.1
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.12.0 to 7.12.1.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.12.1/packages/babel-preset-env)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-16 22:53:00 +00:00
Francisco Hodge
f4b87e76a8 Build update 2020-10-16 04:15:31 +00:00
Francisco Hodge
d22362468a 2.31.1 2020-10-16 04:15:26 +00:00
13 changed files with 2056 additions and 953 deletions

4
.github/stale.yml vendored
View File

@@ -1,5 +1,5 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 3
daysUntilStale: 5
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 2
# Issues with these labels will never be considered stale
@@ -14,4 +14,4 @@ markComment: >
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
closeComment: false

View File

@@ -1,6 +1,6 @@
/*!
*
* simple-keyboard v2.31.0
* simple-keyboard v2.32.0
* https://github.com/hodgef/simple-keyboard
*
* Copyright (c) Francisco Hodge (https://github.com/hodgef)

File diff suppressed because one or more lines are too long

25
build/index.d.ts vendored
View File

@@ -87,6 +87,21 @@ declare module 'simple-keyboard' {
*/
physicalKeyboardHighlight?: boolean;
/**
* Presses keys highlighted by physicalKeyboardHighlight
*/
physicalKeyboardHighlightPress?: boolean;
/**
* Define the text color that the physical keyboard highlighted key should have.
*/
physicalKeyboardHighlightTextColor?: string;
/**
* Define the background color that the physical keyboard highlighted key should have.
*/
physicalKeyboardHighlightBgColor?: string;
/**
* Calling preventDefault for the mousedown events keeps the focus on the input.
*/
@@ -107,16 +122,6 @@ declare module 'simple-keyboard' {
*/
stopMouseUpPropagation?: boolean;
/**
* Define the text color that the physical keyboard highlighted key should have.
*/
physicalKeyboardHighlightTextColor?: string;
/**
* Define the background color that the physical keyboard highlighted key should have.
*/
physicalKeyboardHighlightBgColor?: string;
/**
* Render buttons as a button element instead of a div element.
*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2838
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.31.0",
"version": "2.32.0",
"description": "On-screen Javascript Virtual Keyboard",
"main": "build/index.js",
"types": "build/index.d.ts",
@@ -40,10 +40,10 @@
],
"license": "MIT",
"devDependencies": {
"@babel/core": "7.12.0",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/preset-env": "^7.12.0",
"@babel/preset-react": "^7.10.4",
"@babel/core": "7.12.3",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/preset-env": "^7.12.1",
"@babel/preset-react": "^7.12.1",
"@svgr/webpack": "5.4.0",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
@@ -51,7 +51,7 @@
"@typescript-eslint/eslint-plugin": "^2.10.0",
"@typescript-eslint/parser": "^2.10.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.5.2",
"babel-jest": "^26.6.0",
"babel-loader": "8.1.0",
"babel-plugin-named-asset-import": "^0.3.6",
"babel-preset-react-app": "^9.1.2",
@@ -73,11 +73,11 @@
"fs-extra": "9.0.1",
"html-webpack-plugin": "4.5.0",
"identity-obj-proxy": "3.0.0",
"jest": "26.5.3",
"jest": "26.6.0",
"jest-environment-jsdom-fourteen": "1.0.1",
"jest-resolve": "26.5.2",
"jest-resolve": "26.6.0",
"jest-watch-typeahead": "0.6.1",
"mini-css-extract-plugin": "1.0.0",
"mini-css-extract-plugin": "1.1.0",
"optimize-css-assets-webpack-plugin": "5.0.4",
"pnp-webpack-plugin": "1.6.4",
"postcss-flexbugs-fixes": "4.2.1",
@@ -90,8 +90,8 @@
"react": "^16.14.0",
"react-app-polyfill": "^1.0.6",
"react-dev-utils": "^10.2.1",
"react-dom": "^16.13.1",
"resolve": "1.17.0",
"react-dom": "^16.14.0",
"resolve": "1.18.1",
"resolve-url-loader": "3.1.1",
"sass-loader": "10.0.3",
"semver": "7.3.2",

View File

@@ -87,6 +87,21 @@ declare module 'simple-keyboard' {
*/
physicalKeyboardHighlight?: boolean;
/**
* Presses keys highlighted by physicalKeyboardHighlight
*/
physicalKeyboardHighlightPress?: boolean;
/**
* Define the text color that the physical keyboard highlighted key should have.
*/
physicalKeyboardHighlightTextColor?: string;
/**
* Define the background color that the physical keyboard highlighted key should have.
*/
physicalKeyboardHighlightBgColor?: string;
/**
* Calling preventDefault for the mousedown events keeps the focus on the input.
*/
@@ -107,16 +122,6 @@ declare module 'simple-keyboard' {
*/
stopMouseUpPropagation?: boolean;
/**
* Define the text color that the physical keyboard highlighted key should have.
*/
physicalKeyboardHighlightTextColor?: string;
/**
* Define the background color that the physical keyboard highlighted key should have.
*/
physicalKeyboardHighlightBgColor?: string;
/**
* Render buttons as a button element instead of a div element.
*/

View File

@@ -64,12 +64,13 @@ class SimpleKeyboard {
* @property {object} maxLength Restrains simple-keyboards individual inputs to a certain length. This should be used in addition to the input elements maxlengthattribute.
* @property {boolean} syncInstanceInputs When set to true, this option synchronizes the internal input of every simple-keyboard instance.
* @property {boolean} physicalKeyboardHighlight Enable highlighting of keys pressed on physical keyboard.
* @property {boolean} physicalKeyboardHighlightPress Presses keys highlighted by physicalKeyboardHighlight
* @property {string} physicalKeyboardHighlightTextColor Define the text color that the physical keyboard highlighted key should have.
* @property {string} physicalKeyboardHighlightBgColor Define the background color that the physical keyboard highlighted key should have.
* @property {boolean} preventMouseDownDefault Calling preventDefault for the mousedown events keeps the focus on the input.
* @property {boolean} preventMouseUpDefault Calling preventDefault for the mouseup events.
* @property {boolean} stopMouseDownPropagation Stops pointer down events on simple-keyboard buttons from bubbling to parent elements.
* @property {boolean} stopMouseUpPropagation Stops pointer up events on simple-keyboard buttons from bubbling to parent elements.
* @property {string} physicalKeyboardHighlightTextColor Define the text color that the physical keyboard highlighted key should have.
* @property {string} physicalKeyboardHighlightBgColor Define the background color that the physical keyboard highlighted key should have.
* @property {function(button: string):string} onKeyPress Executes the callback function on key press. Returns button layout name (i.e.: “{shift}”).
* @property {function(input: string):string} onChange Executes the callback function on input change. Returns the current inputs string.
* @property {function} onRender Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).

View File

@@ -34,11 +34,24 @@ class PhysicalKeyboard {
options.physicalKeyboardHighlightBgColor || "#dadce4";
buttonDOM.style.color =
options.physicalKeyboardHighlightTextColor || "black";
if (options.physicalKeyboardHighlightPress) {
/**
* Trigger mousedown
*/
(
buttonDOM.onpointerdown ||
buttonDOM.onmousedown ||
buttonDOM.ontouchstart ||
Utilities.noop
)();
}
}
});
}
handleHighlightKeyUp(event) {
const options = this.getOptions();
const buttonPressed = this.getSimpleKeyboardLayoutKey(event);
this.dispatch(instance => {
@@ -48,6 +61,18 @@ class PhysicalKeyboard {
if (buttonDOM && buttonDOM.removeAttribute) {
buttonDOM.removeAttribute("style");
if (options.physicalKeyboardHighlightPress) {
/**
* Trigger mousedown
*/
(
buttonDOM.onpointerup ||
buttonDOM.onmouseup ||
buttonDOM.ontouchend ||
Utilities.noop
)();
}
}
});
}

View File

@@ -430,6 +430,8 @@ class Utilities {
word.length ? str + word[0].toUpperCase() + word.slice(1) : str
);
}
static noop = () => {};
}
export default Utilities;

View File

@@ -113,4 +113,57 @@ it('PhysicalKeyboard will work with F1-F12 keys', () => {
tagName: "input"
}
}));
});
it('PhysicalKeyboard will work with physicalKeyboardHighlightPress', () => {
setDOM();
new Keyboard({
physicalKeyboardHighlight: true,
physicalKeyboardHighlightPress: true,
debug: true
});
document.dispatchEvent(new KeyboardEvent('keydown', {
code: "KeyF",
key: "f",
target: {
tagName: "input"
}
}));
document.dispatchEvent(new KeyboardEvent('keyup', {
code: "KeyF",
key: "f",
target: {
tagName: "input"
}
}));
});
it('PhysicalKeyboard will work with physicalKeyboardHighlightPress (touch)', () => {
setDOM();
new Keyboard({
physicalKeyboardHighlight: true,
physicalKeyboardHighlightPress: true,
useTouchEvents: true,
debug: true
});
document.dispatchEvent(new KeyboardEvent('keydown', {
code: "KeyF",
key: "f",
target: {
tagName: "input"
}
}));
document.dispatchEvent(new KeyboardEvent('keyup', {
code: "KeyF",
key: "f",
target: {
tagName: "input"
}
}));
});