-
Notifications
You must be signed in to change notification settings - Fork 0
/
template-repeater.js.map
1 lines (1 loc) · 4.84 KB
/
template-repeater.js.map
1
{"version":3,"sources":["webpack:///webpack/bootstrap 0932b0bcf1e9f92daf57","webpack:///./src/template-repeater.js"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;KC9BM;;;;;;;;;;;4CAEiB;AACf,kBAAK,QAAL,GAAgB,KAAK,aAAL,CAAmB,UAAnB,CAAhB,CADe;AAEf,kBAAK,MAAL,CAAY,KAAK,YAAL,CAAkB,SAAlB,CAAZ,EAFe;;;;gCAKZ,KAAK;AACR,iBAAM,cAAc,wCAAd,CADE;AAER,iBAAI,WAAgB,KAAK,QAAL,CAFZ;AAGR,iBAAI,UAAgB,iBAAiB,QAAjB,CAA0B,GAA1B,CAAhB,CAHI;AAIR,kBAAK,SAAL,GAAiB,CAAC,MAAM,OAAN,CAAc,OAAd,IAAyB,QAAQ,GAAR,CAAY,gBAAZ,CAAzB,GAAyD,IAAI,KAAJ,CAAU,WAAV,EAAuB,OAAvB,CAA1D,CAA0F,IAA1F,CAA+F,EAA/F,CAAjB,CAJQ;;AAMR,sBAAS,gBAAT,CAA0B,IAA1B,EAA+B;AAC3B,wBAAO,iBAAiB,WAAjB,CAA6B,SAAS,SAAT,CAAmB,IAAnB,CAA7B,EAAuD,IAAvD,CAAP,CAD2B;cAA/B;;AAKA,oBAAO,KAAK,SAAL,CAXC;;;;kDAca,MAAM,QAAQ,QAAQ;AAC3C,iBAAG,SAAS,SAAT,IAAsB,OAAO,MAAP,KAAkB,QAAlB,EAA4B;AACjD,sBAAK,YAAL,CAAkB,SAAlB,EAA6B,EAA7B,EADiD;AAEjD,sBAAK,MAAL,CAAY,MAAZ,EAFiD;cAArD;;;;qCAMe,UAAU,SAAS;AAClC,iBAAI,aAAa,OAAO,IAAP,CAAY,OAAZ,CAAb,CAD8B;AAElC,iBAAI,cAAc,EAAd,CAF8B;;AAIlC,iBAAI,QAAO,yDAAP,IAAkB,QAAlB,EAA4B;qBAInB,qBAAT,SAAS,kBAAT,CAA4B,IAA5B,EAAiC;AAC7B,8BAAS,SAAT,GAAqB,SAAS,SAAT,CAAmB,OAAnB,CAA2B,OAAO,IAAP,GAAc,GAAd,EAAmB,QAAQ,IAAR,CAA9C,CAArB,CAD6B;kBAAjC,CAJ4B;;AAE5B,4BAAW,OAAX,CAAmB,kBAAnB,EAF4B;;AAQ5B,gCAAe,SAAS,SAAT,CARa;cAAhC;;AAWA,oBAAO,WAAP,CAfkC;;;;kCAmBtB,KAAK;AACjB,iBAAI,MAAM,IAAN,CADa;AAEjB,iBAAI,OAAO,GAAP,IAAc,QAAd,EAAwB;AACxB,qBAAI;AAAE,2BAAM,KAAK,KAAL,CAAW,GAAX,CAAN,CAAF;kBAAJ,CACE,OAAO,CAAP,EAAU;AAAE,2BAAM,IAAI,KAAJ,CAAU,gCAAV,CAAN,CAAF;kBAAV;cAFN;AAIA,oBAAO,GAAP,CANiB;;;;YA/CnB;GAAyB;;AAyD/B,UAAS,eAAT,CAAyB,mBAAzB,EAA8C,gBAA9C,E","file":"template-repeater.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\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\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.loaded = 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// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 0932b0bcf1e9f92daf57\n **/","/**\n * This is a fork of a repeater created by Leon Revill (https://github.com/RevillWeb/rebel-repeater).\n *\n * Blog: http://www.revilweb.com\n * GitHub: https://github.com/RevillWeb\n * Twitter: @RevillWeb\n */\n\nclass TemplateRepeater extends HTMLElement {\n\n attachedCallback() {\n this.template = this.querySelector('template');\n this.render(this.getAttribute('content'));\n }\n\n render(val) {\n const renderError = \"Content should be an Array of objects.\";\n let template = this.template;\n let content = TemplateRepeater.fromJson(val);\n this.innerHTML = (Array.isArray(content) ? content.map(andApplyTemplate) : new Error(renderError).message).join('') ;\n\n function andApplyTemplate(item){\n return TemplateRepeater.interpolate(template.cloneNode(true), item);\n }\n\n\n return this.innerHTML;\n }\n\n attributeChangedCallback(name, oldVal, newVal) {\n if(name === \"content\" && typeof oldVal === 'string') {\n this.setAttribute('content', '');\n this.render(newVal);\n }\n }\n\n static interpolate(template, content) {\n let contentArr = Object.keys(content);\n let updatedHTML = \"\";\n\n if (typeof content == \"object\") {\n\n contentArr.forEach(andIterateOverData);\n\n function andIterateOverData(item){\n template.innerHTML = template.innerHTML.replace(\"${\" + item + \"}\", content[item]);\n }\n\n updatedHTML += template.innerHTML;\n }\n\n return updatedHTML;\n\n }\n\n static fromJson(str) {\n let obj = null;\n if (typeof str == \"string\") {\n try { obj = JSON.parse(str);\n } catch (e) { throw new Error(\"Invalid JSON string provided. \"); }\n }\n return obj;\n }\n}\n\ndocument.registerElement(\"template-repeater\", TemplateRepeater);\n\n\n/** WEBPACK FOOTER **\n ** ./src/template-repeater.js\n **/"],"sourceRoot":""}