iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
8 lines • 13.1 kB
JavaScript
/*! For license information please see 31785.18feee482c3ff3e4.js.LICENSE.txt */
export const __rspack_esm_id=31785;export const __rspack_esm_ids=[31785];export const __webpack_modules__={59646(t,e,o){o.a(t,async function(t,e){try{var a=o(62826),r=o(29344),i=o(5124),h=o(22441),c=o(88360),s=t([r]);r=(s.then?(await s)():s)[0];class l 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,i.AH`: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})],l.prototype,"haptic",void 0),l=(0,a.Cg)([(0,h.EM)("ha-switch")],l),e()}catch(t){e(t)}})},53456(t,e,o){o.a(t,async function(t,a){try{o.r(e);var r=o(62826),i=o(5124),h=o(22441),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;class b extends i.WF{async showDialog(t){this._params=t,this._open=!0}closeDialog(){return!this._open||(this._open=!1,!0)}render(){return this._params?i.qy` <ha-dialog .open="${this._open}" header-title="${this._params.title}" width="small" ="${this._dialogClosed}"> <div> <p>${this._params.text}</p> </div> <ha-dialog-footer slot="footer"> <ha-button appearance="plain" ="${this._dismiss}" slot="secondaryAction"> ${this.hass.localize("ui.common.cancel")} </ha-button> <ha-button slot="primaryAction" ="${this._confirm}" autofocus variant="danger"> ${this._params.confirmText} </ha-button> ${this._params.confirmFutureText?i.qy` <ha-button ="${this._confirmFuture}" slot="primaryAction" variant="danger"> ${this._params.confirmFutureText} </ha-button> `:""} </ha-dialog-footer> </ha-dialog> `: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(){this._params&&("confirmed"!==this._closeState&&"confirmedFuture"!==this._closeState&&this._params.cancel?.(),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}}b.styles=i.AH`: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})],b.prototype,"hass",void 0),(0,r.Cg)([(0,h.wk)()],b.prototype,"_params",void 0),(0,r.Cg)([(0,h.wk)()],b.prototype,"_open",void 0),(0,r.Cg)([(0,h.wk)()],b.prototype,"_closeState",void 0),b=(0,r.Cg)([(0,h.EM)("confirm-event-dialog-box")],b),a()}catch(t){a(t)}})},29344(t,e,o){o.a(t,async function(t,a){try{o.d(e,{A:()=>_});var r=o(5124),i=o(22441),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),g=t([m]);m=(g.then?(await g)():g)[0];var k=Object.defineProperty,f=Object.getOwnPropertyDescriptor,y=(t,e,o,a)=>{for(var r,i=a>1?void 0:a?f(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&&k(e,o,i),i};let _=class extends b.q{static get validators(){return[...super.validators,(0,d.i)()]}get value(){return this._value??"on"}set value(t){this._value=t}handleSizeChange(){(0,l.b)(this.localName,this.size)}get checked(){return this.valueHasChanged?Boolean(this._checked):this._checked??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(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 r.qy` <label part="base" class="${(0,h.H)({checked:this.checked,disabled:this.disabled})}"> <input class="input" type="checkbox" title="${this.title}" name="${(0,c.J)(this.name)}" value="${(0,c.J)(this.value)}" .checked="${(0,s.V)(this.checked)}" .disabled="${this.disabled}" .required="${this.required}" role="switch" aria-checked="${this.checked?"true":"false"}" aria-describedby="hint" ="${this.handleClick}" ="${this.handleKeyDown}"> <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,h.H)({"has-slotted":e})}" aria-hidden="${e?"false":"true"}">${this.hint}</slot> `}constructor(){super(...arguments),this.hasSlotController=new n.X(this,"hint"),this.localize=new m.c(this),this.title="",this.name=null,this._value=this.getAttribute("value")??null,this.size="m",this.disabled=!1,this._checked=null,this.defaultChecked=this.hasAttribute("checked"),this.required=!1,this.hint="",this.withHint=!1}};_.shadowRootOptions={...b.q.shadowRootOptions,delegatesFocus:!0},_.css=[p.A,v.A,w.A],y([(0,i.P)('input[type="checkbox"]')],_.prototype,"input",2),y([(0,i.MZ)()],_.prototype,"title",2),y([(0,i.MZ)({reflect:!0})],_.prototype,"name",2),y([(0,i.MZ)({reflect:!0})],_.prototype,"value",1),y([(0,i.MZ)({reflect:!0})],_.prototype,"size",2),y([(0,u.w)("size")],_.prototype,"handleSizeChange",1),y([(0,i.MZ)({type:Boolean})],_.prototype,"disabled",2),y([(0,i.MZ)({type:Boolean,attribute:!1})],_.prototype,"checked",1),y([(0,i.MZ)({type:Boolean,attribute:"checked",reflect:!0})],_.prototype,"defaultChecked",2),y([(0,i.MZ)({type:Boolean,reflect:!0})],_.prototype,"required",2),y([(0,i.MZ)({attribute:"hint"})],_.prototype,"hint",2),y([(0,i.MZ)({attribute:"with-hint",type:Boolean})],_.prototype,"withHint",2),y([(0,u.w)(["checked","defaultChecked"])],_.prototype,"handleStateChange",1),y([(0,u.w)("disabled",{waitUntilFirstUpdate:!0})],_.prototype,"handleDisabledChange",1),_=y([(0,i.EM)("wa-switch")],_),_.disableWarning?.("change-in-update"),a()}catch(t){a(t)}})},19978(t,e,o){o.d(e,{A:()=>a});var a=o(5124).AH`: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)} (forced-colors:active){:checked+.switch .thumb,:checked:enabled+.switch:hover .thumb{background-color:ButtonText}}`}};