iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 12.9 kB
JavaScript
export const __webpack_ids__=["53564"];export const __webpack_modules__={92636:function(e,t,i){i.d(t,{z:()=>a});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(44249),o=i(57243),n=i(15093),s=i(35359),r=i(36522);i(23334),i(37583);const l={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:()=>""},{kind:"field",decorators:[(0,n.Cb)({attribute:"alert-type"})],key:"alertType",value:()=>"info"},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"dismissable",value:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"narrow",value:()=>!1},{kind:"method",key:"render",value:function(){return o.dy` <div class="issue-type ${(0,s.$)({[this.alertType]:!0})}" role="alert"> <div class="icon ${this.title?"":"no-title"}"> <slot name="icon"> <ha-svg-icon .path="${l[this.alertType]}"></ha-svg-icon> </slot> </div> <div class="${(0,s.$)({content:!0,narrow:this.narrow})}"> <div class="main-content"> ${this.title?o.dy`<div class="title">${this.title}</div>`:o.Ld} <slot></slot> </div> <div class="action"> <slot name="action"> ${this.dismissable?o.dy`<ha-icon-button ="${this._dismissClicked}" label="Dismiss alert" .path="${"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"}"></ha-icon-button>`:o.Ld} </slot> </div> </div> </div> `}},{kind:"method",key:"_dismissClicked",value:function(){(0,r.B)(this,"alert-dismissed-clicked")}},{kind:"field",static:!0,key:"styles",value:()=>o.iv`.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:()=>h,zB:()=>p});var a=i(44249),o=i(72621),n=i(67840),s=i(88854),r=i(57243),l=i(15093);let c;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=()=>{const e=i.call(void 0);return e.container=[...e.container??[],...e.dialog??[]],e.dialog=[],e},t.getCloseAnimation=()=>{const e=a.call(void 0);return e.container=[...e.container??[],...e.dialog??[]],e.dialog=[],e}}));(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),c||(c=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:()=>!1},{kind:"field",key:"_polyfillDialogRegistered",value:()=>!1},{kind:"method",key:"_handleOpen",value:async function(e){if(e.preventDefault(),this._polyfillDialogRegistered)return;this._polyfillDialogRegistered=!0,this._loadPolyfillStylesheet("/static/polyfills/dialog-polyfill.css");const t=this.shadowRoot?.querySelector("dialog");(await c).default.registerDialog(t),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)=>{t.onload=()=>i(),t.onerror=()=>a(new Error(`Stylesheet failed to load: ${e}`)),this.shadowRoot?.appendChild(t)}))}},{kind:"method",key:"_handleCancel",value:function(e){if(this.disableCancelAction){e.preventDefault();const t=this.shadowRoot?.querySelector("dialog .container");void 0!==this.animate&&t?.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),r.iv`: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} 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 d={...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"}]]},u={...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"}]]},h=()=>window.matchMedia("all and (max-width: 450px), all and (max-height: 500px)").matches?d:s.I,p=()=>window.matchMedia("all and (max-width: 450px), all and (max-height: 500px)").matches?u: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:()=>l});var a=i(44249),o=(i(31622),i(57243)),n=i(15093),s=i(27486),r=i(36522);i(51784),i(95198),i(29073),i(23334);let l=(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:()=>!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(){this._dialog?.close()}},{kind:"method",key:"render",value:function(){if(!this._params)return o.Ld;const e=!this._data?.url||""===this._data.url.trim(),t=this._params.resource?.url||this.hass.localize("ui.panel.config.lovelace.resources.detail.new_resource"),i=this._params.resource?.url?this.hass.localize("ui.panel.config.lovelace.resources.detail.edit_resource"):this.hass.localize("ui.panel.config.lovelace.resources.detail.new_resource");return o.dy` <ha-md-dialog open disable-cancel-action ="${this._dialogClosed}" .ariaLabel="${i}"> <ha-dialog-header slot="headline"> <ha-icon-button slot="navigationIcon" .label="${this.hass.localize("ui.common.close")??"Close"}" .path="${"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}"></ha-icon-button> <span slot="title" .title="${t}"> ${t} </span> </ha-dialog-header> <div slot="content"> <ha-alert alert-type="warning" .title="${this.hass.localize("ui.panel.config.lovelace.resources.detail.warning_header")}"> ${this.hass.localize("ui.panel.config.lovelace.resources.detail.warning_text")} </ha-alert> <ha-form .schema="${this._schema(this._data)}" .data="${this._data}" .hass="${this.hass}" .error="${this._error}" .computeLabel="${this._computeLabel}" -changed="${this._valueChanged}"></ha-form> </div> <div slot="actions"> <mwc-button ="${this.closeDialog}"> ${this.hass.localize("ui.common.cancel")} </mwc-button> <mwc-button ="${this._updateResource}" .disabled="${e||!this._data?.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")} </mwc-button> </div> </ha-md-dialog> `}},{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={...this._data,res_type:e}}}},{kind:"method",key:"_updateResource",value:async function(){if(this._data?.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(e){this._error={base:e?.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))}},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(e){d(i,"throw",e)}if(e=s(o(this.next,i)),this.done=!!e.done)return;try{this.inner=l(a(e.value,this.counter++),!1)}catch(e){d(i,"throw",e)}}}));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=53564.171bbc8db5ce3212.js.map