From 6149bcf866808cbaa98df1ce5763d8f363cf89ff Mon Sep 17 00:00:00 2001 From: Matysh Date: Thu, 1 Oct 2026 21:43:32 +0300 Subject: [PATCH] refactor: keep room warm-draft construction in the lazy editor (#762) Issue: #762 User-Visible: no --- docs/ARCHITECTURE.md | 4 ++++ scripts/monolith-baseline.json | 4 ++-- src/houseplan-card.ts | 12 +----------- src/houseplan-editor-runtime.ts | 13 +++++++++++++ 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index ac505c1b..a735dc64 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -489,6 +489,10 @@ still recognised in stored config but no longer served render, including the card-local header offset for pending chrome (#762). Adoption completion lives in the lazy editor graph: it only executes after that runtime is ready; View retains just cancellation and camera comparison. + The room draft payload is also built by the installed editor runtime. + This moves existing room-state reads across the already-defined editor port; + it adds no room state. #762 records the resulting host-reference/ported-private + counts in the monolith baseline, without widening its tolerance bands. ## Second card: houseplan-space-card (read-only) diff --git a/scripts/monolith-baseline.json b/scripts/monolith-baseline.json index dcb5aa2b..3e308d3d 100644 --- a/scripts/monolith-baseline.json +++ b/scripts/monolith-baseline.json @@ -1,8 +1,8 @@ { "delegates": 154, "portMembers": 347, - "hostRefs": 4885, - "portPrivates": 94, + "hostRefs": 4925, + "portPrivates": 103, "harnessPrivates": 100, "bundleBytes": 2605172 } diff --git a/src/houseplan-card.ts b/src/houseplan-card.ts index bcedc361..26503456 100755 --- a/src/houseplan-card.ts +++ b/src/houseplan-card.ts @@ -3432,17 +3432,7 @@ export class HouseplanCard extends LitElement { const data = this[`_${kind}Dialog`]; if (data) return at(kind, data); } - if (this._roomDialog) { - return at('room', { - editId: this._roomEditId, fill: this._roomFill, customFill: this._roomCustomFill, - tempMin: this._roomTempMin, tempMax: this._roomTempMax, tempSrc: this._roomTempSrc, - humSrc: this._roomHumSrc, srcOpen: this._roomSrcOpen, srcFilter: this._roomSrcFilter, - nameScale: this._roomNameScale, labelScale: this._roomLabelScale, - areaSel: this._areaSel, nameSel: this._nameSel, - pendingSplit: this._pendingSplit, wallFaceBatch: this._wallFaceBatch, - path: this._path, - }); - } + if (this._roomDialog) return at('room', this._editorRuntimeOrThrow().warmRoomDraft()); if (this._spaceDialog) return this._spaceDialog.busy ? null : at('space', this._spaceDialog); return null; } diff --git a/src/houseplan-editor-runtime.ts b/src/houseplan-editor-runtime.ts index d8e8c5af..556000e0 100644 --- a/src/houseplan-editor-runtime.ts +++ b/src/houseplan-editor-runtime.ts @@ -922,6 +922,19 @@ public finishWarmModeAdoption(request: number): void { public resumeWarmMode(mode: 'view' | 'plan' | 'devices' | 'decor', animate: boolean): void { resumeWarmMode(this.host as unknown as WarmModeHost, mode, () => this.host._setMode(mode, animate, true)); } +/** An open room editor implies an installed runtime; View never constructs this payload. */ +public warmRoomDraft() { + const host = this.host; + return { + editId: host._roomEditId, fill: host._roomFill, customFill: host._roomCustomFill, + tempMin: host._roomTempMin, tempMax: host._roomTempMax, tempSrc: host._roomTempSrc, + humSrc: host._roomHumSrc, srcOpen: host._roomSrcOpen, srcFilter: host._roomSrcFilter, + nameScale: host._roomNameScale, labelScale: host._roomLabelScale, + areaSel: host._areaSel, nameSel: host._nameSel, + pendingSplit: host._pendingSplit, wallFaceBatch: host._wallFaceBatch, + path: host._path, + }; +} public _setMode(mode: 'view' | 'plan' | 'devices' | 'decor', animate = true): void { if (mode !== this.host._mode) this.host._cancelDangerConfirm();