iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
10 lines • 12.6 kB
JavaScript
/*! For license information please see 44727.dda4c36a5e7240f5.js.LICENSE.txt */
export const __webpack_ids__=["44727"];export const __webpack_modules__={27323:function(t,e,i){i.d(e,{O:()=>h});var a=i(9065),o=i(1105),l=i(57243),n=i(15093),s=i(35359),d=i(20552),r=i(91928);const c={fromAttribute:t=>null!==t&&(""===t||t),toAttribute:t=>"boolean"==typeof t?t?"":null:t};class h extends o.P{constructor(){super(...arguments),this.rows=2,this.cols=20,this.charCounter=!1}render(){const t=this.charCounter&&-1!==this.maxLength,e=t&&"internal"===this.charCounter,i=t&&!e,a=!!this.helper||!!this.validationMessage||i,o={"mdc-text-field--disabled":this.disabled,"mdc-text-field--no-label":!this.label,"mdc-text-field--filled":!this.outlined,"mdc-text-field--outlined":this.outlined,"mdc-text-field--end-aligned":this.endAligned,"mdc-text-field--with-internal-counter":e};return l.dy` <label class="mdc-text-field mdc-text-field--textarea ${(0,s.$)(o)}"> ${this.renderRipple()} ${this.outlined?this.renderOutline():this.renderLabel()} ${this.renderInput()} ${this.renderCharCounter(e)} ${this.renderLineRipple()} </label> ${this.renderHelperText(a,i)} `}renderInput(){const t=this.label?"label":void 0,e=-1===this.minLength?void 0:this.minLength,i=-1===this.maxLength?void 0:this.maxLength,a=this.autocapitalize?this.autocapitalize:void 0;return l.dy` <textarea aria-labelledby="${(0,d.o)(t)}" class="mdc-text-field__input" .value="${(0,r.a)(this.value)}" rows="${this.rows}" cols="${this.cols}" ?disabled="${this.disabled}" placeholder="${this.placeholder}" ?required="${this.required}" ?readonly="${this.readOnly}" minlength="${(0,d.o)(e)}" maxlength="${(0,d.o)(i)}" name="${(0,d.o)(""===this.name?void 0:this.name)}" inputmode="${(0,d.o)(this.inputMode)}" autocapitalize="${(0,d.o)(a)}" ="${this.handleInputChange}" ="${this.onInputBlur}">
</textarea>`}}(0,a.__decorate)([(0,n.IO)("textarea")],h.prototype,"formElement",void 0),(0,a.__decorate)([(0,n.Cb)({type:Number})],h.prototype,"rows",void 0),(0,a.__decorate)([(0,n.Cb)({type:Number})],h.prototype,"cols",void 0),(0,a.__decorate)([(0,n.Cb)({converter:c})],h.prototype,"charCounter",void 0)},88540:function(t,e,i){i.d(e,{W:()=>a});const a=i(57243).iv`.mdc-text-field{height:100%}.mdc-text-field__input{resize:none}`},73729:function(t,e,i){i.d(e,{i:()=>h});var a=i(44249),o=i(72621),l=i(74966),n=i(51408),s=i(57243),d=i(15093),r=i(76525);i(23334);const c=["button","ha-list-item"],h=(t,e)=>s.dy` <div class="header_title"> <ha-icon-button .label="${t?.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"}" dialogAction="close" class="header_button"></ha-icon-button> <span>${e}</span> </div> `;(0,a.Z)([(0,d.Mo)("ha-dialog")],(function(t,e){class i extends e{constructor(...e){super(...e),t(this)}}return{F:i,d:[{kind:"field",key:r.gA,value:void 0},{kind:"method",key:"scrollToPos",value:function(t,e){this.contentElement?.scrollTo(t,e)}},{kind:"method",key:"renderHeading",value:function(){return s.dy`<slot name="heading"> ${(0,o.Z)(i,"renderHeading",this,3)([])} </slot>`}},{kind:"method",key:"firstUpdated",value:function(){(0,o.Z)(i,"firstUpdated",this,3)([]),this.suppressDefaultPressSelector=[this.suppressDefaultPressSelector,c].join(", "),this._updateScrolledAttribute(),this.contentElement?.addEventListener("scroll",this._onScroll,{passive:!0})}},{kind:"method",key:"disconnectedCallback",value:function(){(0,o.Z)(i,"disconnectedCallback",this,3)([]),this.contentElement.removeEventListener("scroll",this._onScroll)}},{kind:"field",key:"_onScroll",value(){return()=>{this._updateScrolledAttribute()}}},{kind:"method",key:"_updateScrolledAttribute",value:function(){this.contentElement&&this.toggleAttribute("scrolled",0!==this.contentElement.scrollTop)}},{kind:"field",static:!0,key:"styles",value:()=>[n.W,s.iv`:host([scrolled]) ::slotted(ha-dialog-header){border-bottom:1px solid var(--mdc-dialog-scroll-divider-color,rgba(0,0,0,.12))}.mdc-dialog{--mdc-dialog-scroll-divider-color:var(
--dialog-scroll-divider-color,
var(--divider-color)
);z-index:var(--dialog-z-index,8);-webkit-backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));--mdc-dialog-box-shadow:var(--dialog-box-shadow, none);--mdc-typography-headline6-font-weight:400;--mdc-typography-headline6-font-size:1.574rem}.mdc-dialog__actions{justify-content:var(--justify-action-buttons,flex-end);padding-bottom:max(env(safe-area-inset-bottom),24px)}.mdc-dialog__actions span:first-child{flex:var(--secondary-action-button-flex,unset)}.mdc-dialog__actions span:nth-child(2){flex:var(--primary-action-button-flex,unset)}.mdc-dialog__container{align-items:var(--vertical-align-dialog,center)}.mdc-dialog__title{padding:24px 24px 0 24px}.mdc-dialog__title:has(span){padding:12px 12px 0}.mdc-dialog__actions{padding:12px 24px 12px 24px}.mdc-dialog__title::before{content:unset}.mdc-dialog .mdc-dialog__content{position:var(--dialog-content-position,relative);padding:var(--dialog-content-padding,24px)}:host([hideactions]) .mdc-dialog .mdc-dialog__content{padding-bottom:max(var(--dialog-content-padding,24px),env(safe-area-inset-bottom))}.mdc-dialog .mdc-dialog__surface{position:var(--dialog-surface-position,relative);top:var(--dialog-surface-top);margin-top:var(--dialog-surface-margin-top);min-height:var(--mdc-dialog-min-height,auto);border-radius:var(--ha-dialog-border-radius,28px);-webkit-backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);background:var(--ha-dialog-surface-background,var(--mdc-theme-surface,#fff))}:host([flexContent]) .mdc-dialog .mdc-dialog__content{display:flex;flex-direction:column}.header_title{display:flex;align-items:center;direction:var(--direction)}.header_title span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;padding-left:4px}.header_button{text-decoration:none;color:inherit;inset-inline-start:initial;inset-inline-end:-12px;direction:var(--direction)}.dialog-actions{inset-inline-start:initial!important;inset-inline-end:0px!important;direction:var(--direction)}`]}]}}),l.M)},40917:function(t,e,i){var a=i(44249),o=i(72621),l=i(27323),n=i(33990),s=i(88540),d=i(57243),r=i(15093);(0,a.Z)([(0,r.Mo)("ha-textarea")],(function(t,e){class i extends e{constructor(...e){super(...e),t(this)}}return{F:i,d:[{kind:"field",decorators:[(0,r.Cb)({type:Boolean,reflect:!0})],key:"autogrow",value:()=>!1},{kind:"method",key:"updated",value:function(t){(0,o.Z)(i,"updated",this,3)([t]),this.autogrow&&t.has("value")&&(this.mdcRoot.dataset.value=this.value+'="')}},{kind:"field",static:!0,key:"styles",value:()=>[n.W,s.W,d.iv`:host([autogrow]) .mdc-text-field{position:relative;min-height:74px;min-width:178px;max-height:200px}:host([autogrow]) .mdc-text-field:after{content:attr(data-value);margin-top:23px;margin-bottom:9px;line-height:1.5rem;min-height:42px;padding:0px 32px 0 16px;letter-spacing:var(
--mdc-typography-subtitle1-letter-spacing,
.009375em
);visibility:hidden;white-space:pre-wrap}:host([autogrow]) .mdc-text-field__input{position:absolute;height:calc(100% - 32px)}:host([autogrow]) .mdc-text-field.mdc-text-field--no-label:after{margin-top:16px;margin-bottom:16px}.mdc-floating-label{inset-inline-start:16px!important;inset-inline-end:initial!important;transform-origin:var(--float-start) top} only screen and (min-width:459px){:host([mobile-multiline]) .mdc-text-field__input{white-space:nowrap;max-height:16px}}`]}]}}),l.O)},88529:function(t,e,i){i.r(e),i.d(e,{DialogTryTts:()=>_});var a=i(44249),o=(i(9359),i(56475),i(70104),i(31622),i(87319),i(57243)),l=i(15093),n=i(68958),s=i(36522),d=i(49976),r=i(59847),c=i(47194),h=i(75278),u=i(73729),p=(i(92824),i(40917),i(14473)),g=i(89890),m=i(58968),v=i(76131),f=i(28008);let _=(0,a.Z)([(0,l.Mo)("dialog-cloud-try-tts")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_loadingExample",value:()=>!1},{kind:"field",decorators:[(0,l.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,l.IO)("#message")],key:"_messageInput",value:void 0},{kind:"field",decorators:[(0,n.t)({key:"cloudTtsTryMessage",state:!1,subscribe:!1})],key:"_message",value:void 0},{kind:"field",decorators:[(0,n.t)({key:"cloudTtsTryTarget",state:!1,subscribe:!1})],key:"_target",value:void 0},{kind:"method",key:"showDialog",value:function(t){this._params=t}},{kind:"method",key:"closeDialog",value:function(){this._params=void 0,(0,s.B)(this,"dialog-closed",{dialog:this.localName})}},{kind:"method",key:"render",value:function(){if(!this._params)return o.Ld;const t=this._target||"browser";return o.dy` <ha-dialog open ="${this.closeDialog}" scrimClickAction escapeKeyAction .heading="${(0,u.i)(this.hass,this.hass.localize("ui.panel.config.cloud.account.tts.dialog.header"))}"> <div> <ha-textarea autogrow id="message" .label="${this.hass.localize("ui.panel.config.cloud.account.tts.dialog.message")}" .value="${this._message||this.hass.localize("ui.panel.config.cloud.account.tts.dialog.example_message",{name:this.hass.user.name})}"> </ha-textarea> <ha-select .label="${this.hass.localize("ui.panel.config.cloud.account.tts.dialog.target")}" id="target" .value="${t}" ="${this._handleTargetChanged}" fixedMenuPosition naturalMenuWidth ="${d.U}"> <mwc-list-item value="browser"> ${this.hass.localize("ui.panel.config.cloud.account.tts.dialog.target_browser")} </mwc-list-item> ${Object.values(this.hass.states).filter((t=>"media_player"===(0,r.N)(t)&&(0,h.e)(t,g.yZ.PLAY_MEDIA))).map((t=>o.dy` <mwc-list-item .value="${t.entity_id}"> ${(0,c.C)(t)} </mwc-list-item> `))} </ha-select> </div> <mwc-button slot="primaryAction" .label="${this.hass.localize("ui.panel.config.cloud.account.tts.dialog.play")}" ="${this._playExample}" .disabled="${this._loadingExample}"> <ha-svg-icon slot="icon" .path="${"M12,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,2M10,16.5L16,12L10,7.5V16.5Z"}"></ha-svg-icon> </mwc-button> <mwc-button slot="secondaryAction" .disabled="${"browser"===t}" .label="${this.hass.localize("ui.panel.config.cloud.account.tts.dialog.create_automation")}" ="${this._createAutomation}"> <ha-svg-icon slot="icon" .path="${"M12,2A2,2 0 0,1 14,4C14,4.74 13.6,5.39 13,5.73V7H14A7,7 0 0,1 21,14H22A1,1 0 0,1 23,15V18A1,1 0 0,1 22,19H21V20A2,2 0 0,1 19,22H5A2,2 0 0,1 3,20V19H2A1,1 0 0,1 1,18V15A1,1 0 0,1 2,14H3A7,7 0 0,1 10,7H11V5.73C10.4,5.39 10,4.74 10,4A2,2 0 0,1 12,2M7.5,13A2.5,2.5 0 0,0 5,15.5A2.5,2.5 0 0,0 7.5,18A2.5,2.5 0 0,0 10,15.5A2.5,2.5 0 0,0 7.5,13M16.5,13A2.5,2.5 0 0,0 14,15.5A2.5,2.5 0 0,0 16.5,18A2.5,2.5 0 0,0 19,15.5A2.5,2.5 0 0,0 16.5,13Z"}"></ha-svg-icon> </mwc-button> </ha-dialog> `}},{kind:"method",key:"_handleTargetChanged",value:function(t){this._target=t.target.value,this.requestUpdate("_target")}},{kind:"method",key:"_playExample",value:async function(){const t=this._messageInput?.value;if(t)if(this._message=t,"browser"===this._target){const e=new Audio;e.play(),this._playBrowser(t,e)}else this.hass.callService("tts","cloud_say",{entity_id:this._target,message:t})}},{kind:"method",key:"_createAutomation",value:function(){const t=this._messageInput.value;this._message=t,(0,p.Ip)({action:[{service:"tts.cloud_say",data:{entity_id:this._target,message:t}}]}),this.closeDialog()}},{kind:"method",key:"_playBrowser",value:async function(t,e){this._loadingExample=!0;const i=this._params.defaultVoice[0],a=this._params.defaultVoice[1];let o;try{o=(await(0,m.aT)(this.hass,{platform:"cloud",message:t,language:i,options:{voice:a}})).path}catch(t){return this._loadingExample=!1,void(0,v.showAlertDialog)(this,{text:`Unable to load example. ${t.error||t.body||t}`,warning:!0})}e.src=o,e.addEventListener("canplaythrough",(()=>{e.play()})),e.addEventListener("playing",(()=>{this._loadingExample=!1})),e.addEventListener("error",(()=>{(0,v.showAlertDialog)(this,{title:"Error playing audio."}),this._loadingExample=!1}))}},{kind:"get",static:!0,key:"styles",value:function(){return[f.yu,o.iv`ha-dialog{--mdc-dialog-max-width:500px}ha-select,ha-textarea{width:100%}ha-select{margin-top:8px}`]}}]}}),o.oi)}};
//# sourceMappingURL=44727.dda4c36a5e7240f5.js.map