Merge origin/main into byrdit/cctv-visible-only-fetch

This commit is contained in:
German Khokhlov committed 2026-11-19 18:33:29 +04:00
commit d19ae89630
445 files changed
+27359 -9232

No files matched your search

@@ -0,0 +1,7 @@
- `F` now collapses and reopens the Data Layers panel the way the panel's own
button does, and its rail entry stays. Before, `F` hid the panel together
with its rail entry, so only another `F` brought it back. When `F` or a
panel's collapse button hides a panel that holds the focus, including one
the opened panel folds away, the focus moves to that panel's rail entry;
in Cockpit, focus in the Contact card it folds moves to the card's expand
button (asturksever, #1598).
@@ -0,0 +1,7 @@
- Make earthquake discs and magnitude labels selectable, with magnitude, USGS
class, depth, location, time and source details. Labels also fly to the quake;
the selected disc shows a fading gradient and bounded contour animation. A
drag ending on a quake does nothing. The card or label painted on top now
takes a click in every layer: what is drawn under it neither acts nor loses
its selection, and the Context panel names nothing there
(Manjunath, @manjunath22466, #1781).
+12
View File
@@ -0,0 +1,12 @@
- Add the Omnibar: one field for places, coordinates, map items, layers
and commands, with a strip of nearby places, guided walks through the
real controls (found by everyday wording such as "how do I change the
map style"), plans such as "go to Austin and show flights", and Ask GEV
for questions. On desktop the dock rises to a bar above the bottom with
the map credits below it on the Power Up row, World Time hides while
suggestions or chat are open, and the dock's Location and Visual trays
and the HUD's mode readout give way to the Omnibar and the Visual panel.
Phones get the field too, with the HUD readout under it on short
screens. The last 20 places you went to from the Omnibar are kept in
this browser (`localStorage` `gev:omnibar:recent-places`)
(manjunath22466, samehkhamis, #1824).
+10
View File
@@ -0,0 +1,10 @@
- Remove the Cyber HUD layout and keep its sonar as a visual style. Display >
HUD > Sonar turns it on over Tactical or Minimal; it is off by default and
ON reveals its five sliders. Share links, scenes and saved views that name
Cyber open in Tactical with Sonar on, links and scene shots carry Tactical
with Sonar the same way, and the `set_cyber_sonar` voice action works under
any layout. A newer Sonar choice takes precedence over a pending share-link
restore. From 1200px wide the command dock and World Timeline sit 74px up,
the map attribution sits on the Power Up baseline, and the coordinates start
level with the bottom-right readout instead of overlapping the attribution
and Power Up (manjunath22466, samehkhamis, #1825).
+16
View File
@@ -0,0 +1,16 @@
- Space Missions moves out of the Context panel into its own right-rail panel,
with its own tab on phones, and becomes an ordinary layer. It no longer
switches other layers off or refuses them while it runs, and Context leaves
it and Satellites alone, so it runs beside Contacts in either order
(Contacts no longer switches Satellites off). On desktop, opening Context or
Space Missions collapses the other. Mission labels on the globe are
clickable and select their mission, even where they sit over aircraft or
ships, and picking a mission on the globe opens the panel. The Data Layers
row gets previous and next mission controls. Share links keep the panel
open or closed (a short link made from an older long link, which does not
mention the panel, is two bytes longer), voice can open it, and Cockpit
folds it away like the other map panels. An explicit user or voice
Satellites off request made after Space Missions was switched on ends it
and keeps Satellites off afterwards; scene, story, preset and other
programmatic Satellites changes leave Space Missions running
(manjunath22466, samehkhamis, #1826).
+5
View File
@@ -0,0 +1,5 @@
- Replace the first-run launcher with a three-step welcome: an introduction to
the modes, where to start (Space Missions, Environmental or Explore
manually), then quick tips and links. The Live Contacts starting choice is
gone. GEV Stories opens in the app from the last step, and a light tint (no
blur) sits over the globe while the card is up (manjunath22466, samehkhamis, #1827).
@@ -0,0 +1,5 @@
- The fire layer takes a stand-in for its markers (`setMarkerStandIn`), for an
application that draws the same detections another way: the markers,
heatmap and ambient cards hide, and a click on a fire the application draws
selects it and moves the camera to it, with its card, as a click on its
marker does (samehkhamis, #1828).
+9
View File
@@ -0,0 +1,9 @@
- Space Missions going off no longer acts on a launch hovered, selected or
replayed meanwhile, and Satellites keeps the state it was saved with when
it is still busy (unless it was switched on or off by hand meanwhile); a
Satellites setting changed during a mission, such as a place search ending
tracking, is kept when the mission ends. A click on a mission label is a
click on the card on top, so no layer selects, turns on, flies to or opens
the link of what lies under it; in the cockpit a mission chosen by its
label, its dot or the row's arrows is selected without moving the camera
(manjunath22466, samehkhamis, #1829).
+7
View File
@@ -0,0 +1,7 @@
- More private text typed into the Omnibar or Location search stays off the
place service: emails spelled out or spaced, IP addresses, wallet recovery
phrases, door, alarm and lockbox numbers, codes after their labels,
document and ID numbers, SSNs, more API token shapes and codes in links.
More real places get through: "Boise ID 83702", house numbers in the
order their country writes them, addresses of up to ten words, and long
questions for Ask GEV (manjunath22466, samehkhamis, #1830).
+7
View File
@@ -0,0 +1,7 @@
- The Omnibar reads more lines the way they are meant: a country named with
"and" stays whole ("flights near Trinidad and Tobago"), places show as they
were typed, "hide everything except flights" switches off every other
layer that is on, "remove flights from the map" and a doubled verb are
understood, a grid reference after "near" is the place, and a layer word
that begins a name ("Fire Island") no longer offers a plan to the rest of
it (manjunath22466, samehkhamis, #1831).
@@ -0,0 +1,3 @@
- The fire layer's marker stand-in can set how far the camera stands from a
fire it draws (`focusRangeM`), and a world focus request may carry its own
range (samehkhamis, #1832).
@@ -0,0 +1,4 @@
- Keep the HUD's bottom corners, the Omnibar dock and the corner row clear of
the map credits at every desktop width, also right to left and when the
credits wrap onto several lines; and carry Sonar with the Minimal HUD layout
in share links and scene shots (manjunath22466, samehkhamis, #1833).
+5
View File
@@ -0,0 +1,5 @@
- Renderer contract: a timed imagery source can be `decoded` (the
`imageryDecoded` capability), tiles the application makes itself and hands
over as finished images, slot by slot; the Cesium renderer draws each slot
as an imagery layer of its own, and the check `globe.imagery.decoded` covers
it (Sameh Khamis, #1834).
@@ -0,0 +1,3 @@
- Icons drawn over depth (aircraft, vessels) no longer vanish for a frame now
and then in dense far-away clusters: they sit just past the near plane instead
of exactly on it, where rounding could discard them (samehkhamis, #1835).
+3
View File
@@ -0,0 +1,3 @@
- The delayed-live aircraft icon test holds the clock still while it compares
drawn and read positions, so it no longer fails on a busy machine
(samehkhamis, #1836).
+4
View File
@@ -0,0 +1,4 @@
- Keep the left and right panel rails clear of obstacles across the middle
of a short window, such as the World Timeline or a card: both rails put
the panels on the side with more room, whatever order the obstacles come
in (manjunath22466, samehkhamis, #1837).
@@ -0,0 +1,4 @@
- "Villages near" a name picks the place of that name in view over a far
bigger namesake, a place lookup reads the detail tiles within 500 km at
most, and rebuilding the places pack never leaves it half removed
(manjunath22466, samehkhamis, #1838).
+4
View File
@@ -0,0 +1,4 @@
- The Vue kit's button, chip, badge, empty state and segmented control now
carry Core's standard looks, so controls can be built from the kit without
restyling them; nothing in the app changes look (manjunath22466,
samehkhamis, #1839).
+3
View File
@@ -0,0 +1,3 @@
- Every close, dismiss and clear button in the views is now one kit
component, `UiCloseButton`, with the same look and behaviour as before
(manjunath22466, samehkhamis, #1840).
+3
View File
@@ -0,0 +1,3 @@
- The Context panel search and the Layer Finder search are now one kit
component, `UiSearchField`, with the same look and behaviour as before
(manjunath22466, samehkhamis, #1841).
+4
View File
@@ -0,0 +1,4 @@
- The Visual panel's toggles, the voice settings, the Data Library's
"available only" box and the welcome screen's "Don't show this again" are
now one kit component, `UiCheckbox`, with the same look and behaviour as
before (manjunath22466, samehkhamis, #1842).
+5
View File
@@ -0,0 +1,5 @@
- The Data Library and scene sharing dialogs are now one kit component,
`UiDialog`. A scene sharing dialog the browser closes on its own now
cancels through its owner, so the next share is not blocked, and a late
close event no longer shuts a dialog opened again since (manjunath22466,
samehkhamis, #1843).
+3
View File
@@ -0,0 +1,3 @@
- The data credits line and its list are now a single-file component. The
close button is the kit's, and a focused link keeps focus when the list
redraws (manjunath22466, samehkhamis, #1844).
+3
View File
@@ -0,0 +1,3 @@
- The Québec CCTV camera window and its map marker are now a single-file
component with the kit's close and buttons, and the window's labels follow
the language at each update (manjunath22466, samehkhamis, #1845).
+3
View File
@@ -0,0 +1,3 @@
- The Omnibar's guided walk is now a single-file component with the kit's
close and buttons, and a walk started while the page is still drawing no
longer fails (manjunath22466, samehkhamis, #1846).
+2
View File
@@ -0,0 +1,2 @@
- The Omnibar's mic, suggestion strip chips and glyphs are now kit controls,
with the same look and behaviour (manjunath22466, samehkhamis, #1847).
+2
View File
@@ -0,0 +1,2 @@
- The welcome card's buttons and glyphs are now kit controls, with the same
look and behaviour (manjunath22466, samehkhamis, #1848).
+2
View File
@@ -0,0 +1,2 @@
- The Visual panel's buttons and glyphs are now kit controls, with the same
look and behaviour (manjunath22466, samehkhamis, #1849).
@@ -0,0 +1,2 @@
- The entity card's buttons and glyphs are now kit controls, with the same
look and behaviour (manjunath22466, samehkhamis, #1850).
@@ -0,0 +1,2 @@
- The Layer Finder's buttons and glyphs are now kit controls, with the same
look and behaviour (manjunath22466, samehkhamis, #1851).
+3
View File
@@ -0,0 +1,3 @@
- The Stories views' buttons and Explore's filter checkbox are now kit
controls, with the same look and behaviour (manjunath22466, samehkhamis,
#1852).
+1 -2
View File
@@ -781,8 +781,7 @@ palettes use `--gev-field-background`, `--gev-field-border-color`,
`--gev-field-color` and `--gev-field-disabled-opacity`. Radio retains its own
compact density and arrow space. CCTV owns calibration editor width in
`cctv.css`; the shared inline density does not impose a feature-specific width.
Cyber supplies a shared-field palette explicitly and keeps its legacy native
field rules separate, so Radio's palette remains an intentional exception.
Radio's palette remains an intentional exception.
### Read-only status badges
+602 -137
View File
@@ -846,8 +846,7 @@ detection, style parameters, 3D aircraft, Scope and Clean UI; Effects,
Celestial, Bloom and Sharpen; and Reset to default at the foot. Each control
is a card (`src/ui/styles/visual-panel.css`) whose header row ends in an
on/off pill worded in the current language (Clean UI, an action, has none;
the buttons carry their state as `aria-pressed`). Under the Cyber HUD the
cards keep Cyber's own red skin. The presets and chips call the
the buttons carry their state as `aria-pressed`). The presets and chips call the
same Display store actions as the dock's Visual Presets tray, which stays on
desktop and phone as before, along with Location; voice `Visual Presets`
still opens that tray. On a phone the More sheet shows that tray right above
@@ -872,8 +871,7 @@ the out-of-the-box look: the Normal style, the first-run post defaults
(bloom off, sharpen on at 49%, the HUD shown, Dense detection at 75%
with its fade and outside opacity, the celestial ring off), Elastic
allocation, Scope on at 100% feather and 100% opacity, and 3D aircraft on in
Proximity. The HUD layout follows the Normal style, as choosing it does: the
Tactical HUD, except that the Cyber HUD stays Cyber. Inside Contacts, which
Proximity. The HUD layout stays as the viewer set it. Inside Contacts, which
lends detection for the session, the reset's detection becomes what leaving
Contacts puts back and what a share link carries. It leaves the map source, the pinned scope terminus, Sonar's
settings, other styles' parameters, the layers and the panels alone.
@@ -937,10 +935,10 @@ the header narrows every list. Expanded, Context becomes a full-height
column at the right edge (the left edge right to left) and the map credits
stop short of it.
The Contacts and Space Missions modes and the Radio strip stay in the
panel's main tab, below the card. When Contacts follows the aircraft the
card shows, its list sits inside the card. Turning Radio or Launches on
opens Context. The Properties tab holds the Labels and 3D aircraft
The Contacts mode and the Radio strip stay in the panel's main tab, below
the card. When Contacts follows the aircraft the card shows, its list sits
inside the card. Turning Radio on opens Context. Space Missions is not part
of Context: turning it on opens its own Space Missions panel. The Properties tab holds the Labels and 3D aircraft
settings from Visual while a layer they act on is on.
Context does its reading only while its panel is open. Weather and news
@@ -968,7 +966,8 @@ the fleet set loaded at startup, so opening a card fetches no model.
country and Wikidata id. `src/data/wikidataCities.js` reads it on the first
lookup and answers `nearestCity` (the largest city within 12 km, else the
nearest within 60 km), `citiesAround`, `findPlace` ("Paris, France", or the
nearest namesake within 150 km of the view, else the largest) and
nearest namesake within 150 km of the view, else the largest; asked to, it
counts the smaller places of the detail tiles near the view too) and
`countryName`. Names match without case or accents ("lodz" finds Łódź). The
app never calls Wikidata; `scripts/build-wikidata-cities.mjs` rebuilds the
pack and fails if well-known cities are missing or a known grouping such as
@@ -1013,9 +1012,9 @@ and Radio through the cockpit layout pass, whose floor
matches it, so an open panel still stops short of the briefing. Contact and
Live Signals are shorter, in the same glass, with the briefing's rows and
weather tiles tightened; Regional News stays a briefing page. In a right-to-left language, the rail keeps its
physical side as the cockpit's other windows do. The Cyber HUD and the phone
keep their own cockpit layouts, with the Display and Radio launchers as
before, and edge mode does not apply in the cockpit.
physical side as the cockpit's other windows do. The phone keeps its own
cockpit layout, with the Display and Radio launchers as before, and edge mode
does not apply in the cockpit.
## God's Eye View in conversations — October 2, 2026
@@ -1117,73 +1116,98 @@ at 70% opacity behind telemetry, vertical metadata and scene chrome. Original
HUD text color, glow and opacity are preserved. Scope OFF brightens the tagline
and Active Style label with the shared secondary text color. The title plate
covers the eye and title without moving the title or tagline. Scope ON retains
the original HUD presentation; Cyber retains its existing skin.
the original HUD presentation.
`node scripts/qa-scope-hud.mjs` checks native input, range, layout persistence,
restoration and both Scope presentations. `QA_SCREENSHOT_DIR` saves screenshots.
## HUD layouts — October 29, 2026
Display > HUD > Layout offers Tactical, Minimal and Cyber; the `set_hud` voice
action accepts the same three. The Operator layout is retired. Share links
Display > HUD > Layout offers Tactical and Minimal; the `set_hud` voice
action accepts the same two. The Operator layout is retired. Share links
keep its enum code so older links still parse, and a link, scene or saved state
that names Operator restores the default Tactical layout. Operator was the
only layout that showed the HUD's top banner bar, so its markup and styles are
removed too.
## Cyber HUD — September 30, 2026
## Sonar visual style — November 18, 2026
Display > HUD > Layout includes Cyber, also available through the HUD voice
action and shared visual state. An explicit first transition into Cyber selects
FLIR with Ironbow 0.42. An explicit switch back to another HUD layout restores
the visual preset used before Cyber; restored links and scenes remain
authoritative. The skin uses shared red/slate panel treatments in map and cockpit,
with compact 200px collapsed controls and wider expanded panels. Other HUD
layouts retain their existing presentation.
Chamfered panel expand/collapse controls use an inset keyboard-focus outline and
red hover border in both map and cockpit, so clipping does not hide the highlight.
Cyber's map-side right rail opens one panel at a time while keeping collapsed
launchers available. Display, CCTV and Context scroll their contents inside fixed
headers and decorative frames. The narrow-screen rail remains scrollable to reach
each panel. Radio retains the shared nested Context player without relocating
playback controls on theme changes.
Voice help/error popups and Location/Visual Presets pins extend beyond their
Cyber frames without being clipped: the shapes decorate non-interactive
pseudo-elements. The lower-left telemetry card leaves room for attribution's
full logo row. New panels can use the [shared surface contract](panel-surfaces.md)
for theme tokens, rail input and a fixed header with a bounded scroll body.
The contract is intentionally future-facing and opt-in; its first production
adopter will land after this change. Existing owners still control disclosure,
persistence and placement, while small-screen rail popup clipping and other
integration limits remain documented in the contract.
On desktop, Cyber raises the left rail so it clears the lower coordinate card.
`layoutRightPanelRail` reads that rendered top as its measured `baseTop`, which
keeps the right rail aligned. Cockpit retains its separate rail placement for
its visor layout.
The Cyber HUD layout and its shell skin are removed. Its sonar stays as an
opt-in visual style over Tactical or Minimal: Display > HUD > Sonar is OFF by
default, and ON reveals the Rings, Range, Power, Opacity and Sector sliders.
Share links, scenes and saved views that name Cyber keep its enum code and
open in Tactical with Sonar on. Links and scene shots record Tactical with
Sonar on under that same code, so older builds still read it. Minimal with
Sonar on is recorded as Minimal plus an explicit Sonar mark: flag bit 5
(`hudSonar`) of a compact link, `hs=1` in the long form, and `hud.sonar: true`
in a scene shot. A restored state turns Sonar on when it names Cyber or carries
that mark, and off otherwise, so a link or shot made before the mark restores
as it always did.
An explicit Sonar toggle or validated voice setting takes visual restore
authority, so a delayed share-link restore cannot undo the newer choice.
Choosing Reset Visual keeps the HUD layout and the Sonar setting.
Sonar has one contact-highlighting method. Native Cesium points, billboards and
labels are treated in GPU draw commands without replacing their positions,
identities or pick commands. Model and canvas/DOM overlays retain their own
rendering paths. Sonar OFF stops the sweep while retaining Cyber's neutral
contact treatment. Reduced motion disables the animated sweep; cockpit and
hidden HUD states do not apply the map treatment. If the native shader is not
supported, native contacts remain available and Display reports the limitation.
No CSS scene-dimming fallback or effect selector is exposed.
rendering paths. Sonar runs only while it is on, the HUD is visible and Cockpit
is closed. Reduced motion disables the animated sweep. The sweep's repaint
timer re-arms only after a drawn frame (postRender) that still shows contacts.
If the native shader is not supported, native contacts remain available and
Display reports the limitation. No CSS scene-dimming fallback or effect
selector is exposed.
The Sonar controls adjust rings, range, power, opacity and sector. Sweep opacity
affects detection painting rather than label cohort admission. Theme exit and
renderer teardown release the derived GPU resources and restore owned model
colors without replacing newer layer-owned color changes.
affects detection painting rather than label cohort admission. Turning Sonar
off and renderer teardown release the derived GPU resources and restore owned
model colors without replacing newer layer-owned color changes.
The `set_cyber_sonar` voice action adjusts the same controls without switching
themes or enabling omitted settings. State readback distinguishes configured
settings from active map/contact effects. Sonar settings are session-only and
return to their defaults on reload. Sliders accept integer values matching the
The `set_cyber_sonar` voice action keeps its name and adjusts the same
controls under any HUD layout, without switching layouts or enabling omitted
settings. State readback distinguishes configured settings from active
map/contact effects. Sonar settings are session-only and return to their
defaults (Sonar off) on reload. Sliders accept integer values matching the
action's ranges.
## Bottom-corner placement — November 18, 2026
From 1200px the command dock and the World Timeline sit 74px above the
bottom edge, and the map attribution row sits on the bottom edge on the Power
Up baseline (bottom right when the page runs right to left, where the corner
row moves to the bottom left). A credit line too long for the space before the
corner row wraps upward instead of running under it. The Tactical bottom-right
readout (GSD / ALT / AIS) sits 8px above the Power Up row and the Tactical and
Minimal coordinates start level with it; right to left, where the attribution
row is under it, the readout sits 1.5rem higher and clears two lines of it. The World Timeline is 44rem narrower
than the screen there, so it sits between the corners and they stay put while
it shows. Toasts keep 12px above the raised dock, and the chat and voice panel
height budgets subtract its rise. Below 1200px the dock reaches the bottom
corners, so it keeps to the bottom edge, the attribution row sits above it and
the coordinates clear the row's logo line. In the desktop Omnibar layout the
Omnibar's own rules (`src/ui/styles/omnibar-dock.css`) place the dock, the
World Timeline, the credits and the coordinates; its Tactical bottom-right
readout also keeps 8px above the Power Up row. There the credit line wraps at
every width, right to left it takes the bottom right at every width, and
`src/ui/creditLineHeight.js` keeps its height in `--credit-line-height`: the
coordinates (and, right to left, the Tactical readout) stay 6px above it
however many lines it wraps onto, and the dock and World Timeline rise when
it is taller than their usual clearance. Narrower than 1120px the dock leaves
no room between the corners, so the coordinates and the readout sit above
the dock, and above the World Timeline while it shows. Outside that layout
Cesium's credit box wraps from 1200px, as before; the phone shell, clean
view, recording and scene playback lay the line out themselves.
The left rail treats the centered World Timeline and voice control as
obstacles only where they reach a laid-out panel, not the stack's
transparent gutter. Obstacles across the middle of the window (common in
short windows) form one block with any obstacle that leaves no room between
itself and them, and both rails put their panels on whichever side of that
block has more room up to the next obstacle, above it on a tie, whatever
order the obstacles come in (`bandBesideMidpointObstacles` in
`src/ui/panelRailGeometry.js`); on the left rail the panels may then rise
above the corridor's usual top to use all the room above. With no room on
either side (a side under 8% of the window's height counts as none) the
obstacles are read as before.
Wind appears in the Weather group before Audio. The surface-weather prototype
uses keyless NOAA GFS or ECMWF IFS forecasts on an approximately 1° display grid.
It defaults to 10 m wind trails over the existing basemap. Speed shading is an explicit choice; earlier v2 links retain their original speed-shading meaning.
@@ -2067,6 +2091,51 @@ feed's place, cut to 40 characters (`earthquakeMarkLabel` in
`src/layers/earthquakes/model.js`: `M6.4 · 113 km SSE of Lata, Solomon
Islands`, or `M6.4` with no place).
Clicking a quake's disc selects it; clicking its magnitude label (what a far
view can hit) also flies the camera there through the world-focus request
(`earthquake` framing in `src/worldFocus.js`). The selected quake shows a card
(`describeEarthquake`): magnitude and USGS class (`M5.5 · Moderate`), a
six-step class meter with the depth band, place (cut to 48 characters; the
card's accessible name carries all of it), UTC time and source; with a USGS
event id the card opens that event's page, and without one a click or its
keyboard action flies to the quake. The selection is also the
shared context selection, so "what's selected" answers with it. Its disc is
painted with a gradient fading to the outer circle and wavy contour lines
(shaped by the quake's id, never crossing) under the labels, drawn at the
ground height the disc is draped on (read again, at most twice a second, while
they paint, as the ground loads under a label's fly-to). A label's
fly-to frames the whole disc, scaling its range from the disc's radius above
the M6 framing. The package takes clicks, picking, context, focus, the ground
height, the opener, the painter and the translator by injection
(`src/app/layers/earthquakes.js`); without input and picking it draws and takes
no clicks, and its labels stay non-interactive.
A press that travels past the tracking click limit is a drag, not a pick: the
quake handler ignores it, and opening the source or clearing the selection
also needs a short press (`src/data/trackingClickGesture.js`).
Quake discs are deliberately not registered in the pick-ownership registry,
like drone airspace and fire perimeters: sibling layers read a disc as empty
space, so their near-miss taps and deselection work over a quake as before,
and a disc yields to another layer's registered pick (an aircraft) under it.
The card or label painted on top takes the click. The world-overlay host hands
its hit test to the pick registry (`setClickCardHitTest`), and every click
handler reads the topmost interactive card or label at the click through
`clickCard(click)`, once per click, so all of them agree in any listener order
(`src/data/pickRegistry.js`). A layer whose own card or label is on top acts
on it, whatever is drawn under it: an aircraft, a vessel, a fire, a camera, a
trail, a route. A layer under another layer's card or label
(`isUnderOtherCard`) does nothing: it neither acts on its item there nor
treats the click as empty space, so a tracked aircraft stays tracked and a
selection stays selected. Context (`src/ui/entityContextBridge.js`) names
nothing under a card. With no card on top, the scene rules are unchanged.
World-overlay hit rectangles are what is painted on screen until the next
paint: an overlay change (a click subscriber publishing its selection card)
no longer clears them mid-click, and a paint that draws nothing clears them
(`src/overlays/worldOverlay.js`). A click on the map under another layer's
card opens no Street Level ground image. The Bhote Koshi trigger-record
callout (`src/data/bhoteKoshiLocator.js`) opens its source on a click, as its
keyboard action does, and ignores a drag; its evidence cards act only when
they are the card on top.
Air quality (`./layers/air-quality`) draws its station discs as one renderer
draw set of ground-clamped fills and reads the view through the camera port; it
no longer reaches Cesium, so a caller handing it a Cesium viewer,
@@ -2483,7 +2552,7 @@ change still in flight blocks entry until it settles. Double-clicking the
selected vessel enters it, and the entry button reads BRIDGE with a ship icon
both in Contacts (`#cockpit-entry`) and under the selected vessel's Intel HUD
readout in the bottom-right corner (`#cockpit-entry-readout`, shown with the
HUD on, in its Tactical and Cyber layouts). Turning Live AIS Vessels off ends
HUD on, in its Tactical layout). Turning Live AIS Vessels off ends
the bridge: the layer then has no subject (`getCockpitSubject` returns null).
The bridge picture uses AIS alone, so no other feed being off makes it partial.
Voice (`control_cockpit`) and the selection entry transaction stay aircraft-only;
@@ -2866,13 +2935,23 @@ them.
## Context coordination
Context controls own Contacts/Space Missions state, entry and exit transactions,
layer snapshots and restoration. The application supplies the existing manager,
Context controls own Contacts state, entry and exit transactions, layer
snapshots and restoration. Space Missions is an ordinary layer outside this
owner: the launches layer keeps its own Satellites dependency
(`src/layers/launches/satelliteIntents.js`), and `SpaceMissionsControls`
(`src/ui/spaceMissionsControls.js`) connects it to its panel and store. The application supplies the existing manager,
installations search and camera/panel actions. Tab listeners and pending
presentation work stop during disposal; layer restoration retains its existing
compensation and latest-intent rules. Clear Selected Layers shares this owner,
so an older restore cannot replay over a newer Clear action.
Contacts leaves Satellites on. Contacts is being removed, so no new Contacts
behavior is added here. Only an explicit user or voice Satellites OFF requested
after Space Missions ON ends Space Missions. A scene, story, preset or other
programmatic Satellites OFF leaves Space Missions running: an automatic change
must not undo the user’s explicit choice, and the mission lifecycle remains
independent of Satellites.
## Camera panel ownership
CCTV controls receive the existing camera port and explicit application actions.
@@ -2889,7 +2968,7 @@ The panel opens when a camera becomes active and collapses when the layer is
switched off, from its own switch or anywhere else. The panel chrome applies
the collapse, so a panel the desktop accordion only folded has its saved and
shared state closed too. Clear selected data layers and Context isolation
(Contacts, Space Missions) switch the layer off without the user asking: the
(Contacts) switch the layer off without the user asking: the
panel and its share preference stay as they are, and the layer comes back to an
open panel. Only the switch-off isolation makes counts (`suspendsLayer`, true
while `_clearLayersOutsideContextMode` switches the layer off): the user
@@ -3219,9 +3298,8 @@ owns surrounding layout and context-specific sizing. CCTV's calibration editor
width lives in `ui/styles/cctv.css`, while the shared inline field variant owns
only density and spinner treatment. Radio supplies its field palette and disabled
opacity through the `--gev-field-*` variables, retaining compact typography and
arrow space locally. Cyber supplies shared-field palette variables explicitly;
its legacy native-field palette rules exclude `.gev-field`. These ownership
boundaries preserve the current Tactical/Cyber appearance and native behavior.
arrow space locally. These ownership boundaries preserve the current Tactical
appearance and native behavior.
## Ordinary status badges
@@ -3281,7 +3359,10 @@ Browser acceptance: `QA_BASE_URL=http://127.0.0.1:4173 node scripts/qa-segmented
`ui/input` supplies the bubbling application shortcut listener and generated
shader-parameter rows. Number/style keys, H/O/V/F/D/C actions, native form-control
typing and Escape behavior retain their existing mappings. A shortcut key held
typing and Escape behavior retain their existing mappings. `F` collapses and
reopens Data Layers the way the panel's own collapse button does, so its rail
entry stays; if focus was inside the panel, it moves to that rail entry.
A shortcut key held
with Cmd, Ctrl or Alt runs no shortcut, so the browser's own chord (Cmd+C to
copy, Cmd+F to find, Cmd+1 to switch tab) does not also toggle CCTV, the layers
panel or a style; Shift does not count, and Escape dismisses search either way.
@@ -3362,8 +3443,7 @@ and military aircraft and vessels share this rule; fine pointers stay exact.
Manually opening Context with a tracked civilian or military aircraft enters
the existing Contacts mode when Context is off. Contacts adopts that aircraft
without restarting its tracking; an active or entering Space Missions mode is
left alone. Programmatic sheet changes and closing the tab do not activate a mode.
without restarting its tracking. Programmatic sheet changes and closing the tab do not activate a mode.
Sheets borrow panels. Opening one expands its panels without persisting them or
claiming a user choice, and share links keep reporting each borrowed panel's
@@ -3389,6 +3469,9 @@ state or inert ancestry; ordinary visible enabled controls retain their order.
focus shared by the first-run launcher and Provider Settings. Each caller
activates it while open and deactivates it on dismissal; destruction releases
keyboard ownership without moving focus. Reopening captures the current opener.
Tab from a control outside the surface moves into it unless the caller passes
`claimOutsideFocus: false`, as the first-run launcher does; focus on the page
body still moves in.
The launcher retains its hit-test/exclusive-surface arbitration and dismissal
preferences. Provider Settings retains its existing visibility and save policy.
Initial focus, transitions and DOM content remain with each screen. This
@@ -3846,9 +3929,9 @@ they do not reduce the materialized entity count or establish an FPS gain.
- Display controls and shader-parameter sliders show keyboard focus in both
the map panel and Cockpit Display. Arrow keys retain native range adjustment.
The enabled CCTV camera dropdown shows keyboard focus as well.
- Tab reaches both Contacts and Space Missions in sequence in every Context
state. Left/Right arrows also switch them; the focused tab has a distinct ring
even when selected.
- Tab reaches the Contacts control in Context and the separate Space Missions
rail button when launches are enabled. Both keep a visible focus ring when
active.
- Keyboard focus on a Space Missions roster item uses the same temporary globe
rotation and mission-marker highlight as pointer hover. Focus alone does not
select the mission; Enter or Space performs selection. Keyboard and pointer
@@ -4103,10 +4186,34 @@ which embeds the MAP_KEY.
points to restrictions, quota, or connectivity. These hints do not expose keys.
> **2026-08-23 — first-run mission launcher** (`src/firstRunExperience.js`,
> `#first-run-launcher`, styles at the tail of `style.css`). After startup
> settles, a fresh session gets one card offering **Live Contacts · Space
> Missions · Environmental · Explore manually**. No layer and no optional API
> call happens until a tile is clicked. The right-hand DISPLAY rail
> `#first-run-launcher`, styles in `src/ui/styles/first-run.css`). After startup
> settles, a fresh session gets three steps: mode introduction, a starting
> mission, then quick tips and links. God mode is available; Analyst is
> marked coming soon. **Space Missions · Environmental · Explore
> manually** are the starting choices, with Explore selected by default; Live
> Contacts is no longer offered as a starting mission (its Context tab is
> unchanged). The footer status line stays empty until a mission reports
> progress or an error; the old voice tip is gone. While the card is up, a
> click-through backdrop tints the globe behind it (`.first-run-backdrop`, a
> 28% dark tint with no blur); it never takes input, so the card stays
> non-modal. The last step links out to the GitHub repository and
> its author's channels (YouTube, X, Instagram, LinkedIn, bilawal.ai) and
> halfpixel.ai; each opens in a new tab with `rel="noopener noreferrer"`, and
> the addresses live in `FIRST_RUN_LINKS` (`src/firstRunCopy.js`). The GEV
> Stories card's BROWSE STORIES button closes the card (a session dismissal,
> like Skip) and opens the in-app Stories Explore view, keeping the Stories
> announcement hidden while Stories loads. Next and Back preserve that selection without starting
> a mission. Only **Enter God mode** runs it; Back is inert while it is loading.
> Step changes focus the main action, announce the new heading separately from
> mission progress, and refresh the scrolling affordance after the transition. Repeated Enter keys,
> double-clicks and activation during a step transition cannot launch a mission; a quick second
> click on Next still moves to the next step. Tab cycles inside the card, and moves into it from
> the page only when focus has nowhere else to be: Tab from the search bar or another control
> follows the page's order.
> No layer and no optional API call happens until the final action is clicked.
> The Stories announcement waits, from startup until onboarding closes, without
> marking it seen.
> The right-hand DISPLAY rail
> (`pp-toggles`) now starts **collapsed** on a first run rather than expanded —
> a stored collapse state still wins, as before.
>
@@ -4154,26 +4261,28 @@ which embeds the MAP_KEY.
> `localStorage['gev:first-run-mission:v1'] === 'suppressed'`, written **only**
> by the "Don't show this again" checkbox → the per-session
> `sessionStorage['gev:first-run-mission-session:v1'] === 'dismissed'`, written
> by **every** close path (mission, Explore, ESC, the footer dismiss button). So
> by **every** close path (a mission or Explore from ENTER GOD MODE, ESC, the
> header Skip button, BROWSE STORIES). So
> it returns each fresh browser session until the visitor ticks the box; clearing
> storage un-ticks it, which is accepted. Both stores fail open — an unreadable
> store still shows the launcher rather than silently swallowing first launch.
>
> **The footer dismiss button is the keyboardless ESC.** Phones and tablets have
> no ESC key, so the footer hint is a `data-first-run-dismiss` button that calls
> **The header Skip button is the keyboardless ESC.** Phones and tablets have
> no ESC key, so the header action is a `data-first-run-dismiss` button that calls
> the same `dismiss()` as ESC. It stays visible at every width (phones used to
> hide it, leaving a mission as the only way out) and reads DISMISS on a
> `(hover: none) and (pointer: coarse)` screen, "ESC to dismiss" otherwise. Its
> 44px touch target is a `::before` outside the layout, so the footer row keeps
> hide it, leaving a mission as the only way out) and reads SKIP on a
> `(hover: none) and (pointer: coarse)` screen, "SKIP · ESC" otherwise. Its
> 44px touch target is a `::before` outside the layout, so the header row keeps
> its one-line height.
>
> **What a mission may persist (do not "simplify" this).** Layer enablement is
> durable in this app (`gev:layer-state:v2`, written by
> `LayerStateCoordinator._commitExplicit` only for origin `user`/`voice`/`tool`).
> A mission enables **its own** layers at `origin: 'user'` — durable, exactly as
> clicking those rows is, because picking the mission _is_ that choice. The two
> Context missions also expand the Context panel, as the visible tabs do; the
> globe missions open no panel. Everything else is off limits: detection
> clicking those rows is, because picking the mission _is_ that choice. Space
> Missions switches on its layer, which opens its own Space Missions panel; no
> mission enters a Context mode or opens the Context panel, and the globe
> missions open no panel. Everything else is off limits: detection
> mode/density, `gev:detection-allocation:v1`, 3D models, feather, and above all
> `_detectionUserOverridden` — setting that flag means "the operator hand-edited
> detection" and would silently disable the CRT/NVG/FLIR auto-preset contract for
@@ -4552,16 +4661,10 @@ a number`, exactly `(0,0,0)` returns undefined, and a near-center value such
> cannot slip through by not matching the older spelling. CCTV's
> `selectedCameraId` is the one recorded keep: it raises a monitor plane and
> never writes `viewer.trackedEntity` or the camera.
> (4) An **isolating Context mode is exited before a shot's layers apply**.
> Space Missions refuses every enable outside its replay bundle, so with it
> left dirty all five recipes were refused (or, for Orbital Watch, composed
> over a replay they never declared). The verdict is read off the shared guard
> (`contextLayerEnableBlockReason`), not a mode name, so a future isolating
> mode is covered — the probe id `SCENE_EXCLUSIVITY_PROBE_LAYER_ID` is
> reserved by a test against the real layer registry. The exit itself is the
> ordinary `setContextMode('off')` exact-restore path and is deliberately NOT
> abortable: leaving the mode IS the restore to the operator's pre-mode state,
> and tearing that transaction in half would strand Context. A refused
> (4) Playback leaves every Context mode alone. No mode isolates the globe
> any more (Space Missions is an ordinary layer), so the former exit of an
> isolating mode before a shot's layers apply, and its probe layer id, were
> removed with it. A refused
> `setEnabled` is surfaced in the status line and a `shot_layers_refused`
> telemetry event instead of being reported as success. **Mixed accepted /
> refused layers are reported honestly, not rolled back** — a shot whose
@@ -4704,10 +4807,8 @@ isCurrent })` gates BOTH halves of the map-stack switch, which is its only
> each wing shows only its icon. `CommandDockView.vue` still gives the toggles
> their "Expand/Collapse …" `aria-label` and `title` (`trayWords`), so the
> browser tooltip is the only visible name on hover.
> The Cyber HUD layout is excluded: it sets `--dock-side-compact` to
> 9–9.75rem, which fits its labels. The former ≤620px ellipsis clip is gone:
> the phone shell takes over at 720px, so it never applied to a visible
> dock.
> The former ≤620px ellipsis clip is gone: the phone shell takes over at
> 720px, so it never applied to a visible dock.
> - **LOCATION mini-status is data-only today (2026-08-20):** the collapsed
> readout now follows a free-text geocode search as well as preset pills
> (`src/locationStatus.js` owns the copy for both), and every other camera
@@ -4884,10 +4985,10 @@ down | auth-failed` (plus the unchanged `missing-key`/`unsupported`) with
> selected manager-owned data layers, including an active Context choice,
> while retaining visual, HUD, map, and panel settings. A disabled layer may
> still release camera work that it owns through its normal teardown.
> Direct Data Layers entry into Space Missions excludes the new mission ON
> intent from its pre-entry snapshot. Its OFF control therefore leaves Space
> Missions off and restores Satellites to their exact pre-entry visibility
> and parameter state.
> Space Missions is an ordinary layer and opens no Context session. Its OFF
> control leaves Space Missions off and restores Satellites to their
> pre-mission visibility and parameter state, keeping an explicit Satellites
> action taken while it ran.
> The title and loading logos use a blue 10 px outer-eye stroke with a
> translucent slate fill, while the globe-and-cage gaze travels up to 34 SVG
> units toward the pointer for clearer feedback at the compact title size.
@@ -4895,11 +4996,12 @@ down | auth-failed` (plus the unchanged `missing-key`/`unsupported`) with
> clock goes live and the camera flies to the view the app started from (the
> host's `homeView`, else its `startView`, else the whole planet), letting go
> of whatever it follows as Reset Globe does (`returnToStart()`).
> - **Context, Cockpit, and Radio interaction contract:** explicit Contacts,
> Space Missions, and successful Cockpit actions reveal the Context panel, while
> restoration and replay preserve its prior collapsed state. Contacts uses the
> dedicated right-side chooser; the underlying Global Context coordinator is
> registered for lifecycle and restoration but is not duplicated in Data Layers.
> - **Context, Cockpit, and Radio interaction contract:** explicit Contacts and
> Radio actions and successful Cockpit actions can reveal Context. Contacts
> uses the dedicated right-side chooser. Space Missions has its own rail
> button and panel while launches are enabled.
> Mission teardown clears the selection shown in the panel before restoring
> the Satellites layer, so a failed restore leaves no stale mission details.
> Inside Cockpit, the focused summary card is titled Contact in both visible
> copy and its accessible control labels.
> The top-center Cockpit vision cycle is the fixed, duplicate-free sequence
@@ -4947,7 +5049,7 @@ down | auth-failed` (plus the unchanged `missing-key`/`unsupported`) with
> corridor). Its minimal Display popover exposes Intel HUD,
> Detection, Parameters, and 3D aircraft. During Cockpit, those existing
> standard Display controls move into the Cockpit popover and retain their normal
> nested interaction: HUD plus Tactical/Minimal/Cyber layout, Detection plus
> nested interaction: HUD plus Tactical/Minimal layout and Sonar, Detection plus
> Density/Allocation/Fade/Outside tuning, and 3D plus Proximity/All mode. The
> same nodes and state return to the map Display on exit, so Cockpit does not
> maintain a second control state. **Detection is owned by the CONTACTS
@@ -5593,9 +5695,16 @@ activeCameraCardEnabled: true })` may publish it through the retained
> pitch/heading instruments, altitude/speed tapes, and the signal window.
> Topline vision and exit controls retain the highest in-cockpit layer.
> - **Space Missions dependency shutdown:** disabling a mission dependency or
> leaving the mode closes mission context and restores the exact pre-entry
> Satellite enabled state and presentation parameters. Restored parameters
> never re-show primitives while the Satellite layer is disabled.
> switching Space Missions off restores the pre-mission Satellite enabled
> state and presentation parameters, except that an explicit Satellites action
> taken while it ran is kept. Restored parameters never re-show primitives
> while the Satellite layer is disabled. When Satellites is still busy after
> the 30 s limit, the restore changes nothing and keeps the saved state, so
> switching Space Missions off again finishes it; after an explicit
> Satellites on/off action, which keeps its visibility, the parameters are
> restored all the same and the saved state is let go. While Space Missions goes
> off, its panel's roster and controls select, focus, preview and replay
> nothing, so no camera move starts that nothing would end.
> - **Flights 3D/cockpit hardening:** the destination-direction cue is an
> inline SVG rather than a remotely loaded Material Icons ligature, so a
> blocked or late font can no longer expand the literal word `navigation`
@@ -5636,17 +5745,13 @@ activeCameraCardEnabled: true })` may publish it through the retained
> only for the synchronous selection window, history survives same-layer
> reselection, and NEXT availability uses the same UNKNOWN-cohort gate as the
> navigation action. Contacts entry does not wait for unrelated serialized
> layer teardown; Space Missions waits for every incompatible live/current
> layer to settle off before replay data starts. A rejected teardown keeps
> that layer authoritatively enabled, restores any siblings already stopped,
> and aborts replay entry; the isolation
> guard remains active until Rocket Launches finishes enabling. Manually enabling
> layer teardown. (Space Missions isolation, which waited for incompatible
> layers to settle off, was later removed: Space Missions is now an ordinary
> layer.) Manually enabling
> another Data Layer is additive in both an active mode and the neutral shell:
> it does not exit Context, and the added layer joins the pre-entry snapshot
> when the session is eventually restored. Manually disabling a required mode
> dependency still exits and restores that union.
> While Space Missions is active, direct incompatible enables are refused
> before initialization or polling and explain that the mode must be exited.
> User entry alone owns the pre-entry snapshot; programmatic dependencies do
> not replace it, and rapid re-entry snapshots the pending settled restore
> target rather than partial manager state.
@@ -5702,10 +5807,8 @@ activeCameraCardEnabled: true })` may publish it through the retained
> enabled-layer set and every runtime parameter it changes, then clears
> unrelated active Data Layers. Mode switches, required-dependency disables, direct
> disable, and teardown restore that pre-entry state before control leaves
> Context. Directly switching between Flights and Space Missions remains
> supported without losing the original snapshot. Contacts waits for the
> dependency releases it owns before restoring that snapshot, so the first
> Space Missions selection completes without a stale teardown superseding it.
> Context. Contacts waits for the dependency releases it owns before
> restoring that snapshot.
> - **Space Mission horizon occlusion:** mission dots and hover reticles apply
> their surface-anchor horizon state before Cesium draws or picks the frame,
> while shared-host labels use the same hidden-globe horizon contract. Rear-side
@@ -6427,9 +6530,9 @@ start where the label would round to 10.0 km, so a 9.96 km route displays as
**Keys needed: none.** Directions works on a keyless boot, and the layer is off
until the operator turns it on.
**Context behavior.** Directions is not a Context layer: neither Contacts nor
Space Missions reads it, depends on it, or lists it as a companion. It is
therefore one of the layers an exclusive Context mode switches off on entry
**Context behavior.** Directions is not a Context layer: Contacts does not
read it, depend on it, or list it as a companion. It is therefore one of the
layers the exclusive Contacts mode switches off on entry
(`_clearLayersOutsideContextMode`) and restores on exit, like every other
non-participating layer — the route and both endpoints are cleared with it, and
placing them again is the way back. Cockpit does not touch the layer either,
@@ -6755,8 +6858,8 @@ Required empty or unexercised checks fail acceptance. The passing final line is
cannot claim full acceptance.
**Lifecycle and proxy.** Contacts temporarily disables Transit and restores its
prior state on exit; Space Missions refuses enablement while isolating replay
data. Cockpit does not need Contacts and does not independently enable Transit.
prior state on exit; Space Missions, an ordinary layer, leaves Transit as it
is. Cockpit does not need Contacts and does not independently enable Transit.
The proxy fetches registered URLs only, validates redirect origins, bounds
responses and decoding, caches successful snapshots, and backs off after failed
refreshes. A 304 confirms contact without appending history. Missing vehicles
@@ -7336,19 +7439,19 @@ silently demoting every later lookup for the session.
### Context / Contacts coordinator (July 2026)
- The internal Context coordinator is available in every visual style. Its dedicated right-side `CONTEXT` chooser exposes the neutral shell; the coordinator is not duplicated in Data Layers and does not enable a live-data dependency until a mode is selected.
- The expanded `CONTEXT` view offers mutually exclusive `CONTACTS` and `SPACE MISSIONS` modes. Selecting `CONTACTS` enables the context-owned Flights, Military Flights, AIS Vessels, and Mapped Installations dependencies only when they are not already user-enabled; selecting `SPACE MISSIONS` enables the recent-launch layer and its Satellite dependency. `CONTACTS` cycles the nearest supported contact of whatever type is selected. Satellites are deliberately excluded from those Awareness cohorts and keep their own tracking UX. Selecting the active mode again returns to the neutral chooser and releases only mode-owned dependencies.
- The expanded `CONTEXT` view offers the `CONTACTS` mode. Selecting `CONTACTS` enables the context-owned Flights, Military Flights, AIS Vessels, and Mapped Installations dependencies only when they are not already user-enabled. Space Missions is not a Context mode: it is the ordinary recent-launch layer with its own panel, and it runs beside Contacts. `CONTACTS` cycles the nearest supported contact of whatever type is selected. Satellites are deliberately excluded from those Awareness cohorts and keep their own tracking UX. Selecting the active mode again returns to the neutral chooser and releases only mode-owned dependencies.
- If a civilian or military aircraft is already tracked when `CONTACTS` becomes operational, that source-owned track is adopted as the Context subject before nearest-contact autofocus. Context rechecks the tracker after its dependencies settle, so a newer selection wins, while an explicit clear during activation prevents fallback from silently selecting a replacement. Cockpit entry remains unavailable until that Context transaction has settled, so its camera takeover cannot clear Cesium tracking before adoption. Adoption does not recreate tracking or transfer camera ownership; it initializes the normal 250 km ring, history, proximity results, and Cockpit Previous/Next state for the original aircraft. With no tracked aircraft, an AIS vessel already selected (the vessel layer's `getSelectedInfo()`) becomes the subject, at activation and again when a deferred dependency settles, exactly as a vessel selected while `CONTACTS` is on; no nearest flight is picked and the camera is not moved.
- `SEARCH NEARBY SITES` retains the bounded OSM results and makes one user-initiated, view-biased Google Maps Places text search for “military installation.” Google results are source-stamped, deduplicated against OSM by rounded location/name, and remain mapped context rather than operational claims. If Places is unavailable or the API is not enabled for the supplied key, OSM context remains available. A view across the antimeridian is searched around its own centre, with a radius from its real width.
- The Context header holds only its title and collapse control. It no longer carries a Radio shortcut or a compact Radio player: Radio is the `RADIO` section inside the panel, with its own disclosure and the single `ENABLE` power control. Cockpit keeps its own compact Radio utility.
- Context is set for reading in every theme: mode, standby and action labels are 10 px, and the panel draws no glow halo. Outside Cyber, the two modes form one segmented control, the standby guidance is plain left-aligned text rather than a dashed placeholder, and the panel's section titles share the side panels' dock-label colour. Cyber keeps its separately framed mode buttons, its red panel titles, and in layout-focus a framed, centred standby card over its radar art.
- Context is set for reading in every theme: mode, standby and action labels are 10 px, and the panel draws no glow halo. The two modes form one segmented control, the standby guidance is plain left-aligned text rather than a dashed placeholder, and the panel's section titles share the side panels' dock-label colour.
- The expanded desktop header omits the redundant `ON` label; the active mode button carries state. Expanded Contact results also omit the duplicate `GLOBAL CONTEXT` / `CONTEXT ONLY` status row and begin with the selected subject and its 250 km scope. Global Context does not fabricate a selected-entity model preview: the provisional hand-authored aircraft wireframe was removed because it was not geometry extracted from the selected entity's actual asset.
- Dependency ownership is reversible: disabling Global Context releases only dependencies it enabled, while user-enabled layers remain on. This also removes the Military-layer suppression handoff when Global Context owned Military, allowing an already-enabled civilian Flights layer to resume its normal mixed rendering. If OpenSky is unavailable and has no last-good cache, Flights requests a capped 250 nm adsb.lol point snapshot around the current view anchor and labels that provenance explicitly; it never relabels military-feed rows as civilian data. If both inputs fail, Flights remains `UNKNOWN`.
- Space Missions is replay-isolated: Rocket Launches and Satellites are the only Data Layers permitted while the mode is active. Direct UI and voice entry capture the same pre-entry snapshot; internal dependency and restoration enables do not create a user-owned Context session. Entry waits for incompatible layers to shut down, direct incompatible enables are blocked before lifecycle work, and the entry gate remains active through the complete Rocket Launches enable. That enable includes the first mission-index load: an HTTP error, timeout, network failure or malformed payload before any index has loaded fails the enable, so Context rolls back to the pre-entry layers instead of committing an empty, isolating mode; the camera returns to its pre-entry view unless navigation took it, and a toast says the mission index could not load. A valid empty index still enters, and a refresh failure after an index loaded keeps its records and the mode. Exiting cancels the layer's own camera flights but never one navigation started. A newer same-target ON request takes ownership of the pending entry without releasing its isolation snapshot, including when it arrives while the prior request is awaiting the adoption guard. A caller abort, resource cancellation, newer OFF, or layer teardown waits for exact manager settlement and restores that snapshot without resurrecting Rocket Launches. If an abort lands after only part of a restore settles, Context completes the same exact target without the stale caller signal and then replays newer explicit layer intent. Dedicated Voice Context cancellation reports a stable cancelled result plus the current Context state; generic layer visibility additionally exposes manager phase, reason, successor, and lifecycle details. Once an exact voice visibility intent commits, a newer voice turn cannot relabel it as cancelled while Context settlement completes; pre-commit aborts remain cancellable and final lifecycle mismatches remain failures. Clear Selected Layers reserves its complete captured OFF set before sequential teardown; a newer absolute request of any origin supersedes only its layer reservation and remains authoritative. A rejected layer teardown retains the truthful enabled state, rolls already-stopped siblings back to the captured pre-entry set, and aborts replay; rapid exit/re-entry serializes the full Satellite enabled-state and parameter restore before a new snapshot is taken. Contacts remains additive and restores user-enabled layers normally.
- Space Missions is an ordinary layer, not a Context mode. It neither isolates the globe nor refuses other layers, opens no Context session, and runs beside Contacts. Turning it on enables its Satellites dependency in the temporary dense/hidden mode and turning it off restores Satellites' exact prior visibility and parameters; an explicit Satellites action taken while it runs (by the person or by voice), a visibility switch or a changed setting (also a place search that stops tracking a satellite), is kept through that restore (also while a restore that found Satellites busy keeps the saved state, for the next Space Missions start, which switches Satellites on again), and such a Satellites OFF asked for after the newest Space Missions ON ends Space Missions (request order, not settle order, decides; `src/layers/launches/satelliteIntents.js`). A scene, story, preset or other programmatic Satellites change does neither (owner decision). Contacts leaves Satellites as it is. The first mission-index load is part of the enable: an HTTP error, timeout, network failure or malformed payload before any index has loaded fails the enable, the camera returns to its pre-entry view unless navigation took it, and a toast says the mission index could not load. A valid empty index still enables, and a refresh failure after an index loaded keeps its records. Turning the layer on by hand, choosing it at first run, asking for it by voice (`set_context_mode` still accepts `space-missions` and switches the layer), or picking a mission on the globe opens the Space Missions panel; on desktop, opening it closes Context and the other right-rail panels, and opening Context closes it. Voice `set_panel_open` refuses to open the panel while the layer is off and says to turn Space Missions on first.
- Enabled Data Layer controls report normalized feed health on the button (`LOADING`, `DEGRADED`, `STALE`, `FALLBACK`, or `UNAVAILABLE`) while the metadata line retains the source and reason. A partial CelesTrak group failure keeps the usable catalog and reports `DEGRADED`; a total outage keeps last-good catalog data visible but reports `UNAVAILABLE`.
- On activation it focuses the nearest currently observed aircraft across the civilian and military feeds, with military winning an exact distance tie; if none are available, it focuses an observed AIS vessel. The aircraft search is deliberately uncapped and one refresh-tick retry handles initially empty feeds. This is an attention-priority navigation shortcut, not a high-risk, affiliation, or threat classification.
- A selected aircraft, AIS vessel, or mapped installation gets a 250 km **context window** with nearby cohort counts, nearest examples, source labels, and stale/unavailable reasons. It emits `NEARBY` or `UNKNOWN`; no detection, engagement, affiliation, or sensor-activity conclusion is calculated.
- Contacts rows and the Cockpit Contact counts name each cohort's provider: the source of the last snapshot, marked `FALLBACK` or `STALE` as its layer row would be. A poll in flight keeps the mark, where the layer row shows `LOADING`. A flight snapshot from the adsb.lol regional fallback reads `adsb.lol · FALLBACK`, not `OpenSky`.
- The window's edge is drawn on the globe as a 250 km range ring: a 4 px polyline whose outer 1 px, half a pixel on each side, is a dark halo around a 3 px Context-blue core, 2.5 km above the ellipsoid (`AWARENESS_RANGE_RING_STYLE` in `src/layers/awareness/policy.js`). The halo keeps it legible over bright desert and snow, dark ocean and forest, and under the FLIR, NVG and CRT styles, where the earlier 1 px ellipse outline disappeared. It is one outlined line in an unpickable draw-port line set (`src/layers/awareness/rangeRing.js`), so a click or tap on its edge reaches the contact underneath; the halo is the line's own outline, so the translucent core and halo never darken where they meet; it moves when the subject moves. Three dim sonar pulses (3 px with a dark edge half a pixel wide on each side, same colours, at most 60% opacity), each an outlined line in the same set, grow slowly from the subject at constant speed, one every 3 s and each taking 9 s, and arrive at the ring at about a third of that. Behind each pulse a radial gradient in the same blue fades inward over 35% of the radius: one unpickable flat ellipse 2.5 km up with 270 km semi-axes, filled with a 256-pixel canvas painted with the band (two canvases in turn, each under a new key). The ellipse stands until the subject has moved 20 km from where it was built, the canvas keeping the band concentric with the subject meanwhile, and not at all while the pulses rest. Fronts and band are fixed in the world, so they step every 80 ms however many frames are drawn and look the same whether the camera moves or not; crossing the 2.5 km rim height shows or hides them at once. While the camera is below the band's 2.5 km height, where it would sweep across the sky, the pulses rest: the band and fronts are hidden and there is no ring flash, no echo and no frame request. Terrain or 3D tiles higher than 2.5 km (the Alps, Andes, Rockies) still cut through the band and the ring when seen from above, as the ring alone already did; the height check uses the camera's height above the ellipsoid, not above the ground. While pulses run, the ring dims to 40% and flashes to full strength as each pulse reaches it, fading over 1.8 s. As a pulse front crosses a flight, military aircraft or AIS vessel, the detection overlay draws a second bracket around that contact's own bracket, in the pulse blue on the default detection style and in the style's own line colour under NVG, FLIR and CRT, which spreads outward as it fades over 1.4 s (`AWARENESS_RANGE_ECHO`, read through `src/awarenessEcho.js`; no layer's icon is restyled, and mapped installations have no detection bracket). Pulses are born 5 km out, so the subject itself and anything nearer never echo. Pulses run for 9 s (three ring flashes) after a selection or a camera move, fading in and out over 1.2 s, then rest: the ring stays on screen at full strength, the pulses, gradient and echoes are hidden, and nothing asks for frames, so a parked Contacts view is quiet again. Only a camera move within 1.5 s of the user handling the map (pointer, wheel or touch on the Cesium canvas, which covers a drag's inertia, and a drag or touch begun there keeps counting until its last finger or button lifts, even outside the canvas, unless the window loses focus or the page is hidden first; keys typed elsewhere do not count, nor does input while Cesium's camera controls are off, as in the cockpit view, and a gesture still pending when the cockpit or another owner takes the camera is dropped) wakes them; a moving subject and the app's own camera moves (a tracked aircraft, the cockpit view, an orbit, a fly-to) do not, since they move on every refresh. While they run they never hold continuous rendering: each drawn frame arms one step 80 ms later (the Cyber sonar cadence, `CYBER_SONAR_RENDER_INTERVAL_MS`) whose changes ask for the frame that draws them, so a parked view repaints at about 12.5 fps, one frame a step, and never beats the detection lane's 80 ms gate. Under `prefers-reduced-motion`, or on a renderer without frame hooks, there are no pulses or echoes and the ring stays on screen; changing the preference mid-session rebuilds the ring. The ring follows a moving subject once it has moved 250 m.
- The window's edge is drawn on the globe as a 250 km range ring: a 4 px polyline whose outer 1 px, half a pixel on each side, is a dark halo around a 3 px Context-blue core, 2.5 km above the ellipsoid (`AWARENESS_RANGE_RING_STYLE` in `src/layers/awareness/policy.js`). The halo keeps it legible over bright desert and snow, dark ocean and forest, and under the FLIR, NVG and CRT styles, where the earlier 1 px ellipse outline disappeared. It is one outlined line in an unpickable draw-port line set (`src/layers/awareness/rangeRing.js`), so a click or tap on its edge reaches the contact underneath; the halo is the line's own outline, so the translucent core and halo never darken where they meet; it moves when the subject moves. Three dim sonar pulses (3 px with a dark edge half a pixel wide on each side, same colours, at most 60% opacity), each an outlined line in the same set, grow slowly from the subject at constant speed, one every 3 s and each taking 9 s, and arrive at the ring at about a third of that. Behind each pulse a radial gradient in the same blue fades inward over 35% of the radius: one unpickable flat ellipse 2.5 km up with 270 km semi-axes, filled with a 256-pixel canvas painted with the band (two canvases in turn, each under a new key). The ellipse stands until the subject has moved 20 km from where it was built, the canvas keeping the band concentric with the subject meanwhile, and not at all while the pulses rest. Fronts and band are fixed in the world, so they step every 80 ms however many frames are drawn and look the same whether the camera moves or not; crossing the 2.5 km rim height shows or hides them at once. While the camera is below the band's 2.5 km height, where it would sweep across the sky, the pulses rest: the band and fronts are hidden and there is no ring flash, no echo and no frame request. Terrain or 3D tiles higher than 2.5 km (the Alps, Andes, Rockies) still cut through the band and the ring when seen from above, as the ring alone already did; the height check uses the camera's height above the ellipsoid, not above the ground. While pulses run, the ring dims to 40% and flashes to full strength as each pulse reaches it, fading over 1.8 s. As a pulse front crosses a flight, military aircraft or AIS vessel, the detection overlay draws a second bracket around that contact's own bracket, in the pulse blue on the default detection style and in the style's own line colour under NVG, FLIR and CRT, which spreads outward as it fades over 1.4 s (`AWARENESS_RANGE_ECHO`, read through `src/awarenessEcho.js`; no layer's icon is restyled, and mapped installations have no detection bracket). Pulses are born 5 km out, so the subject itself and anything nearer never echo. Pulses run for 9 s (three ring flashes) after a selection or a camera move, fading in and out over 1.2 s, then rest: the ring stays on screen at full strength, the pulses, gradient and echoes are hidden, and nothing asks for frames, so a parked Contacts view is quiet again. Only a camera move within 1.5 s of the user handling the map (pointer, wheel or touch on the Cesium canvas, which covers a drag's inertia, and a drag or touch begun there keeps counting until its last finger or button lifts, even outside the canvas, unless the window loses focus or the page is hidden first; keys typed elsewhere do not count, nor does input while Cesium's camera controls are off, as in the cockpit view, and a gesture still pending when the cockpit or another owner takes the camera is dropped) wakes them; a moving subject and the app's own camera moves (a tracked aircraft, the cockpit view, an orbit, a fly-to) do not, since they move on every refresh. While they run they never hold continuous rendering: each drawn frame arms one step 80 ms later (the sonar cadence, `CYBER_SONAR_RENDER_INTERVAL_MS`) whose changes ask for the frame that draws them, so a parked view repaints at about 12.5 fps, one frame a step, and never beats the detection lane's 80 ms gate. Under `prefers-reduced-motion`, or on a renderer without frame hooks, there are no pulses or echoes and the ring stays on screen; changing the preference mid-session rebuilds the ring. The ring follows a moving subject once it has moved 250 m.
- For a selected live aircraft or vessel, the context window refreshes from the existing tracker/feed position every 750 ms, so nearest distances and cohort counts follow the subject without introducing a duplicate poll loop.
- Aircraft cohort membership uses every locally loaded, selectable contact inside the 250 km window, including a plane hidden only by horizon culling or because its 3D model owns the visual. Counts and navigation therefore do not change with the current camera angle or billboard/model handoff.
- Nearby examples in the context panel are focus controls: they use their owning layer's existing selection/tracking path, then frame that contact. Static-installation distances use ellipsoidal surface distance so the count matches the ground-projected context disk.
@@ -7500,8 +7603,8 @@ silently demoting every later lookup for the session.
protected-card path. Disable tears the tier down completely.
Coverage/viewshed semantics unchanged.
- **Satellites**: every point moves every frame. Each satellite's SGP4 sample (position, velocity, gravity and its rate of change; `src/layers/satellites/motion.js`) is reckoned forward or back to the world time and turned into the Earth-fixed frame, so points glide at any play speed instead of stepping once a second. Core satellites take a fresh sample every second, or as soon as the world time is 30 s from their sample (fast play, a seek), which keeps every point within about 10 m of SGP4; Starlink extras are sampled round-robin, more per frame the faster time plays, and a point more than two minutes from its sample waits for the next one. Hidden points are not moved until shown. Orbit rings rotate about Earth's Z by ΔGMST every ~1s (exact inertial→ECEF compensation; no SGP4 re-runs); the tracked satellite propagates per frame with one shared epoch for dot/label/camera. Verified: ISS holds <1km perpendicular to its ring while tracked. Pass prediction (`src/data/satellitePass.js`; `getNextSatellitePass`, `getNextIssPass`) scans at 20s, bisects rise/set to ~0.2s, fits the peak with a parabola, and marks a pass visible when the satellite is outside a cylindrical Earth shadow while the observer's Sun is at or below −6°. `next_iss_pass` preserves its geometric-pass ordering and appends visibility metadata. General `next_satellite_pass` accepts a loaded NORAD ID or unambiguous name, searches 24 hours and optionally requires estimated visibility. These estimates do not account for weather or satellite brightness.
- **Space Missions (30d)**: recent launches render as bounded shared-host, horizon-occluded mission markers using Launch Library 2 v2.3 detailed records. Enabling the layer selects the unified right-side Context panel's Space Missions mode and enables the required satellite layer. Before applying its temporary dense/hidden Satellite mode, Space Missions snapshots the complete standalone Satellite parameter set and exact enabled-layer set. Disabling Space Missions from either Context or the left Data Layers rail restores those parameters and the exact prior enabled state, so a Satellite layer that was already on stays on while a mode-owned dependency returns off; enabling Satellites by itself remains independent. Selecting a mission isolates its launch-to-orbit transfer and dashed satellite orbit, fills that same panel with navigation/details, and animates a small phase-colored marker along the exact displayed Cartesian samples. Marker hit testing drill-picks through photorealistic tiles so the depth-test-free tactical dot remains reliably selectable; its text is non-interactive shared-host presentation. The selected pad is the camera's zoom pivot: the overview remains centered on its launch site, wheel zoom approaches that site instead of drifting elsewhere, and camera pitch progressively changes from global nadir to an oblique close 3D view. Its protected shared-host callout remains visible and expands to include both mission and launch-site names. `FOCUS` flies directly to a 12 km oblique frame around the selected launch site and retains the same anchored zoom/orbit behavior. `REPLAY ASCENT` resets the selected marker at the pad, frames it from an oblique third-person angle, and follows it through the mission-specific compressed ascent directly into one orbital lap at the default `1×` rate. A live `0.25×`–`4×` slider changes ascent and orbit playback speed; adjusting it mid-replay preserves the current path position and historical mission timestamp. Re-entry/recovery cannot be inserted into replay. At orbit insertion the camera smoothly pulls back over the first fifth of the orbital replay and pitches to a globe-scale nadir view while continuing to target the moving replay point. Replay Cancel, mission navigation, deselection, layer disable, and data refresh all release camera ownership. Reconstructed paths are one continuous 128-sample geodetic curve: horizontal departure begins near zero while altitude rises quickly, then the climb progressively bends toward insertion without the former hard 120 km corner. Unmatched orbit fallbacks are smooth planar inclined rings rather than longitude/latitude ground-track curves. The panel lists disclosed payload names, types, operators/manufacturers, mass, multiplicity, and destination when supplied; an empty LL2 payload collection is shown as `CLASSIFIED / MULTI-PAYLOAD`. Launcher, spacecraft, and recoverable payload stages appear in a compact stage table with serial/flight/reuse details, recovery outcome/type, destination, and final coordinates when those records exist; an empty recovery collection omits the section. Stage recoveries with confirmed coordinates use those coordinates; return-to-launch-site records use the pad; downrange-only records receive an explicitly labeled estimated endpoint along the ascent azimuth. Available endpoints render as static 2 px dashed descent/recovery paths with a fixed final-position dot and an estimated atmospheric-interface segment when applicable. The ascent is geodetically densified above the ellipsoid toward the orbit's nearest insertion point, then rendered with `ArcType.NONE`, so it neither cuts through Earth nor separates from the marker. Because LL2 does not normally supply continuous ascent telemetry, pad-to-insertion paths without upstream trajectory samples are labeled `RECONSTRUCTED ESTIMATE` / `ASCENT ESTIMATE`; only supplied trajectory samples receive the replay wording. Selected-orbit framing fits the complete ring, rear-side linework uses normal scene depth occlusion, and current distance, speed, and callout data come only from a launch-year-validated satellite match. Both the loaded-catalog and active-TLE lookups read the launch year from the TLE international designator through one parser (`src/sources/tle.js`); a blank or malformed designator is an unknown year, which skips the year check rather than rejecting the match. Speed is the magnitude of the SGP4 inertial velocity vector at the same propagation epoch as position, displayed in km/s with km/h available as hover detail. Unavailable operator, site, launch-time, orbit, current-altitude, and speed values omit their detail rows instead of reserving panel space with placeholders. Newly launched payloads absent from the core operational groups use CelesTrak's cached active TLE feed as a lookup-only fallback; weak constellation-name matches are rejected. The replay callout maps compressed animation progress onto Launch Library's mission-relative timeline,Line truncated
When no mission is selected, the Context panel presents a scrollable newest-first roster of every launch in the rolling window, including the smaller 5 px operator-colored marker, provider, and launch date. Hovering or keyboard-focusing a row shows four compact cyan corner brackets on both that roster row and its corresponding globe dot, rotates the globe at the current zoom to center it, and gives its label declutter priority without selecting it; the globe label remains unbracketed. Selecting a roster row invokes the same mission isolation and full-orbit framing as clicking its globe marker. The replay vehicle is one screen-space SVG/CSS HUD overlay rather than separate Cesium billboard, label, and reticle graphics. It is hidden during ordinary Focus and manual close views, where the standard selected launch-site label remains visible, and exists only while ascent replay is active. Its fixed pixel scale is shared by ascent and insertion, so camera range never resizes the rocket on screen before the phase boundary. Generic Launch Library pad names are reduced to their identifying suffix, and replay timestamps use a cyan state title over unprefixed white UTC date/time values. `REPLAY ASCENT` holds the unframed cyan/white rocket at the pad for a real-time `T−10` countdown, transitions through `LIFTOFF`, and attaches six tapered cyan/white ellipse waves directly below it from liftoff through insertion to convey thrust without adding scene geometry. While replay is active, the single start button is replaced by compact Play, Pause, and Cancel icon controls. Pause freezes countdown or mission time, vehicle/stage positions, camera target, labels, and thrust-wave animation; Play resumes from that exact frame, and Cancel releases replay camera ownership. The rocket and thrust group rotates from the path's live screen-space tangent, so its nose follows the visible ascent curve while the adjacent text remains upright. The camera begins as a close oblique launch chase, then smoothly widens between roughly 120 and 420 km vehicle altitude into a higher oblique context view that keeps the moving rocket targeted while exposing the ascent bend and orbit connection. At insertion the rocket/thrust glyph is replaced by the fixed-size cyan orbit dot, which the camera follows through the existing globe-scale orbit pullback. The chase camera limits per-frame yaw changes across heading wraps so it cannot abruptly cross in front of the vehicle and make ascent read in reverse; the replay-speed slider affects mission playback but not countdown duration.
- **Space Missions (30d)**: recent launches render as bounded shared-host, horizon-occluded mission markers using Launch Library 2 v2.3 detailed records. Enabling the layer reveals its own right-rail button and roster and enables the required satellite layer; it does not touch Context. Before applying its temporary dense/hidden Satellite mode, Space Missions snapshots the complete standalone Satellite parameter set and exact enabled-layer set. Disabling Space Missions from Data Layers hides its rail button and panel and restores those parameters and the exact prior enabled state, so a Satellite layer that was already on stays on while a mode-owned dependency returns off; enabling Satellites by itself remains independent. An explicit user or voice Satellites OFF requested after Space Missions ON exits Space Missions, including after returning from Stories; scene, story, preset and other programmatic Satellites changes do not. The controls under the Space Missions row cycle through available launches. Selecting a mission isolates its launch-to-orbit transfer and dashed satellite orbit, fills the Space Missions panel with details, navigation, and replay controls, and animates a small phase-colored marker along the exact displayed Cartesian samples. Marker hit testing drill-picks through photorealistic tiles so the depth-test-free tactical dot remains reliably selectable. Clicking the launch name on the globe selects and focuses the same mission as its dot (in the cockpit, which holds the camera, a mission chosen by its name, its dot or the layer row's arrows is selected without flying to it, also once its orbit arrives); what is drawn beneath the name is not picked, and the other layers still hear the click as one on the name. The name is an interactive world-overlay label, so it is the card on top for every click handler (`clickCard`, `isUnderOtherCard` in `src/data/pickRegistry.js`): no other layer selects, turns on, focuses or opens the link of a contact, card or camera that lies under the name, and their selections stay. The selected pad is the camera's zoom pivot: the overview remains centered on its launch site, wheel zoom approaches that site instead of drifting elsewhere, and camera pitch progressively changes from global nadir to an oblique close 3D view. Its protected shared-host callout remains visible and expands to include both mission and launch-site names. `FOCUS` flies directly to a 12 km oblique frame around the selected launch site and retains the same anchored zoom/orbit behavior. `REPLAY ASCENT` resets the selected marker at the pad, frames it from an oblique third-person angle, and follows it through the mission-specific compressed ascent directly into one orbital lap at the default `1×` rate. A live `0.25×`–`4×` slider changes ascent and orbit playback speed; adjusting it mid-replay preserves the current path position and historical mission timestamp. Re-entry/recovery cannot be inserted into replay. At orbit insertion the camera smoothly pulls back over the first fifth of the orbital replay and pitches to a globe-scale nadir view while continuing to target the moving replay point. Replay Cancel, mission navigation, deselection, layer disable, and data refresh all release camera ownership. Reconstructed paths are one continuous 128-sample geodetic curve: horizontal departure begins near zero while altitude rises quickly, then the climb progressively bends toward insertion without the former hard 120 km corner. Unmatched orbit fallbacks are smooth planar inclined rings rather than longitude/latitude ground-track curves. The panel lists disclosed payload names, types, operators/manufacturers, mass, multiplicity, and destination when supplied; an empty LL2 payload collection is shown as `CLASSIFIED / MULTI-PAYLOAD`. Launcher, spacecraft, and recoverable payload stages appear in a compact stage table with serial/flight/reuse details, recovery outcome/type, destination, and final coordinates when those records exist; an empty recovery collection omits the section. Stage recoveries with confirmed coordinates use those coordinates; return-to-launch-site records use the pad; downrange-only records receive an explicitly labeled estimated endpoint along the ascent azimuth. Available endpoints render as static 2 px dashed descent/recovery paths with a fixed final-position dot and an estimated atmospheric-interface segment when applicable. The ascent is geodetically densified above the ellipsoid toward the orbit's nearest insertion point, then rendered with `ArcType.NONE`, so it neither cuts through Earth nor separates from the marker. Because LL2 does not normally supply continuous ascent telemetry, pad-to-insertion paths without upstream trajectory samples are labeled `RECONSTRUCTED ESTIMATE` / `ASCENT ESTIMATE`; only supplied trajectory samples receive the replay wording. Selected-orbit framing fits the complete ring, rear-side linework uses normal scene depth occlusion, and current distanceLine truncated
When no mission is selected, the Space Missions panel presents a scrollable newest-first roster of every launch in the rolling window, including the smaller 5 px operator-colored marker, provider, and launch date. Hovering or keyboard-focusing a row shows four compact cyan corner brackets on both that roster row and its corresponding globe dot, rotates the globe at the current zoom to center it, and gives its label declutter priority without selecting it; the globe label remains unbracketed. Selecting a roster row invokes the same mission isolation and full-orbit framing as clicking its globe marker. The replay vehicle is one screen-space SVG/CSS HUD overlay rather than separate Cesium billboard, label, and reticle graphics. It is hidden during ordinary Focus and manual close views, where the standard selected launch-site label remains visible, and exists only while ascent replay is active. Its fixed pixel scale is shared by ascent and insertion, so camera range never resizes the rocket on screen before the phase boundary. Generic Launch Library pad names are reduced to their identifying suffix, and replay timestamps use a cyan state title over unprefixed white UTC date/time values. `REPLAY ASCENT` holds the unframed cyan/white rocket at the pad for a real-time `T−10` countdown, transitions through `LIFTOFF`, and attaches six tapered cyan/white ellipse waves directly below it from liftoff through insertion to convey thrust without adding scene geometry. While replay is active, the single start button is replaced by compact Play, Pause, and Cancel icon controls. Pause freezes countdown or mission time, vehicle/stage positions, camera target, labels, and thrust-wave animation; Play resumes from that exact frame, and Cancel releases replay camera ownership. The rocket and thrust group rotates from the path's live screen-space tangent, so its nose follows the visible ascent curve while the adjacent text remains upright. The camera begins as a close oblique launch chase, then smoothly widens between roughly 120 and 420 km vehicle altitude into a higher oblique context view that keeps the moving rocket targeted while exposing the ascent bend and orbit connection. At insertion the rocket/thrust glyph is replaced by the fixed-size cyan orbit dot, which the camera follows through the existing globe-scale orbit pullback. The chase camera limits per-frame yaw changes across heading wraps so it cannot abruptly cross in front of the vehicle and make ascent read in reverse; the replay-speed slider affects mission playback but not countdown duration.
Mission world text has no native `LabelGraphics`: overview launch markers publish at most 48 ambient candidates for a 24-winner budget, while selecting a mission clears that overview source and publishes its launch-site callout, stage re-entry annotations, live/estimated payload-position readout, and orbit annotation as protected selected-lane entries. The source retains the exact former strings and colors. Static anchors reuse the Cartesian values used to build their mission geometry; the moving payload entry reads the layer's per-frame live-position cache; catalog-backed orbit annotation positions are cached in the same one-second matrix update that realigns the orbit primitive. Keyhole edge fade, horizon culling, final collision placement, and UI exclusion are owned by the shared host. Deselect restores the bounded overview, and refresh, disable, and destroy replace or clear both mission sources.
A selected mission renders its orbit as four repeating tactical sectors, each containing one prominent cyan dot followed by one hundred thin translucent dashes. The bright dots act as orbit anchors while the subdued dash field remains depth-tested against the globe and is shown only for the selected mission.
Close selected-pad views add one static 500 m-radius cyan launch-zone ring with a low-opacity translucent fill over the sampled photoreal launch-site surface. The single scene primitive is created only for the visible selected site and is otherwise dormant. It appears during Focus, sufficiently close manual zoom, and the replay countdown, but is suppressed above 120 km camera altitude, beyond 180 km direct camera-to-pad range, for unselected missions, and whenever Space Missions is inactive. Focus establishes a launch-site-centered camera transform once; subsequent manual heading and pitch changes remain centered on that site without an automated per-frame correction. Surface mission markers and labels use an additional conservative globe-limb margin before the exact ellipsoid occluder boundary, preventing near-horizon visibility from alternating between frames.
@@ -7823,6 +7926,358 @@ and unreachable upstream (502/504) separately from road geometry.
- `partial` is a feed state of its own, ranked between `fallback` and `nominal`, so one partial layer, or partial plus nominal, reads partial, not off or nominal (HUD, voice view state, `analyst_query`, `brief`, the agent world packet). Its narration note says coverage is incomplete rather than not live.
- A summary asked for before the camera starts moving never paints over the next view: `moveStart` marks the summary dirty and bumps its revision, as `moveEnd` does, aborts the request in flight and stops a reply still typing; neither a reply nor a fallback line (on an error, the 5 s timeout, the abort, or a failed context build) paints once the revision has moved. A dropped request forgets its signature and a timeout counts as a failure, so the next 15 s tick asks again even over the same place. An interrupted typewriter reply also forgets its signature; fully displayed answers remain reusable.
### Omnibar
The desktop Omnibar sits above the footer with the existing mic and chat
buttons on either side. Suggestions open upward. On phones the Omnibar is
a field near the top, beside the Search sheet, and opens downward. While voice is on, the desktop field shows
three audio traces in place of the search text and icon. The thinking dots
sit on the field's top edge. World Time appears immediately above the dock
and hides while suggestions, chat, or voice settings are visible. `/`
focuses search from outside a text field, as do Cmd+K on macOS and Ctrl+K
elsewhere (Ctrl+K on macOS is left alone); none of them takes focus from an
open modal dialog or from inside a dialog such as the guide. While voice is
on, the suggestions give way to the waveform but an error stays shown. The map credits stay on the
Power Up row in the ordinary desktop layout, and the Tactical bottom-right
readout sits 8px above that row.
Pending owner decision: in the desktop Omnibar layout
(`src/ui/styles/omnibar-dock.css`) the legacy Location and Visual trays of
the command dock are hidden (`#command-dock > :is(#location-bar,
#control-panel)`), as is the tactical and minimal HUD's mode readout
(`.hud-readout:has(> #hud-mode)`). Search moves to the Omnibar and presets to
the Visual rail; the phone shell and exclusive modes keep their layouts.
The field offers places, latitude/longitude and grid coordinates, named map
entities, and layer controls. The strip can show cities and landmarks,
nearby small places from the bundled Wikidata packs, selected items and
drawing shapes. The cities of a state or country are those inside its
extent and in its country (by the ISO code Photon returns); with only one of
the two known, that one decides. Selecting a
guided result highlights the existing app controls. "Show me how", "how do
I …" and "how to …" find a walk by the words people use: a layer's name
("how to turn on flights"), or a feature's (`FEATURE_TOPICS` in
`src/ui/omnibarRows.js`): the style or look ("change the map style"), the
map underneath ("change the map", "switch to OpenStreetMap"), the HUD,
north or the compass, tilt, the globe or a reset ("get back to the globe"),
sharing, clearing all layers, and drawing and measuring ("how to measure
distance": open Utilities, press Draw, pick Line for a distance or Area for
its size). A leading `>` opens the
command menu; use it for exact layer commands such as `> show flights`.
The rows come from one pure pipeline, `createOmnibar` in
`src/ui/omnibarRows.js`: the line is normalised once (`normalizeLine` in
`src/ui/omnibarIntent.js`, through `readLine` in `src/ui/omnibarRows.js`:
full-width forms folded, curly apostrophes made straight, a closing full
stop or "!" dropped (an initial's kept, as in "Washington D.C."), and a
"please" before or after a request dropped, never one in a name ("Please
Touch Museum", "Pretty Please")), read once (`parseOmnibar`), turned into
rows, and ordered by the Enter rule; the same reader decides what may go
to Photon and what is a count request. A whole line searched as a place is
searched as typed ("Paris, Texas.", "Yahoo!"). The
component (`Omnibar.vue`) supplies the layers, Photon's answers, the map's
items and the selection, and runs the chosen row; the strip of chips under
the field (landmarks, cities of a region, villages, recent places, draw
shapes) is built in the component from the same normalised line. What Enter does with no
row chosen follows one rule, in `src/ui/omnibarEnter.js` (`enterDefault`),
pinned by an input-to-outcome table in `src/ui/omnibarRows.test.mjs` and
by the mounted table in `src/ui/commandDock.test.mjs`. Only the first row can be the default; an
empty field and a bare `>` have none; the pointer never chooses a row
(hovering then pressing Enter runs the default, a click runs the row), and
the arrow keys choose any row. Enter performs an action (a plan, a layer
switch, a command, Ask GEV) only when the line asks for it outright:
- the action's own clause starts with a verb from the one list
(`ACTION_VERB` in `src/ui/omnibarIntent.js`, read in any letter case by
`hasActionVerb`): show, hide, turn, switch, toggle, enable, disable, add,
remove, display (with something after it), play, start, open, close,
enter, listen, tune, mute, unmute, follow, track, draw, measure, share,
copy, reset, silence, pause, "nearest plane" and the like, or a clause
ending in "on" or "off" ("radio off"). A style, map, camera move, HUD or
layer followed by "on" or "off" reads as that switch ("noir off" and
"turn off noir" go back to the normal style, "orbit off" stops the camera,
"osm off" runs nothing), never as a place called "off"; words that also start names count
only alone or before what they act on ("clear the map", "zoom in",
"tilt", "orbit", "stop the radio", "kill the radio", "face north"). Verbs
are read per clause, so a verb inside a place's name asks for nothing
("radio near Clear Lake", "radio in Show Low", "radio near Stop,
Arkansas" search the place). A layer is asked for only by a switch (show,
display, add, enable, turn or switch on, hide, remove, disable, turn or
switch off) right before its word: "Show Low radio" and "Kill Devil Hills
radio" name places, and a verb with a name left beside its keywords asks
for nothing else in its clause ("Show Low noir", "Start Point noir",
"Track Hill noir"). A clause joined to a "go to"
clause by "and" or "then" counts as asked ("go to Paris, Texas and
noir");
- or it is a command's exact label, alone or after `>` ("North up", "Noir",
"> Clear all layers"). A command row runs on nothing else: a bare switch
verb ("hide", "turn off", "disable") only lists what it could switch;
- or a data layer's whole shown name or synonym alone, which names that
layer as a command's label does ("flights", "earthquakes", "Satellite");
- or, for Ask GEV, it is a real question: it ends with "?" (full-width
"?" and Arabic "؟" too), has a word of two letters or more, and has a
question's form (below), or two words in a
non-Latin script; or five Han, Kana or Hangul characters ("what?", "??",
"N Y?", "New York?", "Truth or Consequences?" and "東京都?" are not:
Ask GEV is offered first and Enter runs nothing; small talk such as "what's up" or "how's it going" is never one); or, without "?", it
starts with
what/where/when/who/why/how/which followed by is, are, was, do, does,
did, can, could, should, would, will, 's, many, much, far, long or to,
then has a word about something ("what is here", "how far is paris"; not
"what is", "how to", "who is it"), and is not written as a name (three
words or more, each capitalised: "Where Is My Mind"). A line starting
with an auxiliary and a pronoun or determiner (is it, can you, do it…)
asks only with "?": without it, Ask GEV is offered first and Enter runs
nothing ("can you show me", "is it raining in tokyo"), and with a capital
after its first two words it is a name and searches the place ("Can You
Imagine", "Do it Best Hardware"). "Can Tho City" and "Is Kinabalu Park"
are places. A line
with a comma and no "?" is a place ("Why, Arizona"), never a question.
Any other line, small talk and question words included ("why", "help",
"what cheer", "List"), still offers the place row first, with Ask GEV
after it.
A whole layer name with a place after near, in, around, over, across or
above ("flights near Tokyo", "earthquakes above m5 in japan") asks outright
too; after "of" or "at" the line may be a name and the whole line is
offered as a place first ("Planes of Fame Air Museum", "Boats at Sea"). Keywords without a
verb ask for nothing, however many clauses they fill ("New York City
noir", "Fire and Rain", "noir and cctv near austin, north up"): with a
place after near or in that place is searched, and otherwise the whole
line is offered as a place first ("Storm Lake and Spencer", "Thermal and
Indio"), the plan after it. Draw opens on Enter only for "draw" itself or a
draw verb with something to draw ("draw a line"; not "Draw Bridge"), and a
guided walk found by forgiving a typo, or on a line written as a title
("How To Train Your Dragon"), is offered, never run. A switch verb before
a capitalised name that names no layer is a place ("Remove Island",
"Toggle Inn"). A
layer row runs only when the line names that layer before any other, by a
whole word of its shown or English name (never its id, and not a word of
kind such as local, global, live, world, new, open, data, map, view or
level) or a synonym, with a plural "s" allowed from four letters
("flights" yes; "a", "display", "Local", "Global", "new" no). "show
flights" with Live Flights already on offers Live Flights, which then
switches nothing; Military Flights, which also has the word, is only
offered after it. Words about a layer after a switch are no place ("show radio
stations", "show flights here"); without the switch the line may be a name
("Train Station"). A line of more than six words left over as a
place (ten with a number in it), or of more than eight words that asks for
nothing outright, is a sentence (pasted text, a remark): it is never sent to
Photon, Ask GEV is offered, and so is a row that searches the whole line as a
place when picked ("San Miguel de las Piedras Primera Sección"); Enter runs
neither. A word that is
both a bundled place's name and, alone, a command, style or layer word
(`PLACE_WORDS` in `src/ui/omnibarEnter.js`: Bike, Hurricane, Normal, Rain,
Ski, Street, Thermal) searches the place first and offers the switch
second. The list comes from sweeping every bundled name (139,502), alone
and with " radio" and " noir" after it, through the mounted Omnibar; after
it, none defaults to anything but a place. A test samples about 2,000 of
them. Some actions need more: sound (the Radio layer and command),
clearing the map, closing panels and the cockpit need a verb or their exact
label ("turn on radio", "close all panels", "enter cockpit"; not "radio near
tokyo" or "Radio, Tokyo"), and the microphone, sharing the view, resetting
it and the globe view need their exact label ("Talk to GEV", "Share this
view", "Reset view", "Globe view"; not "mic", "share", "home" or "start
over").
Otherwise the place row is the default and moves first ("Thermal,
California", "radio near tokyo" searches Tokyo), and any plan or command is
offered after it; a line with neither ("hi", "NY", "?") runs nothing. "hide everything near tokyo" clears the layers and flies to
Tokyo. "hide everything except flights" (or "all but", "other than", with
"turn off", "clear" or "remove") switches off every layer that is on but
the ones named, on Enter, or says no other layers are on; with a layer to
keep that is not read, nothing is switched off and only Ask GEV is offered.
While Space Missions is on, keeping either it or Satellites keeps both,
since Space Missions draws through Satellites. "remove flights from the
map" is "remove flights", after hide, remove,
turn off, switch off or disable, and after clear only for the whole map
("clear everything except flights from the map", "clear the layers from
the map"; "show me the view from the map" is a question), a doubled verb ("hide hide everything") is read
once, and a grid reference after "near" is the place ("flights near 14R PU
2090 4906"). Following needs a callsign or ICAO address (letters and a digit), a
nine-digit MMSI or the name of something loaded on the map, so "Track
Hill" and "Track 29" are places; "nearest plane" counts alone or before a
place ("Nearest Plane Crash Site" is a name), and "goto" only with a place
after it ("Goto" is a town). A row chosen with the arrow keys is kept by its key while rows
arrive above it, and the default comes back if it goes away. After a row
runs with Enter, the field empties and keeps focus for the next line on
desktop; a tapped or clicked row lets go of it, and on the phone shell any
row does (so the keyboard does not stay over the map), and so do Ask GEV, the mic, the cockpit, following, a guided
walk, and any row while drawing is on (the draw tool reads Enter, Backspace
and Esc). Escape closes the list, and on an empty, closed field lets go of
it, so the app's own keys work again. While voice
is on, the list is closed (not expanded) and Enter runs nothing. Text that
may be private is never looked up or searched while typed or on Enter: only
things already loaded on the map may match it, locally, and when only a
long run of digits makes it look private and it has words (an address can:
"Москва, ул. Тверская, д. 13, 125009") one row searches it as a place only
when picked (see below).
After "go to" (or "fly to" and the like) the rest of the clause, and a
following part after a comma that has no verb, is the place, read before
any keyword in it: "go to Thermal, California" only searches there. A
request ending that clause is peeled off and offered as a plan after the
place: "in", "with" or "at" and a style, map or layer ("go to tokyo in
noir", "go to London with flights"), a switch and a layer ("go to tokyo show
flights"), or a comma part that is exactly a style, map, camera move or
layer ("go to Tokyo, north up"). A line with one keyword and no verb beside
the rest of a name ("Tilt Cove", "tokyo traffic", "Hurricane, Utah") offers
the whole line as a place first and the plan second. When that keyword
starts the line with no comma after it and the rest is only a word for a
kind of place ("Fire Island", "Radio City"), it begins the name: the place
and the layer are offered, and no plan goes to the rest ("earthquakes
japan" and "traffic city hall" keep their plans). Further places joined
with "and" are offered as their own rows. Things loaded on the map that
match the line are offered too: a callsign, tail number or transponder
code puts them first, and otherwise the place row keeps the top, so
"Hamburg" goes to the city before the ship HAMBURG. An unrecognized explicit command
stays in search. Questions can be sent through Ask GEV, which uses the
existing typed chat.
Han, Hangul and Kana names are looked up from two characters (東京), others
from three.
Plans run step by step, and a layer step reads the layer's state when it
runs, not when the line was read. A step the app refuses (an action
answering `ok: false`, a layer switch answering `false`, a globe action no
connected owner answers, a panel to open with no rail button) stops the
plan and shows the same error under the field as a single action, with
the action's own short spoken reason (`say`) when it gives one and the
interface is in English (the runner speaks English, so other languages
get the translated message alone); a flight cancelled by a newer
one stops the plan quietly. A running plan is superseded, and none of its
later steps run, when the field's text changes, another row or chip is
chosen, Escape is pressed, the field is reset after a finished choice, or the
Omnibar unmounts. Focus leaving the field (a click on the map, the mic, the
search shortcut) does not cancel it. The guide's placement check pauses
while the tab is hidden.
A place search on its own runs through Location and shares its cancellation
and errors, keeping the separate Location draft intact.
While typing, a short line (six words or fewer, ten with a number in it
as an address has, no `?`, not a command,
coordinates, a hex code, a callsign such as UAL2110 or N123AB, and nothing
that may be private) is sent to
Photon for place suggestions (the suggester itself never sends a line of
more than eight words, or ten with a number): at most one request every
500 ms per tab,
and none for a minute after a refusal. Photon is the keyless geocoder the
place search already uses; a submitted search is not part of this spacing.
A line that may be one name ("Satellite Beach") is looked up whole. While
its suggestions show, or a recent-place chip that came from them, the
OpenStreetMap credit shows too; recent chips from the bundled packs credit
Wikidata. Private text, by `mayBePrivate` in
`src/search/placeSuggestions.js`, is never sent to Photon, offered as a
place, searched or sent to GEV; only things already loaded on the map may
match it, locally. The line is read after NFKC, so full-width letters,
digits and "@" count, and digits of any script count as digits. It is
any line with: an "@" with something right on both sides, ending a word,
starting a lowercase handle ("@jdoe"), or spaced before a domain ("john @
gmail.com") (an email address or a handle, also while it is typed; spaced, as in "Nanjampeta @
Chandambylu", it is part of a name); an email spelled around a filter
("john(at)gmail.com", "john[at]gmail[dot]com", "john at gmail dot de",
"john at gmail.com", "john at gmail (dot) com"); an IP address
("10.0.0.1", "::1", "fe80::1", "https://[::1]/"); a wallet's recovery
phrase (see below); seven digits or more with nothing but spaces,
punctuation, symbols or format characters between them (a phone, card,
SSN or account number or its start: "+1 415 555", "4111 1111", "123 45
6789", "123456789", "4111.1111.1111.1111", "123–45–6789"; a street address's house number
and its postcode are read apart (a house number never starts with 0, and
a polite word such as "thanks" after the digits is not a city): five digits, or between the street and
the city "00-950", "111 21", "125009", "1100-053", or four digits after a
comma ("Straße 120, 1070 Wien"); and so are a US ZIP+4 after a state's
code or name ("Alice 12345-6789" and "Jo 12345-6789" stay private),
a Brazilian CEP, a Japanese postcode after "〒" or next to the address in
Japanese script ("東京都千代田区100-0001"; after a Latin name, as in
"Shibuya 150-0002", it reads as a phone number), and
digits on either side of "#", so "Hauptstrasse 12 10115 Berlin", "DC
20500-0003", "〒100-0001 東京都千代田区" and "Calle 100 # 19-61" are places,
while a seven-digit postcode alone such as "Tel Aviv 6100000" still reads
as private); a phone number written with dots; two letters, two
digits and ten more letters or digits (an IBAN's shape); "password",
"passcode", "passwd", "pw" or "pwd" followed by anything, "bearer"
followed by anything but a short capitalised name or a place word such as
island or lake ("Bearer Island", "bearer island" are places),
"ssn" followed by a digit, also after "ending", "ends in" or "last four"
("SSN Station" is a place), "token", "secret",
"api key", "key" or "pass" followed by ":" or "=", a licence, plate,
passport, membership, account, policy, ticket, booking, confirmation or
reference number with a digit after its label ("license ABC1234",
"passport no. 123456"), "ID" in capitals followed by a number ("ID
AB123"), "otp", "2fa", "mfa", "cvv", "cvc" or a verification, one-time,
security, auth or login code followed by a code (any value after a label
in lower case, "verification code Abc", also before "thanks", ", thanks", "cheers" or "thanks a lot"; after a label
written as a name, any value that is not one: "OTP Bank" and "Security
Code Plaza" are places), a "pin" or door, access, gate, alarm or entry
code followed by a value in mixed case ("PIN aBcD"), a
door, access, gate, alarm, entry or security code followed by a digit, "api
key", "access token" or "secret key" followed by a word of six characters
or more, the word for "password" in the interface's languages
(contraseña, Passwort, mot de passe, пароль…) followed by anything, or "pin"
(also "pin code", "pin number", "pin is") followed by a digit; a word
starting `sk_`, `sk-`, `rk_`, `pk_live`, `ghp_`, `github_pat_`, `glpat-`, `hf_`, a SendGrid
`SG.` key or a Slack token's `xoxb-` and the like (any case) or
`AIza` or `eyJ`, or an AWS key id (`AKIA` and twelve capitals or digits
more; "Akiak" is a place); or a word that may be a password or key, with letters and digits mixed
within one run (a number beside a word, as in "Yanino-1", "2-chōme" or
"Route-66", is a name): eight characters or more, six or more with four
letters and a digit ("hunter22", "Area51"), or six or more with letters,
digits and a symbol ("Tr0ub4dor&3"). The password words match whole words
only ("Sachsenhausen" is a place). Over the bundled names (139,502), six
read as private: two with stray digits ("Maliga0N", "Jerónim67"), two
joined by "@" to a lower-case handle ("Pulipadu @Govardhanagiri") and two
with number lists or dates. When the text may be private the field says
so ("Looks private, so nothing is searched or sent"), and a line whose
only private sign is an address-sized run of digits (no group over six
digits, nine at most in all, counted as they fold, no three digits
followed by four as a phone number writes them, and no word such as
card, code, key, phone or account beside them, in English and some other
European languages; compounds such as "Kreditkartennummer" and words in
other scripts are not read), with words beside it, gets a row
to search it as a place on purpose ("Search … as a place anyway"), which
runs the ordinary place search and its online services only when picked; a
bare number, an email or handle, a password, key, code or IBAN gets none.
A suggested house is named by its number and its street (or, without a
street, its locality, district or city) in the order its country writes them: "10 Downing
Street", "Hauptstraße 12".
A nine-digit number or a short phone number written with no such word
still gets the row: only picking it sends anything. One-time and verification codes,
OTP, 2FA, MFA, CVV and CVC values, "card ending" digits, passphrases,
recovery or seed phrases (twelve words in a row on the BIP39 English list
in `src/search/bip39Words.js`, also with commas, numbered, quoted, joined by
dashes or slashes, or after "my seed is", so a long question or request
still goes to Ask GEV; twelve with four words for places or for asking about
them, such as "park", "airport", "near" or "today", are a list or a request,
which lets about one phrase in a hundred through), "my secret is …", an email spelled
out ("john at example dot com", "punto com", or letter by letter), a door,
alarm or lockbox number ("code 4821"; "zip code 90210" and "area code 415"
are places), "Authorization: Bearer …", a code in a link (`?code=…`), a
spaced UK National Insurance number and "my id is …" are private too.
"Boise ID 83702" names Idaho. Some private text is not caught: a
passphrase run together as one word (a long place name is one word too),
a lower-case word after "otp", "2fa" or "mfa" ("mfa boston" is a name;
"otp ABCDEF" is caught) and a code of lower-case letters after "pin" or
"gate code" ("PIN ABCD" is caught).
A Japanese postcode after a Latin name is refused ("Shibuya 150-0002"), and
so is a name in capitals after a code's label ("MFA BOSTON", which cannot
be told from "OTP ABCDEF"). Text that parses as coordinates or a
grid reference is not private. A place's name is six words at most, or ten
when it has a number in it (an address: "1600 Pennsylvania Ave NW
Washington DC 20500"). The places picked from the Omnibar's rows and chips that carry a position
(a typed name searched as a place, or a plan's place, is not kept; the last 20:
name, position and where the name came from) are kept in this browser's
`localStorage` under `gev:omnibar:recent-places` for the strip; nothing
clears them but the browser's own site data. Setting `PHOTON_URL`
empty turns the suggestions off along with it. Small places come from the
bundled Wikidata packs and are never looked up online; a small place with
the name of a city within 3 km in the same country is that city, and only
the city is listed. A place named in "villages near …" is the nearest of
that name within 150 km of the view, small places included, so a village in
view comes before a bigger namesake far away; with none near, the largest
city of the name. Small places are looked for within 500 km at most, so a
lookup asked for a wider radius reads only the detail tiles around its
centre (the search box asks for 150 km at most). At most 64 detail tiles are kept in memory, the least
recently used dropped first.
### Place-search providers
Coordinate input requires exactly two nonempty components; extra comma or semicolon separators decline to geocoding rather than silently choosing a location.
@@ -8225,7 +8680,7 @@ apply to `public/` assets or built-preview serving.
- Panel POSITION keys are versioned `v8` (`godsEyeView.v8.panelPos.<id>`); collapsed-state keys remain `v6`. The one-time position reset clears stale DISPLAY placements that could overlap the Context rail.
- Map Source lives in the bottom Visual Presets tray. The left accordion contains no MAP STACK panel, and the `k` panel token that addressed it is gone from the share registry, so legacy `ui=k...` state takes the ordinary unknown-token skip.
- A dock popover (Visual Presets, Location) auto-dismisses on mouse-away unless pinned. Focus inside the tray defers that dismissal only when the browser reports `:focus-visible` — keyboard focus and typed-into fields hold the tray open; a mouse-clicked tile does not, because Chromium focuses a `<button>` on press.
- The voice and chat panels share the left panels' glass surface (`--glass-bg`, `--glass-border`, blur(24px) saturate(1.4); `src/ui/styles/ai-chat.css`). The docked voice control draws its own blur on a layer behind it, so the panels inside it still blur the map. Cyber keeps its own surfaces.
- The voice and chat panels share the left panels' glass surface (`--glass-bg`, `--glass-border`, blur(24px) saturate(1.4); `src/ui/styles/ai-chat.css`). The docked voice control draws its own blur on a layer behind it, so the panels inside it still blur the map.
- The desktop right rail (`#right-context-rail`) owns `DISPLAY`, `CCTV`, its active parameter controls, and `GLOBAL CONTEXT` as one fixed responsive stack in that order. Its compact buttons use the same 176 px width as the left accordion and one consistent 50 px height, share the left stack's 52 px edge inset and measured top baseline across HUD variants, then constrain themselves against visible HUD/chrome rectangles and the remaining vertical corridor. `DISPLAY` is no longer draggable and legacy saved coordinates are ignored.
- The right rail is labeled **DISPLAY** (formerly "MOVE") and groups, in order, HUD, DETECT, Bloom, Sharpen, 3D, Clean-UI (HUD + DETECT promoted to the top). Its expanded controls retain the same compact 176 px width as the right-side tabs instead of growing to the wider Context detail-card width. It starts expanded on first run and respects the user's later `v6` collapse choice. Collapses/expands with directional chevrons (`◀` collapsed, `▶` expanded).
- Display and Context use matching 330 px expanded widths and matching compact tab dimensions. The parameter panel is part of Display's expanded content. One right-rail panel is open at a time in every HUD layout and collapsed launchers are hidden; the panel rail beside the stack switches between them (see Panel rails). The most recently opened right-rail panel owns the lane even when it appears later in DOM order; passive restoration and automatic disclosure do not replace that explicit owner. When the open panel exceeds the measured corridor, it scrolls internally.
@@ -8306,11 +8761,11 @@ apply to `public/` assets or built-preview serving.
The ship bridge and the orbital view have their own own-layer gates
(`bridgeEntryAllowed`, `orbitEntryAllowed`; see
[Ship bridge view](#ship-bridge-view) and [Orbital view](#orbital-view)).
- **Aircraft cockpit view:** selecting a commercial or military aircraft reveals a `COCKPIT` action once that aircraft's own layer is on; Contacts is not required. The action shows in Contacts (`#cockpit-entry`) and under the Intel HUD's bottom-right readout (`#cockpit-entry-readout`, with the HUD on, in its Tactical and Cyber layouts), so entry needs no Contacts panel. Turning off the ridden aircraft's layer ends the view (the layer clears its tracking). When an air feed the surrounding picture uses is off, the Cockpit says so instead of blocking: Live Signals leads with `MILITARY FEED OFF · PARTIAL PICTURE` or `FLIGHTS FEED OFF · PARTIAL PICTURE`, and the Contact card shows that line in place of its inputs status, so a partial picture is never presented as complete. `control_cockpit` refuses entry with `entryBlockedReason` `contacts-starting` (a Context change in flight), `subject-layer-off` (the aircraft's layer, or with none tracked any aircraft layer, is off) or `no-tracked-aircraft`. Cockpit mode temporarily releases Cesium's orbit-follow transform and drives a first-person camera from the tracked aircraft's existing smoothed display position and course. Its concave helmet-visor HUD shows callsign, UTC time, coordinates, curved roll/pitch guides, and a seven-division heading tape. Ambient commercial and military AIR contacts use a Cockpit near/far band selected by the shared Display 3D mode: Proximity admits at 150 km and retains to 185 km; All admits at 400 km and retains to 450 km. The shared 3D toggle now applies in Cockpit: Off keeps in-range contacts as rotating 2D aircraft silhouettes, while On lets a ready admitted glTF take over without a drawing gap. The Cockpit model cap remains 60 and can only lower the map budget; in-range contacts that are capped or still loading remain 2D silhouettes instead of degrading to out-of-range dots. Contacts outside the selected band use small rotation-free cyan-white pips for civilian aircraft and amber pips for military. The pilot's own airframe is not drawn in first person, and exiting clears the Cockpit band and restores normal map silhouettes/models. The normal left accordion remains available for Layers and Authoring and keeps the same 26vh HUD-aligned anchor used in map mode, independent of whether the bottom-left Contact card is expanded or collapsed; the right-rail CCTV and Context chooser are hidden to avoid duplicating or overlapping the cockpit presentation. When the intelligence HUD is enabled, its classification, scene summary, collection/orbit metadata, coordinates, and imaging-status text remain visible as reduced peripheral cockpit telemetry; the optical center and flight instruments stay clear, and turning the HUD off still hides it. Ground speed, exact heading, and rendered altitude form one compact lower-center instrument cluster, keeping the horizon and peripheral view open. A second live altitude tape hugs the inside-right visor rim: its rail and nine moving ticks are derived from the same responsive keyhole radius, remain 20 px inside the circular edge even on wide displays, fade deeply at both vertical ends, and move continuously behind a fixed current-altitude pointer; its interval tightens automatically near the surface and it is suppressed on narrow screens. Cockpit mode also has a weather-backed transparent volumetric-cloud pass derived from the supplied FBM/domain-warped R&D shader. It renders at no more than 520×320, uses 24 ray steps/three FBM octaves at 12 FPS, is clipped to the visor, fails clear when Open-Meteo is unavailable, and stops its animation completely on cockpit exit. It does not restore the prior CPU weather canvases, precipitation, scene fog, or any map-mode effect. When Contacts is active for the tracked aircraft, the compact `CONTACT` rail adds the 250 km subject window, four cohort counts, nearest observed/mapped example with relative bearing and distance, freshness, explicit uncertainty, and Previous and Next controls plus its own collapse control. The mirrored right rail is a three-page **cockpit briefing carousel**: source-backed live signals, location-matched regional headlines, and physical-region/current-weather context from bundled Natural Earth polygons and Open-Meteo. It is manual-first: Previous, Next, and direct page controls are always available, and the visible `CYCLE OFF` / `CYCLE ON` control starts or stops the nine-second page cycle. The cycle pauses on hover or keyboard focus and stops while collapsed, hidden, or outside cockpit mode; live signal data continues refreshing either way. Regional News holds its list to the last 24 hours (`newsWindowHours` in the brief; the client drops anything older or undated even if a server sends it) and shows four distinct states: fresh results with no banner and a `{SOURCE} · LAST 24 H` footer; earlier results kept after a failed refresh under `CACHED · REFRESH FAILED` with the cached age in the footer; `NO NEWS IN THE LAST 24 H` when a source answered wiLine truncated
- **Aircraft cockpit view:** selecting a commercial or military aircraft reveals a `COCKPIT` action once that aircraft's own layer is on; Contacts is not required. The action shows in Contacts (`#cockpit-entry`) and under the Intel HUD's bottom-right readout (`#cockpit-entry-readout`, with the HUD on, in its Tactical layout), so entry needs no Contacts panel. Turning off the ridden aircraft's layer ends the view (the layer clears its tracking). When an air feed the surrounding picture uses is off, the Cockpit says so instead of blocking: Live Signals leads with `MILITARY FEED OFF · PARTIAL PICTURE` or `FLIGHTS FEED OFF · PARTIAL PICTURE`, and the Contact card shows that line in place of its inputs status, so a partial picture is never presented as complete. `control_cockpit` refuses entry with `entryBlockedReason` `contacts-starting` (a Context change in flight), `subject-layer-off` (the aircraft's layer, or with none tracked any aircraft layer, is off) or `no-tracked-aircraft`. Cockpit mode temporarily releases Cesium's orbit-follow transform and drives a first-person camera from the tracked aircraft's existing smoothed display position and course. Its concave helmet-visor HUD shows callsign, UTC time, coordinates, curved roll/pitch guides, and a seven-division heading tape. Ambient commercial and military AIR contacts use a Cockpit near/far band selected by the shared Display 3D mode: Proximity admits at 150 km and retains to 185 km; All admits at 400 km and retains to 450 km. The shared 3D toggle now applies in Cockpit: Off keeps in-range contacts as rotating 2D aircraft silhouettes, while On lets a ready admitted glTF take over without a drawing gap. The Cockpit model cap remains 60 and can only lower the map budget; in-range contacts that are capped or still loading remain 2D silhouettes instead of degrading to out-of-range dots. Contacts outside the selected band use small rotation-free cyan-white pips for civilian aircraft and amber pips for military. The pilot's own airframe is not drawn in first person, and exiting clears the Cockpit band and restores normal map silhouettes/models. The normal left accordion remains available for Layers and Authoring and keeps the same 26vh HUD-aligned anchor used in map mode, independent of whether the bottom-left Contact card is expanded or collapsed; the right-rail CCTV and Context chooser are hidden to avoid duplicating or overlapping the cockpit presentation. When the intelligence HUD is enabled, its classification, scene summary, collection/orbit metadata, coordinates, and imaging-status text remain visible as reduced peripheral cockpit telemetry; the optical center and flight instruments stay clear, and turning the HUD off still hides it. Ground speed, exact heading, and rendered altitude form one compact lower-center instrument cluster, keeping the horizon and peripheral view open. A second live altitude tape hugs the inside-right visor rim: its rail and nine moving ticks are derived from the same responsive keyhole radius, remain 20 px inside the circular edge even on wide displays, fade deeply at both vertical ends, and move continuously behind a fixed current-altitude pointer; its interval tightens automatically near the surface and it is suppressed on narrow screens. Cockpit mode also has a weather-backed transparent volumetric-cloud pass derived from the supplied FBM/domain-warped R&D shader. It renders at no more than 520×320, uses 24 ray steps/three FBM octaves at 12 FPS, is clipped to the visor, fails clear when Open-Meteo is unavailable, and stops its animation completely on cockpit exit. It does not restore the prior CPU weather canvases, precipitation, scene fog, or any map-mode effect. When Contacts is active for the tracked aircraft, the compact `CONTACT` rail adds the 250 km subject window, four cohort counts, nearest observed/mapped example with relative bearing and distance, freshness, explicit uncertainty, and Previous and Next controls plus its own collapse control. The mirrored right rail is a three-page **cockpit briefing carousel**: source-backed live signals, location-matched regional headlines, and physical-region/current-weather context from bundled Natural Earth polygons and Open-Meteo. It is manual-first: Previous, Next, and direct page controls are always available, and the visible `CYCLE OFF` / `CYCLE ON` control starts or stops the nine-second page cycle. The cycle pauses on hover or keyboard focus and stops while collapsed, hidden, or outside cockpit mode; live signal data continues refreshing either way. Regional News holds its list to the last 24 hours (`newsWindowHours` in the brief; the client drops anything older or undated even if a server sends it) and shows four distinct states: fresh results with no banner and a `{SOURCE} · LAST 24 H` footer; earlier results kept after a failed refresh under `CACHED · REFRESH FAILED` with the cached age in the footer; `NO NEWS IN THE LAST 24 H` when a source answered with nothing Line truncated
- **Cockpit left-panel clearance:** the Cockpit Contact card and peripheral HUD participate in the adaptive left accordion's live obstacle measurements, including live viewport-height changes. Expanding Layers or Authoring keeps the active panel in the available upper-left corridor with internal scrolling; it does not cover the Contact card, lower Cockpit controls, or Cesium credit line. Outside Cockpit the hidden card does not alter the normal corridor.
- **Cockpit Context scope:** the 250 km radius applies to the air/sea proximity cohorts. Installation counts come only from the currently loaded viewport and are labeled `CURRENT VIEWPORT ONLY` in the cockpit as well as the normal Context panel; neither surface presents them as a complete 250 km installation survey.
- **Cockpit camera anchor:** first-person mode does not write feed-boundary corrections directly into the camera. A cockpit-only inertial anchor advances from the selected aircraft's displayed course and speed, then converges toward the authoritative delayed track with correction capped below forward motion. The displayed kinematics are derived from the same consecutive fix segment as the rendered position, with raw feed speed/course used only as fallback; a transient zero/missing feed speed therefore cannot freeze a visibly moving aircraft after layer enable or a map/cockpit handoff. Rendered altitude continues to come from that interpolated track position. Late ADS-B fixes and short render stalls can remove drift without accelerating or reversing the view. Camera placement runs before scene update/culling at a bounded 20 Hz so a moving cockpit does not force Photoreal 3D Tiles to retraverse on every display frame; textual instruments update at 10 Hz and context/layout work at 4 Hz. Every far Cockpit contact pip shares one stable Cesium texture-atlas entry and skips unused screen-projected course calculations, while only in-range 2D aircraft silhouettes pay the screen-projected rotation cost; ambient glTF collections are hidden/retained rather than synchronously destroyed at cockpit entry, and context rails lay out only on explicit content/state changes and viewport resize. The deliberate 15/30-second layer interpolation delays and per-Cesium-frame position caches remain unchanged.
- **Cockpit route, vision, and view controls:** visible on-screen `COCKPIT`, `RESET`, and `EXIT COCKPIT` controls are the way in and out; Cockpit claims no `C` shortcut, so `C` keeps toggling CCTV, also inside a first-person view. RESET uses the same canonical globe route as the map and voice actions, exits Cockpit, and releases its camera ownership rather than exposing the hidden map-style top action. When the tracked commercial flight has a plausible ADSBDB route, the top of the right briefing rail shows a compact `FROM → TO` airport strip and the visor shows a centered estimated-destination chevron with its relative bearing; its destination label rounds to whole degrees in 000–359, wrapping rounded north to 000° while the chevron continues to use the relative bearing independently of label rounding; absent or implausible route data hides the strip and cue rather than guessing. The cockpit-local vision control is an interactive `PREV / CURRENT / NEXT` carousel over `NORMAL`, `CRT`, `NVG`, `FLIR`, `ANIME`, and `NOIR`; its previous/next actions wrap, and activating the current value advances to the next style. Cockpit enters on the active map preset, so a Cyber FLIR map opens Cockpit on FLIR while Normal remains a distinct option instead of producing a second FLIR entry. Cockpit choices temporarily activate the existing Cesium post-process stages, while exiting Cockpit through either EXIT or RESET restores the pre-entry map style. The regional-news page uses a free Google News RSS locality query for the last day (`when:1d`) first, with the existing GDELT query (24 h timespan) retained only as a fail-soft fallback; both keep only articles published in the last 24 hours, newest first; linked headlines remain reporting, not verified incidents or risk intelligence.
- **Cockpit route, vision, and view controls:** visible on-screen `COCKPIT`, `RESET`, and `EXIT COCKPIT` controls are the way in and out; Cockpit claims no `C` shortcut, so `C` keeps toggling CCTV, also inside a first-person view. RESET uses the same canonical globe route as the map and voice actions, exits Cockpit, and releases its camera ownership rather than exposing the hidden map-style top action. When the tracked commercial flight has a plausible ADSBDB route, the top of the right briefing rail shows a compact `FROM → TO` airport strip and the visor shows a centered estimated-destination chevron with its relative bearing; its destination label rounds to whole degrees in 000–359, wrapping rounded north to 000° while the chevron continues to use the relative bearing independently of label rounding; absent or implausible route data hides the strip and cue rather than guessing. The cockpit-local vision control is an interactive `PREV / CURRENT / NEXT` carousel over `NORMAL`, `CRT`, `NVG`, `FLIR`, `ANIME`, and `NOIR`; its previous/next actions wrap, and activating the current value advances to the next style. Cockpit enters on the active map preset, so a FLIR map opens Cockpit on FLIR while Normal remains a distinct option instead of producing a second FLIR entry. Cockpit choices temporarily activate the existing Cesium post-process stages, while exiting Cockpit through either EXIT or RESET restores the pre-entry map style. The regional-news page uses a free Google News RSS locality query for the last day (`when:1d`) first, with the existing GDELT query (24 h timespan) retained only as a fail-soft fallback; both keep only articles published in the last 24 hours, newest first; linked headlines remain reporting, not verified incidents or risk intelligence.
- Cockpit wind-direction labels wrap after rounding to whole degrees, so a direction of 359.5° displays as `N · 0°` rather than `N · 360°`.
- The transit, ALPR, vessel, CCTV, Local ADS-B, flight and military context, awareness, Cockpit and Street Level heading readouts, and the query tools' vessel `course_deg` and `heading_deg`, aircraft `course_deg`, transit `bearing_deg`, camera `heading_deg` and satellite `rise_azimuth_deg` and `azimuth_deg`, round through `roundHeadingDegrees` in `src/data/headingDegrees.js` (whole degrees 0–359, `null` when not finite, so each caller keeps its own placeholder); `normalizeHeading` lives there too and `cockpitMath.js` re-exports it. The Cockpit's `TRACK ACQUIRED` signal uses `formatHeadingReadout`, so a 359.6° track reads `COURSE 000°`.
- **Cockpit missing observations:** missing local weather observations remain unknown rather than being converted to zero or clear skies, in the briefing and in the cloud effects; a missing temperature drops the whole local weather record, including its wind and condition.
@@ -8494,6 +8949,16 @@ on it.
per frame, it holds NO continuous-render hold — the governor stays idle with
earthquakes on, and the manager's `layer-tick` / `layer-visibility` requests
carry new data to the screen. Pinned in `src/data/earthquakes.test.mjs`.
The one animation is the selected quake's contour lines
(`src/app/layers/earthquakeRipples.js`), painted on the world overlay, not
the ground set: they ask for frames for `RIPPLE_ACTIVE_CYCLES` (3) runs out
to the disc's edge after a selection (about 14 s), only while the disc is on
screen, then rest as still contours and ask for none. A parked camera with a
quake selected therefore returns to idle. A feed refresh updates the
selected quake in place: it neither runs the contours again nor takes back
a shared selection made since; only a click or a label's activation does.
Selecting fades that one disc's flat fill once (an `upsert`, not per frame)
under the painted gradient.
- **Geocode framing has an off-centre sanity gate.** A viewport that is both
bigger than any city (>300 km diagonal) and not centred on its own geocoded
location (anchor >15% of the diagonal from the centroid) is replaced by a
@@ -9278,7 +9743,7 @@ when their footprints touch or contain one another, never across a seam toleranc
outside this change.
- `scripts/qa-form-fields.mjs` exercises native selections, number validity,
calibration commit/cancel and stale-camera/disposal guards against an installed
controller with fixture ports, plus default/Cyber and narrow translated layouts.
controller with fixture ports, plus default and narrow translated layouts.
## Docker health reporting
+12
View File
@@ -368,6 +368,18 @@ names the nearest frame's time once every globe tile drawn shows that
frame's own imagery (`src/render/cesium/imageryFrames.js`). The checks
`globe.imagery.frames` and `globe.imagery.video` cover both.
It also draws `decoded` sources (`imageryDecoded`): tiles the application
makes itself and hands over as finished images. Their slots are times: the
source's `slotAt` names the slot a time shows and `prefetch` the slots held
ahead, of which the first `prefetch` (the option, 1 by default) load unseen.
Each slot is a Cesium imagery layer in the layer's tiling whose tiles are the
images the source's `tile` answers, asked as `shown` or `prefetch`; a
deferred tile is asked again on a later frame, a missing one draws its
parent's, and a slot let go aborts the tiles it still waits on and closes an
image that arrives after. A time with no slot draws nothing and announces
nothing; `frameReady` names the slot shown once it is drawn. The check
`globe.imagery.decoded` covers it.
Every Cesium draw set takes `setColumns` (`columns`): icon sets on the GPU,
any other as the rows the columns make over the items it holds, each row the
item of that id with the columns' fields over it, replacing every item as
+7 -1
View File
@@ -54,8 +54,14 @@ fallback for zero; holds may be zero.
Visual fields are `style`, `mapStack`, `styleParams`, `bloom`, `sharpen`, `hud`, and
`detection`, and `scope`. Bloom has `enabled`, `intensity`, `version`; sharpen has `enabled`,
`intensity`; HUD has `visible`, `variant`; detection has `mode`, `density`,
`intensity`; HUD has `visible`, `variant` and an optional `sonar`; detection has `mode`, `density`,
`allocation`, `fadePct` and `outsideOpacityPct`. Scope has `enabled`, `featherPct`.
HUD `sonar: true` is Sonar on beside a layout that cannot say it (Minimal); it
is written only then, so Tactical with Sonar stays the variant `cyber` and a
shot without Sonar has no `sonar`. A shot without it opens with Sonar on only
when its variant is `cyber`. A build from before `sonar` refuses a project
that has it, as it refuses any field it does not know; every other project
still opens there.
The latter settings were written by Update Shot but previously lost during
normalization; they now survive import and capture.
Version-1/2 bloom without an explicit scale version uses the original inverted
+7 -2
View File
@@ -134,7 +134,7 @@ probability of about 255 in 256 (many of them already fail as base64url).
| 13 | thing | LEN | none | sub-message, see thing views |
| 14 | `style` | enum | `normal` | normal, retro, surveillance, thermal, anime, noir, snow (retired) |
| 15 | `mapStack` | enum | `photoreal` | photoreal, bing-aerial, bing-labels, esri-imagery, osm |
| 16 | `hudVariant` | enum | style | tactical, operator (retired), minimal, cyber |
| 16 | `hudVariant` | enum | style | tactical, operator (retired), minimal, cyber (Tactical + Sonar) |
| 17 | `bloomIntensity` | uint | style | |
| 18 | `bloomVersion` | uint | 2 | |
| 19 | `sharpenIntensity` | uint | style | |
@@ -176,7 +176,11 @@ Opacity slider (the long form's `sco`). It is written only below 100, so a
link made before it, which opens at full opacity, keeps its code.
Flag bits (field 9): 0 `bloom`, 1 `sharpen`, 2 `hudVisible`, 3
`celestialRing` (each defaulting by style), 4 `scopeEnabled` (default on).
`celestialRing` (each defaulting by style), 4 `scopeEnabled` (default on), 5
`hudSonar` (default off). `hudSonar` is Sonar on beside a HUD layout whose code
cannot say so, Minimal (the long form's `hs=1`); Tactical with Sonar stays the
`cyber` layout code alone. A link made before the bit has it off, and opens
with Sonar on only when it names `cyber`, as before.
### Style defaults
@@ -282,6 +286,7 @@ reserved: a decoder ignores that entry, as for collapsed 0.
| 8 | `global-context-panel` | `g` | collapsed |
| 9 | `pp-toggles` | `p` | collapsed |
| 10 | `param-slider-panel` | `m` | expanded |
| 11 | `space-missions-panel` | `n` | collapsed |
### Style parameters (field 27)
+182 -20
View File
@@ -37,14 +37,40 @@ one-panel rule too. Share links continue to record which panels are open.
## Component kit
`src/ui/kit/` holds the generic components: `UiRail`, `UiTooltip`, `UiIcon`,
`UiButton`, `UiPanel`, `UiSegmented`, `UiSlider`, `UiChip`, `UiSelect`,
`UiBadge` and `UiEmpty` so far, with more joining as the controls they serve
are converted. One component
`UiButton`, `UiCloseButton`, `UiPanel`, `UiSegmented`, `UiSlider`, `UiChip`,
`UiSelect`, `UiSearchField`, `UiCheckbox`, `UiDialog`, `UiBadge` and `UiEmpty` so far, with more
joining as the controls they serve are converted. One component
serves every use of a control, with props for the differences (`UiPanel`'s
`sideways`, `glow`, `scroll`), rather than a copy per panel. The components
are styled by the existing stylesheet and custom properties; a kit class such as
`ui-button--icon` carries no Core style yet, and a converted control keeps
its own classes beside it. They contain no application state.
are styled by the existing stylesheet and custom properties, and they contain
no application state. The kit's own classes wear Core's standard looks, each
sharing one selector list with the Core skin it comes from, so the rules are
never copied:
| Kit class | Look | Rules |
| --- | --- | --- |
| `UiButton` `variant="ghost"` (default) | none: the caller's classes style it | — |
| `UiButton` `variant="action"` | the action surface (`gev-action-button`); `tone="danger"` hovers red, `size="compact"` is the shot-row footprint (on this variant only) | `src/ui/styles/action-button.css` |
| `UiButton` `variant="primary"` | the action surface with a group's main-action accent | `src/ui/styles/action-button.css` |
| `UiButton` `variant="icon"` | the 22px square glyph button of a panel's collapse toggle | `src/ui/styles/controls.css` |
| `UiCloseButton` | a close, dismiss or clear button: a bare glyph (× with `glyph="times"`, the Material `close` symbol with `glyph="icon"`) with no padding, border or background of its own and a pointer; the site's feature class sets size, colour, hover and any surface, and `bare` leaves the look off for a skin that sets its own padding and border | `src/ui/styles/close-button.css` |
| `UiSearchField` | a search field: the Material `search` glyph and a search input in a flex row, the input bare (no border or background, free to shrink); the site's feature classes set the frame's size, surface and focus ring and the input's type and outline, and the browser's own cancel button is left to each skin | `src/ui/styles/search-field.css` |
| `UiCheckbox` | a checkbox: a label wrapping a native box and its words in a centred flex row; the box keeps each site's size, margin and accent colour, and the site's feature class sets the row's gap, direction and colour | `src/ui/styles/checkbox.css` |
| `UiDialog` | none: a native modal `<dialog>`; the site's feature class or inline style draws it | — |
| `UiChip` | the read-only chip (a pill of uppercase mono text); `selected` takes the accent | `src/ui/styles/chip.css` |
| `UiEmpty` | the one-line empty state (dim mono text), its hint on a line below | `src/ui/styles/empty-state.css` |
| `UiBadge` | the read-only badge (`gev-status-badge`) | `src/ui/styles/status-badge.css` |
| `UiSegmented` | the segmented control (`gev-segmented`, `gev-segment`) | `src/ui/styles/segmented-control.css` |
A pressed action, primary or icon button looks as a hovered regular one does
(a compact action's quieter hover is for an unpressed button), and a disabled
one dims and ignores hover and press. `tone` is `accent` or `danger`, and
`size` styles the action variant only. Each look's resting rule selects one
kit class; the button, chip and empty-state skins load before the feature
stylesheets that restyle them, so a feature class still wins. The badge and
segmented skins are the stylesheets their Core classes always used. A
converted control keeps its own classes beside the kit's.
`src/ui/kit/kitStyles.test.mjs` pins these rules.
`UiPanel` takes a `title`, slots and `v-model:collapsed`, but its
`collapsed` drives only the button and `ui-panel--collapsed`: the root's
`collapsed` class, which hides the body, is drawn at once by `v-panel-state`
@@ -57,12 +83,70 @@ segmented group in Core is a `UiSegmented`; the old `segmentedControl.js`
adapter is gone.
`UiButton` adds `pressedClass`, Core's class on a pressed toggle (most use
`active`); its pressed classes toggle through `classList`, so a class other
code adds (a voice highlight) survives a press. Every pressed toggle in the
views is a `UiButton` except Bhote Koshi's cinematic button and the
tilt-map button, whose owners still write their state into the DOM. Core's
code adds (a voice highlight) survives a press. Not every pressed toggle in
the views is one yet: the context view and a few panel buttons still
hand-write theirs, and
Bhote Koshi's cinematic button and the tilt-map button have owners that
write their state into the DOM. Core's
pressable chips and pills (rail card chips, map sources, cities and places)
are `UiButton`s too; `UiChip` is a non-interactive label chip, used by
the voice card.
The welcome card's buttons (SKIP, the three start tiles, BROWSE STORIES,
BACK and the main NEXT / ENTER GOD MODE action) are ghost `UiButton`s:
the start tiles are pressed toggles, and all but SKIP keep `aria-disabled`
rather than `disabled`, so they stay focusable while the card is busy. Its
tile, tip, Stories and arrow glyphs are `UiIcon`s with `:size="null"`, so
first-run.css still sizes them (`src/ui/kit/welcomeControls.test.mjs` pins
it). God mode's preview globe and callouts stay inline SVG drawings, and
its outbound links stay links.
Every button in the Stories views (the Stories entry and its popup and
toast, Explore, the Story screen, its header, rail, timeline and context
panel) is a ghost `UiButton`. Explore's topic chips and map pins, the
Story screen's Context button and the timeline's Expand map are pressed
toggles, with no pressed class since their skins read `aria-pressed`;
Explore's story cards are `role="button"` elements and keep their own
`aria-pressed`. Their glyphs are inline SVG drawn for Stories, which no
Material symbol the page loads draws the same, so they stay SVG; the two
search fields keep their own markup, since `UiSearchField`'s Material
magnifier would replace their SVG one, and their clear buttons, which draw
an SVG cross, are ghost `UiButton`s rather than `UiCloseButton`s
(`src/ui/kit/storiesControls.test.mjs` pins it).
The Omnibar's mic (a pressed toggle with `active`) and its suggestion
strip's chips (options, so `aria-current` rather than `pressed`) are
ghost `UiButton`s, and its search, row and chip glyphs are `UiIcon`s with
`:size="null"`, so its own rules still size them
(`src/ui/kit/omnibarControls.test.mjs` pins it). The mic's and the chat
row's glyphs stay inline SVG, since no Material symbol the page loads
draws them, and its field is its own combobox rather than a
`UiSearchField`.
The Visual panel's buttons (its presets and map sources, HUD, Sonar,
Detection, 3D, Clean UI, Celestial, Bloom, Sharpen and Reset to default) are
ghost `UiButton`s. HUD, Sonar, 3D, Celestial, Bloom and Sharpen are
pressed toggles with `active` as their pressed class; Detection sets its own
`active` and `panoptic` classes, and Clean UI is not a pressed toggle (its
owner marks it `active`). The panel's Scope, Celestial,
sky, application-row and Reset glyphs are `UiIcon`s with `:size="null"`, so
the panel's rules still size them (`src/ui/kit/visualControls.test.mjs` pins
it). The toggles' other glyphs (◎ ▣ ✈ □ ✨ 🔍) and the presets' style glyphs
are text characters, not Material symbols, and stay plain spans.
The entity card's buttons are ghost `UiButton`s: its four preview buttons
(Photos, Route, 3D, Cockpit view) are pressed toggles with `active`, Follow
is one with `entity-card__action--on`, and the cockpit entry, Fly to and
Ask GEV are plain buttons; so are the camera preview's bigger-view and More
info buttons and the nearby lists' rows (`SpotConditions`, which the
context view shows too). Their glyphs are `UiIcon`s with `:size="null"`,
so entity-card.css and spot-conditions.css still size them
(`src/ui/kit/entityCardControls.test.mjs` pins it). Ask GEV's chat bubble
stays inline SVG, since no Material symbol the page loads draws it.
The Layer Finder's buttons (Search, Filter, the filter menu's Status and
Category options and the bar's two clear chips) are ghost `UiButton`s.
Search and the options are pressed toggles; the options' pressed class is
`active`, while Search keeps its own `active` binding, which also stays on
while a query is typed. The Filter button opens a disclosure and carries
`aria-expanded`, not `aria-pressed`. Every glyph its own template draws is
a `UiIcon` with `:size="null"`, so `layer-finder.css` still sizes them
(`src/ui/kit/layerFinderControls.test.mjs` pins it); the search field's
magnifier is `UiSearchField`'s own span.
`UiSelect` renders the bare native select (Core's labels sit outside it or
come as an `aria-label`) with `v-model`, `options` and `disabled`;
options that carry their own attributes come through the slot, a caller's
@@ -74,9 +158,66 @@ gain) takes `hold`. Every select in the views is a `UiSelect`.
density variants and colours stay caller classes, and it renders the CCTV
source and calibration badges and the rail card badges. `UiEmpty` takes
a `title` and `hint`, but Core's empty states are one line, so the title
is the text itself rather than a bold heading; the Scene shot list, mission
roster and imagery strip use it. The locale picker's and the mission tables'
is the text itself rather than a bold heading; the News feed, Scene shot
list, mission roster and imagery strip use it. The locale picker's and the mission tables'
empty rows stay a paragraph and table cells.
`UiCloseButton` is a `UiButton` with a fixed glyph, a required `label` and
no tip unless the site passes a `title`; attributes and classes pass through,
so each site keeps its id, feature class and look. Every close, dismiss and
clear button in the views that draws a cross is one
(`src/ui/kit/closeButtons.test.mjs` pins it) except Story Explore's two
search clears, whose SVG cross is neither of its glyphs; the Story context
sheet's Close is a text button, a plain `UiButton`. Street Level's and the
space mission's keep `bare`, since their skins set their own padding and
border, and so does the credits list's. The
Quebec CCTV overlay's close is one too, and so is the Omnibar guide's,
which keeps its feature class and tip.
`UiSearchField` takes `v-model`, a required `label` (the input's
accessible name), `placeholder` and `tag` (`div`, given `role="search"` by
the site, or `label`); attributes and classes go to the frame, and
`inputId`, `inputClass`, `autocomplete` and `spellcheck` to the input. With
`clearLabel` it shows a `UiCloseButton` (`clearClass`, its label as its tip)
while text is typed, which empties the field and focuses the input again.
Escape stops at the input and is emitted with its event, so a site that also
keeps the browser from clearing the field prevents it there; `focus()`
focuses the input. The Context search and the Layer Finder's are
`UiSearchField`s; the locale picker's combobox, the Omnibar's location
field and the Data Library's labelled search are other controls. Its kit rules hold the declarations both search
skins had in common, moved rather than copied, and load before them.
`UiCheckbox` is a `<label>` wrapping a native `<input type="checkbox">` and
its default slot; `trailing` puts the box after the words, as the Visual
panel's rows have it. It takes `v-model` (the change emits the checked state)
and emits `change` with its event; without a `modelValue` the box is the
browser's own, as the welcome card's "Don't show this again" is, whose
owner puts a refused save back itself. `restore` puts the box back to
`modelValue` once a change has rendered without the owner taking it, so the
voice panel's quick commands and Voice Preview show the applied value after
a refused change. Attributes and classes go to the label; `inputId` and
`inputAttrs` (such as `aria-describedby` or a data hook) to the box. The
Visual panel's Scope, sky and application toggles, the voice and chat
preferences, the Data Library's filter and the welcome card's box are
`UiCheckbox`es, and so are Story Explore's filter options, whose label
keeps its `fopt` class (`src/ui/kit/checkboxes.test.mjs` pins it). Its kit
rule holds the centred row the checkbox-only labels drew, moved rather than
copied.
`UiDialog` is a native `<dialog>` its owner opens and closes with `open`:
true opens it with `showModal()` (on mount, for one mounted open), false
closes it, and unmounting closes it. Each change is applied once the content
has rendered and then emitted as `opened` or `closed`, so the Data Library
focuses its search field on open and returns focus to Browse on close.
Escape's `cancel` is prevented and emitted as `dismiss`, so the owner
decides; `backdropDismiss` makes a click on the dialog itself, outside its
content, a `dismiss` too. When the browser closes the dialog on its own
while `open` is still true (an Escape the page may not cancel),
`browserClose` tells the owner; closing on unmount reports nothing. A DOM
without `showModal()` leaves it closed rather than failing. Attributes,
classes, styles and listeners go to the dialog, and `element` is exposed.
The Data Library and the scene sharing dialogs are `UiDialog`s
(`src/ui/kit/dialogs.test.mjs` pins it); the panels drawn as
`role="dialog"` (key setup, the welcome launcher, the CCTV popup, Story
Explore's filter, the credits) and the render failure's `alertdialog` are
other controls. The two dialogs share no declarations, so it has no kit
rules.
`UiSlider` keeps the native range input rather than drawing a
`role="slider"` track, so Core's keyboard, form behaviour and styling stay;
it takes `v-model`, `min`, `max`, `step` and `disabled`, emits a
@@ -92,14 +233,19 @@ a functional component would not render again.
Controls share one skin, so every panel reads the same. Every scrolling
surface carries the kit's `.ui-scroll`, which draws the thin
themed scrollbar from `--scroll-thumb` and `--scroll-track`; the Cyber theme
sets those two tokens, and Cockpit's HUD windows keep their accent tint. A
themed scrollbar from `--scroll-thumb` and `--scroll-track`, and Cockpit's HUD windows keep their accent tint. A
surface without it would draw the platform's light scrollbar, because the
page declares no dark `color-scheme`. Selects and number fields are
`.gev-field`, which draws its own chevron in place of the platform's arrow
and keeps native spinners dark; ranges are `.gev-quantitative-slider`, with
a feature supplying only its accent.
`t()` is not reactive. Words a view passes to a kit component as a prop
(`UiCloseButton`'s `label`) follow a locale change on the view's next
render, but words in a kit component's slot do not: the compiled slot does
not render the child again. A view whose words must follow the locale at
once passes the locale itself as a prop or key, as the credits line does.
## Phases
1. **Foundation.** Vue, Pinia and the Vite Vue plugin join the browser build
@@ -167,8 +313,13 @@ a feature supplying only its accent.
the whole panel from the `gev-cctv` store, including the camera picker,
the inline pose editor, the frame preview, source badge and typed
summary; `CctvControls` keeps its listeners, the frame requests and the
live video surface), Layers (done: `LayerPanel` presents each row and
renders `LayerRows` synchronously; keyed chips and list items keep focus
live video surface; `QuebecCctvOverlay` teleports the Québec 511 player
and its map preview to the end of the body, rendered synchronously by
`createQuebecCctvOverlay()` from the view it computes, as the rail cards
are; the owner keeps every decision and the parts the template never
binds: each video's source, playback and refresh timer, the window's drag
and the marker's per-frame visibility and place), Layers (done:
`LayerPanel` presents each row and renders `LayerRows` synchronously; keyed chips and list items keep focus
through the refresh their own click triggers, and clicks re-read the live
descriptor before acting), Display (in progress: `DisplayPanel` renders
the HUD, Sonar, Scope, Celestial, detection, bloom, sharpen and the
@@ -213,7 +364,11 @@ a feature supplying only its accent.
`gev-location` store, and the search field keeps its listeners; beside
the voice control, the dock teleports each voice pointer reticle to the
body where its `PointerReticle` presents it in the `gev-pointer-reticle`
store), the phone shell (`PhoneTabBar` renders the tabs and open sheet the shell
store; `startGuide()` renders the Omnibar's guided walk, `OmnibarGuide`,
synchronously from the view it computes for each step, teleported to the
end of the body, and keeps every decision and word, focus and its return,
Escape, the entrance replay, and the callout's and spotlight rings' place
each frame), the phone shell (`PhoneTabBar` renders the tabs and open sheet the shell
publishes to the `gev-display` store, teleporting the tab bar and sheet
backdrop to the end of the page from the first publish until the shell
is destroyed; the shell takes their clicks from the document), the
@@ -291,7 +446,14 @@ a feature supplying only its accent.
choices, DISMISS and "Don't show this again" call the launcher's
controls; a refused save hands the tick back to the view to revert. The
launcher still reads the rendered card for its hit test, keyboard trap,
focus and overflow measurement), then
focus and overflow measurement), the attribution line (for a renderer
without its own credit display, `mountCreditsView()` renders
`CreditsView` synchronously, as the weather readout is, and the view
teleports the line and its "Data attribution" list to the end of the
body, where the page's rules select them; the owner keeps the credits
shown, the list's open state and its focus, and words the view again
when the locale changes; the list's close button is a bare
`UiCloseButton`), then
Cockpit (in progress: `CockpitBriefing` renders the briefing card's
pages, cycle toggle, regional news and local conditions, and
`CockpitContext` the Contact card's scope, navigation, counts, nearest
@@ -338,8 +500,8 @@ a feature supplying only its accent.
records surface by surface; [Building UI](../CONTRIBUTING.md#building-ui)
now requires the pattern for new UI. The page-level markup tests read
`renderApplicationHtml()`, the real views rendered on the server, and new
tests mount components; three tests still read a `.vue` file's source
(`cyberTheme`, `panelStorageDocs`, `geoFileImport`). The views translate with `t()`
tests mount components; two tests still read a `.vue` file's source
(`panelStorageDocs`, `geoFileImport`). The views translate with `t()`
while rendering, and vue-i18n holds the locale they read; the attribute
translation pass is left for static page markup (the loading screen and a
host's own markup). An explicit API for hosts to register panels and rail items is
@@ -361,7 +523,7 @@ a feature supplying only its accent.
- Panels lifted out of a view keep its verbatim markup in
`src/ui/views/panels/`, which Prettier leaves alone like the views.
- Visual parity: before/after screenshots of every panel at desktop and phone
widths, in the default and Cyber themes, with the rail as the only expected
widths, in the default theme, with the rail as the only expected
difference.
- Browser QA: the selector-based `scripts/qa-*.mjs` suites keep passing.
- `npm run format:check`, `npm run check:boundaries`, `npm run i18n` and
+9 -11
View File
@@ -1,9 +1,8 @@
# Panel surface contract
`src/ui/styles/panel-surfaces.css` supplies an opt-in visual surface for new
panels. It uses the application's default color, font, border and radius tokens;
Cyber supplies its existing red/slate palette, monospace typography and shaped
frame. This is CSS shared by the existing panel system, not a panel registry or
panels. It uses the application's default color, font, border and radius tokens.
This is CSS shared by the existing panel system, not a panel registry or
a controller. A panel ID does not need a new theme selector.
## Markup
@@ -57,13 +56,12 @@ fit when those contents should instead scroll.
| Mount | Shared contract | Owner responsibilities |
| ------------------------------------- | --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Direct child of `#left-panel-stack` | An owner with a direct `[data-panel-surface]` child receives relative positioning and allocated height; inner surface/body skin | Add the wrapper shown above, use the existing layout/disclosure owners, and retain left-rail focus/auto-collapse rules. |
| Direct child of `#right-context-rail` | The same hooks with right-rail allocation and intrinsic measurement | Keep `data-rail-scroller` on the body so measurement preserves its scroll position. Respect Cyber's one-expanded-panel policy. |
| Direct child of `#right-context-rail` | The same hooks with right-rail allocation and intrinsic measurement | Keep `data-rail-scroller` on the body so measurement preserves its scroll position. |
| Surface inside `#command-dock` | Surface, controls, popup decoration and inherited dock concealment | Supply geometry, stacking, disclosure, pin behavior if wanted, safe viewport bounds and dismissal. This CSS does not extend the existing Location/Visual Presets tray stack manager to arbitrary panels. |
| `dialog[data-panel-surface]` | The same surface/body skin; a closed dialog remains hidden | Set width/max-height, use `showModal()` or `show()` and `close()`, and own labels, initial/return focus and dismissal. Do not put `panel-collapsible` on a dialog. |
For rails, `--panel-expanded-width` and `--panel-collapsed-width` customize
the desired widths within the rail; otherwise Cyber uses its existing left,
right and collapsed panel widths. `--left-panel-allocated-height` and
the desired widths within the rail. `--left-panel-allocated-height` and
`--right-panel-allocated-height` belong
to the existing layout owner, not to individual panels. The surface must be
the wrapper's first non-glow child because left-rail intrinsic measurement
@@ -121,9 +119,9 @@ dismiss open popups/dialogs and restore focus before removing a dynamic panel.
## Decoration, popups and visibility
The shared surface reserves `::before` for its non-interactive background. The
Cyber frame clips this pseudo-element only; the surface stays unclipped with
visible overflow. This follows the existing Display and Global Context pattern.
The shared surface reserves `::before` for its non-interactive background; the
surface stays unclipped with visible overflow. This follows the existing
Display and Global Context pattern.
Putting the shape on an interactive ancestor clips all descendant popups even
if their `z-index` is high. A scrolling body also clips descendants by design,
so outward popups must be siblings of the body, or use an explicitly owned
@@ -148,8 +146,8 @@ visible.
## Check an addition
Use the real application with the default and Cyber themes. Check open,
collapsed, hidden, disabled/error, theme round trips, clean UI/recording and
Use the real application with the Tactical and Minimal HUD layouts. Check open,
collapsed, hidden, disabled/error, layout round trips, clean UI/recording and
the intended Cockpit behavior. Exercise keyboard focus, Escape, pointer input,
the last scrolling item, resize without reload and any pin/unpin controls.
For an outward popup, test visible pixels and pointer hit-testing outside the
-1
View File
@@ -65,7 +65,6 @@ The `many` form is the `other` text with «de» after the number: «{count} de c
| detection overlay | superposición de detección |
| pin (Draw tool) | marcador |
| Bloom / Glow (visual effect) | resplandor |
| Cyber (HUD layout, effect) | Ciber |
| heading, course / altitude / ground speed | rumbo / altitud / velocidad respecto al suelo (short: VEL. SUELO) |
| HDG / BRG / CRS / FOV / DEST / SPD / RANGE | HDG / BRG / CRS / FOV / DEST / SPD / RANGE (unchanged) |
| PREV / NEXT | ANT. / SIG. |
-1
View File
@@ -82,7 +82,6 @@ The `many` form is the `other` text with « de » (« d' » before a vowel) afte
| Recent Imagery / box | imagerie récente / zone |
| Daily overview / overview (Recent Imagery VIIRS product) | vue quotidienne (one name for the product, not « vue d'ensemble ») |
| pin (Draw tool) / pin (Recent Imagery) | épingle / épingler |
| Cyber (HUD layout, effect) | Cyber |
| heading / course (ground track) / altitude / ground speed | cap / route / altitude / vitesse sol |
| HDG / BRG / CRS / FOV / DEST / SPD / ALT | unchanged |
| RANGE / PITCH / HGT (CCTV calibration chips) | PORTÉE / INCL. / HAUT. |
+1 -1
View File
@@ -82,7 +82,7 @@ The `many` form is the `other` text with «di» after the number when a noun fol
| briefing / panel / dock | briefing / pannello / dock |
| cockpit | cockpit |
| preset / visual preset | preset / preset visivo |
| Tactical / Minimal / Cyber | Tattico / Minimale / Cyber |
| Tactical / Minimal | Tattico / Minimale |
| Scope (circular viewport mask) / keyhole | scope / foro |
| feather / fade | sfumatura / dissolvenza |
| detection overlay | overlay di rilevamento |
+1 -1
View File
@@ -61,7 +61,7 @@ Translation source: abiyeenzo (#913).
| scene / shot | シーン / ショット |
| briefing / panel / dock | ブリーフィング / パネル / ドック |
| preset / visual preset | プリセット / ビジュアルプリセット |
| Tactical / Minimal / Cyber | タクティカル / ミニマル / サイバー |
| Tactical / Minimal | タクティカル / ミニマル |
| Scope (circular viewport mask) / keyhole | スコープ / キーホール |
| Clean UI | クリーンUI |
| cockpit | コックピット |
-1
View File
@@ -91,7 +91,6 @@ The `many` form is the `other` text with «de» after the number: «{count} de c
| feather / fade | suavização / esmaecimento |
| detection overlay | sobreposição de detecção |
| pin (Draw tool) / box (Recent Imagery) | marcador / área |
| Cyber (HUD layout, effect) | Ciber |
| heading / course / altitude / ground speed | rumo / curso (a ship's course: rumo) / altitude / velocidade solo (VELOC. SOLO) |
| map heading / bearing (compass, north up) | orientação (do mapa) |
| HDG / BRG / CRS / FOV / DEST / SPD / RANGE | HDG / BRG / CRS / FOV / DEST / SPD / RANGE (unchanged) |
+1 -1
View File
@@ -43,7 +43,7 @@ Translation sources: abiyeenzo (#914) and EDIT-Aeterna (#979).
| briefing / panel / dock | 简报 / 面板 / 停靠栏 |
| preset / visual preset | 预设 / 视觉预设 |
| Display / HUD layout | 显示 / HUD 布局 |
| Tactical / Minimal / Cyber | 战术 / 精简 / 赛博 |
| Tactical / Minimal | 战术 / 精简 |
| Scope (circular viewport mask) / keyhole | 视域 |
| Clean UI | 纯净界面 |
| cockpit | 座舱 |
+21 -4
View File
@@ -39,6 +39,8 @@ import { mkdir, readdir, readFile, rm, writeFile } from 'node:fs/promises';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import {
keepBuiltIfUnchanged,
keepPackBuiltIfUnchanged,
placeTileFiles,
withoutCities,
withoutNearTwins,
@@ -68,6 +70,8 @@ const outDir = path.join(
: 'src/data/local_data/wikidata_cities',
);
/** A file's text, or undefined when there is none yet. */
const readIfThere = (file) => readFile(file, 'utf8').catch(() => undefined);
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const qid = (uri) => uri.slice(uri.lastIndexOf('/') + 1);
@@ -499,17 +503,30 @@ if (tilesMode) {
count: tileRows.length,
maxPopulation,
});
// Tiles from an earlier build that this one has no rows for go.
// The new files are all written before tiles from an earlier build that
// this one has no rows for go, so a build that stops part way never leaves
// an index naming a removed tile.
const earlier = new Map();
for (const name of await readdir(outDir))
if (/^-?\d+_-?\d+\.json$|^index\.json$|^files\.js$/.test(name))
earlier.set(name, await readFile(path.join(outDir, name), 'utf8'));
keepPackBuiltIfUnchanged(files, earlier);
for (const [name, text] of files)
await writeFile(path.join(outDir, name), text);
for (const name of await readdir(outDir))
if (/^-?\d+_-?\d+\.json$/.test(name) && !files.has(name))
await rm(path.join(outDir, name));
for (const [name, text] of files)
await writeFile(path.join(outDir, name), text);
console.log(
`Wrote ${tileRows.length} places in ${files.size - 2} tiles to ${path.relative(root, outDir)}`,
);
process.exit(0);
}
const file = path.join(outDir, 'cities.json');
await writeFile(file, `${JSON.stringify({ meta, rows })}\n`);
await writeFile(
file,
keepBuiltIfUnchanged(
`${JSON.stringify({ meta, rows })}\n`,
await readIfThere(file),
),
);
console.log(`Wrote ${rows.length} places to ${path.relative(root, file)}`);
+53 -2
View File
@@ -227,6 +227,7 @@
"src/ui/panelMeasurement.js",
"src/ui/panelRailGeometry.js",
"src/ui/panelRails.test.mjs",
"src/ui/hudSonarStyle.test.mjs",
"src/panelStackLayout.js",
"src/ui/applicationShortcuts.js",
"src/ui/styleParameters.js",
@@ -296,6 +297,9 @@
"src/ui/contextControls.js",
"src/ui/contextControls.test.mjs",
"src/ui/contextLayerChanges.js",
"src/ui/spaceMissionsControls.js",
"src/ui/spaceMissionsControls.test.mjs",
"src/ui/stores/spaceMissions.js",
"src/ui/contextPresentation.js",
"src/ui/contextSession.js",
"src/ui/contextSubscriptions.js",
@@ -437,6 +441,12 @@
"src/layers/earthquakes/model.js",
"src/layers/earthquakes/source.js",
"src/layers/earthquakes/ownership.test.mjs",
"src/layers/earthquakes/selection.test.mjs",
"src/layers/submarineCables/interaction.test.mjs",
"src/ui/entityContextBridge.test.mjs",
"src/layers/launches/clickYield.test.mjs",
"src/app/layers/earthquakeRipples.js",
"src/app/layers/earthquakeRipples.test.mjs",
"src/layers/perimeters/index.js",
"src/layers/perimeters/records.js",
"src/layers/perimeters/source.js",
@@ -520,6 +530,10 @@
"src/layers/launches/source.test.mjs",
"src/layers/launches/ingestion.test.mjs",
"src/layers/launches/failedEntry.test.mjs",
"src/layers/launches/labelClick.test.mjs",
"src/layers/launches/missionCycler.test.mjs",
"src/layers/launches/satelliteIntents.js",
"src/layers/launches/satelliteIntents.test.mjs",
"src/layers/installations/lifecycle.js",
"src/layers/installations/viewport.js",
"src/layers/installations/controls.js",
@@ -652,6 +666,7 @@
"src/layers/alpr/model.js",
"src/layers/alpr/policy.js",
"src/layers/alpr/presentation.js",
"src/layers/alpr/presentation.test.mjs",
"src/layers/alpr/visuals.js",
"src/layers/alpr/overlay.js",
"src/layers/alpr/overlay.test.mjs",
@@ -1313,6 +1328,29 @@
"src/ui/kit/UiBadge.vue",
"src/ui/kit/UiBadge.test.mjs",
"src/ui/kit/UiEmpty.vue",
"src/ui/kit/kitStyles.test.mjs",
"src/ui/kit/UiCloseButton.vue",
"src/ui/kit/UiCloseButton.test.mjs",
"src/ui/kit/closeButtons.test.mjs",
"src/ui/styles/close-button.css",
"src/ui/kit/UiSearchField.vue",
"src/ui/kit/UiSearchField.test.mjs",
"src/ui/styles/search-field.css",
"src/ui/kit/UiCheckbox.vue",
"src/ui/kit/UiCheckbox.test.mjs",
"src/ui/kit/checkboxes.test.mjs",
"src/ui/styles/checkbox.css",
"src/ui/kit/UiDialog.vue",
"src/ui/kit/UiDialog.test.mjs",
"src/ui/kit/dialogs.test.mjs",
"src/ui/kit/layerFinderControls.test.mjs",
"src/ui/kit/entityCardControls.test.mjs",
"src/ui/kit/visualControls.test.mjs",
"src/ui/kit/welcomeControls.test.mjs",
"src/ui/kit/omnibarControls.test.mjs",
"src/ui/kit/storiesControls.test.mjs",
"src/ui/styles/chip.css",
"src/ui/styles/empty-state.css",
"src/ui/rail/RailChips.vue",
"src/ui/displayPanelActions.test.mjs",
"src/testSupport/vueDom.mjs",
@@ -1476,7 +1514,7 @@
"src/overlays/worldOverlayDraw.test.mjs",
"src/sources/rateLimit.js",
"src/ui/layerNames.js",
"src/ui/styles/cyber.css",
"src/ui/styles/sonar.css",
"src/voice/layerManifest.js",
"src/worldFocus.js",
"src/worldFocus.test.mjs",
@@ -1550,7 +1588,11 @@
"dev/stub-app/main.js",
"scripts/qa-stub-boot.mjs",
"src/ui/creditsView.js",
"src/ui/creditLineHeight.js",
"src/ui/creditLineHeight.test.mjs",
"src/ui/creditsView.test.mjs",
"src/ui/credits/CreditsView.vue",
"src/ui/credits/CreditItem.vue",
"src/cockpitSubjectProviders.js",
"src/cockpitSubjectProviders.test.mjs",
"src/cockpitProgress.js",
@@ -1584,9 +1626,18 @@
"src/data/wikidataCities.js",
"src/data/wikidataCities.test.mjs",
"scripts/build-wikidata-cities.mjs",
"src/search/bip39Words.js",
"src/search/placeSuggestions.test.mjs",
"scripts/wikidataPlaceTiles.mjs",
"src/tooling/wikidataPlaceTiles.test.mjs",
"src/ui/omnibarIntent.test.mjs",
"src/ui/omnibarRows.test.mjs"
"src/ui/omnibarRows.test.mjs",
"src/ui/omnibarGuide.test.mjs",
"src/ui/styles/omnibar-dock.css",
"src/ui/styles/guide.css",
"src/ui/commandDock.test.mjs",
"src/layers/firms/selection.test.mjs",
"src/layers/vessels/selection.test.mjs",
"src/layers/bikeshare/selection.test.mjs",
"src/layers/satellites/interaction.test.mjs"
]
+53 -8
View File
@@ -130,6 +130,7 @@
"src/ui/radioTunerModel.js",
"src/ui/views/panels/MissionDetail.vue",
"src/ui/views/panels/MissionRoster.vue",
"src/ui/views/panels/SpaceMissionsPanel.vue",
"src/ui/views/panels/AwarenessPanel.vue",
"src/ui/views/panels/AwarenessNames.vue",
"src/ui/views/DisplayControlsView.vue",
@@ -163,6 +164,7 @@
"src/ui/stores/cctv.js",
"src/ui/stores/radio.js",
"src/ui/stores/context.js",
"src/ui/stores/spaceMissions.js",
"src/ui/stores/cockpit.js",
"src/ui/stores/locale.js",
"src/ui/stores/providerSettings.js",
@@ -239,6 +241,10 @@
"src/ui/kit/UiSelect.js",
"src/ui/kit/UiEmpty.vue",
"src/ui/kit/UiBadge.vue",
"src/ui/kit/UiCloseButton.vue",
"src/ui/kit/UiSearchField.vue",
"src/ui/kit/UiCheckbox.vue",
"src/ui/kit/UiDialog.vue",
"src/ui/stores/globeActions.js",
"src/ui/views/panels/GlobeActions.vue",
"src/ui/views/panels/RenderFailure.vue",
@@ -289,7 +295,25 @@
"src/render/modelParts.js",
"src/ui/views/panels/AircraftModelHero.vue",
"src/data/retryableLoad.js",
"src/data/local_data/wikidata_places/files.js"
"src/data/local_data/wikidata_places/files.js",
"src/ui/views/panels/Omnibar.vue",
"src/exclusiveSurfaces.js",
"src/geoDistance.js",
"src/ui/omnibarGuide.js",
"src/ui/views/panels/OmnibarGuide.vue",
"src/cityPois.js",
"src/search/photonSetting.js",
"src/sources/requestDeadline.js",
"src/ui/omnibarEnter.js",
"src/ui/omnibarIntent.js",
"src/data/placeNames.js",
"src/search/plusCode.js",
"src/keylessGeocoder.js",
"src/ui/omnibarRows.js",
"src/search/gridReference.js",
"src/search/coordinateParser.js",
"src/search/placeSuggestions.js",
"src/search/bip39Words.js"
],
"external": ["vue", "pinia", "vue-i18n"]
},
@@ -820,7 +844,6 @@
"exports": ["./ui/layout"],
"modules": [
"src/ui/panelRails.js",
"src/ui/displayPanelScroll.js",
"src/ui/leftPanelRail.js",
"src/ui/rightPanelRail.js",
"src/ui/panelMeasurement.js",
@@ -996,6 +1019,8 @@
"src/ui/kit/UiSelect.js",
"src/ui/kit/UiButton.vue",
"src/ui/kit/UiBadge.vue",
"src/ui/kit/UiCloseButton.vue",
"src/ui/kit/UiIcon.vue",
"src/ui/rail/fieldValue.js",
"src/ui/kit/UiSlider.js",
"src/ui/kit/UiSegmented.vue"
@@ -1073,6 +1098,11 @@
"src/ui/cctvVideo.js",
"src/ui/cctvPresentation.js",
"src/ui/quebecCctvOverlay.js",
"src/ui/views/panels/QuebecCctvOverlay.vue",
"src/ui/kit/UiButton.vue",
"src/ui/kit/UiCloseButton.vue",
"src/ui/kit/UiIcon.vue",
"src/ui/rail/classToggle.js",
"src/i18n/index.js",
"src/i18n/locale.js",
"src/i18n/locales/ar.json",
@@ -1196,7 +1226,6 @@
"src/ui/cockpitController.js",
"src/data/followed.js",
"src/ui/cockpitDisplayPortal.js",
"src/ui/displayPanelScroll.js",
"src/ui/cockpitInput.js",
"src/ui/cockpitInstruments.js",
"src/cockpitSubjectProviders.js",
@@ -1420,7 +1449,6 @@
"src/ui/cockpitContext.js",
"src/ui/cockpitController.js",
"src/ui/cockpitDisplayPortal.js",
"src/ui/displayPanelScroll.js",
"src/ui/cockpitInput.js",
"src/ui/cockpitInstruments.js",
"src/cockpitSubjectProviders.js",
@@ -1438,6 +1466,7 @@
"src/ui/contextSession.js",
"src/ui/contextSubscriptions.js",
"src/ui/contextTransactions.js",
"src/ui/spaceMissionsControls.js",
"src/ui/displayControls.js",
"src/ui/effects.js",
"src/ui/frameRateMonitor.js",
@@ -1566,6 +1595,7 @@
"src/ui/stores/cctv.js",
"src/ui/stores/radio.js",
"src/ui/stores/context.js",
"src/ui/stores/spaceMissions.js",
"src/ui/stores/cockpit.js",
"src/ui/stores/locale.js",
"src/ui/stores/providerSettings.js",
@@ -1586,6 +1616,7 @@
"src/ui/kit/UiSlider.js",
"src/ui/kit/UiButton.vue",
"src/ui/kit/UiBadge.vue",
"src/ui/kit/UiCloseButton.vue",
"src/ui/stores/globeActions.js",
"src/ui/stores/recording.js",
"src/ui/i18n.js",
@@ -1612,6 +1643,7 @@
"src/layers/wildlifeSightings/photoText.js",
"src/data/iconOrientation.js",
"src/ui/quebecCctvOverlay.js",
"src/ui/views/panels/QuebecCctvOverlay.vue",
"src/time/worldClock.js",
"src/cockpitSubjects.js",
"src/cockpitRadar.js",
@@ -1659,7 +1691,8 @@
"src/ui/entityContextBridge.js",
"src/data/trackingClickGesture.js",
"src/ui/stores/sceneSharing.js",
"src/maps/attribution.js"
"src/maps/attribution.js",
"src/data/dataCredits.js"
],
"external": [
"cesium",
@@ -2574,7 +2607,8 @@
"src/layers/earthquakes/model.js",
"src/layers/earthquakes/source.js",
"src/layers/earthquakes/records.js",
"src/time/worldClock.js"
"src/time/worldClock.js",
"src/data/trackingClickGesture.js"
],
"external": ["cesium"]
},
@@ -2863,6 +2897,7 @@
"src/data/entityRecords.js",
"src/render/cesium/follow.js",
"src/layers/launches/ingestion.js",
"src/layers/launches/satelliteIntents.js",
"src/layers/launches/launchPad.js",
"src/layers/launches/lifecycle.js",
"src/layers/launches/model.js",
@@ -4172,6 +4207,7 @@
"src/app/layers/bikeshare.js",
"src/app/layers/cctv.js",
"src/app/layers/cyclones.js",
"src/app/layers/earthquakeRipples.js",
"src/app/layers/earthquakes.js",
"src/app/layers/firms.js",
"src/app/layers/flights.js",
@@ -4522,6 +4558,7 @@
"src/layers/launches/controls.js",
"src/layers/launches/index.js",
"src/layers/launches/ingestion.js",
"src/layers/launches/satelliteIntents.js",
"src/layers/launches/launchPad.js",
"src/layers/launches/lifecycle.js",
"src/layers/launches/model.js",
@@ -4736,7 +4773,6 @@
"src/ui/cockpitContext.js",
"src/ui/cockpitController.js",
"src/ui/cockpitDisplayPortal.js",
"src/ui/displayPanelScroll.js",
"src/ui/cockpitInput.js",
"src/ui/cockpitInstruments.js",
"src/cockpitSubjectProviders.js",
@@ -4755,6 +4791,7 @@
"src/ui/contextSession.js",
"src/ui/contextSubscriptions.js",
"src/ui/contextTransactions.js",
"src/ui/spaceMissionsControls.js",
"src/ui/displayControls.js",
"src/ui/effects.js",
"src/ui/frameRateMonitor.js",
@@ -5317,6 +5354,7 @@
"src/ui/stores/cctv.js",
"src/ui/stores/radio.js",
"src/ui/stores/context.js",
"src/ui/stores/spaceMissions.js",
"src/ui/stores/cockpit.js",
"src/ui/stores/locale.js",
"src/ui/stores/providerSettings.js",
@@ -5349,6 +5387,8 @@
"src/ui/kit/UiButton.vue",
"src/ui/kit/UiEmpty.vue",
"src/ui/kit/UiBadge.vue",
"src/ui/kit/UiCloseButton.vue",
"src/ui/kit/UiCheckbox.vue",
"src/ui/stores/globeActions.js",
"src/ui/stores/recording.js",
"src/ui/i18n.js",
@@ -5430,6 +5470,7 @@
"src/layers/wildlifeSightings/iconCollection.js",
"src/layers/wildlifeSightings/view.js",
"src/ui/quebecCctvOverlay.js",
"src/ui/views/panels/QuebecCctvOverlay.vue",
"src/time/viewerClock.js",
"src/time/worldClock.js",
"src/cockpitSubjects.js",
@@ -5457,7 +5498,10 @@
"src/render/applicationHooks.js",
"src/maps/globeEngine.js",
"src/render/cesium/viewers.js",
"src/ui/creditLineHeight.js",
"src/ui/creditsView.js",
"src/ui/credits/CreditsView.vue",
"src/ui/credits/CreditItem.vue",
"src/data/planespottersPhoto.js",
"src/maps/keylessTerrain.js",
"src/render/cesium/vectorBase.js",
@@ -5586,6 +5630,7 @@
"src/app/layers/bikeshare.js",
"src/app/layers/cctv.js",
"src/app/layers/cyclones.js",
"src/app/layers/earthquakeRipples.js",
"src/app/layers/earthquakes.js",
"src/app/layers/firms.js",
"src/app/layers/flights.js",
@@ -5805,6 +5850,7 @@
"src/layers/launches/controls.js",
"src/layers/launches/index.js",
"src/layers/launches/ingestion.js",
"src/layers/launches/satelliteIntents.js",
"src/layers/launches/launchPad.js",
"src/layers/launches/lifecycle.js",
"src/layers/launches/model.js",
@@ -6684,7 +6730,6 @@
"ui-panel-chrome": {
"exports": ["./ui/panel-chrome"],
"modules": [
"src/ui/displayPanelScroll.js",
"src/ui/radioPanelPlacement.js",
"src/panelStackLayout.js",
"src/ui/leftPanelRail.js",
+108 -382
View File
@@ -193,41 +193,74 @@ try {
});
const contactMissionHandoff = await page.evaluate(async () => {
const { styleManager, dataManager } = window.__godsEyeView;
// Launch Library is not contacted: the layer's own work is stubbed so the
// check covers only how Space Missions sits beside Context.
const stubMissions = (rocketEntry) => {
const original = {
initialized: rocketEntry.initialized,
lifecycleState: rocketEntry.lifecycleState,
init: rocketEntry.module.init,
enable: rocketEntry.module.enable,
update: rocketEntry.module.update,
disable: rocketEntry.module.disable,
};
rocketEntry.initialized = true;
rocketEntry.module.init = async () => true;
rocketEntry.module.enable = async () => true;
rocketEntry.module.update = async () => true;
rocketEntry.module.disable = async () => true;
return () => {
rocketEntry.initialized = original.initialized;
rocketEntry.lifecycleState = original.lifecycleState;
rocketEntry.module.init = original.init;
rocketEntry.module.enable = original.enable;
rocketEntry.module.update = original.update;
rocketEntry.module.disable = original.disable;
};
};
const originalShowToast = styleManager._showToast;
const toasts = [];
styleManager._showToast = (message) => { toasts.push(String(message)); };
const restoreMissions = stubMissions(dataManager.layers.get('rocket-launches'));
try {
if (styleManager._contextControls._contextMode) await styleManager._contextControls._selectContextMode(null);
const contactsResult = await styleManager._contextControls._selectContextMode('flights');
const missionResult = await styleManager._contextControls._selectContextMode('space-missions');
const switched = {
const missionResult = await dataManager.setEnabled('rocket-launches', true, { origin: 'user' });
await styleManager._waitForContextLayerSettlement();
const together = {
contactsResult,
missionResult,
mode: styleManager._contextControls._contextMode,
missionsEnabled: dataManager.isEnabled('rocket-launches'),
toasts: [...toasts],
};
const missionOff = await dataManager.setEnabled('rocket-launches', false, { origin: 'user' });
await styleManager._waitForContextLayerSettlement();
const modeAfterMissions = styleManager._contextControls._contextMode;
const exitResult = await styleManager._contextControls._selectContextMode(null);
return {
...switched,
...together,
missionOff,
modeAfterMissions,
exitResult,
modeAfterExit: styleManager._contextControls._contextMode,
missionsOffAfterExit: !dataManager.isEffectivelyEnabled('rocket-launches'),
};
} finally {
restoreMissions();
styleManager._showToast = originalShowToast;
}
});
check(
'Contacts hands off to Space Missions on the first request without a failure toast',
'Space Missions runs beside Contacts, and switching it off leaves Contacts on',
contactMissionHandoff.contactsResult === true
&& contactMissionHandoff.missionResult === true
&& contactMissionHandoff.mode === 'space-missions'
&& contactMissionHandoff.mode === 'flights'
&& contactMissionHandoff.missionsEnabled
&& contactMissionHandoff.toasts?.length === 0
&& contactMissionHandoff.missionOff === true
&& contactMissionHandoff.modeAfterMissions === 'flights'
&& contactMissionHandoff.exitResult === true
&& contactMissionHandoff.modeAfterExit === null
&& contactMissionHandoff.missionsOffAfterExit,
&& contactMissionHandoff.modeAfterExit === null,
JSON.stringify(contactMissionHandoff),
);
const cancelledMissionEntry = await page.evaluate(async () => {
@@ -330,7 +363,7 @@ try {
}
});
check(
'cancelled direct Space Missions entry restores its exact isolated sibling state',
'a cancelled Space Missions start leaves its sibling layer on and opens no Context session',
cancelledMissionEntry.exercised
&& cancelledMissionEntry.transitionResult === false
&& !cancelledMissionEntry.timedOut
@@ -341,214 +374,45 @@ try {
JSON.stringify(cancelledMissionEntry),
);
check(
'successful Space Missions cancellation rollback stays silent',
'a cancelled Space Missions start stays silent',
cancelledMissionEntry.exercised && cancelledMissionEntry.toasts?.length === 0,
JSON.stringify(cancelledMissionEntry.toasts || []),
);
const replacementMissionEntry = await page.evaluate(async () => {
const styleManager = window.__godsEyeView.styleManager;
const dataManager = window.__godsEyeView.dataManager;
const rocketEntry = dataManager.layers.get('rocket-launches');
if (!rocketEntry || dataManager.isEffectivelyEnabled('rocket-launches')) {
return { exercised: false, reason: 'Space Missions was not in a clean OFF state' };
}
const siblingId = 'qa-cockpit-replacement-sibling';
window.__gevQaRegisterLayer(dataManager, {
id: siblingId,
name: 'QA replacement sibling',
icon: 'science',
source: 'QA',
updateInterval: -1,
async init() { return true; },
async enable() { return true; },
async update() { return true; },
async disable() { return true; },
async destroy() {},
getStats() { return { count: 1, status: 'live' }; },
});
await dataManager.setEnabled(siblingId, true, { origin: 'programmatic' });
const original = {
siblingInitialized: dataManager.layers.get(siblingId)?.initialized,
initialized: rocketEntry.initialized,
lifecycleState: rocketEntry.lifecycleState,
init: rocketEntry.module.init,
enable: rocketEntry.module.enable,
update: rocketEntry.module.update,
disable: rocketEntry.module.disable,
showToast: styleManager._showToast,
};
let firstUpdate = true;
let releaseUpdate;
let markUpdateStarted;
const updateStarted = new Promise((resolve) => { markUpdateStarted = resolve; });
const updateGate = new Promise((resolve) => { releaseUpdate = resolve; });
const toasts = [];
rocketEntry.initialized = true;
rocketEntry.module.enable = async () => true;
rocketEntry.module.update = async () => {
if (!firstUpdate) return true;
firstUpdate = false;
markUpdateStarted();
await updateGate;
return true;
};
rocketEntry.module.disable = async () => true;
styleManager._showToast = (message) => { toasts.push(String(message)); };
try {
const entry = styleManager._contextControls._selectContextMode('space-missions');
await updateStarted;
const replacement = dataManager.setEnabled('rocket-launches', true, { origin: 'programmatic' });
releaseUpdate();
const [entryResult, replacementResult] = await Promise.all([entry, replacement]);
const committed = {
entryResult,
replacementResult,
mode: styleManager._contextControls._contextMode,
entering: styleManager._contextControls._contextModeEntering,
snapshotRetained: Boolean(styleManager._contextControls._contextSessionSnapshot),
siblingIsolated: !dataManager.isEffectivelyEnabled(siblingId),
missionEnabled: dataManager.isEnabled('rocket-launches'),
missionEffective: dataManager.isEffectivelyEnabled('rocket-launches'),
toasts: [...toasts],
};
const exitResult = await styleManager._contextControls._selectContextMode(null);
return {
exercised: true,
...committed,
exitResult,
siblingRestored: dataManager.isEnabled(siblingId),
missionRestoredOff: !dataManager.isEffectivelyEnabled('rocket-launches'),
};
} finally {
styleManager._showToast = original.showToast;
rocketEntry.module.init = original.init;
rocketEntry.module.enable = original.enable;
rocketEntry.module.update = original.update;
rocketEntry.module.disable = original.disable;
rocketEntry.initialized = original.initialized;
rocketEntry.lifecycleState = original.lifecycleState;
await dataManager.setEnabled(siblingId, false, { origin: 'programmatic' });
await window.__gevQaUnregisterLayer(dataManager, siblingId);
}
});
check(
'right-rail Space Missions adopts a newer authoritative ON without stale restoration',
replacementMissionEntry.exercised
&& replacementMissionEntry.entryResult === true
&& replacementMissionEntry.replacementResult === true
&& replacementMissionEntry.mode === 'space-missions'
&& replacementMissionEntry.entering === null
&& replacementMissionEntry.snapshotRetained
&& replacementMissionEntry.siblingIsolated
&& replacementMissionEntry.missionEnabled
&& replacementMissionEntry.missionEffective
&& replacementMissionEntry.toasts?.length === 0
&& replacementMissionEntry.exitResult === true
&& replacementMissionEntry.siblingRestored
&& replacementMissionEntry.missionRestoredOff,
JSON.stringify(replacementMissionEntry),
);
const supersededMissionEntry = await page.evaluate(async () => {
const styleManager = window.__godsEyeView.styleManager;
const dataManager = window.__godsEyeView.dataManager;
const rocketEntry = dataManager.layers.get('rocket-launches');
if (!rocketEntry || dataManager.isEffectivelyEnabled('rocket-launches')) {
return { exercised: false, reason: 'Space Missions was not in a clean OFF state' };
}
const siblingId = 'qa-cockpit-superseded-sibling';
window.__gevQaRegisterLayer(dataManager, {
id: siblingId,
name: 'QA superseded sibling',
icon: 'science',
source: 'QA',
updateInterval: -1,
async init() { return true; },
async enable() { return true; },
async update() { return true; },
async disable() { return true; },
async destroy() {},
getStats() { return { count: 1, status: 'live' }; },
});
await dataManager.setEnabled(siblingId, true, { origin: 'programmatic' });
const original = {
initialized: rocketEntry.initialized,
lifecycleState: rocketEntry.lifecycleState,
init: rocketEntry.module.init,
enable: rocketEntry.module.enable,
update: rocketEntry.module.update,
disable: rocketEntry.module.disable,
showToast: styleManager._showToast,
};
let releaseUpdate;
let markUpdateStarted;
const updateStarted = new Promise((resolve) => { markUpdateStarted = resolve; });
const updateGate = new Promise((resolve) => { releaseUpdate = resolve; });
const toasts = [];
rocketEntry.initialized = true;
rocketEntry.module.enable = async () => true;
rocketEntry.module.update = async () => {
markUpdateStarted();
await updateGate;
return true;
};
rocketEntry.module.disable = async () => true;
styleManager._showToast = (message) => { toasts.push(String(message)); };
try {
const entry = styleManager._runUserFacingContextAction(
(notificationToken) => styleManager._contextControls._selectContextMode(
'space-missions',
{ notificationToken },
),
'Space Missions could not complete the requested transition; try again',
);
await updateStarted;
const supersedingOff = dataManager.setEnabled('rocket-launches', false, {
origin: 'programmatic',
});
releaseUpdate();
const [entryResult, offResult] = await Promise.all([entry, supersedingOff]);
return {
exercised: true,
entryResult,
offResult,
mode: styleManager._contextControls._contextMode,
entering: styleManager._contextControls._contextModeEntering,
snapshotRetained: Boolean(styleManager._contextControls._contextSessionSnapshot),
siblingRestored: dataManager.isEnabled(siblingId),
missionEffective: dataManager.isEffectivelyEnabled('rocket-launches'),
toasts,
};
} finally {
styleManager._showToast = original.showToast;
rocketEntry.module.init = original.init;
rocketEntry.module.enable = original.enable;
rocketEntry.module.update = original.update;
rocketEntry.module.disable = original.disable;
rocketEntry.initialized = original.initialized;
rocketEntry.lifecycleState = original.lifecycleState;
await dataManager.setEnabled(siblingId, false, { origin: 'programmatic' });
await window.__gevQaUnregisterLayer(dataManager, siblingId);
}
});
check(
'right-rail Space Missions superseded by OFF restores exactly without a failure toast',
supersededMissionEntry.exercised
&& supersededMissionEntry.entryResult === null
&& supersededMissionEntry.mode === null
&& supersededMissionEntry.entering === null
&& !supersededMissionEntry.snapshotRetained
&& supersededMissionEntry.siblingRestored
&& !supersededMissionEntry.missionEffective
&& supersededMissionEntry.toasts?.length === 0,
JSON.stringify(supersededMissionEntry),
);
const voiceMissionEntry = await page.evaluate(async () => {
const ordinaryMissionLayer = await page.evaluate(async () => {
const { dataManager, styleManager } = window.__godsEyeView;
const siblingId = '__qa_voice_context_sibling__';
const rocketEntry = dataManager.layers.get('rocket-launches');
if (!rocketEntry || dataManager.isEffectivelyEnabled('rocket-launches')) {
return { exercised: false, reason: 'Space Missions was not in a clean OFF state' };
}
// Launch Library is not contacted: the layer's own work is stubbed so the
// check covers only how Space Missions sits beside Context.
const stubMissions = (rocketEntry) => {
const original = {
initialized: rocketEntry.initialized,
lifecycleState: rocketEntry.lifecycleState,
init: rocketEntry.module.init,
enable: rocketEntry.module.enable,
update: rocketEntry.module.update,
disable: rocketEntry.module.disable,
};
rocketEntry.initialized = true;
rocketEntry.module.init = async () => true;
rocketEntry.module.enable = async () => true;
rocketEntry.module.update = async () => true;
rocketEntry.module.disable = async () => true;
return () => {
rocketEntry.initialized = original.initialized;
rocketEntry.lifecycleState = original.lifecycleState;
rocketEntry.module.init = original.init;
rocketEntry.module.enable = original.enable;
rocketEntry.module.update = original.update;
rocketEntry.module.disable = original.disable;
};
};
const siblingId = '__qa_space_missions_sibling__';
window.__gevQaRegisterLayer(dataManager, {
id: siblingId,
name: 'QA voice Context sibling',
name: 'QA Space Missions sibling',
icon: 'science',
source: 'QA',
updateInterval: -1,
@@ -559,94 +423,48 @@ try {
async destroy() {},
getStats() { return { count: 1, status: 'live' }; },
});
const original = {
initialized: rocketEntry.initialized,
lifecycleState: rocketEntry.lifecycleState,
init: rocketEntry.module.init,
enable: rocketEntry.module.enable,
update: rocketEntry.module.update,
disable: rocketEntry.module.disable,
};
const siblingLayerEntry = dataManager.layers.get(siblingId);
siblingLayerEntry.initialized = true;
await dataManager.setEnabled(siblingId, true, { origin: 'programmatic' });
rocketEntry.initialized = true;
rocketEntry.module.init = async () => true;
rocketEntry.module.enable = async () => true;
rocketEntry.module.update = async () => true;
rocketEntry.module.disable = async () => true;
const restoreMissions = stubMissions(rocketEntry);
try {
const voiceOn = await dataManager.setEnabled('rocket-launches', true, { origin: 'voice' });
await new Promise((resolve) => setTimeout(resolve, 80));
const voiceState = {
voiceOn,
mode: styleManager._contextControls._contextMode,
entering: styleManager._contextControls._contextModeEntering,
snapshotRetained: Boolean(styleManager._contextControls._contextSessionSnapshot),
siblingIsolated: !dataManager.isEffectivelyEnabled(siblingId),
};
const snapshotBeforeOff = [...(styleManager._contextControls._contextSessionSnapshot?.enabledLayerIds || [])];
const voiceOff = await dataManager.setEnabled('rocket-launches', false, { origin: 'voice' });
const reactionCountAfterOff = styleManager._contextControls._contextLayerReactionPromises.size;
await styleManager._waitForContextLayerSettlement();
const restoredSiblingEntry = dataManager.layers.get(siblingId);
const voiceExit = {
voiceOff,
snapshotBeforeOff,
reactionCountAfterOff,
mode: styleManager._contextControls._contextMode,
entering: styleManager._contextControls._contextModeEntering,
snapshotRetained: Boolean(styleManager._contextControls._contextSessionSnapshot),
siblingRestored: dataManager.isEffectivelyEnabled(siblingId),
siblingEnabled: restoredSiblingEntry?.enabled,
siblingLifecycle: restoredSiblingEntry?.lifecycleState,
restoreActive: Boolean(styleManager._contextControls._contextRestoreState),
};
await dataManager.setEnabled('rocket-launches', true, { origin: 'programmatic' });
await new Promise((resolve) => setTimeout(resolve, 40));
const internalState = {
mode: styleManager._contextControls._contextMode,
entering: styleManager._contextControls._contextModeEntering,
snapshotRetained: Boolean(styleManager._contextControls._contextSessionSnapshot),
missionEnabled: dataManager.isEffectivelyEnabled('rocket-launches'),
};
await dataManager.setEnabled('rocket-launches', false, { origin: 'programmatic' });
return { exercised: true, voiceState, voiceExit, internalState };
const results = {};
for (const origin of ['user', 'voice', 'programmatic']) {
const on = await dataManager.setEnabled('rocket-launches', true, { origin });
await styleManager._waitForContextLayerSettlement();
const during = {
on,
mode: styleManager._contextControls._contextMode,
snapshot: Boolean(styleManager._contextControls._contextSessionSnapshot),
siblingOn: dataManager.isEffectivelyEnabled(siblingId),
};
const off = await dataManager.setEnabled('rocket-launches', false, { origin });
await styleManager._waitForContextLayerSettlement();
results[origin] = {
...during,
off,
siblingOnAfter: dataManager.isEffectivelyEnabled(siblingId),
snapshotAfter: Boolean(styleManager._contextControls._contextSessionSnapshot),
};
}
return { exercised: true, results };
} finally {
rocketEntry.module.init = original.init;
rocketEntry.module.enable = original.enable;
rocketEntry.module.update = original.update;
rocketEntry.module.disable = original.disable;
rocketEntry.initialized = original.initialized;
rocketEntry.lifecycleState = original.lifecycleState;
restoreMissions();
await dataManager.setEnabled(siblingId, false, { origin: 'programmatic' });
siblingLayerEntry.initialized = original.siblingInitialized;
await window.__gevQaUnregisterLayer(dataManager, siblingId);
}
});
check(
'voice Space Missions uses the same Context snapshot and exact-restore transaction as UI entry',
voiceMissionEntry.exercised
&& voiceMissionEntry.voiceState?.voiceOn
&& voiceMissionEntry.voiceState.mode === 'space-missions'
&& voiceMissionEntry.voiceState.entering === null
&& voiceMissionEntry.voiceState.snapshotRetained
&& voiceMissionEntry.voiceState.siblingIsolated
&& voiceMissionEntry.voiceExit?.voiceOff
&& voiceMissionEntry.voiceExit.mode === null
&& voiceMissionEntry.voiceExit.entering === null
&& !voiceMissionEntry.voiceExit.snapshotRetained
&& voiceMissionEntry.voiceExit.siblingRestored,
JSON.stringify(voiceMissionEntry),
);
check(
'internal programmatic Space Missions activation does not create a user Context session',
voiceMissionEntry.internalState?.missionEnabled
&& voiceMissionEntry.internalState.mode === null
&& voiceMissionEntry.internalState.entering === null
&& !voiceMissionEntry.internalState.snapshotRetained,
JSON.stringify(voiceMissionEntry),
'Space Missions is an ordinary layer: no Context session, no isolation, from any origin',
ordinaryMissionLayer.exercised
&& Object.values(ordinaryMissionLayer.results || {}).length === 3
&& Object.values(ordinaryMissionLayer.results).every((entry) =>
entry.on === true
&& entry.mode === null
&& !entry.snapshot
&& entry.siblingOn
&& entry.off === true
&& entry.siblingOnAfter
&& !entry.snapshotAfter),
JSON.stringify(ordinaryMissionLayer),
);
await page.evaluate(() => window.__godsEyeView.dataManager.setEnabled(
'flights',
@@ -1998,98 +1816,6 @@ try {
}),
);
// Cyber relocates its collapsed briefing header into the expanded utility
// lane. Exercise actual height changes without reload and measure both cards.
await page.evaluate(() => {
const manager = window.__godsEyeView.styleManager;
manager._setHudVariant('cyber');
manager.hud.setMode('on');
manager._setCockpitDisclosure('display', false);
manager._setCockpitDisclosure('radio', true);
});
const cyberRadioOrder = await page.evaluate(() => {
const manager = window.__godsEyeView.styleManager;
manager.cockpitView.syncSignalLayout();
const display = document
.getElementById('cockpit-display-toggle-btn')
.closest('.cockpit-utility-control');
const radio = document
.getElementById('cockpit-radio-toggle-btn')
.closest('.cockpit-utility-control');
const displayRect = display.getBoundingClientRect();
const radioRect = radio.getBoundingClientRect();
return {
display: displayRect.toJSON(),
radio: radioRect.toJSON(),
displayExpanded: display.classList.contains('is-expanded'),
radioExpanded: radio.classList.contains('is-expanded'),
gap: radioRect.top - displayRect.bottom,
};
});
check(
'Cyber expanding Radio preserves the authored Display-then-Radio order',
!cyberRadioOrder.displayExpanded
&& cyberRadioOrder.radioExpanded
&& cyberRadioOrder.display.height > 0
&& cyberRadioOrder.radio.height > 0
&& cyberRadioOrder.gap >= 7,
JSON.stringify(cyberRadioOrder),
);
await page.screenshot({ path: path.join(shotsDir, 'cyber-radio-order.png') });
await page.evaluate(() => {
const manager = window.__godsEyeView.styleManager;
manager._setCockpitDisclosure('radio', false);
manager._setCockpitDisclosure('display', true);
});
const cyberStyleStates = await page.evaluate(() => {
const manager = window.__godsEyeView.styleManager;
const states = [];
for (const style of ['normal', 'surveillance', 'thermal', 'retro']) {
document.querySelector(`.style-btn[data-style="${style}"]`).click();
states.push({
requestedStyle: style,
activeStyle: manager.activeStyle,
hud: manager.hud.getVariant(),
theme: document.documentElement.dataset.uiTheme,
selector: document.getElementById('hud-layout-select').value,
savedHud: manager.getVisualState().hud.variant,
});
}
return states;
});
check('Cockpit visual-style controls retain Cyber HUD, selector, shell and saved layout',
cyberStyleStates.every(state => state.activeStyle === state.requestedStyle
&& state.hud === 'cyber' && state.theme === 'cyber'
&& state.selector === 'cyber' && state.savedHud === 'cyber'),
JSON.stringify(cyberStyleStates));
for (const height of [987, 720, 640, 900]) {
await page.setViewport({ width: 1440, height, deviceScaleFactor: 1 });
await new Promise((resolve) => setTimeout(resolve, 400));
const geometry = await page.evaluate(() => {
const signal = document.getElementById('cockpit-signal-stream');
const utility = document.getElementById('cockpit-utility-controls');
const expanded = utility.querySelector('.cockpit-utility-control.is-expanded');
const s = signal.getBoundingClientRect();
const u = expanded.getBoundingClientRect();
const toggle = document.getElementById('cockpit-signal-toggle');
const t = toggle.getBoundingClientRect();
const hit = document.elementFromPoint(t.x + t.width / 2, t.y + t.height / 2);
return { height: innerHeight, theme: document.documentElement.dataset.uiTheme,
collapsed: signal.dataset.collapsed, signal: s.toJSON(), utility: u.toJSON(),
reachable: Boolean(hit && toggle.contains(hit)),
contained: u.bottom <= s.top - 7 && s.bottom < innerHeight,
};
});
check(`Cyber collapsed Live Signals remains visible and reachable after resize to ${height}px`,
geometry.theme === 'cyber' && geometry.collapsed === 'true'
&& geometry.signal.width > 0 && geometry.signal.height > 0
&& geometry.reachable && geometry.contained, JSON.stringify(geometry));
if (height === 640 || height === 900) {
await page.screenshot({ path: path.join(shotsDir, `cyber-resize-${height}.png`) });
}
}
await page.evaluate(() => window.__godsEyeView.styleManager._setHudVariant('tactical'));
const signalTransition = await page.evaluate(async () => {
const manager = window.__godsEyeView.styleManager;
const cockpit = manager.cockpitView;
+25 -26
View File
@@ -276,21 +276,21 @@ const MUTATIONS = [
},
{
defect: 'the tile stops promising the fires it actually turns on',
file: 'html',
file: 'module',
from: " 'Live earthquakes and active fires, from USGS and NASA',",
to: " 'Live earthquakes worldwide, straight from USGS',",
},
{
defect: 'the owner-authored first-run line is quietly rewritten',
defect: 'the maintainer-authored first-run line is quietly rewritten',
file: 'html',
from: 'It feels like a forbidden cockpit—then you realize the sources are public and the data is real.',
to: "It feels like a forbidden cockpit. It isn't — every feed is public, and every contact is live.",
to: 'A live 3D globe of public data. Pick a view to begin.',
},
{
defect: 'the ledgered global-chip defect loses its pointer to the real fix',
file: 'module',
from: ' // means a KEY REQUIRED terminal state in src/loadingFeedback.js, a state',
to: ' // (note removed)',
from: ' // ends KEY REQUIRED (src/loadingFeedback.js), and the quakes half of the',
to: ' // ends KEY REQUIRED, and the quakes half of the',
},
{
defect: 'the globe missions never pull the camera out',
@@ -307,14 +307,14 @@ const MUTATIONS = [
{
defect: 'a cancelled globe flight fails the whole mission',
file: 'module',
from: ' .catch(() => null);',
to: ' .catch(() => { throw new Error("flight failed"); });',
from: ' .catch(() => null)\n : null;',
to: ' .catch(() => { throw new Error("flight failed"); })\n : null;',
},
{
defect: 'Explore manually quietly runs a mission instead of nothing',
file: 'module',
from: "if (mission.kind === 'none') return { ok: true, choice };",
to: "if (mission.kind === 'none') return { ok: true, choice, ran: await setContextMode('contacts') };",
to: "if (mission.kind === 'none') return { ok: true, choice, ran: await setLayerEnabled('rocket-launches') };",
},
{
defect: 'an unknown choice is treated as a success',
@@ -348,15 +348,14 @@ const MUTATIONS = [
{
defect: 'a mission persists a 3D-models choice nobody made',
file: 'module',
from: ' const result = await styleManager.setContextMode(mode);',
to: ' styleManager._setModels3dEnabled?.(true);\n const result = await styleManager.setContextMode(mode);',
from: " setLayerEnabled: (layerId) =>\n dataManager.setEnabled(layerId, true, { origin: 'user' }),",
to: " setLayerEnabled: (layerId) => {\n styleManager._setModels3dEnabled?.(true);\n return dataManager.setEnabled(layerId, true, { origin: 'user' });\n },",
},
{
defect:
'the Context panel is left collapsed, hiding the mode that just started',
defect: 'a mission writes panel chrome nobody chose',
file: 'module',
from: " styleManager.setPanelCollapsed?.('global-context-panel', false, {\n explicit: true,\n });",
to: ' // panel reveal removed',
from: ' flyToGlobe: () => styleManager.resetToGlobeView(),',
to: " flyToGlobe: () => {\n styleManager.setPanelCollapsed?.('global-context-panel', false, { explicit: true });\n return styleManager.resetToGlobeView();\n },",
},
{
defect:
@@ -371,8 +370,8 @@ const MUTATIONS = [
defect:
'disabling the focused tile drops the keyboard to <body> mid-flight',
file: 'html',
from: ':aria-disabled="launcher?.busy ?? undefined" @click="controls?.choose(\'contacts\')"',
to: ':disabled="launcher?.busy === \'true\'" @click="controls?.choose(\'contacts\')"',
from: ':aria-disabled="String(settling || launcher?.busy === \'true\')" @click="onPrimary"',
to: ':disabled="launcher?.busy === \'true\'" @click="onPrimary"',
},
{
defect: 'Tab escapes into an app the visitor has not seen yet',
@@ -421,8 +420,8 @@ const MUTATIONS = [
defect:
'the card loses its viewport cap and clips on a short landscape phone',
file: 'css',
from: ' max-height: calc(100dvh - 1.5rem);',
to: ' /* cap removed */',
from: ' body.mobile-shell #first-run-launcher {\n bottom: 5.8rem;\n max-height: calc(100vh - 6.55rem);\n max-height: calc(100dvh - 6.55rem);\n }',
to: ' body.mobile-shell #first-run-launcher {\n bottom: 5.8rem;\n /* cap removed */\n }',
},
{
defect:
@@ -437,7 +436,7 @@ const MUTATIONS = [
// those instead and prove nothing about this feature.
defect: "the launcher's reduced-motion opt-out is dropped",
file: 'css',
from: ' #first-run-launcher,\n .first-run-choices button,\n .first-run-arrow {\n transition: none;\n }\n /* Scrolling a tile into view must not animate either. */\n .first-run-choices {\n scroll-behavior: auto;\n }',
from: ' #first-run-launcher,\n .first-run-backdrop,\n .first-run-back,\n .first-run-missions button,\n .first-run-link-card,\n .first-run-link-button,\n .first-run-enter {\n transition: none;\n }\n /* Scrolling a tile into view must not animate either. */\n .first-run-choices {\n scroll-behavior: auto;\n }',
to: ' .first-run-nothing {\n transition: none;\n }',
},
@@ -445,20 +444,20 @@ const MUTATIONS = [
{
defect: 'a mission tile is dropped from the menu',
file: 'html',
from: ' <button type="button" data-first-run-choice="space-missions"',
to: ' <button type="button" data-first-run-choice-disabled="space-missions"',
from: ' <UiButton data-first-run-start="space-missions"',
to: ' <UiButton data-first-run-start-disabled="space-missions"',
},
{
defect: "the menu order stops matching the owner's",
file: 'html',
from: '<button type="button" data-first-run-choice="environmental"',
to: '<button type="button" data-first-run-choice="zzz-environmental"',
from: '<UiButton data-first-run-start="environmental"',
to: '<UiButton data-first-run-start="zzz-environmental"',
},
{
defect: 'the "don\'t show again" checkbox is removed',
defect: 'the "don\'t show again" checkbox loses its hook',
file: 'html',
from: '<input type="checkbox" data-first-run-suppress @change="onSuppress" />',
to: '<span data-first-run-suppress-removed></span>',
from: '<UiCheckbox class="first-run-suppress" :input-attrs="suppressBoxAttrs" @change="onSuppress">',
to: '<UiCheckbox class="first-run-suppress" @change="onSuppress">',
},
{
defect: 'the status line stops being a polite live region',
+108 -42
View File
@@ -33,7 +33,7 @@ const TEETH = args.includes('--teeth');
const HEADFUL = args.includes('--headful');
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const SHOT_DIR = path.join(ROOT, 'qa-shots', 'firstrun');
const SHOT_DIR = process.env.QA_OUTPUT_DIR || path.join(ROOT, 'qa-shots', 'firstrun');
const CHROME_CANDIDATES = [
process.env.PUPPETEER_EXECUTABLE_PATH,
@@ -109,7 +109,7 @@ const appState = (page) => page.evaluate(() => {
const gev = window.__godsEyeView || {};
const sm = gev.styleManager;
const dm = gev.dataManager;
const carto = sm?.viewer?.camera?.positionCartographic;
const carto = gev.viewer?.camera?.positionCartographic;
const layers = {};
const counts = {};
const all = dm?.getAll?.() || [];
@@ -170,8 +170,22 @@ async function watchLoadingChip(page) {
const readLoadingChip = (page) => page.evaluate(() => window.__chipSeen || []);
async function nextStep(page, readySelector) {
await page.click('[data-first-run-next]');
await page.waitForSelector(readySelector, { visible: true });
await page.waitForFunction(() => {
const steps = [...document.querySelectorAll('#first-run-launcher .first-run-step')];
return steps.length === 1
&& !/first-run-step-(forward|back)-(enter|leave)-/.test(steps[0].className)
&& document.querySelector('[data-first-run-primary]')?.getAttribute('aria-disabled') !== 'true';
});
}
async function pick(page, choice, { timeout = 40000, settle = [] } = {}) {
await page.click(`[data-first-run-choice="${choice}"]`);
await nextStep(page, '[data-first-run-start]');
await page.click(`[data-first-run-start="${choice}"]`);
await nextStep(page, '[data-first-run-choice]');
await page.click('[data-first-run-choice]');
await page.waitForFunction(
(sel) => !document.querySelector(sel) || !document.querySelector(sel).classList.contains('visible'),
{ timeout },
@@ -190,8 +204,8 @@ async function pick(page, choice, { timeout = 40000, settle = [] } = {}) {
/** Every section the run is expected to reach; the teeth verdict requires all. */
const EXPECTED_SECTIONS = [
'show-policy', 'esc-arbitration',
'mission-environmental', 'mission-contacts', 'mission-space', 'mission-explore',
'viewports', 'console',
'mission-environmental', 'mission-space', 'mission-explore',
'stories-card', 'viewports', 'console',
];
/*
@@ -482,8 +496,8 @@ async function main() {
record('a fresh session gets the launcher', freshVisible);
if (freshVisible) shots.push(await shoot(page, 'launcher-desktop'));
const focused = await page.evaluate(() => document.activeElement?.dataset?.firstRunChoice ?? null);
record('focus lands on the first mission tile', focused === 'contacts', `activeElement=${focused}`);
const focused = await page.evaluate(() => document.activeElement?.hasAttribute('data-first-run-next') ?? false);
record('focus lands on Next', focused === true, `activeElement=${focused}`);
// The card is a flex column (so its list can scroll on short viewports),
// and an author `display` on this id outranks the UA's `[hidden]` rule.
@@ -500,10 +514,11 @@ async function main() {
record('the hidden attribute still hides the flex card', hiddenHonored === 'none',
`computed display while hidden = ${hiddenHonored}`);
const tiles = await page.$$eval('[data-first-run-choice]', (nodes) => nodes.map((n) => n.dataset.firstRunChoice));
await nextStep(page, '[data-first-run-start]');
const tiles = await page.$$eval('[data-first-run-start]', (nodes) => nodes.map((n) => n.dataset.firstRunStart));
record(
'four tiles in the owner\'s order',
JSON.stringify(tiles) === JSON.stringify(['contacts', 'space-missions', 'environmental', 'explore']),
'three tiles in the owner\'s order',
JSON.stringify(tiles) === JSON.stringify(['space-missions', 'environmental', 'explore']),
tiles.join(' · '),
);
@@ -558,7 +573,7 @@ async function main() {
// ── Mission outcomes ────────────────────────────────────────────────────
// One section PER MISSION: a throw in one (a tile that never rendered under
// --teeth, say) must not take the other four down with it, or the teeth
// --teeth, say) must not take the other two down with it, or the teeth
// tally reports "reached" for assertions that never ran.
let state;
let before;
@@ -642,47 +657,93 @@ async function main() {
shots.push(await shoot(page, 'mission-environmental'));
});
await section('mission-contacts', async () => {
await open(page, { query: "?welcome=1", errorSink: consoleErrors });
await pick(page, 'contacts');
state = await appState(page);
record('LIVE CONTACTS activates the Contacts context mode', state.contextMode === 'flights',
`contextMode=${state.contextMode}`);
const panelOpen = await page.evaluate(() => {
const panel = document.getElementById('global-context-panel');
return !!panel && !panel.classList.contains('collapsed');
});
record('LIVE CONTACTS reveals the Context panel', panelOpen);
record('LIVE CONTACTS still leaves the detection override untouched',
state.detectionOverridden === false, `_detectionUserOverridden=${state.detectionOverridden}`);
shots.push(await shoot(page, 'mission-contacts'));
});
await section('mission-space', async () => {
await open(page, { query: "?welcome=1", errorSink: consoleErrors });
await pick(page, 'space-missions');
state = await appState(page);
record('SPACE MISSIONS activates its context mode', state.contextMode === 'space-missions',
`contextMode=${state.contextMode}`);
const missions = await page.evaluate(() => {
const panel = document.getElementById('space-missions-panel');
return {
layerOn: window.__godsEyeView.dataManager.isEffectivelyEnabled('rocket-launches'),
panelOpen: !!panel && !panel.hidden && !panel.classList.contains('collapsed'),
};
});
record('SPACE MISSIONS switches its layer on without a Context mode',
missions.layerOn && state.contextMode == null,
`layerOn=${missions.layerOn} contextMode=${state.contextMode}`);
record('SPACE MISSIONS opens its own panel', missions.panelOpen,
`panelOpen=${missions.panelOpen}`);
record('SPACE MISSIONS still leaves the detection override untouched',
state.detectionOverridden === false, `_detectionUserOverridden=${state.detectionOverridden}`);
shots.push(await shoot(page, 'mission-space-missions'));
});
await section('mission-explore', async () => {
await open(page, { query: "?welcome=1", errorSink: consoleErrors });
// Start below the mission overview so an accidental overview flight is observable.
await page.evaluate(() => {
const camera = window.__godsEyeView.viewer.camera;
camera.cancelFlight();
camera.setView({ destination: camera.position.constructor.fromDegrees(-97.7431, 30.2672, 100000) });
});
const beforeExplore = await appState(page);
await pick(page, 'explore');
state = await appState(page);
record('EXPLORE MANUALLY enables no layer and no context mode',
Object.values(state.layers).every((on) => !on) && state.contextMode === null,
Object.entries(state.layers).filter(([, on]) => on).map(([id]) => id).join(', ') || 'nothing enabled');
// The real claim is that Explore issues no camera command of its own: the
// arrival fly-in owns the camera and must still be heading down, not out.
record('EXPLORE MANUALLY never commandeers the camera',
(state.heightKm ?? 0) < 12000 && (state.heightKm ?? 1e9) <= (beforeExplore.heightKm ?? 1e9),
`${beforeExplore.heightKm} → ${state.heightKm} km (globe would be 18000)`);
beforeExplore.heightKm === 100 && state.heightKm === beforeExplore.heightKm,
`${beforeExplore.heightKm} → ${state.heightKm} km (expected 100 → 100 km)`);
shots.push(await shoot(page, 'mission-explore'));
});
await section('stories-card', async () => {
await open(page, { query: "?welcome=1", errorSink: consoleErrors });
const backdrop = await page.evaluate(() => {
const el = document.querySelector('.first-run-backdrop');
if (!el) return null;
const style = getComputedStyle(el);
return {
filter: style.backdropFilter || style.webkitBackdropFilter || 'none',
background: style.backgroundColor,
pointerEvents: style.pointerEvents,
};
});
record('the welcome backdrop tints the globe without blurring it',
!!backdrop && backdrop.filter === 'none' && backdrop.background !== 'rgba(0, 0, 0, 0)'
&& backdrop.pointerEvents === 'none',
JSON.stringify(backdrop));
await nextStep(page, '[data-first-run-start]');
await nextStep(page, '[data-first-run-choice]');
const button = await page.evaluate(() => {
const el = document.querySelector('#first-run-launcher [data-first-run-stories]');
return el ? { tag: el.tagName, href: el.getAttribute('href'), target: el.getAttribute('target') } : null;
});
record('the GEV Stories card offers an in-app BROWSE STORIES button',
button?.tag === 'BUTTON' && button.href === null && button.target === null,
JSON.stringify(button));
const pagesBefore = (await browser.pages()).length;
await page.click('#first-run-launcher [data-first-run-stories]');
const opened = await page.waitForFunction(
() => document.body.classList.contains('stories-mode')
&& !!document.querySelector('#gev-stories .app'),
{ timeout: 30000 },
).then(() => true, () => false);
const after = await page.evaluate((sel) => ({
launcherVisible: !!document.querySelector(sel)?.classList.contains('visible'),
session: sessionStorage.getItem('gev:first-run-mission-session:v1'),
query: location.search,
}), LAUNCHER);
record('BROWSE STORIES opens Stories Explore in this tab',
opened && (await browser.pages()).length === pagesBefore,
`stories-mode=${opened}, query=${after.query}`);
record('BROWSE STORIES closes the welcome card for the session',
!after.launcherVisible && after.session !== null,
`visible=${after.launcherVisible}, session=${after.session}`);
shots.push(await shoot(page, 'stories-card-explore'));
});
// ── Viewports ───────────────────────────────────────────────────────────
await section('viewports', async () => {
// Portrait phone, LANDSCAPE phone (the short viewport that clipped the card
@@ -695,6 +756,8 @@ async function main() {
for (const vp of VIEWPORTS) {
await page.setViewport({ width: vp.width, height: vp.height, deviceScaleFactor: vp.dpr });
await open(page, { query: "?welcome=1", errorSink: consoleErrors });
for (let step = 1; step <= 3; step++) {
if (step > 1) await nextStep(page, step === 2 ? '[data-first-run-start]' : '[data-first-run-choice]');
const box = await page.evaluate((sel) => {
const node = document.querySelector(sel);
if (!node) return null;
@@ -715,22 +778,23 @@ async function main() {
const fits = !!box && box.top >= 0 && box.bottom <= box.vh
&& box.left >= 0 && box.right <= box.vw;
record(
`the launcher fits a ${vp.label} with no clipping`,
`step ${step} fits a ${vp.label} with no clipping`,
fits,
box ? `${box.left},${box.top} → ${box.right},${box.bottom} in ${box.vw}x${box.vh}${box.listScrolls ? ' (list scrolls)' : ''}` : 'absent',
);
record(`"Don't show this again" stays on screen at ${vp.width}x${vp.height}`,
record(`step ${step} checkbox stays on screen at ${vp.width}x${vp.height}`,
!!box?.checkboxOnScreen);
// Discoverability: if the list scrolls, the LAST tile must still peek
// above the fold. A fold that lands exactly between tiles looks like a
// complete list of four, and the fifth mission is simply never found.
// complete list, and the last mission is simply never found.
if (step === 2) {
const peek = await page.evaluate((sel) => {
const node = document.querySelector(sel);
const list = node?.querySelector('.first-run-choices');
if (!list) return null;
list.scrollTop = 0;
const tiles = [...list.querySelectorAll('[data-first-run-choice]')];
const tiles = [...list.querySelectorAll('[data-first-run-start]')];
const last = tiles[tiles.length - 1];
if (!last) return null;
const listBox = list.getBoundingClientRect();
@@ -739,7 +803,7 @@ async function main() {
return {
scrolls: list.scrollHeight > list.clientHeight + 1,
fraction: lastBox.height ? visible / lastBox.height : 0,
label: last.dataset.firstRunChoice,
label: last.dataset.firstRunStart,
};
}, LAUNCHER);
record(
@@ -755,7 +819,7 @@ async function main() {
const reach = await page.evaluate(async (sel) => {
const node = document.querySelector(sel);
if (!node) return null;
const targets = [...node.querySelectorAll('[data-first-run-choice], [data-first-run-suppress]')];
const targets = [...node.querySelectorAll('[data-first-run-start], [data-first-run-suppress]')];
const offscreen = [];
for (const target of targets) {
target.focus();
@@ -764,7 +828,7 @@ async function main() {
const host = node.getBoundingClientRect();
if (document.activeElement !== target
|| rect.bottom <= host.top || rect.top >= host.bottom) {
offscreen.push(target.dataset.firstRunChoice || 'suppress-checkbox');
offscreen.push(target.dataset.firstRunStart || 'suppress-checkbox');
}
}
return { count: targets.length, offscreen };
@@ -773,7 +837,7 @@ async function main() {
// A hardcoded count silently turns into a failure the day the menu
// changes, which is exactly what it did when a tile was removed.
const expectedFocusable = await page.$$eval(
'[data-first-run-choice]', (nodes) => nodes.length,
'[data-first-run-start]', (nodes) => nodes.length,
) + 1;
record(
`every tile and the checkbox are keyboard-reachable at ${vp.width}x${vp.height}`,
@@ -782,6 +846,7 @@ async function main() {
? `${reach.count}/${expectedFocusable} focusable${reach.offscreen.length ? `, unreachable: ${reach.offscreen.join(', ')}` : ''}`
: 'absent',
);
}
// The reachability probe above tabs to the last tile and scrolls the list
// with it. Put it back to the top so the taste-pass shot shows what a
// visitor actually opens on.
@@ -791,7 +856,8 @@ async function main() {
document.activeElement?.blur?.();
}, LAUNCHER);
await sleep(250);
shots.push(await shoot(page, `launcher-${vp.name}`));
shots.push(await shoot(page, `launcher-${vp.name}-step-${step}`));
}
}
await page.setViewport({ width: 1440, height: 900, deviceScaleFactor: 1 });
});
+1 -1
View File
@@ -111,7 +111,7 @@ await page.waitForFunction(() => window.__godsEyeView?.viewer && window.__godsEy
{ timeout: 150000 });
await sleep(12000); // let the boot fly-to settle before pinning
await page.evaluate(() => {
document.querySelector('#first-run-launcher:not([hidden]) [data-first-run-choice="explore"]')?.click();
document.querySelector('#first-run-launcher:not([hidden]) [data-first-run-dismiss]')?.click();
});
await sleep(600); // let the launcher dismissal finish before taking evidence
-10
View File
@@ -314,17 +314,7 @@ try {
}
await page.evaluate(() => {
document.documentElement.lang = 'en';
document.documentElement.dataset.uiTheme = 'cyber';
});
const cyber = await page.$eval(
'#scene-select',
(node) => getComputedStyle(node).backgroundColor,
);
check(
'Cyber keeps its native field theme',
cyber === 'rgba(26, 35, 39, 0.96)',
cyber,
);
await begin('heading');
await page.evaluate(() => {
const owner = window.__godsEyeView.styleManager._cctvControls;
+9 -11
View File
@@ -845,7 +845,7 @@ async function main() {
params: {},
};
let failureUsed = false;
const entryLayerId = mode === 'flights' ? 'military-awareness' : 'rocket-launches';
const entryLayerId = 'military-awareness';
dataManager.setEnabled = async (layerId, shouldEnable) => {
const failsIsolation = phase === 'isolation' && layerId === 'local-datacenters' && !shouldEnable;
const failsActivation = phase === 'activation' && layerId === entryLayerId && shouldEnable;
@@ -872,7 +872,6 @@ async function main() {
priorLayerRestored: enabled.has('local-datacenters'),
entryEnabled: enabled.has(entryLayerId),
flightsButtonDisabled: document.getElementById('global-context-flights-btn').disabled,
missionsButtonDisabled: document.getElementById('global-context-missions-btn').disabled,
message: document.getElementById('toast').textContent,
};
};
@@ -893,7 +892,7 @@ async function main() {
}
};
const contextFailures = [];
for (const mode of ['flights', 'space-missions']) {
for (const mode of ['flights']) {
for (const phase of ['isolation', 'activation']) {
for (const outcome of ['false', 'reject']) {
contextFailures.push(await runContextFailure(mode, phase, outcome));
@@ -902,7 +901,7 @@ async function main() {
}
const directEntryFailures = [];
for (const layerId of ['military-awareness', 'rocket-launches']) {
for (const layerId of ['military-awareness']) {
for (const outcome of ['false', 'reject']) {
enabled.clear();
enabled.add('local-datacenters');
@@ -971,7 +970,7 @@ async function main() {
styleManager._showToast = originalShowToast;
const directActivationFailures = [];
for (const layerId of ['military-awareness', 'rocket-launches']) {
for (const layerId of ['military-awareness']) {
enabled.clear();
styleManager._contextControls._contextMode = null;
styleManager._contextControls._contextSessionSnapshot = {
@@ -1001,7 +1000,7 @@ async function main() {
}
const directActivationRollbackFailures = [];
for (const layerId of ['military-awareness', 'rocket-launches']) {
for (const layerId of ['military-awareness']) {
enabled.clear();
styleManager._contextControls._contextMode = null;
styleManager._contextControls._contextSessionSnapshot = {
@@ -1211,7 +1210,7 @@ async function main() {
check(
'user-facing chip, real Context entry rollback, and installation Search failures settle safely',
userFacingFailures.semanticFalseMessage === 'Radio could not stop cleanly'
&& userFacingFailures.contextFailures.length === 8
&& userFacingFailures.contextFailures.length === 4
&& userFacingFailures.contextFailures.every((failure) => (
failure.result === false
&& failure.visibleMode === null
@@ -1219,10 +1218,9 @@ async function main() {
&& failure.priorLayerRestored
&& !failure.entryEnabled
&& !failure.flightsButtonDisabled
&& !failure.missionsButtonDisabled
&& failure.message.includes('QA transition failed')
))
&& userFacingFailures.directEntryFailures.length === 4
&& userFacingFailures.directEntryFailures.length === 2
&& userFacingFailures.directEntryFailures.every((failure) => (
failure.reason.includes('could not start')
&& failure.retryReason === null
@@ -1233,14 +1231,14 @@ async function main() {
&& failure.priorLayerRestored
&& !failure.modeChanging
))
&& userFacingFailures.directActivationFailures.length === 2
&& userFacingFailures.directActivationFailures.length === 1
&& userFacingFailures.directActivationFailures.every((failure) => (
failure.mode === null
&& failure.snapshotCleared
&& failure.priorLayerRestored
&& failure.failedLayerDisabled
))
&& userFacingFailures.directActivationRollbackFailures.length === 2
&& userFacingFailures.directActivationRollbackFailures.length === 1
&& userFacingFailures.directActivationRollbackFailures.every((failure) => (
failure.toastMessages.length === 1
&& failure.toastMessages[0] === `${failure.layerId} could not start cleanly`
+1 -1
View File
@@ -345,7 +345,7 @@ try {
(await readScope()).feather === 2,
);
await page.click('#scope-toggle');
for (const layout of ['minimal', 'cyber', 'tactical']) {
for (const layout of ['minimal', 'tactical']) {
await page.select('#hud-layout-select', layout);
const state = await readScope();
check(
-29
View File
@@ -276,35 +276,6 @@ try {
.every((group) => group.scrollWidth <= group.clientWidth + 1),
),
);
const cyber = await page.evaluate(() => {
const root = document.documentElement;
const previous = root.getAttribute('data-ui-theme');
root.setAttribute('data-ui-theme', 'cyber');
const selected = [
...document.querySelectorAll('.gev-segment[aria-checked="true"]'),
];
// Check the final theme colors, independent of software-GL frame cadence.
for (const button of selected)
for (const animation of button.getAnimations()) animation.finish();
const backgrounds = selected.map(
(button) => getComputedStyle(button).backgroundColor,
);
const radii = [...document.querySelectorAll('.gev-segmented')].map(
(group) => getComputedStyle(group).borderRadius,
);
const consistent =
selected.length === 6 &&
backgrounds.every((color) => color === backgrounds[0]) &&
radii.every((radius) => radius === '1px');
if (previous === null) root.removeAttribute('data-ui-theme');
else root.setAttribute('data-ui-theme', previous);
return { consistent, count: selected.length, backgrounds, radii };
});
check(
'Cyber theme styles every selected segment consistently',
cyber.consistent,
JSON.stringify(cyber),
);
await page.evaluate(async () => {
const { dataManager, styleManager } = window.__godsEyeView;
await dataManager.setEnabled('recent-imagery', true);
+1 -1
View File
@@ -194,7 +194,7 @@ try {
result,
);
}
for (const theme of ['tactical', 'cyber']) {
for (const theme of ['tactical', 'minimal']) {
await page.evaluate(
(theme) => window.__godsEyeView.styleManager._setHudVariant(theme),
theme,
-3
View File
@@ -231,9 +231,6 @@ async function boot(page, url) {
await page.waitForFunction(() => Boolean(window.__godsEyeView?.dataManager), {
timeout: 150_000,
});
await page.evaluate(() =>
document.querySelector('.first-run-explore')?.click(),
);
await page.keyboard.press('Escape');
await page.evaluate(() => {
for (const el of document.querySelectorAll(
+17 -17
View File
@@ -1980,16 +1980,19 @@ try {
await wait(12_000);
check('leaving Contacts restores Transit', await isOn());
// SPACE MISSIONS
await page.evaluate(() =>
window.__godsEyeView.dataManager.setEnabled('transit', false, {
origin: 'user',
}),
);
await wait(2_000);
await page.click('#global-context-missions-btn');
// SPACE MISSIONS: an ordinary layer. It neither refuses nor puts away
// Transit, so a Transit switched on while it runs stays on after it ends.
const setMissions = (enabled) =>
page.evaluate(
(on) =>
window.__godsEyeView.dataManager.setEnabled('rocket-launches', on, {
origin: 'user',
}),
enabled,
);
await setMissions(true);
await wait(20_000);
const blocked = await page.evaluate(async () => {
const beside = await page.evaluate(async () => {
const settled = await window.__godsEyeView.dataManager.setEnabled(
'transit',
true,
@@ -2001,16 +2004,13 @@ try {
};
});
check(
'Space Missions refuses to enable Transit while it isolates replay data',
blocked.enabled === false,
JSON.stringify(blocked),
'Transit can be switched on while Space Missions runs',
beside.settled !== false && beside.enabled === true,
JSON.stringify(beside),
);
await page.click('#global-context-missions-btn');
await setMissions(false);
await wait(12_000);
check(
'leaving Space Missions leaves Transit off, as it was on entry',
(await isOn()) === false,
);
check('switching Space Missions off leaves Transit on', await isOn());
check(
'no uncaught page errors',
+57 -31
View File
@@ -1637,19 +1637,48 @@ async function main() {
// The fixture planes repeat one position, so the icon holds and draws no
// head. Fly the tracked one east for this check; the display runs 30 s
// behind, so give it time to reach the moving reports.
await evalPage((icao) => {
await evalPage(async (icao) => {
const { rendererOf } = await import(`${window.__gevQaSourceBase || '/src'}/render/rendererOf.js`);
const app = window.__godsEyeView;
const fl = app.dataManager.layers.get('flights').module;
// Observe this selection's actual draw-port submissions: trails no
// longer live in viewer.entities. Disabling destroys the reused trail
// set, so this selection creates one the probe can identify.
await app.dataManager.setEnabled('flights', false);
const draw = rendererOf(app.viewer).draw;
const createLines = draw.lines;
let head = null;
let trail = null;
draw.lines = function (spec) {
const set = createLines.call(this, spec);
if (!spec.id.startsWith('trail:')) return set;
draw.lines = createLines;
trail = set;
const upsert = set.upsert;
set.upsert = function (items) {
const result = upsert.call(this, items);
for (const item of items)
if (/^gev-trail:\d+:head$/.test(item.id)) head = item;
return result;
};
const clear = set.clear;
set.clear = function () { head = null; return clear.call(this); };
const dispose = set.dispose;
set.dispose = function () { head = null; trail = null; return dispose.call(this); };
return set;
};
window.__qaTrailHead = () => trail?.show && head?.show !== false ? head?.positions : null;
window.__qaRestoreTrailProbe = () => { draw.lines = createLines; };
await app.dataManager.setEnabled('flights', true);
if (!fl.trackById(icao)) throw new Error('trail fixture could not reselect its aircraft');
const f = window.__SYNTH.flights.find((p) => p.icao === icao);
f.moveFromMs = Date.now();
}, trackedIcao);
await sleep(55_000);
const headSamples = await sampleFrames(page, 40, (icao) => {
const viewer = window.__godsEyeView.viewer;
const fl = window.__godsEyeView.dataManager.layers.get('flights').module;
const ent = viewer.trackedEntity;
const time = viewer.clock.currentTime;
const head = viewer.entities.values.find((e) => String(e.id).startsWith('gev-trail:fl-head-'));
const line = head?.polyline?.positions?.getValue(time);
const drawn = ent?.position?.getValue(time);
const line = window.__qaTrailHead();
const drawn = window.__qaFollowed()?.position?.();
if (!line?.length || !drawn) return null;
const end = line[line.length - 1];
const dist = (a, b) => Math.hypot(a.x - b.x, a.y - b.y, a.z - b.z);
@@ -1695,10 +1724,8 @@ async function main() {
for (let i = 0; i < 8; i++) {
await sleep(600);
betweenFrames.push(await evalPage((icao) => {
const viewer = window.__godsEyeView.viewer;
const head = viewer.entities.values.find((e) => String(e.id).startsWith('gev-trail:fl-head-'));
const line = head?.polyline?.positions?.getValue(viewer.clock.currentTime);
const drawn = viewer.trackedEntity?.position?.getValue(viewer.clock.currentTime);
const line = window.__qaTrailHead();
const drawn = window.__qaFollowed()?.position?.();
if (!line?.length || !drawn) return null;
const end = line[line.length - 1];
return Math.hypot(end.x - drawn.x, end.y - drawn.y, end.z - drawn.z);
@@ -1712,10 +1739,11 @@ async function main() {
f.lon += (f.vel * (Date.now() - f.moveFromMs)) / 1000
/ (111320 * Math.cos((f.lat * Math.PI) / 180));
delete f.moveFromMs;
window.__qaRestoreTrailProbe();
}, trackedIcao);
const headUsable = headSamples.values.filter((v) => v != null);
if (headUsable.length < 10) {
skip('trail head: ends at the drawn icon on every frame',
record('trail head: ends at the drawn icon on every frame', false,
`only ${headUsable.length} frames with a drawn head (timedOut=${headSamples.timedOut})`);
} else {
const worst = Math.max(...headUsable.map((v) => v.end));
@@ -3681,6 +3709,9 @@ async function main() {
} while (Date.now() < fleetClampDeadline
&& (!Number.isFinite(fleetH) || fleetH < seeded + 1));
if (!fl.trackById('aaa097')) return { error: 'trackById(aaa097) failed' };
// The tracked contact obeys the same 3D toggle as the fleet. Arm it
// before testing the cold-ground gate and the warm model handoff.
fl.setParams({ models3d: true });
await window.__dfSettle(1500);
// Read the tracked entity's rendered height plus the floor under it and
// the sensor value the data APIs report, at whatever regime the camera
@@ -3770,6 +3801,7 @@ async function main() {
};
const trackedEntity = window.__qaFollowed();
const trackedModel = findOwnModel();
if (!trackedModel) return { error: 'tracked model absent before exit' };
const achievedOut = await window.__dfZoomAbove(window.__dfRegime.exit + 5000);
const zoomedOut = await window.__dfObserveTrackedExit({
scene: v.scene, trackedEntity, trackedModel, getTrackedModel: findOwnModel,
@@ -3908,10 +3940,8 @@ async function main() {
// the tracked billboard becomes the visual again. Gating the clamp on
// model EXISTENCE put the burial straight back in exactly that state.
//
// This scenario also pins the toggle contract itself. The DISPLAY-rail
// "3D" toggle stays OFF for the whole block on purpose: it governs the
// FLEET's draw-call budget only, and the tracked contact must still take
// its model on zoom without the operator arming anything.
// The tracked contact obeys the shared 3D toggle. Keep it enabled
// while zoom alone hands the visual between model and billboard.
const dfRetained = await evalPage(async () => {
const v = window.__godsEyeView.viewer;
const Cesium = await import('/node_modules/cesium/Build/Cesium/index.js');
@@ -3924,13 +3954,13 @@ async function main() {
// and there would otherwise hand an open skin to the seeded scenarios
// that follow; closing an already-closed skin is inert.
try {
// Toggle OFF throughout — the tracked model must not need it.
fl.setParams({ models3d: false });
const toggleOff = fl.getParams().models3d === false;
// Arm the shared toggle so the zoom regime can retain a hidden model.
fl.setParams({ models3d: true });
const toggleOn = fl.getParams().models3d === true;
if (!fl.trackById('aaa097')) return { error: 'trackById(aaa097) failed' };
await window.__dfSettle(600);
// Below the ENTER ceiling (trackById re-frames to the close follow
// range): the tracked model arrives on zoom alone, toggle still off.
// range): the tracked model arrives on zoom alone, 3D enabled.
const belowH = await window.__dfZoomBelow(window.__dfRegime.enter - 20000);
const withModel = await window.__dfAwaitTrackedModel('aaa097', 20000);
// Same split as the regime scenario: a browser with no usable GLB
@@ -3980,7 +4010,7 @@ async function main() {
const ent2 = window.__qaFollowed()?.position?.();
const c2 = ent2 ? window.__dfCarto(ent2) : null;
const out = {
toggleOff,
toggleOn,
enter: window.__dfRegime.enter,
exit: window.__dfRegime.exit,
belowH,
@@ -4015,23 +4045,19 @@ async function main() {
record('display-floor/T7: while the tracked MODEL is the visual, the clamp stands aside',
!dfRetained.error && dfRetained.modelsRenderingBelow > 0,
dfRetained.error
|| `${dfRetained.modelsRenderingBelow} aaa097 model(s) rendering at ${(dfRetained.belowH / 1000).toFixed(0)} km with the 3D toggle OFF; entity at ${Number(dfRetained.withModelH).toFixed(1)} m (ground-snap owns it)`);
|| `${dfRetained.modelsRenderingBelow} aaa097 model(s) rendering at ${(dfRetained.belowH / 1000).toFixed(0)} km with the 3D toggle ON; entity at ${Number(dfRetained.withModelH).toFixed(1)} m (ground-snap owns it)`);
// The toggle contract after auto-3D (2026-08-20): the DISPLAY-rail "3D"
// switch owns the FLEET only. The tracked contact's model is default-on
// and decided purely by camera distance, so with the toggle OFF it is
// SHOWN below the enter ceiling and handed back above the exit ceiling —
// and handed back by HIDING, not destroying, which is the retained state
// the floor pin below depends on.
record('display-floor/regime: the 3D toggle governs the FLEET only — the tracked model follows the zoom',
!dfRetained.error && dfRetained.toggleOff === true
// With 3D enabled, zooming out hides rather than destroys the
// tracked model: the retained state the floor check depends on.
record('display-floor/regime: with 3D enabled the tracked model follows the zoom',
!dfRetained.error && dfRetained.toggleOn === true
&& dfRetained.modelsRenderingBelow > 0
&& dfRetained.belowH < dfRetained.enter
&& dfRetained.shownModelsAbove === 0
&& dfRetained.hiddenModelsAbove > 0
&& dfRetained.aboveH > dfRetained.exit,
dfRetained.error
|| `toggle OFF throughout: at ${(dfRetained.belowH / 1000).toFixed(0)} km (< ${(dfRetained.enter / 1000).toFixed(0)} km enter) ${dfRetained.modelsRenderingBelow} aaa097 model(s) rendering; at ${(dfRetained.aboveH / 1000).toFixed(0)} km (> ${(dfRetained.exit / 1000).toFixed(1)} km exit) ${dfRetained.shownModelsAbove} shown / ${dfRetained.hiddenModelsAbove} retained-hidden`);
|| `toggle ON throughout: at ${(dfRetained.belowH / 1000).toFixed(0)} km (< ${(dfRetained.enter / 1000).toFixed(0)} km enter) ${dfRetained.modelsRenderingBelow} aaa097 model(s) rendering; at ${(dfRetained.aboveH / 1000).toFixed(0)} km (> ${(dfRetained.exit / 1000).toFixed(1)} km exit) ${dfRetained.shownModelsAbove} shown / ${dfRetained.hiddenModelsAbove} retained-hidden`);
record('display-floor: a retained-but-hidden tracked model does NOT suppress the floor',
Number.isFinite(dfRetained.afterSeedH)
+45
View File
@@ -89,6 +89,51 @@ export function placeTileFiles(rows, meta) {
return files;
}
/**
* A pack file's new text, keeping the earlier build's `meta.built` when
* nothing else in the file changed, so rebuilding unchanged data leaves the
* file as it was. A file that does not hold all of its pack's data (the
* places index) is passed through this only when the rest of the pack is
* unchanged too.
* @param {string} text The new file, JSON with a `meta.built` stamp.
* @param {string | undefined} earlier The file as it is now, if there is one.
*/
export function keepBuiltIfUnchanged(text, earlier) {
if (!earlier) return text;
let before;
try {
before = JSON.parse(earlier);
} catch {
return text;
}
const after = JSON.parse(text);
if (typeof before?.meta?.built !== 'string' || !after.meta) return text;
const unstamped = (value) =>
JSON.stringify({ ...value, meta: { ...value.meta, built: null } });
if (unstamped(before) !== unstamped(after)) return text;
return `${JSON.stringify({ ...after, meta: { ...after.meta, built: before.meta.built } })}\n`;
}
/**
* Keeps the earlier build's `meta.built` in the places pack's index when the
* rebuild changed nothing: every tile and `files.js` the same text, no tile
* of the earlier build left out, and nothing else in the index changed. The
* index holds only row counts, so it alone cannot tell.
* @param {Map<string, string>} files The new pack, as placeTileFiles gives it; its index is replaced in place.
* @param {Map<string, string>} earlier The pack's files on disk now, by name.
*/
export function keepPackBuiltIfUnchanged(files, earlier) {
for (const name of earlier.keys())
if (name !== 'index.json' && !files.has(name)) return files;
for (const [name, text] of files)
if (name !== 'index.json' && earlier.get(name) !== text) return files;
files.set(
'index.json',
keepBuiltIfUnchanged(files.get('index.json'), earlier.get('index.json')),
);
return files;
}
const kmBetween = (a, b) =>
greatCircleKm({ lat: a[1], lon: a[2] }, { lat: b[1], lon: b[2] });
+2 -2
View File
@@ -58,8 +58,8 @@ function realtimeDirectives(
'For visual filter requests, call set_visual_style with one of the allowed style IDs.',
'SHIPS vs STYLES: "vessels" is easily heard as "visuals". "Show me vessels", "turn on vessels", "the vessels", "visuals" or "vestibules" said WITHOUT a style name means the ships layer: set_layer_visibility{layerId:"ais-live-vessels"}, exactly as "ships" or "boats" does. Call set_visual_style only when the user names a style (retro/CRT, surveillance/night vision, thermal, anime, noir, normal) or says filter, effect or look. Never turn on a different data layer (such as fires) for a ships request.',
'Disambiguation table — basemap vs layer vs style: basemap switching requires an explicit stack name — "Bing aerial" means set_map_stack bing-aerial, "aerial with labels" means bing-labels, "OSM"/"road map" means osm, "Esri"/"Esri imagery" means esri-imagery, "Google 3D"/"photorealistic" means photoreal. Any other mention of "satellite" or "satellites" means the satellites DATA LAYER via set_layer_visibility, never a basemap — except "recent/latest satellite imagery" (the recent-imagery layer) and "weather satellite"/clouds (weather-satellite). "surveillance"/"night vision"/"thermal" are visual STYLES via set_visual_style.',
'HUD requests ("hud on/off", "switch to minimal/tactical/cyber layout") use set_hud. Detection requests ("detection on", "dense mode", "balanced mode", "sparse mode", "set density to 25", "use weighted allocation") use set_detection. Density snaps to 0/25/50/75/100 and derives Sparse/Balanced/Dense; panoptic is a legacy alias for Dense.',
'Cyber sonar requests use set_cyber_sonar: enabled, rings, rangePct, intensityPct (Power), opacityPct, sectorDeg. For settings questions read get_current_view_state.controls.hud.sonar. Sonar is not detection. Do not silently switch themes, reveal the HUD or enable sonar when changing a slider. If the user explicitly requests Cyber plus sonar settings, call set_hud first, wait for success, then set_cyber_sonar. Confirm returned values; mapSweepActive and contactSweepActive distinguish saved settings from active map effects, including in Cockpit or reduced motion. Do not claim visible contacts solely because enabled is true.',
'HUD requests ("hud on/off", "switch to minimal/tactical layout") use set_hud. Detection requests ("detection on", "dense mode", "balanced mode", "sparse mode", "set density to 25", "use weighted allocation") use set_detection. Density snaps to 0/25/50/75/100 and derives Sparse/Balanced/Dense; panoptic is a legacy alias for Dense.',
'Sonar is a visual style over any HUD layout. Sonar requests (including "cyber mode", which was replaced by sonar) use set_cyber_sonar: enabled, rings, rangePct, intensityPct (Power), opacityPct, sectorDeg. For settings questions read get_current_view_state.controls.hud.sonar. Sonar is not detection. Do not silently switch layouts, reveal the HUD or enable sonar when changing a slider. Confirm returned values; mapSweepActive and contactSweepActive distinguish saved settings from active map effects, including in Cockpit or reduced motion. Do not claim visible contacts solely because enabled is true.',
'Bloom/sharpen requests use set_post_processing. Scene requests ("play orbital watch", "stop the scene", "what scenes are there") use control_scene. CCTV camera requests ("next camera", "nearest camera", "select the Congress camera", "show coverage") use control_cctv — the CCTV layer must be enabled first.',
'Radio playback requests use control_radio. "Turn on/start the radio" means action=play; action=enable only reveals Radio markers and must be reserved for explicit "show/enable the Radio layer/markers" requests. After a prepared playback result, briefly confirm any other completed actions and say "Turning on the radio"—never claim it is already playing. The client keeps Radio muted until playback is verified, then closes voice before restoring Radio volume. Examples: "play news near Austin" → select category=news locationId=austin; "play US news" → select category=news country=US; "Radio volume 30" → volume; pause/resume/stop/next/previous use the matching action. Radio selection never moves the camera.',
'"Track/follow <something specific>" (a callsign, ship name, satellite name) uses track_entity. "Take me to the biggest fire" uses track_entity with query "biggest fire" (the fires layer must be enabled). Bare "orbit" means camera orbit of the current landmark. "Stop following/tracking" uses stop_tracking.',
+1 -1
View File
@@ -225,7 +225,7 @@ export const ACTION_DESCRIPTIONS = {
},
set_cyber_sonar: {
description:
'Adjust Cyber-only sonar controls. Requires the Cyber HUD layout; never switches layout or HUD visibility. Omitted fields stay unchanged. Returns actual settings and separate map/contact sweep activity. A saved setting does not mean the effect is active.',
'Adjust the Sonar visual style, which works over any HUD layout. Never switches layout or HUD visibility. Omitted fields stay unchanged. Returns actual settings and separate map/contact sweep activity. A saved setting does not mean the effect is active.',
$position: 1,
parameters: {
properties: {
+428
View File
@@ -0,0 +1,428 @@
import { registerWorldOverlayPaintLane } from '../../overlays/worldOverlay.js';
import { fromDegrees } from '../../geo/ellipsoid.js';
import {
earthquakeContourRings,
earthquakeContourScale,
earthquakeContourShape,
earthquakeRippleRings,
EARTHQUAKE_RIPPLE_PERIOD_MS,
} from '../../layers/earthquakes/model.js';
/** Points around each contour line: smooth at the largest disc on screen. */
export const RIPPLE_RING_SEGMENTS = 96;
/** An index contour's width, and every other line's. */
const INDEX_WIDTH_PX = 2;
const LINE_WIDTH_PX = 1.1;
/**
* The overlay lane the lines paint in: the magnitude labels' own. A lane's
* custom painters run before its entries, so the lines sit under the labels
* and under the selected quake's card.
*/
export const RIPPLE_PAINT_LANE = 'ambient-label';
/**
* The selected disc's fill, [offset, alpha] from the epicentre (0) to its
* outer circle (1): strongest in the middle, fading out to nothing at the
* edge.
*/
export const DISC_FADE = Object.freeze([
[0, 0.42],
[0.35, 0.26],
[0.75, 0.1],
[1, 0],
]);
/**
* Each contour wave's fill, out to its own line: clear inside, tinting
* toward the line; times the wave's own fade.
*/
export const WAVE_FADE = Object.freeze([
[0, 0],
[0.55, 0],
[1, 0.2],
]);
/**
* `rgb(r,g,b)` (or `rgba`) as a function of alpha, for gradient stops; any
* other colour keeps its own alpha.
*/
export function cssWithAlpha(color) {
const m = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(String(color));
if (!m) return () => color;
const rgb = `${m[1]},${m[2]},${m[3]}`;
return (alpha) => `rgba(${rgb},${Math.max(0, Math.min(1, alpha))})`;
}
/**
* How many times the lines run out to the edge after a quake is selected
* before they rest as still contours and stop asking for frames: earthquakes
* otherwise hold no render (docs/CURRENT-STATE.md, "Earthquake discs are
* STATIC geometry"), and a quake can stay selected for hours.
*/
export const RIPPLE_ACTIVE_CYCLES = 3;
let reducedMotionQuery;
/**
* The viewer's reduced-motion setting, live: the media query is kept, so a
* change mid-session is read at the next paint and tick.
*/
const reducedMotion = () => {
try {
reducedMotionQuery ??=
globalThis.matchMedia?.('(prefers-reduced-motion: reduce)') ?? null;
return reducedMotionQuery?.matches === true;
} catch {
return false;
}
};
/** How often the rings re-read the ground height under the quake. */
const HEIGHT_READ_INTERVAL_MS = 500;
/**
* A ground height the rings accept, in metres: the Dead Sea shore to above
* Everest. Anything else is a bad sample (a hit on something drawn above
* the ground, or a broken tile), and the rings stay where they are.
*/
const groundHeightOk = (h) => Number.isFinite(h) && h >= -500 && h <= 9000;
/**
* The selected earthquake's contour lines, painted on the world overlay:
* wavy closed lines, shaped by the quake's id (earthquakeContourShape), run
* from the marker out to the disc's edge and fade there, one after another,
* for RIPPLE_ACTIVE_CYCLES runs after a quake is selected and only while it
* is on screen, then rest as still contours. They never cross, and every third is
* a heavier index contour, as on a topographic map. Nothing is drawn, and no
* frame is asked for, while no quake is selected. With reduced motion the
* lines hold still.
*
* A line is drawn in the tangent plane at the epicentre: at the largest
* disc (M6, 64 km) it sits about 320 m above the curved ground at its edge
* (64² / 2R), about 1.5 px off the drawn disc at the 220 km, -45° framing a
* label click flies to (900 px tall, 35° field of view); less for smaller
* quakes, as the offset grows with the square of the radius.
* @param {object} [deps]
* @param {Function} [deps.registerLane] `registerWorldOverlayPaintLane`.
* @param {() => number} [deps.now] Steady clock, ms.
* @param {(cb: Function) => number} [deps.requestFrame]
* @param {(handle: number) => void} [deps.cancelFrame]
* @param {() => boolean} [deps.prefersReducedMotion]
* @returns {{show: Function, hide: Function, dispose: Function}}
*/
export function createEarthquakeRipples({
registerLane = registerWorldOverlayPaintLane,
now = () => globalThis.performance?.now?.() ?? Date.now(),
requestFrame = (cb) => globalThis.requestAnimationFrame?.(cb) ?? null,
cancelFrame = (handle) => globalThis.cancelAnimationFrame?.(handle),
prefersReducedMotion = reducedMotion,
} = {}) {
let lane = null;
let target = null;
let frameHandle = null;
// When the running lines settle into still contours (the selection's
// bound), and whether the last paint found the quake on screen.
let startedAt = 0;
let settlesAt = 0;
let onScreen = false;
/** Whether the lines run now: in the window, and motion allowed. */
const running = () => now() < settlesAt && !prefersReducedMotion();
// Unit offsets around the line in the epicentre's tangent plane, packed
// x, y, z per point: north·cos + east·sin.
const offsets = new Float64Array((RIPPLE_RING_SEGMENTS + 1) * 3);
const angles = new Float64Array(RIPPLE_RING_SEGMENTS + 1);
for (let i = 0; i <= RIPPLE_RING_SEGMENTS; i++)
angles[i] = (2 * Math.PI * i) / RIPPLE_RING_SEGMENTS;
// Screen points, reused every frame.
const at = { x: 0, y: 0 };
const centerAt = { x: 0, y: 0 };
const eastAt = { x: 0, y: 0 };
const northAt = { x: 0, y: 0 };
/** Project an ECEF point to CSS pixels; false when it is behind the eye. */
function project(frame, px, py, pz, out) {
const m = frame.viewProjectionMatrix;
const w = m[3] * px + m[7] * py + m[11] * pz + m[15];
if (w <= 0) return false;
out.x =
((m[0] * px + m[4] * py + m[8] * pz + m[12]) / w / 2 + 0.5) * frame.width;
out.y =
(0.5 - (m[1] * px + m[5] * py + m[9] * pz + m[13]) / w / 2) *
frame.height;
return true;
}
/**
* Trace one closed line at `fraction` of the disc's radius (`shaped`:
* as a contour, else the disc's own circle). True when all of it is in
* front of the eye, so it can be filled.
*/
function trace(frame, fraction, shaped) {
const { ctx } = frame;
const center = target.center;
const reach = fraction * target.radiusM;
ctx.beginPath();
let pen = false;
let whole = true;
for (let i = 0; i <= RIPPLE_RING_SEGMENTS; i++) {
// The last point repeats the first angle, so the line closes.
const r = shaped
? reach * earthquakeContourScale(target.shape, angles[i], fraction)
: reach;
const visible = project(
frame,
center.x + offsets[i * 3] * r,
center.y + offsets[i * 3 + 1] * r,
center.z + offsets[i * 3 + 2] * r,
at,
);
if (!visible) {
pen = false;
whole = false;
continue;
}
if (pen) ctx.lineTo(at.x, at.y);
else ctx.moveTo(at.x, at.y);
pen = true;
}
return whole;
}
/**
* Fill the traced path with a radial gradient laid on the ground: the
* canvas places a path when it is traced and a gradient when it fills, so
* under the disc's ground-to-screen transform the gradient's circle
* becomes the disc's ellipse on screen while the path stays exact.
* @param {Array<[number, number]>} stops [offset, alpha], out to `reach`.
*/
function fillGround(ctx, reach, stops) {
ctx.save();
ctx.transform(
eastAt.x - centerAt.x,
eastAt.y - centerAt.y,
northAt.x - centerAt.x,
northAt.y - centerAt.y,
centerAt.x,
centerAt.y,
);
const gradient = ctx.createRadialGradient(0, 0, 0, 0, 0, reach);
for (const [offset, alpha] of stops)
gradient.addColorStop(offset, target.rgba(alpha));
ctx.fillStyle = gradient;
ctx.globalAlpha = 1;
ctx.fill();
ctx.restore();
}
/**
* Whether any of the disc is in the viewport: its centre's screen point,
* padded by its larger screen radius (or, seen edge-on, the centre alone).
*/
function discOnScreen(frame, c, e, n) {
if (!Number.isFinite(c.x) || !Number.isFinite(c.y)) return false;
const pad = Math.max(
Math.hypot(e.x - c.x, e.y - c.y) || 0,
Math.hypot(n.x - c.x, n.y - c.y) || 0,
);
return (
c.x + pad >= 0 &&
c.x - pad <= frame.width &&
c.y + pad >= 0 &&
c.y - pad <= frame.height
);
}
/**
* Re-read the ground height under the quake, at most twice a second while
* painting: the ground loads and refines as the camera comes in, and the
* rings move onto it once it differs by more than a metre.
*/
function settleHeight() {
if (!target.heightAt) return;
const at = now();
if (at - target.heightReadAt < HEIGHT_READ_INTERVAL_MS) return;
target.heightReadAt = at;
let height = null;
try {
height = target.heightAt();
} catch {
height = null;
}
if (!groundHeightOk(height) || Math.abs(height - target.heightM) <= 1)
return;
target.heightM = height;
target.center = fromDegrees(target.lon, target.lat, height);
}
function paint(frame) {
if (!target) return;
const { ctx } = frame;
settleHeight();
const center = target.center;
onScreen = false;
if (frame.occluder?.isPointVisible?.(center) === false) return;
const R = target.radiusM;
// The disc's ground frame on screen: its centre, and a radius east and
// north. Seen edge-on (or partly behind the eye) it is not filled.
const centerOk = project(frame, center.x, center.y, center.z, centerAt);
const eastOk = project(
frame,
center.x + target.east.x * R,
center.y + target.east.y * R,
center.z + target.east.z * R,
eastAt,
);
const northOk = project(
frame,
center.x + target.north.x * R,
center.y + target.north.y * R,
center.z + target.north.z * R,
northAt,
);
let fills = centerOk && eastOk && northOk;
if (fills) {
const area =
(eastAt.x - centerAt.x) * (northAt.y - centerAt.y) -
(eastAt.y - centerAt.y) * (northAt.x - centerAt.x);
fills = Math.abs(area) > 1;
}
onScreen =
centerOk &&
discOnScreen(
frame,
centerAt,
eastOk ? eastAt : centerAt,
northOk ? northAt : centerAt,
);
// The disc: strongest at the epicentre, fading out to its outer circle.
if (fills && trace(frame, 1, false)) fillGround(ctx, 1, DISC_FADE);
const animate = running();
const rings = animate
? earthquakeRippleRings(now() - startedAt)
: earthquakeContourRings();
// Brought back into view while the window lasts: run again.
if (animate && onScreen && frameHandle === null && lane)
frameHandle = requestFrame(tick);
ctx.strokeStyle = target.color;
ctx.lineJoin = 'round';
for (const { fraction, alpha, index } of rings) {
if (!(alpha > 0.01)) continue;
const whole = trace(frame, fraction, true);
// Each wave: clear inside, tinting toward its own line, as it fades.
if (fills && whole)
fillGround(
ctx,
fraction,
WAVE_FADE.map(([offset, a]) => [offset, a * alpha]),
);
ctx.lineWidth = index ? INDEX_WIDTH_PX : LINE_WIDTH_PX;
ctx.globalAlpha = alpha;
ctx.stroke();
}
ctx.globalAlpha = 1;
}
/** Ask for one more frame while the lines run (one request at a time). */
function tick() {
frameHandle = null;
if (!target || !lane) return;
// Settled, or out of sight: one last paint draws the still contours
// (or nothing), and no more frames are asked for. A paint that finds it
// on screen again inside the window starts the frames again.
if (!running() || !onScreen) {
lane.requestPaint();
return;
}
lane.requestPaint();
frameHandle = requestFrame(tick);
}
function stopFrames() {
if (frameHandle !== null) cancelFrame(frameHandle);
frameHandle = null;
}
/**
* Run the contour lines around one quake, replacing any other.
* @param {{id: string, lon: number, lat: number, heightM?: number, heightAt?: () => number|null, radiusM: number, color: string}} next
* @param {{restart?: boolean}} [options] `restart: false` updates the
* same quake in place (a feed refresh) without running it again.
*/
function show(next, { restart = true } = {}) {
if (
!next ||
!Number.isFinite(next.lon) ||
!Number.isFinite(next.lat) ||
!(next.radiusM > 0)
) {
hide();
return;
}
const sameQuake = target?.id === next.id;
const lon = (next.lon * Math.PI) / 180;
const lat = (next.lat * Math.PI) / 180;
const [sinLon, cosLon] = [Math.sin(lon), Math.cos(lon)];
const [sinLat, cosLat] = [Math.sin(lat), Math.cos(lat)];
for (let i = 0; i <= RIPPLE_RING_SEGMENTS; i++) {
const [c, s] = [Math.cos(angles[i]), Math.sin(angles[i])];
offsets[i * 3] = c * -sinLat * cosLon + s * -sinLon;
offsets[i * 3 + 1] = c * -sinLat * sinLon + s * cosLon;
offsets[i * 3 + 2] = c * cosLat;
}
target = {
id: next.id,
// On the ground the disc is draped on: the height known now, then
// re-read while painting (see `settleHeight`), since a label's fly-to
// starts from far away, before that ground has loaded.
lon: next.lon,
lat: next.lat,
heightM: groundHeightOk(next.heightM) ? next.heightM : 0,
heightAt: typeof next.heightAt === 'function' ? next.heightAt : null,
heightReadAt: -Infinity,
center: fromDegrees(
next.lon,
next.lat,
groundHeightOk(next.heightM) ? next.heightM : 0,
),
radiusM: next.radiusM,
color: next.color || 'rgb(255,165,0)',
shape: earthquakeContourShape(next.id),
rgba: cssWithAlpha(next.color || 'rgb(255,165,0)'),
// Angle 0 is north and a quarter turn is east (see `offsets`).
north: { x: offsets[0], y: offsets[1], z: offsets[2] },
east: {
x: offsets[(RIPPLE_RING_SEGMENTS / 4) * 3],
y: offsets[(RIPPLE_RING_SEGMENTS / 4) * 3 + 1],
z: offsets[(RIPPLE_RING_SEGMENTS / 4) * 3 + 2],
},
};
if (restart || !sameQuake) {
startedAt = now();
settlesAt =
startedAt + RIPPLE_ACTIVE_CYCLES * EARTHQUAKE_RIPPLE_PERIOD_MS;
// Assume it is in view until a paint says otherwise.
onScreen = true;
}
lane ??= registerLane(RIPPLE_PAINT_LANE, paint, {
id: 'earthquake-ripples',
});
lane.setActive(true);
lane.requestPaint();
// A refresh while the disc is out of sight asks for no frame; a paint
// that finds it on screen again starts them (a restart sets onScreen).
if (running() && onScreen && frameHandle === null)
frameHandle = requestFrame(tick);
}
function hide() {
stopFrames();
if (!target) return;
target = null;
lane?.setActive(false);
}
function dispose() {
hide();
lane?.unregister();
lane = null;
}
return { show, hide, dispose };
}
+452
View File
@@ -0,0 +1,452 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import {
DISC_FADE,
cssWithAlpha,
RIPPLE_ACTIVE_CYCLES,
RIPPLE_PAINT_LANE,
RIPPLE_RING_SEGMENTS,
createEarthquakeRipples,
} from './earthquakeRipples.js';
import {
EARTHQUAKE_RIPPLE_PERIOD_MS,
EARTHQUAKE_RIPPLE_RINGS,
} from '../../layers/earthquakes/model.js';
import { fromDegrees } from '../../geo/ellipsoid.js';
/** A paint lane, frame clock and canvas the test steps by hand. */
function harness({ reducedMotion = false } = {}) {
let motionReduced = reducedMotion;
const lanes = [];
const frames = new Map();
let nextFrame = 1;
let clock = 0;
const ripples = createEarthquakeRipples({
registerLane(laneId, painter, options) {
const lane = {
laneId,
painter,
options,
active: false,
paints: 0,
unregistered: false,
setActive(next) {
lane.active = next;
},
requestPaint() {
lane.paints++;
},
unregister() {
lane.unregistered = true;
},
};
lanes.push(lane);
return lane;
},
now: () => clock,
requestFrame(cb) {
const handle = nextFrame++;
frames.set(handle, cb);
return handle;
},
cancelFrame: (handle) => frames.delete(handle),
prefersReducedMotion: () => motionReduced,
});
const strokes = [];
const fills = [];
let path = null;
const ctx = {
globalAlpha: 1,
beginPath() {
path = { moves: 0, lines: 0 };
},
moveTo() {
path.moves++;
},
lineTo() {
path.lines++;
},
stroke() {
strokes.push({
...path,
alpha: ctx.globalAlpha,
color: ctx.strokeStyle,
width: ctx.lineWidth,
});
},
// Fills record their path, gradient and the transform they fill under.
saved: 0,
transformed: null,
save() {
ctx.saved++;
},
restore() {
ctx.saved--;
ctx.transformed = null;
},
transform(...args) {
ctx.transformed = args;
},
createRadialGradient(...circles) {
const gradient = { circles, stops: [] };
gradient.addColorStop = (offset, color) =>
gradient.stops.push([offset, color]);
return gradient;
},
fill() {
fills.push({
...path,
gradient: ctx.fillStyle,
transform: ctx.transformed,
});
},
};
// w = 1 everywhere: every point is in front of the eye.
const matrix = new Float64Array(16);
matrix[0] = 1e-7;
matrix[5] = 1e-7;
matrix[15] = 1;
const frame = (visible = true) => ({
ctx,
width: 800,
height: 600,
viewProjectionMatrix: matrix,
occluder: { isPointVisible: () => visible },
});
return {
ripples,
lanes,
frames,
strokes,
fills,
frame,
matrix,
setReducedMotion(next) {
motionReduced = next;
},
advance(ms) {
clock += ms;
},
/** Run the pending animation frames once. */
step() {
const pending = [...frames.entries()];
frames.clear();
for (const [, cb] of pending) cb();
},
};
}
const target = {
id: 'ak1',
lon: -153.3,
lat: 60,
radiusM: 32000,
color: 'rgb(255,0,0)',
};
test('nothing is registered or animated until a quake is selected', () => {
const h = harness();
assert.equal(h.lanes.length, 0);
assert.equal(h.frames.size, 0);
h.ripples.hide();
assert.equal(h.frames.size, 0);
});
test('a selected quake animates one ring set, one frame request at a time', () => {
const h = harness();
h.ripples.show(target);
const [lane] = h.lanes;
assert.equal(lane.laneId, RIPPLE_PAINT_LANE);
assert.equal(RIPPLE_PAINT_LANE, 'ambient-label', 'under the labels');
assert.equal(lane.active, true);
assert.equal(h.frames.size, 1);
h.ripples.show({ ...target, id: 'ak2' });
assert.equal(h.lanes.length, 1, 'the lane is reused');
assert.equal(h.frames.size, 1, 'still one frame loop');
const before = lane.paints;
h.step();
h.step();
assert.equal(lane.paints, before + 2, 'one repaint per frame');
assert.equal(h.frames.size, 1);
h.advance(600);
lane.painter(h.frame());
// At 600 ms every line is between the marker and the edge, so all draw.
assert.equal(h.strokes.length, EARTHQUAKE_RIPPLE_RINGS);
assert.deepEqual(
h.strokes.map((stroke) => stroke.width),
[2, 1.1, 1.1, 2, 1.1, 1.1],
'every third line is an index contour',
);
for (const stroke of h.strokes) {
assert.equal(stroke.moves, 1, 'one unbroken ring');
assert.equal(stroke.lines, RIPPLE_RING_SEGMENTS);
assert.equal(stroke.color, 'rgb(255,0,0)');
assert.ok(stroke.alpha > 0 && stroke.alpha <= 1);
}
h.ripples.hide();
assert.equal(lane.active, false);
assert.equal(h.frames.size, 0, 'no frames asked for once hidden');
h.strokes.length = 0;
lane.painter(h.frame());
assert.equal(h.strokes.length, 0);
});
test('rings are skipped behind the globe and broken behind the eye', () => {
const h = harness();
h.ripples.show(target);
h.advance(600);
const [lane] = h.lanes;
lane.painter(h.frame(false));
assert.equal(h.strokes.length, 0, 'epicentre over the horizon');
// Points with negative x fall behind the eye: each ring breaks there.
const frame = h.frame();
frame.viewProjectionMatrix[3] = 1e-6;
const center = fromDegrees(target.lon, target.lat);
frame.viewProjectionMatrix[15] = -1e-6 * center.x;
lane.painter(frame);
assert.equal(h.strokes.length, EARTHQUAKE_RIPPLE_RINGS);
for (const stroke of h.strokes)
assert.ok(stroke.lines < RIPPLE_RING_SEGMENTS, 'part of each ring hidden');
});
test('reduced motion draws still contour rings and asks for no frames', () => {
const h = harness({ reducedMotion: true });
h.ripples.show(target);
assert.equal(h.frames.size, 0);
assert.equal(h.lanes[0].paints, 1, 'painted once');
h.lanes[0].painter(h.frame());
assert.equal(h.strokes.length, EARTHQUAKE_RIPPLE_RINGS);
assert.ok(h.strokes.every((stroke) => stroke.alpha === 0.7));
});
test('an unusable target hides the rings; dispose releases the lane', () => {
const h = harness();
h.ripples.show(target);
h.ripples.show({ ...target, radiusM: 0 });
assert.equal(h.lanes[0].active, false);
assert.equal(h.frames.size, 0);
h.ripples.dispose();
assert.equal(h.lanes[0].unregistered, true);
// Shown again after dispose, it registers a fresh lane.
h.ripples.show(target);
assert.equal(h.lanes.length, 2);
h.ripples.dispose();
});
test('contour lines are wavy, the same for a quake every time, and inside the disc', () => {
const h = harness();
h.ripples.show(target);
h.advance(600);
// An identity-like projection: screen x, y follow ECEF y, z, so the
// distance from the projected epicentre measures each point's radius.
const frame = h.frame();
const m = frame.viewProjectionMatrix;
m[0] = 0;
m[5] = 0;
m[4] = 1e-6;
m[9] = 1e-6;
const points = [];
const ctx = frame.ctx;
const record = (x, y) => points.at(-1).push([x, y]);
ctx.beginPath = () => points.push([]);
ctx.moveTo = record;
ctx.lineTo = record;
ctx.stroke = () => {};
h.lanes[0].painter(frame);
const center = fromDegrees(target.lon, target.lat);
const cx = (center.y * 1e-6 * 0.5 + 0.5) * 800;
const cy = (0.5 - center.z * 1e-6 * 0.5) * 600;
const spread = (line) => {
const radii = line.map(([x, y]) => Math.hypot(x - cx, y - cy));
return Math.max(...radii) / Math.min(...radii);
};
// The disc's outer circle first (filled, not stroked), then each line.
assert.equal(points.length, EARTHQUAKE_RIPPLE_RINGS + 1);
points.shift();
assert.ok(
points.every((line) => spread(line) > 1.05),
'not circles: each line dents in and out',
);
for (const line of points) {
const [first, last] = [line[0], line.at(-1)];
assert.ok(
Math.hypot(first[0] - last[0], first[1] - last[1]) < 1e-6,
'closed',
);
}
});
test('the disc fades out to its outer circle; each wave fills with a fade', () => {
const h = harness();
h.ripples.show(target);
h.advance(600);
// A projection where east and north span the screen: the disc is seen
// from above, so its ground frame can be filled.
const frame = h.frame();
const m = frame.viewProjectionMatrix;
m[0] = 0;
m[5] = 0;
m[4] = 1e-6;
m[9] = 1e-6;
h.lanes[0].painter(frame);
assert.equal(h.fills.length, 1 + EARTHQUAKE_RIPPLE_RINGS);
const [disc, ...waves] = h.fills;
assert.equal(disc.lines, RIPPLE_RING_SEGMENTS, 'the whole outer circle');
assert.deepEqual(disc.gradient.circles, [0, 0, 0, 0, 0, 1]);
assert.deepEqual(
disc.gradient.stops,
DISC_FADE.map(([offset, alpha]) => [offset, `rgba(255,0,0,${alpha})`]),
);
assert.equal(disc.gradient.stops.at(-1)[1], 'rgba(255,0,0,0)', 'fades out');
assert.ok(disc.transform, 'filled under the ground-to-screen transform');
assert.equal(h.fills.length, waves.length + 1);
for (const wave of waves) {
const reach = wave.gradient.circles[5];
assert.ok(reach > 0 && reach < 1, 'out to its own line');
assert.equal(wave.gradient.stops[0][1], 'rgba(255,0,0,0)', 'clear inside');
}
// The transforms were undone: nothing leaks into the labels' painting.
assert.equal(frame.ctx.saved, 0);
// Seen edge-on, the ground frame has no area: lines only, no fills.
h.fills.length = 0;
m[9] = 0;
m[5] = 0;
h.lanes[0].painter(frame);
assert.equal(h.fills.length, 0);
});
test('cssWithAlpha turns rgb into rgba stops', () => {
assert.equal(cssWithAlpha('rgb(255,165,0)')(0.25), 'rgba(255,165,0,0.25)');
assert.equal(cssWithAlpha('rgba(1, 2, 3, 0.5)')(2), 'rgba(1,2,3,1)');
assert.equal(cssWithAlpha('red')(0.3), 'red');
});
test('the lines run a bounded time after a selection, then rest without frames', () => {
const h = harness();
h.ripples.show(target);
const [lane] = h.lanes;
const window = RIPPLE_ACTIVE_CYCLES * EARTHQUAKE_RIPPLE_PERIOD_MS;
assert.ok(window <= 15_000, 'about a quarter of a minute at most');
let frames = 0;
for (let t = 0; t < window * 3; t += 16) {
if (!h.frames.size) break;
lane.painter(h.frame());
h.advance(16);
h.step();
frames++;
}
assert.equal(h.frames.size, 0, 'no frame asked for once settled');
assert.ok(frames <= Math.ceil(window / 16) + 2, `bounded: ${frames} frames`);
// At rest the lines hold still as readable contours.
h.strokes.length = 0;
lane.painter(h.frame());
assert.equal(h.strokes.length, EARTHQUAKE_RIPPLE_RINGS);
assert.ok(h.strokes.every((stroke) => stroke.alpha === 0.7));
// A parked camera repainting the overlay does not start them again.
lane.painter(h.frame());
assert.equal(h.frames.size, 0);
// A new selection runs again.
h.ripples.show({ ...target, id: 'ak2' });
assert.equal(h.frames.size, 1);
h.ripples.dispose();
});
test('off screen the frames stop; back in view inside the window they resume', () => {
const h = harness();
h.ripples.show(target);
const [lane] = h.lanes;
// Behind the globe.
lane.painter(h.frame(false));
const paints = lane.paints;
h.step();
assert.equal(h.frames.size, 0, 'stopped while out of sight');
assert.equal(lane.paints, paints + 1, 'one last paint, then none');
h.step();
assert.equal(lane.paints, paints + 1);
// Panned away: the disc is far off the viewport.
h.ripples.show(target);
const away = h.frame();
away.viewProjectionMatrix[12] = 50;
lane.painter(away);
h.step();
assert.equal(h.frames.size, 0);
// The camera brings it back while the window lasts.
away.viewProjectionMatrix[12] = 0;
lane.painter(h.frame());
assert.equal(h.frames.size, 1, 'resumed');
h.ripples.dispose();
});
test('turning reduced motion on mid-run stills the lines and stops the frames', () => {
const h = harness();
h.ripples.show(target);
const [lane] = h.lanes;
lane.painter(h.frame());
h.setReducedMotion(true);
h.step();
assert.equal(h.frames.size, 0);
h.strokes.length = 0;
lane.painter(h.frame());
assert.ok(
h.strokes.every((stroke) => stroke.alpha === 0.7),
'still',
);
// Turned off again within the window: the next paint runs them again.
h.setReducedMotion(false);
lane.painter(h.frame());
assert.equal(h.frames.size, 1);
h.ripples.dispose();
});
test('a refresh of the same quake does not run a settled selection again', () => {
const h = harness();
h.ripples.show(target);
const [lane] = h.lanes;
h.advance(RIPPLE_ACTIVE_CYCLES * EARTHQUAKE_RIPPLE_PERIOD_MS + 1);
lane.painter(h.frame());
h.step();
assert.equal(h.frames.size, 0, 'settled');
h.ripples.show({ ...target, radiusM: 40000 }, { restart: false });
assert.equal(h.frames.size, 0, 'a refresh keeps it at rest');
lane.painter(h.frame());
assert.equal(h.frames.size, 0);
// A different quake, or a user's restart, runs again.
h.ripples.show({ ...target, id: 'other' }, { restart: false });
assert.equal(h.frames.size, 1);
h.ripples.dispose();
});
// The rings sit on the ground the disc is draped on. A label's fly-to starts
// far away, before that ground loads, so the painter reads the height again
// while it paints and moves the rings onto it.
test('the rings move onto the ground height once it loads', () => {
const h = harness();
let ground = null;
h.ripples.show({ ...target, heightM: 0, heightAt: () => ground });
h.advance(600);
const [lane] = h.lanes;
lane.painter(h.frame());
const atSea = h.fills.at(-1).transform;
h.fills.length = 0;
ground = 4000;
h.advance(600);
lane.painter(h.frame());
const onGround = h.fills.at(-1).transform;
assert.notDeepEqual(onGround, atSea, 'the centre moved up onto the ground');
// A change of a metre or less, or an impossible height, leaves them put.
for (const next of [4000.5, 25000, -2000]) {
ground = next;
h.advance(600);
lane.painter(h.frame());
assert.deepEqual(h.fills.at(-1).transform, onGround, String(next));
}
// Reads are bounded: a second paint within the interval does not ask again.
let reads = 0;
h.ripples.show({ ...target, id: 'ak2', heightAt: () => (reads++, 4000) });
lane.painter(h.frame());
lane.painter(h.frame());
assert.equal(reads, 1);
});
+45 -2
View File
@@ -1,6 +1,49 @@
import { createEarthquakesLayer } from '../../layers/earthquakes/index.js';
import { overlayHost } from './overlayHost.js';
/** Wire earthquake observations to the application overlay host. */
import { inputFor } from '../../input/dispatcher.js';
import * as picking from '../../data/pickRegistry.js';
import * as context from '../../data/contextStore.js';
import { isPointerFree } from '../../data/inputOwnership.js';
import { requestWorldFocus } from '../../worldFocus.js';
import { createEarthquakeRipples } from './earthquakeRipples.js';
import { heightsOf } from '../../queries/heights.js';
import { formatDate, formatNumber, t } from '../../i18n/index.js';
const EVENT_TIME = Object.freeze({
day: 'numeric',
month: 'short',
year: 'numeric',
hour: '2-digit',
minute: '2-digit',
timeZone: 'UTC',
timeZoneName: 'short',
});
/** The clicked quake's card text, in the page's language. */
export const earthquakeCardText = Object.freeze({
t,
formatTime: (time) => formatDate(time, EVENT_TIME),
formatDepth: (km) => formatNumber(km, { maximumFractionDigits: 1 }),
});
/**
* Wire earthquake observations to the application overlay host, and its
* discs to the globe's clicks: a clicked quake shows its detail card.
*/
export function createApplicationEarthquakes(options) {
return createEarthquakesLayer({ overlayHost, ...options });
return createEarthquakesLayer({
overlayHost,
input: (viewer) => inputFor(viewer),
picking,
context,
pointer: { isPointerFree },
openExternal: (url) => window.open(url, '_blank', 'noopener,noreferrer'),
focus: { requestWorldFocus },
ripples: createEarthquakeRipples(),
// The loaded ground (terrain or tiles) the clamped disc is draped on.
groundHeight: (viewer, lon, lat) =>
viewer ? heightsOf(viewer).now({ lon, lat }) : null,
text: earthquakeCardText,
...options,
});
}
+2 -1
View File
@@ -2,11 +2,12 @@ import { createRocketLaunchesLayer } from '../../layers/launches/index.js';
import * as geometry from '../../celestialRing.js';
import * as overlays from '../../overlays/worldOverlay.js';
import * as render from '../../renderGovernor.js';
import * as picking from '../../data/pickRegistry.js';
/** Construct one layer using the application scene owners and a supplied source. */
export function createApplicationLaunches({ source, satellites }) {
return createRocketLaunchesLayer({
source,
services: { satellites, geometry, overlays, render },
services: { satellites, geometry, overlays, render, picking },
});
}
+2
View File
@@ -1,9 +1,11 @@
import { createSubmarineCableLayer } from '../../layers/submarineCables/index.js';
import { overlayHost } from './overlayHost.js';
import * as picking from '../../data/pickRegistry.js';
/** Wire cable source geometry to the application overlay host. */
export function createApplicationCables(options) {
return createSubmarineCableLayer({
overlayHost,
picking,
mapStackEventTarget: typeof window !== 'undefined' ? window : null,
...options,
});
+3
View File
@@ -1,6 +1,7 @@
import { createApplicationOperations } from './operations.js';
import { registerDataCredits } from '../data/dataCredits.js';
import { mountCreditsView } from '../ui/creditsView.js';
import { trackCreditLineHeight } from '../ui/creditLineHeight.js';
import { MapStackController } from '../mapStackController.js';
import { mapEngineFor } from '../maps/engine.js';
import { initLogoGaze } from '../logoGaze.js';
@@ -173,6 +174,8 @@ export async function createApplicationScene({
// The credits, in the application's own line, unless the renderer shows
// them in a display of its own.
if (!hooks.ownCreditDisplay) defer(mountCreditsView(viewer));
// The HUD corners above the line clear it when it wraps.
defer(trackCreditLineHeight(document));
loaderStatus.textContent =
googleApiKey || googleTokens || cesiumToken
? t('Loading Google 3D Tiles...')
+7 -5
View File
@@ -403,10 +403,11 @@ test('vessel and fire layers announce valid clicks and never fly cameras', () =>
'vessel click',
);
ordered(vesselClick, [
'clickCard?.(event)',
'selectAndFocusVessel(carded)',
"isOwnedByOtherLayer('ais-live-vessels', pickedId)",
'_vesselOverlayHost.hitTest?.(',
'selectAndFocusVessel(record)',
], 'vessel sibling ownership');
], 'vessel card on top, then sibling ownership');
const vesselFocus = body(
vessels,
/function selectAndFocusVessel\(record\) \{([\s\S]*?)\n \}/,
@@ -419,8 +420,9 @@ test('vessel and fire layers announce valid clicks and never fly cameras', () =>
'fire click',
);
ordered(fireClick, [
'isOwnedByOtherLayer(id, pickedId)',
'overlayHost.hitTest?.(',
'clickCard?.(event)',
'selectAndFocusFire(carded)',
], 'fire sibling ownership');
'isOwnedByOtherLayer(id, pickedId)',
'clearFireSelection()',
], 'fire card on top, then sibling ownership');
});
+8 -6
View File
@@ -595,7 +595,7 @@ test('Cockpit Display portal retains both scroll owners across round trips', ()
const portal = CockpitDisplayPortal.toString();
assert.match(
portal,
/this\.standardScrollTop =\s*displayPanelScroller\(standardPanel\)\?\.scrollTop \|\| 0/,
/this\.standardScrollTop = standardPanel\?\.scrollTop \|\| 0/,
);
assert.match(
portal,
@@ -603,7 +603,7 @@ test('Cockpit Display portal retains both scroll owners across round trips', ()
);
assert.match(
portal,
/if \(!this\.active\)[\s\S]*?this\.standardScrollTop =\s*displayPanelScroller\(standardPanel\)\.scrollTop/,
/if \(!this\.active\)[\s\S]*?this\.standardScrollTop = standardPanel\.scrollTop/,
);
assert.match(
portal,
@@ -611,7 +611,7 @@ test('Cockpit Display portal retains both scroll owners across round trips', ()
);
assert.match(
portal,
/this\.cockpitPanel\.scrollTop = this\.cockpitScrollTop[\s\S]*?displayPanelScroller\(this\.standardPanel\)\.scrollTop =\s*this\.standardScrollTop/,
/this\.cockpitPanel\.scrollTop = this\.cockpitScrollTop[\s\S]*?this\.standardPanel\.scrollTop = this\.standardScrollTop/,
);
});
@@ -680,6 +680,7 @@ test('fresh Cockpit entry temporarily collapses map panels and exit restores the
'scene-panel',
'pp-toggles',
'global-context-panel',
'space-missions-panel',
'radio-panel',
]) {
assert.match(
@@ -1261,14 +1262,15 @@ test('Global Context uses its dedicated right rail without a duplicate Data Laye
);
assert.match(html, /id="global-context-panel"/);
assert.match(html, /id="global-context-flights-btn"/);
assert.match(html, /id="global-context-missions-btn"/);
assert.doesNotMatch(html, /id="global-context-missions-btn"/);
assert.match(html, /id="space-missions-panel"/);
});
test('Global Context standby describes both chooser modes', () => {
test('Global Context standby describes Contacts', () => {
const match = html.match(/<div id="context-mode-standby"[\s\S]*?<\/div>/);
assert.ok(match, 'Global Context standby is missing');
assert.match(match[0], /CONTACTS — nearest planes · vessels · sites/);
assert.match(match[0], /SPACE MISSIONS — launches &amp; orbital assets/);
assert.doesNotMatch(match[0], /SPACE MISSIONS/);
});
test('cockpit briefing cycle control keeps its state as the accessible name', () => {
+138
View File
@@ -31,6 +31,7 @@ import {
speedRulerStep,
speedRulerTicks,
} from './cockpitMath.js';
import { bandBesideMidpointObstacles } from './ui/panelRailGeometry.js';
test('cockpit presentation updates are throttled independently of camera frames', () => {
assert.equal(cockpitUiUpdateDue(1000, 0, 100), true);
@@ -286,6 +287,143 @@ test('HUD rail layout constrains an oversized panel to the safe corridor', () =>
assert.equal(layout.constrained, true);
});
test('HUD rail layout keeps a short window clear of an obstacle across its midpoint', () => {
// 480px window: midpoint 240. Each obstacle is neither wholly above nor
// wholly below the midpoint, and must still limit the band.
const above = resolveHudRailLayout({
viewportHeight: 480,
panelHeight: 120,
laneLeft: 20,
laneRight: 340,
baseTop: 40,
baseBottom: 460,
gap: 10,
obstacles: [{ left: 0, right: 400, top: 200, bottom: 300 }],
});
// Room above: 200 - 10 - 40 = 150; below: 460 - 310 = 150. A tie keeps the
// band above the obstacle.
assert.equal(above.safeTop, 40);
assert.equal(above.safeBottom, 190);
assert(above.top + Math.min(120, above.maxHeight) <= 190);
const below = resolveHudRailLayout({
viewportHeight: 480,
panelHeight: 120,
laneLeft: 20,
laneRight: 340,
baseTop: 40,
baseBottom: 460,
gap: 10,
obstacles: [{ left: 0, right: 400, top: 120, bottom: 260 }],
});
// Room above: 70; below: 190. The band goes under the obstacle.
assert.equal(below.safeTop, 270);
assert.equal(below.safeBottom, 460);
assert(below.top >= 270);
});
test('HUD rail layout leaves the band as it is when an obstacle across the midpoint leaves no room', () => {
const layout = resolveHudRailLayout({
viewportHeight: 480,
panelHeight: 120,
laneLeft: 20,
laneRight: 340,
baseTop: 100,
baseBottom: 400,
gap: 10,
obstacles: [{ left: 0, right: 400, top: 80, bottom: 420 }],
});
assert.equal(layout.safeTop, 100);
assert.equal(layout.safeBottom, 400);
});
test('HUD rail layout reads several obstacles across the midpoint the same in any order', () => {
const a = { left: 0, right: 400, top: 100, bottom: 260 };
const b = { left: 0, right: 400, top: 200, bottom: 470 };
const layoutWith = (obstacles) =>
resolveHudRailLayout({
viewportHeight: 480,
panelHeight: 120,
laneLeft: 20,
laneRight: 340,
baseTop: 40,
baseBottom: 460,
gap: 10,
obstacles,
});
// Together they cover 100 to 470: the only room is above, 40 to 90.
for (const layout of [layoutWith([a, b]), layoutWith([b, a])]) {
assert.equal(layout.safeTop, 40);
assert.equal(layout.safeBottom, 90);
assert.equal(layout.maxHeight, 50);
}
});
test('HUD rail layout counts obstacles beside those across the midpoint', () => {
const band = (obstacles) => {
const layout = resolveHudRailLayout({
viewportHeight: 480,
panelHeight: 120,
laneLeft: 20,
laneRight: 340,
baseTop: 40,
baseBottom: 460,
gap: 10,
obstacles: obstacles.map(([top, bottom]) => ({
left: 0,
right: 400,
top,
bottom,
})),
});
return [layout.safeTop, layout.safeBottom];
};
// One inside the span below the midpoint: 150px below the span, 50 above.
assert.deepEqual(band([[100, 300], [250, 280]]), [310, 460]);
// One touching the midpoint from below: 190px below, 100 above.
assert.deepEqual(band([[150, 260], [240, 250]]), [270, 460]);
// One inside the span above the midpoint: 150px above, 50 below.
assert.deepEqual(band([[200, 400], [210, 230]]), [40, 190]);
// A lower obstacle past the span limits the room below it: 100px between
// them against 70 above, and with a taller one only 60, so above.
assert.deepEqual(band([[120, 260], [380, 420]]), [270, 370]);
assert.deepEqual(band([[120, 260], [340, 420]]), [40, 110]);
// Neighbours exactly two gaps away leave no room between: one block, 100
// to 400, and a tie (50px a side) goes above.
assert.deepEqual(band([[100, 180], [200, 300], [320, 400]]), [40, 90]);
// A neighbour exactly two gaps below joins it too: 150 to 300, 100px
// above against 150 below.
assert.deepEqual(band([[150, 250], [270, 300]]), [310, 460]);
// A side under 8% of the window (38.4px) is no room: 30px above, none
// below, so the band stays as it is.
assert.deepEqual(band([[80, 455]]), [40, 460]);
// Exactly the minimum is enough.
const exact = bandBesideMidpointObstacles({
midpoint: 240,
top: 40,
bottom: 460,
obstacles: [{ top: 90, bottom: 465 }],
gap: 10,
minimum: 40,
});
assert.deepEqual([exact?.top, exact?.bottom], [40, 80]);
});
test('HUD rail layout keeps a band beside a midpoint obstacle inside its own edges', () => {
const layout = resolveHudRailLayout({
viewportHeight: 480,
panelHeight: 80,
laneLeft: 20,
laneRight: 340,
baseTop: 350,
baseBottom: 460,
gap: 10,
obstacles: [{ left: 0, right: 400, top: 100, bottom: 260 }],
});
assert.equal(layout.safeTop, 350);
assert.equal(layout.safeBottom, 460);
});
test('HUD rail layout can anchor controls to the start of the safe corridor', () => {
const layout = resolveHudRailLayout({
viewportHeight: 1000,
+1 -44
View File
@@ -17,11 +17,6 @@
* @param {number} [input.signalGap] Clearance above the briefing card.
* @param {number} [input.minTopFloor] Absolute ceiling for the strip, in px.
* @param {number} [input.minTopRatio] Viewport-relative ceiling, 0..1.
* @param {boolean} [input.signalCollapsed] Whether the briefing card is collapsed.
* @param {boolean} [input.utilityExpanded] Whether Display or Radio is expanded.
* @param {number} [input.bottomInset] Reserved viewport space below an expanded panel.
* @param {number} [input.signalHeight] Collapsed briefing header reserved below the utility.
* @param {boolean} [input.reserveViewportLane] Theme relocates the briefing below the expanded utility.
* @returns {{ top: number, maxHeight: number }}
*/
export function resolveCockpitUtilityAnchor({
@@ -34,29 +29,13 @@ export function resolveCockpitUtilityAnchor({
signalGap = 8,
minTopFloor = 96,
minTopRatio = 0.12,
signalCollapsed = false,
utilityExpanded = false,
bottomInset = 80,
signalHeight = 0,
reserveViewportLane = false,
}) {
const viewport = Math.max(0, Number(viewportHeight) || 0);
const minTop = Math.max(minTopFloor, viewport * minTopRatio);
const anchoredTop = Math.max(minTop, (Number(recBottom) || 0) + recGap);
const strip = Math.max(0, Number(stripHeight) || 0);
const signal = Number(signalTop);
const expandedLaneBottom = Math.max(
0,
viewport -
Math.max(0, Number(bottomInset) || 0) -
Math.max(0, Number(signalHeight) || 0),
);
const lowerBound =
reserveViewportLane && signalCollapsed && utilityExpanded
? expandedLaneBottom
: Number.isFinite(signal)
? signal
: viewport;
const lowerBound = Number.isFinite(signal) ? signal : viewport;
const clearedTop = lowerBound - signalGap - strip;
const top = Math.max(minTop, Math.min(anchoredTop, clearedTop));
const floor = Math.max(0, Number(collapsedHeight) || 0) || 50;
@@ -100,25 +79,3 @@ export function resolveCockpitUtilityLayout({
),
};
}
/** Shared Cyber panel slot, with footer controls above the lower frame (83vh). */
export function resolveCyberCockpitPanelLane({
viewportHeight,
top,
launcherHeight = 60,
signalHeight = 44,
contactHeight = 64,
}) {
const gap = 8;
const footerHeight = Math.max(
contactHeight + gap,
launcherHeight + signalHeight + gap * 2,
);
const bottom = viewportHeight * 0.82;
const panelHeight = Math.max(120, bottom - top - footerHeight);
return {
panelHeight,
utilityHeight: panelHeight + gap + launcherHeight,
signalTop: top + panelHeight + launcherHeight + gap * 2,
};
}
+1 -71
View File
@@ -4,58 +4,11 @@ import assert from 'node:assert/strict';
import {
resolveCockpitUtilityAnchor,
resolveCockpitUtilityLayout,
resolveCyberCockpitPanelLane,
} from './cockpitUtilityLayout.js';
// 1512x790, the height the strip used to collide with the briefing card at.
const desktop = { viewportHeight: 790, stripHeight: 107, collapsedHeight: 50 };
test('Cyber shared panel slot reserves both footer lanes above the decorative frame', () => {
for (const viewportHeight of [600, 673, 713, 986, 1376]) {
for (const signalHeight of [44, 76]) {
for (const contactHeight of [44, 84, 120]) {
const top = Math.max(164, Math.min(204, viewportHeight * 0.19));
const lane = resolveCyberCockpitPanelLane({ viewportHeight, top, signalHeight, contactHeight });
assert.ok(lane.panelHeight >= 120);
assert.ok(top + lane.panelHeight + 8 + contactHeight <= viewportHeight * 0.82 + .01);
assert.ok(lane.signalTop + signalHeight <= viewportHeight * 0.82 + .01);
assert.equal(lane.signalTop, top + lane.utilityHeight + 8);
}
}
}
});
test('Cyber keeps the Data Layers top while reserving briefing clearance', () => {
for (const viewportHeight of [673, 713, 986, 1376]) {
const leftTop = Math.max(164, Math.min(204, viewportHeight * 0.19));
const collapsed = resolveCockpitUtilityAnchor({
viewportHeight, stripHeight: 128, collapsedHeight: 60, recBottom: 0,
signalTop: leftTop + 128 + 28, minTopFloor: leftTop, minTopRatio: 0,
});
assert.equal(collapsed.top, leftTop);
assert.ok(collapsed.maxHeight >= 128);
const expanded = resolveCockpitUtilityAnchor({
viewportHeight, stripHeight: 700, collapsedHeight: 60, recBottom: 0,
signalTop: 255, minTopFloor: leftTop, minTopRatio: 0,
signalCollapsed: true, utilityExpanded: true, reserveViewportLane: true, signalHeight: 44,
});
assert.equal(expanded.top, leftTop);
assert.equal(expanded.top + expanded.maxHeight + 8 + 44 + 80, viewportHeight);
}
});
test('expanded utilities reserve the visible collapsed briefing header at every desktop height', () => {
for (const viewportHeight of [640, 720, 987, 1376]) {
for (const signalHeight of [48, 76, 100]) {
const { top, maxHeight } = resolveCockpitUtilityAnchor({
...desktop, viewportHeight, recBottom: 0, signalTop: 255,
signalCollapsed: true, utilityExpanded: true, signalHeight, reserveViewportLane: true,
});
assert.equal(top + maxHeight + 8, viewportHeight - 80 - signalHeight);
}
}
});
test('the strip hangs 12px under the REC readout when the briefing card leaves room', () => {
const { top } = resolveCockpitUtilityAnchor({ ...desktop, recBottom: 148.1, signalTop: 420 });
assert.equal(Number(top.toFixed(1)), 160.1);
@@ -101,34 +54,11 @@ test('a missing REC readout leaves the strip on the viewport ceiling', () => {
assert.equal(top, 96);
});
test('an expanded utility claims the vertical lane released by a collapsed briefing', () => {
const { top, maxHeight } = resolveCockpitUtilityAnchor({
...desktop,
recBottom: 148.1,
signalTop: 265.4,
signalCollapsed: true,
utilityExpanded: true,
reserveViewportLane: true,
});
assert.equal(Number(top.toFixed(1)), 160.1);
assert.equal(Number(maxHeight.toFixed(1)), 541.9);
});
test('non-relocating themes preserve the visible briefing boundary even when collapsed', () => {
test('the visible briefing card bounds the utility strip, collapsed or not', () => {
const { top, maxHeight } = resolveCockpitUtilityAnchor({
...desktop, recBottom: 148.1, signalTop: 265.4,
signalCollapsed: true, utilityExpanded: true,
});
assert.equal(Number((top + maxHeight).toFixed(1)), 257.4);
});
test('a collapsed briefing still bounds the utility strip until a panel expands', () => {
const { maxHeight } = resolveCockpitUtilityAnchor({
...desktop,
recBottom: 148.1,
signalTop: 265.4,
signalCollapsed: true,
});
assert.equal(Number(maxHeight.toFixed(1)), 107);
});
+19 -106
View File
@@ -1,5 +1,3 @@
import { msg } from './i18n/marker.js';
const CONTEXT_DEPENDENCIES = Object.freeze({
flights: new Set([
'military-awareness',
@@ -8,15 +6,18 @@ const CONTEXT_DEPENDENCIES = Object.freeze({
'ais-live-vessels',
'military-installations',
]),
'space-missions': new Set(['rocket-launches', 'satellites']),
});
const CONTEXT_COMPANIONS = new Set(['radio']);
/** The Space Missions refusal, with the blocked layer's name as {layer}. */
export const SPACE_MISSIONS_LAYER_BLOCK_REASON = msg(
'Space Missions isolates replay data. Exit the mode to enable {layer}.',
);
const [BLOCK_REASON_PREFIX, BLOCK_REASON_SUFFIX] =
SPACE_MISSIONS_LAYER_BLOCK_REASON.split('{layer}');
/**
* Layers Context never touches: Space Missions and the Satellites layer it
* depends on. Contacts neither switches them off on entry nor restores them
* on exit, so they run beside it in either order and keep their own state
* (the mission controller owns the Satellites dependency).
*/
export const CONTEXT_INDEPENDENT_LAYER_IDS = Object.freeze([
'rocket-launches',
'satellites',
]);
/** Return whether an origin represents a direct user choice on this route. */
export function isExplicitUserIntentOrigin(origin, layerId = null) {
return origin === 'user' || origin === 'voice';
@@ -27,7 +28,8 @@ export function recordContextRestoreExplicitChange({ restoreState, change }) {
if (
!restoreState?.enabledLayerIds ||
change?.type !== 'visibility' ||
!isExplicitUserIntentOrigin(change.origin, change.layerId)
!isExplicitUserIntentOrigin(change.origin, change.layerId) ||
CONTEXT_INDEPENDENT_LAYER_IDS.includes(change.layerId)
)
return false;
if (!restoreState.explicitLayerStates)
@@ -121,10 +123,7 @@ export async function settleUserFacingContextAction({
* one into `userAdded` makes exit restoration re-enable the mode layer the
* user just turned off.
*/
export const CONTEXT_ENTRY_LAYER_IDS = Object.freeze([
'military-awareness',
'rocket-launches',
]);
export const CONTEXT_ENTRY_LAYER_IDS = Object.freeze(['military-awareness']);
/**
* Leave a Context transaction: publish the settled coordination flag, then
@@ -193,7 +192,8 @@ export function shouldExitContextForLayerChange({
change?.type !== 'visibility' ||
!isExplicitUserIntentOrigin(change.origin, change.layerId) ||
change.layerId === 'military-awareness' ||
CONTEXT_COMPANIONS.has(change.layerId)
CONTEXT_COMPANIONS.has(change.layerId) ||
CONTEXT_INDEPENDENT_LAYER_IDS.includes(change.layerId)
) {
return false;
}
@@ -215,6 +215,7 @@ export function contextAllowedLayerIds(contextMode) {
return new Set([
...(CONTEXT_DEPENDENCIES[contextMode] || ['military-awareness']),
...CONTEXT_COMPANIONS,
...CONTEXT_INDEPENDENT_LAYER_IDS,
]);
}
@@ -235,21 +236,6 @@ export function shouldCaptureContextSession(change) {
);
}
/**
* Return whether one explicit mission intent superseded an in-flight Clear All
* reservation and therefore needs deferred Context adoption.
*/
export function shouldDeferContextEntryDuringClear({ change, clearInFlight }) {
return Boolean(
clearInFlight &&
change?.type === 'visibility-requested' &&
change.layerId === 'rocket-launches' &&
change.enabled === true &&
isExplicitUserIntentOrigin(change.origin, change.layerId) &&
Number.isInteger(change.intentEpoch),
);
}
/**
* Bookkeep a user-owned layer change against the active Context session so
* exit restoration can honor layers the user added mid-session. Two rules
@@ -273,7 +259,8 @@ export function recordContextSessionUserChange({
if (
!snapshot?.userAdded ||
change?.type !== 'visibility' ||
!isExplicitUserIntentOrigin(change.origin, change.layerId)
!isExplicitUserIntentOrigin(change.origin, change.layerId) ||
CONTEXT_INDEPENDENT_LAYER_IDS.includes(change.layerId)
) {
return false;
}
@@ -319,83 +306,10 @@ export function contextSnapshotLayerIds(
) {
const snapshot = new Set(restoringLayerIds || currentEnabledLayerIds || []);
for (const layerId of excludeLayerIds || []) snapshot.delete(layerId);
for (const layerId of CONTEXT_INDEPENDENT_LAYER_IDS) snapshot.delete(layerId);
return snapshot;
}
/**
* Block layers that would mix unrelated live/current data into Space Missions.
* The manager calls this before lifecycle work so a refused layer never starts.
* @param {object} input Current mode and requested visibility transition.
* @param {string|null} input.contextMode Active Context mode.
* @param {object|null} input.change Requested visibility transition.
* @param {string|null} [input.layerName] User-facing layer name.
* @returns {string|null} Honest user-facing refusal reason, or null when allowed.
*/
export function contextLayerEnableBlockReason({
contextMode,
change,
layerName = null,
}) {
if (
contextMode !== 'space-missions' ||
change?.enabled !== true ||
contextAllowedLayerIds('space-missions').has(change.layerId)
) {
return null;
}
const label = String(layerName || change.layerId || 'that layer');
return SPACE_MISSIONS_LAYER_BLOCK_REASON.replace('{layer}', label);
}
/**
* The layer name from a Space Missions refusal, so the UI can rebuild the
* sentence in its language.
* @param {string} reason
* @returns {{layer: string}|null} The blocked layer's name, or null when the
* reason is not a Space Missions refusal.
*/
export function parseContextLayerBlockReason(reason) {
if (
typeof reason !== 'string' ||
!reason.startsWith(BLOCK_REASON_PREFIX) ||
!reason.endsWith(BLOCK_REASON_SUFFIX) ||
reason.length <= BLOCK_REASON_PREFIX.length + BLOCK_REASON_SUFFIX.length
)
return null;
return {
layer: reason.slice(
BLOCK_REASON_PREFIX.length,
reason.length - BLOCK_REASON_SUFFIX.length,
),
};
}
/**
* Resolve who owns a cancelled direct Space Missions entry. A newer ON keeps
* the entry shell reserved for its replacement transaction; every other
* cancellation must roll back the isolated pre-entry session.
*
* @param {object} input Cancellation and current manager intent state.
* @param {object|null} input.change Manager visibility notification.
* @returns {'ignore'|'replacement'|'restore'} Cancellation disposition.
*/
export function spaceMissionEntryCancellationDisposition({ change }) {
if (
change?.type !== 'visibility-cancelled' ||
change.layerId !== 'rocket-launches' ||
change.enabled !== true
)
return 'ignore';
if (
change.cancellationReason === 'superseded' &&
Number.isInteger(change.successorIntentEpoch) &&
change.successorIntentEpoch > change.intentEpoch &&
change.successorEnabled === true
)
return 'replacement';
return 'restore';
}
/**
* Merge the pre-entry layer snapshot with layers the user enabled during the
* Context session so both survive restoration.
@@ -510,7 +424,6 @@ export function subjectEntryAllowed({
*/
export const CONTEXT_MODE_VOICE_NAMES = Object.freeze({
flights: 'contacts',
'space-missions': 'space-missions',
});
/**
+63 -111
View File
@@ -5,7 +5,6 @@ import {
orbitEntryAllowed,
cockpitEntryAllowed,
contextAllowedLayerIds,
contextLayerEnableBlockReason,
contextRestoreLayerIds,
isExplicitUserIntentOrigin,
mergeContextTransitionErrors,
@@ -17,9 +16,7 @@ import {
settleContextIntentReplay,
settleUserFacingContextAction,
shouldCaptureContextSession,
shouldDeferContextEntryDuringClear,
shouldExitContextForLayerChange,
spaceMissionEntryCancellationDisposition,
} from './contextModePolicy.js';
test('Context transition errors preserve primary identity and aggregate failed layers', () => {
@@ -119,11 +116,6 @@ test('user-enabled layers are additive and do not exit Context', () => {
globalContextEnabled: true,
change: userEnable('earthquakes'),
}), false);
assert.equal(shouldExitContextForLayerChange({
contextMode: 'space-missions',
globalContextEnabled: false,
change: userEnable('traffic'),
}), false);
assert.equal(shouldExitContextForLayerChange({
contextMode: null,
globalContextEnabled: true,
@@ -133,48 +125,16 @@ test('user-enabled layers are additive and do not exit Context', () => {
test('programmatic Context dependencies and direct mode setup remain allowed', () => {
assert.equal(shouldExitContextForLayerChange({
contextMode: 'space-missions',
contextMode: 'flights',
globalContextEnabled: true,
change: { ...userEnable('satellites'), origin: 'programmatic' },
change: { ...userEnable('military'), enabled: false, origin: 'programmatic' },
}), false);
});
test('Space Missions cancellation retains only a newer authoritative ON entry', () => {
const cancelledEntry = {
type: 'visibility-cancelled',
layerId: 'rocket-launches',
enabled: true,
intentEpoch: 8,
cancellationReason: 'superseded',
successorIntentEpoch: 9,
successorEnabled: true,
successorOrigin: 'programmatic',
};
assert.equal(spaceMissionEntryCancellationDisposition({
change: cancelledEntry,
}), 'replacement');
assert.equal(spaceMissionEntryCancellationDisposition({
change: { ...cancelledEntry, successorEnabled: false },
}), 'restore', 'a newer OFF releases the entry shell');
assert.equal(spaceMissionEntryCancellationDisposition({
change: {
...cancelledEntry,
cancellationReason: 'caller-abort',
successorIntentEpoch: undefined,
successorEnabled: undefined,
},
}), 'restore', 'caller abort at the same epoch restores the isolated session');
assert.equal(spaceMissionEntryCancellationDisposition({
change: { ...cancelledEntry, enabled: false },
currentIntentEpoch: 9,
effectivelyEnabled: true,
}), 'ignore');
});
test('only explicit user-owned shell enables capture a Context restoration snapshot', () => {
const userMissionEnable = {
type: 'visibility-requested',
layerId: 'rocket-launches',
layerId: 'military-awareness',
enabled: true,
origin: 'user',
};
@@ -186,40 +146,25 @@ test('only explicit user-owned shell enables capture a Context restoration snaps
assert.equal(shouldCaptureContextSession({ ...userMissionEnable, origin: 'context-restore' }), false);
assert.equal(shouldCaptureContextSession({ ...userMissionEnable, enabled: false }), false);
assert.equal(shouldCaptureContextSession({ ...userMissionEnable, layerId: 'satellites' }), false);
assert.equal(
shouldCaptureContextSession({ ...userMissionEnable, layerId: 'rocket-launches' }),
false,
'Space Missions is an ordinary layer, not a Context entry',
);
});
test('voice dependency OFF exits Space Missions like the equivalent UI action', () => {
test('voice dependency OFF exits Contacts like the equivalent UI action', () => {
assert.equal(shouldExitContextForLayerChange({
contextMode: 'space-missions',
contextMode: 'flights',
globalContextEnabled: false,
change: { type: 'visibility', layerId: 'satellites', enabled: false, origin: 'voice' },
change: { type: 'visibility', layerId: 'flights', enabled: false, origin: 'voice' },
}), true);
});
test('only a newer explicit mission request is deferred during Clear All', () => {
const change = {
type: 'visibility-requested',
layerId: 'rocket-launches',
enabled: true,
origin: 'voice',
intentEpoch: 12,
};
assert.equal(shouldDeferContextEntryDuringClear({ change, clearInFlight: true }), true);
assert.equal(shouldDeferContextEntryDuringClear({ change, clearInFlight: false }), false);
assert.equal(shouldDeferContextEntryDuringClear({
change: { ...change, origin: 'programmatic' },
clearInFlight: true,
}), false);
assert.equal(shouldDeferContextEntryDuringClear({
change: { ...change, enabled: false },
clearInFlight: true,
}), false);
});
test('a rapid re-entry snapshots the settled restore target, not partial manager state', () => {
assert.deepEqual(
[...contextSnapshotLayerIds(
new Set(['rocket-launches', 'earthquakes']),
new Set(['cctv', 'earthquakes']),
new Set(['flights', 'traffic']),
)],
['flights', 'traffic'],
@@ -230,31 +175,15 @@ test('a rapid re-entry snapshots the settled restore target, not partial manager
);
assert.deepEqual(
[...contextSnapshotLayerIds(
new Set(['rocket-launches', 'satellites']),
new Set(['military-awareness', 'cctv']),
null,
['rocket-launches'],
['military-awareness'],
)],
['satellites'],
['cctv'],
'the synchronous entry intent is not part of the pre-entry snapshot',
);
});
test('Space Missions blocks unrelated layer enables before replay data can mix', () => {
const change = { layerId: 'flights', enabled: true, origin: 'user' };
assert.match(
contextLayerEnableBlockReason({ contextMode: 'space-missions', change, layerName: 'Live Flights' }),
/Exit the mode to enable Live Flights/,
);
assert.equal(contextLayerEnableBlockReason({
contextMode: 'space-missions',
change: { ...change, layerId: 'satellites' },
}), null);
assert.equal(contextLayerEnableBlockReason({
contextMode: 'flights',
change,
}), null, 'live cockpit keeps additive user layers');
});
test('the Global Context shell and layers selected while Context is off remain allowed', () => {
assert.equal(shouldExitContextForLayerChange({
contextMode: null,
@@ -275,14 +204,38 @@ test('manually disabling a mode dependency exits that Context bundle', () => {
change: { ...userEnable('military'), enabled: false },
}), true);
assert.equal(shouldExitContextForLayerChange({
contextMode: 'space-missions',
contextMode: 'flights',
globalContextEnabled: false,
change: { ...userEnable('satellites'), enabled: false },
}), true);
}), false, 'Satellites is not a Contacts dependency');
});
test('Context never isolates, snapshots, restores or bookkeeps Space Missions and Satellites', () => {
for (const layerId of ['rocket-launches', 'satellites']) {
assert.equal(contextAllowedLayerIds('flights').has(layerId), true);
const snapshot = { userAdded: new Set(), userRemoved: new Set() };
for (const enabled of [true, false]) {
assert.equal(recordContextSessionUserChange({
snapshot,
change: { type: 'visibility', origin: 'user', layerId, enabled },
effectiveContextMode: 'flights',
}), false);
const restoreState = { enabledLayerIds: new Set() };
assert.equal(recordContextRestoreExplicitChange({
restoreState,
change: { type: 'visibility', origin: 'user', layerId, enabled },
}), false);
}
assert.equal(snapshot.userAdded.size + snapshot.userRemoved.size, 0);
}
assert.deepEqual(
[...contextSnapshotLayerIds(new Set(['rocket-launches', 'satellites', 'cctv']))],
['cctv'],
);
});
test('Radio remains an independent companion across Context transitions', () => {
for (const contextMode of ['flights', 'space-missions']) {
for (const contextMode of ['flights', null]) {
for (const enabled of [true, false]) {
assert.equal(shouldExitContextForLayerChange({
contextMode,
@@ -292,21 +245,17 @@ test('Radio remains an independent companion across Context transitions', () =>
}
assert.equal(contextAllowedLayerIds(contextMode).has('radio'), true);
}
assert.equal(contextLayerEnableBlockReason({
contextMode: 'space-missions',
change: { type: 'visibility', origin: 'user', layerId: 'radio', enabled: true },
layerName: 'Radio',
}), null);
});
test('each Context mode exposes only its shell and dependencies', () => {
assert.deepEqual(
[...contextAllowedLayerIds(null)],
['military-awareness', 'radio'],
['military-awareness', 'radio', 'rocket-launches', 'satellites'],
);
assert.deepEqual(
[...contextAllowedLayerIds('space-missions')],
['rocket-launches', 'satellites', 'radio'],
['military-awareness', 'radio', 'rocket-launches', 'satellites'],
'Space Missions is not a Context mode',
);
});
@@ -332,7 +281,7 @@ test('Context restoration honors an explicit companion disable', () => {
});
test('the latest explicit Radio state wins across a Context session', () => {
for (const effectiveContextMode of [null, 'flights', 'space-missions']) {
for (const effectiveContextMode of [null, 'flights']) {
for (const origin of ['user', 'voice']) {
const snapshot = { userAdded: new Set(), userRemoved: new Set() };
const record = (enabled) => recordContextSessionUserChange({
@@ -368,7 +317,7 @@ test('only direct UI and voice origins count as explicit Context intent', () =>
assert.equal(recordContextSessionUserChange({
snapshot,
change: { type: 'visibility', origin, layerId: 'radio', enabled: true },
effectiveContextMode: 'space-missions',
effectiveContextMode: 'flights',
}), false);
assert.equal(snapshot.userAdded.size, 0);
}
@@ -526,16 +475,8 @@ test('the teardown guard re-publishes on the way out, so a mid-flight exit is no
test('the session-starting entry layer is never bookkept as user-added (chip ON→OFF restores exactly)', () => {
const snapshot = { enabledLayerIds: new Set(['flights', 'ais-live-vessels']), userAdded: new Set() };
// The exact left-panel regression: the rockets enable event lands while the
// mode is still being entered (or even null); it must not survive its own exit.
for (const effectiveContextMode of ['space-missions', null]) {
recordContextSessionUserChange({
snapshot,
change: { type: 'visibility', layerId: 'rocket-launches', enabled: true, origin: 'user' },
effectiveContextMode,
});
assert.equal(snapshot.userAdded.has('rocket-launches'), false);
}
// The entry layer's enable event lands while the mode is still being
// entered; it must not survive its own exit.
recordContextSessionUserChange({
snapshot,
change: { type: 'visibility', layerId: 'military-awareness', enabled: true, origin: 'user' },
@@ -559,10 +500,21 @@ test('mid-session user additions are recorded, removed on disable, and judged ag
// A dependency of the mode being ENTERED is not a user addition.
recordContextSessionUserChange({
snapshot,
change: { type: 'visibility', layerId: 'satellites', enabled: true, origin: 'user' },
effectiveContextMode: 'space-missions',
change: { type: 'visibility', layerId: 'military', enabled: true, origin: 'user' },
effectiveContextMode: 'flights',
});
assert.equal(snapshot.userAdded.has('satellites'), false);
assert.equal(snapshot.userAdded.has('military'), false);
// Space Missions is not Context's: it is never bookkept.
recordContextSessionUserChange({
snapshot,
change: { type: 'visibility', layerId: 'rocket-launches', enabled: true, origin: 'user' },
effectiveContextMode: 'flights',
});
assert.equal(
snapshot.userAdded.has('rocket-launches'),
false,
'Space Missions is not Context state',
);
// Disabling a recorded addition removes it before any exit restore reads it.
recordContextSessionUserChange({
snapshot,
+38 -36
View File
@@ -13,10 +13,7 @@ const radioControlsSource = readRadioSource(new URL('./ui/radioControls.js', imp
// - session bookkeeping ran AFTER the exit early-return, so the compensating
// userAdded.delete never ran on the left-panel chip exit and restoration
// resurrected the mission layer the user just disabled;
// - the effective mode was read AFTER the entering flag was cleared, so the
// entry layer's own enable event was judged against a null mode;
// - a failed Space Missions START from the chip route cleared siblings with
// no rollback;
// - a failed direct Contacts START cleared siblings with no rollback;
// - the right-rail entry ignored the activation result entirely.
import { test } from 'node:test';
import assert from 'node:assert/strict';
@@ -33,25 +30,20 @@ test('context handler: session bookkeeping runs before the exit early-return', (
assert.ok(record < exit, 'bookkeeping must precede the exit check');
});
test('context handler: effective mode is read before the entering flag is cleared', () => {
const effective = handler.indexOf('this._contextModeEntering || this._contextMode');
const clear = handler.indexOf('this._contextModeEntering = null');
assert.ok(effective > 0, 'effective-mode read present');
assert.ok(clear > 0, 'entering-flag clear present');
assert.ok(effective < clear, 'effective mode must be captured first');
test('Space Missions is an ordinary layer the Context handler never enters', () => {
assert.doesNotMatch(handler, /'space-missions'/);
assert.doesNotMatch(handler, /_contextModeEntering = /);
const attach = connectContextManager.toString();
assert.doesNotMatch(attach, /rocket-launches|space-missions/);
});
test('cancelled Space Missions entry resolves ownership before settled bookkeeping', () => {
test('a cancelled visibility request returns before settled bookkeeping', () => {
const cancelled = handler.indexOf("change?.type === 'visibility-cancelled'");
const bookkeeping = handler.indexOf('recordContextSessionUserChange(');
assert.ok(cancelled > 0, 'cancellation branch present');
assert.ok(cancelled < bookkeeping, 'cancellation returns before settled session bookkeeping');
const branch = handler.slice(cancelled, handler.indexOf("change?.type === 'visibility-blocked'"));
assert.match(branch, /spaceMissionEntryCancellationDisposition\(\{/);
assert.match(branch, /cancellationDisposition === 'replacement'[\s\S]*?_contextModeEntering = 'space-missions'[\s\S]*?entryIntent\.intentEpoch === change\.intentEpoch[\s\S]*?_contextModeReplacementIntent = \{[\s\S]*?intentEpoch: change\.successorIntentEpoch/);
assert.match(branch, /cancellationDisposition === 'restore'[\s\S]*?_contextModeEntering = null/);
assert.match(branch, /_restoreContextSessionAfterLayerSettles\(/);
assert.match(branch, /return;/);
assert.match(branch, /this\._syncContextModeButtons\(\);\s*return;/);
});
test('direct Context entry captures on the synchronous request boundary', () => {
@@ -60,18 +52,29 @@ test('direct Context entry captures on the synchronous request boundary', () =>
attach,
/subscribeVisibilityRequests\(\(change\) => \{[\s\S]*?shouldCaptureContextSession\(change\)/,
);
assert.match(
attach,
/_captureContextSessionSnapshot\(\{\s*excludeLayerIds:\s*\[change\.layerId\],?\s*\}\)/,
);
});
test('Clear All defers a newer explicit mission guard until its batch settles', () => {
const attach = connectContextManager.toString();
assert.match(attach, /shouldDeferContextEntryDuringClear\(\{/);
assert.match(attach, /_contextModeDeferredEntryIntent = \{/);
assert.match(attach, /await this\._clearSelectedLayersManagerPromise/);
assert.match(attach, /await this\._clearLayersOutsideContextMode\(entryMode/);
test('only a direct Contacts entry request snapshots the layers', () => {
let request;
const controls = new ContextControls({
elements: {},
installations: {},
actions: { getCockpit: () => null },
});
const captures = [];
controls._captureContextSessionSnapshot = (options) => captures.push(options);
controls._syncContextModeButtons = () => {};
controls.connect({
subscribe: () => () => {},
subscribeVisibilityRequests(listener) {
request = listener;
return () => {};
},
});
for (const layerId of ['rocket-launches', 'military-awareness'])
request({ type: 'visibility-requested', layerId, enabled: true, origin: 'user', intentEpoch: 1 });
controls.stop();
assert.deepEqual(captures, [{ excludeLayerIds: ['military-awareness'] }]);
});
test('context restore replays explicit companion intent after the stale restore queue drains', () => {
@@ -91,7 +94,7 @@ test('context restore settles the Contacts coordinator before dependency fanout'
assert.ok(settle > 0, 'Contacts coordinator settlement is present');
assert.ok(coordinatorOff > settle, 'Contacts OFF is awaited');
assert.ok(fanout > coordinatorOff, 'snapshot fanout starts after Contacts settles');
assert.match(restore, /excludeLayerIds: settleContactsCoordinator[\s\S]*?contactsCoordinatorId/);
assert.match(restore, /excludeLayerIds: \[[\s\S]*?CONTEXT_INDEPENDENT_LAYER_IDS[\s\S]*?settleContactsCoordinator \? \[contactsCoordinatorId\]/);
});
test('Clear All during the Contacts settle stops the snapshot coming back', () => {
@@ -116,7 +119,7 @@ test('context handler: either failed direct Context-shell start rolls the sessio
handler.indexOf("change?.type === 'visibility-failed'"),
handler.indexOf("change?.type === 'visibility-will-change'"),
);
assert.match(failedBranch, /\['military-awareness', 'rocket-launches'\]\.includes\(change\.layerId\)/);
assert.match(failedBranch, /change\.layerId === 'military-awareness' &&/);
assert.match(
failedBranch,
/_restoreContextSessionAfterLayerSettles\(\s*change\.layerId,\s*\{\s*notificationToken,?\s*\},?\s*\)/,
@@ -154,14 +157,14 @@ test('wrapped visibility blocks leave the accessible toast to the wrapper token
test('every user-facing Context exit route settles through the failure surface', () => {
const initPanel = _initGlobalContextPanel.toString();
assert.equal((initPanel.match(/void this\._runUserFacingContextAction/g) || []).length, 3);
assert.equal((initPanel.match(/void this\._runUserFacingContextAction/g) || []).length, 2);
assert.doesNotMatch(initPanel, /falseIsFailure:\s*false/);
assert.doesNotMatch(initPanel, /void this\._selectContextMode/);
const deactivationCalls = [...handler.matchAll(
/void this\._trackContextLayerReaction\(\s*this\._runUserFacingContextAction\(\(notificationToken\) =>\s*this\._deactivateContextForLayerChange\(\{ notificationToken \}\),?\s*\),?\s*\)/g,
)];
assert.equal(deactivationCalls.length, 4, 'dependency and primary layer exits share the caught restore path');
assert.equal(deactivationCalls.length, 3, 'dependency and primary layer exits share the caught restore path');
assert.doesNotMatch(handler, /void this\._deactivateContextForLayerChange\(\)/);
});
@@ -193,10 +196,7 @@ test('right-rail context entry is transactional: activation result gates the mod
const failureBlock = select.slice(activation);
assert.match(failureBlock, /activated = await activationIntent\.promise/);
assert.match(failureBlock, /catch \(error\) \{\s*activationError = error;/);
assert.match(failureBlock, /_contextModeReplacementIntent\?\.generation === generation/);
assert.match(failureBlock, /await this\._dataManager\._waitForVisibilityIntent\?\.\(/);
assert.match(failureBlock, /outcome\?\.intentEpoch === replacementIntent\.intentEpoch[\s\S]*?outcome\.succeeded === true/);
assert.match(failureBlock, /outcome\?\.cancellationReason === 'superseded'[\s\S]*?outcome\.successorEnabled === true[\s\S]*?outcome\.successorIntentEpoch > replacementIntent\.intentEpoch/);
assert.match(failureBlock, /activationError\s*\|\|\s*activated === false\s*\|\|\s*!this\._dataManager\.isEnabled\(entryLayerId\)/);
assert.match(failureBlock, /cancelledAndSettled\s*=\s*terminalIntentOutcome\?\.succeeded === false/);
assert.match(failureBlock, /\['caller-abort', 'resource-abort', 'superseded'\]/);
@@ -216,9 +216,11 @@ test('Context entry awaits isolation and direct shell routes isolate in the visi
// rests on Context OFF; the honesty lives in the REPORT, not in a racy
// attempt to put the prior mode back (see the note above
// _restoreContextSessionAfterLayerSettles).
const capture = select.indexOf('this._captureContextSessionSnapshot(');
assert.ok(capture > 0, 'Context snapshot capture is missing');
const crossMode = select.slice(
select.indexOf('const crossModeSwitch = Boolean('),
select.indexOf('this._captureContextSessionSnapshot();'),
capture,
);
assert.ok(crossMode, 'cross-mode teardown block is missing');
assert.doesNotMatch(crossMode, /if \(signal\?\.aborted\)[\s\S]*?await this\._restoreContextSession/);
@@ -242,10 +244,10 @@ test('Context entry awaits isolation and direct shell routes isolate in the visi
assert.match(ContextControls.prototype.stop.toString(), /this\._contextModeGeneration\+\+/);
const guard = connectContextManager.toString();
assert.match(guard, /\['military-awareness', 'rocket-launches'\]\.includes\(change\.layerId\)/);
assert.match(guard, /change\.layerId !== 'military-awareness'/);
assert.match(guard, /const notificationToken\s*=\s*change\.notificationToken\s*\|\|\s*Symbol\('direct-context-shell-entry'\)/);
assert.match(guard, /this\._userFacingContextNotificationTokens\.add\(notificationToken\)/);
assert.match(guard, /await this\._clearLayersOutsideContextMode\(entryMode,\s*\{\s*notificationToken,?\s*\}\)/);
assert.match(guard, /await this\._clearLayersOutsideContextMode\(null,\s*\{\s*notificationToken,?\s*\}\)/);
assert.match(
guard,
/await this\._restoreContextSession\(\{\s*excludeLayerIds: \[change\.layerId\],\s*notificationToken,\s*\}\)/,
+40 -45
View File
@@ -2,7 +2,9 @@ import { renderApplicationHtml } from './testSupport/applicationHtml.mjs';
import { readStylesheet } from './testSupport/readStylesheet.mjs';
import { _selectContextMode } from './ui/contextTransactions.js';
import { _initGlobalContextPanel } from './ui/contextBindings.js';
import { ContextControls } from './ui/contextControls.js';
import { clearSelectedLayers } from './ui/contextActions.js';
import { PANEL_RAIL_ITEMS } from './ui/panelRailCatalog.js';
import { readFileSync as readRadioSource } from 'node:fs';
const radioBindings = readRadioSource(
new URL('./ui/radioBindings.js', import.meta.url),
@@ -21,43 +23,24 @@ const html = await renderApplicationHtml(
);
const css = readStylesheet(new URL('../style.css', import.meta.url));
test('Contacts and Space Missions both participate in the ordinary Tab sequence', () => {
for (const id of [
'global-context-flights-btn',
'global-context-missions-btn',
]) {
const button = html.match(
new RegExp(`<button id="${id}"[\\s\\S]*?</button>`),
);
assert.ok(button, `${id} is missing`);
assert.match(button[0], /role="tab"/);
assert.match(button[0], /tabindex="0"/);
}
// The view keeps both tabs' tabindex static and never disables them; the
// transition itself is covered over happy-dom in ui/contextPanel.test.mjs.
for (const id of [
'global-context-flights-btn',
'global-context-missions-btn',
]) {
const tag = contextView.match(new RegExp(`<button id="${id}"[^>]*>`))?.[0];
assert.ok(tag, `${id} is missing from the view`);
assert.doesNotMatch(tag, /:tabindex|:disabled|\sdisabled/);
}
test('Contacts stays in the keyboard sequence and Space Missions owns its rail item', () => {
const button = html.match(
/<button id="global-context-flights-btn"[\s\S]*?<\/button>/,
)?.[0];
assert.ok(button, 'Contacts control is missing');
assert.match(button, /role="tab"/);
assert.match(button, /tabindex="0"/);
const tag = contextView.match(/<button id="global-context-flights-btn"[^>]*>/)?.[0];
assert.ok(tag, 'Contacts control is missing from the view');
assert.doesNotMatch(tag, /:tabindex|:disabled|\sdisabled/);
assert.doesNotMatch(html, /id="global-context-missions-btn"/);
assert.match(html, /id="space-missions-panel"[^>]*data-panel-id="space-missions-panel"/);
assert.equal(PANEL_RAIL_ITEMS['space-missions-panel'].icon, 'rocket_launch');
});
test('Context activation and Clear All never native-disable tabs and guard repeated clicks', () => {
const init = _initGlobalContextPanel.toString();
const select = _selectContextMode.toString();
const clear = clearSelectedLayers.toString();
assert.equal(
(
init.match(
/if \(\s*this\.destroyed\s*\|\|\s*this\._contextModeChanging\s*\|\|\s*this\._clearSelectedLayersPromise\s*\)\s*return;/g,
) || []
).length,
2,
);
assert.doesNotMatch(
select,
/_globalContext(?:Flights|Missions)Btn\.disabled\s*=\s*true/,
@@ -68,17 +51,29 @@ test('Context activation and Clear All never native-disable tabs and guard repea
);
});
test('Context tablist retains Left, Right, Home, and End keyboard navigation', () => {
const initSource = _initGlobalContextPanel.toString();
assert.match(initSource, /event\.key === 'ArrowRight'/);
assert.match(initSource, /event\.key === 'ArrowLeft'/);
assert.match(initSource, /event\.key === 'Home'/);
assert.match(initSource, /event\.key === 'End'/);
assert.match(
initSource,
/contextTabs\[nextIndex\]\.focus\(\{ preventScroll: true \}\)/,
);
assert.match(initSource, /contextTabs\[nextIndex\]\.click\(\)/);
test('a Contacts click while Context is busy is ignored', () => {
const button = new EventTarget();
const controls = new ContextControls({
elements: { _globalContextFlightsBtn: button },
installations: {},
actions: { getCockpit: () => null, claimVisualAuthority() {} },
});
const runs = [];
controls._runUserFacingContextAction = (operation) => {
runs.push(operation);
return Promise.resolve(false);
};
const click = () => button.dispatchEvent(new Event('click'));
controls._contextModeChanging = true;
click();
controls._contextModeChanging = false;
controls._clearSelectedLayersPromise = Promise.resolve();
click();
assert.equal(runs.length, 0, 'a transition or Clear All in flight drops it');
controls._clearSelectedLayersPromise = null;
click();
assert.equal(runs.length, 1, 'an idle panel takes the click');
controls.stop();
});
test('Context tabs draw a visible keyboard-focus outline including active tabs', () => {
@@ -102,7 +97,6 @@ test('Context tabs draw a visible keyboard-focus outline including active tabs',
});
test('Context async action buttons remain focused while busy', () => {
const init = _initGlobalContextPanel.toString();
const radio = radioBindings.slice(
radioBindings.indexOf('const toggleRadio = async (trigger) => {'),
radioBindings.indexOf('this._storeToken = this.store?.connect?.('),
@@ -113,6 +107,7 @@ test('Context async action buttons remain focused while busy', () => {
);
const clear = clearSelectedLayers.toString();
const init = _initGlobalContextPanel.toString();
assert.match(init, /if \(this\._installationsSearchBusy\) return;/);
assert.doesNotMatch(init, /\.disabled\s*=\s*true/);
const search = contextView.match(
@@ -220,7 +215,7 @@ test('Context reads as one segmented control with legible type and no halo', ()
// open Context title legible; no Context-only rule dims it again.
assert.equal(
rule(
":root:not([data-ui-theme='cyber']) #global-context-panel:not(.collapsed) .panel-title",
":root #global-context-panel:not(.collapsed) .panel-title",
),
'',
);
+288 -38
View File
@@ -6,6 +6,12 @@ import test from 'node:test';
import { fileURLToPath } from 'node:url';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
// The Omnibar's desktop footer (src/ui/styles/omnibar-dock.css) is part of
// the cascade below like every other stylesheet; its rules carry the
// Omnibar scope, so they are modelled as a layout of their own.
const omnibarCss = readStylesheet(
path.join(ROOT, 'src/ui/styles/omnibar-dock.css'),
);
const css = readStylesheet(path.join(ROOT, 'style.css'));
/*
@@ -125,11 +131,56 @@ function specificity(selector) {
return [ids, classes, types];
}
/** Flatten style.css into rules carrying their raw media stack. */
/** Collapse whitespace and the padding inside brackets of a selector. */
const tidySelector = (part) =>
part
.replace(/\s+/g, ' ')
.trim()
.replace(/\(\s+/g, '(')
.replace(/\s+\)/g, ')');
/**
* A nested selector resolved against its parent rule's selectors, as CSS
* nesting does: `&` stands for the parent, and a selector without one is a
* descendant of it.
*/
function nestSelectors(parents, head) {
const own = splitTopLevel(head, ',').map(tidySelector).filter(Boolean);
if (!parents) return own;
return parents.flatMap((parent) =>
own.map((part) =>
part.includes('&') ? part.replaceAll('&', parent) : `${parent} ${part}`,
),
);
}
/**
* Flatten style.css into rules carrying their raw media stack. Nested style
* rules (CSS nesting) and media queries nested in a rule are resolved to
* full selectors, so a nested rule is modelled like any other.
*/
function flattenRules(source) {
const src = source.replace(/\/\*[\s\S]*?\*\//g, '');
const rules = [];
const mediaStack = [];
// Open blocks, innermost last: media queries and style rules.
const stack = [];
const mediaStack = () =>
stack.filter((frame) => frame.media).map((frame) => frame.media);
const parentRule = () =>
[...stack].reverse().find((frame) => frame.rule)?.rule || null;
const declare = (text) => {
const rule = parentRule();
const trimmed = text.trim();
if (!rule || !trimmed) return;
const colon = trimmed.indexOf(':');
if (colon < 0) return;
const value = trimmed.slice(colon + 1).trim();
rule.decls.push({
prop: trimmed.slice(0, colon).trim().toLowerCase(),
value: value.replace(/\s*!important$/i, '').trim(),
important: /!important\s*$/i.test(value),
});
};
let index = 0;
let prelude = '';
while (index < src.length) {
@@ -137,14 +188,13 @@ function flattenRules(source) {
if (char === '{') {
const head = prelude.replace(/\s+/g, ' ').trim();
prelude = '';
index += 1;
if (head.startsWith('@media')) {
mediaStack.push(head.slice('@media'.length).trim());
index += 1;
stack.push({ media: head.slice('@media'.length).trim() });
continue;
}
if (head.startsWith('@')) {
let level = 1;
index += 1;
while (index < src.length && level > 0) {
if (src[index] === '{') level += 1;
else if (src[index] === '}') level -= 1;
@@ -152,43 +202,34 @@ function flattenRules(source) {
}
continue;
}
const close = src.indexOf('}', index);
assert.ok(close > index, `unterminated rule block for "${head}"`);
const decls = [];
for (const raw of src.slice(index + 1, close).split(';')) {
const text = raw.trim();
if (!text) continue;
const colon = text.indexOf(':');
if (colon < 0) continue;
const value = text.slice(colon + 1).trim();
decls.push({
prop: text.slice(0, colon).trim().toLowerCase(),
value: value.replace(/\s*!important$/i, '').trim(),
important: /!important\s*$/i.test(value),
});
}
rules.push({
const rule = {
order: rules.length,
media: [...mediaStack],
parts: splitTopLevel(head, ',')
.map((part) =>
part.trim().replace(/\(\s+/g, '(').replace(/\s+\)/g, ')'),
)
.filter(Boolean),
decls,
});
index = close + 1;
media: mediaStack(),
parts: nestSelectors(parentRule()?.parts, head),
decls: [],
};
rules.push(rule);
stack.push({ rule });
continue;
}
if (char === ';') {
declare(prelude);
prelude = '';
index += 1;
continue;
}
if (char === '}') {
mediaStack.pop();
// The last declaration of a block may omit its semicolon.
declare(prelude);
prelude = '';
stack.pop();
index += 1;
continue;
}
prelude += char;
index += 1;
}
assert.equal(stack.length, 0, 'unbalanced braces in style.css');
return rules;
}
@@ -227,6 +268,29 @@ const RECOGNIZED = new Set([
]);
const DOCKED_RAIL = 'body.context-docked #right-context-rail';
// The desktop Omnibar layout: the scope its stylesheet nests every rule in.
// It applies on the desktop shell (above the 720px phone breakpoint) while
// the Omnibar and the voice control share the dock; outside it the legacy
// layout below governs.
const OMNIBAR_SCOPE =
'body:not(.mobile-shell):not(.cockpit-mode):not(.scene-playback-mode):not(.ui-clean-view):not(.recording-mode):where(:has(#gev-omnibar):has(#command-dock > #gev-voice-control))';
const OMNIBAR = Object.freeze({
dock: `${OMNIBAR_SCOPE} #command-dock`,
credit: `${OMNIBAR_SCOPE} :is(#cesium-credits, #gev-credits)`,
minimalCredit: `${OMNIBAR_SCOPE}:has(#intel-hud[data-variant='minimal'].active) :is(#cesium-credits, #gev-credits)`,
minimalRail: `${OMNIBAR_SCOPE}:not(.context-docked):has(#intel-hud[data-variant='minimal'].active) #right-context-rail`,
trays: `${OMNIBAR_SCOPE} #command-dock > :is(#location-bar, #control-panel)`,
});
// What each Omnibar-scope rule may set on a modelled box; the Omnibar
// clearance test resolves every one of them through the full cascade.
const OMNIBAR_RECOGNIZED = new Map([
[OMNIBAR.dock, new Set(['top', 'bottom', 'height', 'min-height'])],
[OMNIBAR.credit, new Set(['bottom'])],
[OMNIBAR.minimalCredit, new Set(['bottom'])],
[OMNIBAR.minimalRail, new Set(['max-height'])],
]);
const OMNIBAR_MIN_WIDTH = 721;
const ELEMENT_KEYS = [
'#cesium-credits',
'#command-dock',
@@ -300,8 +364,11 @@ function ownBoxEntries() {
// So is Stories, with GEV's chrome stepped aside; storiesCredit.test.mjs
// pins its attribution placement.
if (
/^body\.stories-mode:not\(#gs-a\):not\(#gs-b\) #(cesium|gev)-credits$/.test(part)
) continue;
/^body\.stories-mode:not\(#gs-a\):not\(#gs-b\) #(cesium|gev)-credits$/.test(
part,
)
)
continue;
entries.push({ rule, part });
}
}
@@ -372,12 +439,21 @@ function resolve(candidates, prop, width, label) {
/** Evaluate a length. Anything the model cannot resolve exactly fails loudly. */
function toPx(value, viewportHeight, where) {
const trimmed = value.trim();
// The larger of its lengths, each resolved the same way.
if (/^max\(.*\)$/.test(trimmed))
return Math.max(
...splitTopLevel(trimmed.slice(4, -1), ',').map((part) =>
toPx(part, viewportHeight, where),
),
);
const inner = /^calc\(/.test(trimmed) ? trimmed.slice(5, -1) : trimmed;
assert.doesNotMatch(
inner,
/\bcalc\(/,
`nested calc() in ${where}: "${value}"`,
);
// A calc() is a whole term of its own, resolved below; nowhere else.
for (const term of splitTopLevel(inner, '+'))
assert.doesNotMatch(
term.trim().replace(/^calc\(.*\)$/, ''),
/\bcalc\(/,
`nested calc() in ${where}: "${value}"`,
);
assert.doesNotMatch(
inner,
/\b(min|max|clamp|env|attr|round|mod)\(/,
@@ -398,6 +474,18 @@ function toPx(value, viewportHeight, where) {
const term = raw.trim();
if (!term) continue;
if (term === '100%') continue; // the tray's own panel height, added separately
// A calc() of its own, as a term ("calc(var(--omnibar-credits-clear) +
// 2px)" once substituted).
if (/^calc\(.*\)$/.test(term)) {
total += toPx(term, viewportHeight, where);
continue;
}
// The credit line's own height (src/ui/creditLineHeight.js), at the
// height this pin models it at.
if (/^var\(--credit-line-height\b/.test(term)) {
total += CREDIT_HEIGHT_PX;
continue;
}
if (term.startsWith('var(')) {
const name = term.slice(4, term.lastIndexOf(')')).split(',')[0].trim();
assert.ok(
@@ -521,6 +609,22 @@ test('the model refuses every cascade construct it cannot resolve', () => {
// Expanded Context covers the right edge top to bottom; the credit row
// stops short of it instead (the docked-Context test below).
if (part === DOCKED_RAIL) continue;
if (part.startsWith(OMNIBAR_SCOPE)) {
const allowed = OMNIBAR_RECOGNIZED.get(part);
for (const decl of guarded) {
if (!allowed?.has(decl.prop))
complaints.push(
`unrecognized Omnibar rule positions a modelled element: "${part}" (${decl.prop})`,
);
if (decl.important)
complaints.push(`!important on ${decl.prop} of "${part}"`);
}
if (rule.media.length)
complaints.push(
`media query on Omnibar rule "${part}": ${rule.media.join(' && ')}`,
);
continue;
}
if (!RECOGNIZED.has(part)) {
complaints.push(
`unrecognized selector positions a modelled element: "${part}" (${guarded.map((d) => d.prop).join(', ')})`,
@@ -771,6 +875,152 @@ test('right rail measurement cannot persist into a painted attribution layout',
// ── Clearance ───────────────────────────────────────────────────────────────
/** A custom property's value as the Omnibar scope declares it. */
function omnibarVar(name) {
const decls = RULES.filter((rule) => rule.parts.includes(OMNIBAR_SCOPE))
.flatMap((rule) => rule.decls)
.filter((decl) => decl.prop === name);
assert.equal(
decls.length,
1,
`${name} is declared once in the Omnibar scope`,
);
return decls[0].value;
}
/** A length in the Omnibar layout, with its scope's own custom properties. */
function omnibarPx(value, viewportHeight, where) {
// The scope's properties may name each other ("--omnibar-dock-bottom"
// clears "--omnibar-credits-clear"): substitute until none is left.
let substituted = value;
for (let pass = 0; /var\(--omnibar-/.test(substituted); pass += 1) {
assert.ok(
pass < 8,
`Omnibar properties name each other in a loop: ${value}`,
);
substituted = substituted.replace(/var\((--omnibar-[\w-]+)\)/g, (_, name) =>
omnibarVar(name),
);
}
return toPx(substituted, viewportHeight, where);
}
test('Omnibar reserves a non-overlapping desktop footer at native credit sizing', () => {
// The Omnibar layout resolves through the same cascade as the legacy one:
// every legacy rule that could still match competes with the scope's.
const trayOpen = [
'#command-dock:has(#location-bar:not(.collapsed))',
'#command-dock:has(#control-panel:not(.collapsed))',
];
assert.equal(
omnibarVar('--world-timeline-lift'),
'0px',
'the Omnibar layout holds the timeline lift at 0',
);
for (const width of WIDTHS.filter((w) => w >= OMNIBAR_MIN_WIDTH)) {
for (const height of HEIGHTS) {
for (const minimal of [false, true]) {
const dock = resolve(
['#command-dock', ...trayOpen, OMNIBAR.dock],
'bottom',
width,
'Omnibar dock',
);
assert.equal(
dock.part,
OMNIBAR.dock,
`the Omnibar owns the dock at ${width}px`,
);
// Its top and height too: a legacy top or height winning here would
// move or stretch the dock the clearance below is measured from.
for (const [prop, value] of [
['top', 'auto'],
['height', '56px'],
]) {
const own = resolve(
['#command-dock', ...trayOpen, OMNIBAR.dock],
prop,
width,
`Omnibar dock ${prop}`,
);
assert.equal(
own.part,
OMNIBAR.dock,
`the Omnibar owns the dock ${prop} at ${width}px`,
);
assert.equal(
own.decl.value,
value,
`Omnibar dock ${prop} at ${width}px`,
);
}
const credit = resolve(
[
...CREDIT_SELECTORS,
OMNIBAR.credit,
...(minimal ? [MINIMAL_HUD_CREDIT, OMNIBAR.minimalCredit] : []),
],
'bottom',
width,
'Omnibar credit',
);
assert.ok(
credit.part.startsWith(OMNIBAR_SCOPE),
`the Omnibar owns the credit row at ${width}px`,
);
const dockBottom = omnibarPx(
dock.decl.value,
height,
'Omnibar dock bottom',
);
const creditTop =
omnibarPx(credit.decl.value, height, 'Omnibar credit bottom') +
CREDIT_HEIGHT_PX;
assert.ok(
dockBottom - creditTop >= MIN_CLEARANCE_PX,
`at ${width}x${height}${minimal ? ' (minimal HUD)' : ''} the Omnibar dock (${dockBottom}px) must clear the credit line (${creditTop}px)`,
);
}
}
}
// No legacy tray opens over the credit: both are hidden in this layout,
// and no rule elsewhere forces them back.
const trays = RULES.find((rule) => rule.parts.includes(OMNIBAR.trays));
assert.ok(trays, 'the Omnibar layout hides the legacy trays');
assert.equal(
trays.decls.find((decl) => decl.prop === 'display')?.value,
'none',
);
for (const rule of RULES) {
for (const part of rule.parts) {
if (!/#(location-bar|control-panel)$/.test(lastCompound(part))) continue;
assert.ok(
!rule.decls.some((decl) => decl.prop === 'display' && decl.important),
`"${part}" forces a hidden tray back with !important`,
);
}
}
// The minimal-HUD rail cap only shortens the rail, which is anchored at
// its top, so it can only add room above the credit.
const rail = RULES.find((rule) => rule.parts.includes(OMNIBAR.minimalRail));
const cap = rail.decls.find(
(decl) => decl.prop === '--omnibar-minimal-rail-height',
);
assert.match(
cap?.value || '',
/^min\(\s*var\(--right-stack-max-height, 70vh\),/,
);
assert.equal(
rail.decls.find((decl) => decl.prop === 'max-height')?.value,
'var(--omnibar-minimal-rail-height)',
);
assert.doesNotMatch(
omnibarCss,
/\.cesium-widget-credits|\.cesium-credit-logoContainer|\.cesium-credit-textContainer/,
'the footer uses the original credit text and logo sizing',
);
});
test('every open dock tray clears the required credit at every modelled viewport', () => {
// Below 900px the tray widens to nearly the viewport and lands on the
// bottom-left corner where the credit lives. The clearance is NOT one fixed
+8 -6
View File
@@ -527,10 +527,15 @@ export function cyberSonarLabelIntensity(
return labelDimFactor + (1 - labelDimFactor) * normalized;
}
/**
* Sonar is an opt-in visual style over any HUD layout: it is on only after
* the Display panel's Sonar toggle, a voice request or a legacy Cyber link
* turns it on.
*/
export function isCyberSonarEnabled(
root = globalThis.document?.documentElement,
) {
return root?.dataset?.cyberSonar !== 'off';
return root?.dataset?.cyberSonar === 'on';
}
export function setCyberSonarEnabled(
@@ -539,9 +544,7 @@ export function setCyberSonarEnabled(
) {
if (!root?.dataset) return false;
root.dataset.cyberSonar = enabled ? 'on' : 'off';
if (root.dataset.uiTheme === 'cyber') {
applyCyberSonarThemePhase(root, enabled);
}
applyCyberSonarThemePhase(root, enabled);
return enabled;
}
@@ -566,7 +569,6 @@ export function isCyberSonarActive({
globalThis.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches ??
false;
return !!(
root?.dataset?.uiTheme === 'cyber' &&
isCyberSonarEnabled(root) &&
(hudActive ?? hud?.classList?.contains?.('active')) &&
!body?.classList?.contains?.('cockpit-mode') &&
@@ -583,7 +585,7 @@ export function isCyberMapThemeActive({
if (hud === undefined)
hud = globalThis.document?.getElementById?.('intel-hud');
return !!(
root?.dataset?.uiTheme === 'cyber' &&
isCyberSonarEnabled(root) &&
(hudActive ?? hud?.classList?.contains?.('active')) &&
!body?.classList?.contains?.('cockpit-mode')
);
+13 -9
View File
@@ -39,7 +39,7 @@ test('production-transformed sonar defaults retain the document method receiver'
const previous = Object.getOwnPropertyDescriptor(globalThis, 'document');
const hud = { classList: { contains: (name) => name === 'active' } };
const document = {
documentElement: { dataset: { uiTheme: 'cyber' } },
documentElement: { dataset: { cyberSonar: 'on' } },
body: { classList: { contains: () => false } },
getElementById(id) {
assert.equal(this, document);
@@ -57,7 +57,7 @@ test('production-transformed sonar defaults retain the document method receiver'
assert.ok(
Number.isFinite(compiled.createCyberSonarSampler(800, 600).at(400, 300)),
);
document.documentElement.dataset.uiTheme = 'tactical';
document.documentElement.dataset.cyberSonar = 'off';
assert.equal(compiled.isCyberSonarActive(), false);
assert.equal(compiled.isCyberMapThemeActive(), false);
} finally {
@@ -139,8 +139,8 @@ test('the sweep brightens contacts inside its sector and dims the remainder', ()
);
});
test('the sonar activates only for a visible Cyber map HUD with motion enabled', () => {
const root = { dataset: { uiTheme: 'cyber' } };
test('the sonar activates only while on, over a visible map HUD with motion enabled', () => {
const root = { dataset: { cyberSonar: 'on' } };
const classes = (...values) => ({
contains: (value) => values.includes(value),
});
@@ -220,14 +220,18 @@ test('the opacity setting controls every contact floor and preserves brighter la
);
});
test('the sonar control defaults on and records explicit operator state', () => {
test('the sonar control defaults off and records explicit operator state', () => {
const root = { dataset: {} };
assert.equal(isCyberSonarEnabled(root), false);
// The removed Cyber theme no longer turns it on.
root.dataset.uiTheme = 'cyber';
assert.equal(isCyberSonarEnabled(root), false);
assert.equal(setCyberSonarEnabled(true, root), true);
assert.equal(root.dataset.cyberSonar, 'on');
assert.equal(isCyberSonarEnabled(root), true);
assert.equal(setCyberSonarEnabled(false, root), false);
assert.equal(root.dataset.cyberSonar, 'off');
assert.equal(isCyberSonarEnabled(root), false);
assert.equal(setCyberSonarEnabled(true, root), true);
assert.equal(root.dataset.cyberSonar, 'on');
});
test('real Cesium points and billboards recover after repeated low/high opacity cycles', () => {
@@ -349,10 +353,10 @@ test('the sweep corrects delayed starts and reacquires restarted animations with
assert.doesNotThrow(() => syncCyberSonarAnimation({}));
});
test('the selected Cyber theme seeds and releases the compositor sweep phase', () => {
test('turning Sonar on seeds and releases the compositor sweep phase', () => {
const values = new Map();
const root = {
dataset: {},
dataset: { cyberSonar: 'on' },
style: {
setProperty: (name, value) => values.set(name, value),
removeProperty: (name) => values.delete(name),
+27 -16
View File
@@ -45,7 +45,7 @@ test('frame sampler matches reference without per-contact settings access', () =
});
test('removed CSS mode cannot disable GPU contacts; unsupported renderers fail closed', () => {
const root = { dataset: { uiTheme: 'cyber' }, style: { setProperty() {} } };
const root = { dataset: { cyberSonar: 'on' }, style: { setProperty() {} } };
const options = {
root,
body: { classList: { contains: () => false } },
@@ -97,7 +97,7 @@ function fixture({ modulation = true, lists = true } = {}) {
document: globalThis.document,
matchMedia: globalThis.matchMedia,
};
const root = { dataset: { uiTheme: 'cyber', cyberSonar: 'on' } };
const root = { dataset: { cyberSonar: 'on' } };
const status = { textContent: '' };
const state = { cockpit: false, reducedMotion: false };
globalThis.document = {
@@ -232,36 +232,47 @@ test('the sweep sets its sector on drawing ticks and at the cadence, and changes
f.tick(false);
assert.equal(f.sets.length, 4, 'a resize sets it at once');
assert.deepEqual(f.sets[3].center, { x: 300, y: 400 });
f.root.dataset.cyberSonar = 'off';
f.root.dataset.cyberSonarOpacity = '50';
f.tick(false);
assert.equal(f.sets[4].radius, 0, 'Sonar OFF rests every contact');
assert.equal(f.sets.length, 5, 'a setting change sets it at once');
assert.equal(
f.sets[4].floor,
0.5,
'while sweeping the floor is the opacity',
);
f.state.reducedMotion = true;
f.tick(false);
assert.equal(f.sets[5].radius, 0, 'reduced motion rests the sweep');
assert.equal(f.sets[5].floor, 0.5 + 0.5 * 0.46, 'at rest it lifts');
clock += 1000;
f.tick(true);
f.tick(false);
assert.equal(f.sets.length, 5, 'at rest only changes set it');
f.root.dataset.cyberSonarOpacity = '50';
f.tick(false);
assert.equal(f.sets.length, 6);
assert.equal(f.sets[5].floor, 0.5 + 0.5 * 0.46);
assert.equal(f.sets.length, 6, 'at rest only changes set it');
f.state.reducedMotion = false;
f.state.cockpit = true;
f.tick(false);
assert.equal(f.sets[6], null, 'out of the map theme it clears');
assert.equal(f.sets[6], null, 'out of the map it clears');
f.tick(true);
assert.equal(f.sets.length, 7, 'cleared once');
f.state.cockpit = false;
f.root.dataset.cyberSonar = 'off';
f.tick(false);
assert.equal(f.sets.length, 7, 'Sonar OFF leaves contacts untreated');
f.root.dataset.cyberSonar = 'on';
f.state.reducedMotion = true;
f.tick(false);
assert.equal(f.sets[7].radius, 0, 'reduced motion rests the sweep');
f.state.reducedMotion = false;
f.root.dataset.uiTheme = 'tactical';
assert.ok(f.sets[7]?.radius > 0, 'Sonar ON sweeps at once');
f.root.dataset.cyberSonar = 'off';
f.tick(false);
assert.equal(f.sets[8], null, 'another HUD style clears it');
assert.equal(f.sets[8], null, 'Sonar OFF clears it');
f.tick(true);
assert.equal(f.sets.length, 9);
// The removed Cyber theme attribute alone does nothing.
f.root.dataset.uiTheme = 'cyber';
f.tick(false);
assert.ok(f.sets[9]?.radius > 0, 'back in Cyber it sweeps at once');
assert.equal(f.sets.length, 9);
f.root.dataset.cyberSonar = 'on';
f.tick(false);
assert.ok(f.sets[9]?.radius > 0, 'back on, it sweeps at once');
assert.deepEqual(f.requests, [], 'the scene itself never asks for frames');
dispose();
assert.equal(f.sets[10], null, 'disposal clears it');
+176 -31
View File
@@ -32,7 +32,12 @@ import aisLiveVesselsLayer from './aisLiveVessels.js';
import { registerEntityContext, selectEntityContext } from './contextStore.js';
import { WORLD_FOCUS_REQUEST_EVENT } from '../worldFocus.js';
import { ensureGeoidReady, geoidHeight } from './geoid.js';
import { registerPickOwner, unregisterPickOwner } from './pickRegistry.js';
import {
isUnderOtherCard,
registerPickOwner,
setClickCardHitTest,
unregisterPickOwner,
} from './pickRegistry.js';
import { applyVesselOverlayPolicy } from './vesselLabels.js';
import { fakeInput } from '../input/testDoubles.mjs';
import { layerFeedState } from './manager.js';
@@ -490,7 +495,7 @@ test('first accepted position ends grace and warm data survives later open silen
const clock = makeFakeAisRuntime(7000);
const record = makeRecord();
_setAisRuntimeForTest(clock.runtime);
_setVesselOverlayHostForTest({
useVesselHost({
setEntries() {},
setVisible() {},
clearSource() {},
@@ -540,7 +545,7 @@ test('first accepted position ends grace and warm data survives later open silen
assert.equal(feed.error, 'awaiting usable AIS positions…');
} finally {
_setVesselStateForTest({ enabled: false });
_setVesselOverlayHostForTest();
useVesselHost();
_setAisRuntimeForTest();
}
});
@@ -1012,7 +1017,12 @@ function makeCesiumEvent() {
};
}
function installWireHarness(picked, stateOverrides = {}) {
function installWireHarness(
picked,
stateOverrides = {},
sceneExtras = {},
firstClick = null,
) {
const hadWindow = Object.hasOwn(globalThis, 'window');
const hadDocument = Object.hasOwn(globalThis, 'document');
const priorWindow = globalThis.window;
@@ -1038,9 +1048,11 @@ function installWireHarness(picked, stateOverrides = {}) {
},
};
const viewer = {
scene: { pick: () => picked },
scene: { pick: () => picked, ...sceneExtras },
};
const input = fakeInput(viewer);
// A subscriber that runs before the layer's own (an aircraft layer).
if (firstClick) input.input.onClick(firstClick);
// The camera port other layers follow through, with no pose to read; its
// followChanged event counts who listens.
const followChanged = makeCesiumEvent();
@@ -1666,7 +1678,7 @@ test('vessel host publication preserves the shipped grid winner and separation s
},
},
});
_setVesselOverlayHostForTest({
useVesselHost({
setEntries(sourceId, entries, options) {
publications.push({ sourceId, entries, options });
},
@@ -1690,7 +1702,7 @@ test('vessel host publication preserves the shipped grid winner and separation s
} finally {
unbind();
_setVesselStateForTest({ enabled: false });
_setVesselOverlayHostForTest();
useVesselHost();
}
});
@@ -1717,7 +1729,7 @@ test('vessel real layer lifecycle publishes protected selection and leaves no st
globalThis.window.addEventListener('gev:world-request-focus', (event) => {
focusRequests.push(event.detail);
});
_setVesselOverlayHostForTest(host);
useVesselHost(host);
_setVesselStateForTest({
viewer: {
get canvas() {
@@ -1766,7 +1778,7 @@ test('vessel real layer lifecycle publishes protected selection and leaves no st
);
} finally {
_setVesselStateForTest({ enabled: false });
_setVesselOverlayHostForTest();
useVesselHost();
if (hadWindow) globalThis.window = priorWindow;
else delete globalThis.window;
globalThis.document = priorDocument;
@@ -1872,17 +1884,31 @@ test('vessel interaction wire: a vessel with an id and no MMSI is selected by cl
}
});
/**
* Hand the vessel layer an overlay host, and answer the pick registry's
* card-on-top question from the same host, as the application does.
*/
function useVesselHost(host) {
_setVesselOverlayHostForTest(host);
setClickCardHitTest(host ? (x, y) => host.hitTest(x, y) : null);
}
/**
* Overlay-host recorder whose hitTest answers with one card id. The real host
* only publishes rects for `interactive` entries, so a stub returning a hit is
* the same contract a painted, actionable card presents.
*/
function hostWithCardHit(entryId) {
function hostWithCardHit(entryId, topHit) {
return {
setEntries() {},
setVisible() {},
clearSource() {},
hitTest: () => (entryId ? { sourceId: 'ais-live-vessels', entryId } : null),
hitTest: (_x, _y, { sourceId } = {}) =>
!sourceId && topHit
? topHit
: entryId
? { sourceId: 'ais-live-vessels', entryId }
: null,
};
}
@@ -1898,9 +1924,7 @@ test('vessel interaction wire: clicking a card selects and transfers, like the s
harness.windowTarget.addEventListener(WORLD_FOCUS_REQUEST_EVENT, (event) =>
requests.push(event.detail),
);
_setVesselOverlayHostForTest(
hostWithCardHit(`vessel:${harness.record.mmsi}`),
);
useVesselHost(hostWithCardHit(`vessel:${harness.record.mmsi}`));
try {
harness.handler.click({ position: { x: 10, y: 20 } });
assert.equal(
@@ -1911,7 +1935,7 @@ test('vessel interaction wire: clicking a card selects and transfers, like the s
assert.equal(requests[0].kind, 'vessel');
assert.equal(requests[0].id, harness.record.mmsi);
} finally {
_setVesselOverlayHostForTest(null);
useVesselHost(null);
harness.cleanup();
}
});
@@ -1926,9 +1950,7 @@ test('vessel interaction wire: clicking the selected vessel card refocuses exact
harness.windowTarget.addEventListener(WORLD_FOCUS_REQUEST_EVENT, (event) =>
requests.push(event.detail),
);
_setVesselOverlayHostForTest(
hostWithCardHit(`vessel:${harness.record.mmsi}`),
);
useVesselHost(hostWithCardHit(`vessel:${harness.record.mmsi}`));
try {
harness.handler.click({ position: { x: 10, y: 20 } });
assert.equal(
@@ -1939,11 +1961,36 @@ test('vessel interaction wire: clicking the selected vessel card refocuses exact
assert.equal(requests[0].id, harness.record.mmsi);
assert.equal(harness.trail.clearCalls, 0);
} finally {
_setVesselOverlayHostForTest(null);
useVesselHost(null);
harness.cleanup();
}
});
// Another layer's card on top takes the click from the vessel card under it
// and from a vessel icon under it alike.
test('vessel interaction wire: a covered card and a covered vessel pick both yield', () => {
for (const ownPick of [false, true]) {
const harness = installWireHarness(ownPick ? { id: makeRecord().mmsi } : null);
const requests = [];
harness.windowTarget.addEventListener(WORLD_FOCUS_REQUEST_EVENT, (event) =>
requests.push(event.detail),
);
useVesselHost(
hostWithCardHit(`vessel:${harness.record.mmsi}`, {
sourceId: 'earthquakes', entryId: 'quake:cover',
}),
);
try {
harness.handler.click({ position: { x: 10, y: 20 } });
assert.equal(requests.length, 0, `own pick: ${ownPick}`);
assert.equal(aisLiveVesselsLayer.getSelectedInfo()?.mmsi, harness.record.mmsi);
} finally {
useVesselHost(null);
harness.cleanup();
}
}
});
test('vessel interaction wire: an unknown card id preserves selection and never flies', () => {
const harness = installWireHarness({
primitive: {},
@@ -1955,7 +2002,7 @@ test('vessel interaction wire: an unknown card id preserves selection and never
requests.push(event.detail),
);
// An evicted vessel's card id resolves to no live record.
_setVesselOverlayHostForTest(hostWithCardHit('vessel:999999999'));
useVesselHost(hostWithCardHit('vessel:999999999'));
try {
harness.handler.click({ position: { x: 10, y: 20 } });
assert.equal(
@@ -1964,37 +2011,135 @@ test('vessel interaction wire: an unknown card id preserves selection and never
);
assert.equal(requests.length, 0);
} finally {
_setVesselOverlayHostForTest(null);
useVesselHost(null);
harness.cleanup();
}
});
test('vessel interaction wire: a sibling-owned pick wins without selection mutation', () => {
// Another layer is already acting on this click; two camera commands is the
// worse failure, so the card is not consulted.
test('vessel interaction wire: the vessel card on top wins over a sibling-owned pick', () => {
// The card painted on top takes the click; the sibling (an aircraft)
// stands aside under it, so there is one camera command, not two.
registerPickOwner('flights', (pickedId) => pickedId === 'a1b2c3');
const harness = installWireHarness({ id: 'a1b2c3' });
const requests = [];
harness.windowTarget.addEventListener(WORLD_FOCUS_REQUEST_EVENT, (event) =>
requests.push(event.detail),
);
_setVesselOverlayHostForTest(
hostWithCardHit(`vessel:${harness.record.mmsi}`),
);
useVesselHost(hostWithCardHit(`vessel:${harness.record.mmsi}`));
try {
harness.handler.click({ position: { x: 10, y: 20 } });
assert.equal(
aisLiveVesselsLayer.getSelectedInfo()?.mmsi,
harness.record.mmsi,
);
assert.equal(requests.length, 0);
assert.equal(requests.length, 1);
} finally {
_setVesselOverlayHostForTest(null);
useVesselHost(null);
harness.cleanup();
unregisterPickOwner('flights');
}
});
// The aircraft layer runs first. Under the vessel's card it stands aside, so
// the card takes the click: one action.
test('vessel interaction wire: a card over an aircraft takes the click; the aircraft does not track', (t) => {
let tracked = null;
registerPickOwner('test-planes', (pickedId) => pickedId === 'plane:9');
t.after(() => unregisterPickOwner('test-planes'));
const harness = installWireHarness(
{ id: 'plane:9' },
{ selectedRecord: null },
{},
(event) => {
if (isUnderOtherCard(event)) return;
if (event.hit?.id === 'plane:9') tracked = 'plane:9';
},
);
const requests = [];
harness.windowTarget.addEventListener(WORLD_FOCUS_REQUEST_EVENT, (event) =>
requests.push(event.detail),
);
useVesselHost(hostWithCardHit(`vessel:${harness.record.mmsi}`));
try {
harness.handler.click({ position: { x: 10, y: 20 } });
assert.equal(tracked, null, 'the aircraft does not track');
assert.equal(requests.length, 1, 'the vessel card acts');
assert.equal(
aisLiveVesselsLayer.getSelectedInfo()?.mmsi,
harness.record.mmsi,
);
} finally {
useVesselHost(null);
harness.cleanup();
}
});
// A trail acts for nobody: the vessel's card painted over it still selects,
// and a bare trail pick stays a no-op that keeps the selection.
test('vessel interaction wire: a card over a trail selects; a bare trail is a no-op', () => {
for (const carded of [true, false]) {
const harness = installWireHarness(
{ id: 'gev-trail:fl-a1b2c3:head' },
{ selectedRecord: null },
);
const requests = [];
harness.windowTarget.addEventListener(WORLD_FOCUS_REQUEST_EVENT, (event) =>
requests.push(event.detail),
);
useVesselHost(
hostWithCardHit(carded ? `vessel:${harness.record.mmsi}` : null),
);
try {
harness.handler.click({ position: { x: 10, y: 20 } });
assert.equal(requests.length, carded ? 1 : 0, `card: ${carded}`);
assert.equal(
aisLiveVesselsLayer.getSelectedInfo()?.mmsi ?? null,
carded ? harness.record.mmsi : null,
);
} finally {
useVesselHost(null);
harness.cleanup();
}
}
});
// A coarse tap on the vessel's card over a fire, nearby or exact: the card on
// top keeps the tap.
test('vessel interaction wire: the card keeps a tap over a nearby or exact fire', (t) => {
const previous = globalThis.matchMedia;
globalThis.matchMedia = () => ({ matches: true });
t.after(() => {
if (previous) globalThis.matchMedia = previous;
else delete globalThis.matchMedia;
});
const fire = 'fire:near-miss';
registerPickOwner('test-exact-fires', (pickedId) => pickedId === fire);
t.after(() => unregisterPickOwner('test-exact-fires'));
for (const exact of [false, true]) {
const harness = installWireHarness(
exact ? { id: fire } : null,
{ selectedRecord: null },
{ drillPick: () => [{ id: fire }] },
);
const requests = [];
harness.windowTarget.addEventListener(WORLD_FOCUS_REQUEST_EVENT, (event) =>
requests.push(event.detail),
);
useVesselHost(hostWithCardHit(`vessel:${harness.record.mmsi}`));
try {
harness.handler.click({ position: { x: 10, y: 20 } });
assert.equal(requests.length, 1, `exact fire: ${exact}`);
assert.equal(
aisLiveVesselsLayer.getSelectedInfo()?.mmsi,
harness.record.mmsi,
);
} finally {
useVesselHost(null);
harness.cleanup();
}
}
});
for (const card of ['live', 'stale', 'absent', 'covered']) {
test(`vessel interaction wire: ${card} foreground card over registered cyclone`, () => {
const id = 'cyclone:fixture:cone:0';
@@ -2020,7 +2165,7 @@ for (const card of ['live', 'stale', 'absent', 'covered']) {
);
return { sourceId: 'cctv', entryId: 'vessel:999999999' };
};
_setVesselOverlayHostForTest(host);
useVesselHost(host);
try {
harness.handler.click({ position: { x: 10, y: 20 } });
assert.equal(
@@ -2029,7 +2174,7 @@ for (const card of ['live', 'stale', 'absent', 'covered']) {
);
assert.equal(requests.length, card === 'live' ? 1 : 0);
} finally {
_setVesselOverlayHostForTest(null);
useVesselHost(null);
harness.cleanup();
unregisterPickOwner('weather-cyclones');
}
+6 -5
View File
@@ -2959,11 +2959,12 @@ export function createBhoteKoshiEventLayer({
: Number.isFinite(clientY) && bounds
? clientY - bounds.top
: Number.NaN;
const hit = overlayHost.hitTest?.(x, y, {
sourceId: BHOTE_KOSHI_OVERLAY_SOURCE_ID,
filter: (entry) => String(entry?.id || '').startsWith('evidence-card-'),
});
if (typeof hit?.entry?.activate !== 'function') return;
// Only the card painted on top acts: an evidence card covered by
// another layer's card or label leaves the click to that card.
const hit = overlayHost.hitTest?.(x, y);
if (hit?.sourceId !== BHOTE_KOSHI_OVERLAY_SOURCE_ID) return;
if (!String(hit.entry?.id || '').startsWith('evidence-card-')) return;
if (typeof hit.entry.activate !== 'function') return;
hit.entry.activate();
}
+9 -1
View File
@@ -2114,6 +2114,7 @@ test('Debris-Dammed Lake card opens its source and is armed for approved local v
};
const viewer = eventViewer();
let activeCard = null;
let coveredBy = null;
const layer = createBhoteKoshiEventLayer({
eventLoader: async () => event,
imagerySpecFactory: async (url) => ({ url }),
@@ -2131,9 +2132,11 @@ test('Debris-Dammed Lake card opens its source and is armed for approved local v
},
setVisible() {},
clearSource() {},
// As the host does: unfiltered, the topmost entry.
hitTest(_x, _y, options) {
if (coveredBy && !options?.sourceId) return coveredBy;
if (!activeCard || options?.filter?.(activeCard) === false) return null;
return { entry: activeCard };
return { sourceId: 'bhote-koshi-witnesses', entry: activeCard };
},
},
renderHost: { request() {}, hold() {}, release() {} },
@@ -2160,6 +2163,11 @@ test('Debris-Dammed Lake card opens its source and is armed for approved local v
} finally {
releasePointer(lease);
}
// Another layer's card painted over the evidence card takes the click.
coveredBy = { sourceId: 'earthquake-card', entryId: 'earthquake-card:q' };
viewer._test.canvas.dispatch('click', { offsetX: 640, offsetY: 420 });
assert.equal(opened.length, 0, 'a covered evidence card does not open');
coveredBy = null;
viewer._test.canvas.dispatch('click', { offsetX: 640, offsetY: 420 });
assert.deepEqual(opened, [[
event.evidenceSpine[1].media.sourceUrl,
+33
View File
@@ -2,6 +2,9 @@ import {
clearOverlaySource,
setOverlayEntries,
} from '../overlays/worldOverlay.js';
import { inputFor } from '../input/dispatcher.js';
import { clickCard } from './pickRegistry.js';
import { isTrackingSelectionGesture } from './trackingClickGesture.js';
import { governorRequestRender } from '../renderGovernor.js';
import { drawOf, findCamera } from '../render/rendererOf.js';
import { hexColor } from '../render/color.js';
@@ -279,8 +282,11 @@ export function createBhoteKoshiLocatorLayer({
cancelFrame = (handle) => cancelAnimationFrame(handle),
scheduleDelay = (callback, delayMs) => setTimeout(callback, delayMs),
cancelDelay = (handle) => clearTimeout(handle),
input = inputFor,
} = {}) {
let _viewer = null;
// The globe click that opens an actionable callout of ours on top.
let _removeClick = null;
const _serial = ++layerSerial;
// Whether the layer draws: from enable until it is let go.
let _drawing = false;
@@ -1107,6 +1113,7 @@ export function createBhoteKoshiLocatorLayer({
renderPresentation();
registerDynamicCredit(viewer, BHOTE_KOSHI_LOCATOR_CREDIT);
showOsmCredit(viewer, BHOTE_KOSHI_LOCATOR_LAYER_ID);
installCalloutClick(viewer);
requestRender('bhote-koshi-locator-callout');
try {
@@ -1141,8 +1148,34 @@ export function createBhoteKoshiLocatorLayer({
}
}
/**
* An actionable callout of ours (the trigger record's) is a card painted
* over the globe: a click on it opens its source, as its keyboard action
* does. Like the other cards, it leaves a drag alone and, on top, takes the
* click over whatever is drawn under it.
*/
function installCalloutClick(viewer) {
if (_removeClick) return;
let clicks = null;
try {
clicks = input?.(viewer) ?? null;
} catch {
clicks = null;
}
_removeClick =
clicks?.onClick?.((event) => {
if (!_enabled || !isTrackingSelectionGesture(event.gesture)) return;
// The card painted on top, read once per click so every layer agrees.
const top = clickCard(event);
if (top?.sourceId !== BHOTE_KOSHI_LOCATOR_OVERLAY_SOURCE_ID) return;
if (typeof top.entry?.activate === 'function') top.entry.activate();
}) ?? null;
}
async function disable() {
hideOsmCredit(_viewer, BHOTE_KOSHI_LOCATOR_LAYER_ID);
_removeClick?.();
_removeClick = null;
_enabled = false;
_boundaryReady = false;
_boundaryResolved = false;
+76
View File
@@ -11,6 +11,11 @@ import {
import { BHOTE_KOSHI_FLOOD_PATH } from './bhoteKoshiFloodPath.js';
import * as Cesium from 'cesium';
import { setLocale } from '../i18n/index.js';
import {
registerPickOwner,
setClickCardHitTest,
unregisterPickOwner,
} from './pickRegistry.js';
import { SceneDirector } from '../scenes/director.js';
import { createPlaybackClock } from '../director/clock.js';
import { createDefaultScenePacks } from '../scenes/packs/defaults.js';
@@ -1049,3 +1054,74 @@ test('Bhote Koshi locator layers draw sets of their own, and halos only as they
assert.equal(await second.disable(), true);
assert.equal(viewer._test.live().length, 0);
});
// The trigger record's callout is an actionable card: the layers under it
// stand aside for it, so a click on it opens its source, as its keyboard
// action does; anything else on top is left alone.
test('a click on the locator callout runs its action', async () => {
const viewer = viewerFixture();
let onClick = null;
let top = null;
const activated = [];
const layer = createBhoteKoshiLocatorLayer({
overlayHost: overlayHostFixture(),
requestRender() {},
...nonRunningAnimation(),
input: () => ({
onClick(callback) {
onClick = callback;
return () => {
onClick = null;
};
},
}),
});
// The card on top at a click, as the host answers the pick registry.
setClickCardHitTest(() => top);
await layer.init(viewer);
await layer.enable(viewer);
const click = (extra = {}) =>
onClick?.({
screenPosition: { x: 5, y: 5 },
gesture: { travelPx: 0, durationMs: 80 },
topHit: null,
hit: null,
...extra,
});
top = {
sourceId: BHOTE_KOSHI_LOCATOR_OVERLAY_SOURCE_ID,
entryId: 'bhote-koshi-trigger-record-callout',
entry: { activate: () => activated.push('trigger') },
};
click();
assert.deepEqual(activated, ['trigger']);
top = {
sourceId: 'earthquake-card',
entry: { activate: () => activated.push('other') },
};
click();
assert.deepEqual(activated, ['trigger'], 'another layer on top is its own');
// A drag that ends on it is not a click on it.
top = {
sourceId: BHOTE_KOSHI_LOCATOR_OVERLAY_SOURCE_ID,
entry: { activate: () => activated.push('trigger') },
};
click({ gesture: { travelPx: 30, durationMs: 80 } });
assert.deepEqual(activated, ['trigger'], 'a drag does not open it');
// On top, it takes the click over an aircraft or a camera under it, exact
// or a touch contact: those layers stand aside under a card.
registerPickOwner('test-planes', (id) => id === 'plane:1');
try {
const plane = { set: 'planes:1', id: 'plane:1' };
const cam = { set: 'cams:1', id: 'cam:1' };
click({ topHit: plane, hit: plane });
click({ topHit: null, hit: plane });
click({ topHit: cam, hit: cam });
assert.equal(activated.length, 4, 'the callout on top acts each time');
} finally {
unregisterPickOwner('test-planes');
setClickCardHitTest(null);
}
await layer.disable();
assert.equal(onClick, null, 'disable removes the click handler');
});
+4 -11
View File
@@ -1020,11 +1020,7 @@ test('CCTV repeated in-world clicks dispatch focus only for the one real activat
);
assert.match(
componentFunctionSource(cctvLayer.init),
/_cctvOverlayHost\.hitTest/,
);
assert.match(
componentFunctionSource(cctvLayer.init),
/sourceId: CCTV_OVERLAY_SOURCE_ID/,
/clickCard\?\.\(event\)/,
);
assert.match(
componentFunctionSource(cctvLayer.init),
@@ -1032,7 +1028,7 @@ test('CCTV repeated in-world clicks dispatch focus only for the one real activat
);
assert.match(
componentFunctionSource(cctvLayer.init),
/activateCctvCameraFromWorldClick\(cardId, setActiveCamera\)/,
/activateCctvCameraFromWorldClick\(\s*top\.entryId,/,
);
});
@@ -1157,11 +1153,8 @@ test('CCTV empty-click gate excludes every identified scene object, ADJUST, and
);
const initSource = componentFunctionSource(cctvLayer.init);
assert.ok(
initSource.indexOf('if (pickedId !== null) return') <
initSource.indexOf('_cctvOverlayHost.hitTest'),
'every identified sibling must win before an overlapping CCTV card hit test',
);
// The real init-bound click route, including identified-object barriers,
// is exercised in layers/cctv/lifecycle.test.mjs.
assert.match(initSource, /activeCameraId: _activeCameraId/);
assert.match(initSource, /calibrationMode: _calibrationMode/);
});
+1 -1
View File
@@ -53,7 +53,7 @@ test('the echo bracket pulses outward from the contact bracket and fades', (t) =
assert.ok(half.spreadPx > echo.spreadPx * 0.5);
assert.ok(half.spreadPx < echo.spreadPx);
assert.ok(half.band < STEPS && half.band >= 1);
// The bracket's own dimming (keyhole fade, Cyber sonar sweep) carries
// The bracket's own dimming (keyhole fade, sonar sweep) carries
// over, and the echo is never drawn brighter than its bracket: a bracket
// too dim for even one band draws no echo.
assert.equal(at(arrival, 0.25).band, 2);
+4 -4
View File
@@ -941,13 +941,13 @@ test('a Global Context echo bracket is drawn outside its contact bracket and dim
}
});
test('under the Cyber sonar sweep an echo is never brighter than its own bracket', () => {
test('under the sonar sweep an echo is never brighter than its own bracket', () => {
const env = installEnvironment();
// The cyber theme with its HUD open turns the contact sonar on; its sweep
// dims brackets it is not passing over.
// Sonar on with its HUD open turns the contact sonar on; its sweep dims
// brackets it is not passing over.
env.document.documentElement = {
// The lowest sweep floor, so dimmed brackets drop a whole alpha band.
dataset: { uiTheme: 'cyber', cyberSonarOpacity: '35' },
dataset: { cyberSonar: 'on', cyberSonarOpacity: '35' },
style: { setProperty() {}, removeProperty() {} },
};
const hud = env.document.createElement('div');
+61
View File
@@ -28,6 +28,8 @@ import {
createApplicationDirectionsLayer,
} from './directions.js';
import { GROUND_FLOOR_LIFT_M } from './groundFloor.js';
import { isOwnedByOtherLayer, setClickCardHitTest } from './pickRegistry.js';
import { fakeInput } from '../input/testDoubles.mjs';
import { instructionFor } from './routeSteps.js';
import { setLocale } from '../i18n/index.js';
import {
@@ -465,6 +467,65 @@ function ownershipFixture(t) {
});
}
// Directions owns its route, markers and steps while enabled: none of them
// is empty space to other layers.
test('enabled, directions owns its picks', (t) => {
ownershipFixture(t);
const viewer = {
scene: {
pick: () => null,
canvas: { clientWidth: 100, clientHeight: 100 },
},
};
const input = fakeInput(viewer);
t.after(() => input.destroy());
directionsLayer.enable(viewer);
try {
for (const id of [
'directions:route',
'directions:marker:a',
'directions:step:3',
])
assert.equal(isOwnedByOtherLayer('earthquakes', id), true, id);
} finally {
directionsLayer.disable(viewer);
}
assert.equal(isOwnedByOtherLayer('earthquakes', 'directions:route'), false);
});
// The card or label painted on top takes the click: directions does not even
// pick under another layer's card, so no step is selected or cleared there.
test("another layer's card over directions keeps the click", (t) => {
ownershipFixture(t);
let picks = 0;
const viewer = {
scene: {
pick: () => {
picks++;
return null;
},
canvas: { clientWidth: 100, clientHeight: 100 },
},
};
const input = fakeInput(viewer);
let top = { sourceId: 'earthquake-card', entryId: 'earthquake-card:ak1' };
setClickCardHitTest(() => top);
t.after(() => {
setClickCardHitTest(null);
input.destroy();
});
directionsLayer.enable(viewer);
try {
input.tap({ x: 10, y: 10 });
assert.equal(picks, 0, 'covered: the scene under the card is not picked');
top = null;
input.tap({ x: 10, y: 10 });
assert.ok(picks > 0, 'open map: the click reaches the scene');
} finally {
directionsLayer.disable(viewer);
}
});
test('placing an endpoint takes the pointer, and every exit path gives it back', (t) => {
ownershipFixture(t);
+374 -17
View File
@@ -11,7 +11,12 @@ import {
buildCellCard,
} from './firmsHeatmap.js';
import { fireDetectionKey } from './firmsLabels.js';
import { registerPickOwner, unregisterPickOwner } from './pickRegistry.js';
import {
isUnderOtherCard,
registerPickOwner,
setClickCardHitTest,
unregisterPickOwner,
} from './pickRegistry.js';
import { getSelectedEntityContext } from './contextStore.js';
import { setLocale } from '../i18n/index.js';
import { shownEntityLabel } from '../voice/speech.js';
@@ -25,6 +30,8 @@ import { fakeDrawPort } from '../testSupport/fakeDrawPort.mjs';
import { fakeGlobePort } from '../testSupport/fakeGlobePort.mjs';
import { bindRenderer } from '../render/rendererOf.js';
import { HEAT_REBUILD_MS } from '../layers/firms/policy.js';
import { registerStyleStages } from '../styles/styleStages.js';
import { sensorPickPosition } from '../input/sensorPick.js';
const LAYER_SOURCE = readLayerSource(
path.join(path.dirname(fileURLToPath(import.meta.url)), 'firmsHeatmap.js'),
@@ -58,10 +65,13 @@ function harness({
fires = [makeFire()],
picked = null,
cardHit = null,
topCard = null,
cameraPosition = null,
withDataSource = false,
withGlobe = false,
feed = null,
drilled = null,
firstClick = null,
} = {}) {
const hadWindow = Object.hasOwn(globalThis, 'window');
const priorWindow = globalThis.window;
@@ -77,16 +87,24 @@ function harness({
};
const published = [];
const overlayHost = {
setEntries: (sourceId, entries) => published.push(...entries),
setVisible() {},
clearSource() {},
hitTest: (_x, _y, { sourceId } = {}) =>
!sourceId && topCard
? topCard
: cardHit
? { sourceId: 'firms', entryId: cardHit }
: null,
};
// The card on top at a click, as the host answers the pick registry.
setClickCardHitTest((x, y) => overlayHost.hitTest(x, y));
const layer = createFirmsHeatmapLayer({
...(feed ? { feed } : {}),
id: 'firms-test',
name: 'Fires',
overlayHost: {
setEntries: (sourceId, entries) => published.push(...entries),
setVisible() {},
clearSource() {},
hitTest: () => (cardHit ? { sourceId: 'firms', entryId: cardHit } : null),
},
overlayHost,
});
const draw = fakeDrawPort();
@@ -106,6 +124,7 @@ function harness({
const viewer = {
scene: {
pick,
...(drilled ? { drillPick: () => drilled } : {}),
canvas: { clientWidth: 1280, clientHeight: 800 },
camera: cameraPosition ? { positionWC: cameraPosition } : undefined,
globe: { ellipsoid: Cesium.Ellipsoid.WGS84 },
@@ -129,6 +148,8 @@ function harness({
if (!withGlobe)
layer.attachShellServices({ imageryHost: () => ({ kind: 'none' }) });
const input = fakeInput(viewer);
// A subscriber that runs before the layer's own (an aircraft layer).
if (firstClick) input.input.onClick(firstClick);
// The LOD rebuild (and with it the context-registration sweep) is inert
// without a data source, so tests that drive a real refresh need one.
if (withDataSource) layer.init(viewer);
@@ -153,7 +174,14 @@ function harness({
(record) => record.kind === 'icons' && !record.disposed,
),
click: () => input.click({ x: 400, y: 300 }),
cover: (hit) => {
topCard = hit;
},
setPicked: (next) => {
picked = next;
},
cleanup() {
setClickCardHitTest(null);
Cesium.SceneTransforms.worldToWindowCoordinates = priorProjection;
if (hadWindow) globalThis.window = priorWindow;
else delete globalThis.window;
@@ -308,8 +336,16 @@ test('far-side detections cannot consume the bounded ambient-card cohort', () =>
test('clicking a fire sprite selects it and requests the camera transfer', () => {
const fire = makeFire();
const h = harness({ fires: [fire], picked: glowPick('firms-7') });
const h = harness({
fires: [fire],
picked: glowPick('firms-7'),
topCard: { sourceId: 'earthquakes', entryId: 'quake:cover' },
});
try {
// Under another layer's card the sprite is that card's click.
h.click();
assert.equal(h.requests.length, 0, 'covered: the card takes it');
h.cover(null);
h.click();
assert.equal(h.requests.length, 1);
assert.equal(h.requests[0].kind, 'fire');
@@ -355,6 +391,34 @@ test('clicking a fire CARD behaves exactly like clicking its sprite', () => {
}
});
test('a covered fire card does not act, and keeps an existing selection', () => {
const fire = makeFire();
const h = harness({
fires: [fire],
cardHit: `fire:${fireDetectionKey(fire)}`,
});
try {
// Covered by another layer's card from the start: nothing selects or flies.
h.cover({ sourceId: 'earthquakes', entryId: 'quake:cover' });
h.click();
assert.equal(h.requests.length, 0);
assert.equal(h.layer.getSelectedInfo(), null);
// Uncovered, the card selects; covered again, the click is the other
// layer's and leaves that selection alone.
h.cover(null);
h.click();
assert.equal(h.requests.length, 1);
const selected = h.layer.getSelectedInfo();
assert.ok(selected);
h.cover({ sourceId: 'earthquakes', entryId: 'quake:cover' });
h.click();
assert.equal(h.requests.length, 1);
assert.deepEqual(h.layer.getSelectedInfo(), selected);
} finally {
h.cleanup();
}
});
// The voice model reads these labels as data (track_entity, get_entity_context,
// pointer_context); the voice card translates them where it shows them.
test('fire labels stay English data in a translated interface', () => {
@@ -386,9 +450,9 @@ test('a click on neither sprite nor card clears without moving the camera', () =
}
});
// Sibling layers surface heterogeneous pick shapes. Reading `picked.id`
// directly recognized only bare strings, so an AIS sprite (or satellite, or
// entity) under a fire card let BOTH layers issue a camera command.
// Sibling layers surface heterogeneous pick shapes. Whatever is drawn under
// it, the fire card painted on top takes the click (those layers stand aside
// under another layer's card, so one click does one thing).
const SIBLING_PICKS = [
['flights', 'a1b2c3', { id: 'a1b2c3' }],
['flights', 'a1b2c3', { primitive: { id: 'a1b2c3' } }],
@@ -398,7 +462,7 @@ const SIBLING_PICKS = [
];
for (const [layerId, ownedId, picked] of SIBLING_PICKS) {
test(`a ${layerId} pick shaped ${JSON.stringify(picked)} wins over a card hit`, () => {
test(`a fire card wins over a ${layerId} pick shaped ${JSON.stringify(picked)}`, () => {
const fire = makeFire();
registerPickOwner(layerId, (pickedId) => pickedId === ownedId);
const h = harness({
@@ -408,11 +472,7 @@ for (const [layerId, ownedId, picked] of SIBLING_PICKS) {
});
try {
h.click();
assert.equal(
h.requests.length,
0,
`the ${layerId} layer is already acting on this click`,
);
assert.equal(h.requests.length, 1, 'the card on top acts');
} finally {
h.cleanup();
unregisterPickOwner(layerId);
@@ -420,6 +480,135 @@ for (const [layerId, ownedId, picked] of SIBLING_PICKS) {
});
}
// A passive owner's pick (a directions route, a flight trail) acts for nobody:
// a fire card over it still takes the click, and with no card the pick is
// still not empty space, so the selection stays.
test('a fire card acts over a passive pick; the bare pick leaves the selection', () => {
const fire = makeFire();
registerPickOwner('test-route', (pickedId) => pickedId === 'route:line');
const carded = harness({
fires: [fire],
picked: { id: 'route:line' },
cardHit: `fire:${fireDetectionKey(fire)}`,
});
try {
carded.click();
assert.equal(carded.requests.length, 1, 'the card acts over the route');
assert.ok(carded.layer.getSelectedInfo());
} finally {
carded.cleanup();
}
const bare = harness({ fires: [fire], picked: { id: 'route:line' } });
try {
bare.click();
assert.equal(bare.requests.length, 0);
assert.equal(
bare.layer.getSelectedInfo(),
null,
'nothing to clear or pick',
);
} finally {
bare.cleanup();
unregisterPickOwner('test-route');
}
});
// A coarse tap on a fire card finds an aircraft nearby through the shared
// touch contact. The card on top takes it; the aircraft layer stands aside.
test('a fire card takes a tap over a touch contact its layer acts on', (t) => {
const previous = globalThis.matchMedia;
globalThis.matchMedia = () => ({ matches: true });
t.after(() => {
if (previous) globalThis.matchMedia = previous;
else delete globalThis.matchMedia;
});
const fire = makeFire();
registerPickOwner('test-planes', (pickedId) => pickedId === 'plane:1');
t.after(() => unregisterPickOwner('test-planes'));
const h = harness({
fires: [fire],
drilled: [{ id: 'plane:1' }],
cardHit: `fire:${fireDetectionKey(fire)}`,
});
try {
h.click();
assert.equal(h.requests.length, 1, 'the card takes the tap');
assert.ok(h.layer.getSelectedInfo());
} finally {
h.cleanup();
}
});
// A touch contact whose layer acts only on exact hits does not take the tap
// from our card; with no card, a coarse tap near an aircraft still clears.
test('a fire card keeps a tap whose contact does not act; bare taps still clear', (t) => {
const previous = globalThis.matchMedia;
globalThis.matchMedia = () => ({ matches: true });
t.after(() => {
if (previous) globalThis.matchMedia = previous;
else delete globalThis.matchMedia;
});
const fire = makeFire();
registerPickOwner('test-cameras', (pickedId) => pickedId === 'cam:1');
registerPickOwner('test-planes', (pickedId) => pickedId === 'plane:1');
t.after(() => {
unregisterPickOwner('test-cameras');
unregisterPickOwner('test-planes');
});
const carded = harness({
fires: [fire],
drilled: [{ id: 'cam:1' }],
cardHit: `fire:${fireDetectionKey(fire)}`,
});
try {
carded.click();
assert.equal(carded.requests.length, 1, 'the card acts');
} finally {
carded.cleanup();
}
const bare = harness({
fires: [fire],
picked: glowPick('firms-7'),
drilled: [{ id: 'plane:1' }],
});
try {
bare.click();
assert.ok(bare.layer.getSelectedInfo(), 'a fire is selected');
// Nothing exact now; the touch contact is an aircraft, with no card.
bare.setPicked(null);
bare.click();
assert.equal(bare.layer.getSelectedInfo(), null, 'the bare tap clears');
} finally {
bare.cleanup();
}
});
// The aircraft layer runs first. Under the fire card painted over its plane
// it stands aside, so the card takes the click: one action, in either order.
test('a fire card over an aircraft takes the click; the aircraft does not track', (t) => {
const fire = makeFire();
let tracked = null;
registerPickOwner('test-planes', (pickedId) => pickedId === 'plane:9');
t.after(() => unregisterPickOwner('test-planes'));
const h = harness({
fires: [fire],
picked: { id: 'plane:9' },
cardHit: `fire:${fireDetectionKey(fire)}`,
firstClick: (event) => {
if (isUnderOtherCard(event)) return;
if (event.hit?.id === 'plane:9') tracked = 'plane:9';
},
});
try {
h.click();
assert.equal(tracked, null, 'the aircraft does not track');
assert.equal(h.requests.length, 1, 'the fire card acts');
assert.ok(h.layer.getSelectedInfo());
} finally {
h.cleanup();
}
});
test('a stale card id resolves to nothing instead of an arbitrary fire', () => {
const h = harness({
picked: { primitive: {}, content: {}, featureId: 0 },
@@ -649,6 +838,16 @@ test('far zoom drapes one heatmap and the hand-off cross-fades it with the marke
assert.equal(added[0].alpha, 0.5);
assert.equal(glow(1).alpha, 0.5, 'rebuilt markers get the fade');
// An application drawing the detections in their place hides both.
h.layer.setMarkerStandIn({ hitTest: () => null });
assert.equal(added[0].show, false, 'a stand-in hides the heatmap');
assert.equal(markers().show, false, 'and the markers');
h.layer._renderLodForTest('global');
assert.equal(added[0].show, false, 'through a rebuild too');
h.layer.setMarkerStandIn(null);
assert.equal(added[0].show, true);
assert.equal(markers().show, true);
h.layer.disable();
assert.equal(added[0].show, false, 'disable hides the heatmap');
@@ -660,3 +859,161 @@ test('far zoom drapes one heatmap and the hand-off cross-fades it with the marke
restoreDocument();
}
});
test('a click on a fire an application draws in place of the markers selects it as a marker click does', () => {
const fire = makeFire();
const other = makeFire({ index: 8, lat: 31.2, lon: -97.9, frp: 40 });
// The application's records come from the same source, adapted on their own.
let answer = { ...fire };
const asked = [];
const h = harness({ fires: [fire, other], picked: glowPick('firms-8') });
try {
h.layer.setMarkerStandIn({
hitTest: (screen) => {
asked.push(screen);
return answer;
},
});
assert.equal(h.icons().show, false, 'the glows are hidden');
h.published.length = 0;
h.click();
assert.deepEqual(asked, [{ x: 400, y: 300 }]);
assert.equal(h.requests.length, 1, 'the camera moves as for a marker');
assert.equal(h.requests[0].kind, 'fire');
assert.equal(
h.requests[0].id,
fireDetectionKey(fire),
'the stand-in decides, not the hidden glow under the click',
);
assert.equal('rangeM' in h.requests[0], false, 'the usual fire framing');
assert.equal(h.layer.getSelectedInfo().id, fireDetectionKey(fire));
assert.equal(getSelectedEntityContext().label, 'Fire · FRP 1520 MW');
assert.deepEqual(
h.published.map((entry) => entry.id),
[`selected-fire:${fireDetectionKey(fire)}`],
"only the selected fire's card shows",
);
// Nothing of the application's under the click: empty space.
answer = null;
h.click();
assert.equal(h.requests.length, 1, 'no camera move');
assert.equal(h.layer.getSelectedInfo(), null, 'the selection is cleared');
} finally {
h.cleanup();
}
});
test('a stand-in that draws a fire larger says how far the camera stands from it', () => {
const fire = makeFire();
const asked = [];
let range = 24_000;
const h = harness({ fires: [fire] });
try {
h.layer.setMarkerStandIn({
hitTest: () => ({ ...fire }),
focusRangeM: (record) => {
asked.push(fireDetectionKey(record));
return range;
},
});
h.click();
assert.deepEqual(asked, [fireDetectionKey(fire)]);
assert.equal(h.requests.at(-1).rangeM, 24_000);
// No range for this fire: the usual fire framing.
range = null;
h.click();
assert.equal(h.requests.length, 2);
assert.equal('rangeM' in h.requests.at(-1), false);
} finally {
h.cleanup();
}
});
test('a stand-in hit on a fire the layer does not show selects nothing', () => {
const fire = makeFire();
const h = harness({ fires: [fire] });
try {
h.layer.setMarkerStandIn({
hitTest: () => makeFire({ lat: 12.5, lon: 40.1 }),
});
h.click();
assert.equal(h.requests.length, 0);
assert.equal(h.layer.getSelectedInfo(), null);
} finally {
h.cleanup();
}
});
test('taking the stand-in away brings the markers and their cards back and keeps the selection', () => {
const fire = makeFire();
const h = harness({
fires: [fire],
// Near enough for the markers rather than the heatmap.
cameraPosition: Cesium.Cartesian3.fromDegrees(fire.lon, fire.lat, 500_000),
});
try {
h.layer.setMarkerStandIn({ hitTest: () => fire });
assert.equal(h.icons().show, false);
h.click();
h.layer.setMarkerStandIn(null);
assert.equal(h.icons().show, true);
assert.equal(h.layer.getSelectedInfo().id, fireDetectionKey(fire));
const ids = h.published.map((entry) => entry.id);
assert.ok(ids.includes(`selected-fire:${fireDetectionKey(fire)}`));
} finally {
h.cleanup();
}
});
test('the stand-in is asked where a marker is picked: the click as the sensor style draws it', () => {
const fire = makeFire();
const asked = [];
const h = harness({ fires: [fire] });
try {
registerStyleStages(h.viewer.scene, {
surveillance: {
enabled: true,
uniforms: { intensity: 1, pixelation: 4 },
},
});
h.layer.setMarkerStandIn({
hitTest: (screen) => {
asked.push(screen);
return fire;
},
});
h.click();
const expected = sensorPickPosition(
h.viewer.scene,
{ x: 400, y: 300 },
h.viewer.scene.canvas,
);
assert.notDeepEqual([expected.x, expected.y], [400, 300]);
assert.deepEqual([asked[0].x, asked[0].y], [expected.x, expected.y]);
} finally {
h.cleanup();
}
});
test("a sibling layer's item over a stand-in fire wins the click", () => {
const fire = makeFire();
let asked = 0;
registerPickOwner('flights', (pickedId) => pickedId === 'a1b2c3');
const h = harness({ fires: [fire], picked: { id: 'a1b2c3' } });
try {
h.layer.setMarkerStandIn({
hitTest: () => {
asked++;
return fire;
},
});
h.click();
assert.equal(asked, 0, 'the stand-in is not asked');
assert.equal(h.requests.length, 0, 'no camera move');
assert.equal(h.layer.getSelectedInfo(), null);
} finally {
h.cleanup();
unregisterPickOwner('flights');
}
});
+38
View File
@@ -1827,6 +1827,44 @@ export class LayerLifecycle {
await entry.toggleChain.catch(() => {});
}
/**
* Wait until a layer's lifecycle queue is idle, following any request that
* joins it while waiting, but no longer than `timeoutMs` or `signal` allows.
* @param {string} layerId Layer id.
* @param {{signal?: AbortSignal, timeoutMs?: number}} [options]
* @returns {Promise<boolean>} true once idle; false on timeout or abort.
*/
async waitForLayerIdle(layerId, { signal, timeoutMs = 30000 } = {}) {
const entry = this.layers.get(layerId);
if (!entry) return true;
if (signal?.aborted) return false;
let timer = null;
let onAbort = null;
const givenUp = new Promise((resolve) => {
timer = setTimeout(() => resolve(false), timeoutMs);
onAbort = () => resolve(false);
signal?.addEventListener('abort', onAbort, { once: true });
});
try {
let pending;
do {
pending = entry.toggleChain;
const idle = await Promise.race([
pending.then(
() => true,
() => true,
),
givenUp,
]);
if (!idle) return false;
} while (pending !== entry.toggleChain);
return true;
} finally {
clearTimeout(timer);
signal?.removeEventListener('abort', onAbort);
}
}
_reserveLayerParamsIntent(layerId, params, origin = 'programmatic') {
const entry = this.layers.get(layerId);
if (
+4
View File
@@ -22,6 +22,7 @@ import {
import { createInfrastructureOverlayEntry } from './infrastructureOverlayEntry.js';
import { createGeojsonPins } from './geojsonPins.js';
import { inputFor as defaultInputFor } from '../input/dispatcher.js';
import { isUnderOtherCard } from './pickRegistry.js';
import {
selectInfraLod,
applyInfraEvictionGrace,
@@ -1114,6 +1115,9 @@ export function createLocalGeoJsonLayer(
const input = inputFor(viewer);
_clickSubscription = input.onClick((event) => {
if (!_enabled || !_drawn) return;
// Another layer's card or label on top takes the click: the
// item under it neither acts nor reads as empty space.
if (isUnderOtherCard(event)) return;
const hit = event.drawHit;
if (!hit || !hit.set.startsWith(`${setPrefix}:`)) return;
const part = _drawn.parts.get(hit.id);
+19
View File
@@ -6,6 +6,7 @@ import {
} from './localGeojsonCore.js';
import { localGeoJsonServices } from '../app/localGeojsonServices.js';
import { getContextStore } from './contextStore.js';
import { setClickCardHitTest } from './pickRegistry.js';
import { readEntityRecord } from './entityRecords.js';
import { bindFakeGroundRenderer } from '../testSupport/fakeGroundRenderer.mjs';
const feature = (id, geometry, properties = { name: `Feature ${id}` }) => ({
@@ -161,6 +162,24 @@ test('polygons fill the ground, lines drape, points stand on pins, all shown', a
assert.equal(record?.label, 'Feature p');
});
// The card or label painted on top takes the click: a feature under another
// layer's card is not selected.
test("another layer's card over a drawn part keeps the click", async (t) => {
const env = await enabledLayer(t, [
feature('p', { type: 'Polygon', coordinates: square(0, 0) }),
]);
let top = { sourceId: 'earthquake-card', entryId: 'earthquake-card:ak1' };
setClickCardHitTest(() => top);
t.after(() => setClickCardHitTest(null));
const fills = env.fake.set('fills');
const at = { x: 5, y: 5 };
env.click({ screenPosition: at, drawHit: { set: fills.spec.id, id: 'p' } });
assert.equal(env.fake.flights.length, 0, 'covered: not selected');
top = null;
env.click({ screenPosition: at, drawHit: { set: fills.spec.id, id: 'p' } });
assert.equal(env.fake.flights.length, 1);
});
test('a click on a drawn part selects its feature and flies above it', async (t) => {
const env = await enabledLayer(t, [
feature('p', { type: 'Polygon', coordinates: square(0, 0) }),
@@ -36,7 +36,13 @@ places without an English label.
The build runs one query at a time with pauses and honours the service's
Retry-After; it takes about ten minutes. It fails if a short list of
well-known cities is missing from the result, or a known grouping gets in.
`meta.built` keeps its earlier date when the rows are unchanged.
**Limits:** populations are whatever Wikidata states and differ in date and
definition between places (city proper, municipality, urban district). Some
districts and suburbs appear as their own rows.
**Finding a place by name:** `findPlace` takes the nearest place of the name
within 150 km of the view, else the largest city of the name. When asked,
the smaller places of `../wikidata_places` near the view count too, so a
village in view comes before a bigger namesake far away.
+15 -4
View File
@@ -1,8 +1,11 @@
# Wikidata places detail tiles
Smaller towns and villages, below the cut-off of the cities pack
(`../wikidata_cities`), for "places nearby" around one picked or named spot. Read by `placesNear` in `src/data/wikidataCities.js`. The app reads
these files; it does not call Wikidata or any place service for them.
(`../wikidata_cities`), for "places nearby" around one picked or named spot. Read by `placesNear` in `src/data/wikidataCities.js`, and by `findPlace`
when asked to look for a small place by name near the view: a place of that
name in view, or close to it, comes before a bigger city of the name far
away. The app reads these files; it does not call Wikidata or any place
service for them.
| File | Contents |
|------|----------|
@@ -17,7 +20,12 @@ entry in the index.
**Loading:** nothing here loads with the app. A lookup reads `files.js` and
the index once, then only the tiles its search box touches (one for a short
radius well inside a tile, more near tile edges and for wider searches),
once each; at most 64 tiles are kept in memory, the least recently used
once each. A lookup reaches 500 km at most (`PLACE_TILE_KM`; the search box
asks for 150 km at most), so one asked for a wider radius reads only the
tiles around its centre: at most one
tile past the centre's own on each side, a few more columns toward the
poles, and never all 732. Cities still count to the full radius. At most
64 tiles are kept in memory, the least recently used
dropped first. Rows whose name has no letter (one row, `380` in Nicaragua) are
dropped when a tile is read.
@@ -39,7 +47,10 @@ names from Wikidata (CC0)" as a courtesy once a name from the pack is shown.
`node scripts/build-wikidata-cities.mjs --tiles --min-population 1000 --max-population 15000`.
It writes only to this folder (tiles, `index.json`, `files.js`, through
`scripts/wikidataPlaceTiles.mjs`) and leaves `../wikidata_cities` alone. It
runs one query at a time with pauses and takes a long while.
runs one query at a time with pauses and takes a long while. The new files
are all written before tiles that the new build has no rows for are
removed, and `meta.built` keeps its earlier date when no tile and
nothing else in `index.json` changed.
**Reproducibility:** the step from rows to files is checked offline:
`src/tooling/wikidataPlaceTiles.test.mjs` sorts the shipped rows as the
+45 -8
View File
@@ -1503,6 +1503,43 @@ test('waitForLayerSettled defers reconciliation until the captured queue complet
await mgr.destroyAll();
});
test('waitForLayerIdle follows queued requests and gives up at its bound', async () => {
const mgr = new DataLayerManager({});
const gates = [];
const layer = makeSlowLayer('satellites', { updateInterval: 0 });
layer.module.enable = () => new Promise((resolve) => { gates.push(resolve); });
mgr.register(layer.module);
assert.equal(await mgr.waitForLayerIdle('satellites'), true, 'idle at once');
assert.equal(await mgr.waitForLayerIdle('unknown-layer'), true);
const first = mgr.setEnabled('satellites', true);
while (!gates.length) await new Promise((resolve) => setTimeout(resolve, 1));
let idle = null;
const waiting = mgr.waitForLayerIdle('satellites', { timeoutMs: 1000 })
.then((value) => { idle = value; });
// A request that joins the queue while waiting is waited for too.
const second = mgr.setEnabled('satellites', false);
gates[0]();
await Promise.all([first, second, waiting]);
assert.equal(idle, true);
// A queue that never drains returns false at the deadline or on abort.
const hung = mgr.setEnabled('satellites', true);
assert.equal(await mgr.waitForLayerIdle('satellites', { timeoutMs: 20 }), false);
const controller = new AbortController();
const aborted = mgr.waitForLayerIdle('satellites', { signal: controller.signal });
controller.abort();
assert.equal(await aborted, false);
assert.equal(
await mgr.waitForLayerIdle('satellites', { signal: controller.signal }),
false,
'an already aborted signal returns at once',
);
for (const release of gates) release();
await hung;
await mgr.destroyAll();
});
test('programmatic Context enables neither create nor replace a restoration snapshot', async () => {
const mgr = new DataLayerManager({});
const missions = makeSlowLayer('rocket-launches', { updateInterval: 0 });
@@ -1854,10 +1891,10 @@ test('pre-transition subscribers capture the exact enabled set before user chang
test('absolute Context entry intent is excluded from its own pre-entry restore snapshot', async () => {
const mgr = new DataLayerManager({});
const missions = makeSlowLayer('rocket-launches', { updateInterval: 0 });
const satellites = makeSlowLayer('satellites', { updateInterval: 0 });
mgr.register(missions.module);
mgr.register(satellites.module);
const contacts = makeSlowLayer('military-awareness', { updateInterval: 0 });
const flights = makeSlowLayer('flights', { updateInterval: 0 });
mgr.register(contacts.module);
mgr.register(flights.module);
let snapshot = null;
mgr.subscribe((change) => {
if (shouldCaptureContextSession(change)) {
@@ -1869,13 +1906,13 @@ test('absolute Context entry intent is excluded from its own pre-entry restore s
}
});
await mgr.setEnabled('rocket-launches', true, { origin: 'user' });
await mgr.setEnabled('military-awareness', true, { origin: 'user' });
assert.deepEqual([...snapshot], []);
await mgr.setEnabled('rocket-launches', false, { origin: 'user' });
await mgr.setEnabled('military-awareness', false, { origin: 'user' });
await mgr.restoreEnabledLayerIds(snapshot, { origin: 'context-restore' });
assert.equal(mgr.isEnabled('rocket-launches'), false);
assert.equal(mgr.isEnabled('satellites'), false);
assert.equal(mgr.isEnabled('military-awareness'), false);
assert.equal(mgr.isEnabled('flights'), false);
await mgr.destroyAll();
});
+56
View File
@@ -145,3 +145,59 @@ export function pickContact(query, position, options = {}) {
}
return picked;
}
/**
* The world overlay's hit test: the topmost interactive card or label painted
* at CSS-pixel coordinates, or null. Set by the overlay host while it runs.
* @type {((x: number, y: number) => {sourceId: string, entryId: string}|null)|null}
*/
let _overlayHitTest = null;
/** @type {WeakMap<object, {sourceId: string, entryId: string}|null>} */
const clickCards = new WeakMap();
/**
* Sets (or with null, clears) the hit test that names the card or label
* painted at a click. The world-overlay host sets it while it runs.
* @param {((x: number, y: number) => object|null)|null} hitTest
* @returns {void}
*/
export function setClickCardHitTest(hitTest) {
_overlayHitTest = typeof hitTest === 'function' ? hitTest : null;
}
/**
* The topmost interactive card or label painted at a click, read once per
* click so every handler of it sees the same one whatever ran first.
* @param {{screenPosition?: {x: number, y: number}}|null|undefined} click
* @returns {{sourceId: string, entryId: string}|null}
*/
export function clickCard(click) {
if (!click || typeof click !== 'object') return null;
if (clickCards.has(click)) return clickCards.get(click);
const at = click.screenPosition;
let card = null;
try {
card = _overlayHitTest?.(at?.x, at?.y) ?? null;
} catch {
// a broken hit test must never break click handling
}
clickCards.set(click, card);
return card;
}
/**
* True when another layer's card or label is painted on top at a click. The
* card on top takes the click: a scene item under it does not act, and is
* not empty space either, so the layer leaves its selection alone.
* @param {object} click The shared dispatcher event.
* @param {Iterable<string>} [ownSourceIds] The asking layer's overlay
* sources: its own card on top is its click.
* @returns {boolean}
*/
export function isUnderOtherCard(click, ownSourceIds = []) {
const card = clickCard(click);
if (!card) return false;
for (const sourceId of ownSourceIds)
if (card.sourceId === sourceId) return false;
return true;
}
+40
View File
@@ -17,6 +17,9 @@ import {
isOwnedByOtherLayer,
resolvePickId,
pickContact,
clickCard,
isUnderOtherCard,
setClickCardHitTest,
} from './pickRegistry.js';
// ---------------------------------------------------------------------------
@@ -197,3 +200,40 @@ test('touch picking tolerates a failing drill and preserves empty sky', (t) => {
])
assert.equal(pickContact(query(null, drillPick), { x: 1, y: 1 }), null);
});
test("the card on top is read once per click, and only another layer's card counts", () => {
let top = { sourceId: 'quake-card', entryId: 'q1' };
let reads = 0;
setClickCardHitTest((x, y) => {
reads++;
assert.deepEqual([x, y], [4, 5]);
return top;
});
try {
const click = { screenPosition: { x: 4, y: 5 } };
assert.equal(isUnderOtherCard(click, ['vessel-card']), true);
assert.equal(isUnderOtherCard(click, ['quake-card']), false, 'own card');
// A card published later in the same click does not change it.
top = { sourceId: 'vessel-card', entryId: 'v1' };
assert.equal(clickCard(click).sourceId, 'quake-card');
assert.equal(reads, 1);
assert.equal(isUnderOtherCard({ screenPosition: { x: 4, y: 5 } }), true);
top = null;
assert.equal(isUnderOtherCard({ screenPosition: { x: 4, y: 5 } }), false);
} finally {
setClickCardHitTest(null);
}
assert.equal(
isUnderOtherCard({ screenPosition: { x: 4, y: 5 } }),
false,
'no host',
);
setClickCardHitTest(() => {
throw new Error('broken');
});
try {
assert.equal(clickCard({ screenPosition: { x: 1, y: 1 } }), null);
} finally {
setClickCardHitTest(null);
}
});
+50 -25
View File
@@ -217,6 +217,15 @@ const TILE_DEG = 5;
* far more than one lookup touches, and bounds what a long session keeps.
*/
const MAX_TILES = 64;
/**
* How far out small places are looked for, in km. 500 km is under the 556 km
* that 5 degrees of latitude span, so a lookup's tile box reaches at most one
* tile past the point's own on each side: 3 rows, and 3 columns at the
* equator (more toward the poles, where tiles narrow). A lookup asked for a
* wider radius, up to the whole globe, still reads only those tiles; cities
* count to its full radius.
*/
export const PLACE_TILE_KM = 500;
const NAMED = /\p{L}/u;
const tiles = new Map();
let loadTileIndex;
@@ -248,9 +257,11 @@ async function readPlaceTiles(latitude, longitude, radiusKm, fetchImpl) {
readPlacePack(INDEX_URL(), fetchImpl),
);
const index = await loadTileIndex();
const keys = tileKeysAround(latitude, longitude, radiusKm).filter(
(key) => index.tiles[key],
);
const keys = tileKeysAround(
latitude,
longitude,
Math.min(radiusKm, PLACE_TILE_KM),
).filter((key) => index.tiles[key]);
// A tile that cannot be read is left out: the places of the others,
// and the cities, are still the answer.
const settled = await Promise.allSettled(
@@ -281,7 +292,10 @@ async function readPlacePack(url, fetchImpl) {
return response.json();
}
/** Named cities and smaller places around one point, nearest first. */
/**
* Named cities and smaller places around one point, nearest first. Smaller
* places are looked for within PLACE_TILE_KM only.
*/
export async function placesNear(
{ latitude, longitude, radiusKm = 10, limit = 6 },
fetchImpl = (...args) => globalThis.fetch(...args),
@@ -325,7 +339,14 @@ export async function placesNear(
const found = [
...cities.filter((city) => city.distanceKm <= radius),
...detail
.flatMap((source) => citiesWithin(source, latitude, longitude, radius))
.flatMap((source) =>
citiesWithin(
source,
latitude,
longitude,
Math.min(radius, PLACE_TILE_KM),
),
)
.filter((place) => !twinOfCity(place)),
];
const seen = new Set();
@@ -339,12 +360,13 @@ export async function placesNear(
const TWIN_KM = 3;
/**
* The city with this name, or null. A qualifier after a comma that names a
* country ("Paris, France", "Paris, US") keeps only cities there, and finds
* The place with this name, or null. A qualifier after a comma that names a
* country ("Paris, France", "Paris, US") keeps only places there, and finds
* nothing when none is; one that names no country ("Paris, Texas") is
* ignored. A city of that name within `radiusKm` of `near` (the view) wins,
* the nearest first, else the largest city of that name anywhere. Omnibar
* can also ask for a smaller place nearby when the cities pack has no match.
* ignored. A place of that name within `radiusKm` of `near` (the view) wins,
* the nearest first, else the largest city of that name anywhere. With
* `includeSmallPlaces`, the smaller places of the detail tiles near the view
* count too: a village in view comes before a far bigger city of its name.
*/
export async function findPlace(
name,
@@ -360,20 +382,6 @@ export async function findPlace(
const cities = (names.get(wanted) || []).filter(
(row) => !country || row[4] === country,
);
if (!cities.length) {
if (!includeSmallPlaces || !near) return null;
const nearby = await placesNear(
{ ...near, radiusKm, limit: Infinity },
fetchImpl,
);
return (
nearby.find(
(place) =>
foldName(place.name) === wanted &&
(!country || place.country === country),
) ?? null
);
}
if (Number.isFinite(near?.latitude) && Number.isFinite(near?.longitude)) {
let best = null;
for (const row of cities) {
@@ -381,7 +389,24 @@ export async function findPlace(
if (km <= radiusKm && (!best || km < best.distanceKm))
best = toCity(row, km);
}
if (includeSmallPlaces) {
const nearby = await placesNear(
{
latitude: near.latitude,
longitude: near.longitude,
radiusKm,
limit: Infinity,
},
fetchImpl,
);
const small = nearby.find(
(place) =>
foldName(place.name) === wanted &&
(!country || place.country === country),
);
if (small && (!best || small.distanceKm < best.distanceKm)) best = small;
}
if (best) return best;
}
return toCity(cities[0], 0);
return cities.length ? toCity(cities[0], 0) : null;
}
Loaded 100 of 445 files, more files were not shown because too many files have changed in this diff. Show more