fix: deduplicate Labs location listeners

Issue: #341
User-Visible: no
This commit is contained in:
Matysh
2026-08-28 14:40:06 +03:00
parent c4a83ce875
commit 5f6bddeaf3
18 changed files with 219 additions and 159 deletions
@@ -1,111 +1,111 @@
{
"schema": 1,
"fingerprint": "420f1f87e66a879316f23c4dd573991c8cf2bfcf5ef013191e55e4216031f3be",
"fingerprint": "13fcebb68eb62b100bccb7b77eb09b8fce2f41e6c77bcbe8870e6dc4d97eedbf",
"entry": "houseplan-card.js",
"initialViewFiles": [
"houseplan-assets/houseplan-card-BarpA18i.js",
"houseplan-assets/houseplan-card-DqEPY1YF.js",
"houseplan-card.js"
],
"initialViewGzipBytes": 256012,
"initialViewGzipBytes": 256046,
"lazyFiles": [
"houseplan-assets/de-L64iNsLu.js",
"houseplan-assets/editor-B45l6syb.js",
"houseplan-assets/houseplan-editor-runtime-D6vKsLjO.js",
"houseplan-assets/houseplan-onboarding-runtime-BUDnRMK5.js",
"houseplan-assets/space-deletion-05RPnoUh.js"
"houseplan-assets/de-C7PgDVgU.js",
"houseplan-assets/editor-CPiO_Ss0.js",
"houseplan-assets/houseplan-editor-runtime-BgHN32PH.js",
"houseplan-assets/houseplan-onboarding-runtime-yqs9kwpI.js",
"houseplan-assets/space-deletion-niSjMtPX.js"
],
"lazyGzipBytes": 160359,
"lazyGzipBytes": 160338,
"lazyEditorFiles": [
"houseplan-assets/editor-B45l6syb.js",
"houseplan-assets/houseplan-editor-runtime-D6vKsLjO.js",
"houseplan-assets/space-deletion-05RPnoUh.js"
"houseplan-assets/editor-CPiO_Ss0.js",
"houseplan-assets/houseplan-editor-runtime-BgHN32PH.js",
"houseplan-assets/space-deletion-niSjMtPX.js"
],
"lazyEditorGzipBytes": 131837,
"lazyEditorGzipBytes": 131830,
"lazyOnboardingFiles": [
"houseplan-assets/houseplan-onboarding-runtime-BUDnRMK5.js",
"houseplan-assets/space-deletion-05RPnoUh.js"
"houseplan-assets/houseplan-onboarding-runtime-yqs9kwpI.js",
"houseplan-assets/space-deletion-niSjMtPX.js"
],
"lazyOnboardingGzipBytes": 7198,
"lazyOnboardingGzipBytes": 7192,
"lazyLocaleFiles": [
"houseplan-assets/de-L64iNsLu.js"
"houseplan-assets/de-C7PgDVgU.js"
],
"lazyLocaleGzipBytes": 21878,
"lazyLocaleGzipBytes": 21866,
"files": [
{
"path": "houseplan-assets/de-L64iNsLu.js",
"sha256": "472ff7eb5679b16bacedce870ac7a23379c8a03ee3470b660c0c996a76f29b7e",
"path": "houseplan-assets/de-C7PgDVgU.js",
"sha256": "0a7d0b50dde016600e4a01b38063b13eb08179de87091fc30af08597bd09d49e",
"rawBytes": 71477,
"gzipBytes": 21878,
"gzipBytes": 21866,
"isEntry": false,
"imports": [],
"dynamicImports": []
},
{
"path": "houseplan-assets/editor-B45l6syb.js",
"sha256": "2df6678b9adc8c3423d6e250b111461f7f3a75f4377a36ed72e5cbee51ce4bf2",
"path": "houseplan-assets/editor-CPiO_Ss0.js",
"sha256": "00cfc5201c071a576ab5c2db63d1d8467bff3f702e81ca49c297700c6ba1712b",
"rawBytes": 3831,
"gzipBytes": 1583,
"gzipBytes": 1582,
"isEntry": false,
"imports": [
"houseplan-assets/houseplan-card-BarpA18i.js"
"houseplan-assets/houseplan-card-DqEPY1YF.js"
],
"dynamicImports": []
},
{
"path": "houseplan-assets/houseplan-card-BarpA18i.js",
"sha256": "b3276d12591e3face8174420b981e9d7626ca9ab02667982ad83943d93194ef1",
"rawBytes": 910025,
"gzipBytes": 255830,
"path": "houseplan-assets/houseplan-card-DqEPY1YF.js",
"sha256": "8ed3aca1f9b05e41e123c54584bc498cfbabe35d232b708768487185d282f7eb",
"rawBytes": 910277,
"gzipBytes": 255864,
"isEntry": false,
"imports": [],
"dynamicImports": [
"houseplan-assets/de-L64iNsLu.js",
"houseplan-assets/editor-B45l6syb.js",
"houseplan-assets/houseplan-editor-runtime-D6vKsLjO.js",
"houseplan-assets/houseplan-onboarding-runtime-BUDnRMK5.js"
"houseplan-assets/de-C7PgDVgU.js",
"houseplan-assets/editor-CPiO_Ss0.js",
"houseplan-assets/houseplan-editor-runtime-BgHN32PH.js",
"houseplan-assets/houseplan-onboarding-runtime-yqs9kwpI.js"
]
},
{
"path": "houseplan-assets/houseplan-editor-runtime-D6vKsLjO.js",
"sha256": "8cf01ac6ca2eb3ee4f8f1191ab15eb92884ee25013356ea4e12bfffdeb0b1fd2",
"path": "houseplan-assets/houseplan-editor-runtime-BgHN32PH.js",
"sha256": "da7c8f5cb805e66604343cf899d8eadf33c6a349ba7d865067ff5cf7fb639bb7",
"rawBytes": 504959,
"gzipBytes": 129700,
"gzipBytes": 129698,
"isEntry": false,
"imports": [
"houseplan-assets/houseplan-card-BarpA18i.js",
"houseplan-assets/space-deletion-05RPnoUh.js"
"houseplan-assets/houseplan-card-DqEPY1YF.js",
"houseplan-assets/space-deletion-niSjMtPX.js"
],
"dynamicImports": []
},
{
"path": "houseplan-assets/houseplan-onboarding-runtime-BUDnRMK5.js",
"sha256": "2439e9cdf2c7873b737d46261a8f489c398c5434bc1fecd71a481ca80519443d",
"path": "houseplan-assets/houseplan-onboarding-runtime-yqs9kwpI.js",
"sha256": "3047ab81aef88f76caa129e43ba4746cc560de6036405759dbd00d1ad98983d6",
"rawBytes": 26356,
"gzipBytes": 6644,
"gzipBytes": 6642,
"isEntry": false,
"imports": [
"houseplan-assets/houseplan-card-BarpA18i.js",
"houseplan-assets/space-deletion-05RPnoUh.js"
"houseplan-assets/houseplan-card-DqEPY1YF.js",
"houseplan-assets/space-deletion-niSjMtPX.js"
],
"dynamicImports": []
},
{
"path": "houseplan-assets/space-deletion-05RPnoUh.js",
"sha256": "2cf11df1b1bcd463ef90c1089b35ae89be7ce4d92370bb6a9ee3e94987a3d65f",
"path": "houseplan-assets/space-deletion-niSjMtPX.js",
"sha256": "2935c48da7310444e002c3426b3b50ec693c7b1484c8b067173621692a4d19a5",
"rawBytes": 911,
"gzipBytes": 554,
"gzipBytes": 550,
"isEntry": false,
"imports": [],
"dynamicImports": []
},
{
"path": "houseplan-card.js",
"sha256": "aa89ff5b93e00716f50c19cbb8efd81900451bca43220ddf3a74d9de7bf6a57e",
"sha256": "147f3e320c09da67cbe342bcb38567c0df6e6b685d0e52bab4277ee69b896361",
"rawBytes": 190,
"gzipBytes": 182,
"isEntry": true,
"imports": [
"houseplan-assets/houseplan-card-BarpA18i.js"
"houseplan-assets/houseplan-card-DqEPY1YF.js"
],
"dynamicImports": []
}
@@ -1,14 +1,14 @@
globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="420f1f87e66a879316f23c4dd573991c8cf2bfcf5ef013191e55e4216031f3be";import{c as e,l as o,t,d2 as s,A as a,d3 as i,d4 as l,d5 as n,E as r,b as c}from"./houseplan-card-BarpA18i.js";class f extends e{constructor(){super(...arguments),this._spaces=null,this._spacesLoading=!1,this._spacesAuthoritative=!1}setConfig(e){this._config=e}async _loadSpaces(){if(!this._spaces&&!this._spacesLoading&&this.hass){this._spacesLoading=!0;try{const e=await this.hass.callWS({type:"houseplan/config/get"});this._spaces=(e?.config?.spaces||[]).map(e=>({value:e.id,label:e.title||e.id})),this._spacesAuthoritative=!0}catch{this._spaces=[],this._spacesAuthoritative=!1}finally{this._spacesLoading=!1}}}get _lang(){return o(this.hass,this._config?.language)}get _floorToken(){const e=this._config?.floor;return"number"==typeof e?`__houseplan_yaml_floor_index__:${String(e)}`:null}get _formData(){const e={...this._config},o=this._floorToken;return o?e.floor=o:Object.prototype.hasOwnProperty.call(e,"floor")||(e.floor=""),e}get _schema(){const e=this._spaces||[],o=this._lang,a=[{value:"",label:t(o,"editor.floor_none")}],i=this._floorToken;i&&a.push({value:i,label:t(o,"editor.floor_index",{index:String(this._config?.floor)})});const l="string"==typeof this._config?.floor?this._config.floor:"";l&&!e.some(e=>e.value===l)&&a.push({value:l,label:l}),a.push(...e);const n="string"==typeof this._config?.default_floor?this._config.default_floor:"",r=[...e];return n&&!e.some(e=>e.value===n)&&r.unshift({value:n,label:n}),[{name:"title",selector:{text:{}}},{name:"floor",selector:{select:{mode:"dropdown",options:a}}},e.length?{name:"default_floor",selector:{select:{mode:"dropdown",options:r}}}:{name:"default_floor",selector:{text:{}}},{name:"language",selector:{select:{mode:"dropdown",options:s(t(o,"editor.lang_auto"),this._config?.language)}}},{name:"icon_size",selector:{number:{min:1,max:6,step:.1,mode:"box"}}},{name:"show_temperature",selector:{boolean:{}}},{name:"live_states",selector:{boolean:{}}},{name:"show_signal",selector:{boolean:{}}},{name:"kiosk",selector:{boolean:{}}},{name:"cycle",selector:{number:{min:0,max:3600,step:5,mode:"box"}}}]}render(){if(!this.hass||!this._config)return a;const e=i(this,l,o(this.hass,this._config.language));if("cold"===e)return n();if("warm"===e)return r;this._loadSpaces();const s=this._lang,f={title:t(s,"editor.title"),floor:t(s,"editor.floor"),default_floor:t(s,"editor.default_floor"),language:t(s,"editor.language"),icon_size:t(s,"editor.icon_size"),show_temperature:t(s,"editor.show_temperature"),live_states:t(s,"editor.live_states"),show_signal:t(s,"editor.show_signal"),kiosk:t(s,"editor.kiosk"),cycle:t(s,"editor.cycle")},h=this._schema,_=function(e,o,t){if(!t||null===o)return null;const s="string"==typeof e?.default_floor?e.default_floor:"";return!s||o.some(e=>e.value===s)?null:s}(this._config,this._spaces,this._spacesAuthoritative),d=e=>c`<ha-form
globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="13fcebb68eb62b100bccb7b77eb09b8fce2f41e6c77bcbe8870e6dc4d97eedbf";import{c as e,l as o,t,d2 as s,A as a,d3 as i,d4 as l,d5 as n,E as r,b as c}from"./houseplan-card-DqEPY1YF.js";class h extends e{constructor(){super(...arguments),this._spaces=null,this._spacesLoading=!1,this._spacesAuthoritative=!1}setConfig(e){this._config=e}async _loadSpaces(){if(!this._spaces&&!this._spacesLoading&&this.hass){this._spacesLoading=!0;try{const e=await this.hass.callWS({type:"houseplan/config/get"});this._spaces=(e?.config?.spaces||[]).map(e=>({value:e.id,label:e.title||e.id})),this._spacesAuthoritative=!0}catch{this._spaces=[],this._spacesAuthoritative=!1}finally{this._spacesLoading=!1}}}get _lang(){return o(this.hass,this._config?.language)}get _floorToken(){const e=this._config?.floor;return"number"==typeof e?`__houseplan_yaml_floor_index__:${String(e)}`:null}get _formData(){const e={...this._config},o=this._floorToken;return o?e.floor=o:Object.prototype.hasOwnProperty.call(e,"floor")||(e.floor=""),e}get _schema(){const e=this._spaces||[],o=this._lang,a=[{value:"",label:t(o,"editor.floor_none")}],i=this._floorToken;i&&a.push({value:i,label:t(o,"editor.floor_index",{index:String(this._config?.floor)})});const l="string"==typeof this._config?.floor?this._config.floor:"";l&&!e.some(e=>e.value===l)&&a.push({value:l,label:l}),a.push(...e);const n="string"==typeof this._config?.default_floor?this._config.default_floor:"",r=[...e];return n&&!e.some(e=>e.value===n)&&r.unshift({value:n,label:n}),[{name:"title",selector:{text:{}}},{name:"floor",selector:{select:{mode:"dropdown",options:a}}},e.length?{name:"default_floor",selector:{select:{mode:"dropdown",options:r}}}:{name:"default_floor",selector:{text:{}}},{name:"language",selector:{select:{mode:"dropdown",options:s(t(o,"editor.lang_auto"),this._config?.language)}}},{name:"icon_size",selector:{number:{min:1,max:6,step:.1,mode:"box"}}},{name:"show_temperature",selector:{boolean:{}}},{name:"live_states",selector:{boolean:{}}},{name:"show_signal",selector:{boolean:{}}},{name:"kiosk",selector:{boolean:{}}},{name:"cycle",selector:{number:{min:0,max:3600,step:5,mode:"box"}}}]}render(){if(!this.hass||!this._config)return a;const e=i(this,l,o(this.hass,this._config.language));if("cold"===e)return n();if("warm"===e)return r;this._loadSpaces();const s=this._lang,h={title:t(s,"editor.title"),floor:t(s,"editor.floor"),default_floor:t(s,"editor.default_floor"),language:t(s,"editor.language"),icon_size:t(s,"editor.icon_size"),show_temperature:t(s,"editor.show_temperature"),live_states:t(s,"editor.live_states"),show_signal:t(s,"editor.show_signal"),kiosk:t(s,"editor.kiosk"),cycle:t(s,"editor.cycle")},f=this._schema,_=function(e,o,t){if(!t||null===o)return null;const s="string"==typeof e?.default_floor?e.default_floor:"";return!s||o.some(e=>e.value===s)?null:s}(this._config,this._spaces,this._spacesAuthoritative),d=e=>c`<ha-form
.hass=${this.hass}
.data=${this._formData}
.schema=${e}
.computeLabel=${e=>f[e.name]||e.name}
.computeLabel=${e=>h[e.name]||e.name}
@value-changed=${this._valueChanged}
></ha-form>`;return c`
${d(h.slice(0,3))}
${d(f.slice(0,3))}
${_?c`<div class="default-floor-error" role="alert"
style="color:var(--error-color,#db4437);margin:-4px 0 12px;overflow-wrap:anywhere">
${t(s,"editor.default_floor_missing",{id:_})}
</div>`:a}
${d(h.slice(3))}
`}_valueChanged(e){const o={...this._config,...e.detail.value};""===o.floor?delete o.floor:o.floor===this._floorToken&&(o.floor=this._config?.floor);const t=new Event("config-changed",{bubbles:!0,composed:!0});t.detail={config:o},this.dispatchEvent(t)}}f.properties={hass:{attribute:!1},_config:{state:!0},_spaces:{state:!0}},customElements.get("houseplan-card-editor")||customElements.define("houseplan-card-editor",f);
${d(f.slice(3))}
`}_valueChanged(e){const o={...this._config,...e.detail.value};""===o.floor?delete o.floor:o.floor===this._floorToken&&(o.floor=this._config?.floor);const t=new Event("config-changed",{bubbles:!0,composed:!0});t.detail={config:o},this.dispatchEvent(t)}}h.properties={hass:{attribute:!1},_config:{state:!0},_spaces:{state:!0}},customElements.get("houseplan-card-editor")||customElements.define("houseplan-card-editor",h);
@@ -1 +1 @@
function e(e,o){return{id:e,title:o,plan_url:null,view_box:[0,0,1,1],rooms:[],wall_segments:[]}}function o(e="file"){const o="draw"===e;return{source:e,showBorders:o,showNames:o,displayTouched:!1}}function r(e,o){if(e.displayTouched)return{...e,source:o};const r="draw"===o;return{...e,source:o,showBorders:r,showNames:r}}function s(e,o,r){return{...e,[o]:r,displayTouched:!0}}function t(e,o,r){const s=(e?.spaces||[]).find(e=>e?.id===r),t=new Set((s?.rooms||[]).map(e=>String(e?.id||"")).filter(Boolean)),n=[...new Set((e?.markers||[]).filter(e=>!0!==e?.removed&&"string"==typeof e?.id).filter(e=>e.space===r||"string"==typeof e.room_id&&t.has(e.room_id)||o?.[e.id]?.s===r).map(e=>e.id))].sort((e,o)=>e.localeCompare(o));return{markerIds:n,count:n.length}}globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="420f1f87e66a879316f23c4dd573991c8cf2bfcf5ef013191e55e4216031f3be";export{t as a,e as c,o as i,r as s,s as t};
function e(e,o){return{id:e,title:o,plan_url:null,view_box:[0,0,1,1],rooms:[],wall_segments:[]}}function o(e="file"){const o="draw"===e;return{source:e,showBorders:o,showNames:o,displayTouched:!1}}function r(e,o){if(e.displayTouched)return{...e,source:o};const r="draw"===o;return{...e,source:o,showBorders:r,showNames:r}}function s(e,o,r){return{...e,[o]:r,displayTouched:!0}}function t(e,o,r){const s=(e?.spaces||[]).find(e=>e?.id===r),t=new Set((s?.rooms||[]).map(e=>String(e?.id||"")).filter(Boolean)),n=[...new Set((e?.markers||[]).filter(e=>!0!==e?.removed&&"string"==typeof e?.id).filter(e=>e.space===r||"string"==typeof e.room_id&&t.has(e.room_id)||o?.[e.id]?.s===r).map(e=>e.id))].sort((e,o)=>e.localeCompare(o));return{markerIds:n,count:n.length}}globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="13fcebb68eb62b100bccb7b77eb09b8fce2f41e6c77bcbe8870e6dc4d97eedbf";export{t as a,e as c,o as i,r as s,s as t};
@@ -1 +1 @@
globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="420f1f87e66a879316f23c4dd573991c8cf2bfcf5ef013191e55e4216031f3be";export{d6 as HouseplanCard}from"./houseplan-assets/houseplan-card-BarpA18i.js";
globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="13fcebb68eb62b100bccb7b77eb09b8fce2f41e6c77bcbe8870e6dc4d97eedbf";export{d6 as HouseplanCard}from"./houseplan-assets/houseplan-card-DqEPY1YF.js";
+48 -48
View File
@@ -1,111 +1,111 @@
{
"schema": 1,
"fingerprint": "420f1f87e66a879316f23c4dd573991c8cf2bfcf5ef013191e55e4216031f3be",
"fingerprint": "13fcebb68eb62b100bccb7b77eb09b8fce2f41e6c77bcbe8870e6dc4d97eedbf",
"entry": "houseplan-card.js",
"initialViewFiles": [
"houseplan-assets/houseplan-card-BarpA18i.js",
"houseplan-assets/houseplan-card-DqEPY1YF.js",
"houseplan-card.js"
],
"initialViewGzipBytes": 256012,
"initialViewGzipBytes": 256046,
"lazyFiles": [
"houseplan-assets/de-L64iNsLu.js",
"houseplan-assets/editor-B45l6syb.js",
"houseplan-assets/houseplan-editor-runtime-D6vKsLjO.js",
"houseplan-assets/houseplan-onboarding-runtime-BUDnRMK5.js",
"houseplan-assets/space-deletion-05RPnoUh.js"
"houseplan-assets/de-C7PgDVgU.js",
"houseplan-assets/editor-CPiO_Ss0.js",
"houseplan-assets/houseplan-editor-runtime-BgHN32PH.js",
"houseplan-assets/houseplan-onboarding-runtime-yqs9kwpI.js",
"houseplan-assets/space-deletion-niSjMtPX.js"
],
"lazyGzipBytes": 160359,
"lazyGzipBytes": 160338,
"lazyEditorFiles": [
"houseplan-assets/editor-B45l6syb.js",
"houseplan-assets/houseplan-editor-runtime-D6vKsLjO.js",
"houseplan-assets/space-deletion-05RPnoUh.js"
"houseplan-assets/editor-CPiO_Ss0.js",
"houseplan-assets/houseplan-editor-runtime-BgHN32PH.js",
"houseplan-assets/space-deletion-niSjMtPX.js"
],
"lazyEditorGzipBytes": 131837,
"lazyEditorGzipBytes": 131830,
"lazyOnboardingFiles": [
"houseplan-assets/houseplan-onboarding-runtime-BUDnRMK5.js",
"houseplan-assets/space-deletion-05RPnoUh.js"
"houseplan-assets/houseplan-onboarding-runtime-yqs9kwpI.js",
"houseplan-assets/space-deletion-niSjMtPX.js"
],
"lazyOnboardingGzipBytes": 7198,
"lazyOnboardingGzipBytes": 7192,
"lazyLocaleFiles": [
"houseplan-assets/de-L64iNsLu.js"
"houseplan-assets/de-C7PgDVgU.js"
],
"lazyLocaleGzipBytes": 21878,
"lazyLocaleGzipBytes": 21866,
"files": [
{
"path": "houseplan-assets/de-L64iNsLu.js",
"sha256": "472ff7eb5679b16bacedce870ac7a23379c8a03ee3470b660c0c996a76f29b7e",
"path": "houseplan-assets/de-C7PgDVgU.js",
"sha256": "0a7d0b50dde016600e4a01b38063b13eb08179de87091fc30af08597bd09d49e",
"rawBytes": 71477,
"gzipBytes": 21878,
"gzipBytes": 21866,
"isEntry": false,
"imports": [],
"dynamicImports": []
},
{
"path": "houseplan-assets/editor-B45l6syb.js",
"sha256": "2df6678b9adc8c3423d6e250b111461f7f3a75f4377a36ed72e5cbee51ce4bf2",
"path": "houseplan-assets/editor-CPiO_Ss0.js",
"sha256": "00cfc5201c071a576ab5c2db63d1d8467bff3f702e81ca49c297700c6ba1712b",
"rawBytes": 3831,
"gzipBytes": 1583,
"gzipBytes": 1582,
"isEntry": false,
"imports": [
"houseplan-assets/houseplan-card-BarpA18i.js"
"houseplan-assets/houseplan-card-DqEPY1YF.js"
],
"dynamicImports": []
},
{
"path": "houseplan-assets/houseplan-card-BarpA18i.js",
"sha256": "b3276d12591e3face8174420b981e9d7626ca9ab02667982ad83943d93194ef1",
"rawBytes": 910025,
"gzipBytes": 255830,
"path": "houseplan-assets/houseplan-card-DqEPY1YF.js",
"sha256": "8ed3aca1f9b05e41e123c54584bc498cfbabe35d232b708768487185d282f7eb",
"rawBytes": 910277,
"gzipBytes": 255864,
"isEntry": false,
"imports": [],
"dynamicImports": [
"houseplan-assets/de-L64iNsLu.js",
"houseplan-assets/editor-B45l6syb.js",
"houseplan-assets/houseplan-editor-runtime-D6vKsLjO.js",
"houseplan-assets/houseplan-onboarding-runtime-BUDnRMK5.js"
"houseplan-assets/de-C7PgDVgU.js",
"houseplan-assets/editor-CPiO_Ss0.js",
"houseplan-assets/houseplan-editor-runtime-BgHN32PH.js",
"houseplan-assets/houseplan-onboarding-runtime-yqs9kwpI.js"
]
},
{
"path": "houseplan-assets/houseplan-editor-runtime-D6vKsLjO.js",
"sha256": "8cf01ac6ca2eb3ee4f8f1191ab15eb92884ee25013356ea4e12bfffdeb0b1fd2",
"path": "houseplan-assets/houseplan-editor-runtime-BgHN32PH.js",
"sha256": "da7c8f5cb805e66604343cf899d8eadf33c6a349ba7d865067ff5cf7fb639bb7",
"rawBytes": 504959,
"gzipBytes": 129700,
"gzipBytes": 129698,
"isEntry": false,
"imports": [
"houseplan-assets/houseplan-card-BarpA18i.js",
"houseplan-assets/space-deletion-05RPnoUh.js"
"houseplan-assets/houseplan-card-DqEPY1YF.js",
"houseplan-assets/space-deletion-niSjMtPX.js"
],
"dynamicImports": []
},
{
"path": "houseplan-assets/houseplan-onboarding-runtime-BUDnRMK5.js",
"sha256": "2439e9cdf2c7873b737d46261a8f489c398c5434bc1fecd71a481ca80519443d",
"path": "houseplan-assets/houseplan-onboarding-runtime-yqs9kwpI.js",
"sha256": "3047ab81aef88f76caa129e43ba4746cc560de6036405759dbd00d1ad98983d6",
"rawBytes": 26356,
"gzipBytes": 6644,
"gzipBytes": 6642,
"isEntry": false,
"imports": [
"houseplan-assets/houseplan-card-BarpA18i.js",
"houseplan-assets/space-deletion-05RPnoUh.js"
"houseplan-assets/houseplan-card-DqEPY1YF.js",
"houseplan-assets/space-deletion-niSjMtPX.js"
],
"dynamicImports": []
},
{
"path": "houseplan-assets/space-deletion-05RPnoUh.js",
"sha256": "2cf11df1b1bcd463ef90c1089b35ae89be7ce4d92370bb6a9ee3e94987a3d65f",
"path": "houseplan-assets/space-deletion-niSjMtPX.js",
"sha256": "2935c48da7310444e002c3426b3b50ec693c7b1484c8b067173621692a4d19a5",
"rawBytes": 911,
"gzipBytes": 554,
"gzipBytes": 550,
"isEntry": false,
"imports": [],
"dynamicImports": []
},
{
"path": "houseplan-card.js",
"sha256": "aa89ff5b93e00716f50c19cbb8efd81900451bca43220ddf3a74d9de7bf6a57e",
"sha256": "147f3e320c09da67cbe342bcb38567c0df6e6b685d0e52bab4277ee69b896361",
"rawBytes": 190,
"gzipBytes": 182,
"isEntry": true,
"imports": [
"houseplan-assets/houseplan-card-BarpA18i.js"
"houseplan-assets/houseplan-card-DqEPY1YF.js"
],
"dynamicImports": []
}
File diff suppressed because one or more lines are too long
@@ -1,14 +1,14 @@
globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="420f1f87e66a879316f23c4dd573991c8cf2bfcf5ef013191e55e4216031f3be";import{c as e,l as o,t,d2 as s,A as a,d3 as i,d4 as l,d5 as n,E as r,b as c}from"./houseplan-card-BarpA18i.js";class f extends e{constructor(){super(...arguments),this._spaces=null,this._spacesLoading=!1,this._spacesAuthoritative=!1}setConfig(e){this._config=e}async _loadSpaces(){if(!this._spaces&&!this._spacesLoading&&this.hass){this._spacesLoading=!0;try{const e=await this.hass.callWS({type:"houseplan/config/get"});this._spaces=(e?.config?.spaces||[]).map(e=>({value:e.id,label:e.title||e.id})),this._spacesAuthoritative=!0}catch{this._spaces=[],this._spacesAuthoritative=!1}finally{this._spacesLoading=!1}}}get _lang(){return o(this.hass,this._config?.language)}get _floorToken(){const e=this._config?.floor;return"number"==typeof e?`__houseplan_yaml_floor_index__:${String(e)}`:null}get _formData(){const e={...this._config},o=this._floorToken;return o?e.floor=o:Object.prototype.hasOwnProperty.call(e,"floor")||(e.floor=""),e}get _schema(){const e=this._spaces||[],o=this._lang,a=[{value:"",label:t(o,"editor.floor_none")}],i=this._floorToken;i&&a.push({value:i,label:t(o,"editor.floor_index",{index:String(this._config?.floor)})});const l="string"==typeof this._config?.floor?this._config.floor:"";l&&!e.some(e=>e.value===l)&&a.push({value:l,label:l}),a.push(...e);const n="string"==typeof this._config?.default_floor?this._config.default_floor:"",r=[...e];return n&&!e.some(e=>e.value===n)&&r.unshift({value:n,label:n}),[{name:"title",selector:{text:{}}},{name:"floor",selector:{select:{mode:"dropdown",options:a}}},e.length?{name:"default_floor",selector:{select:{mode:"dropdown",options:r}}}:{name:"default_floor",selector:{text:{}}},{name:"language",selector:{select:{mode:"dropdown",options:s(t(o,"editor.lang_auto"),this._config?.language)}}},{name:"icon_size",selector:{number:{min:1,max:6,step:.1,mode:"box"}}},{name:"show_temperature",selector:{boolean:{}}},{name:"live_states",selector:{boolean:{}}},{name:"show_signal",selector:{boolean:{}}},{name:"kiosk",selector:{boolean:{}}},{name:"cycle",selector:{number:{min:0,max:3600,step:5,mode:"box"}}}]}render(){if(!this.hass||!this._config)return a;const e=i(this,l,o(this.hass,this._config.language));if("cold"===e)return n();if("warm"===e)return r;this._loadSpaces();const s=this._lang,f={title:t(s,"editor.title"),floor:t(s,"editor.floor"),default_floor:t(s,"editor.default_floor"),language:t(s,"editor.language"),icon_size:t(s,"editor.icon_size"),show_temperature:t(s,"editor.show_temperature"),live_states:t(s,"editor.live_states"),show_signal:t(s,"editor.show_signal"),kiosk:t(s,"editor.kiosk"),cycle:t(s,"editor.cycle")},h=this._schema,_=function(e,o,t){if(!t||null===o)return null;const s="string"==typeof e?.default_floor?e.default_floor:"";return!s||o.some(e=>e.value===s)?null:s}(this._config,this._spaces,this._spacesAuthoritative),d=e=>c`<ha-form
globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="13fcebb68eb62b100bccb7b77eb09b8fce2f41e6c77bcbe8870e6dc4d97eedbf";import{c as e,l as o,t,d2 as s,A as a,d3 as i,d4 as l,d5 as n,E as r,b as c}from"./houseplan-card-DqEPY1YF.js";class h extends e{constructor(){super(...arguments),this._spaces=null,this._spacesLoading=!1,this._spacesAuthoritative=!1}setConfig(e){this._config=e}async _loadSpaces(){if(!this._spaces&&!this._spacesLoading&&this.hass){this._spacesLoading=!0;try{const e=await this.hass.callWS({type:"houseplan/config/get"});this._spaces=(e?.config?.spaces||[]).map(e=>({value:e.id,label:e.title||e.id})),this._spacesAuthoritative=!0}catch{this._spaces=[],this._spacesAuthoritative=!1}finally{this._spacesLoading=!1}}}get _lang(){return o(this.hass,this._config?.language)}get _floorToken(){const e=this._config?.floor;return"number"==typeof e?`__houseplan_yaml_floor_index__:${String(e)}`:null}get _formData(){const e={...this._config},o=this._floorToken;return o?e.floor=o:Object.prototype.hasOwnProperty.call(e,"floor")||(e.floor=""),e}get _schema(){const e=this._spaces||[],o=this._lang,a=[{value:"",label:t(o,"editor.floor_none")}],i=this._floorToken;i&&a.push({value:i,label:t(o,"editor.floor_index",{index:String(this._config?.floor)})});const l="string"==typeof this._config?.floor?this._config.floor:"";l&&!e.some(e=>e.value===l)&&a.push({value:l,label:l}),a.push(...e);const n="string"==typeof this._config?.default_floor?this._config.default_floor:"",r=[...e];return n&&!e.some(e=>e.value===n)&&r.unshift({value:n,label:n}),[{name:"title",selector:{text:{}}},{name:"floor",selector:{select:{mode:"dropdown",options:a}}},e.length?{name:"default_floor",selector:{select:{mode:"dropdown",options:r}}}:{name:"default_floor",selector:{text:{}}},{name:"language",selector:{select:{mode:"dropdown",options:s(t(o,"editor.lang_auto"),this._config?.language)}}},{name:"icon_size",selector:{number:{min:1,max:6,step:.1,mode:"box"}}},{name:"show_temperature",selector:{boolean:{}}},{name:"live_states",selector:{boolean:{}}},{name:"show_signal",selector:{boolean:{}}},{name:"kiosk",selector:{boolean:{}}},{name:"cycle",selector:{number:{min:0,max:3600,step:5,mode:"box"}}}]}render(){if(!this.hass||!this._config)return a;const e=i(this,l,o(this.hass,this._config.language));if("cold"===e)return n();if("warm"===e)return r;this._loadSpaces();const s=this._lang,h={title:t(s,"editor.title"),floor:t(s,"editor.floor"),default_floor:t(s,"editor.default_floor"),language:t(s,"editor.language"),icon_size:t(s,"editor.icon_size"),show_temperature:t(s,"editor.show_temperature"),live_states:t(s,"editor.live_states"),show_signal:t(s,"editor.show_signal"),kiosk:t(s,"editor.kiosk"),cycle:t(s,"editor.cycle")},f=this._schema,_=function(e,o,t){if(!t||null===o)return null;const s="string"==typeof e?.default_floor?e.default_floor:"";return!s||o.some(e=>e.value===s)?null:s}(this._config,this._spaces,this._spacesAuthoritative),d=e=>c`<ha-form
.hass=${this.hass}
.data=${this._formData}
.schema=${e}
.computeLabel=${e=>f[e.name]||e.name}
.computeLabel=${e=>h[e.name]||e.name}
@value-changed=${this._valueChanged}
></ha-form>`;return c`
${d(h.slice(0,3))}
${d(f.slice(0,3))}
${_?c`<div class="default-floor-error" role="alert"
style="color:var(--error-color,#db4437);margin:-4px 0 12px;overflow-wrap:anywhere">
${t(s,"editor.default_floor_missing",{id:_})}
</div>`:a}
${d(h.slice(3))}
`}_valueChanged(e){const o={...this._config,...e.detail.value};""===o.floor?delete o.floor:o.floor===this._floorToken&&(o.floor=this._config?.floor);const t=new Event("config-changed",{bubbles:!0,composed:!0});t.detail={config:o},this.dispatchEvent(t)}}f.properties={hass:{attribute:!1},_config:{state:!0},_spaces:{state:!0}},customElements.get("houseplan-card-editor")||customElements.define("houseplan-card-editor",f);
${d(f.slice(3))}
`}_valueChanged(e){const o={...this._config,...e.detail.value};""===o.floor?delete o.floor:o.floor===this._floorToken&&(o.floor=this._config?.floor);const t=new Event("config-changed",{bubbles:!0,composed:!0});t.detail={config:o},this.dispatchEvent(t)}}h.properties={hass:{attribute:!1},_config:{state:!0},_spaces:{state:!0}},customElements.get("houseplan-card-editor")||customElements.define("houseplan-card-editor",h);
@@ -1 +1 @@
function e(e,o){return{id:e,title:o,plan_url:null,view_box:[0,0,1,1],rooms:[],wall_segments:[]}}function o(e="file"){const o="draw"===e;return{source:e,showBorders:o,showNames:o,displayTouched:!1}}function r(e,o){if(e.displayTouched)return{...e,source:o};const r="draw"===o;return{...e,source:o,showBorders:r,showNames:r}}function s(e,o,r){return{...e,[o]:r,displayTouched:!0}}function t(e,o,r){const s=(e?.spaces||[]).find(e=>e?.id===r),t=new Set((s?.rooms||[]).map(e=>String(e?.id||"")).filter(Boolean)),n=[...new Set((e?.markers||[]).filter(e=>!0!==e?.removed&&"string"==typeof e?.id).filter(e=>e.space===r||"string"==typeof e.room_id&&t.has(e.room_id)||o?.[e.id]?.s===r).map(e=>e.id))].sort((e,o)=>e.localeCompare(o));return{markerIds:n,count:n.length}}globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="420f1f87e66a879316f23c4dd573991c8cf2bfcf5ef013191e55e4216031f3be";export{t as a,e as c,o as i,r as s,s as t};
function e(e,o){return{id:e,title:o,plan_url:null,view_box:[0,0,1,1],rooms:[],wall_segments:[]}}function o(e="file"){const o="draw"===e;return{source:e,showBorders:o,showNames:o,displayTouched:!1}}function r(e,o){if(e.displayTouched)return{...e,source:o};const r="draw"===o;return{...e,source:o,showBorders:r,showNames:r}}function s(e,o,r){return{...e,[o]:r,displayTouched:!0}}function t(e,o,r){const s=(e?.spaces||[]).find(e=>e?.id===r),t=new Set((s?.rooms||[]).map(e=>String(e?.id||"")).filter(Boolean)),n=[...new Set((e?.markers||[]).filter(e=>!0!==e?.removed&&"string"==typeof e?.id).filter(e=>e.space===r||"string"==typeof e.room_id&&t.has(e.room_id)||o?.[e.id]?.s===r).map(e=>e.id))].sort((e,o)=>e.localeCompare(o));return{markerIds:n,count:n.length}}globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="13fcebb68eb62b100bccb7b77eb09b8fce2f41e6c77bcbe8870e6dc4d97eedbf";export{t as a,e as c,o as i,r as s,s as t};
+1 -1
View File
@@ -1 +1 @@
globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="420f1f87e66a879316f23c4dd573991c8cf2bfcf5ef013191e55e4216031f3be";export{d6 as HouseplanCard}from"./houseplan-assets/houseplan-card-BarpA18i.js";
globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="13fcebb68eb62b100bccb7b77eb09b8fce2f41e6c77bcbe8870e6dc4d97eedbf";export{d6 as HouseplanCard}from"./houseplan-assets/houseplan-card-DqEPY1YF.js";
+13 -1
View File
@@ -145,7 +145,10 @@ export function resolveLabs(
}
declare global {
interface Window { __hpLabs?: readonly string[]; }
interface Window {
__hpLabs?: readonly string[];
__hpLabsListenerCleanup?: () => void;
}
}
let snapshot: LabsSnapshot = { active: Object.freeze([]), space: '' };
@@ -179,8 +182,17 @@ function ensureBrowserLabs(version: string): LabsSnapshot {
if (typeof window === 'undefined') return snapshot;
if (!listening) {
listening = true;
window.__hpLabsListenerCleanup?.();
window.addEventListener('hashchange', onLocationChange);
window.addEventListener('popstate', onLocationChange);
const cleanup = (): void => {
window.removeEventListener('hashchange', onLocationChange);
window.removeEventListener('popstate', onLocationChange);
if (window.__hpLabsListenerCleanup === cleanup) {
delete window.__hpLabsListenerCleanup;
}
};
window.__hpLabsListenerCleanup = cleanup;
}
return publishBrowserLabs();
}
+48
View File
@@ -55,3 +55,51 @@ test('malformed and unavailable storage are safe', () => {
assert.deepEqual(resolve('', '', '{bad').active, []);
assert.deepEqual(resolve('?hp-labs=iso', '', undefined).active, ['iso']);
});
test('a reloaded Labs module replaces both browser location listeners', async () => {
const previousWindow = globalThis.window;
const listeners = new Map();
const fakeWindow = {
location: { search: '', hash: '' },
localStorage: {
getItem: () => null,
setItem: () => {},
},
addEventListener(type, listener) {
const registered = listeners.get(type) ?? new Set();
registered.add(listener);
listeners.set(type, registered);
},
removeEventListener(type, listener) {
listeners.get(type)?.delete(listener);
},
dispatch(type) {
for (const listener of [...(listeners.get(type) ?? [])]) listener({ type });
},
};
try {
globalThis.window = fakeWindow;
const first = await import('../test-build/labs.js?listener-instance=first');
let firstPublishes = 0;
const unsubscribeFirst = first.subscribeLabs('1.62.0', () => { firstPublishes += 1; });
const second = await import('../test-build/labs.js?listener-instance=second');
let secondPublishes = 0;
const unsubscribeSecond = second.subscribeLabs('1.62.0', () => { secondPublishes += 1; });
assert.equal(listeners.get('hashchange')?.size, 1);
assert.equal(listeners.get('popstate')?.size, 1);
fakeWindow.dispatch('hashchange');
fakeWindow.dispatch('popstate');
assert.equal(firstPublishes, 1, 'the replaced module must not receive location events');
assert.equal(secondPublishes, 3, 'the current module receives initial, hash and popstate publishes');
unsubscribeFirst();
unsubscribeSecond();
} finally {
if (previousWindow === undefined) delete globalThis.window;
else globalThis.window = previousWindow;
}
});