iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
259 lines (213 loc) • 14.7 kB
JavaScript
/*! For license information please see chunk.f4fe95fdc34027aaebca.js.LICENSE.txt */
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[7482],{85753:(t,e,n)=>{"use strict";n.d(e,{I:()=>o,E:()=>a});n(43437);var i=n(78161);const o={hostAttributes:{role:"menubar"},keyBindings:{left:"_onLeftKey",right:"_onRightKey"},_onUpKey:function(t){this.focusedItem.click(),t.detail.keyboardEvent.preventDefault()},_onDownKey:function(t){this.focusedItem.click(),t.detail.keyboardEvent.preventDefault()},get _isRTL(){return"rtl"===window.getComputedStyle(this).direction},_onLeftKey:function(t){this._isRTL?this._focusNext():this._focusPrevious(),t.detail.keyboardEvent.preventDefault()},_onRightKey:function(t){this._isRTL?this._focusPrevious():this._focusNext(),t.detail.keyboardEvent.preventDefault()},_onKeydown:function(t){this.keyboardEventMatchesKeys(t,"up down left right esc")||this._focusWithKeyboardEvent(t)}},a=[i.i,o]},91441:(t,e,n)=>{"use strict";n(43437),n(65660);var i=n(51644),o=n(26110),a=n(84938),s=n(9672),l=n(87156),r=n(50856);(0,s.k)({_template:r.d`
<style>
:host {
--layout-inline;
--layout-center;
--layout-center-justified;
--layout-flex-auto;
position: relative;
padding: 0 12px;
overflow: hidden;
cursor: pointer;
vertical-align: middle;
--paper-font-common-base;
--paper-tab;
}
:host(:focus) {
outline: none;
}
:host([link]) {
padding: 0;
}
.tab-content {
height: 100%;
transform: translateZ(0);
-webkit-transform: translateZ(0);
transition: opacity 0.1s cubic-bezier(0.4, 0.0, 1, 1);
--layout-horizontal;
--layout-center-center;
--layout-flex-auto;
--paper-tab-content;
}
:host(:not(.iron-selected)) > .tab-content {
opacity: 0.8;
--paper-tab-content-unselected;
}
:host(:focus) .tab-content {
opacity: 1;
font-weight: 700;
--paper-tab-content-focused;
}
paper-ripple {
color: var(--paper-tab-ink, var(--paper-yellow-a100));
}
.tab-content > ::slotted(a) {
--layout-flex-auto;
height: 100%;
}
</style>
<div class="tab-content">
<slot></slot>
</div>
`,is:"paper-tab",behaviors:[o.a,i.P,a.o],properties:{link:{type:Boolean,value:!1,reflectToAttribute:!0}},hostAttributes:{role:"tab"},listeners:{down:"_updateNoink",tap:"_onTap"},attached:function(){this._updateNoink()},get _parentNoink(){var t=(0,l.vz)(this).parentNode;return!!t&&!!t.noink},_updateNoink:function(){this.noink=!!this.noink||!!this._parentNoink},_onTap:function(t){if(this.link){var e=this.queryEffectiveChildren("a");if(!e)return;if(t.target===e)return;e.click()}}})},87482:(t,e,n)=>{"use strict";n(43437),n(65660),n(63207),n(1656);var i=n(49075),o=n(9672),a=n(50856);(0,o.k)({is:"paper-icon-button",_template:a.d`
<style>
:host {
display: inline-block;
position: relative;
padding: 8px;
outline: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
z-index: 0;
line-height: 1;
width: 40px;
height: 40px;
/*
NOTE: Both values are needed, since some phones require the value to
be \`transparent\`.
*/
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: transparent;
/* Because of polymer/2558, this style has lower specificity than * */
box-sizing: border-box !important;
--paper-icon-button;
}
:host #ink {
color: var(--paper-icon-button-ink-color, var(--primary-text-color));
opacity: 0.6;
}
:host([disabled]) {
color: var(--paper-icon-button-disabled-text, var(--disabled-text-color));
pointer-events: none;
cursor: auto;
--paper-icon-button-disabled;
}
:host([hidden]) {
display: none !important;
}
:host(:hover) {
--paper-icon-button-hover;
}
iron-icon {
--iron-icon-width: 100%;
--iron-icon-height: 100%;
}
</style>
<iron-icon id="icon" src="[[src]]" icon="[[icon]]"
alt$="[[alt]]"></iron-icon>
`,hostAttributes:{role:"button",tabindex:"0"},behaviors:[i.B],registered:function(){this._template.setAttribute("strip-whitespace","")},properties:{src:{type:String},icon:{type:String},alt:{type:String,observer:"_altChanged"}},_altChanged:function(t,e){var n=this.getAttribute("aria-label");n&&e!=n||this.setAttribute("aria-label",t)}});n(15495),n(99257);const s=a.d`<iron-iconset-svg name="paper-tabs" size="24">
<svg><defs>
<g id="chevron-left"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"></path></g>
<g id="chevron-right"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path></g>
</defs></svg>
</iron-iconset-svg>`;document.head.appendChild(s.content);n(91441);var l=n(78161),r=n(85753),c=n(72986),h=n(87156);(0,o.k)({_template:a.d`
<style>
:host {
--layout;
--layout-center;
height: 48px;
font-size: 14px;
font-weight: 500;
overflow: hidden;
-moz-user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
user-select: none;
/* NOTE: Both values are needed, since some phones require the value to be \`transparent\`. */
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: transparent;
--paper-tabs;
}
:host(:dir(rtl)) {
--layout-horizontal-reverse;
}
#tabsContainer {
position: relative;
height: 100%;
white-space: nowrap;
overflow: hidden;
--layout-flex-auto;
--paper-tabs-container;
}
#tabsContent {
height: 100%;
-moz-flex-basis: auto;
-ms-flex-basis: auto;
flex-basis: auto;
--paper-tabs-content;
}
#tabsContent.scrollable {
position: absolute;
white-space: nowrap;
}
#tabsContent:not(.scrollable),
#tabsContent.scrollable.fit-container {
--layout-horizontal;
}
#tabsContent.scrollable.fit-container {
min-width: 100%;
}
#tabsContent.scrollable.fit-container > ::slotted(*) {
/* IE - prevent tabs from compressing when they should scroll. */
-ms-flex: 1 0 auto;
-webkit-flex: 1 0 auto;
flex: 1 0 auto;
}
.hidden {
display: none;
}
.not-visible {
opacity: 0;
cursor: default;
}
paper-icon-button {
width: 48px;
height: 48px;
padding: 12px;
margin: 0 4px;
}
#selectionBar {
position: absolute;
height: 0;
bottom: 0;
left: 0;
right: 0;
border-bottom: 2px solid var(--paper-tabs-selection-bar-color, var(--paper-yellow-a100));
-webkit-transform: scale(0);
transform: scale(0);
-webkit-transform-origin: left center;
transform-origin: left center;
transition: -webkit-transform;
transition: transform;
--paper-tabs-selection-bar;
}
#selectionBar.align-bottom {
top: 0;
bottom: auto;
}
#selectionBar.expand {
transition-duration: 0.15s;
transition-timing-function: cubic-bezier(0.4, 0.0, 1, 1);
}
#selectionBar.contract {
transition-duration: 0.18s;
transition-timing-function: cubic-bezier(0.0, 0.0, 0.2, 1);
}
#tabsContent > ::slotted(:not(#selectionBar)) {
height: 100%;
}
</style>
<paper-icon-button icon="paper-tabs:chevron-left" class$="[[_computeScrollButtonClass(_leftHidden, scrollable, hideScrollButtons)]]" on-up="_onScrollButtonUp" on-down="_onLeftScrollButtonDown" tabindex="-1"></paper-icon-button>
<div id="tabsContainer" on-track="_scroll" on-down="_down">
<div id="tabsContent" class$="[[_computeTabsContentClass(scrollable, fitContainer)]]">
<div id="selectionBar" class$="[[_computeSelectionBarClass(noBar, alignBottom)]]" on-transitionend="_onBarTransitionEnd"></div>
<slot></slot>
</div>
</div>
<paper-icon-button icon="paper-tabs:chevron-right" class$="[[_computeScrollButtonClass(_rightHidden, scrollable, hideScrollButtons)]]" on-up="_onScrollButtonUp" on-down="_onRightScrollButtonDown" tabindex="-1"></paper-icon-button>
`,is:"paper-tabs",behaviors:[c.z,r.E],properties:{noink:{type:Boolean,value:!1,observer:"_noinkChanged"},noBar:{type:Boolean,value:!1},noSlide:{type:Boolean,value:!1},scrollable:{type:Boolean,value:!1},fitContainer:{type:Boolean,value:!1},disableDrag:{type:Boolean,value:!1},hideScrollButtons:{type:Boolean,value:!1},alignBottom:{type:Boolean,value:!1},selectable:{type:String,value:"paper-tab"},autoselect:{type:Boolean,value:!1},autoselectDelay:{type:Number,value:0},_step:{type:Number,value:10},_holdDelay:{type:Number,value:1},_leftHidden:{type:Boolean,value:!1},_rightHidden:{type:Boolean,value:!1},_previousTab:{type:Object}},hostAttributes:{role:"tablist"},listeners:{"iron-resize":"_onTabSizingChanged","iron-items-changed":"_onTabSizingChanged","iron-select":"_onIronSelect","iron-deselect":"_onIronDeselect"},keyBindings:{"left:keyup right:keyup":"_onArrowKeyup"},created:function(){this._holdJob=null,this._pendingActivationItem=void 0,this._pendingActivationTimeout=void 0,this._bindDelayedActivationHandler=this._delayedActivationHandler.bind(this),this.addEventListener("blur",this._onBlurCapture.bind(this),!0)},ready:function(){this.setScrollDirection("y",this.$.tabsContainer)},detached:function(){this._cancelPendingActivation()},_noinkChanged:function(t){(0,h.vz)(this).querySelectorAll("paper-tab").forEach(t?this._setNoinkAttribute:this._removeNoinkAttribute)},_setNoinkAttribute:function(t){t.setAttribute("noink","")},_removeNoinkAttribute:function(t){t.removeAttribute("noink")},_computeScrollButtonClass:function(t,e,n){return!e||n?"hidden":t?"not-visible":""},_computeTabsContentClass:function(t,e){return t?"scrollable"+(e?" fit-container":""):" fit-container"},_computeSelectionBarClass:function(t,e){return t?"hidden":e?"align-bottom":""},_onTabSizingChanged:function(){this.debounce("_onTabSizingChanged",(function(){this._scroll(),this._tabChanged(this.selectedItem)}),10)},_onIronSelect:function(t){this._tabChanged(t.detail.item,this._previousTab),this._previousTab=t.detail.item,this.cancelDebouncer("tab-changed")},_onIronDeselect:function(t){this.debounce("tab-changed",(function(){this._tabChanged(null,this._previousTab),this._previousTab=null}),1)},_activateHandler:function(){this._cancelPendingActivation(),l.D._activateHandler.apply(this,arguments)},_scheduleActivation:function(t,e){this._pendingActivationItem=t,this._pendingActivationTimeout=this.async(this._bindDelayedActivationHandler,e)},_delayedActivationHandler:function(){var t=this._pendingActivationItem;this._pendingActivationItem=void 0,this._pendingActivationTimeout=void 0,t.fire(this.activateEvent,null,{bubbles:!0,cancelable:!0})},_cancelPendingActivation:function(){void 0!==this._pendingActivationTimeout&&(this.cancelAsync(this._pendingActivationTimeout),this._pendingActivationItem=void 0,this._pendingActivationTimeout=void 0)},_onArrowKeyup:function(t){this.autoselect&&this._scheduleActivation(this.focusedItem,this.autoselectDelay)},_onBlurCapture:function(t){t.target===this._pendingActivationItem&&this._cancelPendingActivation()},get _tabContainerScrollSize(){return Math.max(0,this.$.tabsContainer.scrollWidth-this.$.tabsContainer.offsetWidth)},_scroll:function(t,e){if(this.scrollable){var n=e&&-e.ddx||0;this._affectScroll(n)}},_down:function(t){this.async((function(){this._defaultFocusAsync&&(this.cancelAsync(this._defaultFocusAsync),this._defaultFocusAsync=null)}),1)},_affectScroll:function(t){this.$.tabsContainer.scrollLeft+=t;var e=this.$.tabsContainer.scrollLeft;this._leftHidden=0===e,this._rightHidden=e===this._tabContainerScrollSize},_onLeftScrollButtonDown:function(){this._scrollToLeft(),this._holdJob=setInterval(this._scrollToLeft.bind(this),this._holdDelay)},_onRightScrollButtonDown:function(){this._scrollToRight(),this._holdJob=setInterval(this._scrollToRight.bind(this),this._holdDelay)},_onScrollButtonUp:function(){clearInterval(this._holdJob),this._holdJob=null},_scrollToLeft:function(){this._affectScroll(-this._step)},_scrollToRight:function(){this._affectScroll(this._step)},_tabChanged:function(t,e){if(!t)return this.$.selectionBar.classList.remove("expand"),this.$.selectionBar.classList.remove("contract"),void this._positionBar(0,0);var n=this.$.tabsContent.getBoundingClientRect(),i=n.width,o=t.getBoundingClientRect(),a=o.left-n.left;if(this._pos={width:this._calcPercent(o.width,i),left:this._calcPercent(a,i)},this.noSlide||null==e)return this.$.selectionBar.classList.remove("expand"),this.$.selectionBar.classList.remove("contract"),void this._positionBar(this._pos.width,this._pos.left);var s=e.getBoundingClientRect(),l=this.items.indexOf(e),r=this.items.indexOf(t);this.$.selectionBar.classList.add("expand");var c=l<r;this._isRTL&&(c=!c),c?this._positionBar(this._calcPercent(o.left+o.width-s.left,i)-5,this._left):this._positionBar(this._calcPercent(s.left+s.width-o.left,i)-5,this._calcPercent(a,i)+5),this.scrollable&&this._scrollToSelectedIfNeeded(o.width,a)},_scrollToSelectedIfNeeded:function(t,e){var n=e-this.$.tabsContainer.scrollLeft;(n<0||(n+=t-this.$.tabsContainer.offsetWidth)>0)&&(this.$.tabsContainer.scrollLeft+=n)},_calcPercent:function(t,e){return 100*t/e},_positionBar:function(t,e){t=t||0,e=e||0,this._width=t,this._left=e,this.transform("translateX("+e+"%) scaleX("+t/100+")",this.$.selectionBar)},_onBarTransitionEnd:function(t){var e=this.$.selectionBar.classList;e.contains("expand")?(e.remove("expand"),e.add("contract"),this._positionBar(this._pos.width,this._pos.left)):e.contains("contract")&&e.remove("contract")}})}}]);
//# sourceMappingURL=chunk.f4fe95fdc34027aaebca.js.map