Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

merge: resolve PR #816 against upstream main (8b8ccc9a)

Kevin Rajan19372875e212
diff --cc CHANGELOG.md
index 802407a41,b24ac95ed..5e2a9576e
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -1,10 -1,327 +1,332 @@@
# Changelog
+- Prevent a compact Radio disclosure from covering Space Missions when the
+ adaptive right rail restores Context without calling the panel owner.
+ Repeated Context-open calls and rail-driven expansion both close the mini,
+ with a regression for auto-collapse restoration (raysung-2026, #804).
+
+ - Treat explicitly current, complete empty vessel coverage as a successful update,
+ clearing obsolete contacts while retaining stale or incomplete snapshots.
+
+ - Custom Street Level provider switches survive share links and stored state
+ using URL-safe stable provider IDs and a shared boolean-switch codec; existing
+ Mapillary links keep their meaning. Explicit provider toggles reach durable
+ state without adopting unrelated live switch changes.
+
+ - Directions and Recent Imagery accept replaceable acquisition sources, including
+ route transport, imagery catalog, thumbnails, tile templates and attribution.
+ Explicitly removing either source leaves its layer unavailable; standalone
+ defaults preserve the existing providers.
+
+ - Catalog source availability no longer modifies layer objects; unavailable
+ tooltips use layer display names.
+
+ - Street Level with no providers uses the shared unavailable state and refuses
+ activation before initialization, while keeping its layer identity visible.
+
+ - Application source configuration accepts replacements and explicit removal.
+ Missing catalog feeds leave their layers unavailable without blocking startup
+ or making fallback requests; malformed supplied feeds remain configuration errors.
+
+ - Street Level providers are optional in application composition. Omitting a
+ Mapillary source no longer prevents startup; callers can inject a different
+ provider list or an empty list without changing layer identities or share links.
+
+ - Vector tile sources take their allowed tile origin from the configured
+ `tileJsonUrl`, so repointing only that URL at a mirror loads tiles from the
+ mirror or fails visibly instead of silently using OpenFreeMap. Thanks to
+ [daikaginza](https://github.com/daikaginza) (#935).
+
+ - MCP setup examples use the app's default port, `4173`. Thanks to
+ [Huanyi Xie](https://github.com/xiehuanyi) (#934) and
+ [shirunjies8-png](https://github.com/shirunjies8-png) (#959) for the same fix.
+
+ - Voice revisits numbered analyst records through current layer snapshots and
+ preserves resolved pin coordinates. Requested analyst lists and rankings can
+ speak returned items alongside the exact count and coverage caveats. Failed
+ actions settle the voice card without reviving cancelled turns. Coverage
+ benchmarks reject invalid calls before accepting semantic matches.
+
+ - Street Level is included in the voice layer manifest for visibility toggles;
+ imagery is not exposed as countable analyst records.
+
+ - Voice debug logs omit complete tool-result bodies and serialized function
+ outputs by default, including location queries and generated spoken replies.
+ `GEV_VOICE_LOG_CONTENT=1` retains them for explicit content debugging.
+
+ - Unqualified Alps searches use the bundled European range for navigation
+ and annotations instead of a same-named peak returned by a geocoder.
+ Coordinates, supplied presets and geographically qualified place names
+ keep their precedence; annotation proximity and containment guards remain.
+ - Contacts analyst follow-ups retain the snapshot's distance ranking rather
+ than switching to the camera. Requested radii and explicit scopes remain
+ authoritative, and a request for a list still requires an analyst query.
+ Analyst speech names stale or degraded feeds and withholds authoritative
+ counts when unavailable. The existing NOTES disclosure preserves complete,
+ deduplicated coverage and source caveats, including crowded results.
+ - The voice card shows analyst counts ("At least 250,000 aircraft …") with
+ their scope, feed window and caveats, and marks partial answers. Analyst
+ speech uses the same deterministic headline, preserves lower bounds and says
+ when an answer is partial. Follow-ups retain unanswered-layer coverage, and
+ keep the original scope label when they narrow a remembered result.
+ Contacts-window answers read one immutable panel snapshot, mark a 20,000-row
+ layer cap as a lower bound, and commit that displayed cohort only after
+ cancellation checks pass. Concurrent analyst calls from one model response
+ remain independent; a stopped or replaced user turn still cancels them.
+ - Voice answers are shorter and fill slow work instead of going silent. Slow
+ or multi-step requests may open with one short spoken plan; instant ones
+ just happen. Tool results carry a code-built `say` line and a `display`
+ card: sources and notes stay on screen, a caveat is spoken only when it
+ changes the answer, and "at least" and partial answers are always said. A card above the mic shows captions, the plan's steps and the
+ result. When a tool that reports steps (layers, place lookups, outlines,
+ nearest-aircraft) is still running after 1.5 s its current step is spoken
+ once; others say "still working" once after 8 s. A soft
+ tick plays in push-to-talk. Holding Space while the assistant talks cuts it
+ off. Each turn writes latency and speech figures to the debug log
+ (`node scripts/voice-turn-spans.mjs`). Captions of what you say are
+ counted in the voice cost meter; the debug log leaves out what was said
+ unless `GEV_VOICE_LOG_CONTENT=1`.
+ - Point and ask: hold Space with the cursor on an aircraft, ship or spot on
+ the map and say "what's that", "track that one" or "how many flights
+ around here". A reticle marks the point and the voice card shows what
+ "this" meant. In open mic it works when you have just moved the cursor
+ there. "The second one" picks from the last numbered list. Asking about
+ "the last one" resolves to the last of the five rows actually shown, and
+ referent-only tracking calls are accepted while empty targets are rejected.
+ Asking about
+ bare ground up close gives the assistant a small crop of the map around the
+ point. A slow render gets one bounded second frame request, while hidden,
+ stale, moved-camera, invalid and oversized captures still fail closed.
+
+ ## [Unreleased]
+
+ - Keep later satellites when a TLE catalog entry is missing an orbital line.
+ The parser skips the incomplete set and resumes at the next complete named
+ set, instead of losing the rest of the group (#906).
+
+ - Add an experimental ChatGPT/Codex OAuth option for cloud voice in Provider
+ Settings. API-key voice remains the default. Local sign-in can start from
+ the auth button and reports completion, failure, timeout, or expired
+ credentials. OAuth credentials stay on the server; local routes require
+ loopback access and same-site requests. OAuth sessions retain usage data
+ and show unknown cost; caption transcriptions are counted rather than
+ priced into the API-key cap. The auth button keeps keyboard focus after a
+ mode change, and pending sign-in does not discard text in the key fields.
+ Thanks to [Shayan Khan](https://github.com/devv-shayan) for #621 and
+ [TheSmokeDev](https://github.com/TheSmokeDev) for the credential handling
+ from #653.
+
+ - Stdio servers from one install share a panel key so a page read from one
+ process can make requests through another. Concurrent malformed-key repairs
+ now select one winner; unavailable storage or a busy repair retains the
+ logged per-process fallback. Thanks to [Jibran Tahir](https://github.com/jibraaan)
+ for #958, [MarvinNL046](https://github.com/MarvinNL046) for the report and
+ proposed diagnosis in #927, and [kvnloo](https://github.com/kvnloo) for identifying
+ the repair race. Windows/Claude Desktop Cowork confirmation remains outstanding.
+
+ - Street Level: a street-level imagery layer modelled on the iD editor's photo
+ overlay, with Mapillary as its first provider (free client token, CC BY-SA 4.0
+ imagery). One right-rail panel holds a chip per provider, shared 360°/flat and
+ captured-since filters, and an embedded viewer with EXPAND, FIT/FILL and
+ FOLLOW (Google 3D only). Coverage lines and image cones are drawn from orbit
+ down to a single street; on Google 3D they sit on the bare earth, refined
+ against the rendered mesh near the camera, so trees and buildings hide them.
+ Share links carry the provider switches, the filters and the panel's collapsed
+ state. A server proxy caches Mapillary coverage tiles (24 h, 1 GiB on disk),
+ refuses cross-site requests, rate-limits per IP and backs off when Mapillary
+ rejects the token or rate-limits.
+
+ - The CCTV and Street Level panels are portable: drag the header to float the
+ panel, resize it from any edge or corner, and double-click the header to dock
+ it again. The position persists across reloads.
+
+ - Add Norway's road cameras from Statens vegvesen as a CCTV pack. The camera
+ list is one keyless GeoJSON request to the agency's OGC API view of its
+ DATEX 3.1 CCTV table, so no DATEX account is needed. Every working camera
+ loads (~850; faulty ones are dropped) under one "Norway" category, and the
+ ~135 working cameras that publish HLS play as live video through the existing in-memory
+ relay with the still as fallback. Frames and manifests are pinned to each
+ camera's own path on the agency hosts. `CCTV_VEGVESEN_ENABLED=0` disables
+ the pack, `CCTV_VEGVESEN_MAX_SOURCES` caps it (keeping cameras nearest the
+ largest cities) and `CCTV_VEGVESEN_VIDEO=0` keeps stills only. Attributed
+ under NLOD 2.0.
+
+ ## [0.2.1] — 2026-10-02 — God's Eye View through Your Agent (with security fixes and other features)
+
+ - Ship each bundled data pack once. The region, marine, admin-boundary,
+ county, military-name and neighborhood packs were emitted twice by the
+ production build, as the JSON the browser fetches and as an unused
+ JavaScript copy; `dist/` drops from 54 MB to 42 MB. Under Node the loader
+ reads the JSON file directly (reporting that Node 24.14 or newer is needed
+ on a runtime too old to do so), and a test keeps app code from importing a
+ pack as a module.
+
+ - Apply the Host check before the app's own routes. Vite installs its Host
+ check after the middleware that plugins add, so the provider and `/api`
+ routes used to answer any Host, including a DNS-rebinding name, in every
+ mode. A first-running middleware now applies the same allowed hosts on the
+ dev and preview servers.
+
+ - Refuse cross-site browser requests to the cost-bearing and log endpoints
+ (`/api/realtime/token`, `/api/openai/hud-summary`,
+ `/api/google/nearby-places`, `/api/google/text-search`,
+ `/api/realtime/debug-log`): a foreign or opaque
+ Origin, a cross-site `Sec-Fetch-Site`, or proxy forwarding headers get 403,
+ while loopback tools and LAN use keep working. The dev and preview servers
+ send one shared Content-Security-Policy (James Sumpter, #242).
+
+ - The voice debug log records the server's own time: a record can no longer
+ supply its `loggedAt`. The dev and preview servers also send
+ `X-Content-Type-Options: nosniff` (findings by Sunil, #710).
+
+ - Keep the Host-header check when binding to all interfaces. `HOST=0.0.0.0`
+ used to accept any Host; the dev and preview servers now accept IP
+ addresses, `localhost` and the LAN hostnames listed in `GEV_ALLOWED_HOSTS`
+ (suffix and wildcard entries are ignored), which also keeps DNS-rebinding
+ names out in LAN mode. The `.local` suffix is no longer accepted by default;
+ list such a name explicitly (Puspo Aditya, #97, fixes #21).
+
+ - Throttle the cost-bearing proxies by default instead of on request. The
+ OpenAI endpoints (`/api/realtime/token`, `/api/openai/hud-summary`) now allow
+ 30 requests per minute per client IP and the Google Places endpoints
+ (`/api/google/nearby-places`, `/api/google/text-search`) 120 — the caps the
+ Pinokio build already ships, so the packaged app is unaffected and only an
+ unconfigured server changes, from unlimited to what the product already runs
+ with. `GEV_RATELIMIT_OPENAI_PER_MIN` and `GEV_RATELIMIT_GOOGLE_PER_MIN` still
+ override the caps, and exactly `0` disables them; a value that cannot be read
+ as a number now falls back to the default rather than to unlimited, so a typo
+ cannot silently disarm the guard (daikaginza, #683).
+
+ - Tighten the local MCP server and embed mode. The panel's `panel_request`
+ needs the key in its MCP server's panel page, and refuses Provider
+ Settings, credential and model endpoints, `/mcp` and development server
+ routes in any letter case, encoding or dot suffix; panels on one server share six
+ requests in flight, and further requests wait their turn. `/mcp` applies Provider Settings' proxy and sharing checks,
+ requires a Host on the port it reached and an Origin from that host, and
+ times out request bodies after 30 seconds; stdio honors
+ `notifications/cancelled`. Embed mode is no longer framable unless
+ `GEV_EMBED_FRAME_ANCESTORS` allows the framing page, and view answers go
+ only to the origin that sent the view. SECURITY.md describes the MCP surface
+ and the panel's browser keys.
+
+ - Cockpit now enters on the existing matching map style while keeping one fixed,
+ duplicate-free carousel over `Normal / CRT / NVG / FLIR / Anime / Noir / Snow`.
+ Normal remains a real unfiltered option; Cockpit-only choices still restore
+ the captured map style through both Exit Cockpit and Reset.
+ - Cyber's compact right-rail and Cockpit utility buttons now center their glyphs
+ vertically and share the same inset and edge alignment.
+ - Keep Cyber Voice help/error popups and Location/Visual Presets pins clear of
+ their decorative frames. Leave space above attribution for its full logo row.
+ - Add an intentionally future-facing, opt-in panel surface contract for new
+ panels to inherit compatible Normal, Cyber and Cockpit styling. Its first
+ production adopter will land separately after this change.
+ - Restore the user's previous visual preset when they explicitly switch from
+ Cyber to another HUD layout, without overriding scene or shared-link state.
+ - Move the aligned Cyber side-panel rails upward on desktop so the left stack
+ clears the lower coordinate card; keep Cockpit's independent visor layout.
+
+ ## [0.2.0] — 2026-10-02 — God's Eye View through Your Agent
+
+ - Show God's Eye View inside AI conversations. Answers that can be shown
+ include a view (camera, layers, style, map, marks, something to follow),
+ and `show_in_gods_eye_view` displays it as the live globe in clients that
+ support MCP Apps, such as Claude Desktop and the Codex and ChatGPT desktop
+ apps, and as a link everywhere else. The panel loads the app's panel build
+ (`npm run build:panel`) and its data through the MCP server, so a local
+ server needs no HTTPS or tunnel. `?embed=1` shows the globe alone for pages
+ that frame the app.
+
+ - Add tools for language-model clients and a local MCP server, served over
+ stdio by `npm run mcp` and over HTTP at `/mcp` on the development and preview
+ servers for local requests only. `npm run mcp`
+ serves earthquake, active-fire, launch, aircraft, ship, satellite, camera, radio,
+ place, routing, bike-share, transit, traffic, weather, cyclone, fire-perimeter,
+ terrain, installation and map-feature queries, plus a situation brief, over
+ stdio to clients such as Claude Code, reading
+ from a running app. Tools are defined
+ once in `gods-eye-view/tools`, reuse the layers' source factories, and are
+ exposed through the protocol adapter in `gods-eye-view/tools/mcp`. The
+ catalog also covers weather maps, wind, recent imagery, submarine cables,
+ license plate reader cameras, datacenters and dams, the Bhote Koshi flood,
+ military awareness and links that open the app over an area with layers on.
+ Voice offers the same queries next to its app actions.
+
+ - Public Overpass instances are no longer used by default. Street Traffic
+ roads come from TomTom flow tiles, OpenFreeMap vector tiles, or both, chosen
+ on the layer row (TomTom / OSM / Hybrid) or with `?trafficRoads=`. With a
+ TomTom key the default is Hybrid: TomTom roads with live flow, plus
+ OpenFreeMap roads TomTom does not cover, simulated. Without a key every
+ choice draws OpenFreeMap roads. TomTom mode shows only roads with flow; OSM
+ mode matches TomTom flow onto OpenFreeMap roads for congestion colors,
+ speeds and closures, and unmatched roads stay simulated. Road failures name
+ OpenFreeMap and retain HTTP status or timeout reasons separately from TomTom.
+ Flow coverage counts
+ rendered dots on roads with flow; mapped military areas come from OpenFreeMap and
+ follow settled camera changes with cached tiles and retained site entities.
+ Superseded requests preserve the next view’s pending load.
+ Tile and API transports can be injected independently; the optional Overpass
+ ALPR adapter remains available.
+ OSM-derived layers share one attribution entry and a persistent inline map credit,
+ including routing, Warendorf cameras, datacenters, dams and the Nepal locator.
+ Military areas use bundled Overture/OSM names; wide views show bounded,
+ decluttered named points that follow camera motion while Contacts holds a subject,
+ using the shared world-overlay host for wide-point and polygon titles. Polygons appear while names load; cancelled views
+ cannot publish late names, and stalled name downloads can retry. Merged groups
+ keep their identity and parent name when a pan hides the largest member. Late
+ names reconcile ids across zooms while retaining selection and marker ownership. Wide
+ named points remain visible until matching close polygons take over. Installation
+ titles share datacenter/dam card arbitration and keep incumbents while panning.
+ Selecting an installation replaces its label with one card; deselection restores it.
+ Selected footprints receive a translucent fill draped on the active map surface.
+ ALPR cameras come from an hourly OpenStreetMap extract (US and Canada). Features
+ without a replacement say they are unavailable; area and footprint
+ annotations check once whether an Overpass instance is configured and skip
+ the query when none is. Area annotations outline countries, states and provinces
+ (Natural Earth, including UK constituent countries) and US counties (US Census Bureau) from bundled data, with no
+ lookup. County names are disambiguated across countries by aliases, qualifiers
+ and geography. `OVERPASS_UPSTREAMS` sets an
+ Overpass instance you run or pay for. The cockpit regional brief resolves
+ regions from bundled Natural Earth data instead of Nominatim. Traffic starts on enable and paints
+ locally grounded roads incrementally, shares concurrent tile requests and
+ reuses validated heights across pans. Camera moves and arriving tiles retain
+ existing traffic dots on their roads; budget changes fade in/out incrementally,
+ height refinements ease vertically, and live flow changes color and speed in
+ place. The traffic footprint follows the reticle square at oblique angles, with
+ cached detailed near tiles and coarse distant roads. Failed detail tiles retain
+ coarse roads and retry at most three times. Road-pass deadlines also cancel
+ queued tile paints and terrain callbacks;
+ off-screen height corrections cannot hold loading open, and visible corrections
+ stay pixel-limited at canvas and camera-plane boundaries. Completed road snapshots replace
+ streamed previews without duplicating roads. Unresolved previews no longer delay or suppress detailed street roads.
+ Road admission excludes private, parking, walking and unknown traffic categories;
+ OpenStreetMap service ways and tunnels no longer receive surface vehicles.
+ Detail tiles load alongside previews, arrival bypasses the movement debounce,
+ and geographically validated rendered depth avoids repeated mesh redraws.
+ Traffic releases surface-frame listeners on disable/destroy and reuses unchanged
+ surface identities without frame-by-frame allocations.
+ Grounded dots respect building occlusion instead of drawing through roofs,
+ and the traffic status chip reports completion without a delayed text animation.
+ Short road chunks and local surface elevation keep the budget on visible
+ streets in elevated cities. Congestion and closures respect travel
+ direction. ALPR distinguishes unsupported coverage from empty results and
+ asks for zoom-in before exceeding its tile budget. Installation footprints
+ retain visible fragments without joining separate parcels across zooms or
+ across quantization gaps between different mapped identities. Keyless
+ terrain tiles retry HTTP 429 and transient gateway failures with bounded,
+ shared backoff. Operator-configured Overpass area and footprint queries
+ retain relation member geometry so their outlines remain available.
+ Contacts filters mapped installations to a true 100 km surface radius around
+ the current tracked subject,
+ including in Cockpit, instead of "?" or nothing. Search arrivals frame against the resolved
+ ground and lift the eye above the rendered surface, so Camp Mabry and Denver
+ no longer land underground (Milan Khanal, #118). Arrival corrections yield to
+ new camera owners and are cancelled on layer/app teardown. ALPR floor preparation
+ and marker placement share terrain requests, cancelled when the layer is disabled.
+ Map-source changes reposition every ALPR marker without replacing entities. ALPR loads
+ whole-city views from z9-z12 tiles, drops native ground wedges and clamping,
+ keeps frame time with ALPR on within a few percent of ALPR off, seats nearby
+ badges on the rendered surface and says when no loaded camera is on screen.
+
- CCTV cameras whose bearing is a guess now say so. Packs mark bearings derived
from a hash of the camera id as `headingConfidence: 'low'`, but nothing read the
flag, so roughly 70% of a default catalog rendered like surveyed facings. The HUD
diff --cc docs/CURRENT-STATE.md
index 8a6cde193,26d56e66b..ba3289569
--- a/docs/CURRENT-STATE.md
+++ b/docs/CURRENT-STATE.md
@@@ -771,6 -1030,6 +1030,12 @@@ panel, and honors keyboard focus on th
desktop allocation styles. Stable Display allocation avoids unnecessary style
writes. This extraction does not change panel positions or layout defaults.
++A Context expansion, whether through a repeated panel-owner call or a right
++rail restore after tactical auto-collapse, dismisses any open compact Radio
++disclosure before revealing Context content. The compact launcher still works
++while Context remains collapsed. This is an ownership invariant, not a
++z-index workaround (#804).
++
## Surface keyboard lifecycle
`ui/surfaces` owns the capture-phase keyboard listener, Tab cycling and return
diff --cc scripts/format-scope.json
index 507ee3126,6b5c9b544..1adb4d050
--- a/scripts/format-scope.json
+++ b/scripts/format-scope.json
@@@ -650,8 -670,7 +670,8 @@@
"src/ui/shareRestoration.js",
"src/ui/visualSettings.js",
"src/ui/panelChrome.js",
- "src/testSupport/readShellSource.mjs",
+ "src/ui/panelChrome.radioOwnership.test.mjs",
+ "src/testSupport/readShellSource.mjs",
"src/ui/stateOwners.test.mjs",
"src/layers/flights/records.js",
"src/layers/flights/recordPolicy.js",
diff --cc src/ui/panelChrome.js
index 0717a1313,284d2b1b2..757d7e0be
--- a/src/ui/panelChrome.js
+++ b/src/ui/panelChrome.js
@@@ -488,17 -487,6 +501,15 @@@ export class PanelChrome
syncShare,
});
}
- // Parent ownership is an invariant even on a no-op disclosure request.
- // A stale compact Radio disclosure is absolutely positioned outside the
- // measured Context rail; clear it before returning from an already-open
- // Context request so it cannot paint over the active Context body.
++ // A repeated Context-open request must clear a stale compact Radio mini
++ // even when no collapsed class changes.
+ if (
+ !nextCollapsed &&
+ panelId === 'global-context-panel' &&
+ this._contextRadioDock?.classList.contains('disclosure-open')
+ ) {
+ this._setRadioDisclosure?.(false);
+ }
if (
panelEl.classList.contains('collapsed') === nextCollapsed &&
!wasAutoCollapsed
diff --cc src/ui/panelChrome.radioOwnership.test.mjs
index 1ecc1c7b9,000000000..c169ae67c
mode 100644,000000..100644
--- a/src/ui/panelChrome.radioOwnership.test.mjs
+++ b/src/ui/panelChrome.radioOwnership.test.mjs
@@@ -1,136 -1,0 +1,133 @@@
+import assert from 'node:assert/strict';
+import test from 'node:test';
+
+import { PanelChrome } from './panelChrome.js';
+import { PanelLayoutController } from './panelLayoutController.js';
+
+function classList(initial = []) {
+ const values = new Set(initial);
+ return {
+ contains: (value) => values.has(value),
+ add: (...items) => items.forEach((item) => values.add(item)),
+ remove: (...items) => items.forEach((item) => values.delete(item)),
+ toggle(value, force) {
+ if (force === true) values.add(value);
+ else if (force === false) values.delete(value);
+ else if (values.has(value)) values.delete(value);
+ else values.add(value);
+ return values.has(value);
+ },
+ };
+}
+
+test('opening an already-open Context still closes a stale compact Radio disclosure', (t) => {
+ const priorDocument = globalThis.document;
+ const contextPanel = {
+ id: 'global-context-panel',
+ classList: classList(),
+ };
+ globalThis.document = {
+ documentElement: { dataset: { uiTheme: 'tactical' } },
+ getElementById(id) {
+ return id === 'global-context-panel' ? contextPanel : null;
+ },
+ };
+ t.after(() => {
+ globalThis.document = priorDocument;
+ });
+
+ const radioDock = { classList: classList(['disclosure-open']) };
+ const calls = [];
+ const owner = {
+ _contextRadioDock: radioDock,
+ _setRadioDisclosure(open) {
+ calls.push(open);
+ radioDock.classList.toggle('disclosure-open', open);
+ },
+ _leftPanelStack: null,
+ _rightPanelStack: null,
+ _panelLayout: {
+ _leftStackPreferredPanelId: null,
+ _rightStackPreferredPanelId: null,
+ },
+ _syncPanelCollapseButton() {},
+ _scheduleLeftPanelLayout() {},
+ _scheduleRightPanelLayout() {},
+ shareLinkManager: null,
+ cockpitView: null,
+ };
+
+ PanelChrome.prototype.setPanelCollapsed.call(
+ owner,
+ 'global-context-panel',
+ false,
+ );
+
+ assert.deepEqual(calls, [false]);
+ assert.equal(radioDock.classList.contains('disclosure-open'), false);
+});
+
+test('adaptive rail restore hides compact Radio before revealing Context', (t) => {
+ const priorRaf = globalThis.requestAnimationFrame;
+ let nextFrame;
+ globalThis.requestAnimationFrame = (callback) => {
+ nextFrame = callback;
+ return 1;
+ };
+ t.after(() => {
+ globalThis.requestAnimationFrame = priorRaf;
+ });
+
+ // Valid starting state: the tactical rail automatically collapsed Context,
+ // and the user opened the compact Radio controls from its header.
+ const contextPanel = {
+ id: 'global-context-panel',
+ classList: classList(['collapsed', 'layout-auto-collapsed']),
+ };
+ const radioDock = { classList: classList(['disclosure-open']) };
+ const radioMini = { hidden: false };
+ const calls = [];
+ const chrome = {
+ _contextRadioDock: radioDock,
+ _setRadioDisclosure(open) {
+ calls.push(`disclosure:${open}`);
+ radioDock.classList.toggle('disclosure-open', open);
+ radioMini.hidden = !open;
+ },
+ _syncPanelCollapseButton(panel) {
+ calls.push(`button:${panel.id}`);
+ },
+ };
+ const layout = {
+ destroyed: false,
+ _rightStackLayoutFrame: null,
+ _rightStackReconsiderAutoCollapse: false,
+ _rightPanelStack: {
+ querySelectorAll: (selector) =>
+ selector === '.layout-auto-collapsed' ? [contextPanel] : [],
+ },
+ _syncPanelCollapseButton(panel) {
+ PanelChrome.prototype._syncRailPanelCollapseButton.call(chrome, panel);
+ },
+ _syncRightPanelAdaptiveLayout() {
+ calls.push('layout');
+ },
+ };
+
+ PanelLayoutController.prototype._scheduleRightPanelLayout.call(layout, {
+ reconsiderAutoCollapse: true,
+ });
+ assert.equal(contextPanel.classList.contains('collapsed'), true);
+ assert.equal(radioMini.hidden, false);
+ nextFrame();
+
+ assert.equal(contextPanel.classList.contains('collapsed'), false);
- assert.equal(
- contextPanel.classList.contains('layout-auto-collapsed'),
- false,
- );
++ assert.equal(contextPanel.classList.contains('layout-auto-collapsed'), false);
+ assert.equal(radioDock.classList.contains('disclosure-open'), false);
+ assert.equal(radioMini.hidden, true);
+ assert.deepEqual(calls, [
+ 'disclosure:false',
+ 'button:global-context-panel',
+ 'layout',
+ ]);
+});