UNPKG

iobroker.lovelace

Version:

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

2 lines 15.7 kB
/*! For license information please see 66432.35eadd51e986900f.js.LICENSE.txt */ "use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[66432],{42814:function(t,a,e){e.a(t,async function(t,o){try{e.d(a,{A:function(){return S}});e(74423),e(18111),e(22489),e(20116),e(7588),e(61701),e(13579),e(62953);var s=e(69235),i=e(5124),r=e(67576),l=e(6412),n=e(62e3),c=e(30777),d=e(4444),h=e(9395),b=e(717),u=e(17060),p=e(88496),v=e(9400),f=t([s,p,u]);[s,p,u]=f.then?(await f)():f;let y,k,T,A=t=>t;var w=Object.defineProperty,g=Object.getOwnPropertyDescriptor,m=(t,a,e,o)=>{for(var s,i=o>1?void 0:o?g(a,e):a,r=t.length-1;r>=0;r--)(s=t[r])&&(i=(o?s(a,e,i):s(i))||i);return o&&i&&w(a,e,i),i};let S=class extends b.A{connectedCallback(){super.connectedCallback(),i.S$||(this.resizeObserver=new ResizeObserver(()=>{this.updateScrollControls()}),this.mutationObserver=new MutationObserver(t=>{t.some(t=>!["aria-labelledby","aria-controls"].includes(t.attributeName))&&setTimeout(()=>this.setAriaLabels());const a=t.filter(t=>t.target.closest(this.localName)===this);if(a.some(t=>"disabled"===t.attributeName))this.syncTabsAndPanels();else if(a.some(t=>"active"===t.attributeName)){const t=a.filter(t=>"active"===t.attributeName&&t.target.tagName.toLowerCase()===this.tabTag).map(t=>t.target).find(t=>t.active);t&&t.closest(this.localName)===this&&this.setActiveTab(t)}}),this.updateComplete.then(()=>{this.syncTabsAndPanels(),this.mutationObserver.observe(this,{attributes:!0,childList:!0,subtree:!0}),this.resizeObserver.observe(this.nav);new IntersectionObserver((t,a)=>{if(t[0].intersectionRatio>0){if(this.setAriaLabels(),this.active){const t=this.tabs.find(t=>t.panel===this.active);t&&this.setActiveTab(t)}else{var e;this.setActiveTab(null!==(e=this.getActiveTab())&&void 0!==e?e:this.tabs[0],{emitEvents:!1})}a.unobserve(t[0].target)}}).observe(this.tabGroup)}))}disconnectedCallback(){var t,a;(super.disconnectedCallback(),null===(t=this.mutationObserver)||void 0===t||t.disconnect(),this.nav)&&(null===(a=this.resizeObserver)||void 0===a||a.unobserve(this.nav))}getAllTabs(){return[...this.shadowRoot.querySelector('slot[name="nav"]').assignedElements()].filter(t=>t.tagName.toLowerCase()===this.tabTag)}getAllPanels(){return[...this.defaultSlot.assignedElements()].filter(t=>t.tagName.toLowerCase()===this.tabPanelTag)}getActiveTab(){return this.tabs.find(t=>t.active)}handleClick(t){const a=t.target.closest(this.tabTag);(null==a?void 0:a.closest(this.localName))===this&&null!==a&&this.setActiveTab(a,{scrollBehavior:"smooth"})}handleKeyDown(t){const a=t.target.closest(this.tabTag);if((null==a?void 0:a.closest(this.localName))===this)if(["Enter"," "].includes(t.key))null!==a&&(this.setActiveTab(a,{scrollBehavior:"smooth"}),t.preventDefault());else if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(t.key)){const a=this.tabs.find(t=>t.matches(":focus")),e="rtl"===this.localize.dir();let o=null;if((null==a?void 0:a.tagName.toLowerCase())===this.tabTag){if("Home"===t.key)o=this.focusableTabs[0];else if("End"===t.key)o=this.focusableTabs[this.focusableTabs.length-1];else if(["top","bottom"].includes(this.placement)&&t.key===(e?"ArrowRight":"ArrowLeft")||["start","end"].includes(this.placement)&&"ArrowUp"===t.key){const t=this.tabs.findIndex(t=>t===a);o=this.findNextFocusableTab(t,"backward")}else if(["top","bottom"].includes(this.placement)&&t.key===(e?"ArrowLeft":"ArrowRight")||["start","end"].includes(this.placement)&&"ArrowDown"===t.key){const t=this.tabs.findIndex(t=>t===a);o=this.findNextFocusableTab(t,"forward")}if(!o)return;o.tabIndex=0,o.focus({preventScroll:!0}),"auto"===this.activation?this.setActiveTab(o,{scrollBehavior:"smooth"}):this.tabs.forEach(t=>{t.tabIndex=t===o?0:-1}),["top","bottom"].includes(this.placement)&&(0,d.Rt)(o,this.nav,"horizontal"),t.preventDefault()}}}findNextFocusableTab(t,a){let e=null;const o="forward"===a?1:-1;let s=t+o;for(;t<this.tabs.length;){if(e=this.tabs[s]||null,null===e){e="forward"===a?this.focusableTabs[0]:this.focusableTabs[this.focusableTabs.length-1];break}if(!e.disabled)break;s+=o}return e}handleScrollToStart(){this.nav.scroll({left:"rtl"===this.localize.dir()?this.nav.scrollLeft+this.nav.clientWidth:this.nav.scrollLeft-this.nav.clientWidth,behavior:"smooth"})}handleScrollToEnd(){this.nav.scroll({left:"rtl"===this.localize.dir()?this.nav.scrollLeft-this.nav.clientWidth:this.nav.scrollLeft+this.nav.clientWidth,behavior:"smooth"})}setActiveTab(t,a){if(a=Object.assign({emitEvents:!0,scrollBehavior:"auto"},a),t.closest(this.localName)===this&&t!==this.activeTab&&!t.disabled){const e=this.activeTab;this.active=t.panel,this.activeTab=t,this.tabs.forEach(t=>{t.active=t===this.activeTab,t.tabIndex=t===this.activeTab?0:-1}),this.panels.forEach(t=>{var a;return t.active=t.name===(null===(a=this.activeTab)||void 0===a?void 0:a.panel)}),["top","bottom"].includes(this.placement)&&(0,d.Rt)(this.activeTab,this.nav,"horizontal",a.scrollBehavior),a.emitEvents&&(e&&this.dispatchEvent(new n.M({name:e.panel})),this.dispatchEvent(new c.f({name:this.activeTab.panel})))}}setAriaLabels(){this.tabOnly||this.tabs.forEach(t=>{const a=this.panels.find(a=>a.name===t.panel);a&&(t.setAttribute("aria-controls",a.getAttribute("id")),a.setAttribute("aria-labelledby",t.getAttribute("id")))})}syncTabsAndPanels(){this.tabs=this.getAllTabs(),this.focusableTabs=this.tabs.filter(t=>!t.disabled),this.panels=this.getAllPanels(),this.updateComplete.then(()=>this.updateScrollControls())}updateActiveTab(){const t=this.tabs.find(t=>t.panel===this.active);t&&this.setActiveTab(t,{scrollBehavior:"smooth"})}updateScrollButtons(){this.hasScrollControls&&(this.shouldHideScrollStartButton=this.scrollFromStart()<=this.scrollOffset,this.shouldHideScrollEndButton=this.isScrolledToEnd())}isScrolledToEnd(){return this.scrollFromStart()+this.nav.clientWidth>=this.nav.scrollWidth-this.scrollOffset}scrollFromStart(){return"rtl"===this.localize.dir()?-this.nav.scrollLeft:this.nav.scrollLeft}updateScrollControls(){this.withoutScrollControls?this.hasScrollControls=!1:this.hasScrollControls=["top","bottom"].includes(this.placement)&&this.nav.scrollWidth>this.nav.clientWidth+1,this.updateScrollButtons()}render(){const t=this.hasUpdated?"rtl"===this.localize.dir():"rtl"===this.dir;return(0,i.qy)(y||(y=A` <div part="base" class="${0}" @click="${0}" @keydown="${0}"> <div class="nav-container" part="nav"> ${0} <div class="nav" @focus="${0}" @scroll="${0}"> <div part="tabs" class="tabs" role="tablist"> <slot name="nav" @slotchange="${0}"></slot> </div> </div> ${0} </div> <div part="body" class="body"><slot @slotchange="${0}"></slot></div> </div> `),(0,l.H)({"tab-group":!0,"tab-group-top":"top"===this.placement,"tab-group-bottom":"bottom"===this.placement,"tab-group-start":"start"===this.placement,"tab-group-end":"end"===this.placement,"tab-group-has-scroll-controls":this.hasScrollControls}),this.handleClick,this.handleKeyDown,this.hasScrollControls&&!this.shouldHideScrollStartButton?(0,i.qy)(k||(k=A` <wa-button part="scroll-button scroll-button-start" exportparts="base:scroll-button__base" class="scroll-button scroll-button-start" appearance="plain" @click="${0}"> <wa-icon name="${0}" library="system" variant="solid" label="${0}"></wa-icon> </wa-button> `),this.handleScrollToStart,t?"chevron-right":"chevron-left",this.localize.term("scrollToStart")):"",()=>{var t;return null===(t=this.activeTab)||void 0===t?void 0:t.focus({preventScroll:!0})},this.updateScrollButtons,this.syncTabsAndPanels,this.hasScrollControls&&!this.shouldHideScrollEndButton?(0,i.qy)(T||(T=A` <wa-button part="scroll-button scroll-button-end" class="scroll-button scroll-button-end" exportparts="base:scroll-button__base" appearance="plain" @click="${0}"> <wa-icon name="${0}" library="system" variant="solid" label="${0}"></wa-icon> </wa-button> `),this.handleScrollToEnd,t?"chevron-left":"chevron-right",this.localize.term("scrollToEnd")):"",this.syncTabsAndPanels)}constructor(){super(...arguments),this.tabs=[],this.focusableTabs=[],this.panels=[],this.localize=new u.c(this),this.hasScrollControls=!1,this.shouldHideScrollStartButton=!1,this.shouldHideScrollEndButton=!1,this.active="",this.placement="top",this.activation="auto",this.withoutScrollControls=!1,this.tabTag="wa-tab",this.tabPanelTag="wa-tab-panel",this.tabOnly=!1,this.scrollOffset=1}};S.css=v.A,m([(0,r.P)(".tab-group")],S.prototype,"tabGroup",2),m([(0,r.P)(".body slot")],S.prototype,"defaultSlot",2),m([(0,r.P)(".nav")],S.prototype,"nav",2),m([(0,r.wk)()],S.prototype,"hasScrollControls",2),m([(0,r.wk)()],S.prototype,"shouldHideScrollStartButton",2),m([(0,r.wk)()],S.prototype,"shouldHideScrollEndButton",2),m([(0,r.MZ)({reflect:!0})],S.prototype,"active",2),m([(0,r.MZ)()],S.prototype,"placement",2),m([(0,r.MZ)()],S.prototype,"activation",2),m([(0,r.MZ)({attribute:"without-scroll-controls",type:Boolean})],S.prototype,"withoutScrollControls",2),m([(0,r.MZ)({attribute:"tab-tag"})],S.prototype,"tabTag",2),m([(0,r.MZ)({attribute:"tab-panel-tag"})],S.prototype,"tabPanelTag",2),m([(0,r.MZ)({attribute:"tab-only",type:Boolean})],S.prototype,"tabOnly",2),m([(0,h.w)("active")],S.prototype,"updateActiveTab",1),m([(0,r.Ls)({passive:!0})],S.prototype,"updateScrollButtons",1),m([(0,h.w)("withoutScrollControls",{waitUntilFirstUpdate:!0})],S.prototype,"updateScrollControls",1),S=m([(0,r.EM)("wa-tab-group")],S),o()}catch(y){o(y)}})},9400:function(t,a,e){e.d(a,{A:function(){return s}});let o;var s=(0,e(5124).AH)(o||(o=(t=>t)`:host{--indicator-color:var(--wa-color-brand-fill-loud);--track-color:var(--wa-color-neutral-fill-normal);--track-width:0.125rem;--safe-track-width:max(0.5px, round(var(--track-width), 0.5px));display:block}.tab-group{display:flex;border-radius:0}.tabs{display:flex;position:relative}.indicator{position:absolute}.tab-group-has-scroll-controls .nav-container{position:relative;padding:0 1.5em}.body{display:block}.scroll-button{display:flex;align-items:center;justify-content:center;position:absolute;top:0;bottom:0;width:1.5em}.scroll-button-start{inset-inline-start:0}.scroll-button-end{inset-inline-end:0}.tab-group-top{flex-direction:column}.tab-group-top .nav-container{order:1}.tab-group-top .nav{display:flex;overflow-x:auto;scrollbar-width:none}.tab-group-top .nav::-webkit-scrollbar{width:0;height:0}.tab-group-top .tabs{flex:1 1 auto;position:relative;flex-direction:row;border-bottom:solid var(--safe-track-width) var(--track-color)}.tab-group-top .indicator{bottom:calc(-1 * var(--safe-track-width));border-bottom:solid var(--safe-track-width) var(--indicator-color)}.tab-group-top .body{order:2}.tab-group-top ::slotted(wa-tab[active]){border-block-end:solid var(--safe-track-width) var(--indicator-color);margin-block-end:calc(-1 * var(--safe-track-width))}.tab-group-top .body slot::slotted(wa-tab-panel){--padding:var(--wa-space-xl) 0}.tab-group-bottom{flex-direction:column}.tab-group-bottom .nav-container{order:2}.tab-group-bottom .nav{display:flex;overflow-x:auto;scrollbar-width:none}.tab-group-bottom .nav::-webkit-scrollbar{width:0;height:0}.tab-group-bottom .tabs{flex:1 1 auto;position:relative;flex-direction:row;border-top:solid var(--safe-track-width) var(--track-color)}.tab-group-bottom .indicator{top:calc(-1 * var(--safe-track-width));border-top:solid var(--safe-track-width) var(--indicator-color)}.tab-group-bottom .body{order:1}.tab-group-bottom ::slotted(wa-tab[active]){border-block-start:solid var(--safe-track-width) var(--indicator-color);margin-block-start:calc(-1 * var(--safe-track-width))}.tab-group-bottom .body slot::slotted(wa-tab-panel){--padding:var(--wa-space-xl) 0}.tab-group-start{flex-direction:row}.tab-group-start .nav-container{order:1}.tab-group-start .tabs{flex:0 0 auto;flex-direction:column;border-inline-end:solid var(--safe-track-width) var(--track-color)}.tab-group-start .indicator{inset-inline-end:calc(-1 * var(--safe-track-width));border-right:solid var(--safe-track-width) var(--indicator-color)}.tab-group-start .body{flex:1 1 auto;order:2}.tab-group-start ::slotted(wa-tab[active]){border-inline-end:solid var(--safe-track-width) var(--indicator-color);margin-inline-end:calc(-1 * var(--safe-track-width))}.tab-group-start .body slot::slotted(wa-tab-panel){--padding:0 var(--wa-space-xl)}.tab-group-end{flex-direction:row}.tab-group-end .nav-container{order:2}.tab-group-end .tabs{flex:0 0 auto;flex-direction:column;border-left:solid var(--safe-track-width) var(--track-color)}.tab-group-end .indicator{inset-inline-start:calc(-1 * var(--safe-track-width));border-inline-start:solid var(--safe-track-width) var(--indicator-color)}.tab-group-end .body{flex:1 1 auto;order:1}.tab-group-end ::slotted(wa-tab[active]){border-inline-start:solid var(--safe-track-width) var(--indicator-color);margin-inline-start:calc(-1 * var(--safe-track-width))}.tab-group-end .body slot::slotted(wa-tab-panel){--padding:0 var(--wa-space-xl)}`))},9866:function(t,a,e){e.d(a,{A:function(){return f}});e(62953);var o=e(5124),s=e(67576),i=e(6412),r=e(9395),l=e(717);let n;var c=(0,o.AH)(n||(n=(t=>t)`:host{display:inline-block;color:var(--wa-color-neutral-on-quiet);font-weight:var(--wa-font-weight-action)}.tab{display:inline-flex;align-items:center;font:inherit;padding:1em 1.5em;white-space:nowrap;user-select:none;-webkit-user-select:none;cursor:pointer;transition:color var(--wa-transition-fast) var(--wa-transition-easing)}.tab ::slotted(wa-icon:first-child){margin-inline-end:.5em}.tab ::slotted(wa-icon:last-child){margin-inline-start:.5em}@media (hover:hover){:host(:hover:not([disabled])) .tab{color:currentColor}}:host(:focus){outline:transparent}:host(:focus-visible) .tab{outline:var(--wa-focus-ring);outline-offset:calc(-1 * var(--wa-border-width-l) - var(--wa-focus-ring-offset))}:host([active]:not([disabled])){color:var(--wa-color-brand-on-quiet)}:host([disabled]) .tab{opacity:.5;cursor:not-allowed}@media (forced-colors:active){:host([active]:not([disabled])){outline:solid 1px transparent;outline-offset:-3px}}`));let d,h=t=>t;var b=Object.defineProperty,u=Object.getOwnPropertyDescriptor,p=(t,a,e,o)=>{for(var s,i=o>1?void 0:o?u(a,e):a,r=t.length-1;r>=0;r--)(s=t[r])&&(i=(o?s(a,e,i):s(i))||i);return o&&i&&b(a,e,i),i};let v=0,f=class extends l.A{connectedCallback(){this.slot||(this.slot="nav"),super.connectedCallback(),this.setAttribute("role","tab")}handleActiveChange(){this.setAttribute("aria-selected",this.active?"true":"false")}handleDisabledChange(){this.setAttribute("aria-disabled",this.disabled?"true":"false"),this.disabled&&!this.active?this.tabIndex=-1:this.tabIndex=0}render(){var t;return this.id=(null===(t=this.id)||void 0===t?void 0:t.length)>0?this.id:this.componentId,(0,o.qy)(d||(d=h` <div part="base" class="${0}"> <slot></slot> </div> `),(0,i.H)({tab:!0,"tab-active":this.active}))}constructor(){super(...arguments),this.attrId=++v,this.componentId=`wa-tab-${this.attrId}`,this.panel="",this.active=!1,this.disabled=!1,this.tabIndex=0}};f.css=c,p([(0,s.P)(".tab")],f.prototype,"tab",2),p([(0,s.MZ)({reflect:!0})],f.prototype,"panel",2),p([(0,s.MZ)({type:Boolean,reflect:!0})],f.prototype,"active",2),p([(0,s.MZ)({type:Boolean,reflect:!0})],f.prototype,"disabled",2),p([(0,s.MZ)({type:Number,reflect:!0})],f.prototype,"tabIndex",2),p([(0,r.w)("active")],f.prototype,"handleActiveChange",1),p([(0,r.w)("disabled")],f.prototype,"handleDisabledChange",1),f=p([(0,s.EM)("wa-tab")],f)},62e3:function(t,a,e){e.d(a,{M:function(){return o}});class o extends Event{constructor(t){super("wa-tab-hide",{bubbles:!0,cancelable:!1,composed:!0}),this.detail=t}}},30777:function(t,a,e){e.d(a,{f:function(){return o}});class o extends Event{constructor(t){super("wa-tab-show",{bubbles:!0,cancelable:!1,composed:!0}),this.detail=t}}}}]);