iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
3 lines • 11.8 kB
JavaScript
/*! For license information please see chunk.dda636fdc588e9cfc32b.js.LICENSE.txt */
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[3268],{53268:function(t,e,s){"use strict";s(65233),s(65660);var i,n,o,r=s(9672),l=s(87156),a=s(50856),h=s(44181),c=s(85530);(0,r.k)({_template:(0,a.d)(i||(n=['\n <style>\n :host {\n position: relative;\n display: block;\n transition-timing-function: linear;\n transition-property: -webkit-transform;\n transition-property: transform;\n }\n\n :host::before {\n position: absolute;\n right: 0px;\n bottom: -5px;\n left: 0px;\n width: 100%;\n height: 5px;\n content: "";\n transition: opacity 0.4s;\n pointer-events: none;\n opacity: 0;\n box-shadow: inset 0px 5px 6px -3px rgba(0, 0, 0, 0.4);\n will-change: opacity;\n @apply --app-header-shadow;\n }\n\n :host([shadow])::before {\n opacity: 1;\n }\n\n #background {\n @apply --layout-fit;\n overflow: hidden;\n }\n\n #backgroundFrontLayer,\n #backgroundRearLayer {\n @apply --layout-fit;\n height: 100%;\n pointer-events: none;\n background-size: cover;\n }\n\n #backgroundFrontLayer {\n @apply --app-header-background-front-layer;\n }\n\n #backgroundRearLayer {\n opacity: 0;\n @apply --app-header-background-rear-layer;\n }\n\n #contentContainer {\n position: relative;\n width: 100%;\n height: 100%;\n }\n\n :host([disabled]),\n :host([disabled])::after,\n :host([disabled]) #backgroundFrontLayer,\n :host([disabled]) #backgroundRearLayer,\n /* Silent scrolling should not run CSS transitions */\n :host([silent-scroll]),\n :host([silent-scroll])::after,\n :host([silent-scroll]) #backgroundFrontLayer,\n :host([silent-scroll]) #backgroundRearLayer {\n transition: none !important;\n }\n\n :host([disabled]) ::slotted(app-toolbar:first-of-type),\n :host([disabled]) ::slotted([sticky]),\n /* Silent scrolling should not run CSS transitions */\n :host([silent-scroll]) ::slotted(app-toolbar:first-of-type),\n :host([silent-scroll]) ::slotted([sticky]) {\n transition: none !important;\n }\n\n </style>\n <div id="contentContainer">\n <slot id="slot"></slot>\n </div>\n'],o||(o=n.slice(0)),i=Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(o)}})))),is:"app-header",behaviors:[c._,h.Y],properties:{condenses:{type:Boolean,value:!1},fixed:{type:Boolean,value:!1},reveals:{type:Boolean,value:!1},shadow:{type:Boolean,reflectToAttribute:!0,value:!1}},observers:["_configChanged(isAttached, condenses, fixed)"],_height:0,_dHeight:0,_stickyElTop:0,_stickyElRef:null,_top:0,_progress:0,_wasScrollingDown:!1,_initScrollTop:0,_initTimestamp:0,_lastTimestamp:0,_lastScrollTop:0,get _maxHeaderTop(){return this.fixed?this._dHeight:this._height+5},get _stickyEl(){if(this._stickyElRef)return this._stickyElRef;for(var t,e=(0,l.vz)(this.$.slot).getDistributedNodes(),s=0;t=e[s];s++)if(t.nodeType===Node.ELEMENT_NODE){if(t.hasAttribute("sticky")){this._stickyElRef=t;break}this._stickyElRef||(this._stickyElRef=t)}return this._stickyElRef},_configChanged:function(){this.resetLayout(),this._notifyLayoutChanged()},_updateLayoutStates:function(){if(0!==this.offsetWidth||0!==this.offsetHeight){var t=this._clampedScrollTop,e=0===this._height||0===t,s=this.disabled;this._height=this.offsetHeight,this._stickyElRef=null,this.disabled=!0,e||this._updateScrollState(0,!0),this._mayMove()?this._dHeight=this._stickyEl?this._height-this._stickyEl.offsetHeight:0:this._dHeight=0,this._stickyElTop=this._stickyEl?this._stickyEl.offsetTop:0,this._setUpEffect(),e?this._updateScrollState(t,!0):(this._updateScrollState(this._lastScrollTop,!0),this._layoutIfDirty()),this.disabled=s}},_updateScrollState:function(t,e){if(0!==this._height){var s=0,i=0,n=this._top,o=(this._lastScrollTop,this._maxHeaderTop),r=t-this._lastScrollTop,l=Math.abs(r),a=t>this._lastScrollTop,h=performance.now();if(this._mayMove()&&(i=this._clamp(this.reveals?n+r:t,0,o)),t>=this._dHeight&&(i=this.condenses&&!this.fixed?Math.max(this._dHeight,i):i,this.style.transitionDuration="0ms"),this.reveals&&!this.disabled&&l<100&&((h-this._initTimestamp>300||this._wasScrollingDown!==a)&&(this._initScrollTop=t,this._initTimestamp=h),t>=o))if(Math.abs(this._initScrollTop-t)>30||l>10){a&&t>=o?i=o:!a&&t>=this._dHeight&&(i=this.condenses&&!this.fixed?this._dHeight:0);var c=r/(h-this._lastTimestamp);this.style.transitionDuration=this._clamp((i-n)/c,0,300)+"ms"}else i=this._top;s=0===this._dHeight?t>0?1:0:i/this._dHeight,e||(this._lastScrollTop=t,this._top=i,this._wasScrollingDown=a,this._lastTimestamp=h),(e||s!==this._progress||n!==i||0===t)&&(this._progress=s,this._runEffects(s,i),this._transformHeader(i))}},_mayMove:function(){return this.condenses||!this.fixed},willCondense:function(){return this._dHeight>0&&this.condenses},isOnScreen:function(){return 0!==this._height&&this._top<this._height},isContentBelow:function(){return 0===this._top?this._clampedScrollTop>0:this._clampedScrollTop-this._maxHeaderTop>=0},_transformHeader:function(t){this.translate3d(0,-t+"px",0),this._stickyEl&&this.translate3d(0,this.condenses&&t>=this._stickyElTop?Math.min(t,this._dHeight)-this._stickyElTop+"px":0,0,this._stickyEl)},_clamp:function(t,e,s){return Math.min(s,Math.max(e,t))},_ensureBgContainers:function(){this._bgContainer||(this._bgContainer=document.createElement("div"),this._bgContainer.id="background",this._bgRear=document.createElement("div"),this._bgRear.id="backgroundRearLayer",this._bgContainer.appendChild(this._bgRear),this._bgFront=document.createElement("div"),this._bgFront.id="backgroundFrontLayer",this._bgContainer.appendChild(this._bgFront),(0,l.vz)(this.root).insertBefore(this._bgContainer,this.$.contentContainer))},_getDOMRef:function(t){switch(t){case"backgroundFrontLayer":return this._ensureBgContainers(),this._bgFront;case"backgroundRearLayer":return this._ensureBgContainers(),this._bgRear;case"background":return this._ensureBgContainers(),this._bgContainer;case"mainTitle":return(0,l.vz)(this).querySelector("[main-title]");case"condensedTitle":return(0,l.vz)(this).querySelector("[condensed-title]")}return null},getScrollState:function(){return{progress:this._progress,top:this._top}}})},85530:function(t,e,s){"use strict";s.d(e,{_:function(){return o}});s(65233);var i=s(67810),n=s(28393),o=[i.o,{properties:{effects:{type:String},effectsConfig:{type:Object,value:function(){return{}}},disabled:{type:Boolean,reflectToAttribute:!0,value:!1},threshold:{type:Number,value:0},thresholdTriggered:{type:Boolean,notify:!0,readOnly:!0,reflectToAttribute:!0}},observers:["_effectsChanged(effects, effectsConfig, isAttached)"],_updateScrollState:function(t){},isOnScreen:function(){return!1},isContentBelow:function(){return!1},_effectsRunFn:null,_effects:null,get _clampedScrollTop(){return Math.max(0,this._scrollTop)},attached:function(){this._scrollStateChanged()},detached:function(){this._tearDownEffects()},createEffect:function(t,e){var s=n.tB[t];if(!s)throw new ReferenceError(this._getUndefinedMsg(t));var i=this._boundEffect(s,e||{});return i.setUp(),i},_effectsChanged:function(t,e,s){this._tearDownEffects(),t&&s&&(t.split(" ").forEach((function(t){var s;""!==t&&((s=n.tB[t])?this._effects.push(this._boundEffect(s,e[t])):console.warn(this._getUndefinedMsg(t)))}),this),this._setUpEffect())},_layoutIfDirty:function(){return this.offsetWidth},_boundEffect:function(t,e){e=e||{};var s=parseFloat(e.startsAt||0),i=parseFloat(e.endsAt||1),n=i-s,o=function(){},r=0===s&&1===i?t.run:function(e,i){t.run.call(this,Math.max(0,(e-s)/n),i)};return{setUp:t.setUp?t.setUp.bind(this,e):o,run:t.run?r.bind(this):o,tearDown:t.tearDown?t.tearDown.bind(this):o}},_setUpEffect:function(){this.isAttached&&this._effects&&(this._effectsRunFn=[],this._effects.forEach((function(t){!1!==t.setUp()&&this._effectsRunFn.push(t.run)}),this))},_tearDownEffects:function(){this._effects&&this._effects.forEach((function(t){t.tearDown()})),this._effectsRunFn=[],this._effects=[]},_runEffects:function(t,e){this._effectsRunFn&&this._effectsRunFn.forEach((function(s){s(t,e)}))},_scrollHandler:function(){this._scrollStateChanged()},_scrollStateChanged:function(){if(!this.disabled){var t=this._clampedScrollTop;this._updateScrollState(t),this.threshold>0&&this._setThresholdTriggered(t>=this.threshold)}},_getDOMRef:function(t){console.warn("_getDOMRef","`"+t+"` is undefined")},_getUndefinedMsg:function(t){return"Scroll effect `"+t+"` is undefined. Did you forget to import app-layout/app-scroll-effects/effects/"+t+".html ?"}}]},28393:function(t,e,s){"use strict";s.d(e,{tB:function(){return i},VA:function(){return n}});s(65233);var i={},n=function(t,e){if(null!=i[t])throw new Error("effect `"+t+"` is already registered.");i[t]=e}},67810:function(t,e,s){"use strict";s.d(e,{o:function(){return o}});s(65233);var i=s(87156);function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o={properties:{scrollTarget:{type:HTMLElement,value:function(){return this._defaultScrollTarget}}},observers:["_scrollTargetChanged(scrollTarget, isAttached)"],_shouldHaveListener:!0,_scrollTargetChanged:function(t,e){if(this._oldScrollTarget&&(this._toggleScrollListener(!1,this._oldScrollTarget),this._oldScrollTarget=null),e)if("document"===t)this.scrollTarget=this._doc;else if("string"==typeof t){var s=this.domHost;this.scrollTarget=s&&s.$?s.$[t]:(0,i.vz)(this.ownerDocument).querySelector("#"+t)}else this._isValidScrollTarget()&&(this._oldScrollTarget=t,this._toggleScrollListener(this._shouldHaveListener,t))},_scrollHandler:function(){},get _defaultScrollTarget(){return this._doc},get _doc(){return this.ownerDocument.documentElement},get _scrollTop(){return this._isValidScrollTarget()?this.scrollTarget===this._doc?window.pageYOffset:this.scrollTarget.scrollTop:0},get _scrollLeft(){return this._isValidScrollTarget()?this.scrollTarget===this._doc?window.pageXOffset:this.scrollTarget.scrollLeft:0},set _scrollTop(t){this.scrollTarget===this._doc?window.scrollTo(window.pageXOffset,t):this._isValidScrollTarget()&&(this.scrollTarget.scrollTop=t)},set _scrollLeft(t){this.scrollTarget===this._doc?window.scrollTo(t,window.pageYOffset):this._isValidScrollTarget()&&(this.scrollTarget.scrollLeft=t)},scroll:function(t,e){var s;"object"===n(t)?(s=t.left,e=t.top):s=t,s=s||0,e=e||0,this.scrollTarget===this._doc?window.scrollTo(s,e):this._isValidScrollTarget()&&(this.scrollTarget.scrollLeft=s,this.scrollTarget.scrollTop=e)},get _scrollTargetWidth(){return this._isValidScrollTarget()?this.scrollTarget===this._doc?window.innerWidth:this.scrollTarget.offsetWidth:0},get _scrollTargetHeight(){return this._isValidScrollTarget()?this.scrollTarget===this._doc?window.innerHeight:this.scrollTarget.offsetHeight:0},_isValidScrollTarget:function(){return this.scrollTarget instanceof HTMLElement},_toggleScrollListener:function(t,e){var s=e===this._doc?window:e;t?this._boundScrollHandler||(this._boundScrollHandler=this._scrollHandler.bind(this),s.addEventListener("scroll",this._boundScrollHandler)):this._boundScrollHandler&&(s.removeEventListener("scroll",this._boundScrollHandler),this._boundScrollHandler=null)},toggleScrollListener:function(t){this._shouldHaveListener=t,this._toggleScrollListener(t,this.scrollTarget)}}}}]);
//# sourceMappingURL=chunk.dda636fdc588e9cfc32b.js.map