diff --git a/dist/light-popup-card.js b/dist/light-popup-card.js index a8d65ba..90e2a2f 100644 --- a/dist/light-popup-card.js +++ b/dist/light-popup-card.js @@ -15,7 +15,6 @@ const directives = new WeakMap(); const isDirective = (o) => { return typeof o === 'function' && directives.has(o); }; -//# sourceMappingURL=directive.js.map /** * @license @@ -47,7 +46,6 @@ const removeNodes = (container, start, end = null) => { start = n; } }; -//# sourceMappingURL=dom.js.map /** * @license @@ -71,7 +69,6 @@ const noChange = {}; * A sentinel value that signals a NodePart to fully clear its content. */ const nothing = {}; -//# sourceMappingURL=part.js.map /** * @license @@ -285,7 +282,6 @@ const createMarker = () => document.createComment(''); * * (') then any non-(') */ const lastAttributeNameRegex = /([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/; -//# sourceMappingURL=template.js.map /** * @license @@ -418,7 +414,6 @@ class TemplateInstance { return fragment; } } -//# sourceMappingURL=template-instance.js.map /** * @license @@ -507,7 +502,6 @@ class TemplateResult { return template; } } -//# sourceMappingURL=template-result.js.map /** * @license @@ -947,7 +941,6 @@ const getOptions = (o) => o && (eventOptionsSupported ? { capture: o.capture, passive: o.passive, once: o.once } : o.capture); -//# sourceMappingURL=parts.js.map /** * @license @@ -999,7 +992,6 @@ class DefaultTemplateProcessor { } } const defaultTemplateProcessor = new DefaultTemplateProcessor(); -//# sourceMappingURL=default-template-processor.js.map /** * @license @@ -1047,7 +1039,6 @@ function templateFactory(result) { return template; } const templateCaches = new Map(); -//# sourceMappingURL=template-factory.js.map /** * @license @@ -1088,7 +1079,6 @@ const render = (result, container, options) => { part.setValue(result); part.commit(); }; -//# sourceMappingURL=render.js.map /** * @license @@ -1112,7 +1102,6 @@ const render = (result, container, options) => { * render to and update a container. */ const html = (strings, ...values) => new TemplateResult(strings, values, 'html', defaultTemplateProcessor); -//# sourceMappingURL=lit-html.js.map /** * @license @@ -1237,7 +1226,6 @@ function insertNodeIntoTemplate(template, node, refNode = null) { } } } -//# sourceMappingURL=modify-template.js.map /** * @license @@ -1507,7 +1495,6 @@ const render$1 = (result, container, options) => { window.ShadyCSS.styleElement(container.host); } }; -//# sourceMappingURL=shady-render.js.map /** * @license @@ -2133,7 +2120,6 @@ _a = finalized; * Marks class as having finished creating properties. */ UpdatingElement[_a] = true; -//# sourceMappingURL=updating-element.js.map /** @license @@ -2197,7 +2183,6 @@ const css = (strings, ...values) => { const cssText = values.reduce((acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1], strings[0]); return new CSSResult(cssText, constructionToken); }; -//# sourceMappingURL=css-tag.js.map /** * @license @@ -2395,7 +2380,6 @@ LitElement['finalized'] = true; * @nocollapse */ LitElement.render = render$1; -//# sourceMappingURL=lit-element.js.map function bound01(n, max) { if (isOnePointZero(n)) { @@ -3619,7 +3603,7 @@ fecha.parse = function (dateStr, format, i18nSettings) { return date; }; -var a=function(){try{(new Date).toLocaleDateString("i");}catch(e){return "RangeError"===e.name}return !1}()?function(e,t){return e.toLocaleDateString(t,{year:"numeric",month:"long",day:"numeric"})}:function(t){return fecha.format(t,"mediumDate")},n=function(){try{(new Date).toLocaleString("i");}catch(e){return "RangeError"===e.name}return !1}()?function(e,t){return e.toLocaleString(t,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit"})}:function(t){return fecha.format(t,"haDateTime")},r=function(){try{(new Date).toLocaleTimeString("i");}catch(e){return "RangeError"===e.name}return !1}()?function(e,t){return e.toLocaleTimeString(t,{hour:"numeric",minute:"2-digit"})}:function(t){return fecha.format(t,"shortTime")};function d(e){return e.substr(0,e.indexOf("."))}function g(e){return d(e.entity_id)}function b(e,t,i){var o,s=g(t);if("binary_sensor"===s)t.attributes.device_class&&(o=e("state."+s+"."+t.attributes.device_class+"."+t.state)),o||(o=e("state."+s+".default."+t.state));else if(t.attributes.unit_of_measurement&&!["unknown","unavailable"].includes(t.state))o=t.state+" "+t.attributes.unit_of_measurement;else if("input_datetime"===s){var c;if(t.attributes.has_time)if(t.attributes.has_date)c=new Date(t.attributes.year,t.attributes.month-1,t.attributes.day,t.attributes.hour,t.attributes.minute),o=n(c,i);else{var u=new Date;c=new Date(u.getFullYear(),u.getMonth(),u.getDay(),t.attributes.hour,t.attributes.minute),o=r(c,i);}else c=new Date(t.attributes.year,t.attributes.month-1,t.attributes.day),o=a(c,i);}else o="zwave"===s?["initializing","dead"].includes(t.state)?e("state.zwave.query_stage."+t.state,"query_stage",t.attributes.query_stage):e("state.zwave.default."+t.state):e("state."+s+"."+t.state);return o||(o=e("state.default."+t.state)||e("component."+s+".state."+t.state)||t.state),o}//# sourceMappingURL=index.m.js.map +var a=function(){try{(new Date).toLocaleDateString("i");}catch(e){return "RangeError"===e.name}return !1}()?function(e,t){return e.toLocaleDateString(t,{year:"numeric",month:"long",day:"numeric"})}:function(t){return fecha.format(t,"mediumDate")},n=function(){try{(new Date).toLocaleString("i");}catch(e){return "RangeError"===e.name}return !1}()?function(e,t){return e.toLocaleString(t,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit"})}:function(t){return fecha.format(t,"haDateTime")},r=function(){try{(new Date).toLocaleTimeString("i");}catch(e){return "RangeError"===e.name}return !1}()?function(e,t){return e.toLocaleTimeString(t,{hour:"numeric",minute:"2-digit"})}:function(t){return fecha.format(t,"shortTime")};function d(e){return e.substr(0,e.indexOf("."))}function g(e){return d(e.entity_id)}function b(e,t,i){var o,s=g(t);if("binary_sensor"===s)t.attributes.device_class&&(o=e("state."+s+"."+t.attributes.device_class+"."+t.state)),o||(o=e("state."+s+".default."+t.state));else if(t.attributes.unit_of_measurement&&!["unknown","unavailable"].includes(t.state))o=t.state+" "+t.attributes.unit_of_measurement;else if("input_datetime"===s){var c;if(t.attributes.has_time)if(t.attributes.has_date)c=new Date(t.attributes.year,t.attributes.month-1,t.attributes.day,t.attributes.hour,t.attributes.minute),o=n(c,i);else{var u=new Date;c=new Date(u.getFullYear(),u.getMonth(),u.getDay(),t.attributes.hour,t.attributes.minute),o=r(c,i);}else c=new Date(t.attributes.year,t.attributes.month-1,t.attributes.day),o=a(c,i);}else o="zwave"===s?["initializing","dead"].includes(t.state)?e("state.zwave.query_stage."+t.state,"query_stage",t.attributes.query_stage):e("state.zwave.default."+t.state):e("state."+s+"."+t.state);return o||(o=e("state.default."+t.state)||e("component."+s+".state."+t.state)||t.state),o} class LightPopupCard extends LitElement { constructor() { @@ -3648,6 +3632,8 @@ class LightPopupCard extends LitElement { var icon = this.config.icon ? this.config.icon : stateObj.attributes.icon ? stateObj.attributes.icon : 'mdi:lightbulb'; var borderRadius = this.config.borderRadius ? this.config.borderRadius : '12px'; var supportedFeaturesTreshold = this.config.supportedFeaturesTreshold ? this.config.supportedFeaturesTreshold : 9; + var onStates = this.config.onStates ? this.config.onStates : ['on']; + var offStates = this.config.offStates ? this.config.offStates : ['off']; //Scenes var actionSize = "actionSize" in this.config ? this.config.actionSize : "50px"; var actions = this.config.actions; @@ -3663,15 +3649,8 @@ class LightPopupCard extends LitElement { } } var switchValue = 0; - switch (stateObj.state) { - case 'on': - switchValue = 1; - break; - case 'off': - switchValue = 0; - break; - default: - switchValue = 0; + if (onStates.includes(stateObj.state)) { + switchValue = 1; } var fullscreen = "fullscreen" in this.config ? this.config.fullscreen : true; var brightnessWidth = this.config.brightnessWidth ? this.config.brightnessWidth : "150px"; @@ -3707,12 +3686,12 @@ class LightPopupCard extends LitElement {