UNPKG

iobroker.lovelace

Version:

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

2 lines 14.1 kB
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["71093"],{92636:function(e,t,i){i.d(t,{z:()=>a});i(19083),i(61006);const a=e=>(t,i)=>e.includes(t,i)},59847:function(e,t,i){i.d(t,{N:()=>o});var a=i(73850);const o=e=>(0,a.M)(e.entity_id)},75278:function(e,t,i){i.d(t,{e:()=>a});const a=(e,t)=>o(e.attributes,t),o=(e,t)=>!!(e.supported_features&t)},99426:function(e,t,i){i.r(t);var a=i(61701),o=(i(71695),i(47021),i(57243)),n=i(50778),s=i(35359),r=i(36522);i(23334),i(37583);let l,c,d,u,h=e=>e;const p={info:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z",warning:"M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16",error:"M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z",success:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2,4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"};(0,a.Z)([(0,n.Mo)("ha-alert")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)()],key:"title",value(){return""}},{kind:"field",decorators:[(0,n.Cb)({attribute:"alert-type"})],key:"alertType",value(){return"info"}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"dismissable",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"narrow",value(){return!1}},{kind:"method",key:"render",value:function(){return(0,o.dy)(l||(l=h` <div class="issue-type ${0}" role="alert"> <div class="icon ${0}"> <slot name="icon"> <ha-svg-icon .path="${0}"></ha-svg-icon> </slot> </div> <div class="${0}"> <div class="main-content"> ${0} <slot></slot> </div> <div class="action"> <slot name="action"> ${0} </slot> </div> </div> </div> `),(0,s.$)({[this.alertType]:!0}),this.title?"":"no-title",p[this.alertType],(0,s.$)({content:!0,narrow:this.narrow}),this.title?(0,o.dy)(c||(c=h`<div class="title">${0}</div>`),this.title):o.Ld,this.dismissable?(0,o.dy)(d||(d=h`<ha-icon-button @click="${0}" label="Dismiss alert" .path="${0}"></ha-icon-button>`),this._dismissClicked,"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"):o.Ld)}},{kind:"method",key:"_dismissClicked",value:function(){(0,r.B)(this,"alert-dismissed-clicked")}},{kind:"field",static:!0,key:"styles",value(){return(0,o.iv)(u||(u=h`.issue-type{position:relative;padding:8px;display:flex}.issue-type::after{position:absolute;top:0;right:0;bottom:0;left:0;opacity:.12;pointer-events:none;content:"";border-radius:4px}.icon{z-index:1}.icon.no-title{align-self:center}.content{display:flex;justify-content:space-between;align-items:center;width:100%;text-align:var(--float-start)}.content.narrow{flex-direction:column;align-items:flex-end}.action{z-index:1;width:min-content;--mdc-theme-primary:var(--primary-text-color)}.main-content{overflow-wrap:anywhere;word-break:break-word;margin-left:8px;margin-right:0;margin-inline-start:8px;margin-inline-end:0}.title{margin-top:2px;font-weight:700}.action ha-icon-button,.action mwc-button{--mdc-theme-primary:var(--primary-text-color);--mdc-icon-button-size:36px}.issue-type.info>.icon{color:var(--info-color)}.issue-type.info::after{background-color:var(--info-color)}.issue-type.warning>.icon{color:var(--warning-color)}.issue-type.warning::after{background-color:var(--warning-color)}.issue-type.error>.icon{color:var(--error-color)}.issue-type.error::after{background-color:var(--error-color)}.issue-type.success>.icon{color:var(--success-color)}.issue-type.success::after{background-color:var(--success-color)}:host ::slotted(ul){margin:0;padding-inline-start:20px}`))}}]}}),o.oi)},51784:function(e,t,i){i.d(t,{dJ:()=>m,zB:()=>v});var a=i(61701),o=i(72621),n=(i(52247),i(71695),i(19423),i(40251),i(47021),i(67840)),s=i(88854),r=i(57243),l=i(50778);let c,d,u=e=>e;n.A.addInitializer((async e=>{await e.updateComplete;const t=e;t.dialog.prepend(t.scrim),t.scrim.style.inset=0,t.scrim.style.zIndex=0;const{getOpenAnimation:i,getCloseAnimation:a}=t;t.getOpenAnimation=()=>{var e,t;const a=i.call(void 0);return a.container=[...null!==(e=a.container)&&void 0!==e?e:[],...null!==(t=a.dialog)&&void 0!==t?t:[]],a.dialog=[],a},t.getCloseAnimation=()=>{var e,t;const i=a.call(void 0);return i.container=[...null!==(e=i.container)&&void 0!==e?e:[],...null!==(t=i.dialog)&&void 0!==t?t:[]],i.dialog=[],i}}));(0,a.Z)([(0,l.Mo)("ha-md-dialog")],(function(e,t){class a extends t{constructor(){super(),e(this),this.addEventListener("cancel",this._handleCancel),"function"!=typeof HTMLDialogElement&&(this.addEventListener("open",this._handleOpen),d||(d=i.e("73854").then(i.bind(i,85893)))),void 0===this.animate&&(this.quick=!0),void 0===this.animate&&(this.quick=!0)}}return{F:a,d:[{kind:"field",decorators:[(0,l.Cb)({attribute:"disable-cancel-action",type:Boolean})],key:"disableCancelAction",value(){return!1}},{kind:"field",key:"_polyfillDialogRegistered",value(){return!1}},{kind:"method",key:"_handleOpen",value:async function(e){var t;if(e.preventDefault(),this._polyfillDialogRegistered)return;this._polyfillDialogRegistered=!0,this._loadPolyfillStylesheet("/static/polyfills/dialog-polyfill.css");const i=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("dialog");(await d).default.registerDialog(i),this.removeEventListener("open",this._handleOpen),this.show()}},{kind:"method",key:"_loadPolyfillStylesheet",value:async function(e){const t=document.createElement("link");return t.rel="stylesheet",t.href=e,new Promise(((i,a)=>{var o;t.onload=()=>i(),t.onerror=()=>a(new Error(`Stylesheet failed to load: ${e}`)),null===(o=this.shadowRoot)||void 0===o||o.appendChild(t)}))}},{kind:"method",key:"_handleCancel",value:function(e){if(this.disableCancelAction){var t;e.preventDefault();const i=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("dialog .container");void 0!==this.animate&&(null==i||i.animate([{transform:"rotate(-1deg)","animation-timing-function":"ease-in"},{transform:"rotate(1.5deg)","animation-timing-function":"ease-out"},{transform:"rotate(0deg)","animation-timing-function":"ease-in"}],{duration:200,iterations:2}))}}},{kind:"field",static:!0,key:"styles",value(){return[...(0,o.Z)(a,"styles",this),(0,r.iv)(c||(c=u`:host{--md-dialog-container-color:var(--card-background-color);--md-dialog-headline-color:var(--primary-text-color);--md-dialog-supporting-text-color:var(--primary-text-color);--md-sys-color-scrim:#000000;--md-dialog-headline-weight:400;--md-dialog-headline-size:1.574rem;--md-dialog-supporting-text-size:1rem;--md-dialog-supporting-text-line-height:1.5rem}:host([type=alert]){min-width:320px}@media all and (max-width:450px),all and (max-height:500px){:host(:not([type=alert])){min-width:calc(100vw - env(safe-area-inset-right) - env(safe-area-inset-left));max-width:calc(100vw - env(safe-area-inset-right) - env(safe-area-inset-left));min-height:100%;max-height:100%;--md-dialog-container-shape:0}}::slotted(ha-dialog-header[slot=headline]){display:contents}.scroller{overflow:var(--dialog-content-overflow,auto)}slot[name=content]::slotted(*){padding:var(--dialog-content-padding,24px)}.scrim{z-index:10}`))]}}]}}),n.A);const h=Object.assign(Object.assign({},s.I),{},{dialog:[[[{transform:"translateY(50px)"},{transform:"translateY(0)"}],{duration:500,easing:"cubic-bezier(.3,0,0,1)"}]],container:[[[{opacity:0},{opacity:1}],{duration:50,easing:"linear",pseudoElement:"::before"}]]}),p=Object.assign(Object.assign({},s.G),{},{dialog:[[[{transform:"translateY(0)"},{transform:"translateY(50px)"}],{duration:150,easing:"cubic-bezier(.3,0,0,1)"}]],container:[[[{opacity:"1"},{opacity:"0"}],{delay:100,duration:50,easing:"linear",pseudoElement:"::before"}]]}),m=()=>window.matchMedia("all and (max-width: 450px), all and (max-height: 500px)").matches?h:s.I,v=()=>window.matchMedia("all and (max-width: 450px), all and (max-height: 500px)").matches?p:s.G},96530:function(e,t,i){i.d(t,{X:()=>n,y:()=>o});var a=i(92636);const o=["input_boolean","input_button","input_text","input_number","input_datetime","input_select","counter","timer","schedule"],n=(0,a.z)(o)},19925:function(e,t,i){i.r(t),i.d(t,{DialogLovelaceResourceDetail:()=>d});var a=i(61701),o=(i(71695),i(19423),i(40251),i(81804),i(47021),i(31622),i(57243)),n=i(50778),s=i(27486),r=i(36522);i(51784),i(95198),i(29073),i(23334);let l,c=e=>e;let d=(0,a.Z)([(0,n.Mo)("dialog-lovelace-resource-detail")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_data",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_submitting",value(){return!1}},{kind:"field",decorators:[(0,n.IO)("ha-md-dialog")],key:"_dialog",value:void 0},{kind:"method",key:"showDialog",value:function(e){this._params=e,this._error=void 0,this._params.resource?this._data={url:this._params.resource.url,res_type:this._params.resource.type}:this._data={url:""}}},{kind:"method",key:"_dialogClosed",value:function(){this._params=void 0,(0,r.B)(this,"dialog-closed",{dialog:this.localName})}},{kind:"method",key:"closeDialog",value:function(){var e;null===(e=this._dialog)||void 0===e||e.close()}},{kind:"method",key:"render",value:function(){var e,t,i,a,n;if(!this._params)return o.Ld;const s=!(null!==(e=this._data)&&void 0!==e&&e.url)||""===this._data.url.trim(),r=(null===(t=this._params.resource)||void 0===t?void 0:t.url)||this.hass.localize("ui.panel.config.lovelace.resources.detail.new_resource"),d=null!==(i=this._params.resource)&&void 0!==i&&i.url?this.hass.localize("ui.panel.config.lovelace.resources.detail.edit_resource"):this.hass.localize("ui.panel.config.lovelace.resources.detail.new_resource");return(0,o.dy)(l||(l=c` <ha-md-dialog open disable-cancel-action @closed="${0}" .ariaLabel="${0}"> <ha-dialog-header slot="headline"> <ha-icon-button slot="navigationIcon" .label="${0}" .path="${0}" @click="${0}"></ha-icon-button> <span slot="title" .title="${0}"> ${0} </span> </ha-dialog-header> <div slot="content"> <ha-alert alert-type="warning" .title="${0}"> ${0} </ha-alert> <ha-form .schema="${0}" .data="${0}" .hass="${0}" .error="${0}" .computeLabel="${0}" @value-changed="${0}"></ha-form> </div> <div slot="actions"> <mwc-button @click="${0}"> ${0} </mwc-button> <mwc-button @click="${0}" .disabled="${0}"> ${0} </mwc-button> </div> </ha-md-dialog> `),this._dialogClosed,d,null!==(a=this.hass.localize("ui.common.close"))&&void 0!==a?a:"Close","M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",this.closeDialog,r,r,this.hass.localize("ui.panel.config.lovelace.resources.detail.warning_header"),this.hass.localize("ui.panel.config.lovelace.resources.detail.warning_text"),this._schema(this._data),this._data,this.hass,this._error,this._computeLabel,this._valueChanged,this.closeDialog,this.hass.localize("ui.common.cancel"),this._updateResource,s||!(null!==(n=this._data)&&void 0!==n&&n.res_type)||this._submitting,this._params.resource?this.hass.localize("ui.panel.config.lovelace.resources.detail.update"):this.hass.localize("ui.panel.config.lovelace.resources.detail.create"))}},{kind:"field",key:"_schema",value(){return(0,s.Z)((e=>[{name:"url",required:!0,selector:{text:{}}},{name:"res_type",required:!0,selector:{select:{options:[{value:"module",label:this.hass.localize("ui.panel.config.lovelace.resources.types.module")},{value:"css",label:this.hass.localize("ui.panel.config.lovelace.resources.types.css")},..."js"===e.type?[{value:"js",label:this.hass.localize("ui.panel.config.lovelace.resources.types.js")}]:[],..."html"===e.type?[{value:"html",label:this.hass.localize("ui.panel.config.lovelace.resources.types.html")}]:[]]}}}]))}},{kind:"field",key:"_computeLabel",value(){return e=>this.hass.localize(`ui.panel.config.lovelace.resources.detail.${"res_type"===e.name?"type":e.name}`)}},{kind:"method",key:"_valueChanged",value:function(e){if(this._data=e.detail.value,!this._data.res_type){const e=(e=>{if(!e)return;const t=e.split(".").pop()||"";return"css"===t?"css":"js"===t?"module":void 0})(this._data.url);if(!e)return;this._data=Object.assign(Object.assign({},this._data),{},{res_type:e})}}},{kind:"method",key:"_updateResource",value:async function(){var e;if(null!==(e=this._data)&&void 0!==e&&e.res_type){this._submitting=!0;try{this._params.resource?await this._params.updateResource(this._data):await this._params.createResource(this._data),this._params=void 0}catch(t){this._error={base:(null==t?void 0:t.message)||"Unknown error"}}finally{this._submitting=!1}}}}]}}),o.oi)},30338:function(e,t,i){var a=i(97934),o=i(71998),n=i(4576),s=i(36760);e.exports=function(e,t){t&&"string"==typeof e||o(e);var i=s(e);return n(o(void 0!==i?a(i,e):e))}},60933:function(e,t,i){var a=i(40810),o=i(57877),n=i(63983),s=i(12360),r=i(13053),l=i(47645);a({target:"Array",proto:!0},{flatMap:function(e){var t,i=s(this),a=r(i);return n(e),(t=l(i,0)).length=o(t,i,i,a,0,1,e,arguments.length>1?arguments[1]:void 0),t}})},32126:function(e,t,i){i(35709)("flatMap")},25677:function(e,t,i){var a=i(40810),o=i(97934),n=i(63983),s=i(71998),r=i(4576),l=i(30338),c=i(79995),d=i(14181),u=i(92288),h=c((function(){for(var e,t,i=this.iterator,a=this.mapper;;){if(t=this.inner)try{if(!(e=s(o(t.next,t.iterator))).done)return e.value;this.inner=null}catch(n){d(i,"throw",n)}if(e=s(o(this.next,i)),this.done=!!e.done)return;try{this.inner=l(a(e.value,this.counter++),!1)}catch(n){d(i,"throw",n)}}}));a({target:"Iterator",proto:!0,real:!0,forced:u},{flatMap:function(e){return s(this),n(e),new h(r(this),{mapper:e,inner:null})}})}}]); //# sourceMappingURL=71093.53c4162c6af6e741.js.map