simple-keyboard/build/index.js.map
2018-04-24 09:18:55 -04:00

1 line
30 KiB
Plaintext

{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///index.js","webpack:///webpack/bootstrap 146ec2062f33f8b07c37","webpack:///./src/lib/index.js","webpack:///./src/lib/components/Keyboard.js","webpack:///./src/lib/services/KeyboardLayout.js","webpack:///./src/lib/services/Utilities.js"],"names":["root","factory","exports","module","define","amd","a","i","this","modules","__webpack_require__","moduleId","installedModules","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","__webpack_exports__","value","__WEBPACK_IMPORTED_MODULE_0__components_Keyboard__","_classCallCheck","instance","Constructor","TypeError","__WEBPACK_IMPORTED_MODULE_0__Keyboard_css__","__WEBPACK_IMPORTED_MODULE_1__services_KeyboardLayout__","__WEBPACK_IMPORTED_MODULE_2__services_Utilities__","_typeof","Symbol","iterator","obj","constructor","SimpleKeyboard","_initialiseProps","keyboardDOMQuery","arguments","length","undefined","options","keyboardDOM","document","querySelector","input","layoutName","theme","render","console","error","_this","handleButtonClicked","button","debug","onKeyPress","newLineOnEnter","updatedInput","getUpdatedInput","log","onChange","clearInput","getInput","setInput","setOptions","option","assign","clear","innerHTML","layoutClass","layout","getLayout","className","forEach","row","index","rowArray","split","rowDOM","createElement","fctBtnClass","getButtonClass","buttonDisplayName","getButtonDisplayName","display","buttonDOM","onclick","buttonSpanDOM","appendChild","onInit","KeyboardLayout","default","shift","_createClass","defineProperties","target","props","descriptor","writable","key","protoProps","staticProps","Utilities","string","output","{bksp}","{enter}","{shift}","{s}","{tab}","{lock}","{accept}","{space}","{//}","buttonTypeClass","includes","buttonWithoutBraces","replace","normalizeString","getDefaultDiplay","slice"],"mappings":"CAAA,SAAAA,EAAAC,GACA,oBAAAC,UAAA,iBAAAC,QACAA,OAAAD,QAAAD,QACA,uBAAAG,gBAAAC,IACAD,UAAAH,OACA,CACA,GAAAK,GAAAL,GACA,QAAAM,K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eACQ,MAAXA,EACG,WACQ,MAAXA,EACG,YACQ,MAAXA,EACG,aACQ,MAAXA,EACG,SACQ,MAAXA,EACG,OACQ,MAAXA,EACG,QACQ,MAAXA,EACG,aACQ,MAAXA,EACG,QACQ,MAAXA,EACG,cACQ,MAAXA,EACG,eACQ,OAAXA,EACG,cAEA,GAEJC,gBAAuBA,EAAW,MLkH87CL,IAAI,mBAAmB9E,MAAM,WKnGpgD,OACEoF,SAAU,SACVC,UAAW,UACXC,UAAW,QACXC,MAAO,QACPC,QAAS,MACTC,SAAU,OACVC,WAAY,SACZC,UAAW,IACXC,OAAQ,SL0F2rDX,IKzJnsDA,GA0CGrB,eAAiB,SAAA5B,GACtB,GAAI6D,GAAmB7D,EAAO8D,SAAS,MAAmB,SAAX9D,EAAqB,cAAgB,cAChF+D,EAAsB/D,EAAOgE,QAAQ,IAAK,IAAIA,QAAQ,IAAK,GAM/D,aAAaH,GAHS,gBAApBA,EACEZ,EAAUgB,gBAAgBF,GAD5B,cACiEA,IAhDjEd,EAmEGnB,qBAAuB,SAAC9B,EAAQ+B,GAErC,MADAA,GAAUA,GAAWkB,EAAUiB,mBACxBnC,EAAQ/B,IAAWA,GArExBiD,EAwEG5C,gBAAkB,SAACL,EAAQR,EAAOJ,GACvC,GAAI+D,GAAS3D,EACTW,EAAiBf,EAAQe,cAa7B,OAXc,WAAXH,GAAuBmD,EAAOjE,OAAS,EACxCiE,EAASA,EAAOgB,MAAM,GAAI,GACT,YAAXnE,EACNmD,GAAkB,IACD,UAAXnD,EACNmD,GAAkB,KACD,YAAXnD,GAAwBG,EAC9BgD,GAAkB,KACXnD,EAAO8D,SAAS,MAAS9D,EAAO8D,SAAS,OAChDX,GAAkBnD,GAEbmD,GAIXpF,EAAA","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\nmodule.exports = __webpack_require__(1);\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__components_Keyboard__ = __webpack_require__(2);\n/* harmony default export */ __webpack_exports__[\"default\"] = (__WEBPACK_IMPORTED_MODULE_0__components_Keyboard__[\"a\" /* default */]);\n\n/***/ }),\n/* 2 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Keyboard_css__ = __webpack_require__(3);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Keyboard_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__Keyboard_css__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_KeyboardLayout__ = __webpack_require__(4);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__services_Utilities__ = __webpack_require__(5);\nvar _typeof=typeof Symbol===\"function\"&&typeof Symbol.iterator===\"symbol\"?function(obj){return typeof obj;}:function(obj){return obj&&typeof Symbol===\"function\"&&obj.constructor===Symbol&&obj!==Symbol.prototype?\"symbol\":typeof obj;};function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError(\"Cannot call a class as a function\");}}// Services\nvar SimpleKeyboard=function SimpleKeyboard(){_classCallCheck(this,SimpleKeyboard);_initialiseProps.call(this);var keyboardDOMQuery=typeof(arguments.length<=0?undefined:arguments[0])===\"string\"?arguments.length<=0?undefined:arguments[0]:'.simple-keyboard';var options=_typeof(arguments.length<=0?undefined:arguments[0])===\"object\"?arguments.length<=0?undefined:arguments[0]:arguments.length<=1?undefined:arguments[1];if(!options)options={};/**\r\n * Processing options\r\n */this.keyboardDOM=document.querySelector(keyboardDOMQuery);this.options=options;this.input='';this.options.layoutName=this.options.layoutName||\"default\";this.options.theme=this.options.theme||\"hg-theme-default\";/**\r\n * Rendering keyboard\r\n */if(this.keyboardDOM)this.render();else console.error('\"'+keyboardDOMQuery+'\" was not found in the DOM.');};var _initialiseProps=function _initialiseProps(){var _this=this;this.handleButtonClicked=function(button){var debug=_this.options.debug;/**\r\n * Ignoring placeholder buttons\r\n */if(button==='{//}')return false;/**\r\n * Calling onKeyPress\r\n */if(typeof _this.options.onKeyPress===\"function\")_this.options.onKeyPress(button);/**\r\n * Updating input\r\n */var options={newLineOnEnter:_this.options.newLineOnEnter===true};var updatedInput=__WEBPACK_IMPORTED_MODULE_2__services_Utilities__[\"a\" /* default */].getUpdatedInput(button,_this.input,options);if(_this.input!==updatedInput){_this.input=updatedInput;if(debug)console.log('Input changed:',_this.input);/**\r\n * Calling onChange\r\n */if(typeof _this.options.onChange===\"function\")_this.options.onChange(_this.input);}if(debug){console.log(\"Key pressed:\",button);}};this.clearInput=function(){_this.input='';};this.getInput=function(){return _this.input;};this.setInput=function(input){_this.input=input;};this.setOptions=function(option){option=option||{};_this.options=Object.assign(_this.options,option);_this.render();};this.clear=function(){_this.keyboardDOM.innerHTML='';};this.render=function(){/**\r\n * Clear keyboard\r\n */_this.clear();var layoutClass=_this.options.layout?\"hg-layout-custom\":'hg-layout-'+_this.options.layoutName;var layout=_this.options.layout||__WEBPACK_IMPORTED_MODULE_1__services_KeyboardLayout__[\"a\" /* default */].getLayout(_this.options.layoutName);/**\r\n * Adding themeClass, layoutClass to keyboardDOM\r\n */_this.keyboardDOM.className+=' '+_this.options.theme+' '+layoutClass;/**\r\n * Iterating through each row\r\n */layout[_this.options.layoutName].forEach(function(row,index){var rowArray=row.split(' ');/**\r\n * Creating empty row\r\n */var rowDOM=document.createElement('div');rowDOM.className+=\"hg-row\";/**\r\n * Iterating through each button in row\r\n */rowArray.forEach(function(button,index){var fctBtnClass=__WEBPACK_IMPORTED_MODULE_2__services_Utilities__[\"a\" /* default */].getButtonClass(button);var buttonDisplayName=__WEBPACK_IMPORTED_MODULE_2__services_Utilities__[\"a\" /* default */].getButtonDisplayName(button,_this.options.display);/**\r\n * Creating button\r\n */var buttonDOM=document.createElement('div');buttonDOM.className+='hg-button '+fctBtnClass;buttonDOM.onclick=function(){return _this.handleButtonClicked(button);};/**\r\n * Adding button label to button\r\n */var buttonSpanDOM=document.createElement('span');buttonSpanDOM.innerHTML=buttonDisplayName;buttonDOM.appendChild(buttonSpanDOM);/**\r\n * Appending button to row\r\n */rowDOM.appendChild(buttonDOM);/**\r\n * Calling onInit\r\n */if(typeof _this.options.onInit===\"function\")_this.options.onInit();});/**\r\n * Appending row to keyboard\r\n */_this.keyboardDOM.appendChild(rowDOM);});};};/* harmony default export */ __webpack_exports__[\"a\"] = (SimpleKeyboard);\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\n// removed by extract-text-webpack-plugin\n\n/***/ }),\n/* 4 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nfunction _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError(\"Cannot call a class as a function\");}}var KeyboardLayout=function KeyboardLayout(){_classCallCheck(this,KeyboardLayout);};KeyboardLayout.getLayout=function(layout){if(layout===\"qwerty\"){return{'default':['` 1 2 3 4 5 6 7 8 9 0 - = {bksp}','{tab} q w e r t y u i o p [ ] \\\\','{lock} a s d f g h j k l ; \\' {enter}','{shift} z x c v b n m , . / {shift}','.com @ {space}'],'shift':['~ ! @ # $ % ^ & * ( ) _ + {bksp}','{tab} Q W E R T Y U I O P { } |','{lock} A S D F G H J K L : \" {enter}','{shift} Z X C V B N M < > ? {shift}','.com @ {space}']};}else if(layout===\"numeric\"){return{'default':['1 2 3','4 5 6','7 8 9','{//} 0 {bksp}']};}else{return KeyboardLayout.getLayout(\"qwerty\");}};/* harmony default export */ __webpack_exports__[\"a\"] = (KeyboardLayout);\n\n/***/ }),\n/* 5 */\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nvar _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if(\"value\"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError(\"Cannot call a class as a function\");}}var Utilities=function(){function Utilities(){_classCallCheck(this,Utilities);}_createClass(Utilities,null,[{key:\"normalizeString\",value:function normalizeString(string){var output=void 0;if(string===\"@\")output='at';else if(string===\",\")output='comma';else if(string===\".\")output='dot';else if(string===\"\\\\\")output='backslash';else if(string===\"/\")output='fordardslash';else if(string===\"*\")output='asterisk';else if(string===\"&\")output='ampersand';else if(string===\"$\")output='dollarsign';else if(string===\"=\")output='equals';else if(string===\"+\")output='plus';else if(string===\"-\")output='minus';else if(string===\"'\")output='apostrophe';else if(string===\";\")output='colon';else if(string===\"[\")output='openbracket';else if(string===\"]\")output='closebracket';else if(string===\"//\")output='emptybutton';else output='';return output?\" hg-button-\"+output:'';}},{key:\"getDefaultDiplay\",value:function getDefaultDiplay(){return{'{bksp}':'delete','{enter}':'< enter','{shift}':'shift','{s}':'shift','{tab}':'tab','{lock}':'caps','{accept}':'Submit','{space}':' ','{//}':' '};}}]);return Utilities;}();Utilities.getButtonClass=function(button){var buttonTypeClass=button.includes(\"{\")&&button!=='{//}'?\"functionBtn\":\"standardBtn\";var buttonWithoutBraces=button.replace(\"{\",\"\").replace(\"}\",\"\");var buttonNormalized=buttonTypeClass===\"standardBtn\"?Utilities.normalizeString(buttonWithoutBraces):\" hg-button-\"+buttonWithoutBraces;return\"hg-\"+buttonTypeClass+buttonNormalized;};Utilities.getButtonDisplayName=function(button,display){display=display||Utilities.getDefaultDiplay();return display[button]||button;};Utilities.getUpdatedInput=function(button,input,options){var output=input;var newLineOnEnter=options.newLineOnEnter;if(button===\"{bksp}\"&&output.length>0)output=output.slice(0,-1);else if(button===\"{space}\")output=output+' ';else if(button===\"{tab}\")output=output+\"\\t\";else if(button===\"{enter}\"&&newLineOnEnter)output=output+\"\\n\";else if(!button.includes(\"{\")&&!button.includes(\"{\"))output=output+button;return output;};/* harmony default export */ __webpack_exports__[\"a\"] = (Utilities);\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// index.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 146ec2062f33f8b07c37","import SimpleKeyboard from './components/Keyboard';\r\nexport default SimpleKeyboard;\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/index.js","import './Keyboard.css';\r\n\r\n// Services\r\nimport KeyboardLayout from '../services/KeyboardLayout';\r\nimport Utilities from '../services/Utilities';\r\n\r\nclass SimpleKeyboard {\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 * Processing options\r\n */\r\n this.keyboardDOM = document.querySelector(keyboardDOMQuery);\r\n this.options = options;\r\n this.input = '';\r\n this.options.layoutName = this.options.layoutName || \"default\";\r\n this.options.theme = this.options.theme || \"hg-theme-default\";\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.error(`\"${keyboardDOMQuery}\" was not found in the DOM.`);\r\n }\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 /**\r\n * Updating input\r\n */\r\n let options = {\r\n newLineOnEnter: (this.options.newLineOnEnter === true)\r\n }\r\n \r\n let updatedInput = Utilities.getUpdatedInput(button, this.input, options);\r\n\r\n if(this.input !== updatedInput){\r\n this.input = updatedInput;\r\n\r\n if(debug)\r\n console.log('Input changed:', 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);\r\n }\r\n \r\n if(debug){\r\n console.log(\"Key pressed:\", button);\r\n }\r\n }\r\n\r\n clearInput = () => {\r\n this.input = '';\r\n }\r\n\r\n getInput = () => {\r\n return this.input;\r\n }\r\n\r\n setInput = input => {\r\n this.input = input;\r\n }\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 clear = () => {\r\n this.keyboardDOM.innerHTML = '';\r\n }\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.getLayout(this.options.layoutName);\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, index) => {\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, index) => {\r\n let fctBtnClass = Utilities.getButtonClass(button);\r\n let buttonDisplayName = Utilities.getButtonDisplayName(button, this.options.display);\r\n\r\n /**\r\n * Creating button\r\n */\r\n var buttonDOM = document.createElement('div');\r\n buttonDOM.className += `hg-button ${fctBtnClass}`;\r\n buttonDOM.onclick = () => this.handleButtonClicked(button);\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 * Appending button to row\r\n */\r\n rowDOM.appendChild(buttonDOM);\r\n\r\n /**\r\n * Calling onInit\r\n */\r\n if(typeof this.options.onInit === \"function\")\r\n this.options.onInit();\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\r\nexport default SimpleKeyboard;\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/lib/components/Keyboard.js","class KeyboardLayout {\r\n\r\n static getLayout = layout => {\r\n if(layout === \"qwerty\"){\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 } else if(layout === \"numeric\"){\r\n return {\r\n 'default': [\r\n '1 2 3',\r\n '4 5 6',\r\n '7 8 9',\r\n '{//} 0 {bksp}'\r\n ]\r\n };\r\n } else {\r\n return KeyboardLayout.getLayout(\"qwerty\");\r\n }\r\n }\r\n\r\n}\r\n\r\nexport default KeyboardLayout;\n\n\n// WEBPACK FOOTER //\n// ./src/lib/services/KeyboardLayout.js","class Utilities {\r\n static normalizeString(string){\r\n let output;\r\n\r\n if(string === \"@\")\r\n output = 'at';\r\n else if(string === \",\")\r\n output = 'comma';\r\n else if(string === \".\")\r\n output = 'dot';\r\n else if(string === \"\\\\\")\r\n output = 'backslash';\r\n else if(string === \"/\")\r\n output = 'fordardslash';\r\n else if(string === \"*\")\r\n output = 'asterisk';\r\n else if(string === \"&\")\r\n output = 'ampersand';\r\n else if(string === \"$\")\r\n output = 'dollarsign';\r\n else if(string === \"=\")\r\n output = 'equals';\r\n else if(string === \"+\")\r\n output = 'plus';\r\n else if(string === \"-\")\r\n output = 'minus';\r\n else if(string === \"'\")\r\n output = 'apostrophe';\r\n else if(string === \";\")\r\n output = 'colon';\r\n else if(string === \"[\")\r\n output = 'openbracket';\r\n else if(string === \"]\")\r\n output = 'closebracket';\r\n else if(string === \"//\")\r\n output = 'emptybutton';\r\n else\r\n output = '';\r\n\r\n return output ? ` hg-button-${output}` : '';\r\n }\r\n\r\n static getButtonClass = button => {\r\n let buttonTypeClass = (button.includes(\"{\") && button !== '{//}') ? \"functionBtn\" : \"standardBtn\";\r\n let buttonWithoutBraces = button.replace(\"{\", \"\").replace(\"}\", \"\");\r\n\r\n let buttonNormalized =\r\n buttonTypeClass === \"standardBtn\" ?\r\n Utilities.normalizeString(buttonWithoutBraces) : ` hg-button-${buttonWithoutBraces}`;\r\n\r\n return `hg-${buttonTypeClass}${buttonNormalized}`;\r\n }\r\n\r\n static getDefaultDiplay(){\r\n return {\r\n '{bksp}': 'delete',\r\n '{enter}': '< enter',\r\n '{shift}': 'shift',\r\n '{s}': 'shift',\r\n '{tab}': 'tab',\r\n '{lock}': 'caps',\r\n '{accept}': 'Submit',\r\n '{space}': ' ',\r\n '{//}': ' '\r\n };\r\n }\r\n\r\n static getButtonDisplayName = (button, display) => {\r\n display = display || Utilities.getDefaultDiplay();\r\n return display[button] || button;\r\n }\r\n\r\n static getUpdatedInput = (button, input, options) => {\r\n let output = input;\r\n let newLineOnEnter = options.newLineOnEnter;\r\n\r\n if(button === \"{bksp}\" && output.length > 0)\r\n output = output.slice(0, -1);\r\n else if(button === \"{space}\")\r\n output = output + ' ';\r\n else if(button === \"{tab}\")\r\n output = output + \"\\t\";\r\n else if(button === \"{enter}\" && newLineOnEnter)\r\n output = output + \"\\n\";\r\n else if(!button.includes(\"{\") && !button.includes(\"{\"))\r\n output = output + button;\r\n\r\n return output;\r\n }\r\n}\r\n\r\nexport default Utilities;\n\n\n// WEBPACK FOOTER //\n// ./src/lib/services/Utilities.js"],"sourceRoot":""}