From 8d935e77859a59be94db9f70a42e33b81d2c66ba Mon Sep 17 00:00:00 2001 From: Genadi Sokolov Date: Thu, 10 Dec 2015 11:01:43 +0200 Subject: [PATCH] chore(all) release --- dist/amd/mdl.js | 39 ++++++++++++++++++++++----------------- dist/amd/mdl.js.map | 2 +- dist/commonjs/mdl.js | 39 ++++++++++++++++++++++----------------- dist/commonjs/mdl.js.map | 2 +- dist/es6/mdl.js | 19 +++++++++++++++++++ dist/system/mdl.js | 39 ++++++++++++++++++++++----------------- dist/system/mdl.js.map | 2 +- src/mdl.js | 2 +- 8 files changed, 89 insertions(+), 55 deletions(-) diff --git a/dist/amd/mdl.js b/dist/amd/mdl.js index a57f864..4ba6d22 100644 --- a/dist/amd/mdl.js +++ b/dist/amd/mdl.js @@ -117,28 +117,33 @@ define(['exports', 'aurelia-framework', 'encapsulated-mdl', 'aurelia-event-aggre if (element.classList.contains('mdl-js-ripple-effect')) { _encapsulatedMdl.componentHandler.upgradeElement(element, 'MaterialRipple'); } - var elements = element.querySelectorAll('.mdl-js-ripple-effect'); - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - try { - for (var _iterator = elements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var el = _step.value; + if (element.MaterialIconToggle) { + var children = element.children; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; - _encapsulatedMdl.componentHandler.upgradeElement(el, 'MaterialRipple'); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { try { - if (!_iteratorNormalCompletion && _iterator['return']) { - _iterator['return'](); + for (var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var child = _step.value; + + if (child.classList.contains('mdl-js-ripple-effect')) { + _encapsulatedMdl.componentHandler.upgradeElement(child, 'MaterialRipple'); + } } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; } finally { - if (_didIteratorError) { - throw _iteratorError; + try { + if (!_iteratorNormalCompletion && _iterator['return']) { + _iterator['return'](); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } } } } diff --git a/dist/amd/mdl.js.map b/dist/amd/mdl.js.map index 6bc1ee2..e7971dc 100644 --- a/dist/amd/mdl.js.map +++ b/dist/amd/mdl.js.map @@ -1 +1 @@ -{"version":3,"sources":["mdl.js"],"names":[],"mappings":";;;;;;;;;;;AAIA,MAAI,QAAQ,GAAG;AACb,UAAM,EAAE;AACN,UAAI,EAAE,CAAC,YAAY,EAAE,eAAe,CAAC;AACrC,QAAE,EAAE,CAAC,gBAAgB,CAAC;AACtB,SAAG,EAAE,CAAC,YAAY,CAAC;KACpB;AACD,aAAS,EAAE;AACT,QAAE,EAAE,CAAC,mBAAmB,CAAC;AACzB,UAAI,EAAE,CAAC,eAAe,EAAE,kBAAkB,CAAC;AAC3C,SAAG,EAAE,EAAE;KACR;AACD,UAAM,EAAE;AACN,QAAE,EAAE,CAAC,gBAAgB,CAAC;AACtB,UAAI,EAAE,CAAC,YAAY,EAAE,eAAe,CAAC;AACrC,SAAG,EAAE,CAAC,YAAY,CAAC;KACpB;AACD,QAAI,EAAE;AACJ,QAAE,EAAE,CAAC,cAAc,CAAC;AACpB,UAAI,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC;AACjC,SAAG,EAAE,CAAC,YAAY,CAAC;KACpB;AACD,gBAAY,EAAE;AACZ,QAAE,EAAE,CAAC,mBAAmB,CAAC;AACzB,UAAI,EAAE,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;AAC7C,SAAG,EAAE,CAAC,YAAY,CAAC;KACpB;AACD,QAAI,EAAE;AACJ,QAAE,EAAE,CAAC,cAAc,CAAC;AACpB,UAAI,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC;AACjC,SAAG,EAAE,CAAC,YAAY,CAAC;KACpB;AACD,UAAM,EAAE;AACN,QAAE,EAAE,CAAC,gBAAgB,CAAC;AACtB,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;;;;AACD,4BAAc,EAAE;YAAP,CAAC;AAAQ,yBA5HZ,gBAAgB,CA4Ha,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;OAAA;;;;;;;;;;;;;;;;;;;;;AAC9D,4BAAc,GAAG;YAAR,CAAC;AAAS,SAAC,CAAC,OAAO,CAAC,CAAC;OAAA;;;;;;;;;;;;;;;GAC/B;;MAIY,kBAAkB;AAElB,aAFA,kBAAkB,CAEjB,OAAO,EAAE,eAAe,EAAE;;;AACpC,UAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,UAAI,CAAC,eAAe,GAAG,eAAe,CAAC;KACxC;;iBALU,kBAAkB;;aAOrB,oBAAG;AAET,sBAAc,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;AACzC,YAAI,OAAO,GAAG,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAC,CAAC;AACpD,YAAI,CAAC,eAAe,CAAC,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;OAChE;;;8BAZU,kBAAkB;AAAlB,sBAAkB,GAD9B,sBAlIe,eAAe,EAkId,KAAK,CAAC,CACV,kBAAkB,KAAlB,kBAAkB;AAAlB,sBAAkB,GAF9B,sBAjIO,MAAM,EAiIN,OAAO,0BA/HP,eAAe,CA+HU,CAEpB,kBAAkB,KAAlB,kBAAkB;WAAlB,kBAAkB","file":"mdl.js","sourcesContent":["import {inject, customAttribute} from 'aurelia-framework';\r\nimport {componentHandler} from 'encapsulated-mdl';\r\nimport {EventAggregator} from 'aurelia-event-aggregator';\r\n\r\nlet mdlTypes = {\r\n button: {\r\n html: ['mdl-button', 'mdl-js-button'],\r\n js: ['MaterialButton'],\r\n fct: [manageRipple]\r\n },\r\n textfield: {\r\n js: ['MaterialTextfield'],\r\n html: ['mdl-textfield', 'mdl-js-textfield'],\r\n fct: []\r\n },\r\n layout: {\r\n js: ['MaterialLayout'],\r\n html: ['mdl-layout', 'mdl-js-layout'],\r\n fct: [manageRipple]\r\n },\r\n menu: {\r\n js: ['MaterialMenu'],\r\n html: ['mdl-menu', 'mdl-js-menu'],\r\n fct: [manageRipple]\r\n },\r\n 'data-table': {\r\n js: ['MaterialDataTable'],\r\n html: ['mdl-data-table', 'mdl-js-data-table'],\r\n fct: [manageRipple]\r\n },\r\n tabs: {\r\n js: ['MaterialTabs'],\r\n html: ['mdl-tabs', 'mdl-js-tabs'],\r\n fct: [manageRipple]\r\n },\r\n slider: {\r\n js: ['MaterialSlider'],\r\n html: ['mdl-slider', 'mdl-js-slider'],\r\n fct: []\r\n },\r\n tooltip: {\r\n js: ['MaterialTooltip'],\r\n html: ['mdl-tooltip'],\r\n fct: []\r\n },\r\n progress: {\r\n js: ['MaterialProgress'],\r\n html: ['mdl-progress', 'mdl-js-progress'],\r\n fct: []\r\n },\r\n spinner: {\r\n js: ['MaterialSpinner'],\r\n html: ['mdl-spinner', 'mdl-js-spinner'],\r\n fct: []\r\n },\r\n badge: {\r\n js: [],\r\n html: ['mdl-badge'],\r\n fct: []\r\n },\r\n switch: {\r\n js: ['MaterialSwitch'],\r\n html: ['mdl-switch', 'mdl-js-switch'],\r\n fct: [manageRipple]\r\n },\r\n radio: {\r\n js: ['MaterialRadio'],\r\n html: ['mdl-radio', 'mdl-js-radio'],\r\n fct: [manageRipple]\r\n },\r\n 'icon-toggle': {\r\n js: ['MaterialIconToggle'],\r\n html: ['mdl-icon-toggle', 'mdl-js-icon-toggle'],\r\n fct: [manageRipple]\r\n },\r\n checkbox: {\r\n js: ['MaterialCheckbox'],\r\n html: ['mdl-checkbox', 'mdl-js-checkbox'],\r\n fct: [manageRipple]\r\n },\r\n dialog: {\r\n js: ['MaterialDialog'],\r\n html: ['mdl-dialog', 'mdl-js-dialog'],\r\n fct: []\r\n },\r\n 'mega-footer': {\r\n js: [],\r\n html: ['mdl-mega-footer'],\r\n fct: []\r\n },\r\n 'mini-footer': {\r\n js: [],\r\n html: ['mdl-mini-footer'],\r\n fct: []\r\n },\r\n grid: {\r\n js: [],\r\n html: ['mdl-grid'],\r\n fct: []\r\n },\r\n snackbar: {\r\n js: ['MaterialSnackbar'],\r\n html: ['mdl-snackbar'],\r\n fct: []\r\n }\r\n\r\n};\r\n\r\nfunction manageRipple(element) {\r\n if (element.classList.contains('mdl-js-ripple-effect')) {\r\n componentHandler.upgradeElement(element, 'MaterialRipple');\r\n }\r\n let elements = element.querySelectorAll('.mdl-js-ripple-effect');\r\n for (let el of elements) {\r\n componentHandler.upgradeElement(el, 'MaterialRipple');\r\n }\r\n}\r\n\r\nfunction upgradeElement(element, type) {\r\n let {html, fct, js} = (mdlTypes[type] || {});\r\n if (html) {\r\n for (let h of html) {\r\n element.classList.add(h);\r\n }\r\n }\r\n for (let t of js) componentHandler.upgradeElement(element, t);\r\n for (let f of fct) f(element);\r\n}\r\n\r\n@inject(Element, EventAggregator)\r\n@customAttribute('mdl')\r\nexport class MDLCustomAttribute {\r\n\r\n constructor(element, eventAggregator) {\r\n this.element = element;\r\n this.eventAggregator = eventAggregator;\r\n }\r\n\r\n attached() {\r\n //console.log(\"mdl attached: \" + this.value);\r\n upgradeElement(this.element, this.value);\r\n let payload = {publisher: this, data: this.element};\r\n this.eventAggregator.publish('mdl:component:upgrade', payload);\r\n }\r\n}\r\n"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["mdl.js"],"names":[],"mappings":";;;;;;;;;;;AAIA,MAAI,QAAQ,GAAG;AACb,UAAM,EAAE;AACN,UAAI,EAAE,CAAC,YAAY,EAAE,eAAe,CAAC;AACrC,QAAE,EAAE,CAAC,gBAAgB,CAAC;AACtB,SAAG,EAAE,CAAC,YAAY,CAAC;KACpB;AACD,aAAS,EAAE;AACT,QAAE,EAAE,CAAC,mBAAmB,CAAC;AACzB,UAAI,EAAE,CAAC,eAAe,EAAE,kBAAkB,CAAC;AAC3C,SAAG,EAAE,EAAE;KACR;AACD,UAAM,EAAE;AACN,QAAE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AI,OAAO,GAAG,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAC,CAAC;AACpD,YAAI,CAAC,eAAe,CAAC,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;OAChE;;;8BAZU,kBAAkB;AAAlB,sBAAkB,GAD9B,sBArJe,eAAe,EAqJd,KAAK,CAAC,CACV,kBAAkB,KAAlB,kBAAkB;AAAlB,sBAAkB,GAF9B,sBApJO,MAAM,EAoJN,OAAO,0BAlJP,eAAe,CAkJU,CAEpB,kBAAkB,KAAlB,kBAAkB;WAAlB,kBAAkB","file":"mdl.js","sourcesContent":["import {inject, customAttribute} from 'aurelia-framework';\nimport {componentHandler} from 'encapsulated-mdl';\nimport {EventAggregator} from 'aurelia-event-aggregator';\n\nlet mdlTypes = {\n button: {\n html: ['mdl-button', 'mdl-js-button'],\n js: ['MaterialButton'],\n fct: [manageRipple]\n },\n textfield: {\n js: ['MaterialTextfield'],\n html: ['mdl-textfield', 'mdl-js-textfield'],\n fct: []\n },\n layout: {\n js: ['MaterialLayout'],\n html: ['mdl-layout', 'mdl-js-layout'],\n fct: [manageRipple]\n },\n menu: {\n js: ['MaterialMenu'],\n html: ['mdl-menu', 'mdl-js-menu'],\n fct: [manageRipple]\n },\n 'data-table': {\n js: ['MaterialDataTable'],\n html: ['mdl-data-table', 'mdl-js-data-table'],\n fct: [manageRipple]\n },\n tabs: {\n js: ['MaterialTabs'],\n html: ['mdl-tabs', 'mdl-js-tabs'],\n fct: [manageRipple]\n },\n slider: {\n js: ['MaterialSlider'],\n html: ['mdl-slider', 'mdl-js-slider'],\n fct: []\n },\n tooltip: {\n js: ['MaterialTooltip'],\n html: ['mdl-tooltip'],\n fct: []\n },\n progress: {\n js: ['MaterialProgress'],\n html: ['mdl-progress', 'mdl-js-progress'],\n fct: []\n },\n spinner: {\n js: ['MaterialSpinner'],\n html: ['mdl-spinner', 'mdl-js-spinner'],\n fct: []\n },\n badge: {\n js: [],\n html: ['mdl-badge'],\n fct: []\n },\n switch: {\n js: ['MaterialSwitch'],\n html: ['mdl-switch', 'mdl-js-switch'],\n fct: [manageRipple]\n },\n radio: {\n js: ['MaterialRadio'],\n html: ['mdl-radio', 'mdl-js-radio'],\n fct: [manageRipple]\n },\n 'icon-toggle': {\n js: ['MaterialIconToggle'],\n html: ['mdl-icon-toggle', 'mdl-js-icon-toggle'],\n fct: [manageRipple]\n },\n checkbox: {\n js: ['MaterialCheckbox'],\n html: ['mdl-checkbox', 'mdl-js-checkbox'],\n fct: [manageRipple]\n },\n dialog: {\n js: ['MaterialDialog'],\n html: ['mdl-dialog', 'mdl-js-dialog'],\n fct: []\n },\n 'mega-footer': {\n js: [],\n html: ['mdl-mega-footer'],\n fct: []\n },\n 'mini-footer': {\n js: [],\n html: ['mdl-mini-footer'],\n fct: []\n },\n grid: {\n js: [],\n html: ['mdl-grid'],\n fct: []\n },\n snackbar: {\n js: ['MaterialSnackbar'],\n html: ['mdl-snackbar'],\n fct: []\n }\n\n};\n\nfunction manageRipple(element) {\n if (element.classList.contains('mdl-js-ripple-effect')) {\n componentHandler.upgradeElement(element, 'MaterialRipple');\n }\n /**\n * Causes issues: upgrades nested elements that has mdl-js-ripple-effect class before the nested elements upgraded, marking them as\n * MaterialRipple upgraded, when the nested elements upgraded, and ripple upgrade tries to take place, it doesn't because it is already\n * marked as upgraded.\n * eventually causing rippleElement to be null on MaterialRipple.\n * NOTE: \"mdl-js-ripple-effect\" should be only on upgradable material elements, not on non material nested elements.\n let elements = element.querySelectorAll('.mdl-js-ripple-effect');\n for (let el of elements) {\n componentHandler.upgradeElement(el, 'MaterialRipple');\n }*/\n\n /** Some of the elements do require upgrade of nested elements, to avoid issues we must handle it carefully\n * NOTE: not sure about all the elements that require nested upgrading. Will add all the required when used and tested.\n */\n if (element.MaterialIconToggle) {\n /* We need to upgrade immediate children only, no easy way to do it (for all browsers) */\n let children = element.children;\n for (let child of children) {\n if (child.classList.contains('mdl-js-ripple-effect')) {\n componentHandler.upgradeElement(child, 'MaterialRipple');\n }\n }\n }\n}\n\nfunction upgradeElement(element, type) {\n let {html, fct, js} = (mdlTypes[type] || {});\n if (html) {\n for (let h of html) {\n element.classList.add(h);\n }\n }\n for (let t of js) componentHandler.upgradeElement(element, t);\n for (let f of fct) f(element);\n}\n\n@inject(Element, EventAggregator)\n@customAttribute('mdl')\nexport class MDLCustomAttribute {\n\n constructor(element, eventAggregator) {\n this.element = element;\n this.eventAggregator = eventAggregator;\n }\n\n attached() {\n //console.log(\"mdl attached: \" + this.value);\n upgradeElement(this.element, this.value);\n let payload = {publisher: this, data: this.element};\n this.eventAggregator.publish('mdl:component:upgrade', payload);\n }\n}\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/dist/commonjs/mdl.js b/dist/commonjs/mdl.js index 8ec7ef1..dd59513 100644 --- a/dist/commonjs/mdl.js +++ b/dist/commonjs/mdl.js @@ -122,28 +122,33 @@ function manageRipple(element) { if (element.classList.contains('mdl-js-ripple-effect')) { _encapsulatedMdl.componentHandler.upgradeElement(element, 'MaterialRipple'); } - var elements = element.querySelectorAll('.mdl-js-ripple-effect'); - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - try { - for (var _iterator = elements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var el = _step.value; + if (element.MaterialIconToggle) { + var children = element.children; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; - _encapsulatedMdl.componentHandler.upgradeElement(el, 'MaterialRipple'); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { try { - if (!_iteratorNormalCompletion && _iterator['return']) { - _iterator['return'](); + for (var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var child = _step.value; + + if (child.classList.contains('mdl-js-ripple-effect')) { + _encapsulatedMdl.componentHandler.upgradeElement(child, 'MaterialRipple'); + } } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; } finally { - if (_didIteratorError) { - throw _iteratorError; + try { + if (!_iteratorNormalCompletion && _iterator['return']) { + _iterator['return'](); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } } } } diff --git a/dist/commonjs/mdl.js.map b/dist/commonjs/mdl.js.map index f82547d..6d5a057 100644 --- a/dist/commonjs/mdl.js.map +++ b/dist/commonjs/mdl.js.map @@ -1 +1 @@ -{"version":3,"sources":["mdl.js"],"names":[],"mappings":";;;;;;;;;;gCAAsC,mBAAmB;;+BAC1B,kBAAkB;;sCACnB,0BAA0B;;AAExD,IAAI,QAAQ,GAAG;AACb,QAAM,EAAE;AACN,QAAI,EAAE,CAAC,YAAY,EAAE,eAAe,CAAC;AACrC,MAAE,EAAE,CAAC,gBAAgB,CAAC;AACtB,OAAG,EAAE,CAAC,YAAY,CAAC;GACpB;AACD,WAAS,EAAE;AACT,MAAE,EAAE,CAAC,mBAAmB,CAAC;AACzB,QAAI,EAAE,CAAC,eAAe,EAAE,kBAAkB,CAAC;AAC3C,OAAG,EAAE,EAAE;GACR;AACD,QAAM,EAAE;AACN,MAAE,EAAE,CAAC,gBAAgB,CAAC;AACtB,QAAI,EAAE,CAAC,YAAY,EAAE,eAAe,CAAC;AACrC,OAAG,EAAE,CAAC,YAAY,CAAC;GACpB;AACD,MAAI,EAAE;AACJ,MAAE,EAAE,CAAC,cAAc,CAAC;AACpB,QAAI,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC;AACjC,OAAG,EAAE,CAAC,YAAY,CAAC;GACpB;AACD,cAAY,EAAE;AACZ,MAAE,EAAE,CAAC,mBAAmB,CAAC;AACzB,QAAI,EAAE,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;AAC7C,OAAG,EAAE,CAAC,YAAY,CAAC;GACpB;AACD,MAAI,EAAE;AACJ,MAAE,EAAE,CAAC,cAAc,CAAC;AACpB,QAAI,EAAE,CAAC,UAAU,EAAE,aA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AC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;OAC1B;;;;;;;;;;;;;;;GACF;;;;;;AACD,0BAAc,EAAE;UAAP,CAAC;AAAQ,wCAAiB,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;KAAA;;;;;;;;;;;;;;;;;;;;;AAC9D,0BAAc,GAAG;UAAR,CAAC;AAAS,OAAC,CAAC,OAAO,CAAC,CAAC;KAAA;;;;;;;;;;;;;;;CAC/B;;IAIY,kBAAkB;AAElB,WAFA,kBAAkB,CAEjB,OAAO,EAAE,eAAe,EAAE;;;AACpC,QAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AACvB,QAAI,CAAC,eAAe,GAAG,eAAe,CAAC;GACxC;;eALU,kBAAkB;;WAOrB,oBAAG;AAET,oBAAc,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;AACzC,UAAI,OAAO,GAAG,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAC,CAAC;AACpD,UAAI,CAAC,eAAe,CAAC,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;KAChE;;;4BAZU,kBAAkB;AAAlB,oBAAkB,GAD9B,uCAAgB,KAAK,CAAC,CACV,kBAAkB,KAAlB,kBAAkB;AAAlB,oBAAkB,GAF9B,8BAAO,OAAO,0CAAkB,CAEpB,kBAAkB,KAAlB,kBAAkB;SAAlB,kBAAkB","file":"mdl.js","sourcesContent":["import {inject, customAttribute} from 'aurelia-framework';\r\nimport {componentHandler} from 'encapsulated-mdl';\r\nimport {EventAggregator} from 'aurelia-event-aggregator';\r\n\r\nlet mdlTypes = {\r\n button: {\r\n html: ['mdl-button', 'mdl-js-button'],\r\n js: ['MaterialButton'],\r\n fct: [manageRipple]\r\n },\r\n textfield: {\r\n js: ['MaterialTextfield'],\r\n html: ['mdl-textfield', 'mdl-js-textfield'],\r\n fct: []\r\n },\r\n layout: {\r\n js: ['MaterialLayout'],\r\n html: ['mdl-layout', 'mdl-js-layout'],\r\n fct: [manageRipple]\r\n },\r\n menu: {\r\n js: ['MaterialMenu'],\r\n html: ['mdl-menu', 'mdl-js-menu'],\r\n fct: [manageRipple]\r\n },\r\n 'data-table': {\r\n js: ['MaterialDataTable'],\r\n html: ['mdl-data-table', 'mdl-js-data-table'],\r\n fct: [manageRipple]\r\n },\r\n tabs: {\r\n js: ['MaterialTabs'],\r\n html: ['mdl-tabs', 'mdl-js-tabs'],\r\n fct: [manageRipple]\r\n },\r\n slider: {\r\n js: ['MaterialSlider'],\r\n html: ['mdl-slider', 'mdl-js-slider'],\r\n fct: []\r\n },\r\n tooltip: {\r\n js: ['MaterialTooltip'],\r\n html: ['mdl-tooltip'],\r\n fct: []\r\n },\r\n progress: {\r\n js: ['MaterialProgress'],\r\n html: ['mdl-progress', 'mdl-js-progress'],\r\n fct: []\r\n },\r\n spinner: {\r\n js: ['MaterialSpinner'],\r\n html: ['mdl-spinner', 'mdl-js-spinner'],\r\n fct: []\r\n },\r\n badge: {\r\n js: [],\r\n html: ['mdl-badge'],\r\n fct: []\r\n },\r\n switch: {\r\n js: ['MaterialSwitch'],\r\n html: ['mdl-switch', 'mdl-js-switch'],\r\n fct: [manageRipple]\r\n },\r\n radio: {\r\n js: ['MaterialRadio'],\r\n html: ['mdl-radio', 'mdl-js-radio'],\r\n fct: [manageRipple]\r\n },\r\n 'icon-toggle': {\r\n js: ['MaterialIconToggle'],\r\n html: ['mdl-icon-toggle', 'mdl-js-icon-toggle'],\r\n fct: [manageRipple]\r\n },\r\n checkbox: {\r\n js: ['MaterialCheckbox'],\r\n html: ['mdl-checkbox', 'mdl-js-checkbox'],\r\n fct: [manageRipple]\r\n },\r\n dialog: {\r\n js: ['MaterialDialog'],\r\n html: ['mdl-dialog', 'mdl-js-dialog'],\r\n fct: []\r\n },\r\n 'mega-footer': {\r\n js: [],\r\n html: ['mdl-mega-footer'],\r\n fct: []\r\n },\r\n 'mini-footer': {\r\n js: [],\r\n html: ['mdl-mini-footer'],\r\n fct: []\r\n },\r\n grid: {\r\n js: [],\r\n html: ['mdl-grid'],\r\n fct: []\r\n },\r\n snackbar: {\r\n js: ['MaterialSnackbar'],\r\n html: ['mdl-snackbar'],\r\n fct: []\r\n }\r\n\r\n};\r\n\r\nfunction manageRipple(element) {\r\n if (element.classList.contains('mdl-js-ripple-effect')) {\r\n componentHandler.upgradeElement(element, 'MaterialRipple');\r\n }\r\n let elements = element.querySelectorAll('.mdl-js-ripple-effect');\r\n for (let el of elements) {\r\n componentHandler.upgradeElement(el, 'MaterialRipple');\r\n }\r\n}\r\n\r\nfunction upgradeElement(element, type) {\r\n let {html, fct, js} = (mdlTypes[type] || {});\r\n if (html) {\r\n for (let h of html) {\r\n element.classList.add(h);\r\n }\r\n }\r\n for (let t of js) componentHandler.upgradeElement(element, t);\r\n for (let f of fct) f(element);\r\n}\r\n\r\n@inject(Element, EventAggregator)\r\n@customAttribute('mdl')\r\nexport class MDLCustomAttribute {\r\n\r\n constructor(element, eventAggregator) {\r\n this.element = element;\r\n this.eventAggregator = eventAggregator;\r\n }\r\n\r\n attached() {\r\n //console.log(\"mdl attached: \" + this.value);\r\n upgradeElement(this.element, this.value);\r\n let payload = {publisher: this, data: this.element};\r\n this.eventAggregator.publish('mdl:component:upgrade', payload);\r\n }\r\n}\r\n"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["mdl.js"],"names":[],"mappings":";;;;;;;;;;gCAAsC,mBAAmB;;+BAC1B,kBAAkB;;sCACnB,0BAA0B;;AAExD,IAAI,QAAQ,GAAG;AACb,QAAM,EAAE;AACN,QAAI,EAAE,CAAC,YAAY,EAAE,eAAe,CAAC;AACrC,MAAE,EAAE,CAAC,gBAAgB,CAAC;AACtB,OAAG,EAAE,CAAC,YAAY,CAAC;GACpB;AACD,WAAS,EAAE;AACT,MAAE,EAAE,CAAC,mBAAmB,CAAC;AACzB,QAAI,EAAE,CAAC,eAAe,EAAE,kB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AC;AACzC,UAAI,OAAO,GAAG,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAC,CAAC;AACpD,UAAI,CAAC,eAAe,CAAC,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;KAChE;;;4BAZU,kBAAkB;AAAlB,oBAAkB,GAD9B,uCAAgB,KAAK,CAAC,CACV,kBAAkB,KAAlB,kBAAkB;AAAlB,oBAAkB,GAF9B,8BAAO,OAAO,0CAAkB,CAEpB,kBAAkB,KAAlB,kBAAkB;SAAlB,kBAAkB","file":"mdl.js","sourcesContent":["import {inject, customAttribute} from 'aurelia-framework';\nimport {componentHandler} from 'encapsulated-mdl';\nimport {EventAggregator} from 'aurelia-event-aggregator';\n\nlet mdlTypes = {\n button: {\n html: ['mdl-button', 'mdl-js-button'],\n js: ['MaterialButton'],\n fct: [manageRipple]\n },\n textfield: {\n js: ['MaterialTextfield'],\n html: ['mdl-textfield', 'mdl-js-textfield'],\n fct: []\n },\n layout: {\n js: ['MaterialLayout'],\n html: ['mdl-layout', 'mdl-js-layout'],\n fct: [manageRipple]\n },\n menu: {\n js: ['MaterialMenu'],\n html: ['mdl-menu', 'mdl-js-menu'],\n fct: [manageRipple]\n },\n 'data-table': {\n js: ['MaterialDataTable'],\n html: ['mdl-data-table', 'mdl-js-data-table'],\n fct: [manageRipple]\n },\n tabs: {\n js: ['MaterialTabs'],\n html: ['mdl-tabs', 'mdl-js-tabs'],\n fct: [manageRipple]\n },\n slider: {\n js: ['MaterialSlider'],\n html: ['mdl-slider', 'mdl-js-slider'],\n fct: []\n },\n tooltip: {\n js: ['MaterialTooltip'],\n html: ['mdl-tooltip'],\n fct: []\n },\n progress: {\n js: ['MaterialProgress'],\n html: ['mdl-progress', 'mdl-js-progress'],\n fct: []\n },\n spinner: {\n js: ['MaterialSpinner'],\n html: ['mdl-spinner', 'mdl-js-spinner'],\n fct: []\n },\n badge: {\n js: [],\n html: ['mdl-badge'],\n fct: []\n },\n switch: {\n js: ['MaterialSwitch'],\n html: ['mdl-switch', 'mdl-js-switch'],\n fct: [manageRipple]\n },\n radio: {\n js: ['MaterialRadio'],\n html: ['mdl-radio', 'mdl-js-radio'],\n fct: [manageRipple]\n },\n 'icon-toggle': {\n js: ['MaterialIconToggle'],\n html: ['mdl-icon-toggle', 'mdl-js-icon-toggle'],\n fct: [manageRipple]\n },\n checkbox: {\n js: ['MaterialCheckbox'],\n html: ['mdl-checkbox', 'mdl-js-checkbox'],\n fct: [manageRipple]\n },\n dialog: {\n js: ['MaterialDialog'],\n html: ['mdl-dialog', 'mdl-js-dialog'],\n fct: []\n },\n 'mega-footer': {\n js: [],\n html: ['mdl-mega-footer'],\n fct: []\n },\n 'mini-footer': {\n js: [],\n html: ['mdl-mini-footer'],\n fct: []\n },\n grid: {\n js: [],\n html: ['mdl-grid'],\n fct: []\n },\n snackbar: {\n js: ['MaterialSnackbar'],\n html: ['mdl-snackbar'],\n fct: []\n }\n\n};\n\nfunction manageRipple(element) {\n if (element.classList.contains('mdl-js-ripple-effect')) {\n componentHandler.upgradeElement(element, 'MaterialRipple');\n }\n /**\n * Causes issues: upgrades nested elements that has mdl-js-ripple-effect class before the nested elements upgraded, marking them as\n * MaterialRipple upgraded, when the nested elements upgraded, and ripple upgrade tries to take place, it doesn't because it is already\n * marked as upgraded.\n * eventually causing rippleElement to be null on MaterialRipple.\n * NOTE: \"mdl-js-ripple-effect\" should be only on upgradable material elements, not on non material nested elements.\n let elements = element.querySelectorAll('.mdl-js-ripple-effect');\n for (let el of elements) {\n componentHandler.upgradeElement(el, 'MaterialRipple');\n }*/\n\n /** Some of the elements do require upgrade of nested elements, to avoid issues we must handle it carefully\n * NOTE: not sure about all the elements that require nested upgrading. Will add all the required when used and tested.\n */\n if (element.MaterialIconToggle) {\n /* We need to upgrade immediate children only, no easy way to do it (for all browsers) */\n let children = element.children;\n for (let child of children) {\n if (child.classList.contains('mdl-js-ripple-effect')) {\n componentHandler.upgradeElement(child, 'MaterialRipple');\n }\n }\n }\n}\n\nfunction upgradeElement(element, type) {\n let {html, fct, js} = (mdlTypes[type] || {});\n if (html) {\n for (let h of html) {\n element.classList.add(h);\n }\n }\n for (let t of js) componentHandler.upgradeElement(element, t);\n for (let f of fct) f(element);\n}\n\n@inject(Element, EventAggregator)\n@customAttribute('mdl')\nexport class MDLCustomAttribute {\n\n constructor(element, eventAggregator) {\n this.element = element;\n this.eventAggregator = eventAggregator;\n }\n\n attached() {\n //console.log(\"mdl attached: \" + this.value);\n upgradeElement(this.element, this.value);\n let payload = {publisher: this, data: this.element};\n this.eventAggregator.publish('mdl:component:upgrade', payload);\n }\n}\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/dist/es6/mdl.js b/dist/es6/mdl.js index 49a8368..652c766 100644 --- a/dist/es6/mdl.js +++ b/dist/es6/mdl.js @@ -110,9 +110,28 @@ function manageRipple(element) { if (element.classList.contains('mdl-js-ripple-effect')) { componentHandler.upgradeElement(element, 'MaterialRipple'); } + /** + * Causes issues: upgrades nested elements that has mdl-js-ripple-effect class before the nested elements upgraded, marking them as + * MaterialRipple upgraded, when the nested elements upgraded, and ripple upgrade tries to take place, it doesn't because it is already + * marked as upgraded. + * eventually causing rippleElement to be null on MaterialRipple. + * NOTE: "mdl-js-ripple-effect" should be only on upgradable material elements, not on non material nested elements. let elements = element.querySelectorAll('.mdl-js-ripple-effect'); for (let el of elements) { componentHandler.upgradeElement(el, 'MaterialRipple'); + }*/ + + /** Some of the elements do require upgrade of nested elements, to avoid issues we must handle it carefully + * NOTE: not sure about all the elements that require nested upgrading. Will add all the required when used and tested. + */ + if (element.MaterialIconToggle) { + /* We need to upgrade immediate children only, no easy way to do it (for all browsers) */ + let children = element.children; + for (let child of children) { + if (child.classList.contains('mdl-js-ripple-effect')) { + componentHandler.upgradeElement(child, 'MaterialRipple'); + } + } } } diff --git a/dist/system/mdl.js b/dist/system/mdl.js index f75f2b1..9189b57 100644 --- a/dist/system/mdl.js +++ b/dist/system/mdl.js @@ -11,28 +11,33 @@ System.register(['aurelia-framework', 'encapsulated-mdl', 'aurelia-event-aggrega if (element.classList.contains('mdl-js-ripple-effect')) { componentHandler.upgradeElement(element, 'MaterialRipple'); } - var elements = element.querySelectorAll('.mdl-js-ripple-effect'); - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - try { - for (var _iterator = elements[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var el = _step.value; + if (element.MaterialIconToggle) { + var children = element.children; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; - componentHandler.upgradeElement(el, 'MaterialRipple'); - } - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally { try { - if (!_iteratorNormalCompletion && _iterator['return']) { - _iterator['return'](); + for (var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var child = _step.value; + + if (child.classList.contains('mdl-js-ripple-effect')) { + componentHandler.upgradeElement(child, 'MaterialRipple'); + } } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; } finally { - if (_didIteratorError) { - throw _iteratorError; + try { + if (!_iteratorNormalCompletion && _iterator['return']) { + _iterator['return'](); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } } } } diff --git a/dist/system/mdl.js.map b/dist/system/mdl.js.map index dd9f8a3..a0c0e9f 100644 --- a/dist/system/mdl.js.map +++ b/dist/system/mdl.js.map @@ -1 +1 @@ -{"version":3,"sources":["mdl.js"],"names":[],"mappings":";;;kEAII,QAAQ,EA+HC,kBAAkB;;;;;;AAvB/B,WAAS,YAAY,CAAC,OAAO,EAAE;AAC7B,QAAI,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE;AACtD,sBAAgB,CAAC,cAAc,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;KAC5D;AACD,QAAI,QAAQ,GAAG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CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;AACzC,gBAAI,OAAO,GAAG,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAC,CAAC;AACpD,gBAAI,CAAC,eAAe,CAAC,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;WAChE;;;kCAZU,kBAAkB;AAAlB,0BAAkB,GAD9B,eAAe,CAAC,KAAK,CAAC,CACV,kBAAkB,KAAlB,kBAAkB;AAAlB,0BAAkB,GAF9B,MAAM,CAAC,OAAO,EAAE,eAAe,CAAC,CAEpB,kBAAkB,KAAlB,kBAAkB;eAAlB,kBAAkB","file":"mdl.js","sourcesContent":["import {inject, customAttribute} from 'aurelia-framework';\r\nimport {componentHandler} from 'encapsulated-mdl';\r\nimport {EventAggregator} from 'aurelia-event-aggregator';\r\n\r\nlet mdlTypes = {\r\n button: {\r\n html: ['mdl-button', 'mdl-js-button'],\r\n js: ['MaterialButton'],\r\n fct: [manageRipple]\r\n },\r\n textfield: {\r\n js: ['MaterialTextfield'],\r\n html: ['mdl-textfield', 'mdl-js-textfield'],\r\n fct: []\r\n },\r\n layout: {\r\n js: ['MaterialLayout'],\r\n html: ['mdl-layout', 'mdl-js-layout'],\r\n fct: [manageRipple]\r\n },\r\n menu: {\r\n js: ['MaterialMenu'],\r\n html: ['mdl-menu', 'mdl-js-menu'],\r\n fct: [manageRipple]\r\n },\r\n 'data-table': {\r\n js: ['MaterialDataTable'],\r\n html: ['mdl-data-table', 'mdl-js-data-table'],\r\n fct: [manageRipple]\r\n },\r\n tabs: {\r\n js: ['MaterialTabs'],\r\n html: ['mdl-tabs', 'mdl-js-tabs'],\r\n fct: [manageRipple]\r\n },\r\n slider: {\r\n js: ['MaterialSlider'],\r\n html: ['mdl-slider', 'mdl-js-slider'],\r\n fct: []\r\n },\r\n tooltip: {\r\n js: ['MaterialTooltip'],\r\n html: ['mdl-tooltip'],\r\n fct: []\r\n },\r\n progress: {\r\n js: ['MaterialProgress'],\r\n html: ['mdl-progress', 'mdl-js-progress'],\r\n fct: []\r\n },\r\n spinner: {\r\n js: ['MaterialSpinner'],\r\n html: ['mdl-spinner', 'mdl-js-spinner'],\r\n fct: []\r\n },\r\n badge: {\r\n js: [],\r\n html: ['mdl-badge'],\r\n fct: []\r\n },\r\n switch: {\r\n js: ['MaterialSwitch'],\r\n html: ['mdl-switch', 'mdl-js-switch'],\r\n fct: [manageRipple]\r\n },\r\n radio: {\r\n js: ['MaterialRadio'],\r\n html: ['mdl-radio', 'mdl-js-radio'],\r\n fct: [manageRipple]\r\n },\r\n 'icon-toggle': {\r\n js: ['MaterialIconToggle'],\r\n html: ['mdl-icon-toggle', 'mdl-js-icon-toggle'],\r\n fct: [manageRipple]\r\n },\r\n checkbox: {\r\n js: ['MaterialCheckbox'],\r\n html: ['mdl-checkbox', 'mdl-js-checkbox'],\r\n fct: [manageRipple]\r\n },\r\n dialog: {\r\n js: ['MaterialDialog'],\r\n html: ['mdl-dialog', 'mdl-js-dialog'],\r\n fct: []\r\n },\r\n 'mega-footer': {\r\n js: [],\r\n html: ['mdl-mega-footer'],\r\n fct: []\r\n },\r\n 'mini-footer': {\r\n js: [],\r\n html: ['mdl-mini-footer'],\r\n fct: []\r\n },\r\n grid: {\r\n js: [],\r\n html: ['mdl-grid'],\r\n fct: []\r\n },\r\n snackbar: {\r\n js: ['MaterialSnackbar'],\r\n html: ['mdl-snackbar'],\r\n fct: []\r\n }\r\n\r\n};\r\n\r\nfunction manageRipple(element) {\r\n if (element.classList.contains('mdl-js-ripple-effect')) {\r\n componentHandler.upgradeElement(element, 'MaterialRipple');\r\n }\r\n let elements = element.querySelectorAll('.mdl-js-ripple-effect');\r\n for (let el of elements) {\r\n componentHandler.upgradeElement(el, 'MaterialRipple');\r\n }\r\n}\r\n\r\nfunction upgradeElement(element, type) {\r\n let {html, fct, js} = (mdlTypes[type] || {});\r\n if (html) {\r\n for (let h of html) {\r\n element.classList.add(h);\r\n }\r\n }\r\n for (let t of js) componentHandler.upgradeElement(element, t);\r\n for (let f of fct) f(element);\r\n}\r\n\r\n@inject(Element, EventAggregator)\r\n@customAttribute('mdl')\r\nexport class MDLCustomAttribute {\r\n\r\n constructor(element, eventAggregator) {\r\n this.element = element;\r\n this.eventAggregator = eventAggregator;\r\n }\r\n\r\n attached() {\r\n //console.log(\"mdl attached: \" + this.value);\r\n upgradeElement(this.element, this.value);\r\n let payload = {publisher: this, data: this.element};\r\n this.eventAggregator.publish('mdl:component:upgrade', payload);\r\n }\r\n}\r\n"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["mdl.js"],"names":[],"mappings":";;;kEAII,QAAQ,EAkJC,kBAAkB;;;;;;AA1C/B,WAAS,YAAY,CAAC,OAAO,EAAE;AAC7B,QAAI,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE;AACtD,sBAAgB,CAAC,cAAc,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;KAC5D;;AAeD,QAAI,OAAO,CAAC,kBAAkB,EAAE;AAE9B,UAAI,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;;;;;;AAChC,6BAAkB,QAAQ,8HAAE;cAAnB,KAAK;;AACZ,cAAI,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE;AACpD,4BAAgB,CAAC,cAAc,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;WAC1D;SACF;;;;;;;;;;;;;;;KACF;GACF;;AAED,WAAS,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE;eACd,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE;;QAAtC,IAAI,QAAJ,IAAI;QAAE,GAAG,QAAH,GAAG;QAAE,EAAE,QAAF,EAAE;;AAClB,QAAI,IAAI,EAAE;;;;;;AACR,8BAAc,IAAI,mIAAE;cAAX,CAAC;;AACR,iBAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,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ework';\nimport {componentHandler} from 'encapsulated-mdl';\nimport {EventAggregator} from 'aurelia-event-aggregator';\n\nlet mdlTypes = {\n button: {\n html: ['mdl-button', 'mdl-js-button'],\n js: ['MaterialButton'],\n fct: [manageRipple]\n },\n textfield: {\n js: ['MaterialTextfield'],\n html: ['mdl-textfield', 'mdl-js-textfield'],\n fct: []\n },\n layout: {\n js: ['MaterialLayout'],\n html: ['mdl-layout', 'mdl-js-layout'],\n fct: [manageRipple]\n },\n menu: {\n js: ['MaterialMenu'],\n html: ['mdl-menu', 'mdl-js-menu'],\n fct: [manageRipple]\n },\n 'data-table': {\n js: ['MaterialDataTable'],\n html: ['mdl-data-table', 'mdl-js-data-table'],\n fct: [manageRipple]\n },\n tabs: {\n js: ['MaterialTabs'],\n html: ['mdl-tabs', 'mdl-js-tabs'],\n fct: [manageRipple]\n },\n slider: {\n js: ['MaterialSlider'],\n html: ['mdl-slider', 'mdl-js-slider'],\n fct: []\n },\n tooltip: {\n js: ['MaterialTooltip'],\n html: ['mdl-tooltip'],\n fct: []\n },\n progress: {\n js: ['MaterialProgress'],\n html: ['mdl-progress', 'mdl-js-progress'],\n fct: []\n },\n spinner: {\n js: ['MaterialSpinner'],\n html: ['mdl-spinner', 'mdl-js-spinner'],\n fct: []\n },\n badge: {\n js: [],\n html: ['mdl-badge'],\n fct: []\n },\n switch: {\n js: ['MaterialSwitch'],\n html: ['mdl-switch', 'mdl-js-switch'],\n fct: [manageRipple]\n },\n radio: {\n js: ['MaterialRadio'],\n html: ['mdl-radio', 'mdl-js-radio'],\n fct: [manageRipple]\n },\n 'icon-toggle': {\n js: ['MaterialIconToggle'],\n html: ['mdl-icon-toggle', 'mdl-js-icon-toggle'],\n fct: [manageRipple]\n },\n checkbox: {\n js: ['MaterialCheckbox'],\n html: ['mdl-checkbox', 'mdl-js-checkbox'],\n fct: [manageRipple]\n },\n dialog: {\n js: ['MaterialDialog'],\n html: ['mdl-dialog', 'mdl-js-dialog'],\n fct: []\n },\n 'mega-footer': {\n js: [],\n html: ['mdl-mega-footer'],\n fct: []\n },\n 'mini-footer': {\n js: [],\n html: ['mdl-mini-footer'],\n fct: []\n },\n grid: {\n js: [],\n html: ['mdl-grid'],\n fct: []\n },\n snackbar: {\n js: ['MaterialSnackbar'],\n html: ['mdl-snackbar'],\n fct: []\n }\n\n};\n\nfunction manageRipple(element) {\n if (element.classList.contains('mdl-js-ripple-effect')) {\n componentHandler.upgradeElement(element, 'MaterialRipple');\n }\n /**\n * Causes issues: upgrades nested elements that has mdl-js-ripple-effect class before the nested elements upgraded, marking them as\n * MaterialRipple upgraded, when the nested elements upgraded, and ripple upgrade tries to take place, it doesn't because it is already\n * marked as upgraded.\n * eventually causing rippleElement to be null on MaterialRipple.\n * NOTE: \"mdl-js-ripple-effect\" should be only on upgradable material elements, not on non material nested elements.\n let elements = element.querySelectorAll('.mdl-js-ripple-effect');\n for (let el of elements) {\n componentHandler.upgradeElement(el, 'MaterialRipple');\n }*/\n\n /** Some of the elements do require upgrade of nested elements, to avoid issues we must handle it carefully\n * NOTE: not sure about all the elements that require nested upgrading. Will add all the required when used and tested.\n */\n if (element.MaterialIconToggle) {\n /* We need to upgrade immediate children only, no easy way to do it (for all browsers) */\n let children = element.children;\n for (let child of children) {\n if (child.classList.contains('mdl-js-ripple-effect')) {\n componentHandler.upgradeElement(child, 'MaterialRipple');\n }\n }\n }\n}\n\nfunction upgradeElement(element, type) {\n let {html, fct, js} = (mdlTypes[type] || {});\n if (html) {\n for (let h of html) {\n element.classList.add(h);\n }\n }\n for (let t of js) componentHandler.upgradeElement(element, t);\n for (let f of fct) f(element);\n}\n\n@inject(Element, EventAggregator)\n@customAttribute('mdl')\nexport class MDLCustomAttribute {\n\n constructor(element, eventAggregator) {\n this.element = element;\n this.eventAggregator = eventAggregator;\n }\n\n attached() {\n //console.log(\"mdl attached: \" + this.value);\n upgradeElement(this.element, this.value);\n let payload = {publisher: this, data: this.element};\n this.eventAggregator.publish('mdl:component:upgrade', payload);\n }\n}\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/src/mdl.js b/src/mdl.js index 7e61e43..652c766 100644 --- a/src/mdl.js +++ b/src/mdl.js @@ -124,7 +124,7 @@ function manageRipple(element) { /** Some of the elements do require upgrade of nested elements, to avoid issues we must handle it carefully * NOTE: not sure about all the elements that require nested upgrading. Will add all the required when used and tested. */ - if(element.MaterialIconToggle) { + if (element.MaterialIconToggle) { /* We need to upgrade immediate children only, no easy way to do it (for all browsers) */ let children = element.children; for (let child of children) {