iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
5 lines • 9.24 kB
JavaScript
/*! For license information please see 66283.b7b421ed24387ad9.js.LICENSE.txt */
;(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[66283],{53921:function(t,e,o){var n=o(46518),i=o(72652),a=o(97040);n({target:"Object",stat:!0},{fromEntries:function(t){var e={};return i(t,function(t,o){a(e,t,o)},{AS_ENTRIES:!0}),e}})},61366:function(t,e,o){o.a(t,async function(t,e){try{o(74423),o(3362),o(17642),o(58004),o(33853),o(45876),o(32475),o(15024),o(31698),o(62953);var n=o(5124),i=o(67576),a=o(6412),r=o(63672),s=o(17051),p=o(42462),d=o(28438),l=o(98779),h=o(27259),c=o(25877),u=o(984),f=o(95010),w=o(9395),v=o(717),b=o(40158),m=o(10416),g=t([b]);b=(g.then?(await g)():g)[0];let D,E=t=>t;var y=Object.defineProperty,k=Object.getOwnPropertyDescriptor,C=(t,e,o,n)=>{for(var i,a=n>1?void 0:n?k(e,o):e,r=t.length-1;r>=0;r--)(i=t[r])&&(a=(n?i(e,o,a):i(a))||a);return n&&a&&y(e,o,a),a};const A=new Set;let x=class extends v.A{connectedCallback(){super.connectedCallback(),this.id||(this.id=(0,f.N)("wa-popover-")),this.eventController.signal.aborted&&(this.eventController=new AbortController),this.for&&this.anchor&&(this.anchor=null,this.handleForChange())}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleDocumentKeyDown),(0,c.Fw)(this),this.eventController.abort()}firstUpdated(){this.open&&this.handleOpenChange()}updated(t){t.has("open")&&this.customStates.set("open",this.open)}async handleOpenChange(){if(this.open){const t=new l.k;if(this.dispatchEvent(t),t.defaultPrevented)return void(this.open=!1);A.forEach(t=>t.open=!1),document.addEventListener("keydown",this.handleDocumentKeyDown,{signal:this.eventController.signal}),document.addEventListener("click",this.handleDocumentClick,{signal:this.eventController.signal}),this.trapFocus?this.dialog.showModal():this.dialog.show(),this.popup.active=!0,A.add(this),(0,c.AZ)(this),requestAnimationFrame(()=>{const t=this.querySelector("[autofocus]");t&&"function"==typeof t.focus?t.focus():this.dialog.focus()}),this.popup.popup||await this.popup.updateComplete,await(0,h.Ud)(this.popup.popup,"show-with-scale"),this.popup.reposition(),this.dispatchEvent(new p.q)}else{const t=new d.L;if(this.dispatchEvent(t),t.defaultPrevented)return void(this.open=!0);document.removeEventListener("keydown",this.handleDocumentKeyDown),document.removeEventListener("click",this.handleDocumentClick),A.delete(this),(0,c.Fw)(this),await(0,h.Ud)(this.popup.popup,"hide-with-scale"),this.popup.active=!1,this.dialog.close(),this.dispatchEvent(new s.Z)}}handleForChange(){const t=this.getRootNode();if(!t)return;const e=this.for?t.getElementById(this.for):null,o=this.anchor;if(e===o)return;const{signal:n}=this.eventController;e&&e.addEventListener("click",this.handleAnchorClick,{signal:n}),o&&o.removeEventListener("click",this.handleAnchorClick),this.anchor=e,this.for&&!e&&console.warn(`A popover was assigned to an element with an ID of "${this.for}" but the element could not be found.`,this)}async handleOptionsChange(){this.hasUpdated&&(await this.updateComplete,this.popup.reposition())}async show(){if(!this.open)return this.open=!0,(0,u.l)(this,"wa-after-show")}async hide(){if(this.open)return this.open=!1,(0,u.l)(this,"wa-after-hide")}handleDialogCancel(t){t.preventDefault(),this.dialog.classList.contains("hide")||(this.open=!1)}render(){return(0,n.qy)(D||(D=E` <dialog aria-labelledby="${0}" aria-describedby="${0}" part="dialog" class="dialog" @cancel="${0}"> <wa-popup part="popup" exportparts="
popup:popup__popup,
arrow:popup__arrow
" class="${0}" placement="${0}" distance="${0}" skidding="${0}" flip shift ?arrow="${0}" .anchor="${0}" .autoSize="${0}" .autoSizePadding="${0}"> <div part="body" class="body" @click="${0}"> <slot></slot> </div> </wa-popup> </dialog> `),(0,r.J)(this.ariaLabelledby),(0,r.J)(this.ariaDescribedby),this.handleDialogCancel,(0,a.H)({popover:!0,"popover-open":this.open}),this.placement,this.distance,this.skidding,!this.withoutArrow,this.anchor,this.autoSize,this.autoSizePadding,this.handleBodyClick)}constructor(){super(...arguments),this.anchor=null,this.placement="top",this.open=!1,this.distance=8,this.skidding=0,this.for=null,this.withoutArrow=!1,this.autoSizePadding=0,this.trapFocus=!1,this.eventController=new AbortController,this.handleAnchorClick=()=>{this.open=!this.open},this.handleBodyClick=t=>{t.stopPropagation();t.target.closest('[data-popover="close"]')&&(this.open=!1)},this.handleDocumentKeyDown=t=>{"Escape"===t.key&&this.open&&(0,c.a0)(this)&&(t.preventDefault(),t.stopPropagation(),this.open=!1,this.anchor&&"function"==typeof this.anchor.focus&&this.anchor.focus())},this.handleDocumentClick=t=>{this.anchor&&t.composedPath().includes(this.anchor)||t.composedPath().includes(this)||(this.open=!1)}}};x.css=m.A,x.dependencies={"wa-popup":b.A},C([(0,i.P)("dialog")],x.prototype,"dialog",2),C([(0,i.P)(".body")],x.prototype,"body",2),C([(0,i.P)("wa-popup")],x.prototype,"popup",2),C([(0,i.wk)()],x.prototype,"anchor",2),C([(0,i.MZ)()],x.prototype,"placement",2),C([(0,i.MZ)({type:Boolean,reflect:!0})],x.prototype,"open",2),C([(0,i.MZ)({type:Number})],x.prototype,"distance",2),C([(0,i.MZ)({type:Number})],x.prototype,"skidding",2),C([(0,i.MZ)()],x.prototype,"for",2),C([(0,i.MZ)({attribute:"without-arrow",type:Boolean,reflect:!0})],x.prototype,"withoutArrow",2),C([(0,i.MZ)({attribute:"auto-size"})],x.prototype,"autoSize",2),C([(0,i.MZ)({attribute:"auto-size-padding",type:Number})],x.prototype,"autoSizePadding",2),C([(0,i.MZ)({attribute:"trap-focus",type:Boolean})],x.prototype,"trapFocus",2),C([(0,i.MZ)({attribute:"aria-labelledby"})],x.prototype,"ariaLabelledby",2),C([(0,i.MZ)({attribute:"aria-describedby"})],x.prototype,"ariaDescribedby",2),C([(0,w.w)("open",{waitUntilFirstUpdate:!0})],x.prototype,"handleOpenChange",1),C([(0,w.w)("for")],x.prototype,"handleForChange",1),C([(0,w.w)(["distance","placement","skidding"])],x.prototype,"handleOptionsChange",1),x=C([(0,i.EM)("wa-popover")],x),e()}catch(D){e(D)}})},10416:function(t,e,o){o.d(e,{A:function(){return i}});let n;var i=(0,o(5124).AH)(n||(n=(t=>t)`:host{--arrow-size:0.375rem;--max-width:25rem;--show-duration:100ms;--hide-duration:100ms;display:contents;font-size:var(--wa-font-size-m);line-height:var(--wa-line-height-normal);text-align:start;white-space:normal}.dialog{display:none;position:fixed;inset:0;width:100%;height:100%;margin:0;padding:0;border:none;background:0 0;overflow:visible;pointer-events:none}.dialog:focus{outline:0}.dialog[open]{display:block}.popover{--arrow-size:inherit;--popup-border-width:var(--wa-panel-border-width);--show-duration:inherit;--hide-duration:inherit;pointer-events:auto}.popover::part(arrow){background-color:var(--wa-color-surface-default);border-top:none;border-left:none;border-bottom:solid var(--wa-panel-border-width) var(--wa-color-surface-border);border-right:solid var(--wa-panel-border-width) var(--wa-color-surface-border);box-shadow:none}.popover[placement^=top]::part(popup){transform-origin:bottom}.popover[placement^=bottom]::part(popup){transform-origin:top}.popover[placement^=left]::part(popup){transform-origin:right}.popover[placement^=right]::part(popup){transform-origin:left}.body{display:flex;flex-direction:column;width:auto;max-width:min(var(--max-width),100vw);padding:var(--wa-space-l);background-color:var(--wa-color-surface-default);border:var(--wa-panel-border-width) solid var(--wa-color-surface-border);border-radius:var(--wa-panel-border-radius);border-style:var(--wa-panel-border-style);box-shadow:var(--wa-shadow-l);color:var(--wa-color-text-normal);user-select:none;-webkit-user-select:none}.popover[data-current-placement^=bottom] .body,.popover[data-current-placement^=top] .body{max-width:min(var(--max-width),100vw - (var(--wa-space-m) * 2));margin-inline:var(--wa-space-m)}.popover[data-current-placement^=left] .body,.popover[data-current-placement^=right] .body{max-height:calc(100vh - (var(--wa-space-m) * 2));margin-block:var(--wa-space-m)}`))},92913:function(t,e,o){o.d(e,{f:function(){return a}});var n=o(73420),i=o(83504);function a(t,e,o){const a=(0,i.a)(t,null==o?void 0:o.in);return isNaN(e)?(0,n.w)((null==o?void 0:o.in)||t,NaN):e?(a.setDate(a.getDate()+e),a):a}},78733:function(t,e,o){o.d(e,{z:function(){return i}});var n=o(83504);function i(t,e,o){const i=(0,n.a)(t,null==o?void 0:o.in);return i.setTime(i.getTime()+6e4*e),i}},83339:function(t,e,o){o.d(e,{b:function(){return i}});var n=o(83504);function i(t,e){return+(0,n.a)(t)-+(0,n.a)(e)}},72659:function(t,e,o){o.d(e,{d:function(){return i}});var n=o(83504);function i(t,e){return+(0,n.a)(t)>+(0,n.a)(e)}},7562:function(t,e,o){o.d(e,{Y:function(){return i}});var n=o(83504);function i(t,e){return+(0,n.a)(t)<+(0,n.a)(e)}},20687:function(t,e,o){o.d(e,{v:function(){return i}});o(26910),o(62953);var n=o(83504);function i(t,e,o){const i=+(0,n.a)(t,null==o?void 0:o.in),[a,r]=[+(0,n.a)(e.start,null==o?void 0:o.in),+(0,n.a)(e.end,null==o?void 0:o.in)].sort((t,e)=>t-e);return i>=a&&i<=r}},20202:function(t,e,o){o.d(e,{f:function(){return n}});o(62953);function*n(t,e){const o="function"==typeof e;if(void 0!==t){let n=-1;for(const i of t)n>-1&&(yield o?e(n):e),n++,yield i}}}}]);