UNPKG

iobroker.lovelace

Version:

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

2 lines 8.3 kB
/*! For license information please see 46095.f003e8d83507cabe.js.LICENSE.txt */ "use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[46095],{76482:function(t,e,i){i.d(e,{i:function(){return s}});i(89463),i(62953);var r=i(5124);const n=Symbol("attachableController");let o;r.S$||(o=new MutationObserver(t=>{for(const i of t){var e;null===(e=i.target[n])||void 0===e||e.hostConnected()}}));class s{get htmlFor(){return this.host.getAttribute("for")}set htmlFor(t){null===t?this.host.removeAttribute("for"):this.host.setAttribute("for",t)}get control(){return this.host.hasAttribute("for")?this.htmlFor&&this.host.isConnected?this.host.getRootNode().querySelector(`#${this.htmlFor}`):null:this.currentControl||this.host.parentElement}set control(t){t?this.attach(t):this.detach()}attach(t){t!==this.currentControl&&(this.setCurrentControl(t),this.host.removeAttribute("for"))}detach(){this.setCurrentControl(null),this.host.setAttribute("for","")}hostConnected(){this.setCurrentControl(this.control)}hostDisconnected(){this.setCurrentControl(null)}setCurrentControl(t){this.onControlChange(this.currentControl,t),this.currentControl=t}constructor(t,e){var i;this.host=t,this.onControlChange=e,this.currentControl=null,t.addController(this),t[n]=this,null===(i=o)||void 0===i||i.observe(t,{attributeFilter:["for"]})}}},76610:function(t,e,i){i.d(e,{Ux:function(){return r},du:function(){return n}});i(3362),i(27495),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(42762),i(62953);const r={STANDARD:"cubic-bezier(0.2, 0, 0, 1)",STANDARD_ACCELERATE:"cubic-bezier(.3,0,1,1)",STANDARD_DECELERATE:"cubic-bezier(0,0,0,1)",EMPHASIZED:"cubic-bezier(.3,0,0,1)",EMPHASIZED_ACCELERATE:"cubic-bezier(.3,0,.8,.15)",EMPHASIZED_DECELERATE:"cubic-bezier(.05,.7,.1,1)"};function n(){let t=null;return{start(){var e;return null===(e=t)||void 0===e||e.abort(),t=new AbortController,t.signal},finish(){t=null}}}},96245:function(t,e,i){i.d(e,{R:function(){return n}});let r;const n=(0,i(5124).AH)(r||(r=(t=>t)`:host{display:flex;margin:auto;pointer-events:none}:host([disabled]){display:none}@media(forced-colors:active){:host{display:none}}.surface,:host{border-radius:inherit;position:absolute;inset:0;overflow:hidden}.surface{-webkit-tap-highlight-color:transparent}.surface::after,.surface::before{content:"";opacity:0;position:absolute}.surface::before{background-color:var(--md-ripple-hover-color,var(--md-sys-color-on-surface,#1d1b20));inset:0;transition:opacity 15ms linear,background-color 15ms linear}.surface::after{background:radial-gradient(closest-side,var(--md-ripple-pressed-color,var(--md-sys-color-on-surface,#1d1b20)) max(100% - 70px,65%),transparent 100%);transform-origin:center center;transition:opacity 375ms linear}.hovered::before{background-color:var(--md-ripple-hover-color,var(--md-sys-color-on-surface,#1d1b20));opacity:var(--md-ripple-hover-opacity, .08)}.pressed::after{opacity:var(--md-ripple-pressed-opacity, .12);transition-duration:105ms}`))},91382:function(t,e,i){i.d(e,{n:function(){return C}});i(3362),i(62953);var r=i(40445),n=i(5124),o=i(67576),s=i(6412),a=i(76482),h=i(76610);let l,c=t=>t;var d;!function(t){t[t.INACTIVE=0]="INACTIVE",t[t.TOUCH_DELAY=1]="TOUCH_DELAY",t[t.HOLDING=2]="HOLDING",t[t.WAITING_FOR_CLICK=3]="WAITING_FOR_CLICK"}(d||(d={}));const u=["click","contextmenu","pointercancel","pointerdown","pointerenter","pointerleave","pointerup"],p=n.S$?null:window.matchMedia("(forced-colors: active)");class C extends n.WF{get htmlFor(){return this.attachableController.htmlFor}set htmlFor(t){this.attachableController.htmlFor=t}get control(){return this.attachableController.control}set control(t){this.attachableController.control=t}attach(t){this.attachableController.attach(t)}detach(){this.attachableController.detach()}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-hidden","true")}render(){const t={hovered:this.hovered,pressed:this.pressed};return(0,n.qy)(l||(l=c`<div class="surface ${0}"></div>`),(0,s.H)(t))}update(t){t.has("disabled")&&this.disabled&&(this.hovered=!1,this.pressed=!1),super.update(t)}handlePointerenter(t){this.shouldReactToEvent(t)&&(this.hovered=!0)}handlePointerleave(t){this.shouldReactToEvent(t)&&(this.hovered=!1,this.state!==d.INACTIVE&&this.endPressAnimation())}handlePointerup(t){if(this.shouldReactToEvent(t)){if(this.state!==d.HOLDING)return this.state===d.TOUCH_DELAY?(this.state=d.WAITING_FOR_CLICK,void this.startPressAnimation(this.rippleStartEvent)):void 0;this.state=d.WAITING_FOR_CLICK}}async handlePointerdown(t){if(this.shouldReactToEvent(t)){if(this.rippleStartEvent=t,!this.isTouch(t))return this.state=d.WAITING_FOR_CLICK,void this.startPressAnimation(t);this.state=d.TOUCH_DELAY,await new Promise(t=>{setTimeout(t,150)}),this.state===d.TOUCH_DELAY&&(this.state=d.HOLDING,this.startPressAnimation(t))}}handleClick(){this.disabled||(this.state!==d.WAITING_FOR_CLICK?this.state===d.INACTIVE&&(this.startPressAnimation(),this.endPressAnimation()):this.endPressAnimation())}handlePointercancel(t){this.shouldReactToEvent(t)&&this.endPressAnimation()}handleContextmenu(){this.disabled||this.endPressAnimation()}determineRippleSize(){var t;const{height:e,width:i}=this.getBoundingClientRect(),r=Math.max(e,i),n=Math.max(.35*r,75),o=null!==(t=this.currentCSSZoom)&&void 0!==t?t:1,s=Math.floor(.2*r/o),a=Math.sqrt(i**2+e**2)+10;this.initialSize=s;const h=(a+n)/s;this.rippleScale=""+h/o,this.rippleSize=`${s}px`}getNormalizedPointerEventCoords(t){var e;const{scrollX:i,scrollY:r}=window,{left:n,top:o}=this.getBoundingClientRect(),s=i+n,a=r+o,{pageX:h,pageY:l}=t,c=null!==(e=this.currentCSSZoom)&&void 0!==e?e:1;return{x:(h-s)/c,y:(l-a)/c}}getTranslationCoordinates(t){var e;const{height:i,width:r}=this.getBoundingClientRect(),n=null!==(e=this.currentCSSZoom)&&void 0!==e?e:1,o={x:(r/n-this.initialSize)/2,y:(i/n-this.initialSize)/2};let s;return s=t instanceof PointerEvent?this.getNormalizedPointerEventCoords(t):{x:r/n/2,y:i/n/2},s={x:s.x-this.initialSize/2,y:s.y-this.initialSize/2},{startPoint:s,endPoint:o}}startPressAnimation(t){var e;if(!this.mdRoot)return;this.pressed=!0,null===(e=this.growAnimation)||void 0===e||e.cancel(),this.determineRippleSize();const{startPoint:i,endPoint:r}=this.getTranslationCoordinates(t),n=`${i.x}px, ${i.y}px`,o=`${r.x}px, ${r.y}px`;this.growAnimation=this.mdRoot.animate({top:[0,0],left:[0,0],height:[this.rippleSize,this.rippleSize],width:[this.rippleSize,this.rippleSize],transform:[`translate(${n}) scale(1)`,`translate(${o}) scale(${this.rippleScale})`]},{pseudoElement:"::after",duration:450,easing:h.Ux.STANDARD,fill:"forwards"})}async endPressAnimation(){this.rippleStartEvent=void 0,this.state=d.INACTIVE;const t=this.growAnimation;let e=1/0;"number"==typeof(null==t?void 0:t.currentTime)?e=t.currentTime:null!=t&&t.currentTime&&(e=t.currentTime.to("ms").value),e>=225?this.pressed=!1:(await new Promise(t=>{setTimeout(t,225-e)}),this.growAnimation===t&&(this.pressed=!1))}shouldReactToEvent(t){if(this.disabled||!t.isPrimary)return!1;if(this.rippleStartEvent&&this.rippleStartEvent.pointerId!==t.pointerId)return!1;if("pointerenter"===t.type||"pointerleave"===t.type)return!this.isTouch(t);const e=1===t.buttons;return this.isTouch(t)||e}isTouch({pointerType:t}){return"touch"===t}async handleEvent(t){if(null==p||!p.matches)switch(t.type){case"click":this.handleClick();break;case"contextmenu":this.handleContextmenu();break;case"pointercancel":this.handlePointercancel(t);break;case"pointerdown":await this.handlePointerdown(t);break;case"pointerenter":this.handlePointerenter(t);break;case"pointerleave":this.handlePointerleave(t);break;case"pointerup":this.handlePointerup(t)}}onControlChange(t,e){if(!n.S$)for(const i of u)null==t||t.removeEventListener(i,this),null==e||e.addEventListener(i,this)}constructor(){super(...arguments),this.disabled=!1,this.hovered=!1,this.pressed=!1,this.rippleSize="",this.rippleScale="",this.initialSize=0,this.state=d.INACTIVE,this.attachableController=new a.i(this,this.onControlChange.bind(this))}}(0,r.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],C.prototype,"disabled",void 0),(0,r.Cg)([(0,o.wk)()],C.prototype,"hovered",void 0),(0,r.Cg)([(0,o.wk)()],C.prototype,"pressed",void 0),(0,r.Cg)([(0,o.P)(".surface")],C.prototype,"mdRoot",void 0)}}]);