UNPKG

iobroker.lovelace

Version:

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

1 lines 5.92 kB
export const __rspack_esm_id=73044;export const __rspack_esm_ids=[73044];export const __webpack_modules__={21220(t,i,s){s.a(t,async function(t,n){try{s.d(i,{t:()=>r,v:()=>h});var o=s(71727),e=s(68246),c=s(85694),a=t([c]);const h={label:"",iconPath:(c=(a.then?(await a)():a)[0]).Gn},r=(t,i,s)=>{const n=(0,o.m)(s),c=(0,e.Y)(s),a=i[n]?.[c];return t(`component.${n}.services.${c}.name`,a?.description_placeholders)||a?.name||s};n()}catch(t){n(t)}})},96779(t,i,s){s.d(i,{q:()=>o});var n=s(45435);class o{get info(){return this._info}update(t,i){this._hass=t,i!==this._subscribedPath&&(this._unsub?.(),this._unsub=void 0,this._subscribedPath=i,i?this._unsub=(0,n.sy)(t,i,t=>{this._info=t,this._host.requestUpdate()}):this._info=n.Mw)}hostConnected(){if(this._hass&&this._subscribedPath&&!this._unsub){const t=this._subscribedPath;this._subscribedPath=void 0,this.update(this._hass,t)}}hostDisconnected(){this._unsub?.(),this._unsub=void 0}constructor(t){this._info=n.Mw,this._host=t,t.addController(this)}}},56505(t,i,s){s.a(t,async function(t,n){try{s.d(i,{G:()=>_});var o=s(35211),e=s(71727),c=s(21220),a=s(22792),h=s(85694),r=t([h,c]);[h,c]=r.then?(await r)():r;class _{_consume(t,i){new o.G(this._host,{context:t,subscribe:!0,callback:t=>{i(t),this._resolve()}})}get info(){return this._info}hostConnected(){this._resolve()}updateService(t){t!==this._service&&(this._service=t,this._resolve())}_resolve(){if(!(this._connection&&this._config&&this._services&&this._i18n))return;const t=this._service,i=this._i18n.language,s=t!==this._resolvedService,n=i!==this._resolvedLanguage;if(!s&&!n)return;if(this._resolvedService=t,this._resolvedLanguage=i,!t)return this._info=c.v,void this._host.requestUpdate();const o=(0,e.m)(t);this._info={label:(0,c.t)(this._i18n.localize,this._services,t),iconPath:s?h.l[o]||h.Gn:this._info.iconPath,icon:s?void 0:this._info.icon},this._host.requestUpdate(),this._i18n.loadBackendTranslation("services",o).then(s=>{this._resolvedService===t&&this._resolvedLanguage===i&&this._services&&(this._info={...this._info,label:(0,c.t)(s,this._services,t)},this._host.requestUpdate())}),s&&(0,h.f$)(this._connection,this._config,t).then(i=>{this._resolvedService===t&&(this._info={...this._info,icon:i},this._host.requestUpdate())})}constructor(t){this._info=c.v,this._host=t,t.addController(this),this._consume(a.Wq,t=>{this._connection=t.connection}),this._consume(a.WF,t=>{this._config=t.config}),this._consume(a.yk,t=>{this._services=t}),this._consume(a.D5,t=>{this._i18n=t})}}n()}catch(t){n(t)}})},53034(t,i,s){s.d(i,{J:()=>o});const n={label:"",iconPath:"M3.9,12C3.9,10.29 5.29,8.9 7,8.9H11V7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H11V15.1H7C5.29,15.1 3.9,13.71 3.9,12M8,13H16V11H8V13M17,7H13V8.9H17C18.71,8.9 20.1,10.29 20.1,12C20.1,13.71 18.71,15.1 17,15.1H13V17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7Z"},o=(t,i,s,o)=>{switch(i?.action){case"navigate":return s;case"assist":return{label:t.localize("ui.panel.lovelace.editor.action-editor.actions.assist"),iconPath:"M12,2A3,3 0 0,1 15,5V11A3,3 0 0,1 12,14A3,3 0 0,1 9,11V5A3,3 0 0,1 12,2M19,11C19,14.53 16.39,17.44 13,17.93V21H11V17.93C7.61,17.44 5,14.53 5,11H7A5,5 0 0,0 12,16A5,5 0 0,0 17,11H19Z"};case"call-service":case"perform-action":return o;case"url":return{label:i.url_path||"",iconPath:"M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z"};default:return n}}},30175(t,i,s){s.a(t,async function(t,n){try{s.r(i),s.d(i,{HuiShortcutCard:()=>g});var o=s(62826),e=s(5124),c=s(22441),a=s(89784),h=s(78870),r=(s(76776),s(22573),s(80933),s(32248),s(96779)),_=s(56505),l=s(22064),u=s(97176),d=s(53034),f=s(51989),v=t([_]);_=(v.then?(await v)():v)[0];class g extends e.WF{static async getConfigElement(){return await s.e(85911).then(s.bind(s,48458)),document.createElement("hui-shortcut-card-editor")}static getStubConfig(){return{type:"shortcut",tap_action:{action:"navigate",navigation_path:"/home"}}}setConfig(t){this._config={tap_action:{action:"none"},...t}}getCardSize(){return this._config?.vertical?2:1}getGridOptions(){return this._config?.vertical?{columns:6,rows:2,min_columns:3,min_rows:2}:{columns:6,rows:1,min_columns:6,min_rows:1}}willUpdate(t){if((t.has("hass")||t.has("_config"))&&this.hass){const t=this._config?.tap_action;this._navInfo.update(this.hass,"navigate"===t?.action?t.navigation_path:void 0),this._serviceInfo.updateService("perform-action"===t?.action||"call-service"===t?.action?t.perform_action||t.service:void 0)}}_handleAction(t){(0,l.$)(this,this.hass,this._config,t.detail.action)}get _hasCardAction(){return(0,u.h)(this._config?.tap_action)||(0,u.h)(this._config?.hold_action)||(0,u.h)(this._config?.double_tap_action)}render(){if(!this._config||!this.hass)return e.s6;const t=(0,d.J)(this.hass,this._config.tap_action,this._navInfo.info,this._serviceInfo.info),i=this._config.label||t.label,s=this._config.description,n=this._config.icon||t.icon,o=n?void 0:t.iconPath,c=this._config.color?(0,h.MP)(this._config.color):void 0,r=c?{"--tile-color":c}:{};return e.qy` <ha-card style="${(0,a.W)(r)}"> <ha-tile-container .vertical="${Boolean(this._config.vertical)}" .interactive="${this._hasCardAction}" .actionHandlerOptions="${{hasHold:(0,u.h)(this._config.hold_action),hasDoubleClick:(0,u.h)(this._config.double_tap_action)}}" @action="${this._handleAction}"> <ha-tile-icon slot="icon" .icon="${n||void 0}" .iconPath="${o}"></ha-tile-icon> <ha-tile-info slot="info"> <span slot="primary">${i}</span> ${s?e.qy`<span slot="secondary">${s}</span>`:e.s6} </ha-tile-info> </ha-tile-container> </ha-card> `}constructor(...t){super(...t),this._navInfo=new r.q(this),this._serviceInfo=new _.G(this)}}g.styles=[f.c,e.AH`:host{--tile-color:var(--primary-color)}`],(0,o.Cg)([(0,c.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,o.Cg)([(0,c.wk)()],g.prototype,"_config",void 0),g=(0,o.Cg)([(0,c.EM)("hui-shortcut-card")],g),n()}catch(t){n(t)}})}};