simple-keyboard/docs/index.json
Francisco Hodge 222629abdd Docs update
2018-10-24 20:20:28 -04:00

2361 lines
112 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[
{
"__docId__": 1,
"kind": "external",
"name": "Infinity",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Infinity",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 2,
"kind": "external",
"name": "NaN",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~NaN",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 3,
"kind": "external",
"name": "undefined",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~undefined",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 4,
"kind": "external",
"name": "null",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~null",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 5,
"kind": "external",
"name": "Object",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Object",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 6,
"kind": "external",
"name": "object",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~object",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 7,
"kind": "external",
"name": "Function",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Function",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 8,
"kind": "external",
"name": "function",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~function",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 9,
"kind": "external",
"name": "Boolean",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Boolean",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 10,
"kind": "external",
"name": "boolean",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~boolean",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 11,
"kind": "external",
"name": "Symbol",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Symbol",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 12,
"kind": "external",
"name": "Error",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Error",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 13,
"kind": "external",
"name": "EvalError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~EvalError",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 14,
"kind": "external",
"name": "InternalError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/InternalError",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~InternalError",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 15,
"kind": "external",
"name": "RangeError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~RangeError",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 16,
"kind": "external",
"name": "ReferenceError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~ReferenceError",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 17,
"kind": "external",
"name": "SyntaxError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~SyntaxError",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 18,
"kind": "external",
"name": "TypeError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~TypeError",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 19,
"kind": "external",
"name": "URIError",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~URIError",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 20,
"kind": "external",
"name": "Number",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Number",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 21,
"kind": "external",
"name": "number",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~number",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 22,
"kind": "external",
"name": "Date",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Date",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 23,
"kind": "external",
"name": "String",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~String",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 24,
"kind": "external",
"name": "string",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~string",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 25,
"kind": "external",
"name": "RegExp",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~RegExp",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 26,
"kind": "external",
"name": "Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 27,
"kind": "external",
"name": "Int8Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Int8Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 28,
"kind": "external",
"name": "Uint8Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Uint8Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 29,
"kind": "external",
"name": "Uint8ClampedArray",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Uint8ClampedArray",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 30,
"kind": "external",
"name": "Int16Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Int16Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 31,
"kind": "external",
"name": "Uint16Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Uint16Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 32,
"kind": "external",
"name": "Int32Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Int32Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 33,
"kind": "external",
"name": "Uint32Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Uint32Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 34,
"kind": "external",
"name": "Float32Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Float32Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 35,
"kind": "external",
"name": "Float64Array",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Float64Array",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 36,
"kind": "external",
"name": "Map",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Map",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 37,
"kind": "external",
"name": "Set",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Set",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 38,
"kind": "external",
"name": "WeakMap",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~WeakMap",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 39,
"kind": "external",
"name": "WeakSet",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~WeakSet",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 40,
"kind": "external",
"name": "ArrayBuffer",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~ArrayBuffer",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 41,
"kind": "external",
"name": "DataView",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~DataView",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 42,
"kind": "external",
"name": "JSON",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~JSON",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 43,
"kind": "external",
"name": "Promise",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Promise",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 44,
"kind": "external",
"name": "Generator",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Generator",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 45,
"kind": "external",
"name": "GeneratorFunction",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/GeneratorFunction",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~GeneratorFunction",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 46,
"kind": "external",
"name": "Reflect",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Reflect",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 47,
"kind": "external",
"name": "Proxy",
"externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy",
"memberof": "src/.external-ecmascript.js",
"static": true,
"longname": "src/.external-ecmascript.js~Proxy",
"access": "public",
"description": "",
"builtinExternal": true
},
{
"__docId__": 48,
"kind": "file",
"name": "src/demo/App.js",
"content": "import Keyboard from '../lib';\r\nimport './css/App.css';\r\n\r\n/**\r\n * simple-keyboard demo\r\n */\r\nclass App {\r\n /**\r\n * Instantiates the demo class\r\n */\r\n constructor(){\r\n document.addEventListener('DOMContentLoaded', this.onDOMLoaded);\r\n\r\n /**\r\n * Default input name\r\n * @type {string}\r\n */\r\n this.layoutName = \"default\";\r\n }\r\n\r\n /**\r\n * Executed when the DOM is ready\r\n */\r\n onDOMLoaded = () => {\r\n /**\r\n * Creates a new simple-keyboard instance\r\n */\r\n this.keyboard = new Keyboard({\r\n debug: true,\r\n layoutName: this.layoutName,\r\n onChange: input => this.onChange(input),\r\n onKeyPress: button => this.onKeyPress(button),\r\n newLineOnEnter: true,\r\n physicalKeyboardHighlight: true,\r\n });\r\n \r\n /**\r\n * Adding preview (demo only)\r\n */\r\n document.querySelector('.simple-keyboard').insertAdjacentHTML('beforebegin', `\r\n <div class=\"simple-keyboard-preview\">\r\n <textarea class=\"input\"></textarea>\r\n </div>\r\n `);\r\n \r\n document.querySelector('.input').addEventListener('change', (event) => {\r\n this.keyboard.setInput(event.target.value);\r\n });\r\n }\r\n\r\n /**\r\n * Handles shift functionality\r\n */\r\n handleShiftButton = () => {\r\n let layoutName = this.layoutName;\r\n let shiftToggle = this.layoutName = layoutName === \"default\" ? \"shift\" : \"default\";\r\n \r\n this.keyboard.setOptions({\r\n layoutName: shiftToggle\r\n });\r\n }\r\n\r\n /**\r\n * Called when simple-keyboard input has changed\r\n */\r\n onChange = input => {\r\n document.querySelector('.input').value = input;\r\n }\r\n\r\n /**\r\n * Called when a simple-keyboard key is pressed\r\n */\r\n onKeyPress = button => {\r\n console.log(\"Button pressed\", button);\r\n \r\n /**\r\n * Shift functionality\r\n */\r\n if(button === \"{lock}\" || button === \"{shift}\")\r\n this.handleShiftButton();\r\n }\r\n\r\n}\r\n\r\nexport default App;",
"static": true,
"longname": "X:/Dev/simple-keyboard/src/demo/App.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 49,
"kind": "class",
"name": "App",
"memberof": "src/demo/App.js",
"static": true,
"longname": "src/demo/App.js~App",
"access": "public",
"export": true,
"importPath": "simple-keyboard/src/demo/App.js",
"importStyle": "App",
"description": "simple-keyboard demo",
"lineNumber": 7,
"interface": false
},
{
"__docId__": 50,
"kind": "constructor",
"name": "constructor",
"memberof": "src/demo/App.js~App",
"generator": false,
"async": false,
"static": false,
"longname": "src/demo/App.js~App#constructor",
"access": "public",
"description": "Instantiates the demo class",
"lineNumber": 11
},
{
"__docId__": 51,
"kind": "member",
"name": "layoutName",
"memberof": "src/demo/App.js~App",
"static": false,
"longname": "src/demo/App.js~App#layoutName",
"access": "public",
"description": "Default input name",
"lineNumber": 18,
"type": {
"nullable": null,
"types": [
"string"
],
"spread": false,
"description": null
}
},
{
"__docId__": 52,
"kind": "member",
"name": "onDOMLoaded",
"memberof": "src/demo/App.js~App",
"static": false,
"longname": "src/demo/App.js~App#onDOMLoaded",
"access": "public",
"description": "Executed when the DOM is ready",
"lineNumber": 24,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 53,
"kind": "member",
"name": "keyboard",
"memberof": "src/demo/App.js~App",
"longname": "src/demo/App.js~App#keyboard",
"access": "public",
"description": "Creates a new simple-keyboard instance",
"lineNumber": 28,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 54,
"kind": "member",
"name": "handleShiftButton",
"memberof": "src/demo/App.js~App",
"static": false,
"longname": "src/demo/App.js~App#handleShiftButton",
"access": "public",
"description": "Handles shift functionality",
"lineNumber": 54,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 55,
"kind": "member",
"name": "onChange",
"memberof": "src/demo/App.js~App",
"static": false,
"longname": "src/demo/App.js~App#onChange",
"access": "public",
"description": "Called when simple-keyboard input has changed",
"lineNumber": 66,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 56,
"kind": "member",
"name": "onKeyPress",
"memberof": "src/demo/App.js~App",
"static": false,
"longname": "src/demo/App.js~App#onKeyPress",
"access": "public",
"description": "Called when a simple-keyboard key is pressed",
"lineNumber": 73,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 57,
"kind": "file",
"name": "src/demo/index.js",
"content": "import App from './App';\r\n\r\n/**\r\n * Initializing demo\r\n */\r\nnew App();",
"static": true,
"longname": "X:/Dev/simple-keyboard/src/demo/index.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 58,
"kind": "file",
"name": "src/lib/components/Keyboard.js",
"content": "import './Keyboard.css';\r\n\r\n// Services\r\nimport PhysicalKeyboard from '../services/PhysicalKeyboard';\r\nimport KeyboardLayout from '../services/KeyboardLayout';\r\nimport Utilities from '../services/Utilities';\r\n\r\n/**\r\n * Root class for simple-keyboard\r\n * This class:\r\n * - Parses the options\r\n * - Renders the rows and buttons\r\n * - Handles button functionality\r\n */\r\nclass SimpleKeyboard {\r\n /**\r\n * Creates an instance of SimpleKeyboard\r\n * @param {Array} params If first parameter is a string, it is considered the container class. The second parameter is then considered the options object. If first parameter is an object, it is considered the options object.\r\n */\r\n constructor(...params){\r\n let keyboardDOMQuery = typeof params[0] === \"string\" ? params[0] : '.simple-keyboard';\r\n let options = typeof params[0] === \"object\" ? params[0] : params[1];\r\n\r\n if(!options)\r\n options = {};\r\n\r\n /**\r\n * Initializing Utilities\r\n */\r\n this.utilities = new Utilities(this);\r\n\r\n /**\r\n * Processing options\r\n */\r\n this.keyboardDOM = document.querySelector(keyboardDOMQuery);\r\n\r\n /**\r\n * @type {object}\r\n * @property {object} layout Modify the keyboard layout.\r\n * @property {string} layoutName Specifies which layout should be used.\r\n * @property {object} display Replaces variable buttons (such as {bksp}) with a human-friendly name (e.g.: “backspace”).\r\n * @property {boolean} mergeDisplay By default, when you set the display property, you replace the default one. This setting merges them instead.\r\n * @property {string} theme A prop to add your own css classes to the keyboard wrapper. You can add multiple classes separated by a space.\r\n * @property {Array} buttonTheme A prop to add your own css classes to one or several buttons.\r\n * @property {boolean} debug Runs a console.log every time a key is pressed. Displays the buttons pressed and the current input.\r\n * @property {boolean} newLineOnEnter Specifies whether clicking the “ENTER” button will input a newline (\\n) or not.\r\n * @property {boolean} tabCharOnTab Specifies whether clicking the “TAB” button will input a tab character (\\t) or not.\r\n * @property {string} inputName Allows you to use a single simple-keyboard instance for several inputs.\r\n * @property {number} maxLength Restrains all of simple-keyboard inputs to a certain length. This should be used in addition to the input elements maxlengthattribute.\r\n * @property {object} maxLength Restrains simple-keyboards individual inputs to a certain length. This should be used in addition to the input elements maxlengthattribute.\r\n * @property {boolean} syncInstanceInputs When set to true, this option synchronizes the internal input of every simple-keyboard instance.\r\n * @property {boolean} physicalKeyboardHighlight Enable highlighting of keys pressed on physical keyboard.\r\n * @property {string} physicalKeyboardHighlightTextColor Define the text color that the physical keyboard highlighted key should have.\r\n * @property {string} physicalKeyboardHighlightBgColor Define the background color that the physical keyboard highlighted key should have. \r\n * @property {function(button: string):string} onKeyPress Executes the callback function on key press. Returns button layout name (i.e.: “{shift}”).\r\n * @property {function(input: string):string} onChange Executes the callback function on input change. Returns the current inputs string.\r\n * @property {function} onRender Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\r\n * @property {function} onInit Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\r\n * @property {function(inputs: object):object} onChangeAll Executes the callback function on input change. Returns the input object with all defined inputs.\r\n */\r\n this.options = options;\r\n this.options.layoutName = this.options.layoutName || \"default\";\r\n this.options.theme = this.options.theme || \"hg-theme-default\";\r\n this.options.inputName = this.options.inputName || \"default\";\r\n\r\n /**\r\n * simple-keyboard uses a non-persistent internal input to keep track of the entered string (the variable `keyboard.input`).\r\n * This removes any dependency to input DOM elements. You can type and directly display the value in a div element, for example.\r\n * @example\r\n * // To get entered input\r\n * let input = keyboard.getInput();\r\n * \r\n * // To clear entered input.\r\n * keyboard.clearInput();\r\n * \r\n * @type {object}\r\n * @property {object} default Default SimpleKeyboard internal input.\r\n * @property {object} myInputName Example input that can be set through `options.inputName:\"myInputName\"`.\r\n */\r\n this.input = {};\r\n this.input[this.options.inputName] = '';\r\n\r\n /**\r\n * @type {string} DOM class of the keyboard wrapper, normally \"simple-keyboard\" by default.\r\n */\r\n this.keyboardDOMClass = keyboardDOMQuery.split('.').join(\"\");\r\n\r\n /**\r\n * @type {object} Contains the DOM elements of every rendered button, the key being the button's layout name (e.g.: \"{enter}\").\r\n */\r\n this.buttonElements = {};\r\n\r\n /**\r\n * Rendering keyboard\r\n */\r\n if(this.keyboardDOM)\r\n this.render();\r\n else {\r\n console.warn(`\"${keyboardDOMQuery}\" was not found in the DOM.`);\r\n throw new Error(\"KEYBOARD_DOM_ERROR\");\r\n }\r\n\r\n /**\r\n * Saving instance\r\n * This enables multiple simple-keyboard support with easier management\r\n */\r\n if(!window['SimpleKeyboardInstances'])\r\n window['SimpleKeyboardInstances'] = {};\r\n \r\n window['SimpleKeyboardInstances'][this.utilities.camelCase(this.keyboardDOMClass)] = this;\r\n\r\n /**\r\n * Physical Keyboard support\r\n */\r\n this.physicalKeyboardInterface = new PhysicalKeyboard(this);\r\n }\r\n /**\r\n * Handles clicks made to keyboard buttons\r\n * @param {string} button The button's layout name.\r\n */\r\n handleButtonClicked = (button) => {\r\n let debug = this.options.debug;\r\n\r\n /**\r\n * Ignoring placeholder buttons\r\n */\r\n if(button === '{//}')\r\n return false;\r\n\r\n /**\r\n * Calling onKeyPress\r\n */\r\n if(typeof this.options.onKeyPress === \"function\")\r\n this.options.onKeyPress(button);\r\n \r\n if(!this.input[this.options.inputName])\r\n this.input[this.options.inputName] = '';\r\n\r\n let updatedInput = this.utilities.getUpdatedInput(button, this.input[this.options.inputName], this.options, this.caretPosition);\r\n\r\n if(this.input[this.options.inputName] !== updatedInput){\r\n\r\n /**\r\n * If maxLength and handleMaxLength yield true, halting\r\n */\r\n if(this.options.maxLength && this.utilities.handleMaxLength(this.input, this.options, updatedInput)){\r\n return false;\r\n }\r\n\r\n this.input[this.options.inputName] = updatedInput;\r\n\r\n if(debug)\r\n console.log('Input changed:', this.input);\r\n\r\n /**\r\n * Enforce syncInstanceInputs, if set\r\n */\r\n if(this.options.syncInstanceInputs)\r\n this.syncInstanceInputs(this.input);\r\n\r\n /**\r\n * Calling onChange\r\n */\r\n if(typeof this.options.onChange === \"function\")\r\n this.options.onChange(this.input[this.options.inputName]);\r\n }\r\n \r\n if(debug){\r\n console.log(\"Key pressed:\", button);\r\n }\r\n }\r\n\r\n /**\r\n * Send a command to all simple-keyboard instances (if you have several instances).\r\n */\r\n syncInstanceInputs = () => {\r\n this.dispatch((instance) => {\r\n instance.replaceInput(this.input);\r\n });\r\n }\r\n \r\n /**\r\n * Clear the keyboards input.\r\n * @param {string} [inputName] optional - the internal input to select\r\n */\r\n clearInput = (inputName) => {\r\n inputName = inputName || this.options.inputName;\r\n this.input[this.options.inputName] = '';\r\n\r\n /**\r\n * Enforce syncInstanceInputs, if set\r\n */\r\n if(this.options.syncInstanceInputs)\r\n this.syncInstanceInputs(this.input);\r\n }\r\n\r\n /**\r\n * Get the keyboards input (You can also get it from the onChange prop).\r\n * @param {string} [inputName] optional - the internal input to select\r\n */\r\n getInput = (inputName) => {\r\n inputName = inputName || this.options.inputName;\r\n\r\n /**\r\n * Enforce syncInstanceInputs, if set\r\n */\r\n if(this.options.syncInstanceInputs)\r\n this.syncInstanceInputs(this.input);\r\n\r\n return this.input[this.options.inputName];\r\n }\r\n\r\n /**\r\n * Set the keyboards input.\r\n * @param {string} input the input value\r\n * @param {string} inputName optional - the internal input to select\r\n */\r\n setInput = (input, inputName) => {\r\n inputName = inputName || this.options.inputName;\r\n this.input[inputName] = input;\r\n\r\n /**\r\n * Enforce syncInstanceInputs, if set\r\n */\r\n if(this.options.syncInstanceInputs)\r\n this.syncInstanceInputs(this.input);\r\n }\r\n \r\n /**\r\n * Replace the input object (`keyboard.input`)\r\n * @param {object} inputObj The input object\r\n */\r\n replaceInput = (inputObj) => {\r\n this.input = inputObj;\r\n }\r\n\r\n /**\r\n * Set new option or modify existing ones after initialization. \r\n * @param {object} option The option to set\r\n */\r\n setOptions = option => {\r\n option = option || {};\r\n this.options = Object.assign(this.options, option);\r\n this.render();\r\n }\r\n\r\n /**\r\n * Remove all keyboard rows and reset keyboard values.\r\n * Used interally between re-renders.\r\n */\r\n clear = () => {\r\n this.keyboardDOM.innerHTML = '';\r\n this.keyboardDOM.className = this.keyboardDOMClass;\r\n this.buttonElements = {};\r\n }\r\n\r\n /**\r\n * Send a command to all simple-keyboard instances at once (if you have multiple instances).\r\n * @param {function(instance: object, key: string)} callback Function to run on every instance\r\n */\r\n dispatch = (callback) => {\r\n if(!window['SimpleKeyboardInstances']){\r\n console.warn(`SimpleKeyboardInstances is not defined. Dispatch cannot be called.`);\r\n throw new Error(\"INSTANCES_VAR_ERROR\");\r\n }\r\n \r\n return Object.keys(window['SimpleKeyboardInstances']).forEach((key) => {\r\n callback(window['SimpleKeyboardInstances'][key], key);\r\n })\r\n }\r\n\r\n /**\r\n * Adds/Modifies an entry to the `buttonTheme`. Basically a way to add a class to a button.\r\n * @param {string} buttons List of buttons to select (separated by a space).\r\n * @param {string} className Classes to give to the selected buttons (separated by space).\r\n */\r\n addButtonTheme = (buttons, className) => {\r\n if(!className || !buttons)\r\n return false;\r\n\r\n buttons.split(\" \").forEach(button => {\r\n className.split(\" \").forEach(classNameItem => {\r\n if(!this.options.buttonTheme)\r\n this.options.buttonTheme = [];\r\n\r\n let classNameFound = false;\r\n \r\n /**\r\n * If class is already defined, we add button to class definition\r\n */\r\n this.options.buttonTheme.map(buttonTheme => {\r\n\r\n if(buttonTheme.class.split(\" \").includes(classNameItem)){\r\n classNameFound = true;\r\n \r\n let buttonThemeArray = buttonTheme.buttons.split(\" \");\r\n if(!buttonThemeArray.includes(button)){\r\n classNameFound = true;\r\n buttonThemeArray.push(button);\r\n buttonTheme.buttons = buttonThemeArray.join(\" \");\r\n }\r\n }\r\n return buttonTheme;\r\n });\r\n\r\n /**\r\n * If class is not defined, we create a new entry\r\n */\r\n if(!classNameFound){\r\n this.options.buttonTheme.push({\r\n class: classNameItem,\r\n buttons: buttons\r\n });\r\n }\r\n\r\n });\r\n });\r\n\r\n this.render();\r\n }\r\n\r\n /**\r\n * Removes/Amends an entry to the `buttonTheme`. Basically a way to remove a class previously added to a button through buttonTheme or addButtonTheme.\r\n * @param {string} buttons List of buttons to select (separated by a space).\r\n * @param {string} className Classes to give to the selected buttons (separated by space).\r\n */\r\n removeButtonTheme = (buttons, className) => {\r\n /**\r\n * When called with empty parameters, remove all button themes\r\n */\r\n if(!buttons && !className){\r\n this.options.buttonTheme = [];\r\n this.render();\r\n return false;\r\n }\r\n\r\n /**\r\n * If buttons are passed and buttonTheme has items\r\n */\r\n if(buttons && Array.isArray(this.options.buttonTheme) && this.options.buttonTheme.length){\r\n let buttonArray = buttons.split(\" \");\r\n buttonArray.forEach((button, key) => {\r\n this.options.buttonTheme.map((buttonTheme, index) => {\r\n\r\n /**\r\n * If className is set, we affect the buttons only for that class\r\n * Otherwise, we afect all classes\r\n */\r\n if(\r\n (className && className.includes(buttonTheme.class)) ||\r\n !className\r\n ){\r\n let filteredButtonArray = buttonTheme.buttons.split(\" \").filter(item => item !== button);\r\n\r\n /**\r\n * If buttons left, return them, otherwise, remove button Theme\r\n */\r\n if(filteredButtonArray.length){\r\n buttonTheme.buttons = filteredButtonArray.join(\" \");\r\n } else {\r\n this.options.buttonTheme.splice(index, 1);\r\n buttonTheme = null;\r\n }\r\n \r\n }\r\n\r\n return buttonTheme;\r\n });\r\n });\r\n\r\n this.render();\r\n }\r\n }\r\n\r\n /**\r\n * Get the DOM Element of a button. If there are several buttons with the same name, an array of the DOM Elements is returned.\r\n * @param {string} button The button layout name to select\r\n */\r\n getButtonElement = (button) => {\r\n let output;\r\n\r\n let buttonArr = this.buttonElements[button];\r\n if(buttonArr){\r\n if(buttonArr.length > 1){\r\n output = buttonArr;\r\n } else {\r\n output = buttonArr[0];\r\n }\r\n }\r\n\r\n return output;\r\n }\r\n\r\n /**\r\n * Retrieves the current cursor position within a input or textarea (if any)\r\n */\r\n handleCaret = () => {\r\n if(this.options.debug){\r\n console.log(\"Caret handling started\");\r\n }\r\n\r\n document.addEventListener(\"keyup\", this.caretEventHandler);\r\n document.addEventListener(\"mouseup\", this.caretEventHandler);\r\n document.addEventListener(\"touchend\", this.caretEventHandler);\r\n }\r\n\r\n /**\r\n * Called by {@link handleCaret} when an event that warrants a cursor position update is triggered\r\n */\r\n caretEventHandler = (event) => {\r\n let targetTagName = event.target.tagName.toLowerCase();\r\n\r\n if(\r\n targetTagName === \"textarea\" ||\r\n targetTagName === \"input\"\r\n ){\r\n /**\r\n * Tracks current cursor position\r\n * As keys are pressed, text will be added/removed at that position within the input.\r\n */\r\n this.caretPosition = event.target.selectionStart;\r\n\r\n if(this.options.debug){\r\n console.log('Caret at: ', event.target.selectionStart, event.target.tagName.toLowerCase());\r\n } \r\n }\r\n }\r\n\r\n /**\r\n * Executes the callback function once simple-keyboard is rendered for the first time (on initialization).\r\n */\r\n onInit = () => {\r\n if(this.options.debug){\r\n console.log(\"Initialized\");\r\n }\r\n\r\n /**\r\n * Caret handling\r\n */\r\n this.handleCaret();\r\n\r\n if(typeof this.options.onInit === \"function\")\r\n this.options.onInit();\r\n }\r\n\r\n /**\r\n * Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).\r\n */\r\n onRender = () => {\r\n if(typeof this.options.onRender === \"function\")\r\n this.options.onRender();\r\n }\r\n\r\n /**\r\n * Renders rows and buttons as per options\r\n */\r\n render = () => {\r\n /**\r\n * Clear keyboard\r\n */\r\n this.clear();\r\n\r\n let layoutClass = this.options.layout ? \"hg-layout-custom\" : `hg-layout-${this.options.layoutName}`;\r\n let layout = this.options.layout || KeyboardLayout.getDefaultLayout();\r\n\r\n /**\r\n * Account for buttonTheme, if set\r\n */\r\n let buttonThemesParsed = {};\r\n if(Array.isArray(this.options.buttonTheme)){\r\n this.options.buttonTheme.forEach(themeObj => {\r\n if(themeObj.buttons && themeObj.class){\r\n let themeButtons;\r\n\r\n if(typeof themeObj.buttons === \"string\"){\r\n themeButtons = themeObj.buttons.split(' ');\r\n }\r\n\r\n if(themeButtons){\r\n themeButtons.forEach(themeButton => {\r\n let themeParsed = buttonThemesParsed[themeButton];\r\n\r\n // If the button has already been added\r\n if(themeParsed){\r\n // Making sure we don't add duplicate classes, even when buttonTheme has duplicates\r\n if(!this.utilities.countInArray(themeParsed.split(\" \"), themeObj.class)){\r\n buttonThemesParsed[themeButton] = `${themeParsed} ${themeObj.class}`;\r\n }\r\n } else {\r\n buttonThemesParsed[themeButton] = themeObj.class;\r\n }\r\n });\r\n }\r\n } else {\r\n console.warn(`buttonTheme row is missing the \"buttons\" or the \"class\". Please check the documentation.`)\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Adding themeClass, layoutClass to keyboardDOM\r\n */\r\n this.keyboardDOM.className += ` ${this.options.theme} ${layoutClass}`;\r\n\r\n /**\r\n * Iterating through each row\r\n */\r\n layout[this.options.layoutName].forEach((row, rIndex) => {\r\n let rowArray = row.split(' ');\r\n\r\n /**\r\n * Creating empty row\r\n */\r\n var rowDOM = document.createElement('div');\r\n rowDOM.className += \"hg-row\";\r\n\r\n /**\r\n * Iterating through each button in row\r\n */\r\n rowArray.forEach((button, bIndex) => {\r\n let fctBtnClass = this.utilities.getButtonClass(button);\r\n let buttonThemeClass = buttonThemesParsed[button];\r\n let buttonDisplayName = this.utilities.getButtonDisplayName(button, this.options.display, this.options.mergeDisplay);\r\n\r\n /**\r\n * Creating button\r\n */\r\n var buttonDOM = document.createElement('div');\r\n buttonDOM.className += `hg-button ${fctBtnClass}${buttonThemeClass ? \" \"+buttonThemeClass : \"\"}`;\r\n buttonDOM.onclick = () => this.handleButtonClicked(button);\r\n\r\n /**\r\n * Adding identifier\r\n */\r\n buttonDOM.setAttribute(\"data-skBtn\", button);\r\n\r\n /**\r\n * Adding unique id\r\n * Since there's no limit on spawning same buttons, the unique id ensures you can style every button\r\n */\r\n let buttonUID = `${this.options.layoutName}-r${rIndex}b${bIndex}`;\r\n buttonDOM.setAttribute(\"data-skBtnUID\", buttonUID);\r\n\r\n /**\r\n * Adding display label\r\n */\r\n buttonDOM.setAttribute(\"data-displayLabel\", buttonDisplayName);\r\n\r\n /**\r\n * Adding button label to button\r\n */\r\n var buttonSpanDOM = document.createElement('span');\r\n buttonSpanDOM.innerHTML = buttonDisplayName;\r\n buttonDOM.appendChild(buttonSpanDOM);\r\n\r\n /**\r\n * Adding to buttonElements\r\n */\r\n if(!this.buttonElements[button])\r\n this.buttonElements[button] = [];\r\n\r\n this.buttonElements[button].push(buttonDOM);\r\n\r\n /**\r\n * Appending button to row\r\n */\r\n rowDOM.appendChild(buttonDOM);\r\n\r\n });\r\n\r\n /**\r\n * Appending row to keyboard\r\n */\r\n this.keyboardDOM.appendChild(rowDOM);\r\n });\r\n\r\n /**\r\n * Calling onRender\r\n */\r\n this.onRender();\r\n\r\n if(!this.initialized){\r\n /**\r\n * Ensures that onInit is only called once per instantiation\r\n */\r\n this.initialized = true;\r\n\r\n /**\r\n * Calling onInit\r\n */\r\n this.onInit();\r\n }\r\n }\r\n}\r\n\r\nexport default SimpleKeyboard;\r\n",
"static": true,
"longname": "X:/Dev/simple-keyboard/src/lib/components/Keyboard.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 59,
"kind": "class",
"name": "SimpleKeyboard",
"memberof": "src/lib/components/Keyboard.js",
"static": true,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard",
"access": "public",
"export": true,
"importPath": "simple-keyboard/src/lib/components/Keyboard.js",
"importStyle": "SimpleKeyboard",
"description": "Root class for simple-keyboard\nThis class:\n- Parses the options\n- Renders the rows and buttons\n- Handles button functionality",
"lineNumber": 15,
"interface": false
},
{
"__docId__": 60,
"kind": "constructor",
"name": "constructor",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"generator": false,
"async": false,
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#constructor",
"access": "public",
"description": "Creates an instance of SimpleKeyboard",
"lineNumber": 20,
"params": [
{
"nullable": null,
"types": [
"Array"
],
"spread": false,
"optional": false,
"name": "params",
"description": "If first parameter is a string, it is considered the container class. The second parameter is then considered the options object. If first parameter is an object, it is considered the options object."
}
]
},
{
"__docId__": 61,
"kind": "member",
"name": "utilities",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#utilities",
"access": "public",
"description": "Initializing Utilities",
"lineNumber": 30,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 62,
"kind": "member",
"name": "keyboardDOM",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#keyboardDOM",
"access": "public",
"description": "Processing options",
"lineNumber": 35,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 63,
"kind": "member",
"name": "options",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#options",
"access": "public",
"description": "",
"lineNumber": 61,
"properties": [
{
"nullable": null,
"types": [
"object"
],
"spread": false,
"optional": false,
"name": "layout",
"description": "Modify the keyboard layout."
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "layoutName",
"description": "Specifies which layout should be used."
},
{
"nullable": null,
"types": [
"object"
],
"spread": false,
"optional": false,
"name": "display",
"description": "Replaces variable buttons (such as {bksp}) with a human-friendly name (e.g.: “backspace”)."
},
{
"nullable": null,
"types": [
"boolean"
],
"spread": false,
"optional": false,
"name": "mergeDisplay",
"description": "By default, when you set the display property, you replace the default one. This setting merges them instead."
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "theme",
"description": "A prop to add your own css classes to the keyboard wrapper. You can add multiple classes separated by a space."
},
{
"nullable": null,
"types": [
"Array"
],
"spread": false,
"optional": false,
"name": "buttonTheme",
"description": "A prop to add your own css classes to one or several buttons."
},
{
"nullable": null,
"types": [
"boolean"
],
"spread": false,
"optional": false,
"name": "debug",
"description": "Runs a console.log every time a key is pressed. Displays the buttons pressed and the current input."
},
{
"nullable": null,
"types": [
"boolean"
],
"spread": false,
"optional": false,
"name": "newLineOnEnter",
"description": "Specifies whether clicking the “ENTER” button will input a newline (\\n) or not."
},
{
"nullable": null,
"types": [
"boolean"
],
"spread": false,
"optional": false,
"name": "tabCharOnTab",
"description": "Specifies whether clicking the “TAB” button will input a tab character (\\t) or not."
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "inputName",
"description": "Allows you to use a single simple-keyboard instance for several inputs."
},
{
"nullable": null,
"types": [
"number"
],
"spread": false,
"optional": false,
"name": "maxLength",
"description": "Restrains all of simple-keyboard inputs to a certain length. This should be used in addition to the input elements maxlengthattribute."
},
{
"nullable": null,
"types": [
"object"
],
"spread": false,
"optional": false,
"name": "maxLength",
"description": "Restrains simple-keyboards individual inputs to a certain length. This should be used in addition to the input elements maxlengthattribute."
},
{
"nullable": null,
"types": [
"boolean"
],
"spread": false,
"optional": false,
"name": "syncInstanceInputs",
"description": "When set to true, this option synchronizes the internal input of every simple-keyboard instance."
},
{
"nullable": null,
"types": [
"boolean"
],
"spread": false,
"optional": false,
"name": "physicalKeyboardHighlight",
"description": "Enable highlighting of keys pressed on physical keyboard."
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "physicalKeyboardHighlightTextColor",
"description": "Define the text color that the physical keyboard highlighted key should have."
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "physicalKeyboardHighlightBgColor",
"description": "Define the background color that the physical keyboard highlighted key should have."
},
{
"nullable": null,
"types": [
"function(button: string):string"
],
"spread": false,
"optional": false,
"name": "onKeyPress",
"description": "Executes the callback function on key press. Returns button layout name (i.e.: “{shift}”)."
},
{
"nullable": null,
"types": [
"function(input: string):string"
],
"spread": false,
"optional": false,
"name": "onChange",
"description": "Executes the callback function on input change. Returns the current inputs string."
},
{
"nullable": null,
"types": [
"function"
],
"spread": false,
"optional": false,
"name": "onRender",
"description": "Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts)."
},
{
"nullable": null,
"types": [
"function"
],
"spread": false,
"optional": false,
"name": "onInit",
"description": "Executes the callback function once simple-keyboard is rendered for the first time (on initialization)."
},
{
"nullable": null,
"types": [
"function(inputs: object):object"
],
"spread": false,
"optional": false,
"name": "onChangeAll",
"description": "Executes the callback function on input change. Returns the input object with all defined inputs."
}
],
"type": {
"nullable": null,
"types": [
"object"
],
"spread": false,
"description": null
}
},
{
"__docId__": 64,
"kind": "member",
"name": "input",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#input",
"access": "public",
"description": "simple-keyboard uses a non-persistent internal input to keep track of the entered string (the variable `keyboard.input`).\nThis removes any dependency to input DOM elements. You can type and directly display the value in a div element, for example.",
"examples": [
"// To get entered input\nlet input = keyboard.getInput();\n\n// To clear entered input.\nkeyboard.clearInput();"
],
"lineNumber": 80,
"properties": [
{
"nullable": null,
"types": [
"object"
],
"spread": false,
"optional": false,
"name": "default",
"description": "Default SimpleKeyboard internal input."
},
{
"nullable": null,
"types": [
"object"
],
"spread": false,
"optional": false,
"name": "myInputName",
"description": "Example input that can be set through `options.inputName:\"myInputName\"`."
}
],
"type": {
"nullable": null,
"types": [
"object"
],
"spread": false,
"description": null
}
},
{
"__docId__": 65,
"kind": "member",
"name": "keyboardDOMClass",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#keyboardDOMClass",
"access": "public",
"description": "",
"lineNumber": 86,
"type": {
"nullable": null,
"types": [
"string"
],
"spread": false,
"description": null
}
},
{
"__docId__": 66,
"kind": "member",
"name": "buttonElements",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#buttonElements",
"access": "public",
"description": "",
"lineNumber": 91,
"type": {
"nullable": null,
"types": [
"object"
],
"spread": false,
"description": null
}
},
{
"__docId__": 67,
"kind": "member",
"name": "physicalKeyboardInterface",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#physicalKeyboardInterface",
"access": "public",
"description": "Physical Keyboard support",
"lineNumber": 115,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 68,
"kind": "member",
"name": "handleButtonClicked",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#handleButtonClicked",
"access": "public",
"description": "Handles clicks made to keyboard buttons",
"lineNumber": 121,
"params": [
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "button",
"description": "The button's layout name."
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 69,
"kind": "member",
"name": "syncInstanceInputs",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#syncInstanceInputs",
"access": "public",
"description": "Send a command to all simple-keyboard instances (if you have several instances).",
"lineNumber": 176,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 70,
"kind": "member",
"name": "clearInput",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#clearInput",
"access": "public",
"description": "Clear the keyboards input.",
"lineNumber": 186,
"params": [
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": true,
"name": "inputName",
"description": "optional - the internal input to select"
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 71,
"kind": "member",
"name": "getInput",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#getInput",
"access": "public",
"description": "Get the keyboards input (You can also get it from the onChange prop).",
"lineNumber": 201,
"params": [
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": true,
"name": "inputName",
"description": "optional - the internal input to select"
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 72,
"kind": "member",
"name": "setInput",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#setInput",
"access": "public",
"description": "Set the keyboards input.",
"lineNumber": 218,
"params": [
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "input",
"description": "the input value"
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "inputName",
"description": "optional - the internal input to select"
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 73,
"kind": "member",
"name": "replaceInput",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#replaceInput",
"access": "public",
"description": "Replace the input object (`keyboard.input`)",
"lineNumber": 233,
"params": [
{
"nullable": null,
"types": [
"object"
],
"spread": false,
"optional": false,
"name": "inputObj",
"description": "The input object"
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 75,
"kind": "member",
"name": "setOptions",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#setOptions",
"access": "public",
"description": "Set new option or modify existing ones after initialization. ",
"lineNumber": 241,
"params": [
{
"nullable": null,
"types": [
"object"
],
"spread": false,
"optional": false,
"name": "option",
"description": "The option to set"
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 77,
"kind": "member",
"name": "clear",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#clear",
"access": "public",
"description": "Remove all keyboard rows and reset keyboard values.\nUsed interally between re-renders.",
"lineNumber": 251,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 79,
"kind": "member",
"name": "dispatch",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#dispatch",
"access": "public",
"description": "Send a command to all simple-keyboard instances at once (if you have multiple instances).",
"lineNumber": 261,
"params": [
{
"nullable": null,
"types": [
"function(instance: object, key: string)"
],
"spread": false,
"optional": false,
"name": "callback",
"description": "Function to run on every instance"
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 80,
"kind": "member",
"name": "addButtonTheme",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#addButtonTheme",
"access": "public",
"description": "Adds/Modifies an entry to the `buttonTheme`. Basically a way to add a class to a button.",
"lineNumber": 277,
"params": [
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "buttons",
"description": "List of buttons to select (separated by a space)."
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "className",
"description": "Classes to give to the selected buttons (separated by space)."
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 81,
"kind": "member",
"name": "removeButtonTheme",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#removeButtonTheme",
"access": "public",
"description": "Removes/Amends an entry to the `buttonTheme`. Basically a way to remove a class previously added to a button through buttonTheme or addButtonTheme.",
"lineNumber": 327,
"params": [
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "buttons",
"description": "List of buttons to select (separated by a space)."
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "className",
"description": "Classes to give to the selected buttons (separated by space)."
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 82,
"kind": "member",
"name": "getButtonElement",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#getButtonElement",
"access": "public",
"description": "Get the DOM Element of a button. If there are several buttons with the same name, an array of the DOM Elements is returned.",
"lineNumber": 379,
"params": [
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "button",
"description": "The button layout name to select"
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 83,
"kind": "member",
"name": "handleCaret",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#handleCaret",
"access": "public",
"description": "Retrieves the current cursor position within a input or textarea (if any)",
"lineNumber": 397,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 84,
"kind": "member",
"name": "caretEventHandler",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#caretEventHandler",
"access": "public",
"description": "Called by {@link handleCaret} when an event that warrants a cursor position update is triggered",
"lineNumber": 410,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 85,
"kind": "member",
"name": "caretPosition",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#caretPosition",
"access": "public",
"description": "Tracks current cursor position\nAs keys are pressed, text will be added/removed at that position within the input.",
"lineNumber": 421,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 86,
"kind": "member",
"name": "onInit",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#onInit",
"access": "public",
"description": "Executes the callback function once simple-keyboard is rendered for the first time (on initialization).",
"lineNumber": 432,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 87,
"kind": "member",
"name": "onRender",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#onRender",
"access": "public",
"description": "Executes the callback function every time simple-keyboard is rendered (e.g: when you change layouts).",
"lineNumber": 449,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 88,
"kind": "member",
"name": "render",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"static": false,
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#render",
"access": "public",
"description": "Renders rows and buttons as per options",
"lineNumber": 457,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 89,
"kind": "member",
"name": "initialized",
"memberof": "src/lib/components/Keyboard.js~SimpleKeyboard",
"longname": "src/lib/components/Keyboard.js~SimpleKeyboard#initialized",
"access": "public",
"description": "Ensures that onInit is only called once per instantiation",
"lineNumber": 586,
"type": {
"types": [
"boolean"
]
}
},
{
"__docId__": 90,
"kind": "file",
"name": "src/lib/index.js",
"content": "import SimpleKeyboard from './components/Keyboard';\r\nexport default SimpleKeyboard;\r\n",
"static": true,
"longname": "X:/Dev/simple-keyboard/src/lib/index.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 91,
"kind": "file",
"name": "src/lib/services/KeyboardLayout.js",
"content": "/**\r\n * Keyboard Layout Service\r\n */\r\nclass KeyboardLayout {\r\n\r\n /**\r\n * Get default simple-keyboard layout\r\n * @return {object} The default layout (US-QWERTY)\r\n */\r\n static getDefaultLayout = () => {\r\n return {\r\n 'default': [\r\n '` 1 2 3 4 5 6 7 8 9 0 - = {bksp}',\r\n '{tab} q w e r t y u i o p [ ] \\\\',\r\n '{lock} a s d f g h j k l ; \\' {enter}',\r\n '{shift} z x c v b n m , . / {shift}',\r\n '.com @ {space}'\r\n ],\r\n 'shift': [\r\n '~ ! @ # $ % ^ & * ( ) _ + {bksp}',\r\n '{tab} Q W E R T Y U I O P { } |',\r\n '{lock} A S D F G H J K L : \" {enter}',\r\n '{shift} Z X C V B N M < > ? {shift}',\r\n '.com @ {space}'\r\n ]\r\n } \r\n }\r\n}\r\n\r\nexport default KeyboardLayout;",
"static": true,
"longname": "X:/Dev/simple-keyboard/src/lib/services/KeyboardLayout.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 92,
"kind": "class",
"name": "KeyboardLayout",
"memberof": "src/lib/services/KeyboardLayout.js",
"static": true,
"longname": "src/lib/services/KeyboardLayout.js~KeyboardLayout",
"access": "public",
"export": true,
"importPath": "simple-keyboard/src/lib/services/KeyboardLayout.js",
"importStyle": "KeyboardLayout",
"description": "Keyboard Layout Service",
"lineNumber": 4,
"interface": false
},
{
"__docId__": 93,
"kind": "member",
"name": "getDefaultLayout",
"memberof": "src/lib/services/KeyboardLayout.js~KeyboardLayout",
"static": true,
"longname": "src/lib/services/KeyboardLayout.js~KeyboardLayout.getDefaultLayout",
"access": "public",
"description": "Get default simple-keyboard layout",
"lineNumber": 10,
"return": {
"nullable": null,
"types": [
"object"
],
"spread": false,
"description": "The default layout (US-QWERTY)"
},
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 94,
"kind": "file",
"name": "src/lib/services/PhysicalKeyboard.js",
"content": "/**\r\n * Physical Keyboard Service\r\n */\r\nclass PhysicalKeyboard {\r\n /**\r\n * Creates an instance of the PhysicalKeyboard service\r\n */\r\n constructor(simpleKeyboardInstance){\r\n /**\r\n * @type {object} A simple-keyboard instance\r\n */\r\n this.simpleKeyboardInstance = simpleKeyboardInstance;\r\n\r\n this.initKeyboardListener();\r\n }\r\n\r\n /**\r\n * Initializes key event listeners\r\n */\r\n initKeyboardListener = () => {\r\n // Adding button style on keydown\r\n document.addEventListener(\"keydown\", (event) => {\r\n if(this.simpleKeyboardInstance.options.physicalKeyboardHighlight){\r\n let buttonPressed = this.getSimpleKeyboardLayoutKey(event);\r\n\r\n this.simpleKeyboardInstance.dispatch(instance => {\r\n let buttonDOM = instance.getButtonElement(buttonPressed) || instance.getButtonElement(`{${buttonPressed}}`);\r\n\r\n if(buttonDOM){\r\n buttonDOM.style.backgroundColor = this.simpleKeyboardInstance.options.physicalKeyboardHighlightBgColor || \"#9ab4d0\";\r\n buttonDOM.style.color = this.simpleKeyboardInstance.options.physicalKeyboardHighlightTextColor || \"white\";\r\n }\r\n });\r\n }\r\n });\r\n\r\n // Removing button style on keyup\r\n document.addEventListener(\"keyup\", (event) => {\r\n if(this.simpleKeyboardInstance.options.physicalKeyboardHighlight){\r\n let buttonPressed = this.getSimpleKeyboardLayoutKey(event);\r\n\r\n this.simpleKeyboardInstance.dispatch(instance => {\r\n let buttonDOM = instance.getButtonElement(buttonPressed) || instance.getButtonElement(`{${buttonPressed}}`);\r\n\r\n if(buttonDOM){\r\n buttonDOM.removeAttribute(\"style\");\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Transforms a KeyboardEvent's \"key.code\" string into a simple-keyboard layout format\r\n * @param {object} event The KeyboardEvent\r\n */\r\n getSimpleKeyboardLayoutKey = (event) => {\r\n let output;\r\n\r\n if(\r\n event.code.includes(\"Numpad\") ||\r\n event.code.includes(\"Shift\") ||\r\n event.code.includes(\"Space\") ||\r\n event.code.includes(\"Backspace\") ||\r\n event.code.includes(\"Control\") ||\r\n event.code.includes(\"Alt\") ||\r\n event.code.includes(\"Meta\")\r\n ){\r\n output = event.code;\r\n } else {\r\n output = event.key;\r\n }\r\n\r\n /**\r\n * If button is not uppercase, casting to lowercase\r\n */\r\n if (\r\n output !== output.toUpperCase() ||\r\n (event.code[0] === \"F\" && Number.isInteger(Number(event.code[1])) && event.code.length <= 3)\r\n ) {\r\n output = output.toLowerCase();\r\n }\r\n\r\n return output;\r\n }\r\n}\r\n\r\nexport default PhysicalKeyboard;",
"static": true,
"longname": "X:/Dev/simple-keyboard/src/lib/services/PhysicalKeyboard.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 95,
"kind": "class",
"name": "PhysicalKeyboard",
"memberof": "src/lib/services/PhysicalKeyboard.js",
"static": true,
"longname": "src/lib/services/PhysicalKeyboard.js~PhysicalKeyboard",
"access": "public",
"export": true,
"importPath": "simple-keyboard/src/lib/services/PhysicalKeyboard.js",
"importStyle": "PhysicalKeyboard",
"description": "Physical Keyboard Service",
"lineNumber": 4,
"interface": false
},
{
"__docId__": 96,
"kind": "constructor",
"name": "constructor",
"memberof": "src/lib/services/PhysicalKeyboard.js~PhysicalKeyboard",
"generator": false,
"async": false,
"static": false,
"longname": "src/lib/services/PhysicalKeyboard.js~PhysicalKeyboard#constructor",
"access": "public",
"description": "Creates an instance of the PhysicalKeyboard service",
"lineNumber": 8
},
{
"__docId__": 97,
"kind": "member",
"name": "simpleKeyboardInstance",
"memberof": "src/lib/services/PhysicalKeyboard.js~PhysicalKeyboard",
"static": false,
"longname": "src/lib/services/PhysicalKeyboard.js~PhysicalKeyboard#simpleKeyboardInstance",
"access": "public",
"description": "",
"lineNumber": 12,
"type": {
"nullable": null,
"types": [
"object"
],
"spread": false,
"description": null
}
},
{
"__docId__": 98,
"kind": "member",
"name": "initKeyboardListener",
"memberof": "src/lib/services/PhysicalKeyboard.js~PhysicalKeyboard",
"static": false,
"longname": "src/lib/services/PhysicalKeyboard.js~PhysicalKeyboard#initKeyboardListener",
"access": "public",
"description": "Initializes key event listeners",
"lineNumber": 20,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 99,
"kind": "member",
"name": "getSimpleKeyboardLayoutKey",
"memberof": "src/lib/services/PhysicalKeyboard.js~PhysicalKeyboard",
"static": false,
"longname": "src/lib/services/PhysicalKeyboard.js~PhysicalKeyboard#getSimpleKeyboardLayoutKey",
"access": "public",
"description": "Transforms a KeyboardEvent's \"key.code\" string into a simple-keyboard layout format",
"lineNumber": 57,
"params": [
{
"nullable": null,
"types": [
"object"
],
"spread": false,
"optional": false,
"name": "event",
"description": "The KeyboardEvent"
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 100,
"kind": "file",
"name": "src/lib/services/Utilities.js",
"content": "/**\r\n * Utility Service\r\n */\r\nclass Utilities {\r\n /**\r\n * Creates an instance of the Utility service\r\n */\r\n constructor(simpleKeyboardInstance){\r\n /**\r\n * @type {object} A simple-keyboard instance\r\n */\r\n this.simpleKeyboardInstance = simpleKeyboardInstance;\r\n }\r\n\r\n /**\r\n * Adds default classes to a given button\r\n * \r\n * @param {string} button The button's layout name\r\n * @return {string} The classes to be added to the button\r\n */\r\n getButtonClass = button => {\r\n let buttonTypeClass = (button.includes(\"{\") && button.includes(\"}\") && button !== '{//}') ? \"functionBtn\" : \"standardBtn\";\r\n let buttonWithoutBraces = button.replace(\"{\", \"\").replace(\"}\", \"\");\r\n let buttonNormalized = '';\r\n\r\n if(buttonTypeClass !== \"standardBtn\")\r\n buttonNormalized = ` hg-button-${buttonWithoutBraces}`;\r\n\r\n return `hg-${buttonTypeClass}${buttonNormalized}`;\r\n }\r\n\r\n /**\r\n * Default button display labels\r\n */\r\n getDefaultDiplay(){\r\n return {\r\n '{bksp}': 'backspace',\r\n '{backspace}': 'backspace',\r\n '{enter}': '< enter',\r\n '{shift}': 'shift',\r\n '{shiftleft}': 'shift',\r\n '{shiftright}': 'shift',\r\n '{alt}': 'alt',\r\n '{s}': 'shift',\r\n '{tab}': 'tab',\r\n '{lock}': 'caps',\r\n '{capslock}': 'caps',\r\n '{accept}': 'Submit',\r\n '{space}': ' ',\r\n '{//}': ' ',\r\n \"{esc}\": \"esc\",\r\n \"{escape}\": \"esc\",\r\n \"{f1}\": \"f1\",\r\n \"{f2}\": \"f2\",\r\n \"{f3}\": \"f3\",\r\n \"{f4}\": \"f4\",\r\n \"{f5}\": \"f5\",\r\n \"{f6}\": \"f6\",\r\n \"{f7}\": \"f7\",\r\n \"{f8}\": \"f8\",\r\n \"{f9}\": \"f9\",\r\n \"{f10}\": \"f10\",\r\n \"{f11}\": \"f11\",\r\n \"{f12}\": \"f12\",\r\n '{numpaddivide}': '/',\r\n '{numlock}': 'lock',\r\n \"{arrowup}\": \"↑\",\r\n \"{arrowleft}\": \"←\",\r\n \"{arrowdown}\": \"↓\",\r\n \"{arrowright}\": \"→\",\r\n \"{prtscr}\": \"print\",\r\n \"{scrolllock}\": \"scroll\",\r\n \"{pause}\": \"pause\",\r\n \"{insert}\": \"ins\",\r\n \"{home}\": \"home\",\r\n \"{pageup}\": \"up\",\r\n \"{delete}\": \"del\",\r\n \"{end}\": \"end\",\r\n \"{pagedown}\": \"down\",\r\n \"{numpadmultiply}\": \"*\",\r\n \"{numpadsubtract}\": \"-\",\r\n \"{numpadadd}\": \"+\",\r\n \"{numpadenter}\": \"enter\",\r\n \"{period}\": \".\",\r\n \"{numpaddecimal}\": \".\",\r\n \"{numpad0}\": \"0\",\r\n \"{numpad1}\": \"1\",\r\n \"{numpad2}\": \"2\",\r\n \"{numpad3}\": \"3\",\r\n \"{numpad4}\": \"4\",\r\n \"{numpad5}\": \"5\",\r\n \"{numpad6}\": \"6\",\r\n \"{numpad7}\": \"7\",\r\n \"{numpad8}\": \"8\",\r\n \"{numpad9}\": \"9\",\r\n };\r\n }\r\n /**\r\n * Returns the display (label) name for a given button\r\n * \r\n * @param {string} button The button's layout name\r\n * @param {object} display The provided display option\r\n * @param {boolean} mergeDisplay Whether the provided param value should be merged with the default one.\r\n */\r\n getButtonDisplayName = (button, display, mergeDisplay) => {\r\n if(mergeDisplay){\r\n display = Object.assign({}, this.getDefaultDiplay(), display);\r\n } else {\r\n display = display || this.getDefaultDiplay();\r\n }\r\n\r\n return display[button] || button;\r\n }\r\n\r\n \r\n /**\r\n * Returns the updated input resulting from clicking a given button\r\n * \r\n * @param {string} button The button's layout name\r\n * @param {string} input The input string\r\n * @param {object} options The simple-keyboard options object\r\n * @param {number} caretPos The cursor's current position\r\n */\r\n getUpdatedInput = (button, input, options, caretPos) => {\r\n \r\n let output = input;\r\n\r\n if((button === \"{bksp}\" || button === \"{backspace}\") && output.length > 0){\r\n output = this.removeAt(output, caretPos);\r\n\r\n } else if(button === \"{space}\")\r\n output = this.addStringAt(output, \" \", caretPos);\r\n\r\n else if(button === \"{tab}\" && !(typeof options.tabCharOnTab === \"boolean\" && options.tabCharOnTab === false)){\r\n output = this.addStringAt(output, \"\\t\", caretPos);\r\n\r\n } else if((button === \"{enter}\" || button === \"{numpadenter}\") && options.newLineOnEnter)\r\n output = this.addStringAt(output, \"\\n\", caretPos);\r\n\r\n else if(button.includes(\"numpad\") && Number.isInteger(Number(button[button.length - 2]))){\r\n output = this.addStringAt(output, button[button.length - 2], caretPos);\r\n }\r\n else if(button === \"{numpaddivide}\")\r\n output = this.addStringAt(output, '/', caretPos);\r\n\r\n else if(button === \"{numpadmultiply}\")\r\n output = this.addStringAt(output, '*', caretPos);\r\n else if(button === \"{numpadsubtract}\")\r\n output = this.addStringAt(output, '-', caretPos);\r\n\r\n else if(button === \"{numpadadd}\")\r\n output = this.addStringAt(output, '+', caretPos);\r\n\r\n else if(button === \"{numpaddecimal}\")\r\n output = this.addStringAt(output, '.', caretPos);\r\n\r\n else if(button === \"{\" || button === \"}\")\r\n output = this.addStringAt(output, button, caretPos);\r\n\r\n else if(!button.includes(\"{\") && !button.includes(\"}\"))\r\n output = this.addStringAt(output, button, caretPos);\r\n\r\n return output;\r\n }\r\n /**\r\n * Moves the cursor position by a given amount\r\n * \r\n * @param {number} length Represents by how many characters the input should be moved\r\n * @param {boolean} minus Whether the cursor should be moved to the left or not.\r\n */\r\n updateCaretPos = (length, minus) => {\r\n if(minus){\r\n if(this.simpleKeyboardInstance.caretPosition > 0)\r\n this.simpleKeyboardInstance.caretPosition = this.simpleKeyboardInstance.caretPosition - length\r\n } else {\r\n this.simpleKeyboardInstance.caretPosition = this.simpleKeyboardInstance.caretPosition + length;\r\n }\r\n }\r\n\r\n /**\r\n * Adds a string to the input at a given position\r\n * \r\n * @param {string} source The source input\r\n * @param {string} string The string to add\r\n * @param {number} position The (cursor) position where the string should be added\r\n */\r\n addStringAt(source, string, position){\r\n let output;\r\n\r\n if(this.simpleKeyboardInstance.options.debug){\r\n console.log(\"Caret at:\", position);\r\n }\r\n\r\n if(!position && position !== 0){\r\n output = source + string;\r\n } else {\r\n output = [source.slice(0, position), string, source.slice(position)].join('');\r\n\r\n /**\r\n * Avoid caret position change when maxLength is set\r\n */\r\n if(!this.isMaxLengthReached()){\r\n this.updateCaretPos(string.length);\r\n }\r\n\r\n }\r\n\r\n return output;\r\n }\r\n\r\n /**\r\n * Removes an amount of characters at a given position\r\n * \r\n * @param {string} source The source input\r\n * @param {number} position The (cursor) position from where the characters should be removed\r\n */\r\n removeAt(source, position){\r\n if(this.simpleKeyboardInstance.caretPosition === 0){\r\n return source;\r\n }\r\n\r\n let output;\r\n let prevTwoChars;\r\n let emojiMatched;\r\n let emojiMatchedReg = /([\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/g;\r\n\r\n /**\r\n * Emojis are made out of two characters, so we must take a custom approach to trim them.\r\n * For more info: https://mathiasbynens.be/notes/javascript-unicode\r\n */\r\n if(position && position >= 0){\r\n prevTwoChars = source.substring(position - 2, position)\r\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\r\n\r\n if(emojiMatched){\r\n output = source.substr(0, (position - 2)) + source.substr(position);\r\n this.updateCaretPos(2, true);\r\n } else {\r\n output = source.substr(0, (position - 1)) + source.substr(position);\r\n this.updateCaretPos(1, true);\r\n }\r\n } else {\r\n prevTwoChars = source.slice(-2);\r\n emojiMatched = prevTwoChars.match(emojiMatchedReg);\r\n\r\n if(emojiMatched){\r\n output = source.slice(0, -2);\r\n this.updateCaretPos(2, true);\r\n } else {\r\n output = source.slice(0, -1);\r\n this.updateCaretPos(1, true);\r\n }\r\n }\r\n\r\n return output;\r\n }\r\n /**\r\n * Determines whether the maxLength has been reached. This function is called when the maxLength option it set.\r\n * \r\n * @param {object} inputObj\r\n * @param {object} options\r\n * @param {string} updatedInput\r\n */\r\n handleMaxLength(inputObj, options, updatedInput){\r\n let maxLength = options.maxLength;\r\n let currentInput = inputObj[options.inputName];\r\n let condition = currentInput.length === maxLength;\r\n\r\n\r\n if(\r\n /**\r\n * If pressing this button won't add more characters\r\n * We exit out of this limiter function\r\n */\r\n updatedInput.length <= currentInput.length\r\n ){\r\n return false;\r\n }\r\n\r\n if(Number.isInteger(maxLength)){\r\n if(options.debug){\r\n console.log(\"maxLength (num) reached:\", condition);\r\n }\r\n\r\n if(condition){\r\n /**\r\n * @type {boolean} Boolean value that shows whether maxLength has been reached\r\n */\r\n this.maxLengthReached = true;\r\n return true;\r\n } else {\r\n this.maxLengthReached = false;\r\n return false;\r\n }\r\n }\r\n\r\n if(typeof maxLength === \"object\"){\r\n let condition = currentInput.length === maxLength[options.inputName];\r\n\r\n if(options.debug){\r\n console.log(\"maxLength (obj) reached:\", condition);\r\n }\r\n\r\n if(condition){\r\n this.maxLengthReached = true;\r\n return true;\r\n } else {\r\n this.maxLengthReached = false;\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current value of maxLengthReached\r\n */\r\n isMaxLengthReached = () => {\r\n return Boolean(this.maxLengthReached);\r\n }\r\n\r\n /**\r\n * Transforms an arbitrary string to camelCase\r\n * \r\n * @param {string} string The string to transform.\r\n */\r\n camelCase = (string) => {\r\n return string.toLowerCase().trim().split(/[.\\-_\\s]/g).reduce((string, word) => string + word[0].toUpperCase() + word.slice(1));\r\n };\r\n\r\n /**\r\n * Counts the number of duplicates in a given array\r\n * \r\n * @param {Array} array The haystack to search in\r\n * @param {string} value The needle to search for\r\n */\r\n countInArray = (array, value) => {\r\n return array.reduce((n, x) => n + (x === value), 0);\r\n }\r\n\r\n}\r\n\r\nexport default Utilities;",
"static": true,
"longname": "X:/Dev/simple-keyboard/src/lib/services/Utilities.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 101,
"kind": "class",
"name": "Utilities",
"memberof": "src/lib/services/Utilities.js",
"static": true,
"longname": "src/lib/services/Utilities.js~Utilities",
"access": "public",
"export": true,
"importPath": "simple-keyboard/src/lib/services/Utilities.js",
"importStyle": "Utilities",
"description": "Utility Service",
"lineNumber": 4,
"interface": false
},
{
"__docId__": 102,
"kind": "constructor",
"name": "constructor",
"memberof": "src/lib/services/Utilities.js~Utilities",
"generator": false,
"async": false,
"static": false,
"longname": "src/lib/services/Utilities.js~Utilities#constructor",
"access": "public",
"description": "Creates an instance of the Utility service",
"lineNumber": 8
},
{
"__docId__": 103,
"kind": "member",
"name": "simpleKeyboardInstance",
"memberof": "src/lib/services/Utilities.js~Utilities",
"static": false,
"longname": "src/lib/services/Utilities.js~Utilities#simpleKeyboardInstance",
"access": "public",
"description": "",
"lineNumber": 12,
"type": {
"nullable": null,
"types": [
"object"
],
"spread": false,
"description": null
}
},
{
"__docId__": 104,
"kind": "member",
"name": "getButtonClass",
"memberof": "src/lib/services/Utilities.js~Utilities",
"static": false,
"longname": "src/lib/services/Utilities.js~Utilities#getButtonClass",
"access": "public",
"description": "Adds default classes to a given button",
"lineNumber": 21,
"params": [
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "button",
"description": "The button's layout name"
}
],
"return": {
"nullable": null,
"types": [
"string"
],
"spread": false,
"description": "The classes to be added to the button"
},
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 105,
"kind": "method",
"name": "getDefaultDiplay",
"memberof": "src/lib/services/Utilities.js~Utilities",
"generator": false,
"async": false,
"static": false,
"longname": "src/lib/services/Utilities.js~Utilities#getDefaultDiplay",
"access": "public",
"description": "Default button display labels",
"lineNumber": 35,
"params": [],
"return": {
"types": [
"{\"{bksp}\": string, \"{backspace}\": string, \"{enter}\": string, \"{shift}\": string, \"{shiftleft}\": string, \"{shiftright}\": string, \"{alt}\": string, \"{s}\": string, \"{tab}\": string, \"{lock}\": string, \"{capslock}\": string, \"{accept}\": string, \"{space}\": string, \"{//}\": string, \"{esc}\": string, \"{escape}\": string, \"{f1}\": string, \"{f2}\": string, \"{f3}\": string, \"{f4}\": string, \"{f5}\": string, \"{f6}\": string, \"{f7}\": string, \"{f8}\": string, \"{f9}\": string, \"{f10}\": string, \"{f11}\": string, \"{f12}\": string, \"{numpaddivide}\": string, \"{numlock}\": string, \"{arrowup}\": string, \"{arrowleft}\": string, \"{arrowdown}\": string, \"{arrowright}\": string, \"{prtscr}\": string, \"{scrolllock}\": string, \"{pause}\": string, \"{insert}\": string, \"{home}\": string, \"{pageup}\": string, \"{delete}\": string, \"{end}\": string, \"{pagedown}\": string, \"{numpadmultiply}\": string, \"{numpadsubtract}\": string, \"{numpadadd}\": string, \"{numpadenter}\": string, \"{period}\": string, \"{numpaddecimal}\": string, \"{numpad0}\": string, \"{numpad1}\": string, \"{numpad2}\": string, \"{numpad3}\": string, \"{numpad4}\": string, \"{numpad5}\": string, \"{numpad6}\": string, \"{numpad7}\": string, \"{numpad8}\": string, \"{numpad9}\": string}"
]
}
},
{
"__docId__": 106,
"kind": "member",
"name": "getButtonDisplayName",
"memberof": "src/lib/services/Utilities.js~Utilities",
"static": false,
"longname": "src/lib/services/Utilities.js~Utilities#getButtonDisplayName",
"access": "public",
"description": "Returns the display (label) name for a given button",
"lineNumber": 105,
"params": [
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "button",
"description": "The button's layout name"
},
{
"nullable": null,
"types": [
"object"
],
"spread": false,
"optional": false,
"name": "display",
"description": "The provided display option"
},
{
"nullable": null,
"types": [
"boolean"
],
"spread": false,
"optional": false,
"name": "mergeDisplay",
"description": "Whether the provided param value should be merged with the default one."
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 107,
"kind": "member",
"name": "getUpdatedInput",
"memberof": "src/lib/services/Utilities.js~Utilities",
"static": false,
"longname": "src/lib/services/Utilities.js~Utilities#getUpdatedInput",
"access": "public",
"description": "Returns the updated input resulting from clicking a given button",
"lineNumber": 124,
"params": [
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "button",
"description": "The button's layout name"
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "input",
"description": "The input string"
},
{
"nullable": null,
"types": [
"object"
],
"spread": false,
"optional": false,
"name": "options",
"description": "The simple-keyboard options object"
},
{
"nullable": null,
"types": [
"number"
],
"spread": false,
"optional": false,
"name": "caretPos",
"description": "The cursor's current position"
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 108,
"kind": "member",
"name": "updateCaretPos",
"memberof": "src/lib/services/Utilities.js~Utilities",
"static": false,
"longname": "src/lib/services/Utilities.js~Utilities#updateCaretPos",
"access": "public",
"description": "Moves the cursor position by a given amount",
"lineNumber": 171,
"params": [
{
"nullable": null,
"types": [
"number"
],
"spread": false,
"optional": false,
"name": "length",
"description": "Represents by how many characters the input should be moved"
},
{
"nullable": null,
"types": [
"boolean"
],
"spread": false,
"optional": false,
"name": "minus",
"description": "Whether the cursor should be moved to the left or not."
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 109,
"kind": "method",
"name": "addStringAt",
"memberof": "src/lib/services/Utilities.js~Utilities",
"generator": false,
"async": false,
"static": false,
"longname": "src/lib/services/Utilities.js~Utilities#addStringAt",
"access": "public",
"description": "Adds a string to the input at a given position",
"lineNumber": 187,
"params": [
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "source",
"description": "The source input"
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "string",
"description": "The string to add"
},
{
"nullable": null,
"types": [
"number"
],
"spread": false,
"optional": false,
"name": "position",
"description": "The (cursor) position where the string should be added"
}
],
"return": {
"types": [
"*"
]
}
},
{
"__docId__": 110,
"kind": "method",
"name": "removeAt",
"memberof": "src/lib/services/Utilities.js~Utilities",
"generator": false,
"async": false,
"static": false,
"longname": "src/lib/services/Utilities.js~Utilities#removeAt",
"access": "public",
"description": "Removes an amount of characters at a given position",
"lineNumber": 217,
"params": [
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "source",
"description": "The source input"
},
{
"nullable": null,
"types": [
"number"
],
"spread": false,
"optional": false,
"name": "position",
"description": "The (cursor) position from where the characters should be removed"
}
],
"return": {
"types": [
"*"
]
}
},
{
"__docId__": 111,
"kind": "method",
"name": "handleMaxLength",
"memberof": "src/lib/services/Utilities.js~Utilities",
"generator": false,
"async": false,
"static": false,
"longname": "src/lib/services/Utilities.js~Utilities#handleMaxLength",
"access": "public",
"description": "Determines whether the maxLength has been reached. This function is called when the maxLength option it set.",
"lineNumber": 264,
"params": [
{
"nullable": null,
"types": [
"object"
],
"spread": false,
"optional": false,
"name": "inputObj",
"description": ""
},
{
"nullable": null,
"types": [
"object"
],
"spread": false,
"optional": false,
"name": "options",
"description": ""
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "updatedInput",
"description": ""
}
],
"return": {
"types": [
"boolean"
]
}
},
{
"__docId__": 112,
"kind": "member",
"name": "maxLengthReached",
"memberof": "src/lib/services/Utilities.js~Utilities",
"static": false,
"longname": "src/lib/services/Utilities.js~Utilities#maxLengthReached",
"access": "public",
"description": "",
"lineNumber": 289,
"type": {
"nullable": null,
"types": [
"boolean"
],
"spread": false,
"description": null
}
},
{
"__docId__": 116,
"kind": "member",
"name": "isMaxLengthReached",
"memberof": "src/lib/services/Utilities.js~Utilities",
"static": false,
"longname": "src/lib/services/Utilities.js~Utilities#isMaxLengthReached",
"access": "public",
"description": "Gets the current value of maxLengthReached",
"lineNumber": 317,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 117,
"kind": "member",
"name": "camelCase",
"memberof": "src/lib/services/Utilities.js~Utilities",
"static": false,
"longname": "src/lib/services/Utilities.js~Utilities#camelCase",
"access": "public",
"description": "Transforms an arbitrary string to camelCase",
"lineNumber": 326,
"params": [
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "string",
"description": "The string to transform."
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 118,
"kind": "member",
"name": "countInArray",
"memberof": "src/lib/services/Utilities.js~Utilities",
"static": false,
"longname": "src/lib/services/Utilities.js~Utilities#countInArray",
"access": "public",
"description": "Counts the number of duplicates in a given array",
"lineNumber": 336,
"params": [
{
"nullable": null,
"types": [
"Array"
],
"spread": false,
"optional": false,
"name": "array",
"description": "The haystack to search in"
},
{
"nullable": null,
"types": [
"string"
],
"spread": false,
"optional": false,
"name": "value",
"description": "The needle to search for"
}
],
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 119,
"kind": "file",
"name": "src/lib/tests/TestUtility.js",
"content": "/**\r\n * Test Utility Functions\r\n */\r\nexport default class TestUtility {\r\n /**\r\n * Set's a basic DOM structure to test in\r\n */\r\n setDOM = (divClass) => {\r\n this.clear();\r\n const div = document.createElement('div');\r\n div.className += divClass || \"simple-keyboard\";\r\n document.body.appendChild(div);\r\n }\r\n\r\n /**\r\n * Clears DOM structure\r\n */\r\n clear = () => {\r\n document.body.innerHTML = \"\";\r\n }\r\n\r\n /**\r\n * Test if standard buttons respect maxLength and do input a value\r\n */\r\n testLayoutStdButtons = (keyboard) => {\r\n let stdBtnCount = 0;\r\n let fullInput = '';\r\n\r\n this.iterateButtons((button) => {\r\n let label = button.getAttribute(\"data-skbtn\");\r\n\r\n if(label.includes(\"{\"))\r\n return false;\r\n\r\n // Click all standard buttons, respects maxLength\r\n button.onclick();\r\n\r\n // Recording fullInput, bypasses maxLength\r\n fullInput = keyboard.utilities.getUpdatedInput(label, fullInput, keyboard.options, null);\r\n\r\n stdBtnCount += label.length;\r\n });\r\n\r\n /**\r\n * Check if maxLength is respected\r\n */\r\n if(\r\n (\r\n typeof keyboard.options.maxLength === \"object\" &&\r\n keyboard.getInput().length !== keyboard.options.maxLength[keyboard.options.layoutName]\r\n ) ||\r\n (\r\n typeof keyboard.options.maxLength !== \"object\" &&\r\n keyboard.getInput().length !== keyboard.options.maxLength\r\n )\r\n )\r\n throw new Error(\"MAX_LENGTH_ISSUE\");\r\n else\r\n console.log(\"MAX_LENGTH PASSED:\", keyboard.options.layoutName, keyboard.getInput().length, keyboard.options.maxLength);\r\n\r\n /**\r\n * Check if all standard buttons are inputting something\r\n * (Regardless of maxLength)\r\n */\r\n if(stdBtnCount !== fullInput.length)\r\n throw new Error(\"STANDARD_BUTTONS_ISSUE\");\r\n else\r\n console.log(\"STANDARD_BUTTONS PASSED:\", keyboard.options.layoutName, stdBtnCount, fullInput.length);\r\n }\r\n\r\n /**\r\n * Test if function buttons are interactive (have an onclick)\r\n */\r\n testLayoutFctButtons = (callback) => {\r\n let fctBtnCount = 0;\r\n let fctBtnHasOnclickCount = 0;\r\n\r\n this.iterateButtons((button) => {\r\n let label = button.getAttribute(\"data-skbtn\");\r\n\r\n if(!label.includes(\"{\") && !label.includes(\"}\"))\r\n return false;\r\n\r\n fctBtnCount++;\r\n\r\n if(button.onclick){\r\n button.onclick();\r\n fctBtnHasOnclickCount++;\r\n }\r\n\r\n callback(fctBtnCount, fctBtnHasOnclickCount);\r\n });\r\n }\r\n\r\n /**\r\n * Iterates on the keyboard buttons\r\n */\r\n iterateButtons = (callback, selector) => {\r\n let rows = document.body.querySelector(selector || '.simple-keyboard').children;\r\n\r\n Array.from(rows).forEach(row => {\r\n Array.from(row.children).forEach((button) => {\r\n callback(button);\r\n });\r\n });\r\n }\r\n}",
"static": true,
"longname": "X:/Dev/simple-keyboard/src/lib/tests/TestUtility.js",
"access": "public",
"description": null,
"lineNumber": 1
},
{
"__docId__": 120,
"kind": "class",
"name": "TestUtility",
"memberof": "src/lib/tests/TestUtility.js",
"static": true,
"longname": "src/lib/tests/TestUtility.js~TestUtility",
"access": "public",
"export": true,
"importPath": "simple-keyboard/src/lib/tests/TestUtility.js",
"importStyle": "TestUtility",
"description": "Test Utility Functions",
"lineNumber": 4,
"interface": false
},
{
"__docId__": 121,
"kind": "member",
"name": "setDOM",
"memberof": "src/lib/tests/TestUtility.js~TestUtility",
"static": false,
"longname": "src/lib/tests/TestUtility.js~TestUtility#setDOM",
"access": "public",
"description": "Set's a basic DOM structure to test in",
"lineNumber": 8,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 122,
"kind": "member",
"name": "clear",
"memberof": "src/lib/tests/TestUtility.js~TestUtility",
"static": false,
"longname": "src/lib/tests/TestUtility.js~TestUtility#clear",
"access": "public",
"description": "Clears DOM structure",
"lineNumber": 18,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 123,
"kind": "member",
"name": "testLayoutStdButtons",
"memberof": "src/lib/tests/TestUtility.js~TestUtility",
"static": false,
"longname": "src/lib/tests/TestUtility.js~TestUtility#testLayoutStdButtons",
"access": "public",
"description": "Test if standard buttons respect maxLength and do input a value",
"lineNumber": 25,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 124,
"kind": "member",
"name": "testLayoutFctButtons",
"memberof": "src/lib/tests/TestUtility.js~TestUtility",
"static": false,
"longname": "src/lib/tests/TestUtility.js~TestUtility#testLayoutFctButtons",
"access": "public",
"description": "Test if function buttons are interactive (have an onclick)",
"lineNumber": 74,
"type": {
"types": [
"*"
]
}
},
{
"__docId__": 125,
"kind": "member",
"name": "iterateButtons",
"memberof": "src/lib/tests/TestUtility.js~TestUtility",
"static": false,
"longname": "src/lib/tests/TestUtility.js~TestUtility#iterateButtons",
"access": "public",
"description": "Iterates on the keyboard buttons",
"lineNumber": 98,
"type": {
"types": [
"*"
]
}
},
{
"kind": "index",
"content": "[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/hodgef/simple-keyboard/blob/master/LICENSE)\r\n[![npm version](https://img.shields.io/npm/v/simple-keyboard.svg?style=flat)](https://www.npmjs.com/package/simple-keyboard)\r\n[![Build Status](https://travis-ci.org/hodgef/simple-keyboard.svg?branch=master)](https://travis-ci.org/hodgef/simple-keyboard)\r\n[![codecov](https://codecov.io/gh/hodgef/simple-keyboard/branch/master/graph/badge.svg)](https://codecov.io/gh/hodgef/simple-keyboard)\r\n[![Documentation Status](https://doc.esdoc.org/github.com/hodgef/simple-keyboard/badge.svg\r\n)](https://doc.esdoc.org/github.com/hodgef/simple-keyboard)\r\n[![](https://img.shields.io/badge/discord--chat-join-green.svg?longCache=true&style=flat-square&colorB=7289DA&logo=discord)](http://franciscohodge.com/simple-keyboard/chat/join) \r\n\r\n<a href=\"https://simple-keyboard.com/demo\" title=\"View Demo\" target=\"_blank\"><img src=\"https://franciscohodge.com/project-pages/simple-keyboard/images/simplekeyboard-banner_B.png\" align=\"center\" width=\"100%\"></a>\r\n<a href=\"https://simple-keyboard.com/demo\" title=\"View Demo\" target=\"_blank\"><img src=\"https://franciscohodge.com/project-pages/simple-keyboard/images/simple-keyboard-10172018.gif\" align=\"center\" width=\"100%\"></a>\r\n\r\n> The easily customisable and responsive on-screen virtual keyboard for Javascript projects.\r\n\r\n## Installation & Usage\r\nYou can use simple-keyboard as a `<script>` tag from a CDN, or install it from npm.\r\n \r\nCheck out the [Getting Started](https://simple-keyboard.com/getting-started) docs to begin.\r\n\r\n## Documentation\r\nCheck out the [simple-keyboard documentation](https://simple-keyboard.com/documentation) site.\r\n\r\nFeel free to browse the [Q&A / Use-cases](https://simple-keyboard.com/qa-use-cases/) page for advanced use-cases.\r\n\r\n## Demo\r\n\r\n[https://simple-keyboard.com/demo](https://simple-keyboard.com/demo)\r\n\r\n\r\n### To run demo on your own computer\r\n\r\n* Clone this repository\r\n* `npm install`\r\n* `npm start`\r\n* Visit [http://localhost:3000/](http://localhost:3000/)\r\n\r\n### Other versions\r\n\r\n* ReactJS - [react-simple-keyboard](https://github.com/hodgef/react-simple-keyboard)\r\n\r\n### Questions?\r\n\r\n<a href=\"http://franciscohodge.com/simple-keyboard/chat/join\" title=\"Join our Discord chat\" target=\"_blank\"><img src=\"https://franciscohodge.com/project-pages/simple-keyboard/images/discord.png\" align=\"center\" width=\"200\"></a>\r\n\r\n## Contributing\r\n\r\nPR's and issues are welcome. Feel free to submit any issues you have at:\r\n[https://github.com/hodgef/simple-keyboard/issues](https://github.com/hodgef/simple-keyboard/issues)\r\n",
"longname": "X:\\Dev\\simple-keyboard\\README.md",
"name": "./README.md",
"static": true,
"access": "public"
},
{
"kind": "packageJSON",
"content": "{\r\n \"name\": \"simple-keyboard\",\r\n \"version\": \"2.6.7\",\r\n \"description\": \"On-screen Javascript Virtual Keyboard\",\r\n \"main\": \"build/index.js\",\r\n \"scripts\": {\r\n \"start\": \"node scripts/start.js\",\r\n \"build\": \"node scripts/build.js\",\r\n \"demo\": \"node scripts/demo.js\",\r\n \"test\": \"node scripts/test.js --env=jsdom\",\r\n \"postinstall\": \"node bin/postinstall\",\r\n \"prepublish\": \"npm run docs && npm run build\",\r\n \"docs\": \"esdoc\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/hodgef/simple-keyboard\"\r\n },\r\n \"author\": \"Francisco Hodge <hello@franciscohodge.com> (https://github.com/hodgef)\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/hodgef/simple-keyboard/issues\"\r\n },\r\n \"homepage\": \"https://virtual-keyboard-javascript.github.io\",\r\n \"keywords\": [\r\n \"javascript\",\r\n \"es6\",\r\n \"digital\",\r\n \"keyboard\",\r\n \"onscreen\",\r\n \"virtual\",\r\n \"component\",\r\n \"virtual-keyboard\",\r\n \"touchscreen\",\r\n \"touch-screen\",\r\n \"osk\"\r\n ],\r\n \"license\": \"MIT\",\r\n \"dependencies\": {},\r\n \"devDependencies\": {\r\n \"autoprefixer\": \"7.1.6\",\r\n \"babel-core\": \"^6.26.3\",\r\n \"babel-eslint\": \"7.2.3\",\r\n \"babel-jest\": \"20.0.3\",\r\n \"babel-loader\": \"7.1.2\",\r\n \"babel-preset-react-app\": \"^3.1.2\",\r\n \"babel-runtime\": \"6.26.0\",\r\n \"case-sensitive-paths-webpack-plugin\": \"2.1.1\",\r\n \"chalk\": \"1.1.3\",\r\n \"copy-webpack-plugin\": \"^4.3.1\",\r\n \"css-loader\": \"0.28.7\",\r\n \"dotenv\": \"4.0.0\",\r\n \"esdoc\": \"^1.1.0\",\r\n \"esdoc-ecmascript-proposal-plugin\": \"^1.0.0\",\r\n \"esdoc-standard-plugin\": \"^1.0.0\",\r\n \"eslint\": \"4.10.0\",\r\n \"eslint-config-react-app\": \"^2.0.1\",\r\n \"eslint-loader\": \"1.9.0\",\r\n \"eslint-plugin-flowtype\": \"2.39.1\",\r\n \"eslint-plugin-import\": \"2.8.0\",\r\n \"eslint-plugin-jsx-a11y\": \"5.1.1\",\r\n \"eslint-plugin-react\": \"7.4.0\",\r\n \"extract-text-webpack-plugin\": \"3.0.2\",\r\n \"file-loader\": \"1.1.5\",\r\n \"fs-extra\": \"3.0.1\",\r\n \"html-webpack-plugin\": \"2.29.0\",\r\n \"istanbul\": \"^0.4.5\",\r\n \"istanbul-api\": \"^2.0.6\",\r\n \"istanbul-reports\": \"^2.0.1\",\r\n \"jest\": \"20.0.4\",\r\n \"object-assign\": \"4.1.1\",\r\n \"postcss-flexbugs-fixes\": \"3.2.0\",\r\n \"postcss-loader\": \"2.0.8\",\r\n \"promise\": \"8.0.1\",\r\n \"prop-types\": \"^15.6.1\",\r\n \"raf\": \"3.4.0\",\r\n \"react\": \"^16.2.0\",\r\n \"react-dev-utils\": \"^4.2.1\",\r\n \"react-dom\": \"^16.2.0\",\r\n \"style-loader\": \"0.19.0\",\r\n \"sw-precache-webpack-plugin\": \"0.11.4\",\r\n \"url-loader\": \"0.6.2\",\r\n \"webpack\": \"3.8.1\",\r\n \"webpack-dev-server\": \"2.9.4\",\r\n \"webpack-manifest-plugin\": \"1.3.2\",\r\n \"whatwg-fetch\": \"2.0.3\"\r\n },\r\n \"jest\": {\r\n \"collectCoverageFrom\": [\r\n \"src/**/*.{js,jsx,mjs}\",\r\n \"!**/tests/**\"\r\n ],\r\n \"setupFiles\": [\r\n \"<rootDir>/config/polyfills.js\"\r\n ],\r\n \"testMatch\": [\r\n \"<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}\",\r\n \"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}\"\r\n ],\r\n \"testEnvironment\": \"node\",\r\n \"testURL\": \"http://localhost\",\r\n \"transform\": {\r\n \"^.+\\\\.(js|jsx|mjs)$\": \"<rootDir>/node_modules/babel-jest\",\r\n \"^.+\\\\.css$\": \"<rootDir>/config/jest/cssTransform.js\",\r\n \"^(?!.*\\\\.(js|jsx|mjs|css|json)$)\": \"<rootDir>/config/jest/fileTransform.js\"\r\n },\r\n \"transformIgnorePatterns\": [\r\n \"[/\\\\\\\\]node_modules[/\\\\\\\\].+\\\\.(js|jsx|mjs)$\"\r\n ],\r\n \"moduleNameMapper\": {\r\n \"^react-native$\": \"react-native-web\"\r\n },\r\n \"moduleFileExtensions\": [\r\n \"web.js\",\r\n \"mjs\",\r\n \"js\",\r\n \"json\",\r\n \"web.jsx\",\r\n \"jsx\",\r\n \"node\"\r\n ]\r\n },\r\n \"babel\": {\r\n \"presets\": [\r\n \"react-app\"\r\n ]\r\n },\r\n \"eslintConfig\": {\r\n \"extends\": \"react-app\"\r\n }\r\n}\r\n",
"longname": "X:\\Dev\\simple-keyboard\\package.json",
"name": "package.json",
"static": true,
"access": "public"
}
]