Socket
Socket
Sign inDemoInstall

x-weather

Package Overview
Dependencies
63
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.11 to 0.0.12

2

lib/build-custom-elements-shady-dom-esm/esm/x-weather.js

@@ -1,1 +0,1 @@

import{a as loadComponent,b as classCallCheck,c as createClass,d as inherits,e as possibleConstructorReturn,f as toConsumableArray}from"./utilities-aabd0479.js";function _CustomElement(){return Reflect.construct(HTMLElement,[],this.__proto__.constructor)}Object.setPrototypeOf(_CustomElement.prototype,HTMLElement.prototype),Object.setPrototypeOf(_CustomElement,HTMLElement);var template='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-weather] #location {\n border: 0;\n font-style: italic;\n margin: 0 0 0 0.5rem;\n padding: 0 0.5rem 0 0;\n width: 100%;\n }\n </style>\n\n <div data-x-weather>\n <div><input id="location"></input></div>\n\n <slot></slot>\n </div>\n',XWeather=function(t){function e(){classCallCheck(this,e);var t=possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this)),n=document.createElement("div");return n.innerHTML=template,t.attachShadow({mode:"open"}).appendChild(n),t}return inherits(e,_CustomElement),createClass(e,[{key:"connectedCallback",value:function(){var t=this;this._upgradeProperty("appid"),this._upgradeProperty("host"),this._upgradeProperty("location"),this.xCurrent=this.querySelector("x-current"),this.xForecast=this.querySelector("x-forecast"),this._renderLocation(this.location);var e=this.shadowRoot.querySelector("#location");e.addEventListener("change",function(){t.location=e.value,t.xCurrent.refresh().then(function(e){t.xCurrent.render(e),t.xCurrent.currentWeather=e}),t.xForecast.refresh().then(function(e){t.xForecast.render(e),t.xForecast.currentForecast=e})})}},{key:"attributeChangedCallback",value:function(t,e,n){(e!==n&&"appid"===t||"host"===t||"location"===t)&&("location"===t&&this._renderLocation(this.location),this.xCurrent&&this.xCurrent.setAttribute(t,n),this.xForecast&&this.xForecast.setAttribute(t,n))}},{key:"_renderLocation",value:function(t){this.shadowRoot.querySelector("#location").value=t}},{key:"_upgradeProperty",value:function(t){if(this.hasOwnProperty(t)){var e=this[t];delete this[t],this[t]=e}}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}}],[{key:"observedAttributes",get:function(){return["appid","host","location"]}}]),e}(),load=function(){return loadComponent({customElements:customElements,tagName:"x-weather",element:XWeather})};export default XWeather;export{load};
import{a as loadComponent,b as classCallCheck,c as createClass,d as inherits,e as possibleConstructorReturn,f as toConsumableArray}from"./utilities-aabd0479.js";function _CustomElement(){return Reflect.construct(HTMLElement,[],this.__proto__.constructor)}Object.setPrototypeOf(_CustomElement.prototype,HTMLElement.prototype),Object.setPrototypeOf(_CustomElement,HTMLElement);var template='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-weather] #location {\n border: 0;\n font-style: italic;\n margin: 0 0 0 2.5%;\n padding: 0 2.5% 0 0;\n width: 95%;\n }\n </style>\n\n <div data-x-weather>\n <div><input id="location"></input></div>\n\n <slot></slot>\n </div>\n',XWeather=function(t){function e(){classCallCheck(this,e);var t=possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this)),n=document.createElement("div");return n.innerHTML=template,t.attachShadow({mode:"open"}).appendChild(n),t}return inherits(e,_CustomElement),createClass(e,[{key:"connectedCallback",value:function(){var t=this;this._upgradeProperty("appid"),this._upgradeProperty("host"),this._upgradeProperty("location"),this.xCurrent=this.querySelector("x-current"),this.xForecast=this.querySelector("x-forecast"),this._renderLocation(this.location);var e=this.shadowRoot.querySelector("#location");e.addEventListener("change",function(){t.location=e.value,t.xCurrent.refresh().then(function(e){t.xCurrent.render(e),t.xCurrent.currentWeather=e}),t.xForecast.refresh().then(function(e){t.xForecast.render(e),t.xForecast.currentForecast=e})})}},{key:"attributeChangedCallback",value:function(t,e,n){(e!==n&&"appid"===t||"host"===t||"location"===t)&&("location"===t&&this._renderLocation(this.location),this.xCurrent&&this.xCurrent.setAttribute(t,n),this.xForecast&&this.xForecast.setAttribute(t,n))}},{key:"_renderLocation",value:function(t){this.shadowRoot.querySelector("#location").value=t}},{key:"_upgradeProperty",value:function(t){if(this.hasOwnProperty(t)){var e=this[t];delete this[t],this[t]=e}}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}}],[{key:"observedAttributes",get:function(){return["appid","host","location"]}}]),e}(),load=function(){return loadComponent({customElements:customElements,tagName:"x-weather",element:XWeather})};export default XWeather;export{load};

@@ -1,1 +0,1 @@

System.register(["./utilities-efc14eb9.js"],function(n,t){"use strict";var r,o,i,s,a;return{setters:[function(t){r=t.a,o=t.b,i=t.c,s=t.d,a=t.e,t.f}],execute:function(){function e(){return Reflect.construct(HTMLElement,[],this.__proto__.constructor)}Object.setPrototypeOf(e.prototype,HTMLElement.prototype),Object.setPrototypeOf(e,HTMLElement);var t=function(t){function n(){o(this,n);var t=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-weather] #location {\n border: 0;\n font-style: italic;\n margin: 0 0 0 0.5rem;\n padding: 0 0.5rem 0 0;\n width: 100%;\n }\n </style>\n\n <div data-x-weather>\n <div><input id="location"></input></div>\n\n <slot></slot>\n </div>\n',t.attachShadow({mode:"open"}).appendChild(e),t}return s(n,e),i(n,[{key:"connectedCallback",value:function(){var e=this;this._upgradeProperty("appid"),this._upgradeProperty("host"),this._upgradeProperty("location"),this.xCurrent=this.querySelector("x-current"),this.xForecast=this.querySelector("x-forecast"),this._renderLocation(this.location);var t=this.shadowRoot.querySelector("#location");t.addEventListener("change",function(){e.location=t.value,e.xCurrent.refresh().then(function(t){e.xCurrent.render(t),e.xCurrent.currentWeather=t}),e.xForecast.refresh().then(function(t){e.xForecast.render(t),e.xForecast.currentForecast=t})})}},{key:"attributeChangedCallback",value:function(t,e,n){(e!==n&&"appid"===t||"host"===t||"location"===t)&&("location"===t&&this._renderLocation(this.location),this.xCurrent&&this.xCurrent.setAttribute(t,n),this.xForecast&&this.xForecast.setAttribute(t,n))}},{key:"_renderLocation",value:function(t){this.shadowRoot.querySelector("#location").value=t}},{key:"_upgradeProperty",value:function(t){if(this.hasOwnProperty(t)){var e=this[t];delete this[t],this[t]=e}}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}}],[{key:"observedAttributes",get:function(){return["appid","host","location"]}}]),n}();n("load",function(){return r({customElements:customElements,tagName:"x-weather",element:t})});n("default",t)}}});
System.register(["./utilities-efc14eb9.js"],function(n,t){"use strict";var r,o,i,s,a;return{setters:[function(t){r=t.a,o=t.b,i=t.c,s=t.d,a=t.e,t.f}],execute:function(){function e(){return Reflect.construct(HTMLElement,[],this.__proto__.constructor)}Object.setPrototypeOf(e.prototype,HTMLElement.prototype),Object.setPrototypeOf(e,HTMLElement);var t=function(t){function n(){o(this,n);var t=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-weather] #location {\n border: 0;\n font-style: italic;\n margin: 0 0 0 2.5%;\n padding: 0 2.5% 0 0;\n width: 95%;\n }\n </style>\n\n <div data-x-weather>\n <div><input id="location"></input></div>\n\n <slot></slot>\n </div>\n',t.attachShadow({mode:"open"}).appendChild(e),t}return s(n,e),i(n,[{key:"connectedCallback",value:function(){var e=this;this._upgradeProperty("appid"),this._upgradeProperty("host"),this._upgradeProperty("location"),this.xCurrent=this.querySelector("x-current"),this.xForecast=this.querySelector("x-forecast"),this._renderLocation(this.location);var t=this.shadowRoot.querySelector("#location");t.addEventListener("change",function(){e.location=t.value,e.xCurrent.refresh().then(function(t){e.xCurrent.render(t),e.xCurrent.currentWeather=t}),e.xForecast.refresh().then(function(t){e.xForecast.render(t),e.xForecast.currentForecast=t})})}},{key:"attributeChangedCallback",value:function(t,e,n){(e!==n&&"appid"===t||"host"===t||"location"===t)&&("location"===t&&this._renderLocation(this.location),this.xCurrent&&this.xCurrent.setAttribute(t,n),this.xForecast&&this.xForecast.setAttribute(t,n))}},{key:"_renderLocation",value:function(t){this.shadowRoot.querySelector("#location").value=t}},{key:"_upgradeProperty",value:function(t){if(this.hasOwnProperty(t)){var e=this[t];delete this[t],this[t]=e}}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}}],[{key:"observedAttributes",get:function(){return["appid","host","location"]}}]),n}();n("load",function(){return r({customElements:customElements,tagName:"x-weather",element:t})});n("default",t)}}});

@@ -1,1 +0,1 @@

var Main=function(){"use strict";var r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e=function(){function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}}(),i=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},a=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},g=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"cToF",n=function(t){return t+273.15},r=function(t){return t-273.15},i=function(t){return 1.8*t+32},a=function(t){return 5*(t-32)/9};return{cToK:n,kToC:r,cToF:i,fToC:a,kToF:function(t){return i(r(t))},fToK:function(t){return n(a(t))}}[e](t)},t=function(t){var e=t.customElements,n=t.tagName,r=t.element,i=function(t){var e=t.customElements,n=t.tagName,r=t.element;e.define(n,r)};window.customElements?i({customElements:e,tagName:n,element:r}):document.addEventListener("WebComponentsReady",function(){i({customElements:e,tagName:n,element:r})})},v=function(t){return new Date(1e3*t)},b=function(t){return{date:t,results:"",getResults:function(){return this.results},getTimeStamp:function(){return this.date.getTime()},Y:function(t){return this.results+=this.date.getFullYear(),this.sep(t)&&(this.results+=t),this},m:function(t){return this.results+=this.pad(this.date.getMonth()+1),this.sep(t)&&(this.results+=t),this},d:function(t){return this.results+=this.pad(this.date.getDate()),this.sep(t)&&(this.results+=t),this},H:function(t){return this.results+=this.pad(this.date.getHours()),this.sep(t)&&(this.results+=t),this},M:function(t){return this.results+=this.pad(this.date.getMinutes()),this.sep(t)&&(this.results+=t),this},S:function(t){return this.results+=this.pad(this.date.getSeconds()),this.sep(t)&&(this.results+=t),this},pad:function(t){return t<10?"0"+t:t},sep:function(t){return!!t}}},n=function(t){function n(){r(this,n);var t=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-current] h3 {\n padding-left: 0.5rem;\n }\n\n div[data-x-current] ul {\n list-style-type: none;\n padding: 0 0 1rem 1.5rem;\n }\n\n div[data-x-current] ul > li {\n padding: 0.5rem 0 0 0;\n }\n\n div[data-x-current] #time {\n display: none;\n }\n\n div[data-x-current] #alternateScale {\n cursor: pointer;\n border-bottom: 1px dotted;\n }\n </style>\n\n <div data-x-current>\n <h3>Current</h3>\n <ul>\n <li id="time"></li>\n <li><img alt="" id="icon"></img></li>\n <li>\n <span id="temperature"></span>°<span id="primaryScale"></span> / <span><a id="alternateScale"></a></span>\n </li>\n </ul>\n </div>\n',t.attachShadow({mode:"open"}).appendChild(e),t}return i(n,t),e(n,[{key:"connectedCallback",value:function(){var e=this;this.refresh().then(function(t){e.render(t),e.currentWeather=t,e.primaryScale=e.shadowRoot.querySelector("#primaryScale"),e.alternateScale=e.shadowRoot.querySelector("#alternateScale"),e.primaryScale.textContent=e.scale,e.alternateScale.textContent="C"===e.scale?"F":"C",e.alternateScale.onclick=function(){e.scale=e.alternateScale.textContent;var t=e.parentElement.querySelector("x-forecast");t&&t.setAttribute("scale",e.primaryScale.textContent)}})}},{key:"attributeChangedCallback",value:function(t,e,n){"scale"===t&&e!==n&&this.alternateScale&&this.primaryScale&&("C"===n&&(this.alternateScale.textContent="F",this.primaryScale.textContent=n),"F"===n&&(this.alternateScale.textContent="C",this.primaryScale.textContent=n),this.render(this.currentWeather))}},{key:"_getCurrentWeather",value:function(t){var e=t.appid,n=t.host,r=t.location;if(e&&n&&r)return this._serviceHandler({appid:e,host:n,location:r}).then(function(t){t.coord;var e=t.weather,n=(t.base,t.main),r=(t.visibility,t.wind,t.clouds,t.dt);t.sys,t.id,t.name,t.cod;return{iconAlt:e[0].description,iconSrc:e[0].icon,temperature:{kelvin:n.temp,celsius:g(n.temp,"kToC"),fahrenheit:g(n.temp,"kToF")},timestamp:r}})}},{key:"_serviceHandler",value:function(t){var e=t.appid,n=t.host,r=t.location;return fetch("https://"+n+"/data/2.5/weather?q="+r+"&appid="+e,{method:"GET"}).then(function(t){if(t.ok)return t.json()})}},{key:"refresh",value:function(){var t={appid:this.parentElement.getAttribute("appid"),host:this.parentElement.getAttribute("host"),location:this.parentElement.getAttribute("location")};return this._getCurrentWeather(t)}},{key:"render",value:function(t){var e=t.iconAlt,n=t.iconSrc,r=t.temperature,i=t.timestamp;this.temperature=Number.parseFloat(r["C"===this.scale?"celsius":"fahrenheit"]).toFixed(2),this.iconAlt=e,this.iconSrc="https://openweathermap.org/img/w/"+n+".png",this.timestamp=i}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}},{key:"iconAlt",set:function(t){this.shadowRoot.querySelector("#icon").setAttribute("alt",t)}},{key:"iconSrc",set:function(t){this.shadowRoot.querySelector("#icon").src=t}},{key:"scale",get:function(){return this.getAttribute("scale")},set:function(t){this.setAttribute("scale",t)}},{key:"temperature",set:function(t){this.setAttribute("temperature",t),this.shadowRoot.querySelector("#temperature").textContent=t}},{key:"timestamp",set:function(t){this.shadowRoot.querySelector("#time").textContent=b(v(t)).H(":").M(":").S().getResults()}}],[{key:"observedAttributes",get:function(){return["scale"]}}]),n}(HTMLElement),o=function(t){function n(){r(this,n);var t=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML="\n <style>\n :host {\n display: block;\n }\n\n div[data-x-forecast] h3 {\n padding-left: 0.5rem;\n }\n\n div[data-x-forecast] ul {\n list-style-type: none;\n padding: 0 0 1rem 1.5rem;\n }\n\n div[data-x-forecast] ul > li {\n padding: 0.5rem 0 0 0;\n }\n </style>\n\n <div data-x-forecast>\n <h3>Forecast</h3>\n\n <div data-x-forecast-date-container>\n <div/>\n",t.attachShadow({mode:"open"}).appendChild(e),t}return i(n,t),e(n,[{key:"connectedCallback",value:function(){var e=this;this.refresh().then(function(t){e.render(t),e.currentForecast=t})}},{key:"attributeChangedCallback",value:function(t,e,n){e!==n&&"scale"===t&&this.render(this.currentForecast)}},{key:"_buildDateContainer",value:function(t){var e,f=this,m=document.createElement("div");if(m.setAttribute("data-x-forecast-date-container",""),t&&(e=t,0!==Object.keys(e).length||e.constructor!==Object)){var y=b(new Date).Y("-").m("-").d("").getResults();t.forEach(function(t){var e=t.dt,n=t.temp,r=(t.pressure,t.humidity,t.weather,t.speed,t.deg,t.clouds,t.rain,document.createElement("ul")),i=document.createElement("u"),a=v(e),o=b(a).Y("-").m("-").d().getResults(),s="F"===f.scale?g(n.day,"cToF"):n.day,c="F"===f.scale?g(n.night,"cToF"):n.night;if(o===y)i.textContent="Today:";else{var u=b(a).date.toLocaleString("en-US",{weekday:"long"}),l=b(a).m("/").d().getResults();i.textContent=u+" ("+l+"):"}var h=document.createElement("li");h.appendChild(i),r.appendChild(h);var d=document.createElement("li");d.textContent="Day: "+Number.parseFloat(s).toFixed(2)+"°"+f.scale,r.appendChild(d);var p=document.createElement("li");p.textContent="Night: "+Number.parseFloat(c).toFixed(2)+"°"+f.scale,r.appendChild(p),m.appendChild(r)})}return m}},{key:"_getForecast",value:function(t){var e=t.appid,n=t.host,r=t.location;if(e&&n&&r)return this._serviceHandler({appid:e,host:n,location:r}).then(function(t){t.city,t.cod,t.message,t.cnt;return t.list})}},{key:"_serviceHandler",value:function(t){var e=t.appid,n=t.host,r=t.location;return fetch("https://"+n+"/data/2.5/forecast/daily?q="+r+"&mode=json&units=metric&cnt=14&appid="+e,{method:"GET"}).then(function(t){if(t.ok)return t.json()})}},{key:"refresh",value:function(){var t={appid:this.parentElement.getAttribute("appid"),host:this.parentElement.getAttribute("host"),location:this.parentElement.getAttribute("location")};return this._getForecast(t)}},{key:"render",value:function(t){var e=this.shadowRoot.querySelector("[data-x-forecast]"),n=this.shadowRoot.querySelector("[data-x-forecast] > [data-x-forecast-date-container]");e.replaceChild(this._buildDateContainer(t),n)}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}},{key:"scale",get:function(){return this.getAttribute("scale")},set:function(t){this.setAttribute("scale",t)}}],[{key:"observedAttributes",get:function(){return["scale"]}}]),n}(HTMLElement),s=function(t){function n(){r(this,n);var t=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-weather] #location {\n border: 0;\n font-style: italic;\n margin: 0 0 0 0.5rem;\n padding: 0 0.5rem 0 0;\n width: 100%;\n }\n </style>\n\n <div data-x-weather>\n <div><input id="location"></input></div>\n\n <slot></slot>\n </div>\n',t.attachShadow({mode:"open"}).appendChild(e),t}return i(n,t),e(n,[{key:"connectedCallback",value:function(){var e=this;this._upgradeProperty("appid"),this._upgradeProperty("host"),this._upgradeProperty("location"),this.xCurrent=this.querySelector("x-current"),this.xForecast=this.querySelector("x-forecast"),this._renderLocation(this.location);var t=this.shadowRoot.querySelector("#location");t.addEventListener("change",function(){e.location=t.value,e.xCurrent.refresh().then(function(t){e.xCurrent.render(t),e.xCurrent.currentWeather=t}),e.xForecast.refresh().then(function(t){e.xForecast.render(t),e.xForecast.currentForecast=t})})}},{key:"attributeChangedCallback",value:function(t,e,n){(e!==n&&"appid"===t||"host"===t||"location"===t)&&("location"===t&&this._renderLocation(this.location),this.xCurrent&&this.xCurrent.setAttribute(t,n),this.xForecast&&this.xForecast.setAttribute(t,n))}},{key:"_renderLocation",value:function(t){this.shadowRoot.querySelector("#location").value=t}},{key:"_upgradeProperty",value:function(t){if(this.hasOwnProperty(t)){var e=this[t];delete this[t],this[t]=e}}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}}],[{key:"observedAttributes",get:function(){return["appid","host","location"]}}]),n}(HTMLElement);return t({customElements:customElements,tagName:"x-current",element:n}),t({customElements:customElements,tagName:"x-forecast",element:o}),t({customElements:customElements,tagName:"x-weather",element:s}),{XCurrent:n,XForecast:o,XWeather:s}}();
var Main=function(){"use strict";var r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e=function(){function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}}(),i=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},a=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},g=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"cToF",n=function(t){return t+273.15},r=function(t){return t-273.15},i=function(t){return 1.8*t+32},a=function(t){return 5*(t-32)/9};return{cToK:n,kToC:r,cToF:i,fToC:a,kToF:function(t){return i(r(t))},fToK:function(t){return n(a(t))}}[e](t)},t=function(t){var e=t.customElements,n=t.tagName,r=t.element,i=function(t){var e=t.customElements,n=t.tagName,r=t.element;e.define(n,r)};window.customElements?i({customElements:e,tagName:n,element:r}):document.addEventListener("WebComponentsReady",function(){i({customElements:e,tagName:n,element:r})})},v=function(t){return new Date(1e3*t)},b=function(t){return{date:t,results:"",getResults:function(){return this.results},getTimeStamp:function(){return this.date.getTime()},Y:function(t){return this.results+=this.date.getFullYear(),this.sep(t)&&(this.results+=t),this},m:function(t){return this.results+=this.pad(this.date.getMonth()+1),this.sep(t)&&(this.results+=t),this},d:function(t){return this.results+=this.pad(this.date.getDate()),this.sep(t)&&(this.results+=t),this},H:function(t){return this.results+=this.pad(this.date.getHours()),this.sep(t)&&(this.results+=t),this},M:function(t){return this.results+=this.pad(this.date.getMinutes()),this.sep(t)&&(this.results+=t),this},S:function(t){return this.results+=this.pad(this.date.getSeconds()),this.sep(t)&&(this.results+=t),this},pad:function(t){return t<10?"0"+t:t},sep:function(t){return!!t}}},n=function(t){function n(){r(this,n);var t=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-current] h3 {\n padding-left: 0.5rem;\n }\n\n div[data-x-current] ul {\n list-style-type: none;\n padding: 0 0 1rem 1.5rem;\n }\n\n div[data-x-current] ul > li {\n padding: 0.5rem 0 0 0;\n }\n\n div[data-x-current] #time {\n display: none;\n }\n\n div[data-x-current] #alternateScale {\n cursor: pointer;\n border-bottom: 1px dotted;\n }\n </style>\n\n <div data-x-current>\n <h3>Current</h3>\n <ul>\n <li id="time"></li>\n <li><img alt="" id="icon"></img></li>\n <li>\n <span id="temperature"></span>°<span id="primaryScale"></span> / <span><a id="alternateScale"></a></span>\n </li>\n </ul>\n </div>\n',t.attachShadow({mode:"open"}).appendChild(e),t}return i(n,t),e(n,[{key:"connectedCallback",value:function(){var e=this;this.refresh().then(function(t){e.render(t),e.currentWeather=t,e.primaryScale=e.shadowRoot.querySelector("#primaryScale"),e.alternateScale=e.shadowRoot.querySelector("#alternateScale"),e.primaryScale.textContent=e.scale,e.alternateScale.textContent="C"===e.scale?"F":"C",e.alternateScale.onclick=function(){e.scale=e.alternateScale.textContent;var t=e.parentElement.querySelector("x-forecast");t&&t.setAttribute("scale",e.primaryScale.textContent)}})}},{key:"attributeChangedCallback",value:function(t,e,n){"scale"===t&&e!==n&&this.alternateScale&&this.primaryScale&&("C"===n&&(this.alternateScale.textContent="F",this.primaryScale.textContent=n),"F"===n&&(this.alternateScale.textContent="C",this.primaryScale.textContent=n),this.render(this.currentWeather))}},{key:"_getCurrentWeather",value:function(t){var e=t.appid,n=t.host,r=t.location;if(e&&n&&r)return this._serviceHandler({appid:e,host:n,location:r}).then(function(t){t.coord;var e=t.weather,n=(t.base,t.main),r=(t.visibility,t.wind,t.clouds,t.dt);t.sys,t.id,t.name,t.cod;return{iconAlt:e[0].description,iconSrc:e[0].icon,temperature:{kelvin:n.temp,celsius:g(n.temp,"kToC"),fahrenheit:g(n.temp,"kToF")},timestamp:r}})}},{key:"_serviceHandler",value:function(t){var e=t.appid,n=t.host,r=t.location;return fetch("https://"+n+"/data/2.5/weather?q="+r+"&appid="+e,{method:"GET"}).then(function(t){if(t.ok)return t.json()})}},{key:"refresh",value:function(){var t={appid:this.parentElement.getAttribute("appid"),host:this.parentElement.getAttribute("host"),location:this.parentElement.getAttribute("location")};return this._getCurrentWeather(t)}},{key:"render",value:function(t){var e=t.iconAlt,n=t.iconSrc,r=t.temperature,i=t.timestamp;this.temperature=Number.parseFloat(r["C"===this.scale?"celsius":"fahrenheit"]).toFixed(2),this.iconAlt=e,this.iconSrc="https://openweathermap.org/img/w/"+n+".png",this.timestamp=i}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}},{key:"iconAlt",set:function(t){this.shadowRoot.querySelector("#icon").setAttribute("alt",t)}},{key:"iconSrc",set:function(t){this.shadowRoot.querySelector("#icon").src=t}},{key:"scale",get:function(){return this.getAttribute("scale")},set:function(t){this.setAttribute("scale",t)}},{key:"temperature",set:function(t){this.setAttribute("temperature",t),this.shadowRoot.querySelector("#temperature").textContent=t}},{key:"timestamp",set:function(t){this.shadowRoot.querySelector("#time").textContent=b(v(t)).H(":").M(":").S().getResults()}}],[{key:"observedAttributes",get:function(){return["scale"]}}]),n}(HTMLElement),o=function(t){function n(){r(this,n);var t=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML="\n <style>\n :host {\n display: block;\n }\n\n div[data-x-forecast] h3 {\n padding-left: 0.5rem;\n }\n\n div[data-x-forecast] ul {\n list-style-type: none;\n padding: 0 0 1rem 1.5rem;\n }\n\n div[data-x-forecast] ul > li {\n padding: 0.5rem 0 0 0;\n }\n </style>\n\n <div data-x-forecast>\n <h3>Forecast</h3>\n\n <div data-x-forecast-date-container>\n <div/>\n",t.attachShadow({mode:"open"}).appendChild(e),t}return i(n,t),e(n,[{key:"connectedCallback",value:function(){var e=this;this.refresh().then(function(t){e.render(t),e.currentForecast=t})}},{key:"attributeChangedCallback",value:function(t,e,n){e!==n&&"scale"===t&&this.render(this.currentForecast)}},{key:"_buildDateContainer",value:function(t){var e,f=this,m=document.createElement("div");if(m.setAttribute("data-x-forecast-date-container",""),t&&(e=t,0!==Object.keys(e).length||e.constructor!==Object)){var y=b(new Date).Y("-").m("-").d("").getResults();t.forEach(function(t){var e=t.dt,n=t.temp,r=(t.pressure,t.humidity,t.weather,t.speed,t.deg,t.clouds,t.rain,document.createElement("ul")),i=document.createElement("u"),a=v(e),o=b(a).Y("-").m("-").d().getResults(),s="F"===f.scale?g(n.day,"cToF"):n.day,c="F"===f.scale?g(n.night,"cToF"):n.night;if(o===y)i.textContent="Today:";else{var u=b(a).date.toLocaleString("en-US",{weekday:"long"}),l=b(a).m("/").d().getResults();i.textContent=u+" ("+l+"):"}var h=document.createElement("li");h.appendChild(i),r.appendChild(h);var d=document.createElement("li");d.textContent="Day: "+Number.parseFloat(s).toFixed(2)+"°"+f.scale,r.appendChild(d);var p=document.createElement("li");p.textContent="Night: "+Number.parseFloat(c).toFixed(2)+"°"+f.scale,r.appendChild(p),m.appendChild(r)})}return m}},{key:"_getForecast",value:function(t){var e=t.appid,n=t.host,r=t.location;if(e&&n&&r)return this._serviceHandler({appid:e,host:n,location:r}).then(function(t){t.city,t.cod,t.message,t.cnt;return t.list})}},{key:"_serviceHandler",value:function(t){var e=t.appid,n=t.host,r=t.location;return fetch("https://"+n+"/data/2.5/forecast/daily?q="+r+"&mode=json&units=metric&cnt=14&appid="+e,{method:"GET"}).then(function(t){if(t.ok)return t.json()})}},{key:"refresh",value:function(){var t={appid:this.parentElement.getAttribute("appid"),host:this.parentElement.getAttribute("host"),location:this.parentElement.getAttribute("location")};return this._getForecast(t)}},{key:"render",value:function(t){var e=this.shadowRoot.querySelector("[data-x-forecast]"),n=this.shadowRoot.querySelector("[data-x-forecast] > [data-x-forecast-date-container]");e.replaceChild(this._buildDateContainer(t),n)}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}},{key:"scale",get:function(){return this.getAttribute("scale")},set:function(t){this.setAttribute("scale",t)}}],[{key:"observedAttributes",get:function(){return["scale"]}}]),n}(HTMLElement),s=function(t){function n(){r(this,n);var t=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-weather] #location {\n border: 0;\n font-style: italic;\n margin: 0 0 0 2.5%;\n padding: 0 2.5% 0 0;\n width: 95%;\n }\n </style>\n\n <div data-x-weather>\n <div><input id="location"></input></div>\n\n <slot></slot>\n </div>\n',t.attachShadow({mode:"open"}).appendChild(e),t}return i(n,t),e(n,[{key:"connectedCallback",value:function(){var e=this;this._upgradeProperty("appid"),this._upgradeProperty("host"),this._upgradeProperty("location"),this.xCurrent=this.querySelector("x-current"),this.xForecast=this.querySelector("x-forecast"),this._renderLocation(this.location);var t=this.shadowRoot.querySelector("#location");t.addEventListener("change",function(){e.location=t.value,e.xCurrent.refresh().then(function(t){e.xCurrent.render(t),e.xCurrent.currentWeather=t}),e.xForecast.refresh().then(function(t){e.xForecast.render(t),e.xForecast.currentForecast=t})})}},{key:"attributeChangedCallback",value:function(t,e,n){(e!==n&&"appid"===t||"host"===t||"location"===t)&&("location"===t&&this._renderLocation(this.location),this.xCurrent&&this.xCurrent.setAttribute(t,n),this.xForecast&&this.xForecast.setAttribute(t,n))}},{key:"_renderLocation",value:function(t){this.shadowRoot.querySelector("#location").value=t}},{key:"_upgradeProperty",value:function(t){if(this.hasOwnProperty(t)){var e=this[t];delete this[t],this[t]=e}}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}}],[{key:"observedAttributes",get:function(){return["appid","host","location"]}}]),n}(HTMLElement);return t({customElements:customElements,tagName:"x-current",element:n}),t({customElements:customElements,tagName:"x-forecast",element:o}),t({customElements:customElements,tagName:"x-weather",element:s}),{XCurrent:n,XForecast:o,XWeather:s}}();

@@ -1,1 +0,1 @@

System.register(["./utilities-efc14eb9.js"],function(e,t){"use strict";var n,r,i,o,a;return{setters:[function(t){n=t.a,r=t.b,i=t.c,o=t.d,a=t.e,t.f}],execute:function(){var t=function(t){function n(){r(this,n);var t=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-weather] #location {\n border: 0;\n font-style: italic;\n margin: 0 0 0 0.5rem;\n padding: 0 0.5rem 0 0;\n width: 100%;\n }\n </style>\n\n <div data-x-weather>\n <div><input id="location"></input></div>\n\n <slot></slot>\n </div>\n',t.attachShadow({mode:"open"}).appendChild(e),t}return o(n,t),i(n,[{key:"connectedCallback",value:function(){var e=this;this._upgradeProperty("appid"),this._upgradeProperty("host"),this._upgradeProperty("location"),this.xCurrent=this.querySelector("x-current"),this.xForecast=this.querySelector("x-forecast"),this._renderLocation(this.location);var t=this.shadowRoot.querySelector("#location");t.addEventListener("change",function(){e.location=t.value,e.xCurrent.refresh().then(function(t){e.xCurrent.render(t),e.xCurrent.currentWeather=t}),e.xForecast.refresh().then(function(t){e.xForecast.render(t),e.xForecast.currentForecast=t})})}},{key:"attributeChangedCallback",value:function(t,e,n){(e!==n&&"appid"===t||"host"===t||"location"===t)&&("location"===t&&this._renderLocation(this.location),this.xCurrent&&this.xCurrent.setAttribute(t,n),this.xForecast&&this.xForecast.setAttribute(t,n))}},{key:"_renderLocation",value:function(t){this.shadowRoot.querySelector("#location").value=t}},{key:"_upgradeProperty",value:function(t){if(this.hasOwnProperty(t)){var e=this[t];delete this[t],this[t]=e}}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}}],[{key:"observedAttributes",get:function(){return["appid","host","location"]}}]),n}(HTMLElement);e("load",function(){return n({customElements:customElements,tagName:"x-weather",element:t})});e("default",t)}}});
System.register(["./utilities-efc14eb9.js"],function(e,t){"use strict";var n,r,i,o,a;return{setters:[function(t){n=t.a,r=t.b,i=t.c,o=t.d,a=t.e,t.f}],execute:function(){var t=function(t){function n(){r(this,n);var t=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-weather] #location {\n border: 0;\n font-style: italic;\n margin: 0 0 0 2.5%;\n padding: 0 2.5% 0 0;\n width: 95%;\n }\n </style>\n\n <div data-x-weather>\n <div><input id="location"></input></div>\n\n <slot></slot>\n </div>\n',t.attachShadow({mode:"open"}).appendChild(e),t}return o(n,t),i(n,[{key:"connectedCallback",value:function(){var e=this;this._upgradeProperty("appid"),this._upgradeProperty("host"),this._upgradeProperty("location"),this.xCurrent=this.querySelector("x-current"),this.xForecast=this.querySelector("x-forecast"),this._renderLocation(this.location);var t=this.shadowRoot.querySelector("#location");t.addEventListener("change",function(){e.location=t.value,e.xCurrent.refresh().then(function(t){e.xCurrent.render(t),e.xCurrent.currentWeather=t}),e.xForecast.refresh().then(function(t){e.xForecast.render(t),e.xForecast.currentForecast=t})})}},{key:"attributeChangedCallback",value:function(t,e,n){(e!==n&&"appid"===t||"host"===t||"location"===t)&&("location"===t&&this._renderLocation(this.location),this.xCurrent&&this.xCurrent.setAttribute(t,n),this.xForecast&&this.xForecast.setAttribute(t,n))}},{key:"_renderLocation",value:function(t){this.shadowRoot.querySelector("#location").value=t}},{key:"_upgradeProperty",value:function(t){if(this.hasOwnProperty(t)){var e=this[t];delete this[t],this[t]=e}}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}}],[{key:"observedAttributes",get:function(){return["appid","host","location"]}}]),n}(HTMLElement);e("load",function(){return n({customElements:customElements,tagName:"x-weather",element:t})});e("default",t)}}});

@@ -1,1 +0,1 @@

import{a as loadComponent,b as classCallCheck,c as createClass,d as inherits,e as possibleConstructorReturn,f as toConsumableArray}from"./utilities-aabd0479.js";function _CustomElement(){return Reflect.construct(HTMLElement,[],this.__proto__.constructor)}Object.setPrototypeOf(_CustomElement.prototype,HTMLElement.prototype),Object.setPrototypeOf(_CustomElement,HTMLElement);var template='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-weather] #location {\n border: 0;\n font-style: italic;\n margin: 0 0 0 0.5rem;\n padding: 0 0.5rem 0 0;\n width: 100%;\n }\n </style>\n\n <div data-x-weather>\n <div><input id="location"></input></div>\n\n <slot></slot>\n </div>\n',XWeather=function(t){function e(){classCallCheck(this,e);var t=possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this)),n=document.createElement("div");return n.innerHTML=template,t.attachShadow({mode:"open"}).appendChild(n),t}return inherits(e,_CustomElement),createClass(e,[{key:"connectedCallback",value:function(){var t=this;this._upgradeProperty("appid"),this._upgradeProperty("host"),this._upgradeProperty("location"),this.xCurrent=this.querySelector("x-current"),this.xForecast=this.querySelector("x-forecast"),this._renderLocation(this.location);var e=this.shadowRoot.querySelector("#location");e.addEventListener("change",function(){t.location=e.value,t.xCurrent.refresh().then(function(e){t.xCurrent.render(e),t.xCurrent.currentWeather=e}),t.xForecast.refresh().then(function(e){t.xForecast.render(e),t.xForecast.currentForecast=e})})}},{key:"attributeChangedCallback",value:function(t,e,n){(e!==n&&"appid"===t||"host"===t||"location"===t)&&("location"===t&&this._renderLocation(this.location),this.xCurrent&&this.xCurrent.setAttribute(t,n),this.xForecast&&this.xForecast.setAttribute(t,n))}},{key:"_renderLocation",value:function(t){this.shadowRoot.querySelector("#location").value=t}},{key:"_upgradeProperty",value:function(t){if(this.hasOwnProperty(t)){var e=this[t];delete this[t],this[t]=e}}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}}],[{key:"observedAttributes",get:function(){return["appid","host","location"]}}]),e}(),load=function(){return loadComponent({customElements:customElements,tagName:"x-weather",element:XWeather})};export default XWeather;export{load};
import{a as loadComponent,b as classCallCheck,c as createClass,d as inherits,e as possibleConstructorReturn,f as toConsumableArray}from"./utilities-aabd0479.js";function _CustomElement(){return Reflect.construct(HTMLElement,[],this.__proto__.constructor)}Object.setPrototypeOf(_CustomElement.prototype,HTMLElement.prototype),Object.setPrototypeOf(_CustomElement,HTMLElement);var template='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-weather] #location {\n border: 0;\n font-style: italic;\n margin: 0 0 0 2.5%;\n padding: 0 2.5% 0 0;\n width: 95%;\n }\n </style>\n\n <div data-x-weather>\n <div><input id="location"></input></div>\n\n <slot></slot>\n </div>\n',XWeather=function(t){function e(){classCallCheck(this,e);var t=possibleConstructorReturn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this)),n=document.createElement("div");return n.innerHTML=template,t.attachShadow({mode:"open"}).appendChild(n),t}return inherits(e,_CustomElement),createClass(e,[{key:"connectedCallback",value:function(){var t=this;this._upgradeProperty("appid"),this._upgradeProperty("host"),this._upgradeProperty("location"),this.xCurrent=this.querySelector("x-current"),this.xForecast=this.querySelector("x-forecast"),this._renderLocation(this.location);var e=this.shadowRoot.querySelector("#location");e.addEventListener("change",function(){t.location=e.value,t.xCurrent.refresh().then(function(e){t.xCurrent.render(e),t.xCurrent.currentWeather=e}),t.xForecast.refresh().then(function(e){t.xForecast.render(e),t.xForecast.currentForecast=e})})}},{key:"attributeChangedCallback",value:function(t,e,n){(e!==n&&"appid"===t||"host"===t||"location"===t)&&("location"===t&&this._renderLocation(this.location),this.xCurrent&&this.xCurrent.setAttribute(t,n),this.xForecast&&this.xForecast.setAttribute(t,n))}},{key:"_renderLocation",value:function(t){this.shadowRoot.querySelector("#location").value=t}},{key:"_upgradeProperty",value:function(t){if(this.hasOwnProperty(t)){var e=this[t];delete this[t],this[t]=e}}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}}],[{key:"observedAttributes",get:function(){return["appid","host","location"]}}]),e}(),load=function(){return loadComponent({customElements:customElements,tagName:"x-weather",element:XWeather})};export default XWeather;export{load};

@@ -1,1 +0,1 @@

var Main=function(){"use strict";var r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e=function(){function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}}(),i=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},g=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"cToF",n=function(t){return t+273.15},r=function(t){return t-273.15},i=function(t){return 1.8*t+32},o=function(t){return 5*(t-32)/9};return{cToK:n,kToC:r,cToF:i,fToC:o,kToF:function(t){return i(r(t))},fToK:function(t){return n(o(t))}}[e](t)},t=function(t){var e=t.customElements,n=t.tagName,r=t.element,i=function(t){var e=t.customElements,n=t.tagName,r=t.element;e.define(n,r)};window.customElements?i({customElements:e,tagName:n,element:r}):document.addEventListener("WebComponentsReady",function(){i({customElements:e,tagName:n,element:r})})},v=function(t){return new Date(1e3*t)},b=function(t){return{date:t,results:"",getResults:function(){return this.results},getTimeStamp:function(){return this.date.getTime()},Y:function(t){return this.results+=this.date.getFullYear(),this.sep(t)&&(this.results+=t),this},m:function(t){return this.results+=this.pad(this.date.getMonth()+1),this.sep(t)&&(this.results+=t),this},d:function(t){return this.results+=this.pad(this.date.getDate()),this.sep(t)&&(this.results+=t),this},H:function(t){return this.results+=this.pad(this.date.getHours()),this.sep(t)&&(this.results+=t),this},M:function(t){return this.results+=this.pad(this.date.getMinutes()),this.sep(t)&&(this.results+=t),this},S:function(t){return this.results+=this.pad(this.date.getSeconds()),this.sep(t)&&(this.results+=t),this},pad:function(t){return t<10?"0"+t:t},sep:function(t){return!!t}}};function a(){return Reflect.construct(HTMLElement,[],this.__proto__.constructor)}Object.setPrototypeOf(a.prototype,HTMLElement.prototype),Object.setPrototypeOf(a,HTMLElement);var n=function(t){function n(){r(this,n);var t=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-current] h3 {\n padding-left: 0.5rem;\n }\n\n div[data-x-current] ul {\n list-style-type: none;\n padding: 0 0 1rem 1.5rem;\n }\n\n div[data-x-current] ul > li {\n padding: 0.5rem 0 0 0;\n }\n\n div[data-x-current] #time {\n display: none;\n }\n\n div[data-x-current] #alternateScale {\n cursor: pointer;\n border-bottom: 1px dotted;\n }\n </style>\n\n <div data-x-current>\n <h3>Current</h3>\n <ul>\n <li id="time"></li>\n <li><img alt="" id="icon"></img></li>\n <li>\n <span id="temperature"></span>°<span id="primaryScale"></span> / <span><a id="alternateScale"></a></span>\n </li>\n </ul>\n </div>\n',t.attachShadow({mode:"open"}).appendChild(e),t}return i(n,a),e(n,[{key:"connectedCallback",value:function(){var e=this;this.refresh().then(function(t){e.render(t),e.currentWeather=t,e.primaryScale=e.shadowRoot.querySelector("#primaryScale"),e.alternateScale=e.shadowRoot.querySelector("#alternateScale"),e.primaryScale.textContent=e.scale,e.alternateScale.textContent="C"===e.scale?"F":"C",e.alternateScale.onclick=function(){e.scale=e.alternateScale.textContent;var t=e.parentElement.querySelector("x-forecast");t&&t.setAttribute("scale",e.primaryScale.textContent)}})}},{key:"attributeChangedCallback",value:function(t,e,n){"scale"===t&&e!==n&&this.alternateScale&&this.primaryScale&&("C"===n&&(this.alternateScale.textContent="F",this.primaryScale.textContent=n),"F"===n&&(this.alternateScale.textContent="C",this.primaryScale.textContent=n),this.render(this.currentWeather))}},{key:"_getCurrentWeather",value:function(t){var e=t.appid,n=t.host,r=t.location;if(e&&n&&r)return this._serviceHandler({appid:e,host:n,location:r}).then(function(t){t.coord;var e=t.weather,n=(t.base,t.main),r=(t.visibility,t.wind,t.clouds,t.dt);t.sys,t.id,t.name,t.cod;return{iconAlt:e[0].description,iconSrc:e[0].icon,temperature:{kelvin:n.temp,celsius:g(n.temp,"kToC"),fahrenheit:g(n.temp,"kToF")},timestamp:r}})}},{key:"_serviceHandler",value:function(t){var e=t.appid,n=t.host,r=t.location;return fetch("https://"+n+"/data/2.5/weather?q="+r+"&appid="+e,{method:"GET"}).then(function(t){if(t.ok)return t.json()})}},{key:"refresh",value:function(){var t={appid:this.parentElement.getAttribute("appid"),host:this.parentElement.getAttribute("host"),location:this.parentElement.getAttribute("location")};return this._getCurrentWeather(t)}},{key:"render",value:function(t){var e=t.iconAlt,n=t.iconSrc,r=t.temperature,i=t.timestamp;this.temperature=Number.parseFloat(r["C"===this.scale?"celsius":"fahrenheit"]).toFixed(2),this.iconAlt=e,this.iconSrc="https://openweathermap.org/img/w/"+n+".png",this.timestamp=i}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}},{key:"iconAlt",set:function(t){this.shadowRoot.querySelector("#icon").setAttribute("alt",t)}},{key:"iconSrc",set:function(t){this.shadowRoot.querySelector("#icon").src=t}},{key:"scale",get:function(){return this.getAttribute("scale")},set:function(t){this.setAttribute("scale",t)}},{key:"temperature",set:function(t){this.setAttribute("temperature",t),this.shadowRoot.querySelector("#temperature").textContent=t}},{key:"timestamp",set:function(t){this.shadowRoot.querySelector("#time").textContent=b(v(t)).H(":").M(":").S().getResults()}}],[{key:"observedAttributes",get:function(){return["scale"]}}]),n}();function s(){return Reflect.construct(HTMLElement,[],this.__proto__.constructor)}Object.setPrototypeOf(s.prototype,HTMLElement.prototype),Object.setPrototypeOf(s,HTMLElement);var c=function(t){function n(){r(this,n);var t=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML="\n <style>\n :host {\n display: block;\n }\n\n div[data-x-forecast] h3 {\n padding-left: 0.5rem;\n }\n\n div[data-x-forecast] ul {\n list-style-type: none;\n padding: 0 0 1rem 1.5rem;\n }\n\n div[data-x-forecast] ul > li {\n padding: 0.5rem 0 0 0;\n }\n </style>\n\n <div data-x-forecast>\n <h3>Forecast</h3>\n\n <div data-x-forecast-date-container>\n <div/>\n",t.attachShadow({mode:"open"}).appendChild(e),t}return i(n,s),e(n,[{key:"connectedCallback",value:function(){var e=this;this.refresh().then(function(t){e.render(t),e.currentForecast=t})}},{key:"attributeChangedCallback",value:function(t,e,n){e!==n&&"scale"===t&&this.render(this.currentForecast)}},{key:"_buildDateContainer",value:function(t){var e,f=this,m=document.createElement("div");if(m.setAttribute("data-x-forecast-date-container",""),t&&(e=t,0!==Object.keys(e).length||e.constructor!==Object)){var y=b(new Date).Y("-").m("-").d("").getResults();t.forEach(function(t){var e=t.dt,n=t.temp,r=(t.pressure,t.humidity,t.weather,t.speed,t.deg,t.clouds,t.rain,document.createElement("ul")),i=document.createElement("u"),o=v(e),a=b(o).Y("-").m("-").d().getResults(),s="F"===f.scale?g(n.day,"cToF"):n.day,c="F"===f.scale?g(n.night,"cToF"):n.night;if(a===y)i.textContent="Today:";else{var u=b(o).date.toLocaleString("en-US",{weekday:"long"}),l=b(o).m("/").d().getResults();i.textContent=u+" ("+l+"):"}var h=document.createElement("li");h.appendChild(i),r.appendChild(h);var d=document.createElement("li");d.textContent="Day: "+Number.parseFloat(s).toFixed(2)+"°"+f.scale,r.appendChild(d);var p=document.createElement("li");p.textContent="Night: "+Number.parseFloat(c).toFixed(2)+"°"+f.scale,r.appendChild(p),m.appendChild(r)})}return m}},{key:"_getForecast",value:function(t){var e=t.appid,n=t.host,r=t.location;if(e&&n&&r)return this._serviceHandler({appid:e,host:n,location:r}).then(function(t){t.city,t.cod,t.message,t.cnt;return t.list})}},{key:"_serviceHandler",value:function(t){var e=t.appid,n=t.host,r=t.location;return fetch("https://"+n+"/data/2.5/forecast/daily?q="+r+"&mode=json&units=metric&cnt=14&appid="+e,{method:"GET"}).then(function(t){if(t.ok)return t.json()})}},{key:"refresh",value:function(){var t={appid:this.parentElement.getAttribute("appid"),host:this.parentElement.getAttribute("host"),location:this.parentElement.getAttribute("location")};return this._getForecast(t)}},{key:"render",value:function(t){var e=this.shadowRoot.querySelector("[data-x-forecast]"),n=this.shadowRoot.querySelector("[data-x-forecast] > [data-x-forecast-date-container]");e.replaceChild(this._buildDateContainer(t),n)}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}},{key:"scale",get:function(){return this.getAttribute("scale")},set:function(t){this.setAttribute("scale",t)}}],[{key:"observedAttributes",get:function(){return["scale"]}}]),n}();function u(){return Reflect.construct(HTMLElement,[],this.__proto__.constructor)}Object.setPrototypeOf(u.prototype,HTMLElement.prototype),Object.setPrototypeOf(u,HTMLElement);var l=function(t){function n(){r(this,n);var t=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-weather] #location {\n border: 0;\n font-style: italic;\n margin: 0 0 0 0.5rem;\n padding: 0 0.5rem 0 0;\n width: 100%;\n }\n </style>\n\n <div data-x-weather>\n <div><input id="location"></input></div>\n\n <slot></slot>\n </div>\n',t.attachShadow({mode:"open"}).appendChild(e),t}return i(n,u),e(n,[{key:"connectedCallback",value:function(){var e=this;this._upgradeProperty("appid"),this._upgradeProperty("host"),this._upgradeProperty("location"),this.xCurrent=this.querySelector("x-current"),this.xForecast=this.querySelector("x-forecast"),this._renderLocation(this.location);var t=this.shadowRoot.querySelector("#location");t.addEventListener("change",function(){e.location=t.value,e.xCurrent.refresh().then(function(t){e.xCurrent.render(t),e.xCurrent.currentWeather=t}),e.xForecast.refresh().then(function(t){e.xForecast.render(t),e.xForecast.currentForecast=t})})}},{key:"attributeChangedCallback",value:function(t,e,n){(e!==n&&"appid"===t||"host"===t||"location"===t)&&("location"===t&&this._renderLocation(this.location),this.xCurrent&&this.xCurrent.setAttribute(t,n),this.xForecast&&this.xForecast.setAttribute(t,n))}},{key:"_renderLocation",value:function(t){this.shadowRoot.querySelector("#location").value=t}},{key:"_upgradeProperty",value:function(t){if(this.hasOwnProperty(t)){var e=this[t];delete this[t],this[t]=e}}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}}],[{key:"observedAttributes",get:function(){return["appid","host","location"]}}]),n}();return t({customElements:customElements,tagName:"x-current",element:n}),t({customElements:customElements,tagName:"x-forecast",element:c}),t({customElements:customElements,tagName:"x-weather",element:l}),{XCurrent:n,XForecast:c,XWeather:l}}();
var Main=function(){"use strict";var r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e=function(){function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}}(),i=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},g=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"cToF",n=function(t){return t+273.15},r=function(t){return t-273.15},i=function(t){return 1.8*t+32},o=function(t){return 5*(t-32)/9};return{cToK:n,kToC:r,cToF:i,fToC:o,kToF:function(t){return i(r(t))},fToK:function(t){return n(o(t))}}[e](t)},t=function(t){var e=t.customElements,n=t.tagName,r=t.element,i=function(t){var e=t.customElements,n=t.tagName,r=t.element;e.define(n,r)};window.customElements?i({customElements:e,tagName:n,element:r}):document.addEventListener("WebComponentsReady",function(){i({customElements:e,tagName:n,element:r})})},v=function(t){return new Date(1e3*t)},b=function(t){return{date:t,results:"",getResults:function(){return this.results},getTimeStamp:function(){return this.date.getTime()},Y:function(t){return this.results+=this.date.getFullYear(),this.sep(t)&&(this.results+=t),this},m:function(t){return this.results+=this.pad(this.date.getMonth()+1),this.sep(t)&&(this.results+=t),this},d:function(t){return this.results+=this.pad(this.date.getDate()),this.sep(t)&&(this.results+=t),this},H:function(t){return this.results+=this.pad(this.date.getHours()),this.sep(t)&&(this.results+=t),this},M:function(t){return this.results+=this.pad(this.date.getMinutes()),this.sep(t)&&(this.results+=t),this},S:function(t){return this.results+=this.pad(this.date.getSeconds()),this.sep(t)&&(this.results+=t),this},pad:function(t){return t<10?"0"+t:t},sep:function(t){return!!t}}};function a(){return Reflect.construct(HTMLElement,[],this.__proto__.constructor)}Object.setPrototypeOf(a.prototype,HTMLElement.prototype),Object.setPrototypeOf(a,HTMLElement);var n=function(t){function n(){r(this,n);var t=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-current] h3 {\n padding-left: 0.5rem;\n }\n\n div[data-x-current] ul {\n list-style-type: none;\n padding: 0 0 1rem 1.5rem;\n }\n\n div[data-x-current] ul > li {\n padding: 0.5rem 0 0 0;\n }\n\n div[data-x-current] #time {\n display: none;\n }\n\n div[data-x-current] #alternateScale {\n cursor: pointer;\n border-bottom: 1px dotted;\n }\n </style>\n\n <div data-x-current>\n <h3>Current</h3>\n <ul>\n <li id="time"></li>\n <li><img alt="" id="icon"></img></li>\n <li>\n <span id="temperature"></span>°<span id="primaryScale"></span> / <span><a id="alternateScale"></a></span>\n </li>\n </ul>\n </div>\n',t.attachShadow({mode:"open"}).appendChild(e),t}return i(n,a),e(n,[{key:"connectedCallback",value:function(){var e=this;this.refresh().then(function(t){e.render(t),e.currentWeather=t,e.primaryScale=e.shadowRoot.querySelector("#primaryScale"),e.alternateScale=e.shadowRoot.querySelector("#alternateScale"),e.primaryScale.textContent=e.scale,e.alternateScale.textContent="C"===e.scale?"F":"C",e.alternateScale.onclick=function(){e.scale=e.alternateScale.textContent;var t=e.parentElement.querySelector("x-forecast");t&&t.setAttribute("scale",e.primaryScale.textContent)}})}},{key:"attributeChangedCallback",value:function(t,e,n){"scale"===t&&e!==n&&this.alternateScale&&this.primaryScale&&("C"===n&&(this.alternateScale.textContent="F",this.primaryScale.textContent=n),"F"===n&&(this.alternateScale.textContent="C",this.primaryScale.textContent=n),this.render(this.currentWeather))}},{key:"_getCurrentWeather",value:function(t){var e=t.appid,n=t.host,r=t.location;if(e&&n&&r)return this._serviceHandler({appid:e,host:n,location:r}).then(function(t){t.coord;var e=t.weather,n=(t.base,t.main),r=(t.visibility,t.wind,t.clouds,t.dt);t.sys,t.id,t.name,t.cod;return{iconAlt:e[0].description,iconSrc:e[0].icon,temperature:{kelvin:n.temp,celsius:g(n.temp,"kToC"),fahrenheit:g(n.temp,"kToF")},timestamp:r}})}},{key:"_serviceHandler",value:function(t){var e=t.appid,n=t.host,r=t.location;return fetch("https://"+n+"/data/2.5/weather?q="+r+"&appid="+e,{method:"GET"}).then(function(t){if(t.ok)return t.json()})}},{key:"refresh",value:function(){var t={appid:this.parentElement.getAttribute("appid"),host:this.parentElement.getAttribute("host"),location:this.parentElement.getAttribute("location")};return this._getCurrentWeather(t)}},{key:"render",value:function(t){var e=t.iconAlt,n=t.iconSrc,r=t.temperature,i=t.timestamp;this.temperature=Number.parseFloat(r["C"===this.scale?"celsius":"fahrenheit"]).toFixed(2),this.iconAlt=e,this.iconSrc="https://openweathermap.org/img/w/"+n+".png",this.timestamp=i}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}},{key:"iconAlt",set:function(t){this.shadowRoot.querySelector("#icon").setAttribute("alt",t)}},{key:"iconSrc",set:function(t){this.shadowRoot.querySelector("#icon").src=t}},{key:"scale",get:function(){return this.getAttribute("scale")},set:function(t){this.setAttribute("scale",t)}},{key:"temperature",set:function(t){this.setAttribute("temperature",t),this.shadowRoot.querySelector("#temperature").textContent=t}},{key:"timestamp",set:function(t){this.shadowRoot.querySelector("#time").textContent=b(v(t)).H(":").M(":").S().getResults()}}],[{key:"observedAttributes",get:function(){return["scale"]}}]),n}();function s(){return Reflect.construct(HTMLElement,[],this.__proto__.constructor)}Object.setPrototypeOf(s.prototype,HTMLElement.prototype),Object.setPrototypeOf(s,HTMLElement);var c=function(t){function n(){r(this,n);var t=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML="\n <style>\n :host {\n display: block;\n }\n\n div[data-x-forecast] h3 {\n padding-left: 0.5rem;\n }\n\n div[data-x-forecast] ul {\n list-style-type: none;\n padding: 0 0 1rem 1.5rem;\n }\n\n div[data-x-forecast] ul > li {\n padding: 0.5rem 0 0 0;\n }\n </style>\n\n <div data-x-forecast>\n <h3>Forecast</h3>\n\n <div data-x-forecast-date-container>\n <div/>\n",t.attachShadow({mode:"open"}).appendChild(e),t}return i(n,s),e(n,[{key:"connectedCallback",value:function(){var e=this;this.refresh().then(function(t){e.render(t),e.currentForecast=t})}},{key:"attributeChangedCallback",value:function(t,e,n){e!==n&&"scale"===t&&this.render(this.currentForecast)}},{key:"_buildDateContainer",value:function(t){var e,f=this,m=document.createElement("div");if(m.setAttribute("data-x-forecast-date-container",""),t&&(e=t,0!==Object.keys(e).length||e.constructor!==Object)){var y=b(new Date).Y("-").m("-").d("").getResults();t.forEach(function(t){var e=t.dt,n=t.temp,r=(t.pressure,t.humidity,t.weather,t.speed,t.deg,t.clouds,t.rain,document.createElement("ul")),i=document.createElement("u"),o=v(e),a=b(o).Y("-").m("-").d().getResults(),s="F"===f.scale?g(n.day,"cToF"):n.day,c="F"===f.scale?g(n.night,"cToF"):n.night;if(a===y)i.textContent="Today:";else{var u=b(o).date.toLocaleString("en-US",{weekday:"long"}),l=b(o).m("/").d().getResults();i.textContent=u+" ("+l+"):"}var h=document.createElement("li");h.appendChild(i),r.appendChild(h);var d=document.createElement("li");d.textContent="Day: "+Number.parseFloat(s).toFixed(2)+"°"+f.scale,r.appendChild(d);var p=document.createElement("li");p.textContent="Night: "+Number.parseFloat(c).toFixed(2)+"°"+f.scale,r.appendChild(p),m.appendChild(r)})}return m}},{key:"_getForecast",value:function(t){var e=t.appid,n=t.host,r=t.location;if(e&&n&&r)return this._serviceHandler({appid:e,host:n,location:r}).then(function(t){t.city,t.cod,t.message,t.cnt;return t.list})}},{key:"_serviceHandler",value:function(t){var e=t.appid,n=t.host,r=t.location;return fetch("https://"+n+"/data/2.5/forecast/daily?q="+r+"&mode=json&units=metric&cnt=14&appid="+e,{method:"GET"}).then(function(t){if(t.ok)return t.json()})}},{key:"refresh",value:function(){var t={appid:this.parentElement.getAttribute("appid"),host:this.parentElement.getAttribute("host"),location:this.parentElement.getAttribute("location")};return this._getForecast(t)}},{key:"render",value:function(t){var e=this.shadowRoot.querySelector("[data-x-forecast]"),n=this.shadowRoot.querySelector("[data-x-forecast] > [data-x-forecast-date-container]");e.replaceChild(this._buildDateContainer(t),n)}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}},{key:"scale",get:function(){return this.getAttribute("scale")},set:function(t){this.setAttribute("scale",t)}}],[{key:"observedAttributes",get:function(){return["scale"]}}]),n}();function u(){return Reflect.construct(HTMLElement,[],this.__proto__.constructor)}Object.setPrototypeOf(u.prototype,HTMLElement.prototype),Object.setPrototypeOf(u,HTMLElement);var l=function(t){function n(){r(this,n);var t=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this)),e=document.createElement("div");return e.innerHTML='\n <style>\n :host {\n display: block;\n }\n\n div[data-x-weather] #location {\n border: 0;\n font-style: italic;\n margin: 0 0 0 2.5%;\n padding: 0 2.5% 0 0;\n width: 95%;\n }\n </style>\n\n <div data-x-weather>\n <div><input id="location"></input></div>\n\n <slot></slot>\n </div>\n',t.attachShadow({mode:"open"}).appendChild(e),t}return i(n,u),e(n,[{key:"connectedCallback",value:function(){var e=this;this._upgradeProperty("appid"),this._upgradeProperty("host"),this._upgradeProperty("location"),this.xCurrent=this.querySelector("x-current"),this.xForecast=this.querySelector("x-forecast"),this._renderLocation(this.location);var t=this.shadowRoot.querySelector("#location");t.addEventListener("change",function(){e.location=t.value,e.xCurrent.refresh().then(function(t){e.xCurrent.render(t),e.xCurrent.currentWeather=t}),e.xForecast.refresh().then(function(t){e.xForecast.render(t),e.xForecast.currentForecast=t})})}},{key:"attributeChangedCallback",value:function(t,e,n){(e!==n&&"appid"===t||"host"===t||"location"===t)&&("location"===t&&this._renderLocation(this.location),this.xCurrent&&this.xCurrent.setAttribute(t,n),this.xForecast&&this.xForecast.setAttribute(t,n))}},{key:"_renderLocation",value:function(t){this.shadowRoot.querySelector("#location").value=t}},{key:"_upgradeProperty",value:function(t){if(this.hasOwnProperty(t)){var e=this[t];delete this[t],this[t]=e}}},{key:"appid",get:function(){return this.getAttribute("appid")},set:function(t){this.setAttribute("appid",t)}},{key:"host",get:function(){return this.getAttribute("host")},set:function(t){this.setAttribute("host",t)}},{key:"location",get:function(){return this.getAttribute("location")},set:function(t){this.setAttribute("location",t)}}],[{key:"observedAttributes",get:function(){return["appid","host","location"]}}]),n}();return t({customElements:customElements,tagName:"x-current",element:n}),t({customElements:customElements,tagName:"x-forecast",element:c}),t({customElements:customElements,tagName:"x-weather",element:l}),{XCurrent:n,XForecast:c,XWeather:l}}();
{
"name": "x-weather",
"version": "0.0.11",
"version": "0.0.12",
"description": "A collection of web components implementing portions of the OpenWeatherMap API.",

@@ -5,0 +5,0 @@ "files": [

@@ -12,5 +12,5 @@ import { loadComponent } from '../utilities.js'

font-style: italic;
margin: 0 0 0 0.5rem;
padding: 0 0.5rem 0 0;
width: 100%;
margin: 0 0 0 2.5%;
padding: 0 2.5% 0 0;
width: 95%;
}

@@ -17,0 +17,0 @@ </style>

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc