UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

8 lines 13.6 kB
/*! For license information please see 31785.6fae88fb34249a76.js.LICENSE.txt */ "use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[31785],{59646:function(t,e,o){o.a(t,async function(t,e){try{o(62953);var a=o(40445),r=o(29344),i=o(5124),h=o(67576),c=o(88360),s=t([r]);r=(s.then?(await s)():s)[0];let l,n=t=>t;class d extends r.A{updated(t){super.updated(t),t.has("haptic")&&(this.haptic?this.addEventListener("change",this._forwardHaptic):this.removeEventListener("change",this._forwardHaptic))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",this._forwardHaptic)}static get styles(){return[r.A.styles,(0,i.AH)(l||(l=n`:host{--wa-form-control-toggle-size:var(--ha-switch-size, 24px);--wa-form-control-required-content:var( --ha-switch-required-marker, var(--ha-input-required-marker, "*") );--wa-form-control-required-content-offset:var( --ha-switch-required-marker-offset, 0.1rem );--thumb-size:var(--ha-switch-thumb-size, 18px);--width:var(--ha-switch-width, 48px)}label{position:relative;height:max(var(--thumb-size),var(--wa-form-control-toggle-size))}label::before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;min-width:var(--ha-switch-min-touch-size,40px);min-height:var(--ha-switch-min-touch-size,40px)}label.disabled::before{pointer-events:none}.switch{background-color:var(--ha-switch-background-color,var(--ha-color-fill-disabled-quiet-resting));border-color:var(--ha-switch-border-color,var(--ha-color-border-neutral-normal))}label:not(.disabled) .input:focus-visible~.switch,label:not(.disabled):hover .switch{background-color:var(--ha-switch-background-color-hover,var(--ha-switch-background-color,var(--ha-color-fill-disabled-quiet-hover)))}.checked .switch{background-color:var(--ha-switch-checked-background-color,var(--ha-color-fill-primary-normal-resting));border-color:var(--ha-switch-checked-border-color,var(--ha-color-border-primary-loud))}label:not(.disabled).checked .input:focus-visible~.switch,label:not(.disabled).checked:hover .switch{background-color:var(--ha-switch-checked-background-color-hover,var(--ha-switch-checked-background-color,var(--ha-color-fill-primary-normal-hover)));border-color:var(--ha-switch-checked-border-color-hover,var(--ha-switch-checked-border-color,var(--ha-color-border-primary-loud)))}.switch .thumb{background-color:var(--ha-switch-thumb-background-color,var(--ha-color-on-neutral-normal));border-color:var(--ha-switch-thumb-border-color,var(--ha-color-on-neutral-normal));border-style:var(--wa-form-control-border-style);border-width:var(--wa-form-control-border-width);box-shadow:var(--ha-switch-thumb-box-shadow,var(--ha-box-shadow-s))}label:not(.disabled) .input:focus-visible~.switch .thumb,label:not(.disabled):hover .switch .thumb{background-color:var(--ha-switch-thumb-background-color-hover,var(--ha-switch-thumb-background-color,var(--ha-color-on-neutral-normal)));border-color:var(--ha-switch-thumb-border-color-hover,var(--ha-switch-thumb-border-color,var(--ha-color-on-neutral-normal)))}.checked .switch .thumb{background-color:var(--ha-switch-checked-thumb-background-color,var(--ha-color-on-primary-normal));border-color:var(--ha-switch-checked-thumb-border-color,var(--ha-color-on-primary-normal))}label:not(.disabled).checked .input:focus-visible~.switch .thumb,label:not(.disabled).checked:hover .switch .thumb{background-color:var(--ha-switch-checked-thumb-background-color-hover,var(--ha-switch-checked-thumb-background-color,var(--ha-color-on-primary-normal)));border-color:var(--ha-switch-checked-thumb-border-color-hover,var(--ha-switch-checked-thumb-border-color,var(--ha-color-on-primary-normal)))}label.disabled{opacity:var(--ha-switch-disabled-opacity, .3);cursor:not-allowed}label:not(.disabled) .input:focus-visible~.switch .thumb{outline:0;outline-offset:none}label:not(.disabled) .input:focus-visible~.switch{outline:var(--wa-focus-ring);outline-offset:var(--wa-focus-ring-offset)}:host(:empty) slot.label{display:none}`))]}constructor(...t){super(...t),this.haptic=!1,this._forwardHaptic=()=>{(0,c.j)(this,"light")}}}(0,a.Cg)([(0,h.MZ)({type:Boolean})],d.prototype,"haptic",void 0),d=(0,a.Cg)([(0,h.EM)("ha-switch")],d),e()}catch(l){e(l)}})},53456:function(t,e,o){o.a(t,async function(t,a){try{o.r(e);o(3362),o(62953);var r=o(40445),i=o(5124),h=o(67576),c=o(1087),s=(o(93444),o(67094),o(59646)),l=o(72554),n=o(55156),d=o(18350),u=t([s,l,d]);[s,l,d]=u.then?(await u)():u;let b,p,v,m=t=>t;class w extends i.WF{async showDialog(t){this._params=t,this._open=!0}closeDialog(){return!this._open||(this._open=!1,!0)}render(){return this._params?(0,i.qy)(b||(b=m` <ha-dialog .open="${0}" header-title="${0}" width="small" @closed="${0}"> <div> <p>${0}</p> </div> <ha-dialog-footer slot="footer"> <ha-button appearance="plain" @click="${0}" slot="secondaryAction"> ${0} </ha-button> <ha-button slot="primaryAction" @click="${0}" autofocus variant="danger"> ${0} </ha-button> ${0} </ha-dialog-footer> </ha-dialog> `),this._open,this._params.title,this._dialogClosed,this._params.text,this._dismiss,this.hass.localize("ui.common.cancel"),this._confirm,this._params.confirmText,this._params.confirmFutureText?(0,i.qy)(p||(p=m` <ha-button @click="${0}" slot="primaryAction" variant="danger"> ${0} </ha-button> `),this._confirmFuture,this._params.confirmFutureText):""):i.s6}_dismiss(){this._closeState="canceled",this.closeDialog()}_confirm(){this._closeState="confirmed",this._params.confirm&&this._params.confirm(n.kt.THISEVENT),this.closeDialog()}_confirmFuture(){this._closeState="confirmedFuture",this._params.confirm&&this._params.confirm(n.kt.THISANDFUTURE),this.closeDialog()}_dialogClosed(){if(this._params){var t,e;if("confirmed"!==this._closeState&&"confirmedFuture"!==this._closeState)null===(t=(e=this._params).cancel)||void 0===t||t.call(e);this._params=void 0,this._open=!1,this._closeState=void 0,(0,c.r)(this,"dialog-closed",{dialog:this.localName})}}constructor(...t){super(...t),this._open=!1}}w.styles=(0,i.AH)(v||(v=m`:host([inert]){pointer-events:initial!important;cursor:initial!important}a{color:var(--primary-color)}p{margin:0;color:var(--primary-text-color)}.no-bottom-padding{padding-bottom:0}.secondary{color:var(--secondary-text-color)}ha-dialog{--dialog-z-index:104}`)),(0,r.Cg)([(0,h.MZ)({attribute:!1})],w.prototype,"hass",void 0),(0,r.Cg)([(0,h.wk)()],w.prototype,"_params",void 0),(0,r.Cg)([(0,h.wk)()],w.prototype,"_open",void 0),(0,r.Cg)([(0,h.wk)()],w.prototype,"_closeState",void 0),w=(0,r.Cg)([(0,h.EM)("confirm-event-dialog-box")],w),a()}catch(b){a(b)}})},29344:function(t,e,o){o.a(t,async function(t,a){try{o.d(e,{A:function(){return z}});o(27495),o(62953);var r=o(5124),i=o(67576),h=o(6412),c=o(63672),s=o(34514),l=o(40991),n=o(92070),d=o(41268),u=o(9395),b=o(62676),p=o(15477),v=o(31896),m=o(17060),w=o(19978),f=t([m]);m=(f.then?(await f)():f)[0];let _,C,x,$=t=>t;var g=Object.defineProperty,k=Object.getOwnPropertyDescriptor,y=(t,e,o,a)=>{for(var r,i=a>1?void 0:a?k(e,o):e,h=t.length-1;h>=0;h--)(r=t[h])&&(i=(a?r(e,o,i):r(i))||i);return a&&i&&g(e,o,i),i};let z=class extends b.q{static get validators(){return[...super.validators,(0,d.i)()]}get value(){var t;return null!==(t=this._value)&&void 0!==t?t:"on"}set value(t){this._value=t}handleSizeChange(){(0,l.b)(this.localName,this.size)}get checked(){var t;return this.valueHasChanged?Boolean(this._checked):null!==(t=this._checked)&&void 0!==t?t:this.defaultChecked}set checked(t){this._checked=Boolean(t),this.valueHasChanged=!0}handleClick(){this.hasInteracted=!0,this.checked=!this.checked,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))})}handleKeyDown(t){const e="rtl"===this.localize.dir();"ArrowLeft"===t.key&&(t.preventDefault(),this.checked=e,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))})),"ArrowRight"===t.key&&(t.preventDefault(),this.checked=!e,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}))}willUpdate(t){super.willUpdate(t),(t.has("value")||t.has("checked")||t.has("defaultChecked"))&&this.handleValueOrCheckedChange()}handleValueOrCheckedChange(){this.setValue(this.checked?this.value:null,this._value),this.updateValidity()}handleStateChange(){this.hasUpdated&&(this.input.checked=this.checked),this.customStates.set("checked",this.checked),this.updateValidity()}handleDisabledChange(){this.updateValidity()}click(){this.input.click()}focus(t){this.input.focus(t)}blur(){this.input.blur()}setValue(t,e){this.checked?this.internals.setFormValue(null!=t?t:"on",e):this.internals.setFormValue(null,null)}formResetCallback(){this._checked=null,super.formResetCallback(),this.handleValueOrCheckedChange()}render(){const t=this.hasUpdated?this.hasSlotController.test("hint"):this.withHint,e=!!this.hint||!!t;return(0,r.qy)(_||(_=$` <label part="base" class="${0}"> <input class="input" type="checkbox" title="${0}" name="${0}" value="${0}" .checked="${0}" .disabled="${0}" .required="${0}" role="switch" aria-checked="${0}" aria-describedby="hint" @click="${0}" @keydown="${0}"> <span part="control" class="switch"> <span part="thumb" class="thumb"></span> </span> <slot part="label" class="label"></slot> </label> <slot id="hint" name="hint" part="hint" class="${0}" aria-hidden="${0}">${0}</slot> `),(0,h.H)({checked:this.checked,disabled:this.disabled}),this.title,(0,c.J)(this.name),(0,c.J)(this.value),(0,s.V)(this.checked),this.disabled,this.required,this.checked?"true":"false",this.handleClick,this.handleKeyDown,(0,h.H)({"has-slotted":e}),e?"false":"true",this.hint)}constructor(){var t;super(...arguments),this.hasSlotController=new n.X(this,"hint"),this.localize=new m.c(this),this.title="",this.name=null,this._value=null!==(t=this.getAttribute("value"))&&void 0!==t?t:null,this.size="m",this.disabled=!1,this._checked=null,this.defaultChecked=this.hasAttribute("checked"),this.required=!1,this.hint="",this.withHint=!1}};z.shadowRootOptions=Object.assign(Object.assign({},b.q.shadowRootOptions),{},{delegatesFocus:!0}),z.css=[p.A,v.A,w.A],y([(0,i.P)('input[type="checkbox"]')],z.prototype,"input",2),y([(0,i.MZ)()],z.prototype,"title",2),y([(0,i.MZ)({reflect:!0})],z.prototype,"name",2),y([(0,i.MZ)({reflect:!0})],z.prototype,"value",1),y([(0,i.MZ)({reflect:!0})],z.prototype,"size",2),y([(0,u.w)("size")],z.prototype,"handleSizeChange",1),y([(0,i.MZ)({type:Boolean})],z.prototype,"disabled",2),y([(0,i.MZ)({type:Boolean,attribute:!1})],z.prototype,"checked",1),y([(0,i.MZ)({type:Boolean,attribute:"checked",reflect:!0})],z.prototype,"defaultChecked",2),y([(0,i.MZ)({type:Boolean,reflect:!0})],z.prototype,"required",2),y([(0,i.MZ)({attribute:"hint"})],z.prototype,"hint",2),y([(0,i.MZ)({attribute:"with-hint",type:Boolean})],z.prototype,"withHint",2),y([(0,u.w)(["checked","defaultChecked"])],z.prototype,"handleStateChange",1),y([(0,u.w)("disabled",{waitUntilFirstUpdate:!0})],z.prototype,"handleDisabledChange",1),z=y([(0,i.EM)("wa-switch")],z),null===(C=(x=z).disableWarning)||void 0===C||C.call(x,"change-in-update"),a()}catch(_){a(_)}})},19978:function(t,e,o){o.d(e,{A:function(){return r}});let a;var r=(0,o(5124).AH)(a||(a=(t=>t)`:host{--height:var(--wa-form-control-toggle-size);--width:calc(var(--height) * 1.75);--thumb-size:0.75em;display:inline-flex;line-height:var(--wa-form-control-value-line-height)}label{position:relative;display:flex;align-items:center;font:inherit;color:var(--wa-form-control-value-color);vertical-align:middle;cursor:pointer}.switch{flex:0 0 auto;position:relative;display:flex;align-items:center;justify-content:center;width:var(--width);height:var(--height);background-color:var(--wa-form-control-background-color);border-color:var(--wa-form-control-border-color);border-radius:var(--height);border-style:var(--wa-form-control-border-style);border-width:var(--wa-form-control-border-width);transition-property:translate,background,border-color,box-shadow;transition-duration:var(--wa-transition-normal);transition-timing-function:var(--wa-transition-easing)}.switch .thumb{aspect-ratio:1/1;width:var(--thumb-size);height:var(--thumb-size);background-color:var(--wa-form-control-border-color);border-radius:50%;translate:calc((var(--width) - var(--height))/ -2);transition:inherit}.switch .thumb:dir(rtl){translate:calc((var(--width) - var(--height))/ 2)}.input{position:absolute;opacity:0;padding:0;margin:0;pointer-events:none}label:not(.disabled) .input:focus-visible~.switch .thumb{outline:var(--wa-focus-ring);outline-offset:var(--wa-focus-ring-offset)}.checked .switch{background-color:var(--wa-form-control-activated-color);border-color:var(--wa-form-control-activated-color)}.checked .switch .thumb{background-color:var(--wa-color-surface-default);translate:calc((var(--width) - var(--height))/ 2)}.checked .switch .thumb:dir(rtl){translate:calc((var(--width) - var(--height))/ -2)}label:has(> :disabled){opacity:.5;cursor:not-allowed}[part~=label]{display:inline-block;line-height:var(--height);margin-inline-start:.5em;user-select:none;-webkit-user-select:none}:host([required]) [part~=label]::after{content:var(--wa-form-control-required-content);color:var(--wa-form-control-required-content-color);margin-inline-start:var(--wa-form-control-required-content-offset)}@media (forced-colors:active){:checked+.switch .thumb,:checked:enabled+.switch:hover .thumb{background-color:ButtonText}}`))}}]);