iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
5 lines • 8.9 kB
JavaScript
/*! For license information please see 22398.9b9a9f6430d6e871.js.LICENSE.txt */
export const __rspack_esm_id=22398;export const __rspack_esm_ids=[22398];export const __webpack_modules__={61366(t,e,o){o.a(t,async function(t,e){try{o(74423),o(17642),o(58004),o(33853),o(45876),o(32475),o(15024),o(31698);var a=o(5124),i=o(22441),n=o(6412),r=o(63672),s=o(17051),p=o(42462),d=o(28438),h=o(98779),l=o(27259),c=o(25877),u=o(984),w=o(95010),v=o(9395),m=o(717),b=o(40158),f=o(10416),y=t([b]);b=(y.then?(await y)():y)[0];var g=Object.defineProperty,k=Object.getOwnPropertyDescriptor,C=(t,e,o,a)=>{for(var i,n=a>1?void 0:a?k(e,o):e,r=t.length-1;r>=0;r--)(i=t[r])&&(n=(a?i(e,o,n):i(n))||n);return a&&n&&g(e,o,n),n};const D=new Set;let x=class extends m.A{connectedCallback(){super.connectedCallback(),this.id||(this.id=(0,w.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 h.k;if(this.dispatchEvent(t),t.defaultPrevented)return void(this.open=!1);D.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,D.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,l.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),D.delete(this),(0,c.Fw)(this),await(0,l.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:a}=this.eventController;e&&e.addEventListener("click",this.handleAnchorClick,{signal:a}),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 a.qy` <dialog aria-labelledby="${(0,r.J)(this.ariaLabelledby)}" aria-describedby="${(0,r.J)(this.ariaDescribedby)}" part="dialog" class="dialog" @cancel="${this.handleDialogCancel}"> <wa-popup part="popup" exportparts="
popup:popup__popup,
arrow:popup__arrow
" class="${(0,n.H)({popover:!0,"popover-open":this.open})}" placement="${this.placement}" distance="${this.distance}" skidding="${this.skidding}" flip shift ?arrow="${!this.withoutArrow}" .anchor="${this.anchor}" .autoSize="${this.autoSize}" .autoSizePadding="${this.autoSizePadding}"> <div part="body" class="body" @click="${this.handleBodyClick}"> <slot></slot> </div> </wa-popup> </dialog> `}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=f.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,v.w)("open",{waitUntilFirstUpdate:!0})],x.prototype,"handleOpenChange",1),C([(0,v.w)("for")],x.prototype,"handleForChange",1),C([(0,v.w)(["distance","placement","skidding"])],x.prototype,"handleOptionsChange",1),x=C([(0,i.EM)("wa-popover")],x),e()}catch(t){e(t)}})},10416(t,e,o){o.d(e,{A:()=>a});var a=o(5124).AH`: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(t,e,o){o.d(e,{f:()=>n});var a=o(73420),i=o(83504);function n(t,e,o){const n=(0,i.a)(t,o?.in);return isNaN(e)?(0,a.w)(o?.in||t,NaN):e?(n.setDate(n.getDate()+e),n):n}},78733(t,e,o){o.d(e,{z:()=>i});var a=o(83504);function i(t,e,o){const i=(0,a.a)(t,o?.in);return i.setTime(i.getTime()+6e4*e),i}},83339(t,e,o){o.d(e,{b:()=>i});var a=o(83504);function i(t,e){return+(0,a.a)(t)-+(0,a.a)(e)}},72659(t,e,o){o.d(e,{d:()=>i});var a=o(83504);function i(t,e){return+(0,a.a)(t)>+(0,a.a)(e)}},7562(t,e,o){o.d(e,{Y:()=>i});var a=o(83504);function i(t,e){return+(0,a.a)(t)<+(0,a.a)(e)}},20687(t,e,o){o.d(e,{v:()=>i});var a=o(83504);function i(t,e,o){const i=+(0,a.a)(t,o?.in),[n,r]=[+(0,a.a)(e.start,o?.in),+(0,a.a)(e.end,o?.in)].sort((t,e)=>t-e);return i>=n&&i<=r}},96231(t,e,o){function*a(t,e){const o="function"==typeof e;if(void 0!==t){let a=-1;for(const i of t)a>-1&&(yield o?e(a):e),a++,yield i}}o.d(e,{f:()=>a})},31479(t,e,o){o.d(e,{D:()=>r});var a=o(5055),i=o(42017),n=o(63937);const r=(0,i.u$)(class extends i.WL{render(t,e){return this.key=t,e}update(t,[e,o]){return e!==this.key&&((0,n.mY)(t),this.key=e),o}constructor(){super(...arguments),this.key=a.s6}})}};