iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 15.1 kB
JavaScript
/*! For license information please see 66432.59ce3b9628c2e369.js.LICENSE.txt */
export const __rspack_esm_id=66432;export const __rspack_esm_ids=[66432];export const __webpack_modules__={42814(t,a,e){e.a(t,async function(t,o){try{e.d(a,{A:()=>g});e(74423),e(18111),e(22489),e(20116),e(7588),e(61701),e(13579);var s=e(5124),i=e(22441),r=e(6412),l=e(62e3),n=e(30777),c=e(4444),d=e(9395),h=e(717),b=e(17060),p=e(88496),u=e(9400),v=t([p,b]);[p,b]=v.then?(await v)():v;var f=Object.defineProperty,w=Object.getOwnPropertyDescriptor,m=(t,a,e,o)=>{for(var s,i=o>1?void 0:o?w(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&&f(a,e,i),i};let g=class extends h.A{connectedCallback(){super.connectedCallback(),s.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 this.setActiveTab(this.getActiveTab()??this.tabs[0],{emitEvents:!1});a.unobserve(t[0].target)}}).observe(this.tabGroup)}))}disconnectedCallback(){super.disconnectedCallback(),this.mutationObserver?.disconnect(),this.nav&&this.resizeObserver?.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),e=a?.closest(this.localName);e===this&&null!==a&&this.setActiveTab(a,{scrollBehavior:"smooth"})}handleKeyDown(t){const a=t.target.closest(this.tabTag),e=a?.closest(this.localName);if(e===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(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,c.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={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=>t.active=t.name===this.activeTab?.panel),["top","bottom"].includes(this.placement)&&(0,c.Rt)(this.activeTab,this.nav,"horizontal",a.scrollBehavior),a.emitEvents&&(e&&this.dispatchEvent(new l.M({name:e.panel})),this.dispatchEvent(new n.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 s.qy` <div part="base" class="${(0,r.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}"> <div class="nav-container" part="nav"> ${this.hasScrollControls&&!this.shouldHideScrollStartButton?s.qy` <wa-button part="scroll-button scroll-button-start" exportparts="base:scroll-button__base" class="scroll-button scroll-button-start" appearance="plain" ="${this.handleScrollToStart}"> <wa-icon name="${t?"chevron-right":"chevron-left"}" library="system" variant="solid" label="${this.localize.term("scrollToStart")}"></wa-icon> </wa-button> `:""} <div class="nav" ="${()=>this.activeTab?.focus({preventScroll:!0})}" ="${this.updateScrollButtons}"> <div part="tabs" class="tabs" role="tablist"> <slot name="nav" ="${this.syncTabsAndPanels}"></slot> </div> </div> ${this.hasScrollControls&&!this.shouldHideScrollEndButton?s.qy` <wa-button part="scroll-button scroll-button-end" class="scroll-button scroll-button-end" exportparts="base:scroll-button__base" appearance="plain" ="${this.handleScrollToEnd}"> <wa-icon name="${t?"chevron-left":"chevron-right"}" library="system" variant="solid" label="${this.localize.term("scrollToEnd")}"></wa-icon> </wa-button> `:""} </div> <div part="body" class="body"><slot ="${this.syncTabsAndPanels}"></slot></div> </div> `}constructor(){super(...arguments),this.tabs=[],this.focusableTabs=[],this.panels=[],this.localize=new b.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}};g.css=u.A,m([(0,i.P)(".tab-group")],g.prototype,"tabGroup",2),m([(0,i.P)(".body slot")],g.prototype,"defaultSlot",2),m([(0,i.P)(".nav")],g.prototype,"nav",2),m([(0,i.wk)()],g.prototype,"hasScrollControls",2),m([(0,i.wk)()],g.prototype,"shouldHideScrollStartButton",2),m([(0,i.wk)()],g.prototype,"shouldHideScrollEndButton",2),m([(0,i.MZ)({reflect:!0})],g.prototype,"active",2),m([(0,i.MZ)()],g.prototype,"placement",2),m([(0,i.MZ)()],g.prototype,"activation",2),m([(0,i.MZ)({attribute:"without-scroll-controls",type:Boolean})],g.prototype,"withoutScrollControls",2),m([(0,i.MZ)({attribute:"tab-tag"})],g.prototype,"tabTag",2),m([(0,i.MZ)({attribute:"tab-panel-tag"})],g.prototype,"tabPanelTag",2),m([(0,i.MZ)({attribute:"tab-only",type:Boolean})],g.prototype,"tabOnly",2),m([(0,d.w)("active")],g.prototype,"updateActiveTab",1),m([(0,i.Ls)({passive:!0})],g.prototype,"updateScrollButtons",1),m([(0,d.w)("withoutScrollControls",{waitUntilFirstUpdate:!0})],g.prototype,"updateScrollControls",1),g=m([(0,i.EM)("wa-tab-group")],g),o()}catch(t){o(t)}})},9400(t,a,e){e.d(a,{A:()=>o});var o=e(5124).AH`: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(t,a,e){e.d(a,{A:()=>p});var o=e(5124),s=e(22441),i=e(6412),r=e(9395),l=e(717),n=o.AH`: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} (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} (forced-colors:active){:host([active]:not([disabled])){outline:solid 1px transparent;outline-offset:-3px}}`,c=Object.defineProperty,d=Object.getOwnPropertyDescriptor,h=(t,a,e,o)=>{for(var s,i=o>1?void 0:o?d(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&&c(a,e,i),i};let b=0,p=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(){return this.id=this.id?.length>0?this.id:this.componentId,o.qy` <div part="base" class="${(0,i.H)({tab:!0,"tab-active":this.active})}"> <slot></slot> </div> `}constructor(){super(...arguments),this.attrId=++b,this.componentId=`wa-tab-${this.attrId}`,this.panel="",this.active=!1,this.disabled=!1,this.tabIndex=0}};p.css=n,h([(0,s.P)(".tab")],p.prototype,"tab",2),h([(0,s.MZ)({reflect:!0})],p.prototype,"panel",2),h([(0,s.MZ)({type:Boolean,reflect:!0})],p.prototype,"active",2),h([(0,s.MZ)({type:Boolean,reflect:!0})],p.prototype,"disabled",2),h([(0,s.MZ)({type:Number,reflect:!0})],p.prototype,"tabIndex",2),h([(0,r.w)("active")],p.prototype,"handleActiveChange",1),h([(0,r.w)("disabled")],p.prototype,"handleDisabledChange",1),p=h([(0,s.EM)("wa-tab")],p)},62e3(t,a,e){e.d(a,{M:()=>o});class o extends Event{constructor(t){super("wa-tab-hide",{bubbles:!0,cancelable:!1,composed:!0}),this.detail=t}}},30777(t,a,e){e.d(a,{f:()=>o});class o extends Event{constructor(t){super("wa-tab-show",{bubbles:!0,cancelable:!1,composed:!0}),this.detail=t}}}};