From c1dd9246eb705c198c09297cdeba5753b19611aa Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Fri, 30 Oct 2026 23:56:20 -0700 Subject: [PATCH] fix(ui): keep the removed Display and layout exports as deprecated shims Restore shouldHideCollapsedRightPanels, syncScopeControls and the fadeSliders field, skipping sliders already bound by name. Note the API changes in the changelog. --- CHANGELOG.md | 7 +++++++ src/ui/displayControls.js | 18 ++++++++++++++++++ src/ui/displayControls.test.mjs | 14 ++++++++++++++ src/ui/panelRailGeometry.js | 13 +++++++++++++ src/ui/panelRails.js | 5 ++++- 5 files changed, 56 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d99f1d3cc..c0b42a7bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,13 @@ picker, and Node tests that import application modules register the component loader with `--import=/build/register-vue` (samehkhamis). +- `./ui/display`'s `bindDisplayControls` takes the keyhole fade and outside + opacity sliders as `fadeSlider` and `outsideOpacitySlider`, and their + actions receive whole percentages; `fadeSliders` still works. + `syncScopeControls` (`./ui/display`) and `shouldHideCollapsedRightPanels` + (`./ui/layout`) are deprecated: the Display view and the rail now own what + they did. `./ui/input` imports Vue (samehkhamis). + ## [0.3.0] — 2026-10-27 — Street Level, On Your Phone, in Your Language - Show a Street Level view facing 359.5° or more as 0°. The viewer caption diff --git a/src/ui/displayControls.js b/src/ui/displayControls.js index 3969e46f1..6994b933c 100644 --- a/src/ui/displayControls.js +++ b/src/ui/displayControls.js @@ -67,9 +67,27 @@ export function bindDisplayControls({ elements, actions }) { } listen(elements.fadeSlider, 'input', 'setFade', integer); listen(elements.outsideOpacitySlider, 'input', 'setOutsideOpacity', integer); + // Hosts written before the two sliders were told apart pass `fadeSliders` + // and read both values in `setFade` themselves. + for (const el of elements.fadeSliders || []) { + if (el === elements.fadeSlider || el === elements.outsideOpacitySlider) + continue; + listen(el, 'input', 'setFade'); + } return { destroy() { for (const remove of removers.splice(0)) remove(); }, }; } + +/** + * Keep a native Scope checkbox and feather availability in step with the + * mask. The Display view renders both from VisualSettings now; this stays + * exported from `./ui/display` for hosts that imported it. + * @deprecated + */ +export function syncScopeControls(toggle, featherSlider, enabled) { + if (toggle) toggle.checked = enabled; + if (featherSlider) featherSlider.disabled = !enabled; +} diff --git a/src/ui/displayControls.test.mjs b/src/ui/displayControls.test.mjs index 4e44c582d..d91b1bc5b 100644 --- a/src/ui/displayControls.test.mjs +++ b/src/ui/displayControls.test.mjs @@ -159,6 +159,20 @@ test('optional controls are absent safely and subscriptions stay instance-owned' two.destroy(); }); +test('legacy fadeSliders bind once and skip sliders passed by name', () => { + const calls = []; + const fade = element('40'); + const legacy = element('25'); + const control = bindDisplayControls({ + elements: { fadeSlider: fade, fadeSliders: [fade, legacy] }, + actions: { setFade: (value) => calls.push(value) }, + }); + fade.dispatchEvent(new Event('input')); + legacy.dispatchEvent(new Event('input')); + assert.deepEqual(calls, [40, undefined]); + control.destroy(); +}); + test('the native Scope checkbox reads checked state on change and disposes its listener', () => { const scopeToggle = element(); scopeToggle.checked = true; diff --git a/src/ui/panelRailGeometry.js b/src/ui/panelRailGeometry.js index b5a129c21..673f4871e 100644 --- a/src/ui/panelRailGeometry.js +++ b/src/ui/panelRailGeometry.js @@ -60,3 +60,16 @@ export function resolveHudRailLayout({ constrained: panelHeight > availableHeight, }; } + +/** + * Whether the Tactical layout hid collapsed right panels beside an expanded + * one. The rail now enforces one open panel per side in every layout; this + * stays exported from `./ui/layout` for hosts that imported it. + * @deprecated + */ +export function shouldHideCollapsedRightPanels({ + hudVariant, + hasExpandedPanel, +}) { + return hudVariant === 'tactical' && Boolean(hasExpandedPanel); +} diff --git a/src/ui/panelRails.js b/src/ui/panelRails.js index e447d6302..a67371cc7 100644 --- a/src/ui/panelRails.js +++ b/src/ui/panelRails.js @@ -1,7 +1,10 @@ export { layoutLeftPanelRail } from './leftPanelRail.js'; export { layoutRightPanelRail } from './rightPanelRail.js'; export { measurePanelNaturalHeight } from './panelMeasurement.js'; -export { resolveHudRailLayout } from './panelRailGeometry.js'; +export { + resolveHudRailLayout, + shouldHideCollapsedRightPanels, +} from './panelRailGeometry.js'; export { allocatePanelStackHeights, panelStackAutoCollapseIndices,