iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 17.6 kB
JavaScript
/*! For license information please see 93282.42e1ec8d9de93a90.js.LICENSE.txt */
export const __rspack_esm_id=93282;export const __rspack_esm_ids=[93282];export const __webpack_modules__={7658(t,e,i){i.d(e,{I:()=>r});var r=function(){function t(t){void 0===t&&(t={}),this.adapter=t}return Object.defineProperty(t,"cssClasses",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"strings",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"numbers",{get:function(){return{}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{}},enumerable:!1,configurable:!0}),t.prototype.init=function(){},t.prototype.destroy=function(){},t}()},12451(t,e,i){i.d(e,{O:()=>n,i:()=>o.is});var r=i(5124),o=i(12130);class n extends r.WF{click(){if(this.mdcRoot)return this.mdcRoot.focus(),void this.mdcRoot.click();super.click()}createFoundation(){void 0!==this.mdcFoundation&&this.mdcFoundation.destroy(),this.mdcFoundationClass&&(this.mdcFoundation=new this.mdcFoundationClass(this.createAdapter()),this.mdcFoundation.init())}firstUpdated(){this.createFoundation()}}},51324(t,e,i){i.d(e,{ZS:()=>c,is:()=>l.i});var r,o,n=i(62826),a=i(22441),l=i(12451);const s=null!==(o=null===(r=window.ShadyDOM)||void 0===r?void 0:r.inUse)&&void 0!==o&&o;class c extends l.O{findFormElement(){if(!this.shadowRoot||s)return null;const t=this.getRootNode().querySelectorAll("form");for(const e of Array.from(t))if(e.contains(this))return e;return null}connectedCallback(){var t;super.connectedCallback(),this.containingForm=this.findFormElement(),null===(t=this.containingForm)||void 0===t||t.addEventListener("formdata",this.formDataListener)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this.containingForm)||void 0===t||t.removeEventListener("formdata",this.formDataListener),this.containingForm=null}click(){this.formElement&&!this.disabled&&(this.formElement.focus(),this.formElement.click())}firstUpdated(){super.firstUpdated(),this.shadowRoot&&this.mdcRoot.addEventListener("change",t=>{this.dispatchEvent(new Event("change",t))})}constructor(){super(...arguments),this.disabled=!1,this.containingForm=null,this.formDataListener=t=>{this.disabled||this.setFormData(t.formData)}}}c.shadowRootOptions={mode:"open",delegatesFocus:!0},(0,n.Cg)([(0,a.MZ)({type:Boolean})],c.prototype,"disabled",void 0)},56161(t,e,i){i.d(e,{P:()=>r});i(18111),i(7588),i(45367),i(92731);const r=t=>(e,i)=>{if(e.constructor._observers){if(!e.constructor.hasOwnProperty("_observers")){const t=e.constructor._observers;e.constructor._observers=new Map,t.forEach((t,i)=>e.constructor._observers.set(i,t))}}else{e.constructor._observers=new Map;const t=e.updated;e.updated=function(e){t.call(this,e),e.forEach((t,e)=>{const i=this.constructor._observers.get(e);void 0!==i&&i.call(this,this[e],t)})}}e.constructor._observers.set(i,t)}},12130(t,e,i){i.d(e,{SE:()=>c,U9:()=>s,hP:()=>r,is:()=>o});i(44114);const r=t=>t.nodeType===Node.ELEMENT_NODE;function o(t){return{addClass:e=>{t.classList.add(e)},removeClass:e=>{t.classList.remove(e)},hasClass:e=>t.classList.contains(e)}}let n=!1;const a=()=>{},l={get passive(){return n=!0,!1}};document.addEventListener("x",a,l),document.removeEventListener("x",a);const s=(t=window.document)=>{let e=t.activeElement;const i=[];if(!e)return i;for(;e&&(i.push(e),e.shadowRoot);)e=e.shadowRoot.activeElement;return i},c=t=>{const e=s();if(!e.length)return!1;const i=e[e.length-1],r=new Event("check-if-focused",{bubbles:!0,composed:!0});let o=[];const n=t=>{o=t.composedPath()};return document.body.addEventListener("check-if-focused",n),i.dispatchEvent(r),document.body.removeEventListener("check-if-focused",n),-1!==o.indexOf(t)}},68462(t,e,i){i.d(e,{M:()=>f});var r=i(62826),o=i(7658),n={ROOT:"mdc-form-field"},a={LABEL_SELECTOR:".mdc-form-field > label"};const l=function(t){function e(i){var o=t.call(this,(0,r.Cl)((0,r.Cl)({},e.defaultAdapter),i))||this;return o.click=function(){o.handleClick()},o}return(0,r.C6)(e,t),Object.defineProperty(e,"cssClasses",{get:function(){return n},enumerable:!1,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return a},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{activateInputRipple:function(){},deactivateInputRipple:function(){},deregisterInteractionHandler:function(){},registerInteractionHandler:function(){}}},enumerable:!1,configurable:!0}),e.prototype.init=function(){this.adapter.registerInteractionHandler("click",this.click)},e.prototype.destroy=function(){this.adapter.deregisterInteractionHandler("click",this.click)},e.prototype.handleClick=function(){var t=this;this.adapter.activateInputRipple(),requestAnimationFrame(function(){t.adapter.deactivateInputRipple()})},e}(o.I);var s=i(12451),c=i(51324),d=i(56161),h=i(5124),p=i(22441),u=i(6412);class f extends s.O{createAdapter(){return{registerInteractionHandler:(t,e)=>{this.labelEl.addEventListener(t,e)},deregisterInteractionHandler:(t,e)=>{this.labelEl.removeEventListener(t,e)},activateInputRipple:async()=>{const t=this.input;if(t instanceof c.ZS){const e=await t.ripple;e&&e.startPress()}},deactivateInputRipple:async()=>{const t=this.input;if(t instanceof c.ZS){const e=await t.ripple;e&&e.endPress()}}}}get input(){var t,e;return null!==(e=null===(t=this.slottedInputs)||void 0===t?void 0:t[0])&&void 0!==e?e:null}render(){const t={"mdc-form-field--align-end":this.alignEnd,"mdc-form-field--space-between":this.spaceBetween,"mdc-form-field--nowrap":this.nowrap};return h.qy` <div class="mdc-form-field ${(0,u.H)(t)}"> <slot></slot> <label class="mdc-label" ="${this._labelClick}">${this.label}</label> </div>`}click(){this._labelClick()}_labelClick(){const t=this.input;t&&(t.focus(),t.click())}constructor(){super(...arguments),this.alignEnd=!1,this.spaceBetween=!1,this.nowrap=!1,this.label="",this.mdcFoundationClass=l}}(0,r.Cg)([(0,p.MZ)({type:Boolean})],f.prototype,"alignEnd",void 0),(0,r.Cg)([(0,p.MZ)({type:Boolean})],f.prototype,"spaceBetween",void 0),(0,r.Cg)([(0,p.MZ)({type:Boolean})],f.prototype,"nowrap",void 0),(0,r.Cg)([(0,p.MZ)({type:String}),(0,d.P)(async function(t){var e;null===(e=this.input)||void 0===e||e.setAttribute("aria-label",t)})],f.prototype,"label",void 0),(0,r.Cg)([(0,p.P)(".mdc-form-field")],f.prototype,"mdcRoot",void 0),(0,r.Cg)([(0,p.KN)({slot:"",flatten:!0,selector:"*"})],f.prototype,"slottedInputs",void 0),(0,r.Cg)([(0,p.P)("label")],f.prototype,"labelEl",void 0)},38627(t,e,i){i.d(e,{R:()=>r});const r=i(5124).AH`.mdc-form-field{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-body2-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:.875rem;font-size:var(--mdc-typography-body2-font-size, .875rem);line-height:1.25rem;line-height:var(--mdc-typography-body2-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-body2-font-weight,400);letter-spacing:.0178571429em;letter-spacing:var(--mdc-typography-body2-letter-spacing, .0178571429em);text-decoration:inherit;text-decoration:var(--mdc-typography-body2-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-body2-text-transform,inherit);color:rgba(0,0,0,.87);color:var(--mdc-theme-text-primary-on-background,rgba(0,0,0,.87));display:inline-flex;align-items:center;vertical-align:middle}.mdc-form-field>label{margin-left:0;margin-right:auto;padding-left:4px;padding-right:0;order:0}.mdc-form-field>label[dir=rtl],[dir=rtl] .mdc-form-field>label{margin-left:auto;margin-right:0}.mdc-form-field>label[dir=rtl],[dir=rtl] .mdc-form-field>label{padding-left:0;padding-right:4px}.mdc-form-field--nowrap>label{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.mdc-form-field--align-end>label{margin-left:auto;margin-right:0;padding-left:0;padding-right:4px;order:-1}.mdc-form-field--align-end>label[dir=rtl],[dir=rtl] .mdc-form-field--align-end>label{margin-left:0;margin-right:auto}.mdc-form-field--align-end>label[dir=rtl],[dir=rtl] .mdc-form-field--align-end>label{padding-left:4px;padding-right:0}.mdc-form-field--space-between{justify-content:space-between}.mdc-form-field--space-between>label{margin:0}.mdc-form-field--space-between>label[dir=rtl],[dir=rtl] .mdc-form-field--space-between>label{margin:0}:host{display:inline-flex}.mdc-form-field{width:100%}::slotted(*){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-body2-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:.875rem;font-size:var(--mdc-typography-body2-font-size, .875rem);line-height:1.25rem;line-height:var(--mdc-typography-body2-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-body2-font-weight,400);letter-spacing:.0178571429em;letter-spacing:var(--mdc-typography-body2-letter-spacing, .0178571429em);text-decoration:inherit;text-decoration:var(--mdc-typography-body2-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-body2-text-transform,inherit);color:rgba(0,0,0,.87);color:var(--mdc-theme-text-primary-on-background,rgba(0,0,0,.87))}::slotted(mwc-switch){margin-right:10px}::slotted(mwc-switch[dir=rtl]),[dir=rtl] ::slotted(mwc-switch){margin-left:10px}`},29344(t,e,i){i.a(t,async function(t,r){try{i.d(e,{A:()=>C});var o=i(5124),n=i(22441),a=i(6412),l=i(63672),s=i(34514),c=i(40991),d=i(92070),h=i(41268),p=i(9395),u=i(62676),f=i(15477),m=i(31896),b=i(17060),g=i(19978),v=t([b]);b=(v.then?(await v)():v)[0];var y=Object.defineProperty,w=Object.getOwnPropertyDescriptor,k=(t,e,i,r)=>{for(var o,n=r>1?void 0:r?w(e,i):e,a=t.length-1;a>=0;a--)(o=t[a])&&(n=(r?o(e,i,n):o(n))||n);return r&&n&&y(e,i,n),n};let C=class extends u.q{static get validators(){return[...super.validators,(0,h.i)()]}get value(){return this._value??"on"}set value(t){this._value=t}handleSizeChange(){(0,c.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 o.qy` <label part="base" class="${(0,a.H)({checked:this.checked,disabled:this.disabled})}"> <input class="input" type="checkbox" title="${this.title}" name="${(0,l.J)(this.name)}" value="${(0,l.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,a.H)({"has-slotted":e})}" aria-hidden="${e?"false":"true"}">${this.hint}</slot> `}constructor(){super(...arguments),this.hasSlotController=new d.X(this,"hint"),this.localize=new b.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}};C.shadowRootOptions={...u.q.shadowRootOptions,delegatesFocus:!0},C.css=[f.A,m.A,g.A],k([(0,n.P)('input[type="checkbox"]')],C.prototype,"input",2),k([(0,n.MZ)()],C.prototype,"title",2),k([(0,n.MZ)({reflect:!0})],C.prototype,"name",2),k([(0,n.MZ)({reflect:!0})],C.prototype,"value",1),k([(0,n.MZ)({reflect:!0})],C.prototype,"size",2),k([(0,p.w)("size")],C.prototype,"handleSizeChange",1),k([(0,n.MZ)({type:Boolean})],C.prototype,"disabled",2),k([(0,n.MZ)({type:Boolean,attribute:!1})],C.prototype,"checked",1),k([(0,n.MZ)({type:Boolean,attribute:"checked",reflect:!0})],C.prototype,"defaultChecked",2),k([(0,n.MZ)({type:Boolean,reflect:!0})],C.prototype,"required",2),k([(0,n.MZ)({attribute:"hint"})],C.prototype,"hint",2),k([(0,n.MZ)({attribute:"with-hint",type:Boolean})],C.prototype,"withHint",2),k([(0,p.w)(["checked","defaultChecked"])],C.prototype,"handleStateChange",1),k([(0,p.w)("disabled",{waitUntilFirstUpdate:!0})],C.prototype,"handleDisabledChange",1),C=k([(0,n.EM)("wa-switch")],C),C.disableWarning?.("change-in-update"),r()}catch(t){r(t)}})},19978(t,e,i){i.d(e,{A:()=>r});var r=i(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}}`},15477(t,e,i){i.d(e,{A:()=>r});var r=i(5124).AH`:host{display:flex;flex-direction:column}[part~=form-control]{display:contents}:is([part~=form-control-label],[part~=label]).has-label,:is([part~=form-control-label],[part~=label]):has(:not(:empty)){display:inline-flex;color:var(--wa-form-control-label-color);font-weight:var(--wa-form-control-label-font-weight);line-height:var(--wa-form-control-label-line-height);margin-block-end:0.5em}:host([required]) :is([part~=form-control-label],[part~=label])::after{content:var(--wa-form-control-required-content);margin-inline-start:var(--wa-form-control-required-content-offset);color:var(--wa-form-control-required-content-color)}[part~=hint]{display:block;color:var(--wa-form-control-hint-color);font-weight:var(--wa-form-control-hint-font-weight);line-height:var(--wa-form-control-hint-line-height);margin-block-start:0.5em;font-size:var(--wa-font-size-smaller)}[part~=hint]:not(.has-slotted,.has-hint){display:none}`},34514(t,e,i){i.d(e,{V:()=>a});var r=i(5055),o=i(42017),n=i(63937);const a=(0,o.u$)(class extends o.WL{render(t){return t}update(t,[e]){if(e===r.c0||e===r.s6)return e;const i=t.element,a=t.name;if(t.type===o.OA.PROPERTY){if(e===i[a])return r.c0}else if(t.type===o.OA.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(a))return r.c0}else if(t.type===o.OA.ATTRIBUTE&&i.getAttribute(a)===e+"")return r.c0;return(0,n.mY)(t),e}constructor(t){if(super(t),t.type!==o.OA.PROPERTY&&t.type!==o.OA.ATTRIBUTE&&t.type!==o.OA.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!(0,n.Rt)(t))throw Error("`live` bindings can only contain a single expression")}})}};