x-weather
Version:
A collection of web components implementing portions of the OpenWeatherMap API.
2 lines (1 loc) • 2.28 kB
JavaScript
import"./utilities.js";import"./types.js";import"./updateCurrentWeather.js";import"./getCurrentWeather.js";import"./updateForecastWeather.js";import"./getForecastWeather.js";import"./index.js";import{_ as e}from"./_rollupPluginBabelHelpers-5bd7183e.js";import{L as t,c as r,h as a}from"./lit-element-ae08ccac.js";import{c as i}from"./connect-mixin-144a42a2.js";import"./redux-a2f99696.js";import{store as s}from"./configureStore.js";import"./initialState.js";import"./utilities2.js";import"./current.js";import"./forecast.js";import"./preferences.js";import"./index2.js";import"./root.js";import"./middleware.js";import{swapPrimaryScaleCurrent as n,swapPrimaryScaleForecast as p}from"./dispatchers.js";function c(){var t=e(['\n <span id="temperature">','</span> °<span id="primaryScale">F</span>\n <span> / ',' °<a id="alternateScale" @click=',">C</a></span>\n "]);return c=function(){return t},t}function o(){var t=e(['\n <span id="temperature">','</span> °<span id="primaryScale">C</span>\n <span> / ',' °<a id="alternateScale" @click=',">F</a></span>\n "]);return o=function(){return t},t}function u(){var t=e(["\n :host {\n display: block;\n }\n\n #alternateScale {\n cursor: pointer;\n border-bottom: 1px dotted;\n }\n\n #temperature {\n font-size: 1.25rem;\n font-weight: bold;\n }\n "]);return u=function(){return t},t}var m=class extends(i(s)(t)){static get styles(){return r(u())}static get properties(){return{celsius:{type:Number},fahrenheit:{type:Number},primaryscale:{type:String}}}stateChanged(e){var{weather:t}=e;this.celsius=String(t.current.temperature.celsius).slice(0,5),this.fahrenheit=String(t.current.temperature.fahrenheit).slice(0,5),this.primaryscale=t.current.primaryScale||this.primaryscale}constructor(){super(),this.celsius="10.00",this.fahrenheit="50.00",this.primaryscale="c"}_handleScaleSwap(e){return()=>{n(e),p(e)}}render(){return"c"===this.primaryscale?a(o(),this.celsius,this.fahrenheit,this._handleScaleSwap("f")):a(c(),this.fahrenheit,this.celsius,this._handleScaleSwap("c"))}};customElements.get("x-current-temperature")||customElements.define("x-current-temperature",m);export default m;export{m as XCurrentTemperature};