diff --git a/elements/rhelement/rhelement.js b/elements/rhelement/rhelement.js index e845484d7c..f1e9dc3d4c 100644 --- a/elements/rhelement/rhelement.js +++ b/elements/rhelement/rhelement.js @@ -111,7 +111,7 @@ class RHElement extends HTMLElement { } render() { - this.shadowRoot.innerHTML = null; + this.shadowRoot.innerHTML = ""; this.template.innerHTML = this.html; if (window.ShadyCSS) { diff --git a/elements/rhelement/rhelement.js.map b/elements/rhelement/rhelement.js.map index 4dd728c644..286c997993 100644 --- a/elements/rhelement/rhelement.js.map +++ b/elements/rhelement/rhelement.js.map @@ -1 +1 @@ -{"version":3,"file":"rhelement.js","sources":["rhelement.js"],"sourcesContent":["import { autoReveal } from \"./utilities/reveal.js\";\n\n/*\n * Copyright 2018 Red Hat, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nclass RHElement extends HTMLElement {\n static create(rhe) {\n window.customElements.define(rhe.tag, rhe);\n }\n\n static get RhTypes() {\n return {\n Container: \"container\",\n Content: \"content\",\n Pattern: \"pattern\"\n };\n }\n\n get rhType() {\n return this.getAttribute(\"rh-type\");\n }\n\n set rhType(value) {\n this.setAttribute(\"rh-type\", value);\n }\n\n constructor(rhClass, { type = null, delayRender = false } = {}) {\n super();\n\n this._rhClass = rhClass;\n this.tag = rhClass.tag;\n this._queue = [];\n this.template = document.createElement(\"template\");\n\n this.attachShadow({ mode: \"open\" });\n\n if (type) {\n this._queueAction({\n type: \"setProperty\",\n data: {\n name: \"rhType\",\n value: type\n }\n });\n }\n\n if (!delayRender) {\n this.render();\n }\n }\n\n connectedCallback() {\n if (window.ShadyCSS) {\n window.ShadyCSS.styleElement(this);\n }\n\n if (this._queue.length) {\n this._processQueue();\n }\n }\n\n attributeChangedCallback(attr, oldVal, newVal) {\n const cascadeTo = this._rhClass.cascadingAttributes[attr];\n if (cascadeTo) {\n this._copyAttribute(attr, cascadeTo);\n }\n }\n\n _copyAttribute(name, to) {\n const recipients = this.shadowRoot.querySelectorAll(to);\n const value = this.getAttribute(name);\n const fname = value == null ? \"removeAttribute\" : \"setAttribute\";\n for (const node of recipients) {\n node[fname](name, value);\n }\n }\n\n _queueAction(action) {\n this._queue.push(action);\n }\n\n _processQueue() {\n this._queue.forEach(action => {\n this[`_${action.type}`](action.data);\n });\n\n this._queue = [];\n }\n\n _setProperty({ name, value }) {\n this[name] = value;\n }\n\n render() {\n this.shadowRoot.innerHTML = null;\n this.template.innerHTML = this.html;\n\n if (window.ShadyCSS) {\n window.ShadyCSS.prepareTemplate(this.template, this.tag);\n }\n\n this.shadowRoot.appendChild(this.template.content.cloneNode(true));\n }\n}\n\nautoReveal();\n\nexport default RHElement;\n//# sourceMappingURL=rhelement.js.map\n"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,SAAS,SAAS,WAAW,CAAC;EAClC,OAAO,MAAM,CAAC,GAAG,EAAE;IACjB,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;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AM,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;KAC1D;;IAED,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;GACpE;CACF;;AAED,UAAU,EAAE,CAAC;;;;"} \ No newline at end of file +{"version":3,"file":"rhelement.js","sources":["rhelement.js"],"sourcesContent":["import { autoReveal } from \"./utilities/reveal.js\";\n\n/*\n * Copyright 2018 Red Hat, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nclass RHElement extends HTMLElement {\n static create(rhe) {\n window.customElements.define(rhe.tag, rhe);\n }\n\n static get RhTypes() {\n return {\n Container: \"container\",\n Content: \"content\",\n Pattern: \"pattern\"\n };\n }\n\n get rhType() {\n return this.getAttribute(\"rh-type\");\n }\n\n set rhType(value) {\n this.setAttribute(\"rh-type\", value);\n }\n\n constructor(rhClass, { type = null, delayRender = false } = {}) {\n super();\n\n this._rhClass = rhClass;\n this.tag = rhClass.tag;\n this._queue = [];\n this.template = document.createElement(\"template\");\n\n this.attachShadow({ mode: \"open\" });\n\n if (type) {\n this._queueAction({\n type: \"setProperty\",\n data: {\n name: \"rhType\",\n value: type\n }\n });\n }\n\n if (!delayRender) {\n this.render();\n }\n }\n\n connectedCallback() {\n if (window.ShadyCSS) {\n window.ShadyCSS.styleElement(this);\n }\n\n if (this._queue.length) {\n this._processQueue();\n }\n }\n\n attributeChangedCallback(attr, oldVal, newVal) {\n const cascadeTo = this._rhClass.cascadingAttributes[attr];\n if (cascadeTo) {\n this._copyAttribute(attr, cascadeTo);\n }\n }\n\n _copyAttribute(name, to) {\n const recipients = this.shadowRoot.querySelectorAll(to);\n const value = this.getAttribute(name);\n const fname = value == null ? \"removeAttribute\" : \"setAttribute\";\n for (const node of recipients) {\n node[fname](name, value);\n }\n }\n\n _queueAction(action) {\n this._queue.push(action);\n }\n\n _processQueue() {\n this._queue.forEach(action => {\n this[`_${action.type}`](action.data);\n });\n\n this._queue = [];\n }\n\n _setProperty({ name, value }) {\n this[name] = value;\n }\n\n render() {\n this.shadowRoot.innerHTML = \"\";\n this.template.innerHTML = this.html;\n\n if (window.ShadyCSS) {\n window.ShadyCSS.prepareTemplate(this.template, this.tag);\n }\n\n this.shadowRoot.appendChild(this.template.content.cloneNode(true));\n }\n}\n\nautoReveal();\n\nexport default RHElement;\n//# sourceMappingURL=rhelement.js.map\n"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,SAAS,SAAS,WAAW,CAAC;EAClC,OAAO,MAAM,CAAC,GAAG,EAAE;IACjB,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;GAC5C;;EAED,WAAW,OAAO,GAAG;IACnB,OAAO;MACL,SAAS,EAAE,WAAW;MACtB,OAAO,EAAE,SAAS;MAClB,O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;;IAED,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;GACpE;CACF;;AAED,UAAU,EAAE,CAAC;;;;"} \ No newline at end of file diff --git a/elements/rhelement/rhelement.umd.js b/elements/rhelement/rhelement.umd.js index e82402d267..ebfea25ae4 100644 --- a/elements/rhelement/rhelement.umd.js +++ b/elements/rhelement/rhelement.umd.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.RHElement=t()}(this,function(){"use strict";function e(){console.log("[reveal] web components ready"),console.log("[reveal] elements ready, revealing the body"),window.document.body.removeAttribute("unresolved")}var t=function(){function o(e,t){for(var n=0;n {\n this[`_${action.type}`](action.data);\n });\n\n this._queue = [];\n }\n\n _setProperty({ name, value }) {\n this[name] = value;\n }\n\n render() {\n this.shadowRoot.innerHTML = null;\n this.template.innerHTML = this.html;\n\n if (window.ShadyCSS) {\n window.ShadyCSS.prepareTemplate(this.template, this.tag);\n }\n\n this.shadowRoot.appendChild(this.template.content.cloneNode(true));\n }\n}\n\nautoReveal();\n\nexport default RHElement;\n//# sourceMappingURL=rhelement.js.map\n"],"names":["handleWebComponentsReady","log","document","body","removeAttribute","RHElement","rhClass","type","delayRender","_rhClass","tag","_queue","template","createElement","attachShadow","mode","_queueAction","render","HTMLElement","this","getAttribute","value","setAttribute","rhe","customElements","define","window","ShadyCSS","styleElement","length","_processQueue","attr","oldVal","newVal","cascadeTo","cascadingAttributes","_copyAttribute","name","to","recipients","shadowRoot","querySelectorAll","fname","action","push","forEach","data","innerHTML","html","prepareTemplate","appendChild","content","cloneNode","WebComponents","ready","addEventListener"],"mappings":"qLAwCA,SAASA,YACCC,IAAI,yCAlBJA,0DACDC,SAASC,KAAKC,gBAAgB,uQCAjCC,yBAqBQC,gEAAgD,OAArCC,KAAAA,aAAO,WAAMC,YAAAA,gWAG7BC,SAAWH,IACXI,IAAMJ,EAAQI,MACdC,OAAS,KACTC,SAAWV,SAASW,cAAc,cAElCC,aAAa,CAAEC,KAAM,SAEtBR,KACGS,aAAa,MACV,mBACA,MACE,eACCT,KAKRC,KACES,8UA1CaC,sDAcbC,KAAKC,aAAa,yBAGhBC,QACJC,aAAa,UAAWD,oCAjBjBE,UACLC,eAAeC,OAAOF,EAAIb,IAAKa,yCAI/B,WACM,oBACF,kBACA,8DAsCPG,OAAOC,iBACFA,SAASC,aAAaT,MAG3BA,KAAKR,OAAOkB,aACTC,iEAIgBC,EAAMC,EAAQC,OAC/BC,EAAYf,KAAKV,SAAS0B,oBAAoBJ,GAChDG,QACGE,eAAeL,EAAMG,0CAIfG,EAAMC,OACbC,EAAapB,KAAKqB,WAAWC,iBAAiBH,GAC9CjB,EAAQF,KAAKC,aAAaiB,GAC1BK,EAAiB,MAATrB,EAAgB,kBAAoB,kDAC/BkB,iDAAY,SACxBG,GAAOL,EAAMhB,uHAITsB,QACNhC,OAAOiC,KAAKD,2DAIZhC,OAAOkC,QAAQ,kBACTF,EAAOpC,MAAQoC,EAAOG,aAG5BnC,OAAS,+CAGD0B,IAAAA,KAAMhB,IAAAA,WACdgB,GAAQhB,wCAIRmB,WAAWO,UAAY,UACvBnC,SAASmC,UAAY5B,KAAK6B,KAE3BtB,OAAOC,iBACFA,SAASsB,gBAAgB9B,KAAKP,SAAUO,KAAKT,UAGjD8B,WAAWU,YAAY/B,KAAKP,SAASuC,QAAQC,WAAU,oBDvF1D1B,OAAO2B,cAAcC,iBAGhBC,iBAAiB,qBAAsBvD"} \ No newline at end of file +{"version":3,"file":"rhelement.umd.js","sources":["utilities/reveal.umd.js","rhelement.umd.js"],"sourcesContent":["/*\n * Copyright 2018 Red Hat, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport function reveal() {\n console.log(`[reveal] elements ready, revealing the body`);\n window.document.body.removeAttribute(\"unresolved\");\n}\n\nexport function autoReveal() {\n // If Web Components are already ready, run the handler right away. If they\n // are not yet ready, wait.\n //\n // see https://github.com/github/webcomponentsjs#webcomponents-loaderjs for\n // info about web component readiness events\n if (window.WebComponents.ready) {\n handleWebComponentsReady();\n } else {\n window.addEventListener(\"WebComponentsReady\", handleWebComponentsReady);\n }\n}\n\nfunction handleWebComponentsReady() {\n console.log(\"[reveal] web components ready\");\n reveal();\n}\n","import { autoReveal } from \"./utilities/reveal.umd.js\";\n\n/*\n * Copyright 2018 Red Hat, Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nclass RHElement extends HTMLElement {\n static create(rhe) {\n window.customElements.define(rhe.tag, rhe);\n }\n\n static get RhTypes() {\n return {\n Container: \"container\",\n Content: \"content\",\n Pattern: \"pattern\"\n };\n }\n\n get rhType() {\n return this.getAttribute(\"rh-type\");\n }\n\n set rhType(value) {\n this.setAttribute(\"rh-type\", value);\n }\n\n constructor(rhClass, { type = null, delayRender = false } = {}) {\n super();\n\n this._rhClass = rhClass;\n this.tag = rhClass.tag;\n this._queue = [];\n this.template = document.createElement(\"template\");\n\n this.attachShadow({ mode: \"open\" });\n\n if (type) {\n this._queueAction({\n type: \"setProperty\",\n data: {\n name: \"rhType\",\n value: type\n }\n });\n }\n\n if (!delayRender) {\n this.render();\n }\n }\n\n connectedCallback() {\n if (window.ShadyCSS) {\n window.ShadyCSS.styleElement(this);\n }\n\n if (this._queue.length) {\n this._processQueue();\n }\n }\n\n attributeChangedCallback(attr, oldVal, newVal) {\n const cascadeTo = this._rhClass.cascadingAttributes[attr];\n if (cascadeTo) {\n this._copyAttribute(attr, cascadeTo);\n }\n }\n\n _copyAttribute(name, to) {\n const recipients = this.shadowRoot.querySelectorAll(to);\n const value = this.getAttribute(name);\n const fname = value == null ? \"removeAttribute\" : \"setAttribute\";\n for (const node of recipients) {\n node[fname](name, value);\n }\n }\n\n _queueAction(action) {\n this._queue.push(action);\n }\n\n _processQueue() {\n this._queue.forEach(action => {\n this[`_${action.type}`](action.data);\n });\n\n this._queue = [];\n }\n\n _setProperty({ name, value }) {\n this[name] = value;\n }\n\n render() {\n this.shadowRoot.innerHTML = \"\";\n this.template.innerHTML = this.html;\n\n if (window.ShadyCSS) {\n window.ShadyCSS.prepareTemplate(this.template, this.tag);\n }\n\n this.shadowRoot.appendChild(this.template.content.cloneNode(true));\n }\n}\n\nautoReveal();\n\nexport default RHElement;\n//# sourceMappingURL=rhelement.js.map\n"],"names":["handleWebComponentsReady","log","document","body","removeAttribute","RHElement","rhClass","type","delayRender","_rhClass","tag","_queue","template","createElement","attachShadow","mode","_queueAction","render","HTMLElement","this","getAttribute","value","setAttribute","rhe","customElements","define","window","ShadyCSS","styleElement","length","_processQueue","attr","oldVal","newVal","cascadeTo","cascadingAttributes","_copyAttribute","name","to","recipients","shadowRoot","querySelectorAll","fname","action","push","forEach","data","innerHTML","html","prepareTemplate","appendChild","content","cloneNode","WebComponents","ready","addEventListener"],"mappings":"qLAwCA,SAASA,YACCC,IAAI,yCAlBJA,0DACDC,SAASC,KAAKC,gBAAgB,uQCAjCC,yBAqBQC,gEAAgD,OAArCC,KAAAA,aAAO,WAAMC,YAAAA,gWAG7BC,SAAWH,IACXI,IAAMJ,EAAQI,MACdC,OAAS,KACTC,SAAWV,SAASW,cAAc,cAElCC,aAAa,CAAEC,KAAM,SAEtBR,KACGS,aAAa,MACV,mBACA,MACE,eACCT,KAKRC,KACES,8UA1CaC,sDAcbC,KAAKC,aAAa,yBAGhBC,QACJC,aAAa,UAAWD,oCAjBjBE,UACLC,eAAeC,OAAOF,EAAIb,IAAKa,yCAI/B,WACM,oBACF,kBACA,8DAsCPG,OAAOC,iBACFA,SAASC,aAAaT,MAG3BA,KAAKR,OAAOkB,aACTC,iEAIgBC,EAAMC,EAAQC,OAC/BC,EAAYf,KAAKV,SAAS0B,oBAAoBJ,GAChDG,QACGE,eAAeL,EAAMG,0CAIfG,EAAMC,OACbC,EAAapB,KAAKqB,WAAWC,iBAAiBH,GAC9CjB,EAAQF,KAAKC,aAAaiB,GAC1BK,EAAiB,MAATrB,EAAgB,kBAAoB,kDAC/BkB,iDAAY,SACxBG,GAAOL,EAAMhB,uHAITsB,QACNhC,OAAOiC,KAAKD,2DAIZhC,OAAOkC,QAAQ,kBACTF,EAAOpC,MAAQoC,EAAOG,aAG5BnC,OAAS,+CAGD0B,IAAAA,KAAMhB,IAAAA,WACdgB,GAAQhB,wCAIRmB,WAAWO,UAAY,QACvBnC,SAASmC,UAAY5B,KAAK6B,KAE3BtB,OAAOC,iBACFA,SAASsB,gBAAgB9B,KAAKP,SAAUO,KAAKT,UAGjD8B,WAAWU,YAAY/B,KAAKP,SAASuC,QAAQC,WAAU,oBDvF1D1B,OAAO2B,cAAcC,iBAGhBC,iBAAiB,qBAAsBvD"} \ No newline at end of file