UNPKG

@larva.io/webcomponents

Version:

Fentrica SmartUnits WebComponents package

101 lines (96 loc) 8.2 kB
/*! * (C) Fentrica http://fentrica.com - Seee LICENSE.md */ import { p as proxyCustomElement, H, h } from './p-AOwgnAK2.js'; import { d as defineCustomElement$6 } from './p-C9VBtzS4.js'; import { d as defineCustomElement$5 } from './p-p5eBnhDi.js'; import { d as defineCustomElement$4 } from './p-DwjVtK9p.js'; import { d as defineCustomElement$3 } from './p-B-fmI6sr.js'; import { d as defineCustomElement$2 } from './p-DZ674rl9.js'; const weatherCss = "slot-fb[hidden],slot[hidden]{display:initial !important}lar-icon{fill:var(--lar-text-color, #fff);stroke:var(--lar-text-color, #fff)}.suninfo .sunrise>*,.suninfo .sunset>*{vertical-align:middle}.suninfo{height:2rem;width:50%;margin:0 auto 1rem auto}.suninfo .sunrise,.suninfo .sunset{display:inline-block;width:50%;text-align:center}h4{margin:0.2rem 0 0 0}.circle{background-color:var(--lar-background-color-step-200, #333333) !important;border-radius:50%;display:inline-block;padding:0.5rem;width:2rem;height:2rem;margin-right:1rem}.circle lar-icon{display:block;width:100%;height:100%;color:var(--lar-text-color, #fff) !important}lar-list-item{background-color:var(--lar-background-color-step-100, rgb(25.5, 25.5, 25.5)) !important;color:var(--lar-text-color, #fff) !important}"; const WeatherContent = /*@__PURE__*/ proxyCustomElement(class WeatherContent extends H { constructor(registerHost) { super(); if (registerHost !== false) { this.__registerHost(); } this.__attachShadow(); this.parsedData = {}; } componentWillLoad() { this.parseData(); } parseData() { if (typeof this.data === 'string') { try { this.parsedData = JSON.parse(this.data); } catch (e) { console.error('Failed to parse weather data:', e); this.parsedData = {}; } } else { this.parsedData = this.data || {}; } } render() { return [ h("div", { key: '41da9057208e01a7956b48d8d5d6fbf06b1ccdb1', class: "suninfo" }, this.parsedData.sunrise && h("div", { key: 'be8777fe226d3c954d1aa7cda4edf1c9d3b2c14a', class: "sunrise" }, h("lar-icon", { key: 'a885904dd31babf2a1c3eda2a79e7f2055f2fc0c', size: "large", icon: "wi-sunrise" }), h("span", { key: 'abd566d8215a526b6fcea8b895c3bd7f5747635b' }, this.parsedData.sunrise)), this.parsedData.sunset && h("div", { key: '871c869650ddc70a7fe60bef2b67e1a6a6ef1dd8', class: "sunset" }, h("lar-icon", { key: '0dbd1ce208b974e0b6570b6b44ead84738ffdb47', size: "large", icon: "wi-sunset" }), h("span", { key: '9f3500813af6cf3a368d2ce1d15b16bc93cdc2ee' }, this.parsedData.sunset))), h("lar-list", { key: '56133403afb444dd47a56710bad060e7714ccba1', class: "detailinfo" }, this.parsedData.temperature !== undefined && h("lar-weather-item", { key: '2f01679f1a215f6fbbd4540552a90676884a4eb8', icon: "wi-thermometer-exterior", name: "weather.temperature", value: `${this.parsedData.temperature}°` }), this.parsedData.temperatureFeelsLike !== undefined && h("lar-weather-item", { key: 'e03c98c73b739c3a59e520d768601c56a4ab9524', icon: "wi-thermometer-exterior", name: "weather.temperatureFeelsLike", value: `${this.parsedData.temperatureFeelsLike}°` }), this.parsedData.drewPoint !== undefined && h("lar-weather-item", { key: '3ba96054f8c5146a1a1f150ab5e927621fef2128', icon: "wi-raindrop", name: "weather.drewPoint", value: `${this.parsedData.drewPoint}°` }), this.parsedData.solarIrradiation !== undefined && h("lar-weather-item", { key: '362ff9f7b5d9928b17b9dc6499c29eb5284a7269', icon: "wi-day-sunny", name: "weather.solarIrradiation", value: `${this.parsedData.solarIrradiation}%` }), this.parsedData.windSpeed !== undefined && h("lar-weather-item", { key: '76d848a1ec6cd44918ebae975b5ca67ac0381873', icon: "wi-strong-wind", name: "weather.windSpeed", value: `${this.parsedData.windSpeed}m/s` }), this.parsedData.windDirection !== undefined && h("lar-weather-item", { key: '54054ab9d1e162931fd0f68fabb4f5a45988dc98', icon: "wi-wind-deg", name: "weather.windDirection", rotateIcon: this.parsedData.windDirection, value: `${this.parsedData.windDirection}°` }), this.parsedData.daylight !== undefined && typeof this.parsedData.daylight === 'number' && h("lar-weather-item", { key: '4e781f51f744f9bd810b35a506ce14031e781be9', icon: "wi-day-sunny", name: "weather.daylight", value: `${this.parsedData.daylight}lx` }), this.parsedData.daylight !== undefined && typeof this.parsedData.daylight === 'boolean' && h("lar-weather-item", { key: '6a91df1e31fd1a6093f6ae684837893686215c1f', icon: "wi-day-sunny", name: "weather.daylight", value: `${this.parsedData.daylight}` }), this.parsedData.humidity !== undefined && h("lar-weather-item", { key: '05bace71f421bb6c84127dff0200d872aa1e7f10', icon: "wi-humidity", name: "weather.humidity", value: `${this.parsedData.humidity}%` }), this.parsedData.pressure !== undefined && h("lar-weather-item", { key: '4dc111977dda20572e3f5fe3ef27edf08dcb5b60', icon: "wi-barometer", name: "weather.pressure", value: `${this.parsedData.pressure}hPa` }), this.parsedData.rain !== undefined && typeof this.parsedData.rain === 'number' && h("lar-weather-item", { key: '1d83fddff35770b6a6b79397a371f5aea5c3376c', icon: "wi-raindrops", name: "weather.rain", value: `${this.parsedData.rain}mm` }), this.parsedData.rain !== undefined && typeof this.parsedData.rain === 'boolean' && h("lar-weather-item", { key: 'c9483c37d5193552db365208dad2d2c29ce7567a', icon: "wi-raindrops", name: "weather.rain", value: `${this.parsedData.rain}` }), this.parsedData.snow !== undefined && typeof this.parsedData.snow === 'number' && h("lar-weather-item", { key: 'da7d3c04bc0655b5cac9d1a44d846d4a907bb217', icon: "wi-snow", name: "weather.snow", value: `${this.parsedData.snow}mm` }), this.parsedData.snow !== undefined && typeof this.parsedData.snow === 'boolean' && h("lar-weather-item", { key: '4211f2e2b384a42a17a3913241b3763159db9cfd', icon: "wi-snow", name: "weather.snow", value: `${this.parsedData.snow}` }), this.parsedData.storm !== undefined && h("lar-weather-item", { key: 'cfd06c2ff7f0acda4a9d0c2266251a9a1cc22a4a', icon: "wi-storm-warning", name: "weather.storm", value: `${this.parsedData.storm}` }), this.parsedData.fog !== undefined && h("lar-weather-item", { key: '4af61c04f010c2cf81dc3e5e80af0ec54e918578', icon: "wi-fog", name: "weather.fog", value: `${this.parsedData.fog}` })) ]; } static get watchers() { return { "data": ["parseData"] }; } static get style() { return weatherCss; } }, [257, "lar-weather-content", { "data": [1], "parsedData": [32] }, undefined, { "data": ["parseData"] }]); function defineCustomElement$1() { if (typeof customElements === "undefined") { return; } const components = ["lar-weather-content", "lar-icon", "lar-list", "lar-list-item", "lar-translate", "lar-weather-item"]; components.forEach(tagName => { switch (tagName) { case "lar-weather-content": if (!customElements.get(tagName)) { customElements.define(tagName, WeatherContent); } break; case "lar-icon": if (!customElements.get(tagName)) { defineCustomElement$6(); } break; case "lar-list": if (!customElements.get(tagName)) { defineCustomElement$5(); } break; case "lar-list-item": if (!customElements.get(tagName)) { defineCustomElement$4(); } break; case "lar-translate": if (!customElements.get(tagName)) { defineCustomElement$3(); } break; case "lar-weather-item": if (!customElements.get(tagName)) { defineCustomElement$2(); } break; } }); } defineCustomElement$1(); const LarWeatherContent = WeatherContent; const defineCustomElement = defineCustomElement$1; export { LarWeatherContent, defineCustomElement }; //# sourceMappingURL=lar-weather-content.js.map //# sourceMappingURL=lar-weather-content.js.map