├── .DS_Store ├── .gitignore ├── ChartBlock_Example_Data.csv ├── README.md ├── build ├── frontendscript.js ├── frontendscript.js.map ├── index.asset.php ├── index.js └── index.js.map ├── chartjs └── chart.min.js ├── charts-block.php ├── index.php ├── package-lock.json ├── package.json ├── readme.txt ├── screenshot-1.gif ├── screenshot-2.gif ├── screenshot-4.gif ├── src ├── .DS_Store ├── blocks │ ├── .DS_Store │ ├── Inspector.js │ ├── bar │ │ ├── block.json │ │ └── index.js │ ├── doughnut │ │ ├── block.json │ │ └── index.js │ ├── edit.js │ ├── frontend.js │ ├── horizontal-bar │ │ ├── block.json │ │ └── index.js │ ├── horizontal-line │ │ ├── block.json │ │ └── index.js │ ├── line │ │ ├── block.json │ │ └── index.js │ └── pie │ │ ├── block.json │ │ └── index.js └── index.js └── webpack.config.js /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thisissandip/charts-block/64911fec088c7dd3b7eed86ecb209f093440c367/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /ChartBlock_Example_Data.csv: -------------------------------------------------------------------------------- 1 | Label,Data 2 | Chinese,80 3 | Spanish,60 4 | English,65 5 | Hindi,70 6 | German,40 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Charts Blocks for Gutenberg 2 | 3 | Charts Blocks for Gutenberg is a WordPress plugin for creating responsive, interactive and animated charts in just two simple clicks.\ 4 | Select a Chart Block, Upload your CSV file and DONE. It's that easy! 5 | 6 | ### [Download Plugin](https://wordpress.org/plugins/charts-blocks/) 7 | 8 | Bar Chart Example:\ 9 | \ 10 | ![Bar Chart Block](screenshot-2.gif) 11 | 12 | Pie Chart Example:\ 13 | \ 14 | ![Pie Chart Block](screenshot-1.gif) 15 | 16 | ### 🧰  Built with 17 | 18 | - React 19 | - ChartJS 20 | - PHP 21 | - WordPress 22 | 23 | ### 👨‍💻  How to use 24 | 25 | Select a Chart Block from the availabe chart types. Currently there are 6 different Chart Blocks: 26 | 27 | 1. Bar Chart Block 28 | 2. Line Chart Block 29 | 3. Pie Chart Block 30 | 4. Doughnut Chart Block 31 | 5. Horizontal Bar Chart Block 32 | 6. Horizontal Line Chart Block 33 | 34 | Upload your CSV file and TADAA! 35 | 36 | Your Beautiful, Animated and Responsive chart is ready for the world! 37 | 38 | ### 🤝 Contributing 39 | 40 | 1. Fork it 41 | 2. Create your feature branch (`git checkout -b feature/fooBar`) 42 | 3. Commit your changes (`git commit -am 'Add some fooBar'`) 43 | 4. Push to the branch (`git push origin feature/fooBar`) 44 | 5. Create a new Pull Request 45 | -------------------------------------------------------------------------------- /build/frontendscript.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 40 | /******/ } 41 | /******/ }; 42 | /******/ 43 | /******/ // define __esModule on exports 44 | /******/ __webpack_require__.r = function(exports) { 45 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 46 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 47 | /******/ } 48 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 49 | /******/ }; 50 | /******/ 51 | /******/ // create a fake namespace object 52 | /******/ // mode & 1: value is a module id, require it 53 | /******/ // mode & 2: merge all properties of value into the ns 54 | /******/ // mode & 4: return value when already ns object 55 | /******/ // mode & 8|1: behave like require 56 | /******/ __webpack_require__.t = function(value, mode) { 57 | /******/ if(mode & 1) value = __webpack_require__(value); 58 | /******/ if(mode & 8) return value; 59 | /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 60 | /******/ var ns = Object.create(null); 61 | /******/ __webpack_require__.r(ns); 62 | /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 63 | /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 64 | /******/ return ns; 65 | /******/ }; 66 | /******/ 67 | /******/ // getDefaultExport function for compatibility with non-harmony modules 68 | /******/ __webpack_require__.n = function(module) { 69 | /******/ var getter = module && module.__esModule ? 70 | /******/ function getDefault() { return module['default']; } : 71 | /******/ function getModuleExports() { return module; }; 72 | /******/ __webpack_require__.d(getter, 'a', getter); 73 | /******/ return getter; 74 | /******/ }; 75 | /******/ 76 | /******/ // Object.prototype.hasOwnProperty.call 77 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 78 | /******/ 79 | /******/ // __webpack_public_path__ 80 | /******/ __webpack_require__.p = ""; 81 | /******/ 82 | /******/ 83 | /******/ // Load entry module and return exports 84 | /******/ return __webpack_require__(__webpack_require__.s = "./src/blocks/frontend.js"); 85 | /******/ }) 86 | /************************************************************************/ 87 | /******/ ({ 88 | 89 | /***/ "./src/blocks/frontend.js": 90 | /*!********************************!*\ 91 | !*** ./src/blocks/frontend.js ***! 92 | \********************************/ 93 | /*! no static exports found */ 94 | /***/ (function(module, exports) { 95 | 96 | function displayAllCharts() { 97 | allchartsdata.forEach(chart => { 98 | let chartctx = document.querySelector(`#${chart.chartID}`); 99 | let labels = chart.labels ? chart.labels : ['English', 'Spanish', 'French']; 100 | let data = chart.chartdata ? chart.chartdata : [300, 50, 100]; 101 | let bgColors = chart.chartBgColor ? chart.chartBgColor : ['#ff6385', '#36a3eb', '#ffcc56', '#812ffe', '#00e893']; 102 | let title = chart.title ? chart.title : 'Mostly spoken languages across the world'; 103 | let currentChartType = chart.chartType; 104 | let indexAxis = null; 105 | let chartTypeArray = chart.chartType.split(''); 106 | 107 | if (chartTypeArray.length > 9) { 108 | let currentChartTypeArray = chartTypeArray.slice(11); 109 | currentChartType = currentChartTypeArray.join(''); 110 | indexAxis = 'y'; 111 | } 112 | 113 | if (chartctx) { 114 | var myChart = new Chart(chartctx, { 115 | type: currentChartType, 116 | data: { 117 | labels: labels, 118 | datasets: [{ 119 | data: data, 120 | backgroundColor: bgColors, 121 | hoverOffset: 2 122 | }] 123 | }, 124 | options: { 125 | indexAxis: indexAxis, 126 | responsive: true, 127 | plugins: { 128 | title: { 129 | display: true, 130 | text: title 131 | }, 132 | legend: { 133 | display: currentChartType === 'bar' || currentChartType === 'line' ? false : true 134 | } 135 | } 136 | } 137 | }); 138 | } 139 | }); 140 | } 141 | 142 | if (allchartsdata.length > 0) { 143 | displayAllCharts(); 144 | } 145 | 146 | /***/ }) 147 | 148 | /******/ }); 149 | //# sourceMappingURL=frontendscript.js.map -------------------------------------------------------------------------------- /build/frontendscript.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/blocks/frontend.js"],"names":["displayAllCharts","allchartsdata","forEach","chart","chartctx","document","querySelector","chartID","labels","data","chartdata","bgColors","chartBgColor","title","currentChartType","chartType","indexAxis","chartTypeArray","split","length","currentChartTypeArray","slice","join","myChart","Chart","type","datasets","backgroundColor","hoverOffset","options","responsive","plugins","display","text","legend"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;AClFA,SAASA,gBAAT,GAA4B;AAC3BC,eAAa,CAACC,OAAd,CAAuBC,KAAD,IAAW;AAChC,QAAIC,QAAQ,GAAGC,QAAQ,CAACC,aAAT,CAAwB,IAAGH,KAAK,CAACI,OAAQ,EAAzC,CAAf;AAEA,QAAIC,MAAM,GAAGL,KAAK,CAACK,MAAN,GAAeL,KAAK,CAACK,MAArB,GAA8B,CAAC,SAAD,EAAY,SAAZ,EAAuB,QAAvB,CAA3C;AACA,QAAIC,IAAI,GAAGN,KAAK,CAACO,SAAN,GAAkBP,KAAK,CAACO,SAAxB,GAAoC,CAAC,GAAD,EAAM,EAAN,EAAU,GAAV,CAA/C;AACA,QAAIC,QAAQ,GAAGR,KAAK,CAACS,YAAN,GACZT,KAAK,CAACS,YADM,GAEZ,CAAC,SAAD,EAAY,SAAZ,EAAuB,SAAvB,EAAkC,SAAlC,EAA6C,SAA7C,CAFH;AAGA,QAAIC,KAAK,GAAGV,KAAK,CAACU,KAAN,GACTV,KAAK,CAACU,KADG,GAET,0CAFH;AAIA,QAAIC,gBAAgB,GAAGX,KAAK,CAACY,SAA7B;AACA,QAAIC,SAAS,GAAG,IAAhB;AAEA,QAAIC,cAAc,GAAGd,KAAK,CAACY,SAAN,CAAgBG,KAAhB,CAAsB,EAAtB,CAArB;;AACA,QAAID,cAAc,CAACE,MAAf,GAAwB,CAA5B,EAA+B;AAC9B,UAAIC,qBAAqB,GAAGH,cAAc,CAACI,KAAf,CAAqB,EAArB,CAA5B;AACAP,sBAAgB,GAAGM,qBAAqB,CAACE,IAAtB,CAA2B,EAA3B,CAAnB;AACAN,eAAS,GAAG,GAAZ;AACA;;AAED,QAAIZ,QAAJ,EAAc;AACb,UAAImB,OAAO,GAAG,IAAIC,KAAJ,CAAUpB,QAAV,EAAoB;AACjCqB,YAAI,EAAEX,gBAD2B;AAEjCL,YAAI,EAAE;AACLD,gBAAM,EAAEA,MADH;AAELkB,kBAAQ,EAAE,CACT;AACCjB,gBAAI,EAAEA,IADP;AAECkB,2BAAe,EAAEhB,QAFlB;AAGCiB,uBAAW,EAAE;AAHd,WADS;AAFL,SAF2B;AAYjCC,eAAO,EAAE;AACRb,mBAAS,EAAEA,SADH;AAERc,oBAAU,EAAE,IAFJ;AAGRC,iBAAO,EAAE;AACRlB,iBAAK,EAAE;AACNmB,qBAAO,EAAE,IADH;AAENC,kBAAI,EAAEpB;AAFA,aADC;AAKRqB,kBAAM,EAAE;AACPF,qBAAO,EACNlB,gBAAgB,KAAK,KAArB,IAA8BA,gBAAgB,KAAK,MAAnD,GACG,KADH,GAEG;AAJG;AALA;AAHD;AAZwB,OAApB,CAAd;AA6BA;AACD,GArDD;AAsDA;;AACD,IAAIb,aAAa,CAACkB,MAAd,GAAuB,CAA3B,EAA8B;AAC7BnB,kBAAgB;AAChB,C","file":"frontendscript.js","sourcesContent":[" \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, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/blocks/frontend.js\");\n","function displayAllCharts() {\n\tallchartsdata.forEach((chart) => {\n\t\tlet chartctx = document.querySelector(`#${chart.chartID}`);\n\n\t\tlet labels = chart.labels ? chart.labels : ['English', 'Spanish', 'French'];\n\t\tlet data = chart.chartdata ? chart.chartdata : [300, 50, 100];\n\t\tlet bgColors = chart.chartBgColor\n\t\t\t? chart.chartBgColor\n\t\t\t: ['#ff6385', '#36a3eb', '#ffcc56', '#812ffe', '#00e893'];\n\t\tlet title = chart.title\n\t\t\t? chart.title\n\t\t\t: 'Mostly spoken languages across the world';\n\n\t\tlet currentChartType = chart.chartType;\n\t\tlet indexAxis = null;\n\n\t\tlet chartTypeArray = chart.chartType.split('');\n\t\tif (chartTypeArray.length > 9) {\n\t\t\tlet currentChartTypeArray = chartTypeArray.slice(11);\n\t\t\tcurrentChartType = currentChartTypeArray.join('');\n\t\t\tindexAxis = 'y';\n\t\t}\n\n\t\tif (chartctx) {\n\t\t\tvar myChart = new Chart(chartctx, {\n\t\t\t\ttype: currentChartType,\n\t\t\t\tdata: {\n\t\t\t\t\tlabels: labels,\n\t\t\t\t\tdatasets: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdata: data,\n\t\t\t\t\t\t\tbackgroundColor: bgColors,\n\t\t\t\t\t\t\thoverOffset: 2,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\toptions: {\n\t\t\t\t\tindexAxis: indexAxis,\n\t\t\t\t\tresponsive: true,\n\t\t\t\t\tplugins: {\n\t\t\t\t\t\ttitle: {\n\t\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\t\ttext: title,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlegend: {\n\t\t\t\t\t\t\tdisplay:\n\t\t\t\t\t\t\t\tcurrentChartType === 'bar' || currentChartType === 'line'\n\t\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t\t: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t});\n}\nif (allchartsdata.length > 0) {\n\tdisplayAllCharts();\n}\n"],"sourceRoot":""} -------------------------------------------------------------------------------- /build/index.asset.php: -------------------------------------------------------------------------------- 1 | array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'aaa6e5937825abef98598d8b1dd750a5'); -------------------------------------------------------------------------------- /build/index.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) { 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ } 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ i: moduleId, 15 | /******/ l: false, 16 | /******/ exports: {} 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.l = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // define getter function for harmony exports 37 | /******/ __webpack_require__.d = function(exports, name, getter) { 38 | /******/ if(!__webpack_require__.o(exports, name)) { 39 | /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 40 | /******/ } 41 | /******/ }; 42 | /******/ 43 | /******/ // define __esModule on exports 44 | /******/ __webpack_require__.r = function(exports) { 45 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 46 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 47 | /******/ } 48 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); 49 | /******/ }; 50 | /******/ 51 | /******/ // create a fake namespace object 52 | /******/ // mode & 1: value is a module id, require it 53 | /******/ // mode & 2: merge all properties of value into the ns 54 | /******/ // mode & 4: return value when already ns object 55 | /******/ // mode & 8|1: behave like require 56 | /******/ __webpack_require__.t = function(value, mode) { 57 | /******/ if(mode & 1) value = __webpack_require__(value); 58 | /******/ if(mode & 8) return value; 59 | /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 60 | /******/ var ns = Object.create(null); 61 | /******/ __webpack_require__.r(ns); 62 | /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 63 | /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 64 | /******/ return ns; 65 | /******/ }; 66 | /******/ 67 | /******/ // getDefaultExport function for compatibility with non-harmony modules 68 | /******/ __webpack_require__.n = function(module) { 69 | /******/ var getter = module && module.__esModule ? 70 | /******/ function getDefault() { return module['default']; } : 71 | /******/ function getModuleExports() { return module; }; 72 | /******/ __webpack_require__.d(getter, 'a', getter); 73 | /******/ return getter; 74 | /******/ }; 75 | /******/ 76 | /******/ // Object.prototype.hasOwnProperty.call 77 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 78 | /******/ 79 | /******/ // __webpack_public_path__ 80 | /******/ __webpack_require__.p = ""; 81 | /******/ 82 | /******/ 83 | /******/ // Load entry module and return exports 84 | /******/ return __webpack_require__(__webpack_require__.s = "./src/index.js"); 85 | /******/ }) 86 | /************************************************************************/ 87 | /******/ ({ 88 | 89 | /***/ "./node_modules/uuid/dist/esm-browser/index.js": 90 | /*!*****************************************************!*\ 91 | !*** ./node_modules/uuid/dist/esm-browser/index.js ***! 92 | \*****************************************************/ 93 | /*! exports provided: v1, v3, v4, v5, NIL, version, validate, stringify, parse */ 94 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 95 | 96 | "use strict"; 97 | __webpack_require__.r(__webpack_exports__); 98 | /* harmony import */ var _v1_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./v1.js */ "./node_modules/uuid/dist/esm-browser/v1.js"); 99 | /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "v1", function() { return _v1_js__WEBPACK_IMPORTED_MODULE_0__["default"]; }); 100 | 101 | /* harmony import */ var _v3_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./v3.js */ "./node_modules/uuid/dist/esm-browser/v3.js"); 102 | /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "v3", function() { return _v3_js__WEBPACK_IMPORTED_MODULE_1__["default"]; }); 103 | 104 | /* harmony import */ var _v4_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./v4.js */ "./node_modules/uuid/dist/esm-browser/v4.js"); 105 | /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "v4", function() { return _v4_js__WEBPACK_IMPORTED_MODULE_2__["default"]; }); 106 | 107 | /* harmony import */ var _v5_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./v5.js */ "./node_modules/uuid/dist/esm-browser/v5.js"); 108 | /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "v5", function() { return _v5_js__WEBPACK_IMPORTED_MODULE_3__["default"]; }); 109 | 110 | /* harmony import */ var _nil_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./nil.js */ "./node_modules/uuid/dist/esm-browser/nil.js"); 111 | /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NIL", function() { return _nil_js__WEBPACK_IMPORTED_MODULE_4__["default"]; }); 112 | 113 | /* harmony import */ var _version_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./version.js */ "./node_modules/uuid/dist/esm-browser/version.js"); 114 | /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "version", function() { return _version_js__WEBPACK_IMPORTED_MODULE_5__["default"]; }); 115 | 116 | /* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/esm-browser/validate.js"); 117 | /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "validate", function() { return _validate_js__WEBPACK_IMPORTED_MODULE_6__["default"]; }); 118 | 119 | /* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/esm-browser/stringify.js"); 120 | /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "stringify", function() { return _stringify_js__WEBPACK_IMPORTED_MODULE_7__["default"]; }); 121 | 122 | /* harmony import */ var _parse_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./parse.js */ "./node_modules/uuid/dist/esm-browser/parse.js"); 123 | /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parse", function() { return _parse_js__WEBPACK_IMPORTED_MODULE_8__["default"]; }); 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | /***/ }), 136 | 137 | /***/ "./node_modules/uuid/dist/esm-browser/md5.js": 138 | /*!***************************************************!*\ 139 | !*** ./node_modules/uuid/dist/esm-browser/md5.js ***! 140 | \***************************************************/ 141 | /*! exports provided: default */ 142 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 143 | 144 | "use strict"; 145 | __webpack_require__.r(__webpack_exports__); 146 | /* 147 | * Browser-compatible JavaScript MD5 148 | * 149 | * Modification of JavaScript MD5 150 | * https://github.com/blueimp/JavaScript-MD5 151 | * 152 | * Copyright 2011, Sebastian Tschan 153 | * https://blueimp.net 154 | * 155 | * Licensed under the MIT license: 156 | * https://opensource.org/licenses/MIT 157 | * 158 | * Based on 159 | * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message 160 | * Digest Algorithm, as defined in RFC 1321. 161 | * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 162 | * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet 163 | * Distributed under the BSD License 164 | * See http://pajhome.org.uk/crypt/md5 for more info. 165 | */ 166 | function md5(bytes) { 167 | if (typeof bytes === 'string') { 168 | var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape 169 | 170 | bytes = new Uint8Array(msg.length); 171 | 172 | for (var i = 0; i < msg.length; ++i) { 173 | bytes[i] = msg.charCodeAt(i); 174 | } 175 | } 176 | 177 | return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8)); 178 | } 179 | /* 180 | * Convert an array of little-endian words to an array of bytes 181 | */ 182 | 183 | 184 | function md5ToHexEncodedArray(input) { 185 | var output = []; 186 | var length32 = input.length * 32; 187 | var hexTab = '0123456789abcdef'; 188 | 189 | for (var i = 0; i < length32; i += 8) { 190 | var x = input[i >> 5] >>> i % 32 & 0xff; 191 | var hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16); 192 | output.push(hex); 193 | } 194 | 195 | return output; 196 | } 197 | /** 198 | * Calculate output length with padding and bit length 199 | */ 200 | 201 | 202 | function getOutputLength(inputLength8) { 203 | return (inputLength8 + 64 >>> 9 << 4) + 14 + 1; 204 | } 205 | /* 206 | * Calculate the MD5 of an array of little-endian words, and a bit length. 207 | */ 208 | 209 | 210 | function wordsToMd5(x, len) { 211 | /* append padding */ 212 | x[len >> 5] |= 0x80 << len % 32; 213 | x[getOutputLength(len) - 1] = len; 214 | var a = 1732584193; 215 | var b = -271733879; 216 | var c = -1732584194; 217 | var d = 271733878; 218 | 219 | for (var i = 0; i < x.length; i += 16) { 220 | var olda = a; 221 | var oldb = b; 222 | var oldc = c; 223 | var oldd = d; 224 | a = md5ff(a, b, c, d, x[i], 7, -680876936); 225 | d = md5ff(d, a, b, c, x[i + 1], 12, -389564586); 226 | c = md5ff(c, d, a, b, x[i + 2], 17, 606105819); 227 | b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330); 228 | a = md5ff(a, b, c, d, x[i + 4], 7, -176418897); 229 | d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426); 230 | c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341); 231 | b = md5ff(b, c, d, a, x[i + 7], 22, -45705983); 232 | a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416); 233 | d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417); 234 | c = md5ff(c, d, a, b, x[i + 10], 17, -42063); 235 | b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162); 236 | a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682); 237 | d = md5ff(d, a, b, c, x[i + 13], 12, -40341101); 238 | c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290); 239 | b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329); 240 | a = md5gg(a, b, c, d, x[i + 1], 5, -165796510); 241 | d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632); 242 | c = md5gg(c, d, a, b, x[i + 11], 14, 643717713); 243 | b = md5gg(b, c, d, a, x[i], 20, -373897302); 244 | a = md5gg(a, b, c, d, x[i + 5], 5, -701558691); 245 | d = md5gg(d, a, b, c, x[i + 10], 9, 38016083); 246 | c = md5gg(c, d, a, b, x[i + 15], 14, -660478335); 247 | b = md5gg(b, c, d, a, x[i + 4], 20, -405537848); 248 | a = md5gg(a, b, c, d, x[i + 9], 5, 568446438); 249 | d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690); 250 | c = md5gg(c, d, a, b, x[i + 3], 14, -187363961); 251 | b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501); 252 | a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467); 253 | d = md5gg(d, a, b, c, x[i + 2], 9, -51403784); 254 | c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473); 255 | b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734); 256 | a = md5hh(a, b, c, d, x[i + 5], 4, -378558); 257 | d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463); 258 | c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562); 259 | b = md5hh(b, c, d, a, x[i + 14], 23, -35309556); 260 | a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060); 261 | d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353); 262 | c = md5hh(c, d, a, b, x[i + 7], 16, -155497632); 263 | b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640); 264 | a = md5hh(a, b, c, d, x[i + 13], 4, 681279174); 265 | d = md5hh(d, a, b, c, x[i], 11, -358537222); 266 | c = md5hh(c, d, a, b, x[i + 3], 16, -722521979); 267 | b = md5hh(b, c, d, a, x[i + 6], 23, 76029189); 268 | a = md5hh(a, b, c, d, x[i + 9], 4, -640364487); 269 | d = md5hh(d, a, b, c, x[i + 12], 11, -421815835); 270 | c = md5hh(c, d, a, b, x[i + 15], 16, 530742520); 271 | b = md5hh(b, c, d, a, x[i + 2], 23, -995338651); 272 | a = md5ii(a, b, c, d, x[i], 6, -198630844); 273 | d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415); 274 | c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905); 275 | b = md5ii(b, c, d, a, x[i + 5], 21, -57434055); 276 | a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571); 277 | d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606); 278 | c = md5ii(c, d, a, b, x[i + 10], 15, -1051523); 279 | b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799); 280 | a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359); 281 | d = md5ii(d, a, b, c, x[i + 15], 10, -30611744); 282 | c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380); 283 | b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649); 284 | a = md5ii(a, b, c, d, x[i + 4], 6, -145523070); 285 | d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379); 286 | c = md5ii(c, d, a, b, x[i + 2], 15, 718787259); 287 | b = md5ii(b, c, d, a, x[i + 9], 21, -343485551); 288 | a = safeAdd(a, olda); 289 | b = safeAdd(b, oldb); 290 | c = safeAdd(c, oldc); 291 | d = safeAdd(d, oldd); 292 | } 293 | 294 | return [a, b, c, d]; 295 | } 296 | /* 297 | * Convert an array bytes to an array of little-endian words 298 | * Characters >255 have their high-byte silently ignored. 299 | */ 300 | 301 | 302 | function bytesToWords(input) { 303 | if (input.length === 0) { 304 | return []; 305 | } 306 | 307 | var length8 = input.length * 8; 308 | var output = new Uint32Array(getOutputLength(length8)); 309 | 310 | for (var i = 0; i < length8; i += 8) { 311 | output[i >> 5] |= (input[i / 8] & 0xff) << i % 32; 312 | } 313 | 314 | return output; 315 | } 316 | /* 317 | * Add integers, wrapping at 2^32. This uses 16-bit operations internally 318 | * to work around bugs in some JS interpreters. 319 | */ 320 | 321 | 322 | function safeAdd(x, y) { 323 | var lsw = (x & 0xffff) + (y & 0xffff); 324 | var msw = (x >> 16) + (y >> 16) + (lsw >> 16); 325 | return msw << 16 | lsw & 0xffff; 326 | } 327 | /* 328 | * Bitwise rotate a 32-bit number to the left. 329 | */ 330 | 331 | 332 | function bitRotateLeft(num, cnt) { 333 | return num << cnt | num >>> 32 - cnt; 334 | } 335 | /* 336 | * These functions implement the four basic operations the algorithm uses. 337 | */ 338 | 339 | 340 | function md5cmn(q, a, b, x, s, t) { 341 | return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b); 342 | } 343 | 344 | function md5ff(a, b, c, d, x, s, t) { 345 | return md5cmn(b & c | ~b & d, a, b, x, s, t); 346 | } 347 | 348 | function md5gg(a, b, c, d, x, s, t) { 349 | return md5cmn(b & d | c & ~d, a, b, x, s, t); 350 | } 351 | 352 | function md5hh(a, b, c, d, x, s, t) { 353 | return md5cmn(b ^ c ^ d, a, b, x, s, t); 354 | } 355 | 356 | function md5ii(a, b, c, d, x, s, t) { 357 | return md5cmn(c ^ (b | ~d), a, b, x, s, t); 358 | } 359 | 360 | /* harmony default export */ __webpack_exports__["default"] = (md5); 361 | 362 | /***/ }), 363 | 364 | /***/ "./node_modules/uuid/dist/esm-browser/nil.js": 365 | /*!***************************************************!*\ 366 | !*** ./node_modules/uuid/dist/esm-browser/nil.js ***! 367 | \***************************************************/ 368 | /*! exports provided: default */ 369 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 370 | 371 | "use strict"; 372 | __webpack_require__.r(__webpack_exports__); 373 | /* harmony default export */ __webpack_exports__["default"] = ('00000000-0000-0000-0000-000000000000'); 374 | 375 | /***/ }), 376 | 377 | /***/ "./node_modules/uuid/dist/esm-browser/parse.js": 378 | /*!*****************************************************!*\ 379 | !*** ./node_modules/uuid/dist/esm-browser/parse.js ***! 380 | \*****************************************************/ 381 | /*! exports provided: default */ 382 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 383 | 384 | "use strict"; 385 | __webpack_require__.r(__webpack_exports__); 386 | /* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/esm-browser/validate.js"); 387 | 388 | 389 | function parse(uuid) { 390 | if (!Object(_validate_js__WEBPACK_IMPORTED_MODULE_0__["default"])(uuid)) { 391 | throw TypeError('Invalid UUID'); 392 | } 393 | 394 | var v; 395 | var arr = new Uint8Array(16); // Parse ########-....-....-....-............ 396 | 397 | arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; 398 | arr[1] = v >>> 16 & 0xff; 399 | arr[2] = v >>> 8 & 0xff; 400 | arr[3] = v & 0xff; // Parse ........-####-....-....-............ 401 | 402 | arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; 403 | arr[5] = v & 0xff; // Parse ........-....-####-....-............ 404 | 405 | arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; 406 | arr[7] = v & 0xff; // Parse ........-....-....-####-............ 407 | 408 | arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; 409 | arr[9] = v & 0xff; // Parse ........-....-....-....-############ 410 | // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) 411 | 412 | arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; 413 | arr[11] = v / 0x100000000 & 0xff; 414 | arr[12] = v >>> 24 & 0xff; 415 | arr[13] = v >>> 16 & 0xff; 416 | arr[14] = v >>> 8 & 0xff; 417 | arr[15] = v & 0xff; 418 | return arr; 419 | } 420 | 421 | /* harmony default export */ __webpack_exports__["default"] = (parse); 422 | 423 | /***/ }), 424 | 425 | /***/ "./node_modules/uuid/dist/esm-browser/regex.js": 426 | /*!*****************************************************!*\ 427 | !*** ./node_modules/uuid/dist/esm-browser/regex.js ***! 428 | \*****************************************************/ 429 | /*! exports provided: default */ 430 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 431 | 432 | "use strict"; 433 | __webpack_require__.r(__webpack_exports__); 434 | /* harmony default export */ __webpack_exports__["default"] = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i); 435 | 436 | /***/ }), 437 | 438 | /***/ "./node_modules/uuid/dist/esm-browser/rng.js": 439 | /*!***************************************************!*\ 440 | !*** ./node_modules/uuid/dist/esm-browser/rng.js ***! 441 | \***************************************************/ 442 | /*! exports provided: default */ 443 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 444 | 445 | "use strict"; 446 | __webpack_require__.r(__webpack_exports__); 447 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return rng; }); 448 | // Unique ID creation requires a high quality random # generator. In the browser we therefore 449 | // require the crypto API and do not support built-in fallback to lower quality random number 450 | // generators (like Math.random()). 451 | var getRandomValues; 452 | var rnds8 = new Uint8Array(16); 453 | function rng() { 454 | // lazy load so that environments that need to polyfill have a chance to do so 455 | if (!getRandomValues) { 456 | // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also, 457 | // find the complete implementation of crypto (msCrypto) on IE11. 458 | getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto); 459 | 460 | if (!getRandomValues) { 461 | throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); 462 | } 463 | } 464 | 465 | return getRandomValues(rnds8); 466 | } 467 | 468 | /***/ }), 469 | 470 | /***/ "./node_modules/uuid/dist/esm-browser/sha1.js": 471 | /*!****************************************************!*\ 472 | !*** ./node_modules/uuid/dist/esm-browser/sha1.js ***! 473 | \****************************************************/ 474 | /*! exports provided: default */ 475 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 476 | 477 | "use strict"; 478 | __webpack_require__.r(__webpack_exports__); 479 | // Adapted from Chris Veness' SHA1 code at 480 | // http://www.movable-type.co.uk/scripts/sha1.html 481 | function f(s, x, y, z) { 482 | switch (s) { 483 | case 0: 484 | return x & y ^ ~x & z; 485 | 486 | case 1: 487 | return x ^ y ^ z; 488 | 489 | case 2: 490 | return x & y ^ x & z ^ y & z; 491 | 492 | case 3: 493 | return x ^ y ^ z; 494 | } 495 | } 496 | 497 | function ROTL(x, n) { 498 | return x << n | x >>> 32 - n; 499 | } 500 | 501 | function sha1(bytes) { 502 | var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6]; 503 | var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]; 504 | 505 | if (typeof bytes === 'string') { 506 | var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape 507 | 508 | bytes = []; 509 | 510 | for (var i = 0; i < msg.length; ++i) { 511 | bytes.push(msg.charCodeAt(i)); 512 | } 513 | } else if (!Array.isArray(bytes)) { 514 | // Convert Array-like to Array 515 | bytes = Array.prototype.slice.call(bytes); 516 | } 517 | 518 | bytes.push(0x80); 519 | var l = bytes.length / 4 + 2; 520 | var N = Math.ceil(l / 16); 521 | var M = new Array(N); 522 | 523 | for (var _i = 0; _i < N; ++_i) { 524 | var arr = new Uint32Array(16); 525 | 526 | for (var j = 0; j < 16; ++j) { 527 | arr[j] = bytes[_i * 64 + j * 4] << 24 | bytes[_i * 64 + j * 4 + 1] << 16 | bytes[_i * 64 + j * 4 + 2] << 8 | bytes[_i * 64 + j * 4 + 3]; 528 | } 529 | 530 | M[_i] = arr; 531 | } 532 | 533 | M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32); 534 | M[N - 1][14] = Math.floor(M[N - 1][14]); 535 | M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff; 536 | 537 | for (var _i2 = 0; _i2 < N; ++_i2) { 538 | var W = new Uint32Array(80); 539 | 540 | for (var t = 0; t < 16; ++t) { 541 | W[t] = M[_i2][t]; 542 | } 543 | 544 | for (var _t = 16; _t < 80; ++_t) { 545 | W[_t] = ROTL(W[_t - 3] ^ W[_t - 8] ^ W[_t - 14] ^ W[_t - 16], 1); 546 | } 547 | 548 | var a = H[0]; 549 | var b = H[1]; 550 | var c = H[2]; 551 | var d = H[3]; 552 | var e = H[4]; 553 | 554 | for (var _t2 = 0; _t2 < 80; ++_t2) { 555 | var s = Math.floor(_t2 / 20); 556 | var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[_t2] >>> 0; 557 | e = d; 558 | d = c; 559 | c = ROTL(b, 30) >>> 0; 560 | b = a; 561 | a = T; 562 | } 563 | 564 | H[0] = H[0] + a >>> 0; 565 | H[1] = H[1] + b >>> 0; 566 | H[2] = H[2] + c >>> 0; 567 | H[3] = H[3] + d >>> 0; 568 | H[4] = H[4] + e >>> 0; 569 | } 570 | 571 | return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff]; 572 | } 573 | 574 | /* harmony default export */ __webpack_exports__["default"] = (sha1); 575 | 576 | /***/ }), 577 | 578 | /***/ "./node_modules/uuid/dist/esm-browser/stringify.js": 579 | /*!*********************************************************!*\ 580 | !*** ./node_modules/uuid/dist/esm-browser/stringify.js ***! 581 | \*********************************************************/ 582 | /*! exports provided: default */ 583 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 584 | 585 | "use strict"; 586 | __webpack_require__.r(__webpack_exports__); 587 | /* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/esm-browser/validate.js"); 588 | 589 | /** 590 | * Convert array of 16 byte values to UUID string format of the form: 591 | * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX 592 | */ 593 | 594 | var byteToHex = []; 595 | 596 | for (var i = 0; i < 256; ++i) { 597 | byteToHex.push((i + 0x100).toString(16).substr(1)); 598 | } 599 | 600 | function stringify(arr) { 601 | var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; 602 | // Note: Be careful editing this code! It's been tuned for performance 603 | // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 604 | var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one 605 | // of the following: 606 | // - One or more input array values don't map to a hex octet (leading to 607 | // "undefined" in the uuid) 608 | // - Invalid input values for the RFC `version` or `variant` fields 609 | 610 | if (!Object(_validate_js__WEBPACK_IMPORTED_MODULE_0__["default"])(uuid)) { 611 | throw TypeError('Stringified UUID is invalid'); 612 | } 613 | 614 | return uuid; 615 | } 616 | 617 | /* harmony default export */ __webpack_exports__["default"] = (stringify); 618 | 619 | /***/ }), 620 | 621 | /***/ "./node_modules/uuid/dist/esm-browser/v1.js": 622 | /*!**************************************************!*\ 623 | !*** ./node_modules/uuid/dist/esm-browser/v1.js ***! 624 | \**************************************************/ 625 | /*! exports provided: default */ 626 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 627 | 628 | "use strict"; 629 | __webpack_require__.r(__webpack_exports__); 630 | /* harmony import */ var _rng_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./rng.js */ "./node_modules/uuid/dist/esm-browser/rng.js"); 631 | /* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/esm-browser/stringify.js"); 632 | 633 | // **`v1()` - Generate time-based UUID** 634 | // 635 | // Inspired by https://github.com/LiosK/UUID.js 636 | // and http://docs.python.org/library/uuid.html 637 | 638 | var _nodeId; 639 | 640 | var _clockseq; // Previous uuid creation time 641 | 642 | 643 | var _lastMSecs = 0; 644 | var _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details 645 | 646 | function v1(options, buf, offset) { 647 | var i = buf && offset || 0; 648 | var b = buf || new Array(16); 649 | options = options || {}; 650 | var node = options.node || _nodeId; 651 | var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not 652 | // specified. We do this lazily to minimize issues related to insufficient 653 | // system entropy. See #189 654 | 655 | if (node == null || clockseq == null) { 656 | var seedBytes = options.random || (options.rng || _rng_js__WEBPACK_IMPORTED_MODULE_0__["default"])(); 657 | 658 | if (node == null) { 659 | // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) 660 | node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; 661 | } 662 | 663 | if (clockseq == null) { 664 | // Per 4.2.2, randomize (14 bit) clockseq 665 | clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; 666 | } 667 | } // UUID timestamps are 100 nano-second units since the Gregorian epoch, 668 | // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so 669 | // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' 670 | // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. 671 | 672 | 673 | var msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock 674 | // cycle to simulate higher resolution clock 675 | 676 | var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) 677 | 678 | var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression 679 | 680 | if (dt < 0 && options.clockseq === undefined) { 681 | clockseq = clockseq + 1 & 0x3fff; 682 | } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new 683 | // time interval 684 | 685 | 686 | if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { 687 | nsecs = 0; 688 | } // Per 4.2.1.2 Throw error if too many uuids are requested 689 | 690 | 691 | if (nsecs >= 10000) { 692 | throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); 693 | } 694 | 695 | _lastMSecs = msecs; 696 | _lastNSecs = nsecs; 697 | _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch 698 | 699 | msecs += 12219292800000; // `time_low` 700 | 701 | var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; 702 | b[i++] = tl >>> 24 & 0xff; 703 | b[i++] = tl >>> 16 & 0xff; 704 | b[i++] = tl >>> 8 & 0xff; 705 | b[i++] = tl & 0xff; // `time_mid` 706 | 707 | var tmh = msecs / 0x100000000 * 10000 & 0xfffffff; 708 | b[i++] = tmh >>> 8 & 0xff; 709 | b[i++] = tmh & 0xff; // `time_high_and_version` 710 | 711 | b[i++] = tmh >>> 24 & 0xf | 0x10; // include version 712 | 713 | b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) 714 | 715 | b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` 716 | 717 | b[i++] = clockseq & 0xff; // `node` 718 | 719 | for (var n = 0; n < 6; ++n) { 720 | b[i + n] = node[n]; 721 | } 722 | 723 | return buf || Object(_stringify_js__WEBPACK_IMPORTED_MODULE_1__["default"])(b); 724 | } 725 | 726 | /* harmony default export */ __webpack_exports__["default"] = (v1); 727 | 728 | /***/ }), 729 | 730 | /***/ "./node_modules/uuid/dist/esm-browser/v3.js": 731 | /*!**************************************************!*\ 732 | !*** ./node_modules/uuid/dist/esm-browser/v3.js ***! 733 | \**************************************************/ 734 | /*! exports provided: default */ 735 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 736 | 737 | "use strict"; 738 | __webpack_require__.r(__webpack_exports__); 739 | /* harmony import */ var _v35_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./v35.js */ "./node_modules/uuid/dist/esm-browser/v35.js"); 740 | /* harmony import */ var _md5_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./md5.js */ "./node_modules/uuid/dist/esm-browser/md5.js"); 741 | 742 | 743 | var v3 = Object(_v35_js__WEBPACK_IMPORTED_MODULE_0__["default"])('v3', 0x30, _md5_js__WEBPACK_IMPORTED_MODULE_1__["default"]); 744 | /* harmony default export */ __webpack_exports__["default"] = (v3); 745 | 746 | /***/ }), 747 | 748 | /***/ "./node_modules/uuid/dist/esm-browser/v35.js": 749 | /*!***************************************************!*\ 750 | !*** ./node_modules/uuid/dist/esm-browser/v35.js ***! 751 | \***************************************************/ 752 | /*! exports provided: DNS, URL, default */ 753 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 754 | 755 | "use strict"; 756 | __webpack_require__.r(__webpack_exports__); 757 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DNS", function() { return DNS; }); 758 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "URL", function() { return URL; }); 759 | /* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/esm-browser/stringify.js"); 760 | /* harmony import */ var _parse_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parse.js */ "./node_modules/uuid/dist/esm-browser/parse.js"); 761 | 762 | 763 | 764 | function stringToBytes(str) { 765 | str = unescape(encodeURIComponent(str)); // UTF8 escape 766 | 767 | var bytes = []; 768 | 769 | for (var i = 0; i < str.length; ++i) { 770 | bytes.push(str.charCodeAt(i)); 771 | } 772 | 773 | return bytes; 774 | } 775 | 776 | var DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; 777 | var URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; 778 | /* harmony default export */ __webpack_exports__["default"] = (function (name, version, hashfunc) { 779 | function generateUUID(value, namespace, buf, offset) { 780 | if (typeof value === 'string') { 781 | value = stringToBytes(value); 782 | } 783 | 784 | if (typeof namespace === 'string') { 785 | namespace = Object(_parse_js__WEBPACK_IMPORTED_MODULE_1__["default"])(namespace); 786 | } 787 | 788 | if (namespace.length !== 16) { 789 | throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); 790 | } // Compute hash of namespace and value, Per 4.3 791 | // Future: Use spread syntax when supported on all platforms, e.g. `bytes = 792 | // hashfunc([...namespace, ... value])` 793 | 794 | 795 | var bytes = new Uint8Array(16 + value.length); 796 | bytes.set(namespace); 797 | bytes.set(value, namespace.length); 798 | bytes = hashfunc(bytes); 799 | bytes[6] = bytes[6] & 0x0f | version; 800 | bytes[8] = bytes[8] & 0x3f | 0x80; 801 | 802 | if (buf) { 803 | offset = offset || 0; 804 | 805 | for (var i = 0; i < 16; ++i) { 806 | buf[offset + i] = bytes[i]; 807 | } 808 | 809 | return buf; 810 | } 811 | 812 | return Object(_stringify_js__WEBPACK_IMPORTED_MODULE_0__["default"])(bytes); 813 | } // Function#name is not settable on some platforms (#270) 814 | 815 | 816 | try { 817 | generateUUID.name = name; // eslint-disable-next-line no-empty 818 | } catch (err) {} // For CommonJS default export support 819 | 820 | 821 | generateUUID.DNS = DNS; 822 | generateUUID.URL = URL; 823 | return generateUUID; 824 | }); 825 | 826 | /***/ }), 827 | 828 | /***/ "./node_modules/uuid/dist/esm-browser/v4.js": 829 | /*!**************************************************!*\ 830 | !*** ./node_modules/uuid/dist/esm-browser/v4.js ***! 831 | \**************************************************/ 832 | /*! exports provided: default */ 833 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 834 | 835 | "use strict"; 836 | __webpack_require__.r(__webpack_exports__); 837 | /* harmony import */ var _rng_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./rng.js */ "./node_modules/uuid/dist/esm-browser/rng.js"); 838 | /* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/esm-browser/stringify.js"); 839 | 840 | 841 | 842 | function v4(options, buf, offset) { 843 | options = options || {}; 844 | var rnds = options.random || (options.rng || _rng_js__WEBPACK_IMPORTED_MODULE_0__["default"])(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` 845 | 846 | rnds[6] = rnds[6] & 0x0f | 0x40; 847 | rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided 848 | 849 | if (buf) { 850 | offset = offset || 0; 851 | 852 | for (var i = 0; i < 16; ++i) { 853 | buf[offset + i] = rnds[i]; 854 | } 855 | 856 | return buf; 857 | } 858 | 859 | return Object(_stringify_js__WEBPACK_IMPORTED_MODULE_1__["default"])(rnds); 860 | } 861 | 862 | /* harmony default export */ __webpack_exports__["default"] = (v4); 863 | 864 | /***/ }), 865 | 866 | /***/ "./node_modules/uuid/dist/esm-browser/v5.js": 867 | /*!**************************************************!*\ 868 | !*** ./node_modules/uuid/dist/esm-browser/v5.js ***! 869 | \**************************************************/ 870 | /*! exports provided: default */ 871 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 872 | 873 | "use strict"; 874 | __webpack_require__.r(__webpack_exports__); 875 | /* harmony import */ var _v35_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./v35.js */ "./node_modules/uuid/dist/esm-browser/v35.js"); 876 | /* harmony import */ var _sha1_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sha1.js */ "./node_modules/uuid/dist/esm-browser/sha1.js"); 877 | 878 | 879 | var v5 = Object(_v35_js__WEBPACK_IMPORTED_MODULE_0__["default"])('v5', 0x50, _sha1_js__WEBPACK_IMPORTED_MODULE_1__["default"]); 880 | /* harmony default export */ __webpack_exports__["default"] = (v5); 881 | 882 | /***/ }), 883 | 884 | /***/ "./node_modules/uuid/dist/esm-browser/validate.js": 885 | /*!********************************************************!*\ 886 | !*** ./node_modules/uuid/dist/esm-browser/validate.js ***! 887 | \********************************************************/ 888 | /*! exports provided: default */ 889 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 890 | 891 | "use strict"; 892 | __webpack_require__.r(__webpack_exports__); 893 | /* harmony import */ var _regex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./regex.js */ "./node_modules/uuid/dist/esm-browser/regex.js"); 894 | 895 | 896 | function validate(uuid) { 897 | return typeof uuid === 'string' && _regex_js__WEBPACK_IMPORTED_MODULE_0__["default"].test(uuid); 898 | } 899 | 900 | /* harmony default export */ __webpack_exports__["default"] = (validate); 901 | 902 | /***/ }), 903 | 904 | /***/ "./node_modules/uuid/dist/esm-browser/version.js": 905 | /*!*******************************************************!*\ 906 | !*** ./node_modules/uuid/dist/esm-browser/version.js ***! 907 | \*******************************************************/ 908 | /*! exports provided: default */ 909 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 910 | 911 | "use strict"; 912 | __webpack_require__.r(__webpack_exports__); 913 | /* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/esm-browser/validate.js"); 914 | 915 | 916 | function version(uuid) { 917 | if (!Object(_validate_js__WEBPACK_IMPORTED_MODULE_0__["default"])(uuid)) { 918 | throw TypeError('Invalid UUID'); 919 | } 920 | 921 | return parseInt(uuid.substr(14, 1), 16); 922 | } 923 | 924 | /* harmony default export */ __webpack_exports__["default"] = (version); 925 | 926 | /***/ }), 927 | 928 | /***/ "./src/blocks/Inspector.js": 929 | /*!*********************************!*\ 930 | !*** ./src/blocks/Inspector.js ***! 931 | \*********************************/ 932 | /*! exports provided: default */ 933 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 934 | 935 | "use strict"; 936 | __webpack_require__.r(__webpack_exports__); 937 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 938 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 939 | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); 940 | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__); 941 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); 942 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); 943 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); 944 | /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__); 945 | /* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-browser/index.js"); 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | function Inspector({ 954 | attributes, 955 | setAttributes, 956 | chartObj 957 | }) { 958 | const { 959 | title, 960 | labels, 961 | chartBgColor, 962 | labelType, 963 | chartType, 964 | sameColor 965 | } = attributes; // local states for Custom Label Colors 966 | 967 | const [labelOptions, setLabelOptions] = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useState"])([]); 968 | const [selectedColor, setSelectedColor] = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useState"])(chartBgColor[0]); 969 | const [selectedLabel, setSelectedLabel] = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useState"])(labels[0]); 970 | Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => { 971 | // set the Labels in SelectControls required format in the. Labels will Change when a new CSV is uploaded 972 | processLabelsforOptions(); 973 | }, []); 974 | 975 | const processLabelsforOptions = () => { 976 | let alllabelForOptions = labels.map(label => { 977 | return { 978 | value: label, 979 | label: label 980 | }; 981 | }); 982 | setLabelOptions(alllabelForOptions); 983 | }; 984 | 985 | Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => { 986 | if (chartObj) { 987 | // Update the Labels in SelectControllers if new CSV is Uploadded 988 | processLabelsforOptions(); 989 | } 990 | }, [labels]); 991 | /* File Upload Start */ 992 | // handle CSV Upload from FormFileUpload Component and pass on result to DataPareser 993 | 994 | const handleCSVupload = e => { 995 | const CSVreader = new FileReader(); 996 | 997 | CSVreader.onload = () => { 998 | DataParser(CSVreader.result); 999 | }; 1000 | 1001 | CSVreader.readAsText(e.target.files[0]); 1002 | setSelectedColor('#ff6385'); 1003 | }; // Parse the Data in required Format and set new labels, chartdata and LabelType. (Label Type is what you see in Select Controller Select [LabelType] by default it is Language) 1004 | 1005 | 1006 | const DataParser = result => { 1007 | const table = result.split('\n').map(eachrow => eachrow.split(',')); // First Split the data in rows and then separate the column values 1008 | 1009 | const columnnames = table[0]; // Get the column names which is the first item in rows array 1010 | //const chartLabelType = columnnames[0]; 1011 | 1012 | table.shift(); // remove the first item which is column names to get the rows data 1013 | 1014 | const rowsdata = table; //Get the labels which is the second item in rows array 1015 | 1016 | const labels = rowsdata.map(row => row[0]); //Get the data which is the second item in rows array 1017 | 1018 | const data = rowsdata.map(row => parseInt(row[1])); 1019 | setAttributes({ 1020 | labels: labels, 1021 | chartdata: data // labelType: chartLabelType, 1022 | 1023 | }); 1024 | }; 1025 | /* File Upload End */ 1026 | 1027 | /* Label Bg Color Settings Start */ 1028 | // If same color is selected, set the color to #812ffe and set set label to first label 1029 | // else switch back to default colors 1030 | 1031 | 1032 | Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => { 1033 | if (chartObj) { 1034 | if (sameColor) { 1035 | setSelectedColor('#812ffe'); 1036 | setSelectedLabel(labels[0]); 1037 | } else { 1038 | switchtoDefaultColors(); 1039 | } 1040 | } 1041 | }, [sameColor]); 1042 | 1043 | const switchtoDefaultColors = () => { 1044 | let defaultcolors = ['#ff6385', '#36a3eb', '#ffcc56', '#812ffe', '#00e893']; 1045 | let newBgColorsFull = []; 1046 | labels.forEach(item => { 1047 | if (newBgColorsFull.length <= labels.length) { 1048 | newBgColorsFull.push(...defaultcolors); 1049 | } 1050 | }); 1051 | let newBgColor = newBgColorsFull.slice(0, labels.length); 1052 | setAttributes({ 1053 | chartBgColor: [...newBgColor] 1054 | }); 1055 | setSelectedColor('#ff6385'); 1056 | }; 1057 | 1058 | Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => { 1059 | if (chartObj) { 1060 | if (sameColor) { 1061 | // When Same Color is Selected, Switch all bars to same color 1062 | updateAllLabelColors(); 1063 | } else { 1064 | // if theLabel Color of currently selectedLabel is Changed, Update the Label Color 1065 | updateLabelColor(); 1066 | } 1067 | } 1068 | }, [selectedColor]); 1069 | 1070 | const updateLabelColor = () => { 1071 | const labelIndex = labels.indexOf(selectedLabel); 1072 | let newLabelColors = [...chartBgColor]; 1073 | newLabelColors[labelIndex] = selectedColor; 1074 | setAttributes({ 1075 | chartBgColor: [...newLabelColors] 1076 | }); 1077 | }; 1078 | 1079 | const updateAllLabelColors = () => { 1080 | setAttributes({ 1081 | chartBgColor: [selectedColor] 1082 | }); 1083 | }; // set default selectedcolor of the current selectedlabel using it's index 1084 | 1085 | 1086 | Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => { 1087 | const labelIndex = labels.indexOf(selectedLabel); 1088 | const color = chartBgColor[labelIndex]; 1089 | 1090 | if (chartObj && !sameColor) { 1091 | setSelectedColor(color); 1092 | } 1093 | }, [selectedLabel]); 1094 | /* Label Bg Color Settings End */ 1095 | // ColorPallete Onchange Function 1096 | 1097 | const onLabelColorChange = newColor => { 1098 | setSelectedColor(newColor); 1099 | }; 1100 | 1101 | return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_1__["InspectorControls"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["PanelBody"], { 1102 | title: "Chart Settings", 1103 | initialOpen: true 1104 | }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["PanelRow"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["TextControl"], { 1105 | label: "Chart Tile", 1106 | value: title, 1107 | onChange: title => setAttributes({ 1108 | title 1109 | }) 1110 | })), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["FormFileUpload"], { 1111 | accept: ".csv", 1112 | onChange: handleCSVupload, 1113 | render: ({ 1114 | openFileDialog 1115 | }) => Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["Button"], { 1116 | style: { 1117 | marginBottom: '10px' 1118 | }, 1119 | isSecondary: true, 1120 | onClick: openFileDialog 1121 | }, "Upload CSV File")) 1122 | }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("a", { 1123 | href: `${siteurl}/ChartBlock_Example_Data.csv`, 1124 | download: true 1125 | }, "Download Example CSV File")), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["PanelBody"], { 1126 | title: "Chart Color Settings", 1127 | initialOpen: true 1128 | }, (chartType === 'bar' || chartType === 'line') && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", { 1129 | style: { 1130 | margin: '25px 0 25px 0' 1131 | } 1132 | }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["ToggleControl"], { 1133 | label: `Use same color for all Labels `, 1134 | checked: sameColor, 1135 | onChange: e => setAttributes({ 1136 | sameColor: e 1137 | }) 1138 | })), !sameColor && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["SelectControl"], { 1139 | label: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])(`Select Label`), 1140 | value: selectedLabel, 1141 | onChange: label => setSelectedLabel(label), 1142 | options: [{ 1143 | value: null, 1144 | label: `Select Label` 1145 | }, ...labelOptions] 1146 | }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("p", null, "Select Color"), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["ColorPalette"], { 1147 | value: selectedColor, 1148 | colors: [{ 1149 | color: '#ff6385' 1150 | }, { 1151 | color: '#36a3eb' 1152 | }, { 1153 | color: '#ffcc56' 1154 | }, { 1155 | color: '#812ffe' 1156 | }, { 1157 | color: '#00e893' 1158 | }], 1159 | style: { 1160 | width: '200px' 1161 | }, 1162 | onChange: onLabelColorChange 1163 | })))); 1164 | } 1165 | 1166 | /* harmony default export */ __webpack_exports__["default"] = (Inspector); 1167 | 1168 | /***/ }), 1169 | 1170 | /***/ "./src/blocks/bar/block.json": 1171 | /*!***********************************!*\ 1172 | !*** ./src/blocks/bar/block.json ***! 1173 | \***********************************/ 1174 | /*! exports provided: apiVersion, name, category, textdomain, attributes, supports, example, editorScript, script, default */ 1175 | /***/ (function(module) { 1176 | 1177 | module.exports = JSON.parse("{\"apiVersion\":2,\"name\":\"charts-blocks/bar\",\"category\":\"charts-blocks\",\"textdomain\":\"charts-blocks\",\"attributes\":{\"title\":{\"type\":\"string\",\"default\":\"Mostly Spoken Languages across the World\"},\"labelType\":{\"type\":\"string\",\"default\":\"Language\"},\"labels\":{\"type\":\"array\",\"default\":[\"English\",\"Spanish\",\"French\"]},\"chartType\":{\"type\":\"string\",\"default\":\"bar\"},\"chartdata\":{\"type\":\"array\",\"default\":[300,50,100]},\"chartBgColor\":{\"type\":\"array\",\"default\":[\"#ff6385\",\"#36a3eb\",\"#ffcc56\",\"#812ffe\",\"#00e893\"]},\"chartID\":{\"type\":\"string\",\"default\":null},\"barAxes\":{\"type\":\"string\",\"default\":\"x\"},\"sameColor\":{\"type\":\"boolean\",\"default\":false}},\"supports\":{\"align\":[\"wide\",\"full\"],\"html\":false},\"example\":{},\"editorScript\":\"file:./build/index.js\",\"script\":\"file:./build/frontendscript.js\"}"); 1178 | 1179 | /***/ }), 1180 | 1181 | /***/ "./src/blocks/bar/index.js": 1182 | /*!*********************************!*\ 1183 | !*** ./src/blocks/bar/index.js ***! 1184 | \*********************************/ 1185 | /*! exports provided: name, settings */ 1186 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 1187 | 1188 | "use strict"; 1189 | __webpack_require__.r(__webpack_exports__); 1190 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "name", function() { return name; }); 1191 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "settings", function() { return settings; }); 1192 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 1193 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 1194 | /* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../edit */ "./src/blocks/edit.js"); 1195 | /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/blocks/bar/block.json"); 1196 | var _block_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./block.json */ "./src/blocks/bar/block.json", 1); 1197 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); 1198 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); 1199 | 1200 | 1201 | 1202 | 1203 | const { 1204 | name, 1205 | category, 1206 | attributes, 1207 | supports, 1208 | textdomain, 1209 | example 1210 | } = _block_json__WEBPACK_IMPORTED_MODULE_2__; 1211 | const icon = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("svg", { 1212 | version: "1.0", 1213 | xmlns: "http://www.w3.org/2000/svg", 1214 | width: "250.000000pt", 1215 | height: "250.000000pt", 1216 | viewBox: "0 0 250.000000 250.000000", 1217 | preserveAspectRatio: "xMidYMid meet" 1218 | }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("g", { 1219 | transform: "translate(0.000000,250.000000) scale(0.100000,-0.100000)", 1220 | fill: "#1E1E1E", 1221 | stroke: "none" 1222 | }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", { 1223 | d: "M250 1235 l0 -1115 255 0 255 0 0 1115 0 1115 -255 0 -255 0 0 -1115z" 1224 | }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", { 1225 | d: "M1020 1050 l0 -940 255 0 255 0 0 940 0 940 -255 0 -255 0 0 -940z" 1226 | }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", { 1227 | d: "M1760 800 l0 -680 255 0 255 0 0 680 0 680 -255 0 -255 0 0 -680z" 1228 | }))); 1229 | const settings = { 1230 | title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Bar Chart', `${textdomain}`), 1231 | description: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Display your data in a Bar Chart.', `${textdomain}`), 1232 | icon, 1233 | category, 1234 | keywords: [Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Bar Chart', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Bar', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts block', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts-blocks', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('graph', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('graphs', `${textdomain}`)], 1235 | supports, 1236 | attributes, 1237 | edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"], 1238 | save: function () { 1239 | return null; 1240 | }, 1241 | example 1242 | }; 1243 | 1244 | 1245 | /***/ }), 1246 | 1247 | /***/ "./src/blocks/doughnut/block.json": 1248 | /*!****************************************!*\ 1249 | !*** ./src/blocks/doughnut/block.json ***! 1250 | \****************************************/ 1251 | /*! exports provided: apiVersion, name, category, textdomain, attributes, supports, example, editorScript, script, default */ 1252 | /***/ (function(module) { 1253 | 1254 | module.exports = JSON.parse("{\"apiVersion\":2,\"name\":\"charts-blocks/doughnut\",\"category\":\"charts-blocks\",\"textdomain\":\"charts-blocks\",\"attributes\":{\"title\":{\"type\":\"string\",\"default\":\"Mostly Spoken Languages across the World\"},\"labelType\":{\"type\":\"string\",\"default\":\"Language\"},\"labels\":{\"type\":\"array\",\"default\":[\"English\",\"Spanish\",\"French\"]},\"chartType\":{\"type\":\"string\",\"default\":\"doughnut\"},\"chartdata\":{\"type\":\"array\",\"default\":[300,50,100]},\"chartBgColor\":{\"type\":\"array\",\"default\":[\"#ff6385\",\"#36a3eb\",\"#ffcc56\",\"#812ffe\",\"#00e893\"]},\"chartID\":{\"type\":\"string\",\"default\":null}},\"supports\":{\"align\":[\"wide\",\"full\"],\"html\":false},\"example\":{},\"editorScript\":\"file:./build/index.js\",\"script\":\"file:./build/frontendscript.js\"}"); 1255 | 1256 | /***/ }), 1257 | 1258 | /***/ "./src/blocks/doughnut/index.js": 1259 | /*!**************************************!*\ 1260 | !*** ./src/blocks/doughnut/index.js ***! 1261 | \**************************************/ 1262 | /*! exports provided: name, settings */ 1263 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 1264 | 1265 | "use strict"; 1266 | __webpack_require__.r(__webpack_exports__); 1267 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "name", function() { return name; }); 1268 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "settings", function() { return settings; }); 1269 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 1270 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 1271 | /* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../edit */ "./src/blocks/edit.js"); 1272 | /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/blocks/doughnut/block.json"); 1273 | var _block_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./block.json */ "./src/blocks/doughnut/block.json", 1); 1274 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); 1275 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); 1276 | 1277 | 1278 | 1279 | 1280 | const { 1281 | name, 1282 | category, 1283 | attributes, 1284 | supports, 1285 | textdomain, 1286 | example 1287 | } = _block_json__WEBPACK_IMPORTED_MODULE_2__; 1288 | const icon = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("svg", { 1289 | version: "1.0", 1290 | xmlns: "http://www.w3.org/2000/svg", 1291 | width: "980.000000pt", 1292 | height: "980.000000pt", 1293 | viewBox: "0 0 980.000000 980.000000", 1294 | preserveAspectRatio: "xMidYMid meet" 1295 | }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("g", { 1296 | transform: "translate(0.000000,980.000000) scale(0.100000,-0.100000)", 1297 | fill: "#1E1E1E", 1298 | stroke: "none" 1299 | }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", { 1300 | d: "M4900 8578 l0 -1225 121 -6 c1053 -57 1943 -765 2234 -1776 54 -190\n95 -453 95 -618 l0 -53 1225 0 1225 0 0 73 c0 40 -5 144 -10 232 -70 1094\n-491 2109 -1216 2935 -112 128 -386 398 -509 501 -848 714 -1878 1112 -2987\n1155 l-178 7 0 -1225z" 1301 | }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", { 1302 | d: "M4200 9749 c-952 -143 -1794 -528 -2505 -1144 -147 -127 -423 -405\n-536 -540 -1099 -1306 -1443 -3063 -917 -4685 194 -597 500 -1146 922 -1650\n98 -117 370 -393 496 -504 1149 -1010 2674 -1424 4180 -1136 807 155 1604 539\n2235 1078 133 113 384 361 499 492 527 598 885 1282 1080 2057 46 183 99 479\n112 616 l7 77 -247 0 c-175 0 -246 -3 -246 -11 0 -25 -33 -232 -56 -354 -165\n-861 -621 -1699 -1261 -2316 -616 -593 -1371 -988 -2203 -1153 -1142 -227\n-2303 0 -3284 641 -477 312 -924 755 -1243 1233 -591 887 -839 1941 -707 3010\n96 782 425 1559 924 2184 706 885 1701 1454 2831 1620 59 9 112 16 118 16 8 0\n11 71 11 245 l0 245 -42 -1 c-24 0 -99 -9 -168 -20z" 1303 | }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", { 1304 | d: "M4258 7764 c-1097 -245 -1957 -1094 -2218 -2189 -106 -444 -104 -928\n5 -1372 102 -416 295 -809 561 -1143 87 -109 344 -367 454 -454 332 -265 745\n-466 1160 -565 246 -59 387 -75 680 -75 223 0 288 4 410 22 533 82 983 275\n1410 606 129 100 360 329 463 458 298 374 494 789 592 1250 l23 108 -248 0\n-248 0 -22 -92 c-218 -891 -925 -1591 -1820 -1802 -200 -48 -319 -60 -560 -60\n-243 0 -359 12 -565 61 -527 124 -1005 427 -1347 853 -275 344 -445 736 -515\n1190 -24 159 -24 519 0 680 118 769 554 1409 1224 1794 171 98 427 199 622\n245 46 11 85 22 87 24 3 2 3 114 2 249 l-3 245 -147 -33z" 1305 | }))); 1306 | const settings = { 1307 | title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Doughnut Chart', `${textdomain}`), 1308 | description: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Display your data in a Doughnut Chart.', `${textdomain}`), 1309 | icon, 1310 | category, 1311 | keywords: [Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Doughnut chart', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Doughnut', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts block', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts-blocks', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('graph', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('graphs', `${textdomain}`)], 1312 | supports, 1313 | attributes, 1314 | edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"], 1315 | save: function () { 1316 | return null; 1317 | }, 1318 | example 1319 | }; 1320 | 1321 | 1322 | /***/ }), 1323 | 1324 | /***/ "./src/blocks/edit.js": 1325 | /*!****************************!*\ 1326 | !*** ./src/blocks/edit.js ***! 1327 | \****************************/ 1328 | /*! exports provided: default */ 1329 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 1330 | 1331 | "use strict"; 1332 | __webpack_require__.r(__webpack_exports__); 1333 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Edit; }); 1334 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 1335 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 1336 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); 1337 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); 1338 | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); 1339 | /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__); 1340 | /* harmony import */ var _Inspector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Inspector */ "./src/blocks/Inspector.js"); 1341 | /* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-browser/index.js"); 1342 | 1343 | 1344 | 1345 | 1346 | 1347 | 1348 | function Edit({ 1349 | attributes, 1350 | setAttributes, 1351 | className 1352 | }) { 1353 | const mycanvas = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useRef"])(); 1354 | const { 1355 | labels, 1356 | title, 1357 | chartdata, 1358 | chartBgColor, 1359 | labelType, 1360 | barAxes, 1361 | chartID, 1362 | chartType 1363 | } = attributes; 1364 | const [chartObj, setChartObj] = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useState"])(null); 1365 | Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => { 1366 | // if chartID is null then create a unique id for the frontend Chart 1367 | if (!chartID) { 1368 | const uid = Object(uuid__WEBPACK_IMPORTED_MODULE_4__["v4"])(); 1369 | setAttributes({ 1370 | chartID: `chart-${uid}` 1371 | }); 1372 | } 1373 | 1374 | let chartInstance = new Chart(mycanvas.current, { 1375 | type: chartType, 1376 | data: { 1377 | labels, 1378 | datasets: [{ 1379 | data: chartdata, 1380 | backgroundColor: chartBgColor, 1381 | hoverOffset: 2 1382 | }] 1383 | }, 1384 | options: { 1385 | indexAxis: barAxes ? barAxes : null, 1386 | 1387 | /* fill: true, 1388 | backgroundColor: 'rgba(244, 144, 128, 0.1)', */ 1389 | responsive: true, 1390 | plugins: { 1391 | title: { 1392 | display: true, 1393 | text: title 1394 | }, 1395 | legend: { 1396 | display: chartType === 'bar' || chartType === 'line' ? false : true 1397 | } 1398 | } 1399 | } 1400 | }); 1401 | setChartObj(chartInstance); 1402 | }, []); 1403 | Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => { 1404 | if (chartObj) { 1405 | /* If New CSV is uploaded Update Chart settings and Re Render the canvas */ 1406 | updateChartSettings(); 1407 | } 1408 | }, [chartdata]); 1409 | 1410 | const updateChartSettings = () => { 1411 | /* Function to Remove the Old Dataset and Push the Uploaded one */ 1412 | filterData(chartObj); 1413 | chartObj.data.labels = labels; 1414 | chartObj.update(); 1415 | }; 1416 | 1417 | function filterData(chart) { 1418 | if (chartType === 'bar' || chartType === 'line') { 1419 | /* Old dataset length */ 1420 | const existingdataLength = chart.data.datasets[0].data.length; // exisiting colors 1421 | 1422 | let colors = [...chartBgColor]; 1423 | /* From the existing dataset, remove the old data set items 1424 | and push the new uploaded dataset to it */ 1425 | 1426 | chartdata.forEach((dataitem, index) => { 1427 | if (index < existingdataLength) { 1428 | chart.data.datasets[0].data.shift(); 1429 | } 1430 | 1431 | chart.data.datasets[0].data.push(dataitem); // if the dataset has new bars (that is if it's length is greater than existing) 1432 | // add colors for the new for the new bars 1433 | 1434 | if (chartBgColor.length <= chartdata.length) { 1435 | chartBgColor.push(...colors); 1436 | } 1437 | }); 1438 | let newBgColor = chartBgColor.slice(0, chartdata.length); 1439 | setAttributes({ 1440 | chartBgColor: newBgColor 1441 | }); 1442 | } else { 1443 | chartObj.data.datasets[0].data = chartdata; 1444 | } 1445 | } // If the Bg color of label or The title is Changed, Update the Chart 1446 | 1447 | 1448 | Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => { 1449 | if (chartObj) { 1450 | chartObj.options.plugins.title.text = title; 1451 | chartObj.data.datasets[0].backgroundColor = chartBgColor; 1452 | chartObj.update(); 1453 | } 1454 | }, [chartBgColor, title]); 1455 | return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", Object(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__["useBlockProps"])(), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", { 1456 | className: "chart-wrapper" 1457 | }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_Inspector__WEBPACK_IMPORTED_MODULE_3__["default"], { 1458 | chartObj: chartObj, 1459 | attributes: attributes, 1460 | setAttributes: setAttributes 1461 | }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("canvas", { 1462 | ref: mycanvas, 1463 | className: className, 1464 | style: { 1465 | margin: 40 1466 | }, 1467 | width: "800", 1468 | height: "800" 1469 | }))); 1470 | } 1471 | 1472 | /***/ }), 1473 | 1474 | /***/ "./src/blocks/horizontal-bar/block.json": 1475 | /*!**********************************************!*\ 1476 | !*** ./src/blocks/horizontal-bar/block.json ***! 1477 | \**********************************************/ 1478 | /*! exports provided: apiVersion, name, category, textdomain, attributes, supports, example, editorScript, script, default */ 1479 | /***/ (function(module) { 1480 | 1481 | module.exports = JSON.parse("{\"apiVersion\":2,\"name\":\"charts-blocks/horizontal-bar\",\"category\":\"charts-blocks\",\"textdomain\":\"charts-blocks\",\"attributes\":{\"title\":{\"type\":\"string\",\"default\":\"Mostly Spoken Languages across the World\"},\"labelType\":{\"type\":\"string\",\"default\":\"Language\"},\"labels\":{\"type\":\"array\",\"default\":[\"English\",\"Spanish\",\"French\"]},\"chartType\":{\"type\":\"string\",\"default\":\"bar\"},\"chartdata\":{\"type\":\"array\",\"default\":[300,50,100]},\"chartBgColor\":{\"type\":\"array\",\"default\":[\"#ff6385\",\"#36a3eb\",\"#ffcc56\",\"#812ffe\",\"#00e893\"]},\"chartID\":{\"type\":\"string\",\"default\":null},\"barAxes\":{\"type\":\"string\",\"default\":\"y\"}},\"supports\":{\"align\":[\"wide\",\"full\"],\"html\":false},\"example\":{},\"editorScript\":\"file:./build/index.js\",\"script\":\"file:./build/frontendscript.js\"}"); 1482 | 1483 | /***/ }), 1484 | 1485 | /***/ "./src/blocks/horizontal-bar/index.js": 1486 | /*!********************************************!*\ 1487 | !*** ./src/blocks/horizontal-bar/index.js ***! 1488 | \********************************************/ 1489 | /*! exports provided: name, settings */ 1490 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 1491 | 1492 | "use strict"; 1493 | __webpack_require__.r(__webpack_exports__); 1494 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "name", function() { return name; }); 1495 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "settings", function() { return settings; }); 1496 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 1497 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 1498 | /* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../edit */ "./src/blocks/edit.js"); 1499 | /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/blocks/horizontal-bar/block.json"); 1500 | var _block_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./block.json */ "./src/blocks/horizontal-bar/block.json", 1); 1501 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); 1502 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); 1503 | 1504 | 1505 | 1506 | 1507 | const { 1508 | name, 1509 | category, 1510 | attributes, 1511 | supports, 1512 | textdomain, 1513 | example 1514 | } = _block_json__WEBPACK_IMPORTED_MODULE_2__; 1515 | const icon = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("svg", { 1516 | version: "1.0", 1517 | xmlns: "http://www.w3.org/2000/svg", 1518 | width: "250.000000pt", 1519 | height: "250.000000pt", 1520 | viewBox: "0 0 250.000000 250.000000", 1521 | preserveAspectRatio: "xMidYMid meet" 1522 | }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("g", { 1523 | transform: "translate(0.000000,250.000000) scale(0.100000,-0.100000)", 1524 | fill: "#1E1E1E", 1525 | stroke: "none" 1526 | }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", { 1527 | d: "M120 2090 l0 -250 1135 0 1135 0 0 250 0 250 -1135 0 -1135 0 0 -250z" 1528 | }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", { 1529 | d: "M110 1280 l0 -310 755 0 755 0 0 310 0 310 -755 0 -755 0 0 -310z" 1530 | }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", { 1531 | d: "M120 460 l0 -290 1035 0 1035 0 0 290 0 290 -1035 0 -1035 0 0 -290z" 1532 | }))); 1533 | const settings = { 1534 | title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Horizontal Bar Chart', `${textdomain}`), 1535 | description: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Display your data in a Horizontal Bar Chart.', `${textdomain}`), 1536 | icon: icon, 1537 | category, 1538 | keywords: [Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Horizontal Bar Chart', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Horizontal Bar', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts block', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts-blocks', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('graph', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('graphs', `${textdomain}`)], 1539 | supports, 1540 | attributes, 1541 | edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"], 1542 | save: function () { 1543 | return null; 1544 | }, 1545 | example 1546 | }; 1547 | 1548 | 1549 | /***/ }), 1550 | 1551 | /***/ "./src/blocks/horizontal-line/block.json": 1552 | /*!***********************************************!*\ 1553 | !*** ./src/blocks/horizontal-line/block.json ***! 1554 | \***********************************************/ 1555 | /*! exports provided: apiVersion, name, category, textdomain, attributes, supports, example, editorScript, script, default */ 1556 | /***/ (function(module) { 1557 | 1558 | module.exports = JSON.parse("{\"apiVersion\":2,\"name\":\"charts-blocks/horizontal-line\",\"category\":\"charts-blocks\",\"textdomain\":\"charts-blocks\",\"attributes\":{\"title\":{\"type\":\"string\",\"default\":\"Mostly Spoken Languages across the World\"},\"labelType\":{\"type\":\"string\",\"default\":\"Language\"},\"labels\":{\"type\":\"array\",\"default\":[\"English\",\"Spanish\",\"French\"]},\"chartType\":{\"type\":\"string\",\"default\":\"line\"},\"chartdata\":{\"type\":\"array\",\"default\":[300,50,100]},\"chartBgColor\":{\"type\":\"array\",\"default\":[\"#ff6385\",\"#36a3eb\",\"#ffcc56\",\"#812ffe\",\"#00e893\"]},\"chartID\":{\"type\":\"string\",\"default\":null},\"barAxes\":{\"type\":\"string\",\"default\":\"y\"}},\"supports\":{\"align\":[\"wide\",\"full\"],\"html\":false},\"example\":{},\"editorScript\":\"file:./build/index.js\",\"script\":\"file:./build/frontendscript.js\"}"); 1559 | 1560 | /***/ }), 1561 | 1562 | /***/ "./src/blocks/horizontal-line/index.js": 1563 | /*!*********************************************!*\ 1564 | !*** ./src/blocks/horizontal-line/index.js ***! 1565 | \*********************************************/ 1566 | /*! exports provided: name, settings */ 1567 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 1568 | 1569 | "use strict"; 1570 | __webpack_require__.r(__webpack_exports__); 1571 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "name", function() { return name; }); 1572 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "settings", function() { return settings; }); 1573 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 1574 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 1575 | /* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../edit */ "./src/blocks/edit.js"); 1576 | /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/blocks/horizontal-line/block.json"); 1577 | var _block_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./block.json */ "./src/blocks/horizontal-line/block.json", 1); 1578 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); 1579 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); 1580 | 1581 | 1582 | 1583 | 1584 | const { 1585 | name, 1586 | category, 1587 | attributes, 1588 | supports, 1589 | textdomain, 1590 | example 1591 | } = _block_json__WEBPACK_IMPORTED_MODULE_2__; 1592 | const icon = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("svg", { 1593 | version: "1.0", 1594 | xmlns: "http://www.w3.org/2000/svg", 1595 | width: "250.000000pt", 1596 | height: "250.000000pt", 1597 | viewBox: "0 0 250.000000 250.000000", 1598 | preserveAspectRatio: "xMidYMid meet" 1599 | }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("g", { 1600 | transform: "translate(0.000000,250.000000) scale(0.100000,-0.100000)", 1601 | fill: "#1E1E1E", 1602 | stroke: "none" 1603 | }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", { 1604 | d: "M190 1250 l0 -1070 1065 0 1065 0 0 100 0 100 -985 0 -985 0 0 970 0\n970 -80 0 -80 0 0 -1070z" 1605 | }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", { 1606 | d: "M566 2251 c-16 -11 -35 -30 -42 -43 -18 -31 -17 -93 0 -126 28 -53\n121 -86 181 -63 15 6 73 -40 315 -252 l295 -259 1 -56 c0 -32 4 -66 8 -77 5\n-16 -5 -32 -48 -74 l-55 -55 -86 0 -87 -1 -34 -37 c-28 -31 -34 -45 -34 -83 0\n-38 6 -52 34 -83 l35 -37 90 0 90 0 154 -134 154 -134 -4 -61 c-4 -53 -2 -65\n18 -90 26 -34 92 -66 134 -66 42 0 107 32 133 65 46 59 22 154 -48 190 -33 17\n-132 20 -159 5 -16 -8 -46 14 -179 131 l-160 140 5 53 c3 30 1 61 -5 73 -9 17\n-3 28 49 79 l60 59 60 -3 c58 -4 61 -3 99 36 37 37 40 44 40 94 0 63 -20 97\n-69 118 -30 12 -101 10 -132 -4 -24 -10 -603 499 -593 522 14 32 16 93 4 122\n-7 17 -27 39 -45 50 -44 27 -138 28 -179 1z" 1607 | }))); 1608 | const settings = { 1609 | title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Horizontal Line Chart', `${textdomain}`), 1610 | description: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Display your data in a Horizontal Line Chart.', `${textdomain}`), 1611 | icon, 1612 | category, 1613 | keywords: [Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Horizontal Line Chart', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Horizontal Line ', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts block', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts-blocks', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('graph', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('graphs', `${textdomain}`)], 1614 | supports, 1615 | attributes, 1616 | edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"], 1617 | save: function () { 1618 | return null; 1619 | }, 1620 | example 1621 | }; 1622 | 1623 | 1624 | /***/ }), 1625 | 1626 | /***/ "./src/blocks/line/block.json": 1627 | /*!************************************!*\ 1628 | !*** ./src/blocks/line/block.json ***! 1629 | \************************************/ 1630 | /*! exports provided: apiVersion, name, category, textdomain, attributes, supports, example, editorScript, script, default */ 1631 | /***/ (function(module) { 1632 | 1633 | module.exports = JSON.parse("{\"apiVersion\":2,\"name\":\"charts-blocks/line\",\"category\":\"charts-blocks\",\"textdomain\":\"charts-blocks\",\"attributes\":{\"title\":{\"type\":\"string\",\"default\":\"Mostly Spoken Languages across the World\"},\"labelType\":{\"type\":\"string\",\"default\":\"Language\"},\"labels\":{\"type\":\"array\",\"default\":[\"English\",\"Spanish\",\"French\"]},\"chartType\":{\"type\":\"string\",\"default\":\"line\"},\"chartdata\":{\"type\":\"array\",\"default\":[300,50,100]},\"chartBgColor\":{\"type\":\"array\",\"default\":[\"#ff6385\",\"#36a3eb\",\"#ffcc56\",\"#812ffe\",\"#00e893\"]},\"chartID\":{\"type\":\"string\",\"default\":null}},\"supports\":{\"align\":[\"wide\",\"full\"],\"html\":false},\"example\":{},\"editorScript\":\"file:./build/index.js\",\"script\":\"file:./build/frontendscript.js\"}"); 1634 | 1635 | /***/ }), 1636 | 1637 | /***/ "./src/blocks/line/index.js": 1638 | /*!**********************************!*\ 1639 | !*** ./src/blocks/line/index.js ***! 1640 | \**********************************/ 1641 | /*! exports provided: name, settings */ 1642 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 1643 | 1644 | "use strict"; 1645 | __webpack_require__.r(__webpack_exports__); 1646 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "name", function() { return name; }); 1647 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "settings", function() { return settings; }); 1648 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 1649 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 1650 | /* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../edit */ "./src/blocks/edit.js"); 1651 | /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/blocks/line/block.json"); 1652 | var _block_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./block.json */ "./src/blocks/line/block.json", 1); 1653 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); 1654 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); 1655 | 1656 | 1657 | 1658 | 1659 | const { 1660 | name, 1661 | category, 1662 | attributes, 1663 | supports, 1664 | textdomain, 1665 | example 1666 | } = _block_json__WEBPACK_IMPORTED_MODULE_2__; 1667 | const icon = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("svg", { 1668 | version: "1.0", 1669 | xmlns: "http://www.w3.org/2000/svg", 1670 | width: "250.000000pt", 1671 | height: "250.000000pt", 1672 | viewBox: "0 0 250.000000 250.000000", 1673 | preserveAspectRatio: "xMidYMid meet" 1674 | }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("g", { 1675 | transform: "translate(0.000000,250.000000) scale(0.100000,-0.100000)", 1676 | fill: "#1E1E1E", 1677 | stroke: "none" 1678 | }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", { 1679 | d: "M140 1210 l0 -1070 1065 0 1065 0 0 100 0 100 -985 0 -985 0 0 970 0\n970 -80 0 -80 0 0 -1070z" 1680 | }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", { 1681 | d: "M2081 1866 c-53 -29 -85 -122 -62 -181 6 -15 -40 -73 -252 -315\nl-259 -295 -56 -1 c-32 0 -66 -4 -77 -8 -16 -5 -32 5 -74 48 l-55 55 0 86 -1\n87 -37 34 c-31 28 -45 34 -83 34 -38 0 -52 -6 -83 -34 l-37 -35 0 -90 0 -90\n-134 -154 -134 -154 -61 4 c-53 4 -65 2 -90 -18 -34 -26 -66 -92 -66 -134 0\n-42 32 -107 65 -133 59 -46 154 -22 190 48 17 33 20 132 5 159 -8 16 14 46\n131 179 l140 160 53 -5 c30 -3 61 -1 73 5 17 9 28 3 79 -49 l59 -60 -3 -60\nc-4 -58 -3 -61 36 -99 37 -37 44 -40 94 -40 63 0 97 20 118 69 12 30 10 101\n-4 132 -10 24 499 603 522 593 32 -14 93 -16 122 -4 91 38 96 218 8 266 -30\n17 -97 17 -127 0z" 1682 | }))); 1683 | const settings = { 1684 | title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Line Chart', `${textdomain}`), 1685 | description: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Display your data in a Line Chart.', `${textdomain}`), 1686 | icon, 1687 | category, 1688 | keywords: [Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Line chart', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Line', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts block', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts-blocks', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('graph', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('graphs', `${textdomain}`)], 1689 | supports, 1690 | attributes, 1691 | edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"], 1692 | save: function () { 1693 | return null; 1694 | }, 1695 | example 1696 | }; 1697 | 1698 | 1699 | /***/ }), 1700 | 1701 | /***/ "./src/blocks/pie/block.json": 1702 | /*!***********************************!*\ 1703 | !*** ./src/blocks/pie/block.json ***! 1704 | \***********************************/ 1705 | /*! exports provided: apiVersion, name, category, textdomain, attributes, supports, example, editorScript, script, default */ 1706 | /***/ (function(module) { 1707 | 1708 | module.exports = JSON.parse("{\"apiVersion\":2,\"name\":\"charts-blocks/pie\",\"category\":\"charts-blocks\",\"textdomain\":\"charts-blocks\",\"attributes\":{\"title\":{\"type\":\"string\",\"default\":\"Mostly spoken languages across the world\"},\"labelType\":{\"type\":\"string\",\"default\":\"Language\"},\"labels\":{\"type\":\"array\",\"default\":[\"English\",\"Spanish\",\"French\"]},\"chartType\":{\"type\":\"string\",\"default\":\"pie\"},\"chartdata\":{\"type\":\"array\",\"default\":[300,50,100]},\"chartBgColor\":{\"type\":\"array\",\"default\":[\"#ff6385\",\"#36a3eb\",\"#ffcc56\",\"#812ffe\",\"#00e893\"]},\"chartID\":{\"type\":\"string\",\"default\":null}},\"supports\":{\"align\":[\"wide\",\"full\"],\"html\":false},\"example\":{},\"editorScript\":\"file:./build/index.js\",\"script\":\"file:./build/frontendscript.js\"}"); 1709 | 1710 | /***/ }), 1711 | 1712 | /***/ "./src/blocks/pie/index.js": 1713 | /*!*********************************!*\ 1714 | !*** ./src/blocks/pie/index.js ***! 1715 | \*********************************/ 1716 | /*! exports provided: name, settings */ 1717 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 1718 | 1719 | "use strict"; 1720 | __webpack_require__.r(__webpack_exports__); 1721 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "name", function() { return name; }); 1722 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "settings", function() { return settings; }); 1723 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 1724 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 1725 | /* harmony import */ var _edit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../edit */ "./src/blocks/edit.js"); 1726 | /* harmony import */ var _block_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.json */ "./src/blocks/pie/block.json"); 1727 | var _block_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./block.json */ "./src/blocks/pie/block.json", 1); 1728 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); 1729 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); 1730 | 1731 | 1732 | 1733 | 1734 | const { 1735 | name, 1736 | category, 1737 | attributes, 1738 | supports, 1739 | textdomain, 1740 | example 1741 | } = _block_json__WEBPACK_IMPORTED_MODULE_2__; 1742 | const icon = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("svg", { 1743 | version: "1.0", 1744 | xmlns: "http://www.w3.org/2000/svg", 1745 | width: "980.000000pt", 1746 | height: "996.000000pt", 1747 | viewBox: "0 0 980.000000 996.000000", 1748 | preserveAspectRatio: "xMidYMid meet" 1749 | }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("g", { 1750 | transform: "translate(0.000000,996.000000) scale(0.100000,-0.100000)", 1751 | fill: "#1E1E1E", 1752 | stroke: "none" 1753 | }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", { 1754 | d: "M4651 9949 c-919 -53 -1828 -376 -2588 -921 -392 -281 -795 -679\n-1089 -1073 -453 -609 -756 -1309 -895 -2064 -42 -229 -79 -608 -79 -808 l0\n-73 2475 0 2475 0 0 2475 0 2475 -77 -1 c-43 -1 -143 -6 -222 -10z" 1755 | }), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("path", { 1756 | d: "M5468 6803 l-3 -2468 -2467 -3 -2468 -2 0 -33 c0 -57 30 -298 56\n-452 213 -1247 953 -2374 2021 -3078 1226 -808 2759 -986 4147 -482 465 169\n905 418 1313 743 184 147 511 467 659 647 572 692 926 1508 1038 2395 53 415\n44 898 -24 1318 -303 1863 -1704 3357 -3546 3781 -213 49 -565 101 -681 101\nl-43 0 -2 -2467z m722 1886 c724 -184 1381 -559 1915 -1094 681 -681 1093\n-1541 1207 -2520 17 -149 17 -702 0 -860 -98 -881 -449 -1677 -1032 -2338\n-684 -774 -1619 -1259 -2665 -1384 -211 -25 -710 -25 -915 0 -770 95 -1460\n372 -2060 826 -229 174 -491 422 -671 636 -420 499 -714 1077 -868 1705 -16\n69 -33 144 -37 168 l-7 42 2439 0 2439 0 -3 2436 -4 2437 53 -7 c30 -4 123\n-25 209 -47z" 1757 | }))); 1758 | const settings = { 1759 | title: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Pie Chart', `${textdomain}`), 1760 | description: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Display your data in a Pie Chart.', `${textdomain}`), 1761 | icon, 1762 | category, 1763 | keywords: [Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Pie chart', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('Pie', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts block', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('charts-blocks', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('graph', `${textdomain}`), Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__["__"])('graphs', `${textdomain}`)], 1764 | supports, 1765 | attributes, 1766 | edit: _edit__WEBPACK_IMPORTED_MODULE_1__["default"], 1767 | save: function () { 1768 | return null; 1769 | }, 1770 | example 1771 | }; 1772 | 1773 | 1774 | /***/ }), 1775 | 1776 | /***/ "./src/index.js": 1777 | /*!**********************!*\ 1778 | !*** ./src/index.js ***! 1779 | \**********************/ 1780 | /*! no exports provided */ 1781 | /***/ (function(module, __webpack_exports__, __webpack_require__) { 1782 | 1783 | "use strict"; 1784 | __webpack_require__.r(__webpack_exports__); 1785 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); 1786 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_0__); 1787 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks"); 1788 | /* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__); 1789 | /* harmony import */ var _blocks_bar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./blocks/bar */ "./src/blocks/bar/index.js"); 1790 | /* harmony import */ var _blocks_pie__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./blocks/pie */ "./src/blocks/pie/index.js"); 1791 | /* harmony import */ var _blocks_doughnut__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./blocks/doughnut */ "./src/blocks/doughnut/index.js"); 1792 | /* harmony import */ var _blocks_line__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./blocks/line */ "./src/blocks/line/index.js"); 1793 | /* harmony import */ var _blocks_horizontal_bar__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./blocks/horizontal-bar */ "./src/blocks/horizontal-bar/index.js"); 1794 | /* harmony import */ var _blocks_horizontal_line__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./blocks/horizontal-line */ "./src/blocks/horizontal-line/index.js"); 1795 | /** 1796 | * import Wordpress Dependencies 1797 | */ 1798 | 1799 | 1800 | /** 1801 | * import Block Settings 1802 | */ 1803 | 1804 | 1805 | 1806 | 1807 | 1808 | 1809 | 1810 | 1811 | const regsiterBlock = block => { 1812 | const { 1813 | name, 1814 | settings 1815 | } = block; 1816 | Object(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_1__["registerBlockType"])(name, settings); 1817 | }; 1818 | 1819 | const registerAllChartBlocks = () => { 1820 | const allBlocks = [_blocks_bar__WEBPACK_IMPORTED_MODULE_2__, _blocks_pie__WEBPACK_IMPORTED_MODULE_3__, _blocks_doughnut__WEBPACK_IMPORTED_MODULE_4__, _blocks_line__WEBPACK_IMPORTED_MODULE_5__, _blocks_horizontal_bar__WEBPACK_IMPORTED_MODULE_6__, _blocks_horizontal_line__WEBPACK_IMPORTED_MODULE_7__]; 1821 | allBlocks.forEach(block => { 1822 | regsiterBlock(block); 1823 | }); 1824 | }; 1825 | 1826 | registerAllChartBlocks(); 1827 | 1828 | /***/ }), 1829 | 1830 | /***/ "@wordpress/block-editor": 1831 | /*!*************************************!*\ 1832 | !*** external ["wp","blockEditor"] ***! 1833 | \*************************************/ 1834 | /*! no static exports found */ 1835 | /***/ (function(module, exports) { 1836 | 1837 | (function() { module.exports = window["wp"]["blockEditor"]; }()); 1838 | 1839 | /***/ }), 1840 | 1841 | /***/ "@wordpress/blocks": 1842 | /*!********************************!*\ 1843 | !*** external ["wp","blocks"] ***! 1844 | \********************************/ 1845 | /*! no static exports found */ 1846 | /***/ (function(module, exports) { 1847 | 1848 | (function() { module.exports = window["wp"]["blocks"]; }()); 1849 | 1850 | /***/ }), 1851 | 1852 | /***/ "@wordpress/components": 1853 | /*!************************************!*\ 1854 | !*** external ["wp","components"] ***! 1855 | \************************************/ 1856 | /*! no static exports found */ 1857 | /***/ (function(module, exports) { 1858 | 1859 | (function() { module.exports = window["wp"]["components"]; }()); 1860 | 1861 | /***/ }), 1862 | 1863 | /***/ "@wordpress/element": 1864 | /*!*********************************!*\ 1865 | !*** external ["wp","element"] ***! 1866 | \*********************************/ 1867 | /*! no static exports found */ 1868 | /***/ (function(module, exports) { 1869 | 1870 | (function() { module.exports = window["wp"]["element"]; }()); 1871 | 1872 | /***/ }), 1873 | 1874 | /***/ "@wordpress/i18n": 1875 | /*!******************************!*\ 1876 | !*** external ["wp","i18n"] ***! 1877 | \******************************/ 1878 | /*! no static exports found */ 1879 | /***/ (function(module, exports) { 1880 | 1881 | (function() { module.exports = window["wp"]["i18n"]; }()); 1882 | 1883 | /***/ }) 1884 | 1885 | /******/ }); 1886 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /build/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./node_modules/uuid/dist/esm-browser/index.js","webpack:///./node_modules/uuid/dist/esm-browser/md5.js","webpack:///./node_modules/uuid/dist/esm-browser/nil.js","webpack:///./node_modules/uuid/dist/esm-browser/parse.js","webpack:///./node_modules/uuid/dist/esm-browser/regex.js","webpack:///./node_modules/uuid/dist/esm-browser/rng.js","webpack:///./node_modules/uuid/dist/esm-browser/sha1.js","webpack:///./node_modules/uuid/dist/esm-browser/stringify.js","webpack:///./node_modules/uuid/dist/esm-browser/v1.js","webpack:///./node_modules/uuid/dist/esm-browser/v3.js","webpack:///./node_modules/uuid/dist/esm-browser/v35.js","webpack:///./node_modules/uuid/dist/esm-browser/v4.js","webpack:///./node_modules/uuid/dist/esm-browser/v5.js","webpack:///./node_modules/uuid/dist/esm-browser/validate.js","webpack:///./node_modules/uuid/dist/esm-browser/version.js","webpack:///./src/blocks/Inspector.js","webpack:///./src/blocks/bar/index.js","webpack:///./src/blocks/doughnut/index.js","webpack:///./src/blocks/edit.js","webpack:///./src/blocks/horizontal-bar/index.js","webpack:///./src/blocks/horizontal-line/index.js","webpack:///./src/blocks/line/index.js","webpack:///./src/blocks/pie/index.js","webpack:///./src/index.js","webpack:///external [\"wp\",\"blockEditor\"]","webpack:///external [\"wp\",\"blocks\"]","webpack:///external [\"wp\",\"components\"]","webpack:///external [\"wp\",\"element\"]","webpack:///external [\"wp\",\"i18n\"]"],"names":["Inspector","attributes","setAttributes","chartObj","title","labels","chartBgColor","labelType","chartType","sameColor","labelOptions","setLabelOptions","useState","selectedColor","setSelectedColor","selectedLabel","setSelectedLabel","useEffect","processLabelsforOptions","alllabelForOptions","map","label","value","handleCSVupload","e","CSVreader","FileReader","onload","DataParser","result","readAsText","target","files","table","split","eachrow","columnnames","shift","rowsdata","row","data","parseInt","chartdata","switchtoDefaultColors","defaultcolors","newBgColorsFull","forEach","item","length","push","newBgColor","slice","updateAllLabelColors","updateLabelColor","labelIndex","indexOf","newLabelColors","color","onLabelColorChange","newColor","openFileDialog","marginBottom","siteurl","margin","__","width","name","category","supports","textdomain","example","metadata","icon","settings","description","keywords","edit","save","Edit","className","mycanvas","useRef","barAxes","chartID","setChartObj","uid","uuidv4","chartInstance","Chart","current","type","datasets","backgroundColor","hoverOffset","options","indexAxis","responsive","plugins","display","text","legend","updateChartSettings","filterData","update","chart","existingdataLength","colors","dataitem","index","useBlockProps","regsiterBlock","block","registerBlockType","registerAllChartBlocks","allBlocks","bar","pie","dougnut","line","horizontalbar","horizontalline"],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAwC;AACA;AACA;AACA;AACE;AACQ;AACE;AACE;;;;;;;;;;;;;ACPtD;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;;AAElD;;AAEA,mBAAmB,gBAAgB;AACnC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA,iBAAiB,cAAc;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,cAAc;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,aAAa;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEe,kEAAG,E;;;;;;;;;;;;ACtNlB;AAAe,qGAAsC,E;;;;;;;;;;;;ACArD;AAAA;AAAqC;;AAErC;AACA,OAAO,4DAAQ;AACf;AACA;;AAEA;AACA,+BAA+B;;AAE/B;AACA;AACA;AACA,oBAAoB;;AAEpB;AACA,oBAAoB;;AAEpB;AACA,oBAAoB;;AAEpB;AACA,oBAAoB;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEe,oEAAK,E;;;;;;;;;;;;AClCpB;AAAe,6EAAc,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,UAAU,GAAG,yCAAyC,E;;;;;;;;;;;;ACApI;AAAA;AAAA;AACA;AACA;AACA;AACA;AACe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,C;;;;;;;;;;;;AClBA;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kDAAkD;;AAElD;;AAEA,mBAAmB,gBAAgB;AACnC;AACA;AACA,GAAG;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B,GAAEK,UAAW,EAAhC,CALO,EAMTL,0DAAE,CAAC,OAAD,EAAW,GAAEK,UAAW,EAAxB,CANO,EAOTL,0DAAE,CAAC,QAAD,EAAY,GAAEK,UAAW,EAAzB,CAPO,CALM;AAchBD,UAdgB;AAehBnE,YAfgB;AAgBhB2E,qDAhBgB;AAiBhBC,MAAI,EAAE,YAAY;AACjB,WAAO,IAAP;AACA,GAnBe;AAoBhBP;AApBgB,CAAjB;;;;;;;;;;;;;ACvCA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMwC,aAAa,GAAIC,KAAD,IAAW;AAChC,QAAM;AAAE7C,QAAF;AAAQO;AAAR,MAAqBsC,KAA3B;AACAC,6EAAiB,CAAC9C,IAAD,EAAOO,QAAP,CAAjB;AACA,CAHD;;AAKA,MAAMwC,sBAAsB,GAAG,MAAM;AACpC,QAAMC,SAAS,GAAG,CAACC,wCAAD,EAAMC,wCAAN,EAAWC,6CAAX,EAAoBC,yCAApB,EAA0BC,mDAA1B,EAAyCC,oDAAzC,CAAlB;AACAN,WAAS,CAACpE,OAAV,CAAmBiE,KAAD,IAAW;AAC5BD,iBAAa,CAACC,KAAD,CAAb;AACA,GAFD;AAGA,CALD;;AAOAE,sBAAsB,G;;;;;;;;;;;AC9BtB,aAAa,8CAA8C,EAAE,I;;;;;;;;;;;ACA7D,aAAa,yCAAyC,EAAE,I;;;;;;;;;;;ACAxD,aAAa,6CAA6C,EAAE,I;;;;;;;;;;;ACA5D,aAAa,0CAA0C,EAAE,I;;;;;;;;;;;ACAzD,aAAa,uCAAuC,EAAE,I","file":"index.js","sourcesContent":[" \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, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.js\");\n","export { default as v1 } from './v1.js';\nexport { default as v3 } from './v3.js';\nexport { default as v4 } from './v4.js';\nexport { default as v5 } from './v5.js';\nexport { default as NIL } from './nil.js';\nexport { default as version } from './version.js';\nexport { default as validate } from './validate.js';\nexport { default as stringify } from './stringify.js';\nexport { default as parse } from './parse.js';","/*\n * Browser-compatible JavaScript MD5\n *\n * Modification of JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\nfunction md5(bytes) {\n if (typeof bytes === 'string') {\n var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = new Uint8Array(msg.length);\n\n for (var i = 0; i < msg.length; ++i) {\n bytes[i] = msg.charCodeAt(i);\n }\n }\n\n return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));\n}\n/*\n * Convert an array of little-endian words to an array of bytes\n */\n\n\nfunction md5ToHexEncodedArray(input) {\n var output = [];\n var length32 = input.length * 32;\n var hexTab = '0123456789abcdef';\n\n for (var i = 0; i < length32; i += 8) {\n var x = input[i >> 5] >>> i % 32 & 0xff;\n var hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);\n output.push(hex);\n }\n\n return output;\n}\n/**\n * Calculate output length with padding and bit length\n */\n\n\nfunction getOutputLength(inputLength8) {\n return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;\n}\n/*\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n */\n\n\nfunction wordsToMd5(x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << len % 32;\n x[getOutputLength(len) - 1] = len;\n var a = 1732584193;\n var b = -271733879;\n var c = -1732584194;\n var d = 271733878;\n\n for (var i = 0; i < x.length; i += 16) {\n var olda = a;\n var oldb = b;\n var oldc = c;\n var oldd = d;\n a = md5ff(a, b, c, d, x[i], 7, -680876936);\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n b = md5gg(b, c, d, a, x[i], 20, -373897302);\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n d = md5hh(d, a, b, c, x[i], 11, -358537222);\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n a = md5ii(a, b, c, d, x[i], 6, -198630844);\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n a = safeAdd(a, olda);\n b = safeAdd(b, oldb);\n c = safeAdd(c, oldc);\n d = safeAdd(d, oldd);\n }\n\n return [a, b, c, d];\n}\n/*\n * Convert an array bytes to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n */\n\n\nfunction bytesToWords(input) {\n if (input.length === 0) {\n return [];\n }\n\n var length8 = input.length * 8;\n var output = new Uint32Array(getOutputLength(length8));\n\n for (var i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;\n }\n\n return output;\n}\n/*\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\n\n\nfunction safeAdd(x, y) {\n var lsw = (x & 0xffff) + (y & 0xffff);\n var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return msw << 16 | lsw & 0xffff;\n}\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\n\n\nfunction bitRotateLeft(num, cnt) {\n return num << cnt | num >>> 32 - cnt;\n}\n/*\n * These functions implement the four basic operations the algorithm uses.\n */\n\n\nfunction md5cmn(q, a, b, x, s, t) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\n\nfunction md5ff(a, b, c, d, x, s, t) {\n return md5cmn(b & c | ~b & d, a, b, x, s, t);\n}\n\nfunction md5gg(a, b, c, d, x, s, t) {\n return md5cmn(b & d | c & ~d, a, b, x, s, t);\n}\n\nfunction md5hh(a, b, c, d, x, s, t) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\n\nfunction md5ii(a, b, c, d, x, s, t) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\nexport default md5;","export default '00000000-0000-0000-0000-000000000000';","import validate from './validate.js';\n\nfunction parse(uuid) {\n if (!validate(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n var v;\n var arr = new Uint8Array(16); // Parse ########-....-....-....-............\n\n arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;\n arr[1] = v >>> 16 & 0xff;\n arr[2] = v >>> 8 & 0xff;\n arr[3] = v & 0xff; // Parse ........-####-....-....-............\n\n arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;\n arr[5] = v & 0xff; // Parse ........-....-####-....-............\n\n arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;\n arr[7] = v & 0xff; // Parse ........-....-....-####-............\n\n arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;\n arr[9] = v & 0xff; // Parse ........-....-....-....-############\n // (Use \"/\" to avoid 32-bit truncation when bit-shifting high-order bytes)\n\n arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;\n arr[11] = v / 0x100000000 & 0xff;\n arr[12] = v >>> 24 & 0xff;\n arr[13] = v >>> 16 & 0xff;\n arr[14] = v >>> 8 & 0xff;\n arr[15] = v & 0xff;\n return arr;\n}\n\nexport default parse;","export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nvar getRandomValues;\nvar rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation. Also,\n // find the complete implementation of crypto (msCrypto) on IE11.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","// Adapted from Chris Veness' SHA1 code at\n// http://www.movable-type.co.uk/scripts/sha1.html\nfunction f(s, x, y, z) {\n switch (s) {\n case 0:\n return x & y ^ ~x & z;\n\n case 1:\n return x ^ y ^ z;\n\n case 2:\n return x & y ^ x & z ^ y & z;\n\n case 3:\n return x ^ y ^ z;\n }\n}\n\nfunction ROTL(x, n) {\n return x << n | x >>> 32 - n;\n}\n\nfunction sha1(bytes) {\n var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];\n var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n\n if (typeof bytes === 'string') {\n var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = [];\n\n for (var i = 0; i < msg.length; ++i) {\n bytes.push(msg.charCodeAt(i));\n }\n } else if (!Array.isArray(bytes)) {\n // Convert Array-like to Array\n bytes = Array.prototype.slice.call(bytes);\n }\n\n bytes.push(0x80);\n var l = bytes.length / 4 + 2;\n var N = Math.ceil(l / 16);\n var M = new Array(N);\n\n for (var _i = 0; _i < N; ++_i) {\n var arr = new Uint32Array(16);\n\n for (var j = 0; j < 16; ++j) {\n arr[j] = bytes[_i * 64 + j * 4] << 24 | bytes[_i * 64 + j * 4 + 1] << 16 | bytes[_i * 64 + j * 4 + 2] << 8 | bytes[_i * 64 + j * 4 + 3];\n }\n\n M[_i] = arr;\n }\n\n M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);\n M[N - 1][14] = Math.floor(M[N - 1][14]);\n M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;\n\n for (var _i2 = 0; _i2 < N; ++_i2) {\n var W = new Uint32Array(80);\n\n for (var t = 0; t < 16; ++t) {\n W[t] = M[_i2][t];\n }\n\n for (var _t = 16; _t < 80; ++_t) {\n W[_t] = ROTL(W[_t - 3] ^ W[_t - 8] ^ W[_t - 14] ^ W[_t - 16], 1);\n }\n\n var a = H[0];\n var b = H[1];\n var c = H[2];\n var d = H[3];\n var e = H[4];\n\n for (var _t2 = 0; _t2 < 80; ++_t2) {\n var s = Math.floor(_t2 / 20);\n var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[_t2] >>> 0;\n e = d;\n d = c;\n c = ROTL(b, 30) >>> 0;\n b = a;\n a = T;\n }\n\n H[0] = H[0] + a >>> 0;\n H[1] = H[1] + b >>> 0;\n H[2] = H[2] + c >>> 0;\n H[3] = H[3] + d >>> 0;\n H[4] = H[4] + e >>> 0;\n }\n\n return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];\n}\n\nexport default sha1;","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nvar byteToHex = [];\n\nfor (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).substr(1));\n}\n\nfunction stringify(arr) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import rng from './rng.js';\nimport stringify from './stringify.js'; // **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\n\nvar _clockseq; // Previous uuid creation time\n\n\nvar _lastMSecs = 0;\nvar _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details\n\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || new Array(16);\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n\n if (node == null || clockseq == null) {\n var seedBytes = options.random || (options.rng || rng)();\n\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];\n }\n\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n } // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n\n\n var msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)\n\n var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression\n\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n\n\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n } // Per 4.2.1.2 Throw error if too many uuids are requested\n\n\n if (nsecs >= 10000) {\n throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n\n msecs += 12219292800000; // `time_low`\n\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff; // `time_mid`\n\n var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff; // `time_high_and_version`\n\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n\n b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n\n b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`\n\n b[i++] = clockseq & 0xff; // `node`\n\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf || stringify(b);\n}\n\nexport default v1;","import v35 from './v35.js';\nimport md5 from './md5.js';\nvar v3 = v35('v3', 0x30, md5);\nexport default v3;","import stringify from './stringify.js';\nimport parse from './parse.js';\n\nfunction stringToBytes(str) {\n str = unescape(encodeURIComponent(str)); // UTF8 escape\n\n var bytes = [];\n\n for (var i = 0; i < str.length; ++i) {\n bytes.push(str.charCodeAt(i));\n }\n\n return bytes;\n}\n\nexport var DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nexport var URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\nexport default function (name, version, hashfunc) {\n function generateUUID(value, namespace, buf, offset) {\n if (typeof value === 'string') {\n value = stringToBytes(value);\n }\n\n if (typeof namespace === 'string') {\n namespace = parse(namespace);\n }\n\n if (namespace.length !== 16) {\n throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');\n } // Compute hash of namespace and value, Per 4.3\n // Future: Use spread syntax when supported on all platforms, e.g. `bytes =\n // hashfunc([...namespace, ... value])`\n\n\n var bytes = new Uint8Array(16 + value.length);\n bytes.set(namespace);\n bytes.set(value, namespace.length);\n bytes = hashfunc(bytes);\n bytes[6] = bytes[6] & 0x0f | version;\n bytes[8] = bytes[8] & 0x3f | 0x80;\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = bytes[i];\n }\n\n return buf;\n }\n\n return stringify(bytes);\n } // Function#name is not settable on some platforms (#270)\n\n\n try {\n generateUUID.name = name; // eslint-disable-next-line no-empty\n } catch (err) {} // For CommonJS default export support\n\n\n generateUUID.DNS = DNS;\n generateUUID.URL = URL;\n return generateUUID;\n}","import rng from './rng.js';\nimport stringify from './stringify.js';\n\nfunction v4(options, buf, offset) {\n options = options || {};\n var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return stringify(rnds);\n}\n\nexport default v4;","import v35 from './v35.js';\nimport sha1 from './sha1.js';\nvar v5 = v35('v5', 0x50, sha1);\nexport default v5;","import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;","import validate from './validate.js';\n\nfunction version(uuid) {\n if (!validate(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n return parseInt(uuid.substr(14, 1), 16);\n}\n\nexport default version;","import { useBlockProps, InspectorControls } from '@wordpress/block-editor';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n\tFormFileUpload,\n\tButton,\n\tSelectControl,\n\tColorPalette,\n\tToggleControl,\n} from '@wordpress/components';\nimport { v4 as uuidv4 } from 'uuid';\n\nfunction Inspector({ attributes, setAttributes, chartObj }) {\n\tconst { title, labels, chartBgColor, labelType, chartType, sameColor } =\n\t\tattributes;\n\n\t// local states for Custom Label Colors\n\tconst [labelOptions, setLabelOptions] = useState([]);\n\tconst [selectedColor, setSelectedColor] = useState(chartBgColor[0]);\n\tconst [selectedLabel, setSelectedLabel] = useState(labels[0]);\n\n\tuseEffect(() => {\n\t\t// set the Labels in SelectControls required format in the. Labels will Change when a new CSV is uploaded\n\t\tprocessLabelsforOptions();\n\t}, []);\n\n\tconst processLabelsforOptions = () => {\n\t\tlet alllabelForOptions = labels.map((label) => {\n\t\t\treturn {\n\t\t\t\tvalue: label,\n\t\t\t\tlabel: label,\n\t\t\t};\n\t\t});\n\t\tsetLabelOptions(alllabelForOptions);\n\t};\n\n\tuseEffect(() => {\n\t\tif (chartObj) {\n\t\t\t// Update the Labels in SelectControllers if new CSV is Uploadded\n\t\t\tprocessLabelsforOptions();\n\t\t}\n\t}, [labels]);\n\n\t/* File Upload Start */\n\n\t// handle CSV Upload from FormFileUpload Component and pass on result to DataPareser\n\tconst handleCSVupload = (e) => {\n\t\tconst CSVreader = new FileReader();\n\t\tCSVreader.onload = () => {\n\t\t\tDataParser(CSVreader.result);\n\t\t};\n\t\tCSVreader.readAsText(e.target.files[0]);\n\t\tsetSelectedColor('#ff6385');\n\t};\n\n\t// Parse the Data in required Format and set new labels, chartdata and LabelType. (Label Type is what you see in Select Controller Select [LabelType] by default it is Language)\n\tconst DataParser = (result) => {\n\t\tconst table = result.split('\\n').map((eachrow) => eachrow.split(',')); // First Split the data in rows and then separate the column values\n\t\tconst columnnames = table[0]; // Get the column names which is the first item in rows array\n\t\t//const chartLabelType = columnnames[0];\n\t\ttable.shift(); // remove the first item which is column names to get the rows data\n\t\tconst rowsdata = table;\n\n\t\t//Get the labels which is the second item in rows array\n\t\tconst labels = rowsdata.map((row) => row[0]);\n\t\t//Get the data which is the second item in rows array\n\t\tconst data = rowsdata.map((row) => parseInt(row[1]));\n\n\t\tsetAttributes({\n\t\t\tlabels: labels,\n\t\t\tchartdata: data,\n\t\t\t//\tlabelType: chartLabelType,\n\t\t});\n\t};\n\n\t/* File Upload End */\n\n\t/* Label Bg Color Settings Start */\n\n\t// If same color is selected, set the color to #812ffe and set set label to first label\n\t// else switch back to default colors\n\tuseEffect(() => {\n\t\tif (chartObj) {\n\t\t\tif (sameColor) {\n\t\t\t\tsetSelectedColor('#812ffe');\n\t\t\t\tsetSelectedLabel(labels[0]);\n\t\t\t} else {\n\t\t\t\tswitchtoDefaultColors();\n\t\t\t}\n\t\t}\n\t}, [sameColor]);\n\n\tconst switchtoDefaultColors = () => {\n\t\tlet defaultcolors = ['#ff6385', '#36a3eb', '#ffcc56', '#812ffe', '#00e893'];\n\t\tlet newBgColorsFull = [];\n\t\tlabels.forEach((item) => {\n\t\t\tif (newBgColorsFull.length <= labels.length) {\n\t\t\t\tnewBgColorsFull.push(...defaultcolors);\n\t\t\t}\n\t\t});\n\n\t\tlet newBgColor = newBgColorsFull.slice(0, labels.length);\n\t\tsetAttributes({ chartBgColor: [...newBgColor] });\n\t\tsetSelectedColor('#ff6385');\n\t};\n\n\tuseEffect(() => {\n\t\tif (chartObj) {\n\t\t\tif (sameColor) {\n\t\t\t\t// When Same Color is Selected, Switch all bars to same color\n\t\t\t\tupdateAllLabelColors();\n\t\t\t} else {\n\t\t\t\t// if theLabel Color of currently selectedLabel is Changed, Update the Label Color\n\t\t\t\tupdateLabelColor();\n\t\t\t}\n\t\t}\n\t}, [selectedColor]);\n\n\tconst updateLabelColor = () => {\n\t\tconst labelIndex = labels.indexOf(selectedLabel);\n\t\tlet newLabelColors = [...chartBgColor];\n\t\tnewLabelColors[labelIndex] = selectedColor;\n\t\tsetAttributes({ chartBgColor: [...newLabelColors] });\n\t};\n\n\tconst updateAllLabelColors = () => {\n\t\tsetAttributes({ chartBgColor: [selectedColor] });\n\t};\n\n\t// set default selectedcolor of the current selectedlabel using it's index\n\tuseEffect(() => {\n\t\tconst labelIndex = labels.indexOf(selectedLabel);\n\t\tconst color = chartBgColor[labelIndex];\n\t\tif (chartObj && !sameColor) {\n\t\t\tsetSelectedColor(color);\n\t\t}\n\t}, [selectedLabel]);\n\n\t/* Label Bg Color Settings End */\n\n\t// ColorPallete Onchange Function\n\tconst onLabelColorChange = (newColor) => {\n\t\tsetSelectedColor(newColor);\n\t};\n\n\treturn (\n\t\t
\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t setAttributes({ title })}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\n\n\t\t\t\t\t (\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tUpload CSV File\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t)}\n\t\t\t\t\t/>\n\n\t\t\t\t\t\n\t\t\t\t\t\tDownload Example CSV File\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\t\t\t\t\t{(chartType === 'bar' || chartType === 'line') && (\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t setAttributes({ sameColor: e })}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t
\n\t\t\t\t\t)}\n\n\t\t\t\t\t{!sameColor && (\n\t\t\t\t\t\t setSelectedLabel(label)}\n\t\t\t\t\t\t\toptions={[\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tvalue: null,\n\t\t\t\t\t\t\t\t\tlabel: `Select Label`,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t...labelOptions,\n\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\n\t\t\t\t\t

Select Color

\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t);\n}\n\nexport default Inspector;\n","import edit from '../edit';\nimport metadata from './block.json';\nimport { __ } from '@wordpress/i18n';\n\nconst { name, category, attributes, supports, textdomain, example } = metadata;\n\nconst icon = (\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n);\n\nconst settings = {\n\ttitle: __('Bar Chart', `${textdomain}`),\n\tdescription: __('Display your data in a Bar Chart.', `${textdomain}`),\n\ticon,\n\tcategory,\n\tkeywords: [\n\t\t__('Bar Chart', `${textdomain}`),\n\t\t__('Bar', `${textdomain}`),\n\t\t__('charts', `${textdomain}`),\n\t\t__('charts block', `${textdomain}`),\n\t\t__('charts-blocks', `${textdomain}`),\n\t\t__('graph', `${textdomain}`),\n\t\t__('graphs', `${textdomain}`),\n\t],\n\tsupports,\n\tattributes,\n\tedit,\n\tsave: function () {\n\t\treturn null;\n\t},\n\texample,\n};\n\nexport { name, settings };\n","import edit from '../edit';\nimport metadata from './block.json';\nimport { __ } from '@wordpress/i18n';\n\nconst { name, category, attributes, supports, textdomain, example } = metadata;\n\nconst icon = (\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n);\n\nconst settings = {\n\ttitle: __('Doughnut Chart', `${textdomain}`),\n\tdescription: __('Display your data in a Doughnut Chart.', `${textdomain}`),\n\ticon,\n\tcategory,\n\tkeywords: [\n\t\t__('Doughnut chart', `${textdomain}`),\n\t\t__('Doughnut', `${textdomain}`),\n\t\t__('charts', `${textdomain}`),\n\t\t__('charts block', `${textdomain}`),\n\t\t__('charts-blocks', `${textdomain}`),\n\t\t__('graph', `${textdomain}`),\n\t\t__('graphs', `${textdomain}`),\n\t],\n\tsupports,\n\tattributes,\n\tedit,\n\tsave: function () {\n\t\treturn null;\n\t},\n\texample,\n};\n\nexport { name, settings };\n","import { __ } from '@wordpress/i18n';\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { useEffect, useRef, useState } from '@wordpress/element';\nimport Inspector from './Inspector';\nimport { v4 as uuidv4 } from 'uuid';\n\nexport default function Edit({ attributes, setAttributes, className }) {\n\tconst mycanvas = useRef();\n\n\tconst {\n\t\tlabels,\n\t\ttitle,\n\t\tchartdata,\n\t\tchartBgColor,\n\t\tlabelType,\n\t\tbarAxes,\n\t\tchartID,\n\t\tchartType,\n\t} = attributes;\n\n\tconst [chartObj, setChartObj] = useState(null);\n\n\tuseEffect(() => {\n\t\t// if chartID is null then create a unique id for the frontend Chart\n\t\tif (!chartID) {\n\t\t\tconst uid = uuidv4();\n\t\t\tsetAttributes({ chartID: `chart-${uid}` });\n\t\t}\n\n\t\tlet chartInstance = new Chart(mycanvas.current, {\n\t\t\ttype: chartType,\n\t\t\tdata: {\n\t\t\t\tlabels,\n\t\t\t\tdatasets: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdata: chartdata,\n\t\t\t\t\t\tbackgroundColor: chartBgColor,\n\t\t\t\t\t\thoverOffset: 2,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\toptions: {\n\t\t\t\tindexAxis: barAxes ? barAxes : null,\n\t\t\t\t/* \tfill: true,\n\t\t\t\tbackgroundColor: 'rgba(244, 144, 128, 0.1)', */\n\t\t\t\tresponsive: true,\n\t\t\t\tplugins: {\n\t\t\t\t\ttitle: {\n\t\t\t\t\t\tdisplay: true,\n\t\t\t\t\t\ttext: title,\n\t\t\t\t\t},\n\t\t\t\t\tlegend: {\n\t\t\t\t\t\tdisplay: chartType === 'bar' || chartType === 'line' ? false : true,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t\tsetChartObj(chartInstance);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (chartObj) {\n\t\t\t/* If New CSV is uploaded Update Chart settings and Re Render the canvas */\n\t\t\tupdateChartSettings();\n\t\t}\n\t}, [chartdata]);\n\n\tconst updateChartSettings = () => {\n\t\t/* \tFunction to Remove the Old Dataset and Push the Uploaded one */\n\t\tfilterData(chartObj);\n\t\tchartObj.data.labels = labels;\n\t\tchartObj.update();\n\t};\n\n\tfunction filterData(chart) {\n\t\tif (chartType === 'bar' || chartType === 'line') {\n\t\t\t/* Old dataset length */\n\t\t\tconst existingdataLength = chart.data.datasets[0].data.length;\n\n\t\t\t// exisiting colors\n\t\t\tlet colors = [...chartBgColor];\n\n\t\t\t/* From the existing dataset, remove the old data set items\n and push the new uploaded dataset to it */\n\t\t\tchartdata.forEach((dataitem, index) => {\n\t\t\t\tif (index < existingdataLength) {\n\t\t\t\t\tchart.data.datasets[0].data.shift();\n\t\t\t\t}\n\t\t\t\tchart.data.datasets[0].data.push(dataitem);\n\n\t\t\t\t// if the dataset has new bars (that is if it's length is greater than existing)\n\t\t\t\t// add colors for the new for the new bars\n\t\t\t\tif (chartBgColor.length <= chartdata.length) {\n\t\t\t\t\tchartBgColor.push(...colors);\n\t\t\t\t}\n\t\t\t});\n\t\t\tlet newBgColor = chartBgColor.slice(0, chartdata.length);\n\t\t\tsetAttributes({ chartBgColor: newBgColor });\n\t\t} else {\n\t\t\tchartObj.data.datasets[0].data = chartdata;\n\t\t}\n\t}\n\n\t// If the Bg color of label or The title is Changed, Update the Chart\n\tuseEffect(() => {\n\t\tif (chartObj) {\n\t\t\tchartObj.options.plugins.title.text = title;\n\t\t\tchartObj.data.datasets[0].backgroundColor = chartBgColor;\n\t\t\tchartObj.update();\n\t\t}\n\t}, [chartBgColor, title]);\n\n\treturn (\n\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t
\n\t);\n}\n","import edit from '../edit';\nimport metadata from './block.json';\nimport { __ } from '@wordpress/i18n';\n\nconst { name, category, attributes, supports, textdomain, example } = metadata;\n\nconst icon = (\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n);\n\nconst settings = {\n\ttitle: __('Horizontal Bar Chart', `${textdomain}`),\n\tdescription: __(\n\t\t'Display your data in a Horizontal Bar Chart.',\n\t\t`${textdomain}`\n\t),\n\ticon: icon,\n\tcategory,\n\tkeywords: [\n\t\t__('Horizontal Bar Chart', `${textdomain}`),\n\t\t__('Horizontal Bar', `${textdomain}`),\n\t\t__('charts', `${textdomain}`),\n\t\t__('charts block', `${textdomain}`),\n\t\t__('charts-blocks', `${textdomain}`),\n\t\t__('graph', `${textdomain}`),\n\t\t__('graphs', `${textdomain}`),\n\t],\n\tsupports,\n\tattributes,\n\tedit,\n\tsave: function () {\n\t\treturn null;\n\t},\n\texample,\n};\n\nexport { name, settings };\n","import edit from '../edit';\nimport metadata from './block.json';\nimport { __ } from '@wordpress/i18n';\n\nconst { name, category, attributes, supports, textdomain, example } = metadata;\n\nconst icon = (\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n);\n\nconst settings = {\n\ttitle: __('Horizontal Line Chart', `${textdomain}`),\n\tdescription: __(\n\t\t'Display your data in a Horizontal Line Chart.',\n\t\t`${textdomain}`\n\t),\n\ticon,\n\tcategory,\n\tkeywords: [\n\t\t__('Horizontal Line Chart', `${textdomain}`),\n\t\t__('Horizontal Line ', `${textdomain}`),\n\t\t__('charts', `${textdomain}`),\n\t\t__('charts block', `${textdomain}`),\n\t\t__('charts-blocks', `${textdomain}`),\n\t\t__('graph', `${textdomain}`),\n\t\t__('graphs', `${textdomain}`),\n\t],\n\tsupports,\n\tattributes,\n\tedit,\n\tsave: function () {\n\t\treturn null;\n\t},\n\texample,\n};\n\nexport { name, settings };\n","import edit from '../edit';\nimport metadata from './block.json';\nimport { __ } from '@wordpress/i18n';\n\nconst { name, category, attributes, supports, textdomain, example } = metadata;\n\nconst icon = (\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n);\n\nconst settings = {\n\ttitle: __('Line Chart', `${textdomain}`),\n\tdescription: __('Display your data in a Line Chart.', `${textdomain}`),\n\ticon,\n\tcategory,\n\tkeywords: [\n\t\t__('Line chart', `${textdomain}`),\n\t\t__('Line', `${textdomain}`),\n\t\t__('charts', `${textdomain}`),\n\t\t__('charts block', `${textdomain}`),\n\t\t__('charts-blocks', `${textdomain}`),\n\t\t__('graph', `${textdomain}`),\n\t\t__('graphs', `${textdomain}`),\n\t],\n\tsupports,\n\tattributes,\n\tedit,\n\tsave: function () {\n\t\treturn null;\n\t},\n\texample,\n};\n\nexport { name, settings };\n","import edit from '../edit';\nimport metadata from './block.json';\nimport { __ } from '@wordpress/i18n';\n\nconst { name, category, attributes, supports, textdomain, example } = metadata;\n\nconst icon = (\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n);\n\nconst settings = {\n\ttitle: __('Pie Chart', `${textdomain}`),\n\tdescription: __('Display your data in a Pie Chart.', `${textdomain}`),\n\ticon,\n\tcategory,\n\tkeywords: [\n\t\t__('Pie chart', `${textdomain}`),\n\t\t__('Pie', `${textdomain}`),\n\t\t__('charts', `${textdomain}`),\n\t\t__('charts block', `${textdomain}`),\n\t\t__('charts-blocks', `${textdomain}`),\n\t\t__('graph', `${textdomain}`),\n\t\t__('graphs', `${textdomain}`),\n\t],\n\tsupports,\n\tattributes,\n\tedit,\n\tsave: function () {\n\t\treturn null;\n\t},\n\texample,\n};\n\nexport { name, settings };\n","/**\n * import Wordpress Dependencies\n */\n\nimport { __ } from '@wordpress/i18n';\nimport { registerBlockType } from '@wordpress/blocks';\n\n/**\n * import Block Settings\n */\n\nimport * as bar from './blocks/bar';\nimport * as pie from './blocks/pie';\nimport * as dougnut from './blocks/doughnut';\nimport * as line from './blocks/line';\nimport * as horizontalbar from './blocks/horizontal-bar';\nimport * as horizontalline from './blocks/horizontal-line';\n\nconst regsiterBlock = (block) => {\n\tconst { name, settings } = block;\n\tregisterBlockType(name, settings);\n};\n\nconst registerAllChartBlocks = () => {\n\tconst allBlocks = [bar, pie, dougnut, line, horizontalbar, horizontalline];\n\tallBlocks.forEach((block) => {\n\t\tregsiterBlock(block);\n\t});\n};\n\nregisterAllChartBlocks();\n","(function() { module.exports = window[\"wp\"][\"blockEditor\"]; }());","(function() { module.exports = window[\"wp\"][\"blocks\"]; }());","(function() { module.exports = window[\"wp\"][\"components\"]; }());","(function() { module.exports = window[\"wp\"][\"element\"]; }());","(function() { module.exports = window[\"wp\"][\"i18n\"]; }());"],"sourceRoot":""} -------------------------------------------------------------------------------- /charts-block.php: -------------------------------------------------------------------------------- 1 | "; 63 | print_r($attributes); 64 | echo ""; */ 65 | 66 | /* HTML OUTPUT START */ 67 | echo ' 68 |
69 | 74 | 75 |
76 | '; 77 | /* HTML OUTPUT END */ 78 | 79 | return ob_get_clean(); 80 | } 81 | 82 | 83 | // Register Blocks 84 | 85 | if( ! function_exists("sandip_charts_blocks_register_blocks")){ 86 | function sandip_charts_blocks_register_blocks($slug, $block_name){ 87 | register_block_type( $slug . '/' . $block_name, array( 88 | "editor_script" => $slug . '-script', 89 | "script" => $slug . '-frontendscript', 90 | 'attributes' => array( 91 | 'chartType' => array( 92 | "type" => "string", 93 | "default" => $block_name 94 | ), 95 | ), 96 | "render_callback" => "sandip_charts_blocks_render_all_charts" 97 | ) ); 98 | } 99 | } 100 | 101 | add_action("init", "sandip_charts_blocks_load_all_blocks_assets"); 102 | 103 | 104 | // Add new Block Category - charts_blocks 105 | 106 | if( ! function_exists("sandip_register_charts_blocks_category")){ 107 | 108 | function sandip_register_charts_blocks_category($categories) 109 | { 110 | $existing_categories = wp_list_pluck( $categories, 'slug' ); 111 | 112 | if( ! in_array("charts-blocks", $categories)) 113 | { 114 | $new_block_categories = array_merge($categories, array( 115 | array( 116 | "slug" => "charts-blocks", 117 | "title" => "Charts", 118 | "icons" => NULL 119 | ) 120 | )); 121 | 122 | return $new_block_categories; 123 | } 124 | } 125 | 126 | } 127 | 128 | add_filter("block_categories", "sandip_register_charts_blocks_category"); -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | Add New 35 | 3. Search for Charts Blocks 36 | 4. Install and Activate 37 | 38 | == Frequently Asked Questions == 39 | 40 | = Is Charts Blocks Free = 41 | 42 | Yes, Charts Blocks is 100% Free. 43 | 44 | = How do I create my first Chart = 45 | 46 | Navigate to the Page or Post where you want to add a chart. Select one Chart Block from the available chart blocks. Upload your CSV file. Your beautiful chart is ready for the world. 47 | 48 | = Why is my CSV data not showing in Charts = 49 | 50 | Download the example CSV file provided below the Upload CSV button. Make sure your data is in the specified format. 51 | 52 | = How can I add Grouped Bar Charts or Multiline Charts = 53 | 54 | Grouped Bar Charts, Multiline Charts and many more Chart Types will be added in the upcoming versions. 55 | 56 | == Screenshots == 57 | 58 | 1. Make Beautiful, Interactive and Animated Charts in just 2 steps! (Pie Chart Example) 59 | 2. Making Charts on Wordpress have never been this easy! (Bar Chart Example) 60 | 3. 6 different Chart Blocks. Explore them all! 61 | 4. Doughnut Chart Example 62 | 63 | 64 | -------------------------------------------------------------------------------- /screenshot-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thisissandip/charts-block/64911fec088c7dd3b7eed86ecb209f093440c367/screenshot-1.gif -------------------------------------------------------------------------------- /screenshot-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thisissandip/charts-block/64911fec088c7dd3b7eed86ecb209f093440c367/screenshot-2.gif -------------------------------------------------------------------------------- /screenshot-4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thisissandip/charts-block/64911fec088c7dd3b7eed86ecb209f093440c367/screenshot-4.gif -------------------------------------------------------------------------------- /src/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thisissandip/charts-block/64911fec088c7dd3b7eed86ecb209f093440c367/src/.DS_Store -------------------------------------------------------------------------------- /src/blocks/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thisissandip/charts-block/64911fec088c7dd3b7eed86ecb209f093440c367/src/blocks/.DS_Store -------------------------------------------------------------------------------- /src/blocks/Inspector.js: -------------------------------------------------------------------------------- 1 | import { useBlockProps, InspectorControls } from '@wordpress/block-editor'; 2 | import { useEffect, useState } from '@wordpress/element'; 3 | import { __ } from '@wordpress/i18n'; 4 | import { 5 | PanelBody, 6 | PanelRow, 7 | TextControl, 8 | FormFileUpload, 9 | Button, 10 | SelectControl, 11 | ColorPalette, 12 | ToggleControl, 13 | } from '@wordpress/components'; 14 | import { v4 as uuidv4 } from 'uuid'; 15 | 16 | function Inspector({ attributes, setAttributes, chartObj }) { 17 | const { title, labels, chartBgColor, labelType, chartType, sameColor } = 18 | attributes; 19 | 20 | // local states for Custom Label Colors 21 | const [labelOptions, setLabelOptions] = useState([]); 22 | const [selectedColor, setSelectedColor] = useState(chartBgColor[0]); 23 | const [selectedLabel, setSelectedLabel] = useState(labels[0]); 24 | 25 | useEffect(() => { 26 | // set the Labels in SelectControls required format in the. Labels will Change when a new CSV is uploaded 27 | processLabelsforOptions(); 28 | }, []); 29 | 30 | const processLabelsforOptions = () => { 31 | let alllabelForOptions = labels.map((label) => { 32 | return { 33 | value: label, 34 | label: label, 35 | }; 36 | }); 37 | setLabelOptions(alllabelForOptions); 38 | }; 39 | 40 | useEffect(() => { 41 | if (chartObj) { 42 | // Update the Labels in SelectControllers if new CSV is Uploadded 43 | processLabelsforOptions(); 44 | } 45 | }, [labels]); 46 | 47 | /* File Upload Start */ 48 | 49 | // handle CSV Upload from FormFileUpload Component and pass on result to DataPareser 50 | const handleCSVupload = (e) => { 51 | const CSVreader = new FileReader(); 52 | CSVreader.onload = () => { 53 | DataParser(CSVreader.result); 54 | }; 55 | CSVreader.readAsText(e.target.files[0]); 56 | setSelectedColor('#ff6385'); 57 | }; 58 | 59 | // Parse the Data in required Format and set new labels, chartdata and LabelType. (Label Type is what you see in Select Controller Select [LabelType] by default it is Language) 60 | const DataParser = (result) => { 61 | const table = result.split('\n').map((eachrow) => eachrow.split(',')); // First Split the data in rows and then separate the column values 62 | const columnnames = table[0]; // Get the column names which is the first item in rows array 63 | //const chartLabelType = columnnames[0]; 64 | table.shift(); // remove the first item which is column names to get the rows data 65 | const rowsdata = table; 66 | 67 | //Get the labels which is the second item in rows array 68 | const labels = rowsdata.map((row) => row[0]); 69 | //Get the data which is the second item in rows array 70 | const data = rowsdata.map((row) => parseInt(row[1])); 71 | 72 | setAttributes({ 73 | labels: labels, 74 | chartdata: data, 75 | // labelType: chartLabelType, 76 | }); 77 | }; 78 | 79 | /* File Upload End */ 80 | 81 | /* Label Bg Color Settings Start */ 82 | 83 | // If same color is selected, set the color to #812ffe and set set label to first label 84 | // else switch back to default colors 85 | useEffect(() => { 86 | if (chartObj) { 87 | if (sameColor) { 88 | setSelectedColor('#812ffe'); 89 | setSelectedLabel(labels[0]); 90 | } else { 91 | switchtoDefaultColors(); 92 | } 93 | } 94 | }, [sameColor]); 95 | 96 | const switchtoDefaultColors = () => { 97 | let defaultcolors = ['#ff6385', '#36a3eb', '#ffcc56', '#812ffe', '#00e893']; 98 | let newBgColorsFull = []; 99 | labels.forEach((item) => { 100 | if (newBgColorsFull.length <= labels.length) { 101 | newBgColorsFull.push(...defaultcolors); 102 | } 103 | }); 104 | 105 | let newBgColor = newBgColorsFull.slice(0, labels.length); 106 | setAttributes({ chartBgColor: [...newBgColor] }); 107 | setSelectedColor('#ff6385'); 108 | }; 109 | 110 | useEffect(() => { 111 | if (chartObj) { 112 | if (sameColor) { 113 | // When Same Color is Selected, Switch all bars to same color 114 | updateAllLabelColors(); 115 | } else { 116 | // if theLabel Color of currently selectedLabel is Changed, Update the Label Color 117 | updateLabelColor(); 118 | } 119 | } 120 | }, [selectedColor]); 121 | 122 | const updateLabelColor = () => { 123 | const labelIndex = labels.indexOf(selectedLabel); 124 | let newLabelColors = [...chartBgColor]; 125 | newLabelColors[labelIndex] = selectedColor; 126 | setAttributes({ chartBgColor: [...newLabelColors] }); 127 | }; 128 | 129 | const updateAllLabelColors = () => { 130 | setAttributes({ chartBgColor: [selectedColor] }); 131 | }; 132 | 133 | // set default selectedcolor of the current selectedlabel using it's index 134 | useEffect(() => { 135 | const labelIndex = labels.indexOf(selectedLabel); 136 | const color = chartBgColor[labelIndex]; 137 | if (chartObj && !sameColor) { 138 | setSelectedColor(color); 139 | } 140 | }, [selectedLabel]); 141 | 142 | /* Label Bg Color Settings End */ 143 | 144 | // ColorPallete Onchange Function 145 | const onLabelColorChange = (newColor) => { 146 | setSelectedColor(newColor); 147 | }; 148 | 149 | return ( 150 |
151 | 152 | 153 | 154 | setAttributes({ title })} 158 | /> 159 | 160 | 161 | ( 165 |
166 | 172 |
173 | )} 174 | /> 175 | 176 | 177 | Download Example CSV File 178 | 179 |
180 | 181 | {(chartType === 'bar' || chartType === 'line') && ( 182 |
183 | setAttributes({ sameColor: e })} 187 | /> 188 |
189 | )} 190 | 191 | {!sameColor && ( 192 | setSelectedLabel(label)} 196 | options={[ 197 | { 198 | value: null, 199 | label: `Select Label`, 200 | }, 201 | ...labelOptions, 202 | ]} 203 | /> 204 | )} 205 | 206 |

Select Color

207 | 219 |
220 |
221 |
222 | ); 223 | } 224 | 225 | export default Inspector; 226 | -------------------------------------------------------------------------------- /src/blocks/bar/block.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": 2, 3 | "name": "charts-blocks/bar", 4 | "category": "charts-blocks", 5 | "textdomain": "charts-blocks", 6 | "attributes": { 7 | "title": { 8 | "type": "string", 9 | "default": "Mostly Spoken Languages across the World" 10 | }, 11 | "labelType": { 12 | "type": "string", 13 | "default": "Language" 14 | }, 15 | "labels": { 16 | "type": "array", 17 | "default": ["English", "Spanish", "French"] 18 | }, 19 | "chartType": { 20 | "type": "string", 21 | "default": "bar" 22 | }, 23 | "chartdata": { 24 | "type": "array", 25 | "default": [300, 50, 100] 26 | }, 27 | "chartBgColor": { 28 | "type": "array", 29 | "default": ["#ff6385", "#36a3eb", "#ffcc56", "#812ffe", "#00e893"] 30 | }, 31 | "chartID": { 32 | "type": "string", 33 | "default": null 34 | }, 35 | "barAxes": { 36 | "type": "string", 37 | "default": "x" 38 | }, 39 | "sameColor": { 40 | "type": "boolean", 41 | "default": false 42 | } 43 | }, 44 | "supports": { 45 | "align": ["wide", "full"], 46 | "html": false 47 | }, 48 | "example": {}, 49 | "editorScript": "file:./build/index.js", 50 | "script": "file:./build/frontendscript.js" 51 | } 52 | -------------------------------------------------------------------------------- /src/blocks/bar/index.js: -------------------------------------------------------------------------------- 1 | import edit from '../edit'; 2 | import metadata from './block.json'; 3 | import { __ } from '@wordpress/i18n'; 4 | 5 | const { name, category, attributes, supports, textdomain, example } = metadata; 6 | 7 | const icon = ( 8 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | ); 25 | 26 | const settings = { 27 | title: __('Bar Chart', `${textdomain}`), 28 | description: __('Display your data in a Bar Chart.', `${textdomain}`), 29 | icon, 30 | category, 31 | keywords: [ 32 | __('Bar Chart', `${textdomain}`), 33 | __('Bar', `${textdomain}`), 34 | __('charts', `${textdomain}`), 35 | __('charts block', `${textdomain}`), 36 | __('charts-blocks', `${textdomain}`), 37 | __('graph', `${textdomain}`), 38 | __('graphs', `${textdomain}`), 39 | ], 40 | supports, 41 | attributes, 42 | edit, 43 | save: function () { 44 | return null; 45 | }, 46 | example, 47 | }; 48 | 49 | export { name, settings }; 50 | -------------------------------------------------------------------------------- /src/blocks/doughnut/block.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": 2, 3 | "name": "charts-blocks/doughnut", 4 | "category": "charts-blocks", 5 | "textdomain": "charts-blocks", 6 | "attributes": { 7 | "title": { 8 | "type": "string", 9 | "default": "Mostly Spoken Languages across the World" 10 | }, 11 | "labelType": { 12 | "type": "string", 13 | "default": "Language" 14 | }, 15 | "labels": { 16 | "type": "array", 17 | "default": ["English", "Spanish", "French"] 18 | }, 19 | "chartType": { 20 | "type": "string", 21 | "default": "doughnut" 22 | }, 23 | "chartdata": { 24 | "type": "array", 25 | "default": [300, 50, 100] 26 | }, 27 | "chartBgColor": { 28 | "type": "array", 29 | "default": ["#ff6385", "#36a3eb", "#ffcc56", "#812ffe", "#00e893"] 30 | }, 31 | "chartID": { 32 | "type": "string", 33 | "default": null 34 | } 35 | }, 36 | "supports": { 37 | "align": ["wide", "full"], 38 | "html": false 39 | }, 40 | "example": {}, 41 | "editorScript": "file:./build/index.js", 42 | "script": "file:./build/frontendscript.js" 43 | } 44 | -------------------------------------------------------------------------------- /src/blocks/doughnut/index.js: -------------------------------------------------------------------------------- 1 | import edit from '../edit'; 2 | import metadata from './block.json'; 3 | import { __ } from '@wordpress/i18n'; 4 | 5 | const { name, category, attributes, supports, textdomain, example } = metadata; 6 | 7 | const icon = ( 8 | 15 | 19 | 25 | 36 | 46 | 47 | 48 | ); 49 | 50 | const settings = { 51 | title: __('Doughnut Chart', `${textdomain}`), 52 | description: __('Display your data in a Doughnut Chart.', `${textdomain}`), 53 | icon, 54 | category, 55 | keywords: [ 56 | __('Doughnut chart', `${textdomain}`), 57 | __('Doughnut', `${textdomain}`), 58 | __('charts', `${textdomain}`), 59 | __('charts block', `${textdomain}`), 60 | __('charts-blocks', `${textdomain}`), 61 | __('graph', `${textdomain}`), 62 | __('graphs', `${textdomain}`), 63 | ], 64 | supports, 65 | attributes, 66 | edit, 67 | save: function () { 68 | return null; 69 | }, 70 | example, 71 | }; 72 | 73 | export { name, settings }; 74 | -------------------------------------------------------------------------------- /src/blocks/edit.js: -------------------------------------------------------------------------------- 1 | import { __ } from '@wordpress/i18n'; 2 | import { useBlockProps } from '@wordpress/block-editor'; 3 | import { useEffect, useRef, useState } from '@wordpress/element'; 4 | import Inspector from './Inspector'; 5 | import { v4 as uuidv4 } from 'uuid'; 6 | 7 | export default function Edit({ attributes, setAttributes, className }) { 8 | const mycanvas = useRef(); 9 | 10 | const { 11 | labels, 12 | title, 13 | chartdata, 14 | chartBgColor, 15 | labelType, 16 | barAxes, 17 | chartID, 18 | chartType, 19 | } = attributes; 20 | 21 | const [chartObj, setChartObj] = useState(null); 22 | 23 | useEffect(() => { 24 | // if chartID is null then create a unique id for the frontend Chart 25 | if (!chartID) { 26 | const uid = uuidv4(); 27 | setAttributes({ chartID: `chart-${uid}` }); 28 | } 29 | 30 | let chartInstance = new Chart(mycanvas.current, { 31 | type: chartType, 32 | data: { 33 | labels, 34 | datasets: [ 35 | { 36 | data: chartdata, 37 | backgroundColor: chartBgColor, 38 | hoverOffset: 2, 39 | }, 40 | ], 41 | }, 42 | options: { 43 | indexAxis: barAxes ? barAxes : null, 44 | /* fill: true, 45 | backgroundColor: 'rgba(244, 144, 128, 0.1)', */ 46 | responsive: true, 47 | plugins: { 48 | title: { 49 | display: true, 50 | text: title, 51 | }, 52 | legend: { 53 | display: chartType === 'bar' || chartType === 'line' ? false : true, 54 | }, 55 | }, 56 | }, 57 | }); 58 | setChartObj(chartInstance); 59 | }, []); 60 | 61 | useEffect(() => { 62 | if (chartObj) { 63 | /* If New CSV is uploaded Update Chart settings and Re Render the canvas */ 64 | updateChartSettings(); 65 | } 66 | }, [chartdata]); 67 | 68 | const updateChartSettings = () => { 69 | /* Function to Remove the Old Dataset and Push the Uploaded one */ 70 | filterData(chartObj); 71 | chartObj.data.labels = labels; 72 | chartObj.update(); 73 | }; 74 | 75 | function filterData(chart) { 76 | if (chartType === 'bar' || chartType === 'line') { 77 | /* Old dataset length */ 78 | const existingdataLength = chart.data.datasets[0].data.length; 79 | 80 | // exisiting colors 81 | let colors = [...chartBgColor]; 82 | 83 | /* From the existing dataset, remove the old data set items 84 | and push the new uploaded dataset to it */ 85 | chartdata.forEach((dataitem, index) => { 86 | if (index < existingdataLength) { 87 | chart.data.datasets[0].data.shift(); 88 | } 89 | chart.data.datasets[0].data.push(dataitem); 90 | 91 | // if the dataset has new bars (that is if it's length is greater than existing) 92 | // add colors for the new for the new bars 93 | if (chartBgColor.length <= chartdata.length) { 94 | chartBgColor.push(...colors); 95 | } 96 | }); 97 | let newBgColor = chartBgColor.slice(0, chartdata.length); 98 | setAttributes({ chartBgColor: newBgColor }); 99 | } else { 100 | chartObj.data.datasets[0].data = chartdata; 101 | } 102 | } 103 | 104 | // If the Bg color of label or The title is Changed, Update the Chart 105 | useEffect(() => { 106 | if (chartObj) { 107 | chartObj.options.plugins.title.text = title; 108 | chartObj.data.datasets[0].backgroundColor = chartBgColor; 109 | chartObj.update(); 110 | } 111 | }, [chartBgColor, title]); 112 | 113 | return ( 114 |
115 |
116 | 121 | 127 |
128 |
129 | ); 130 | } 131 | -------------------------------------------------------------------------------- /src/blocks/frontend.js: -------------------------------------------------------------------------------- 1 | function displayAllCharts() { 2 | allchartsdata.forEach((chart) => { 3 | let chartctx = document.querySelector(`#${chart.chartID}`); 4 | 5 | let labels = chart.labels ? chart.labels : ['English', 'Spanish', 'French']; 6 | let data = chart.chartdata ? chart.chartdata : [300, 50, 100]; 7 | let bgColors = chart.chartBgColor 8 | ? chart.chartBgColor 9 | : ['#ff6385', '#36a3eb', '#ffcc56', '#812ffe', '#00e893']; 10 | let title = chart.title 11 | ? chart.title 12 | : 'Mostly spoken languages across the world'; 13 | 14 | let currentChartType = chart.chartType; 15 | let indexAxis = null; 16 | 17 | let chartTypeArray = chart.chartType.split(''); 18 | if (chartTypeArray.length > 9) { 19 | let currentChartTypeArray = chartTypeArray.slice(11); 20 | currentChartType = currentChartTypeArray.join(''); 21 | indexAxis = 'y'; 22 | } 23 | 24 | if (chartctx) { 25 | var myChart = new Chart(chartctx, { 26 | type: currentChartType, 27 | data: { 28 | labels: labels, 29 | datasets: [ 30 | { 31 | data: data, 32 | backgroundColor: bgColors, 33 | hoverOffset: 2, 34 | }, 35 | ], 36 | }, 37 | options: { 38 | indexAxis: indexAxis, 39 | responsive: true, 40 | plugins: { 41 | title: { 42 | display: true, 43 | text: title, 44 | }, 45 | legend: { 46 | display: 47 | currentChartType === 'bar' || currentChartType === 'line' 48 | ? false 49 | : true, 50 | }, 51 | }, 52 | }, 53 | }); 54 | } 55 | }); 56 | } 57 | if (allchartsdata.length > 0) { 58 | displayAllCharts(); 59 | } 60 | -------------------------------------------------------------------------------- /src/blocks/horizontal-bar/block.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": 2, 3 | "name": "charts-blocks/horizontal-bar", 4 | "category": "charts-blocks", 5 | "textdomain": "charts-blocks", 6 | "attributes": { 7 | "title": { 8 | "type": "string", 9 | "default": "Mostly Spoken Languages across the World" 10 | }, 11 | "labelType": { 12 | "type": "string", 13 | "default": "Language" 14 | }, 15 | "labels": { 16 | "type": "array", 17 | "default": ["English", "Spanish", "French"] 18 | }, 19 | "chartType": { 20 | "type": "string", 21 | "default": "bar" 22 | }, 23 | "chartdata": { 24 | "type": "array", 25 | "default": [300, 50, 100] 26 | }, 27 | "chartBgColor": { 28 | "type": "array", 29 | "default": ["#ff6385", "#36a3eb", "#ffcc56", "#812ffe", "#00e893"] 30 | }, 31 | "chartID": { 32 | "type": "string", 33 | "default": null 34 | }, 35 | "barAxes": { 36 | "type": "string", 37 | "default": "y" 38 | } 39 | }, 40 | "supports": { 41 | "align": ["wide", "full"], 42 | "html": false 43 | }, 44 | "example": {}, 45 | "editorScript": "file:./build/index.js", 46 | "script": "file:./build/frontendscript.js" 47 | } 48 | -------------------------------------------------------------------------------- /src/blocks/horizontal-bar/index.js: -------------------------------------------------------------------------------- 1 | import edit from '../edit'; 2 | import metadata from './block.json'; 3 | import { __ } from '@wordpress/i18n'; 4 | 5 | const { name, category, attributes, supports, textdomain, example } = metadata; 6 | 7 | const icon = ( 8 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | ); 25 | 26 | const settings = { 27 | title: __('Horizontal Bar Chart', `${textdomain}`), 28 | description: __( 29 | 'Display your data in a Horizontal Bar Chart.', 30 | `${textdomain}` 31 | ), 32 | icon: icon, 33 | category, 34 | keywords: [ 35 | __('Horizontal Bar Chart', `${textdomain}`), 36 | __('Horizontal Bar', `${textdomain}`), 37 | __('charts', `${textdomain}`), 38 | __('charts block', `${textdomain}`), 39 | __('charts-blocks', `${textdomain}`), 40 | __('graph', `${textdomain}`), 41 | __('graphs', `${textdomain}`), 42 | ], 43 | supports, 44 | attributes, 45 | edit, 46 | save: function () { 47 | return null; 48 | }, 49 | example, 50 | }; 51 | 52 | export { name, settings }; 53 | -------------------------------------------------------------------------------- /src/blocks/horizontal-line/block.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": 2, 3 | "name": "charts-blocks/horizontal-line", 4 | "category": "charts-blocks", 5 | "textdomain": "charts-blocks", 6 | "attributes": { 7 | "title": { 8 | "type": "string", 9 | "default": "Mostly Spoken Languages across the World" 10 | }, 11 | "labelType": { 12 | "type": "string", 13 | "default": "Language" 14 | }, 15 | "labels": { 16 | "type": "array", 17 | "default": ["English", "Spanish", "French"] 18 | }, 19 | "chartType": { 20 | "type": "string", 21 | "default": "line" 22 | }, 23 | "chartdata": { 24 | "type": "array", 25 | "default": [300, 50, 100] 26 | }, 27 | "chartBgColor": { 28 | "type": "array", 29 | "default": ["#ff6385", "#36a3eb", "#ffcc56", "#812ffe", "#00e893"] 30 | }, 31 | "chartID": { 32 | "type": "string", 33 | "default": null 34 | }, 35 | "barAxes": { 36 | "type": "string", 37 | "default": "y" 38 | } 39 | }, 40 | "supports": { 41 | "align": ["wide", "full"], 42 | "html": false 43 | }, 44 | "example": {}, 45 | "editorScript": "file:./build/index.js", 46 | "script": "file:./build/frontendscript.js" 47 | } 48 | -------------------------------------------------------------------------------- /src/blocks/horizontal-line/index.js: -------------------------------------------------------------------------------- 1 | import edit from '../edit'; 2 | import metadata from './block.json'; 3 | import { __ } from '@wordpress/i18n'; 4 | 5 | const { name, category, attributes, supports, textdomain, example } = metadata; 6 | 7 | const icon = ( 8 | 15 | 19 | 23 | 34 | 35 | 36 | ); 37 | 38 | const settings = { 39 | title: __('Horizontal Line Chart', `${textdomain}`), 40 | description: __( 41 | 'Display your data in a Horizontal Line Chart.', 42 | `${textdomain}` 43 | ), 44 | icon, 45 | category, 46 | keywords: [ 47 | __('Horizontal Line Chart', `${textdomain}`), 48 | __('Horizontal Line ', `${textdomain}`), 49 | __('charts', `${textdomain}`), 50 | __('charts block', `${textdomain}`), 51 | __('charts-blocks', `${textdomain}`), 52 | __('graph', `${textdomain}`), 53 | __('graphs', `${textdomain}`), 54 | ], 55 | supports, 56 | attributes, 57 | edit, 58 | save: function () { 59 | return null; 60 | }, 61 | example, 62 | }; 63 | 64 | export { name, settings }; 65 | -------------------------------------------------------------------------------- /src/blocks/line/block.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": 2, 3 | "name": "charts-blocks/line", 4 | "category": "charts-blocks", 5 | "textdomain": "charts-blocks", 6 | "attributes": { 7 | "title": { 8 | "type": "string", 9 | "default": "Mostly Spoken Languages across the World" 10 | }, 11 | "labelType": { 12 | "type": "string", 13 | "default": "Language" 14 | }, 15 | "labels": { 16 | "type": "array", 17 | "default": ["English", "Spanish", "French"] 18 | }, 19 | "chartType": { 20 | "type": "string", 21 | "default": "line" 22 | }, 23 | "chartdata": { 24 | "type": "array", 25 | "default": [300, 50, 100] 26 | }, 27 | "chartBgColor": { 28 | "type": "array", 29 | "default": ["#ff6385", "#36a3eb", "#ffcc56", "#812ffe", "#00e893"] 30 | }, 31 | "chartID": { 32 | "type": "string", 33 | "default": null 34 | } 35 | }, 36 | "supports": { 37 | "align": ["wide", "full"], 38 | "html": false 39 | }, 40 | "example": {}, 41 | "editorScript": "file:./build/index.js", 42 | "script": "file:./build/frontendscript.js" 43 | } 44 | -------------------------------------------------------------------------------- /src/blocks/line/index.js: -------------------------------------------------------------------------------- 1 | import edit from '../edit'; 2 | import metadata from './block.json'; 3 | import { __ } from '@wordpress/i18n'; 4 | 5 | const { name, category, attributes, supports, textdomain, example } = metadata; 6 | 7 | const icon = ( 8 | 15 | 19 | 23 | 34 | 35 | 36 | ); 37 | 38 | const settings = { 39 | title: __('Line Chart', `${textdomain}`), 40 | description: __('Display your data in a Line Chart.', `${textdomain}`), 41 | icon, 42 | category, 43 | keywords: [ 44 | __('Line chart', `${textdomain}`), 45 | __('Line', `${textdomain}`), 46 | __('charts', `${textdomain}`), 47 | __('charts block', `${textdomain}`), 48 | __('charts-blocks', `${textdomain}`), 49 | __('graph', `${textdomain}`), 50 | __('graphs', `${textdomain}`), 51 | ], 52 | supports, 53 | attributes, 54 | edit, 55 | save: function () { 56 | return null; 57 | }, 58 | example, 59 | }; 60 | 61 | export { name, settings }; 62 | -------------------------------------------------------------------------------- /src/blocks/pie/block.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": 2, 3 | "name": "charts-blocks/pie", 4 | "category": "charts-blocks", 5 | "textdomain": "charts-blocks", 6 | "attributes": { 7 | "title": { 8 | "type": "string", 9 | "default": "Mostly spoken languages across the world" 10 | }, 11 | "labelType": { 12 | "type": "string", 13 | "default": "Language" 14 | }, 15 | "labels": { 16 | "type": "array", 17 | "default": ["English", "Spanish", "French"] 18 | }, 19 | "chartType": { 20 | "type": "string", 21 | "default": "pie" 22 | }, 23 | "chartdata": { 24 | "type": "array", 25 | "default": [300, 50, 100] 26 | }, 27 | "chartBgColor": { 28 | "type": "array", 29 | "default": ["#ff6385", "#36a3eb", "#ffcc56", "#812ffe", "#00e893"] 30 | }, 31 | "chartID": { 32 | "type": "string", 33 | "default": null 34 | } 35 | }, 36 | "supports": { 37 | "align": ["wide", "full"], 38 | "html": false 39 | }, 40 | "example": {}, 41 | "editorScript": "file:./build/index.js", 42 | "script": "file:./build/frontendscript.js" 43 | } 44 | -------------------------------------------------------------------------------- /src/blocks/pie/index.js: -------------------------------------------------------------------------------- 1 | import edit from '../edit'; 2 | import metadata from './block.json'; 3 | import { __ } from '@wordpress/i18n'; 4 | 5 | const { name, category, attributes, supports, textdomain, example } = metadata; 6 | 7 | const icon = ( 8 | 15 | 19 | 24 | 36 | 37 | 38 | ); 39 | 40 | const settings = { 41 | title: __('Pie Chart', `${textdomain}`), 42 | description: __('Display your data in a Pie Chart.', `${textdomain}`), 43 | icon, 44 | category, 45 | keywords: [ 46 | __('Pie chart', `${textdomain}`), 47 | __('Pie', `${textdomain}`), 48 | __('charts', `${textdomain}`), 49 | __('charts block', `${textdomain}`), 50 | __('charts-blocks', `${textdomain}`), 51 | __('graph', `${textdomain}`), 52 | __('graphs', `${textdomain}`), 53 | ], 54 | supports, 55 | attributes, 56 | edit, 57 | save: function () { 58 | return null; 59 | }, 60 | example, 61 | }; 62 | 63 | export { name, settings }; 64 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * import Wordpress Dependencies 3 | */ 4 | 5 | import { __ } from '@wordpress/i18n'; 6 | import { registerBlockType } from '@wordpress/blocks'; 7 | 8 | /** 9 | * import Block Settings 10 | */ 11 | 12 | import * as bar from './blocks/bar'; 13 | import * as pie from './blocks/pie'; 14 | import * as dougnut from './blocks/doughnut'; 15 | import * as line from './blocks/line'; 16 | import * as horizontalbar from './blocks/horizontal-bar'; 17 | import * as horizontalline from './blocks/horizontal-line'; 18 | 19 | const regsiterBlock = (block) => { 20 | const { name, settings } = block; 21 | registerBlockType(name, settings); 22 | }; 23 | 24 | const registerAllChartBlocks = () => { 25 | const allBlocks = [bar, pie, dougnut, line, horizontalbar, horizontalline]; 26 | allBlocks.forEach((block) => { 27 | regsiterBlock(block); 28 | }); 29 | }; 30 | 31 | registerAllChartBlocks(); 32 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const defaultConfig = require('@wordpress/scripts/config/webpack.config'); 2 | const path = require('path'); 3 | const IgnoreEmitPlugin = require('ignore-emit-webpack-plugin'); 4 | 5 | module.exports = { 6 | ...defaultConfig, 7 | entry: { 8 | ...defaultConfig.entry, 9 | frontendscript: path.join(__dirname, '/src/blocks/frontend.js'), 10 | }, 11 | plugins: [ 12 | ...defaultConfig.plugins, 13 | new IgnoreEmitPlugin(['frontendscript.asset.php']), 14 | ], 15 | }; 16 | --------------------------------------------------------------------------------