Merge main; keep inline panels polling while their host reports them hidden

Main now has #1282, which pauses periodic layer polling in a hidden page
with its own catch-up and listener cleanup, so this PR drops its duplicate
lifecycle.js change and test in favor of main's.

Review fixes:
- data.js passes panelAwareVisibility(document) (new in app/embed.js) as
  the lifecycle's visibility target, so an inline panel whose host reports
  it hidden keeps polling. The HUD's 250 ms readout follows the same
  document.hidden && !isEmbeddedInline() rule as tools.js.
- Tests: embed.test.mjs (layers poll in an inline panel reported hidden,
  pause without the flag) and hudPageVisibility.test.mjs (HUD readout).
  Both use mock timers and clean up in finally.
- changelog.d/1344-inline-panel-visibility.md and a note in
  docs/CURRENT-STATE.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
nu-statsandClaude Opus 5.5 committed 2026-10-24 19:47:18 -04:00
commit 1161899aea
83 files changed
+5697 -378

No files matched your search

+5 -2
View File
@@ -39,6 +39,7 @@ import {
} from './hudLayouts.js';
import { formatNumber, msg, t } from './i18n/index.js';
import { localizeLayerName } from './ui/layerPanel.js';
import { isEmbeddedInline } from './app/embed.js';
/** Color palettes keyed by shader mode; applied as CSS custom properties. */
const HUD_COLORS = {
@@ -348,9 +349,11 @@ export class IntelHUD {
dot.style.visibility = this._recBlinkState ? 'visible' : 'hidden';
}, 800);
// Camera-derived data — 4 updates/second (250ms)
// Camera-derived data — 4 updates/second (250ms). Skipped in a hidden
// page, except an inline panel, whose host may report it hidden while it
// is on screen (see keepPanelRendering in app/embed.js).
this._updateInterval = setInterval(() => {
if (!this._visible || document.hidden) return;
if (!this._visible || (document.hidden && !isEmbeddedInline())) return;
this._updateCameraData();
}, 250);