Merge remote-tracking branch 'origin/main' into german/cctv-camera-counts

This commit is contained in:
German Khokhlov committed 2026-11-20 02:02:08 +04:00
commit b322ac1df9
132 files changed
+3673 -1073

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).
@@ -1,4 +1,4 @@
- Clicking a shot row anywhere (its number, title or summary), or pressing
Enter or Space on its title, now goes to the shot, as LOAD did; the LOAD
button is gone. In its place, up and down arrows swap the shot with its
neighbour, saved with the project (Sameh Khamis, @samehkhamis, #XXXX).
neighbour, saved with the project (Sameh Khamis, @samehkhamis, #1803).
+1 -1
View File
@@ -3,4 +3,4 @@
posing, and the vessel hull sprites are part of the package's public entry
points as `gods-eye-view/fleet`, with declarations, so contacts can be drawn
exactly as the Flights and Vessels layers draw them (Sameh Khamis,
@samehkhamis, #XXXX).
@samehkhamis, #1820).
+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).
+3
View File
@@ -0,0 +1,3 @@
- The remaining selects, pressed toggles and close buttons in the views are
kit controls, and a test now keeps every view that way (manjunath22466,
samehkhamis, #1854).
@@ -0,0 +1,3 @@
- The command dock's and Context's buttons and glyphs are now kit controls,
and the style buttons say whether they are pressed (manjunath22466,
samehkhamis, #1855).
@@ -0,0 +1,3 @@
- The small views' buttons and glyphs (locale picker, phone tabs, globe
actions and compass, News and rail cards, credits, the Omnibar guide's
rings and others) are now kit controls (manjunath22466, samehkhamis, #1856).
@@ -0,0 +1,3 @@
- Wheel and trackpad zoom no longer freeze below 150 km while an aircraft or
vessel icon is under the centre of the view: icons drawn over depth write a
depth of exactly 0, which the camera's depth pick ignores (asturksever, #1857).
+2
View File
@@ -0,0 +1,2 @@
- The Cockpit HUD's buttons and glyphs are now kit controls, and its rim
pointers are hidden from screen readers (manjunath22466, samehkhamis, #1858).
@@ -0,0 +1,4 @@
- Opening the bare address starts with the default layers again, instead of
bringing back the last session's: a link still restores everything it
carries, so clearing the address always resets the view (samehkhamis,
#1861).
+2
View File
@@ -0,0 +1,2 @@
- The AI chat panel's and voice control's buttons and glyphs are now kit
controls (manjunath22466, samehkhamis, #1862).
+2
View File
@@ -0,0 +1,2 @@
- Draw's and Import's buttons and glyphs are now kit controls
(manjunath22466, samehkhamis, #1863).
+21 -6
View File
@@ -93,6 +93,16 @@ settling. Oblique views below 300 km are left alone.
`QA_BASE_URL=http://localhost:4173 node scripts/qa-zoom-out-guard.mjs` exercises
the real browser controller at desktop and phone widths with keyless fixtures.
Below 150 km Cesium sizes a wheel or pinch zoom step from the depth it picks at
the canvas centre. Icons drawn over depth (aircraft, vessels and most markers:
`disableDepthTest: Infinity`) sit on the near plane and write a depth of
exactly 0 there (`src/render/cesium/iconSetPrimitive.js`), which that pick
reads as nothing drawn, so it keeps the ground under the icon. Any depth past
the near plane would be taken for a surface a near plane's distance from the
camera, and the zoom would stop while an icon is under the centre.
`QA_BASE_URL=http://localhost:5173 node scripts/qa-zoom-under-icon.mjs` checks
this against a dev server (`npm run dev`).
Cesium's free look (Shift+drag, which turns the camera in place) works only
below 1,000 km. Above that height a few drags could turn the whole planet out of
frame and leave only stars, so Shift+drag does nothing there. Cesium also turns
@@ -3372,7 +3382,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.
@@ -8581,7 +8594,7 @@ pins and share links already supply complete boxes.
- Vessels, Transit and Rail draw fleet models under the same DISPLAY rail `3D` toggle, at the same altitude ceiling, caps and 3 km add/keep radii as the aircraft, at true size (`FLEET_MODEL_POLICY`, `src/layers/flights/policy.js`; `createFleetModelLayer`, `src/data/fleetModelInstances.js`). A vessel's model follows its AIS ship type and is drawn at its reported length and beam (AIS static dimensions A+B and C+D, now carried on vessel rows as `length` and `beam`), standing at the sea surface, heading by true heading then course. An aid to navigation is not a hull: a vessel record whose type names a buoy, beacon, mark, RACON or light, or whose MMSI is an aid-to-navigation station's (`99MIDxxxx`), is `isAidToNavigation` (`src/data/vesselTypes.js`) and is drawn as the set's `buoys` model of the IALA mark its type names (`aidToNavigationModel`, `src/data/fleetModels.js`: cardinal N/E/S/W, port or starboard hand, preferred channel by its side, safe water, isolated danger, special mark; a beacon, light, light vessel, RACON or reference point with no mark of its own is the special mark), else a red can (`DEFAULT_AID_MODEL`), at its built size and facing north whatever heading it reports. A type is an aid's when it is one of the 32 kinds an aid report names or uses a word for one (buoy, beacon, cardinal, safe water, RACON, lighthouse and so on); a vessel that works on aids (`Buoy Tender`, `Buoy Layer`) is not one. Its icon is the buoy sprite, tinted bone white (`AID_TO_NAVIGATION_STYLE`, `src/data/vesselLabels.js`), upright and never turned, and its card, selected card and HUD readout (`src/layers/vessels/cards.js`) show its kind alone, whole, in that colour: no speed or heading, since a fixed mark has neither. AISStream subscribes to `AidsToNavigationReport` (message 21) by default, and the server names each report's aid type code (0 to 31) as its kind (`aidToNavigationTypeName`: `20` is `Cardinal Mark N`) rather than reading it as a ship type, and its name runs on into the report's `NameExtension`. A virtual aid (the report's `VirtualAtoN` flag: a mark broadcast where nothing physical stands) carries `virtual: true` on its row, and on its vessel source record (the live-source contract's `virtual`, `src/sources/live/contract.js`, false unless a source says true; any source may set it). It keeps its buoy sprite but never gets a model (`vesselModelSpec` returns null for it, and the vessel layer gathers no model item for it), and its card and readout add `VIRTUAL` after its kind. `aisStreamRows` (`server/providers/vessels/ais-store.js`) puts every vessel ahead of every aid, so a capped request (the layer asks for 12,000 rows) never gives up a ship for a buoy. The `vessels_in_area` tool (and the brief built on it) counts ships only: it leaves aids out of its rows, counts, breakdowns and speed stats. A transit vehicle's model follows its route's GTFS `route_type` when its record carries one and that type is a kind of the vehicle's mode (`types.json` `transit.route_types`: 200 a coach, 101 a high-speed set, 106 a regional DMU, 710 a double-decker), else its layer mode (`transit.modes`: bus, trolleybus, tram, cable car, subway, monorail, rail, funicular, gondola or ferry; a vehicle of `unknown` mode keeps its icon); a fleet hint that overrules the route (a bus on a tram route) leaves the type unused. A monorail and a gondola are raised by their `transit.elevation` lifts. A train's model follows its rail category and mode (rail, metro or tram). The bundled GTFS-Realtime proxy carries no route type, so its vehicles draw their mode's model; a source that adds `routeType` reaches the finer ones. Both stand on the road or rail top they are drawn on, without the 1.5 m `GROUND_FLOOR_LIFT_M` their icons carry, and are painted in their mode or category colour where the model's `_TINT` attribute marks it. A vessel model is clipped at its waterline (one clipping plane per model, at the model origin's horizontal plane), so its hull below the water never shows through a plain globe, which Cesium does not depth-test models against. Under the NVG/FLIR styles (the Flights `irBoost` parameter) these models render unlit flat white, as aircraft models do. Each vehicle's icon stays the visual until its model is loaded, ready and placed; a model is picked as its icon is, and a vehicle drawn as its model keeps its selection card and its place in the detection overlay.
- **Aircraft models skip Cesium's dynamic environment map (2026-10-24).** Flights, Military Flights and Local ADS-B pass `environmentMapOptions: AIRCRAFT_ENVIRONMENT_MAP_OPTIONS` (`{ enabled: false }`, `src/data/aircraftModelLighting.js`) to every drawn model. Otherwise each `Model` renders the sky around it and reads it back from the GPU (`readPixels`) when it is first placed, and again whenever it moves more than 1 km, the scene's atmosphere settings change, or (under sunlight dynamic lighting) an hour of scene time passes (`DynamicEnvironmentMapManager`, Cesium 1.138). The models are lit from Cesium's default spherical harmonics instead, with no specular environment map, so the sky's model-lighting cube map no longer reaches aircraft. `src/data/aircraftModelLighting.test.mjs` pins the option at every drawn model call; every model is built from the fleet set loaded up front, so there is no separate preload.
- The DISPLAY-rail `3D` toggle is the user-facing activation path for both aircraft layers. Their small approved GLBs build their render resources without Cesium's frame-spread job queue, preventing continuous Photorealistic 3D Tiles streaming from starving model readiness; model caps, tracking, camera, and fallback billboards are unchanged.
- **The `3D` toggle DEFAULTS ON in `proximity` on a first run.** Proximity is itself the budget — models appear only within 3 km of the camera and only for the nearest `MODEL_MAX` — so the default costs nothing at globe scale, and `all` remains a deliberate opt-in. A fresh boot runs NO layer-state restoration (`LayerStateCoordinator.start()` returns early with neither a share payload nor stored state), so four independent initializers decide what a first-run operator sees and must agree: `booleanOption('models3d', 'e', true)` in `src/data/layerState.js`, `_models3dEnabled = true` in BOTH flight layers, `this._models3dEnabled = true` in `src/ui/aircraftDisplay.js`, and the `active` / `visible` classes on `#models3d-toggle` / `#models3d-mode-row` in `index.html`. All four are pinned together in `src/data/layerState.test.mjs`. Explicit state still wins: because the codec omits default-valued options, `models3d: false` is now what travels in a link (`lo=…f.e.0`) and restores OFF at both aircraft layers. **Consequence for returning users:** a stored `gev:layer-state:v2` blob is a FULL options snapshot, so a session that wrote one before this change carries `models3d:false` and keeps 3D off until the operator flips it (or clears the key) — the durable snapshot is treated as the recipient's own state, by design.
- **The `3D` toggle DEFAULTS ON in `proximity` on a first run.** Proximity is itself the budget — models appear only within 3 km of the camera and only for the nearest `MODEL_MAX` — so the default costs nothing at globe scale, and `all` remains a deliberate opt-in. A fresh boot runs NO layer-state restoration (`LayerStateCoordinator.start()` returns early with neither a share payload nor stored state), so four independent initializers decide what a first-run operator sees and must agree: `booleanOption('models3d', 'e', true)` in `src/data/layerState.js`, `_models3dEnabled = true` in BOTH flight layers, `this._models3dEnabled = true` in `src/ui/aircraftDisplay.js`, and the `active` / `visible` classes on `#models3d-toggle` / `#models3d-mode-row` in `index.html`. All four are pinned together in `src/data/layerState.test.mjs`. Explicit state still wins: because the codec omits default-valued options, `models3d: false` is now what travels in a link (`lo=…f.e.0`) and restores OFF at both aircraft layers. Start-up never reads a stored `gev:layer-state:v2` blob back: a bare URL starts from these defaults and a link from its hash (`src/ui/shareRestoration.js`, `allowLocalState: false`), so clearing the address always resets the view.
- Civilian and military 2D aircraft use the established distance scale: `3×` near
the camera and a `0.5×` floor from 8,000 km outward. A standard 20 px ambient
icon therefore remains about 10 px at globe altitude while retaining the
@@ -8824,13 +8837,15 @@ that era's default (`scf` → 35, `ko` → 5). Every link since carries both fie
explicitly, because the generator always writes them, so no era whose default
later changed depends on a fallback either way.
**They do NOT all persist the same way, and only one of them persists at all.**
**None of them comes back from storage on a bare URL; only the hash carries them.**
Worth stating plainly, because "a default you can override" and "a default that
remembers" are different promises:
- **3D models** have durable storage — `gev:layer-state:v2` in local storage,
written by `LayerStateCoordinator` on explicit intent. A session that stored a
snapshot keeps whatever it stored, across tabs and restarts.
- **3D models** are written to `gev:layer-state:v2` in local storage by
`LayerStateCoordinator` on explicit intent, but start-up never reads it back:
a link restores what its hash carries, and a bare URL starts with the default
layers and options (`src/ui/shareRestoration.js` passes
`allowLocalState: false`), so clearing the address always resets the view.
- **Detection mode/density and scope feather have NO storage key at all.** Their
only durable carrier is the URL hash (`dm`/`dd`, `scf`), written on a 500 ms
debounce. A same-URL reload therefore keeps them only if that debounce already
+228 -32
View File
@@ -37,9 +37,12 @@ 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`, `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
`UiButton`, `UiCloseButton`, `UiPanel`, `UiPanelToggle` (a panel's collapse
button, which `UiPanel` and `PanelCollapseButton` draw), `UiPanelEdge` (a
panel header's edge switch), `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, and they contain
@@ -83,19 +86,171 @@ 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
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.
code adds (a voice highlight) survives a press. Every pressed toggle (a
control with `aria-pressed`) in the views is a `UiButton` with `pressed`
except two that keep their own `aria-pressed`: Bhote Koshi's cinematic
button, whose state the event layer writes into the attributes its panel
renders, and Explore's story cards, which are `role="button"` elements,
not buttons (`src/ui/kit/viewControls.test.mjs` pins it). Where the
converted buttons draw Material symbols (the tilt-map button, the Context
header's search and expand, Draw, Import, the imported files' and drawn
shapes' row actions and the rail chips' icons), the glyphs are `UiIcon`s
with `:size="null"`, so the site rules still size them. Core's pressable
chips and pills (the rail cards' chips and action chips, Recent Imagery's
day chips, SWAP and ZOOM IN, map sources, cities and places, and the view
context's place and layer chips) are `UiButton`s too; the key setup chip
is still a plain button. `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 three
search fields (Explore's two and the Story context sheet's story search, a
combobox) keep their own markup, since `UiSearchField`'s Material
magnifier would replace their SVG one, and Explore's two clear buttons,
which draw an SVG cross, are ghost `UiButton`s rather than
`UiCloseButton`s (`src/ui/kit/storiesControls.test.mjs` pins it).
Explore's sort is a `UiSelect`.
Every button in the Cockpit HUD (`CockpitView` and its panels: the vision
selector, Look ahead, the view switcher's Reset and Exit, the utility
strip's launchers, collapse buttons, Radio transport and desktop rail, the
briefing card's paging, Auto, collapse and page tabs, the Contact card's
navigation, collapse and Weather, a signal row's target, the orbital
view's TLE, Nadir, zoom and Sensor, and the bridge radar's range) is a
ghost `UiButton` that keeps its id and classes, so the Cockpit
controller's listeners and the cockpit stylesheets still find it. Radio's
Enable (with `active`), Auto and Weather are pressed toggles; the
disclosures keep `aria-expanded` and the page tabs `aria-current`. Its
glyphs (the rim pointers, the reticle, the heading caret, the chevrons and
panel glyphs, the contact and route arrows) are `UiIcon`s with
`:size="null"`; the heading caret's rule reads
`.cockpit-compass .cockpit-heading-caret`, so it still outranks the kit's
`.ui-icon`, which loads after cockpit.css
(`src/ui/kit/cockpitControls.test.mjs` pins it). The −, ◀ ▶ and + glyphs
are text characters and stay text, and the Radio volume is a `UiSlider`.
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 command dock's buttons (the six style buttons, the two tray toggles,
Location's collapse and the search toggle, beside the pins and pills that
already were) are ghost `UiButton`s. The style buttons are pressed toggles
with `active` as their pressed class, so they now carry `aria-pressed`;
Normal is the pressed one until a style is published. Their glyphs, the
search 🔎 and the collapse + are text characters, not Material symbols, and
stay plain text. The Context panel's buttons (its two tabs, Contacts, the
cockpit entry and SEARCH NEARBY SITES, beside the header's search and
expand and the TR-3B chip) are ghost `UiButton`s; the tabs and Contacts
are `role="tab"` controls, chosen through `aria-selected` with their own
`active` class rather than `pressed`. The view context it shows while
nothing is picked (a worldwide tile that turns a layer on, an item's row,
the place and layer chips and Ask GEV) is on the kit too, and the glyphs of
all three are `UiIcon`s with `:size="null"`, so their site rules still size
them; an item's motion glyph keeps `role="img"` and its name, with the
kit's `aria-hidden` taken off (`src/ui/kit/commandDockControls.test.mjs`
pins it). Ask GEV's chat bubble stays inline SVG.
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.
Utilities' Draw and Import are on the kit. Draw (a pressed toggle with
`active`), Clear and Import are ghost `UiButton`s, their glyphs `UiIcon`s
with `pp-icon` and `:size="null"`. Draw's five colour swatches, in the
toolbar and in a drawn shape's row, are ghost `UiButton`s with
`role="radio"`: they say they are chosen with `aria-checked` and their own
`active` class, never `aria-pressed`. A drawn shape's row (its swatch,
show/hide, the application's row actions and fly to, beside its remove
`UiCloseButton`) is on the kit too, its glyphs `UiIcon`s with
`:size="null"`, so `controls.css` still sizes them; show/hide says what it
does in its name (Show …, Hide …) rather than being pressed. The Street
Level panel's controls already were kit controls; its EXPAND ⤢ ⤡ and its
errors' ⚠ are text characters and stay text
(`src/ui/kit/drawControls.test.mjs` pins it).
The AI chat panel's and the voice control's buttons are ghost
`UiButton`s: the chat's Settings, quick prompts, attachment removes,
Attach layer, Attach a file, Expand conversation, command suggestions,
Expand chat, Add attachment and Send (a submit button that turns into
Stop reply), and the voice control's Open AI chat, Back to chat, Back to
voice, its Preview and Settings tabs and the error tray's DISMISS, beside
the tier button, the mic and the dock and minimize buttons, which already
were. The tier button and dock are pressed toggles; the mic is one only
while its owner has a state for it; the tabs keep `role="tab"` and
`aria-selected`. DISMISS is a text button, not a cross, so it is not a
`UiCloseButton`. The Settings and tab glyphs are `UiIcon`s with
`:size="null"`, so voice-cost.css and voice-card.css still size them
(`src/ui/kit/chatVoiceControls.test.mjs` pins it). The chat bubble,
globe, attach, send and stop, expand and Back glyphs stay inline SVG,
since no Material symbol the page loads draws them the same, and the
message box, file picker and inactivity minutes stay native fields, which
the kit has none of. The voice modules build no controls in script.
The small surfaces' buttons are ghost `UiButton`s: the locale picker's
button, the phone tab bar's tabs, the globe actions' Clear, Share, Reset
and north-up compass, the imagery divider's handle, the scene sharing
dialog's buttons, the layer group index's ticks, the title logo, Exit
clean view, the HUD's cockpit entry, a News card's face, a rail card's
header, a layer row's toggle, the credits line's Data attribution and the
camera calibration chips. None is a pressed toggle; the disclosures keep
`aria-expanded`. Their Material glyphs (the tabs', the globe actions', the
compass needle, the cockpit entry's and the celestial ring's sun and moon)
are `UiIcon`s with `:size="null"`, so the site rules still size them. The
locale picker's globe, caret and check and a News card's category icon stay
inline SVG. The Omnibar guide draws the extra rings of a step with several
targets in its template, as many as `view.subRings` says, rather than
building them in script; the Omnibar's one other `material-symbols-outlined`
is a stylesheet selector, and the layer disclosure only names a button in a
comment (`src/ui/kit/smallSurfacesControls.test.mjs` pins it).
`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
`@change` still reaches the select, and `hold` works as in `UiSlider`.
Without `hold`, a select takes its model back after its own change renders,
so a pick its owner refuses goes back; an owner that answers later (the SDR
gain) takes `hold`. Every select in the views is a `UiSelect`.
gain) takes `hold`. A layer row's range ends are repainted on a later frame
and may come back reordered (a start picked after the end swaps them), so
they take a plain `value` instead of a model: a pick stays until the owner
publishes a different value, which shows at once, focused or not
(`src/ui/layerPanel/rowRange.test.mjs`). Every select in the views is a
`UiSelect` (`src/ui/kit/viewControls.test.mjs` pins it).
`UiBadge` takes a `tone` and carries Core's `gev-status-badge`; its
density variants and colours stay caller classes, and it renders the CCTV
source and calibration badges and the rail card badges. `UiEmpty` takes
@@ -106,10 +261,17 @@ 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 is one (`src/ui/kit/closeButtons.test.mjs` pins
it); Street Level's and the space mission's keep `bare`, since their skins
set their own padding and border. The close buttons built in script (credits, the
Quebec CCTV overlay, the guide) are not converted yet.
clear button in the views that draws a cross is one
(`src/ui/kit/closeButtons.test.mjs` and `viewControls.test.mjs` pin it,
for a bare × or one in a span) except Story Explore's two search clears,
whose SVG cross is neither of its glyphs, and an imported file's
Remove, one of the row's icon `UiButton`s (show or hide, fly to, remove)
that draw the icon the file import names for each. The Story context
sheet's Close is a text button, a plain `UiButton`. Street Level's and the
space mission's (its deselect and the replay's Cancel) 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
@@ -134,9 +296,10 @@ 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 (`src/ui/kit/checkboxes.test.mjs` pins it); Story Explore's
filters are not converted yet. Its kit rule holds the centred row the
checkbox-only labels drew, moved rather than copied.
`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
@@ -152,7 +315,8 @@ 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
Explore's filter, the credits, the Omnibar guide's callout) 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
@@ -164,9 +328,12 @@ are, without Core's slider surface). A caller's own input, change and blur
handlers still reach the input, and a null model leaves it as it is. It is
a functional render-function component, so the portable `./ui/input` rows
use it without a component compiler. Every range in the views is a
`UiSlider` except the radio tuner's: its owner moves the handle back to the
`UiSlider` except two. The radio tuner's owner moves the handle back to the
selected station on a drag's first input without changing the slot, which
a functional component would not render again.
a functional component would not render again. The world timeline's
scrubber is a bare range inside its own gesture track: its `step="any"`
bounds follow the zoomed view, and a pinch puts the input back on the
handle itself.
Controls share one skin, so every panel reads the same. Every scrolling
surface carries the kit's `.ui-scroll`, which draws the thin
@@ -177,6 +344,18 @@ page declares no dark `color-scheme`. Selects and number fields are
and keeps native spinners dark; ranges are `.gev-quantitative-slider`, with
a feature supplying only its accent.
`t()` is reactive only while the locale is bound to a ref (the app binds
it to vue-i18n's). Words a view passes to a kit component as a prop
(`UiCloseButton`'s `label`) follow the view's render at once. Words and
props read in a kit component's slot follow a tick later, in the child's
own update, and never when the locale is unbound; a slot that reads a
`v-for` variable is already redrawn with its view. A view whose owner
patches synchronously and reads the result at once (a News card, a rail
card, the credits line, the Omnibar guide's buttons) gives such a slot
under a named condition that is always true
(`<template v-if="redrawWithView" #default>`): Vue redraws a conditional
slot whenever its view is drawn.
## Phases
1. **Foundation.** Vue, Pinia and the Vite Vue plugin join the browser build
@@ -244,8 +423,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
@@ -290,7 +474,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
@@ -368,7 +556,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
@@ -415,14 +610,15 @@ 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; 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
deferred until a host adds one: no host does today (the hosted
application's account interface is its own markup), and the first such
panel, the hosted timeline, will shape it.
tests mount components. Many tests still read `.vue` sources: the kit's
control scans in `src/ui/kit/` (`viewControls`, `closeButtons`,
`checkboxes`, `dialogs` and the per-surface ones) and markup checks such
as `contextTabKeyboard`, `geoFileImport` and `panelStorageDocs`. 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 deferred until a host needs
one.
## Verification
+17
View File
@@ -1297,6 +1297,7 @@
"src/render/cesium/zoomOutGuard.test.mjs",
"src/app/controls.test.mjs",
"scripts/qa-zoom-out-guard.mjs",
"scripts/qa-zoom-under-icon.mjs",
"src/hudSummaryGate.test.mjs",
"src/hudSummaryLine.test.mjs",
"src/testSupport/stubMgrs.mjs",
@@ -1339,6 +1340,7 @@
"src/ui/kit/UiCloseButton.vue",
"src/ui/kit/UiCloseButton.test.mjs",
"src/ui/kit/closeButtons.test.mjs",
"src/ui/kit/viewControls.test.mjs",
"src/ui/styles/close-button.css",
"src/ui/kit/UiSearchField.vue",
"src/ui/kit/UiSearchField.test.mjs",
@@ -1350,6 +1352,17 @@
"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/kit/chatVoiceControls.test.mjs",
"src/ui/kit/cockpitControls.test.mjs",
"src/ui/kit/smallSurfacesControls.test.mjs",
"src/ui/kit/commandDockControls.test.mjs",
"src/ui/kit/drawControls.test.mjs",
"src/ui/styles/chip.css",
"src/ui/styles/empty-state.css",
"src/ui/rail/RailChips.vue",
@@ -1425,6 +1438,7 @@
"src/data/firmsIntensity.test.mjs",
"src/ui/layerPanel/RowSwitch.vue",
"src/ui/layerPanel/RowRange.vue",
"src/ui/layerPanel/rowRange.test.mjs",
"src/ui/layerPanel/RowSlider.vue",
"src/sources/phaseTiming.test.mjs",
"scripts/build-census-places.mjs",
@@ -1592,6 +1606,8 @@
"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",
@@ -1631,6 +1647,7 @@
"src/tooling/wikidataPlaceTiles.test.mjs",
"src/ui/omnibarIntent.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",
+11
View File
@@ -300,6 +300,7 @@
"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",
@@ -1096,6 +1097,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",
@@ -1635,6 +1641,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",
@@ -5383,6 +5390,7 @@
"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",
@@ -5464,6 +5472,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",
@@ -5493,6 +5502,8 @@
"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",
+4 -4
View File
@@ -444,14 +444,14 @@ const MUTATIONS = [
{
defect: 'a mission tile is dropped from the menu',
file: 'html',
from: ' <button type="button" data-first-run-start="space-missions"',
to: ' <button type="button" data-first-run-start-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-start="environmental"',
to: '<button type="button" data-first-run-start="zzz-environmental"',
from: '<UiButton data-first-run-start="environmental"',
to: '<UiButton data-first-run-start="zzz-environmental"',
},
{
defect: 'the "don\'t show again" checkbox loses its hook',
+214
View File
@@ -0,0 +1,214 @@
#!/usr/bin/env node
/**
* Real-app regression: the wheel zooms with an over-depth icon under the
* centre of the canvas. Start a dev server (`npm run dev`), then run this
* file with QA_BASE_URL set to it.
*
* Below 150 km Cesium sizes a zoom step from the depth it picks at the canvas
* centre. An icon drawn over depth must leave nothing there for that pick, or
* the camera takes the icon (a metre away, on the near plane) for the ground
* and stops zooming.
*/
import assert from 'node:assert/strict';
import puppeteer from 'puppeteer';
const origin = process.env.QA_BASE_URL || 'http://localhost:4173';
const CAMERA_HEIGHT_M = 15_000;
const browser = await puppeteer.launch({
headless: true,
args: [
'--no-sandbox',
...(process.platform === 'darwin'
? ['--use-angle=metal', '--enable-gpu']
: [
'--use-gl=angle',
'--use-angle=swiftshader',
'--enable-unsafe-swiftshader',
]),
],
protocolTimeout: 120_000,
});
const errors = [];
try {
const page = await browser.newPage();
page.on('pageerror', (error) => errors.push(error.message));
const viewport = { width: 1200, height: 800 };
await page.setViewport(viewport);
await page.goto(`${origin}/?welcome=0`, { waitUntil: 'domcontentloaded' });
await page.waitForFunction(
() =>
window.__godsEyeView?.viewer &&
window.__godsEyeView.viewer.scene.screenSpaceCameraController
.enableInputs &&
document.getElementById('loading-screen')?.classList.contains('hidden'),
{ timeout: 90_000 },
);
const setup = await page.evaluate(async (cameraHeight) => {
const C = await import('/node_modules/cesium/Build/Cesium/index.js');
const { drawOf } = await import('/src/render/rendererOf.js');
const viewer = window.__godsEyeView.viewer;
const scene = viewer.scene;
viewer.camera.cancelFlight();
viewer.trackedEntity = undefined;
// Explicit real renders make each gesture independent of host frame rate.
viewer.useDefaultRenderLoop = false;
const controller = scene.screenSpaceCameraController;
controller.inertiaZoom = 0;
controller.inertiaSpin = 0;
const lon = -30;
const lat = 40; // open Atlantic: nothing else of the app's draws here
const icons = drawOf(viewer).icons({ id: 'qa-zoom-under-icon' });
const item = {
id: 'qa-icon',
pos: C.Cartesian3.fromDegrees(lon, lat, 100),
// Held in place on the GPU, as a live aircraft or vessel icon is.
motion: { kind: 'hold', courseDeg: 0 },
image: `data:image/svg+xml;charset=utf-8,${encodeURIComponent(
'<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64"><rect width="64" height="64" fill="#f0f"/></svg>',
)}`,
size: [64, 64],
disableDepthTest: Infinity,
};
const centre = () =>
new C.Cartesian2(
scene.canvas.clientWidth / 2,
scene.canvas.clientHeight / 2,
);
const frame = () => {
scene.requestRender();
viewer.render();
};
const qa = {
height: () => viewer.camera.positionCartographic.height,
setIcon(shown) {
icons.set(shown ? [item] : []);
},
reset() {
viewer.camera.cancelFlight();
viewer.camera.lookAtTransform(C.Matrix4.IDENTITY);
viewer.camera.setView({
destination: C.Cartesian3.fromDegrees(lon, lat, cameraHeight),
orientation: { heading: 0, pitch: -C.Math.PI_OVER_TWO, roll: 0 },
});
frame();
},
async frames(count) {
for (let i = 0; i < count; i++) {
frame();
await new Promise((resolve) => setTimeout(resolve, 0));
}
return qa.height();
},
/** Whether the icon is what a click at the canvas centre picks. */
iconAtCentre() {
const picked = scene.pick(centre());
return JSON.stringify(picked?.id ?? null).includes('qa-icon');
},
/** Metres from the camera to what the depth pick finds at the centre. */
centreDepthM() {
frame();
const point = scene.pickPositionWorldCoordinates(centre());
return point
? C.Cartesian3.distance(point, viewer.camera.positionWC)
: null;
},
};
window.__zoomUnderIconQa = qa;
const gl = scene.context._gl;
const debug = gl.getExtension('WEBGL_debug_renderer_info');
return {
renderer: gl.getParameter(
debug ? debug.UNMASKED_RENDERER_WEBGL : gl.RENDERER,
),
logDepth: scene.logarithmicDepthBuffer,
pickPosition: scene.pickPositionSupported,
};
}, CAMERA_HEIGHT_M);
console.log(
`[INFO] WebGL renderer: ${setup.renderer}; log depth ${setup.logDepth}`,
);
assert.ok(setup.pickPosition, 'the context must support depth picks');
const qa = (method, ...args) =>
page.evaluate(
(name, rest) => window.__zoomUnderIconQa[name](...rest),
method,
args,
);
const x = viewport.width / 2;
const y = viewport.height / 2;
await page.mouse.move(x, y);
/** Wheel `deltaY` at the canvas centre, then the settled camera height. */
const wheel = async (deltaY) => {
await qa('reset');
await page.evaluate(
({ x, y, deltaY }) => {
window.__godsEyeView.viewer.canvas.dispatchEvent(
new WheelEvent('wheel', {
deltaY,
clientX: x,
clientY: y,
bubbles: true,
cancelable: true,
}),
);
},
{ x, y, deltaY },
);
return qa('frames', 40);
};
// The ground alone: what the icon must not change.
await qa('setIcon', false);
await qa('reset');
await qa('frames', 10);
const groundDepth = await qa('centreDepthM');
const groundIn = await wheel(-600);
const groundOut = await wheel(600);
console.log(
`[INFO] no icon: centre depth ${groundDepth?.toFixed(1)} m, wheel in to ${groundIn.toFixed(0)} m, out to ${groundOut.toFixed(0)} m`,
);
assert.ok(groundIn < CAMERA_HEIGHT_M * 0.95, 'control: wheel in zooms in');
assert.ok(groundOut > CAMERA_HEIGHT_M * 1.05, 'control: wheel out zooms out');
await qa('setIcon', true);
await qa('reset');
await page.waitForFunction(
async () => {
await window.__zoomUnderIconQa.frames(1);
return window.__zoomUnderIconQa.iconAtCentre();
},
{ timeout: 30_000 },
);
console.log('[PASS] the icon draws under the canvas centre');
const depth = await qa('centreDepthM');
const zoomedIn = await wheel(-600);
const zoomedOut = await wheel(600);
console.log(
`[INFO] icon at centre: depth pick ${depth === null ? 'finds nothing' : `${depth.toFixed(3)} m away`}, wheel in to ${zoomedIn.toFixed(0)} m, out to ${zoomedOut.toFixed(0)} m`,
);
assert.ok(
depth === null || depth > 100,
`the depth pick must not land on the icon (${depth} m from the camera)`,
);
console.log('[PASS] the depth pick at the centre ignores the icon');
assert.ok(
zoomedIn < CAMERA_HEIGHT_M * 0.95,
`wheel in must zoom in under an icon (height ${zoomedIn.toFixed(1)} m)`,
);
console.log('[PASS] wheel in zooms in');
assert.ok(
zoomedOut > CAMERA_HEIGHT_M * 1.05,
`wheel out must zoom out under an icon (height ${zoomedOut.toFixed(1)} m)`,
);
console.log('[PASS] wheel out zooms out');
assert.ok(await qa('iconAtCentre'), 'the icon must still pick by click');
console.log('[PASS] the icon still picks by click');
assert.deepEqual(errors, [], 'no JavaScript page errors');
console.log('[PASS] no JavaScript page errors');
} finally {
await browser.close();
}
+8 -2
View File
@@ -90,8 +90,14 @@ test('the ring renders its overlay in the viewer container', async (t) => {
['DIV', 'celestial-ring-outline'],
['CANVAS', 'celestial-ring-canvas celestial-sun-canvas'],
['CANVAS', 'celestial-ring-canvas celestial-moon-canvas'],
['SPAN', 'celestial-marker celestial-sun material-symbols-outlined'],
['SPAN', 'celestial-marker celestial-moon material-symbols-outlined'],
[
'SPAN',
'ui-icon material-symbols-outlined celestial-marker celestial-sun',
],
[
'SPAN',
'ui-icon material-symbols-outlined celestial-marker celestial-moon',
],
],
);
assert.equal(root.children[0].style.display, 'none');
+24 -11
View File
@@ -74,10 +74,14 @@ const voiceActions = fs.readFileSync(
test('Cockpit has one reset action beside its bottom exit path', () => {
assert.doesNotMatch(html, /id="cockpit-quick-entry"/);
assert.doesNotMatch(html, /id="cockpit-exit"/);
assert.match(
html,
/id="map-view-switch"[^>]*aria-label="Exit cockpit view"[^>]*aria-keyshortcuts="Escape"[\s\S]*?close_fullscreen[\s\S]*?EXIT COCKPIT/,
// The exit button's attributes, in whatever order the button renders them.
const exit = html.match(
/<button\b(?=[^>]*\sid="map-view-switch")([^>]*)>([\s\S]*?)<\/button>/,
);
assert.ok(exit, 'Cockpit exit is missing');
assert.match(exit[1], /\saria-label="Exit cockpit view"/);
assert.match(exit[1], /\saria-keyshortcuts="Escape"/);
assert.match(exit[2], /close_fullscreen[\s\S]*?EXIT COCKPIT/);
const topCenterActions = html.match(
/<nav id="top-center-actions"[\s\S]*?<\/nav>/,
);
@@ -108,9 +112,18 @@ test('Cockpit has one reset action beside its bottom exit path', () => {
/id="reset-globe-view"/,
'map-only reset must stay outside Cockpit',
);
assert.match(
viewSwitcher[0],
/id="cockpit-reset-globe"[^>]*type="button"[^>]*aria-label="Reset cockpit to full globe view"[^>]*hidden[\s\S]*?public[\s\S]*?RESET[\s\S]*?id="map-view-switch"/,
// The reset button's attributes, in whatever order the button renders them.
const reset = viewSwitcher[0].match(
/<button\b(?=[^>]*\sid="cockpit-reset-globe")([^>]*)>([\s\S]*?)<\/button>/,
);
assert.ok(reset, 'Cockpit Reset is missing from the view switcher');
assert.match(reset[1], /\stype="button"/);
assert.match(reset[1], /\saria-label="Reset cockpit to full globe view"/);
assert.match(reset[1], /\shidden(?=[\s>=]|$)/);
assert.match(reset[2], /public[\s\S]*?RESET/);
assert.ok(
viewSwitcher[0].indexOf('id="map-view-switch"') > reset.index,
'Cockpit Reset must sit before the exit button',
);
const actions = html.match(
@@ -194,12 +207,12 @@ test('Cockpit vision cycle exposes every map preset exactly once', () => {
test('Contacts uses the approved radar icon', () => {
const button = html.match(
/<button id="global-context-flights-btn"[\s\S]*?<\/button>/,
/<button\b[^>]*\bid="global-context-flights-btn"[\s\S]*?<\/button>/,
);
assert.ok(button, 'Contacts button is missing');
assert.match(
button[0],
/material-symbols-outlined" aria-hidden="true">radar<\/span>/,
/material-symbols-outlined"[^>]*aria-hidden="true">radar<\/span>/,
);
});
@@ -369,11 +382,11 @@ test('Cockpit owns a focused shared Display portal and compact Radio controls',
assert.doesNotMatch(html, /data-cockpit-display-slot="presets"/);
assert.match(
html,
/id="clear-selected-layers"[^>]*aria-label="Clear selected data layers"/,
/<button\b(?=[^>]*\bid="clear-selected-layers")[^>]*aria-label="Clear selected data layers"/,
);
assert.match(
html,
/id="reset-globe-view"[^>]*aria-label="Reset to full globe view"/,
/<button\b(?=[^>]*\bid="reset-globe-view")[^>]*aria-label="Reset to full globe view"/,
);
assert.match(
css,
@@ -1231,7 +1244,7 @@ test('Cockpit Contact navigation omits the redundant Focus camera action', () =>
test('Global Context names its mixed contact cycle without changing the stable mode id', () => {
const match = html.match(
/<button id="global-context-flights-btn"[\s\S]*?<\/button>/,
/<button\b[^>]*\bid="global-context-flights-btn"[\s\S]*?<\/button>/,
);
assert.ok(match, 'Global Context contacts button is missing');
assert.match(match[0], />CONTACTS</);
+4 -4
View File
@@ -25,12 +25,12 @@ const css = readStylesheet(new URL('../style.css', import.meta.url));
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>/,
/<button\b[^>]*\bid="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];
const tag = contextView.match(/<UiButton 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"/);
@@ -111,7 +111,7 @@ test('Context async action buttons remain focused while busy', () => {
assert.match(init, /if \(this\._installationsSearchBusy\) return;/);
assert.doesNotMatch(init, /\.disabled\s*=\s*true/);
const search = contextView.match(
/<button id="installations-search-btn"[^>]*>/,
/<UiButton id="installations-search-btn"[^>]*>/,
)?.[0];
assert.ok(search, 'nearby sites search is missing');
assert.doesNotMatch(search, /:disabled|\sdisabled/);
@@ -140,7 +140,7 @@ test('Context async action buttons remain focused while busy', () => {
'utf8',
);
const clearButton = globeActions.match(
/<button id="clear-selected-layers"[^>]*>/,
/<UiButton id="clear-selected-layers"[^>]*>/,
)?.[0];
assert.ok(clearButton, 'Clear selected layers button is missing');
assert.doesNotMatch(clearButton, /disabled(?!=")|:disabled=/);
+1 -1
View File
@@ -946,7 +946,7 @@ test('the card closes without a keyboard: the ESC hint is a button, kept on phon
);
assert.match(
header,
/<button type="button" class="first-run-dismiss" data-first-run-dismiss>/,
/<button type="button" class="[^"]*\bfirst-run-dismiss\b[^"]*" data-first-run-dismiss>/,
);
assert.match(header, />SKIP · ESC</);
assert.match(header, />SKIP</);
+2 -2
View File
@@ -110,7 +110,7 @@ function harness({ hidden = false, selected = true, noChips = false } = {}) {
window.performance = { now: () => now };
document.defaultView = window;
const methods = new Function('createHoverDisclosure', 'collapsePanelOnEscape', 'document', 'window', 'clearTimeout', 'performance', 'requestAnimationFrame', 't', 'msg', 'readPanelState',
`return ({${shellMethod('_initAutoHoverPanel').toString()},\n${shellMethod('_collapsePanelOnEscape').toString()},\n${shellMethod('setPanelCollapsed').toString()},\n${shellMethod('_presentPanel').toString()},\n${shellMethod('_shownPanel').toString()}});`)(
`return ({${shellMethod('_initAutoHoverPanel').toString()},\n${shellMethod('_collapsePanelOnEscape').toString()},\n${shellMethod('_railFocusStand').toString()},\n${shellMethod('setPanelCollapsed').toString()},\n${shellMethod('_presentPanel').toString()},\n${shellMethod('_shownPanel').toString()}});`)(
createHoverDisclosure, collapsePanelOnEscape, document, window, (id) => timers.delete(id), { now: () => now }, () => {}, t, msg, readPanelState,
);
const saves = [];
@@ -294,7 +294,7 @@ test('Location markup provides one named native disclosure linked to its popover
assert.match(locationToggleMarkup[2], /class="location-toolbar-label"/);
assert.doesNotMatch(locationToggleMarkup[2], /<button\b/);
assert.match(locationMarkup.slice(locationToggleMarkup.index + locationToggleMarkup[0].length),
/^\s*<button class="panel-collapse-btn" data-collapse-target="location-bar"/);
/^\s*<button type="button" class="[^"]*\bpanel-collapse-btn\b[^"]*"[^>]*\sdata-collapse-target="location-bar"/);
assert.match(locationMarkup, /<div id="location-bar-popover" class="dock-popover-content">/);
});
+1 -1
View File
@@ -349,7 +349,7 @@ test('the Visual Presets tray owns Map Source and the retired left panel is abse
);
assert.match(
html,
/<button id="control-panel-toggle"[\s\S]*?data-dock-toggle-target="control-panel"[\s\S]*?aria-controls="control-panel-popover"/,
/<button\b[^>]*\bid="control-panel-toggle"[\s\S]*?data-dock-toggle-target="control-panel"[\s\S]*?aria-controls="control-panel-popover"/,
'the compact wing must expose a semantic keyboard disclosure',
);
const panels = readFileSync(
+1 -1
View File
@@ -42,7 +42,7 @@ function panelFixture({ id = 'data-panel', nested = false, nestedCollapsed = fal
disclosure.closest = () => panel;
}
const document = { getElementById: (candidate) => candidate === id ? panel : null };
const manager = new Function('document', 'getComputedStyle', 'collapsePanelOnEscape', `return {${method('_collapsePanelOnEscape', '_togglePanel')}};`)(document, (el) => ({ visibility: el.visibility ?? 'visible' }), collapsePanelOnEscape);
const manager = new Function('document', 'getComputedStyle', 'collapsePanelOnEscape', `return {${method('_collapsePanelOnEscape', '_togglePanel')}, ${method('_railFocusStand', '_setCommandDockPanelPinState')}};`)(document, (el) => ({ visibility: el.visibility ?? 'visible' }), collapsePanelOnEscape);
manager.setPanelCollapsed = (candidate, value, options) => {
assert.equal(candidate, id);
assert.equal(value, true);
+16 -9
View File
@@ -92,6 +92,7 @@ out vec2 v_uv;
out vec4 v_color;
out vec4 v_pickColor;
out float v_proxy;
out float v_overDepth; // 1 for a row drawn over depth, on the near plane
// The row's anchor in clip space before screen offsets, for effects that wrap
// main() (sonar) and must not change geometry or picks.
@@ -125,6 +126,7 @@ void main() {
v_uv = vec2(0.0);
v_color = vec4(0.0);
v_proxy = 0.0;
v_overDepth = 0.0;
gl_Position = vec4(0.0, 0.0, 2.0, 1.0); // outside the clip volume: not drawn
float flags = style1.z;
@@ -260,14 +262,9 @@ void main() {
distanceSq < style3.w * style3.w;
if (overDepth && zclip >= -1.0 && zclip <= 1.0) {
gl_Position.z = -gl_Position.w;
#ifdef LOG_DEPTH
// Just past the near plane, not on it: czm_writeLogDepth discards a
// fragment at or below 0.9999999, and 1.0 interpolated across the quad
// can arrive a rounding step or two under that, dropping the icon for a
// frame as it moves (flicker). 1e-4 m past the near plane is still in
// front of everything the scene draws.
v_depthFromNearPlusOne = 1.0001;
#endif
// With a log depth buffer the fragment shader writes the near plane's
// depth itself.
v_overDepth = 1.0;
}
v_uv = mix(rect.xy, rect.zw, vec2(corner.x * 0.5 + 0.5, 0.5 - corner.y * 0.5));
@@ -282,6 +279,7 @@ in vec2 v_uv;
in vec4 v_color;
in vec4 v_pickColor;
in float v_proxy;
in float v_overDepth;
void main() {
vec4 color = czm_gammaCorrect(texture(u_atlas, v_uv));
@@ -296,7 +294,16 @@ void main() {
#endif
out_FragColor = color;
#ifdef LOG_DEPTH
czm_writeLogDepth(v_depthFromNearPlusOne);
// Over depth: exactly the near plane's depth, written here and not through
// czm_writeLogDepth. That function discards a fragment whose interpolated
// depth arrives a rounding step under the near plane (the icon drops for a
// frame as it moves), and any depth past the near plane is a surface to
// Cesium's depth pick: the camera controller then sizes a zoom step from an
// icon under the canvas centre, a near plane's distance away, and the wheel
// stops zooming. The pick reads a depth of 0 as nothing drawn, and keeps
// the depth of the ground under the icon.
if (v_overDepth > 0.5) gl_FragDepth = 0.0;
else czm_writeLogDepth(v_depthFromNearPlusOne);
#endif
}
`;
@@ -1,5 +1,6 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import fs from 'node:fs';
import * as Cesium from 'cesium';
import { createIconSet } from '../../data/iconSet.js';
import { IconSetPrimitive } from './iconSetPrimitive.js';
@@ -58,3 +59,29 @@ test('by default the set draws an opaque pass and a translucent one, and draws n
assert.equal(translucent.renderState.depthMask, false);
assert.equal(primitive.drawsBlend('translucent'), false);
});
test('an over-depth row writes a depth of exactly 0, which a depth pick ignores', () => {
// Shaders do not compile under node: this reads the fragment shader's
// source. A depth past the near plane (as 1.0001 through
// czm_writeLogDepth was) is a surface to Cesium's depth pick, a near
// plane's distance from the camera, and the wheel stops zooming with an
// icon under the canvas centre (scripts/qa-zoom-under-icon.mjs).
const source = fs.readFileSync(
new URL('./iconSetPrimitive.js', import.meta.url),
'utf8',
);
const [vertex, fragment] = source
.slice(source.indexOf('const VERTEX_SHADER'))
.split('const FRAGMENT_SHADER')
.map((shader) => shader.replace(/\/\/.*$/gm, '')); // comments out
assert.match(
fragment,
/if \(v_overDepth > 0\.5\) gl_FragDepth = 0\.0;\s+else czm_writeLogDepth\(v_depthFromNearPlusOne\);/,
);
// The vertex shader flags the row and leaves its log depth alone.
assert.match(
vertex,
/gl_Position\.z = -gl_Position\.w;[^}]*v_overDepth = 1\.0;/,
);
assert.doesNotMatch(vertex, /v_depthFromNearPlusOne\s*=/);
});
+1
View File
@@ -637,6 +637,7 @@ export class StyleManager extends ShellFacade {
_toggleOrbit: (...args) => this._toggleOrbit(...args),
toggleCleanView: (...args) => this.toggleCleanView(...args),
_toggleCctvEnabled: (...args) => this._toggleCctvEnabled(...args),
_togglePanel: (panelId) => this._panelChrome._togglePanel(panelId),
_setBloomEnabled: (...args) => this._setBloomEnabled(...args),
_setBloomIntensity: (...args) => this._setBloomIntensity(...args),
_setSharpenEnabled: (...args) => this._setSharpenEnabled(...args),
+3 -2
View File
@@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia';
import { computed } from 'vue';
import { t } from '../../i18n/index.js';
import { useCctvStore } from '../stores/cctv.js';
import UiButton from '../kit/UiButton.vue';
// One click-to-type pose chip. The panel's delegated click starts an edit
// in CctvControls, which publishes it; the chip then holds a number input
@@ -42,7 +43,7 @@ function onBlur(event) {
</script>
<template>
<button
<UiButton
class="cctv-cal-value"
:data-cal-field="field"
:disabled="edit ? false : view?.calibration.disabled"
@@ -60,6 +61,6 @@ function onBlur(event) {
@click.stop /></template
><template v-else>{{
view?.calibration.values[field] ?? `${t(label)} --`
}}</template></button
}}</template></UiButton
>
</template>
+4 -1
View File
@@ -58,7 +58,10 @@ test('before ContextControls renders, the switch shows its initial markup', (t)
);
assert.equal(panel.hasAttribute('data-context-mode'), false);
const tab = $('global-context-flights-btn');
assert.equal(tab.className, 'context-mode-button');
assert.equal(
tab.className,
'ui-button ui-focus ui-button--ghost ui-button--accent context-mode-button',
);
assert.equal(tab.getAttribute('aria-selected'), 'false');
assert.equal(tab.getAttribute('tabindex'), '0');
assert.equal(tab.hasAttribute('aria-busy'), false);
+53
View File
@@ -0,0 +1,53 @@
<script setup>
import { computed } from 'vue';
import {
LINK_SCHEMES,
LOGO_SCHEMES,
safeUrl,
splitLink,
} from '../../render/creditMarkup.js';
// One credit: its logo or its text, linked when it has a link. A credit is
// plain data (`src/render/contract/credits.d.ts`): its text is set as text,
// and a link or logo is kept only for a safe scheme.
const props = defineProps({
credit: { type: Object, required: true },
});
const href = computed(() =>
props.credit.href ? safeUrl(props.credit.href, LINK_SCHEMES) : null,
);
// A logo is drawn in place of the text, which names it (its alt text).
const logo = computed(() =>
props.credit.logoUrl ? safeUrl(props.credit.logoUrl, LOGO_SCHEMES) : null,
);
// Only the credit's linked words are the link, as the source wrote it.
const parts = computed(() =>
href.value && !logo.value && props.credit.linkText
? splitLink(props.credit)
: null,
);
</script>
<template>
<span v-if="parts" class="gev-credit"
>{{ parts[0]
}}<a :href="href" target="_blank" rel="noopener noreferrer">{{
parts[1]
}}</a
>{{ parts[2] }}</span
><component
:is="href ? 'a' : 'span'"
v-else
class="gev-credit"
:href="href || undefined"
:target="href ? '_blank' : undefined"
:rel="href ? 'noopener noreferrer' : undefined"
><img
v-if="logo"
class="gev-credit-logo"
:src="logo"
:alt="credit.text"
/><template v-else>{{ credit.text }}</template></component
>
</template>
+90
View File
@@ -0,0 +1,90 @@
<script setup>
import { t } from '../../i18n/index.js';
import UiButton from '../kit/UiButton.vue';
import UiCloseButton from '../kit/UiCloseButton.vue';
import CreditItem from './CreditItem.vue';
// The attribution line at the bottom left and the "Data attribution" list it
// opens, both at the end of `to` (the page's body), where the page's rules
// place them. The owner (src/ui/creditsView.js) computes the credits shown,
// keeps the list's open state and its focus, and takes the clicks and keys;
// `elements` receives the line's, the button's and the list's elements for
// it.
const props = defineProps({
to: { type: Object, required: true },
panelId: { type: String, required: true },
/** The credits on the line, once each. */
inline: { type: Array, required: true },
/** The credits in the list, once each. */
listed: { type: Array, required: true },
open: { type: Boolean, default: false },
/**
* The locale its words are in: a change words them again. The template
* never reads it; `t()` is not reactive, so a new value is what makes the
* view render again in the new language.
*/
locale: { type: String, default: '' },
elements: { type: Object, required: true },
onExpand: { type: Function, default: () => {} },
onClose: { type: Function, default: () => {} },
onKeydown: { type: Function, default: () => {} },
});
/** Between the line's credits, and before the list's button. */
const SEPARATOR = ' · ';
/** A credit's key: the same text and link are one credit. */
const key = (credit) => `${credit.text}\u0000${credit.href ?? ''}`;
// The list button's words are the slot of a UiButton, which renders inside
// the button: a locale that is not bound to a ref changes nothing the button
// reads, and the owner patches synchronously and reads the result at once. A
// slot given under a condition (`redrawWithView`, always true) is redrawn
// whenever this view is, so the words follow a new locale with the rest.
const redrawWithView = true;
/** Keep `name`'s element for the owner. */
const keep = (name) => (element) => {
props.elements[name] = element?.$el ?? element;
};
</script>
<template>
<Teleport :to="props.to"
><div id="gev-credits" :ref="keep('bar')" class="gev-credits" tabindex="-1"
><span :ref="keep('line')" class="gev-credits-line"
><template v-for="(credit, i) in props.inline" :key="key(credit)"
>{{ i ? SEPARATOR : '' }}<CreditItem :credit="credit" /></template
>{{ props.inline.length && props.listed.length ? SEPARATOR : '' }}</span
><UiButton
:ref="keep('expand')"
class="gev-credits-expand"
aria-haspopup="dialog"
:aria-controls="props.panelId"
:aria-expanded="String(props.open)"
:hidden="props.listed.length === 0"
@click="props.onExpand()"
><template v-if="redrawWithView" #default>{{
t('Data attribution')
}}</template></UiButton
></div
><div
:id="props.panelId"
:ref="keep('panel')"
class="gev-credits-panel"
role="dialog"
:aria-labelledby="`${props.panelId}-title`"
:hidden="!props.open"
@keydown="props.onKeydown($event)"
><div class="gev-credits-header"
><span class="gev-credits-title" :id="`${props.panelId}-title`">{{
t('Data provided by:')
}}</span
><UiCloseButton
:ref="keep('close')"
class="gev-credits-close"
bare
:label="t('Close data attribution')"
@click="props.onClose()" /></div
><ul class="gev-credits-list"
><li v-for="credit in props.listed" :key="key(credit)"
><CreditItem :credit="credit" /></li></ul></div
></Teleport>
</template>
+55 -122
View File
@@ -6,16 +6,14 @@
* credits). Inline credits are shown on the line at the bottom left; the
* rest are in the "Data attribution" list it opens. A credit is plain data
* (`src/render/contract/credits.d.ts`): its text is set as text, and a link
* or logo is kept only for a safe scheme.
* or logo is kept only for a safe scheme. `CreditsView` renders the line and
* the list; this owner keeps the credits shown, the list's open state and
* its focus.
*/
import { h, render as renderVue } from 'vue';
import { findCredits } from '../render/rendererOf.js';
import {
LINK_SCHEMES,
LOGO_SCHEMES,
safeUrl,
splitLink,
} from '../render/creditMarkup.js';
import { onLocaleChange, t } from '../i18n/index.js';
import { getLocale, onLocaleChange } from '../i18n/index.js';
import CreditsView from './credits/CreditsView.vue';
const PANEL_ID = 'gev-credits-panel';
@@ -30,42 +28,6 @@ function distinct(list) {
});
}
/** One credit as DOM: its logo or its text, linked when it has a link. */
function creditElement(doc, credit) {
const href = credit.href ? safeUrl(credit.href, LINK_SCHEMES) : null;
const logoUrl = credit.logoUrl ? safeUrl(credit.logoUrl, LOGO_SCHEMES) : null;
// Only the credit's linked words are the link, as the source wrote it.
if (href && !logoUrl && credit.linkText) {
const [before, words, after] = splitLink(credit);
const element = doc.createElement('span');
element.className = 'gev-credit';
const link = doc.createElement('a');
link.href = href;
link.target = '_blank';
link.rel = 'noopener noreferrer';
link.textContent = words;
element.append(before, link, after);
return element;
}
const element = doc.createElement(href ? 'a' : 'span');
element.className = 'gev-credit';
if (href) {
element.href = href;
element.target = '_blank';
element.rel = 'noopener noreferrer';
}
// A logo is drawn in place of the text, which names it (its alt text).
const logo = credit.logoUrl ? safeUrl(credit.logoUrl, LOGO_SCHEMES) : null;
if (logo) {
const image = doc.createElement('img');
image.className = 'gev-credit-logo';
image.src = logo;
image.alt = credit.text;
element.append(image);
} else element.textContent = credit.text;
return element;
}
/**
* Show `viewer`'s renderer credits at the bottom left of `root`'s page.
* @param {object} viewer The scene object, bound to its renderer.
@@ -76,106 +38,77 @@ export function mountCreditsView(viewer, { root = document.body } = {}) {
const credits = findCredits(viewer);
if (!credits || !root) return () => {};
const doc = root.ownerDocument;
const bar = doc.createElement('div');
bar.id = 'gev-credits';
bar.className = 'gev-credits';
// Takes focus back from an emptied list when the line has no link.
bar.tabIndex = -1;
const line = doc.createElement('span');
line.className = 'gev-credits-line';
const expand = doc.createElement('button');
expand.type = 'button';
expand.className = 'gev-credits-expand';
expand.setAttribute('aria-haspopup', 'dialog');
expand.setAttribute('aria-controls', PANEL_ID);
expand.setAttribute('aria-expanded', 'false');
// The view teleports the line and the list to the end of `root`; this
// host, never in the page, holds only its place.
const host = doc.createElement('div');
const elements = {};
let inline = [];
let listed = [];
let open = false;
const panel = doc.createElement('div');
panel.id = PANEL_ID;
panel.className = 'gev-credits-panel';
panel.setAttribute('role', 'dialog');
panel.hidden = true;
const header = doc.createElement('div');
header.className = 'gev-credits-header';
const title = doc.createElement('span');
title.className = 'gev-credits-title';
title.id = `${PANEL_ID}-title`;
panel.setAttribute('aria-labelledby', title.id);
const close = doc.createElement('button');
close.type = 'button';
close.className = 'gev-credits-close';
close.textContent = '×';
header.append(title, close);
const list = doc.createElement('ul');
list.className = 'gev-credits-list';
panel.append(header, list);
bar.append(line, expand);
root.append(bar, panel);
// The view patches synchronously, so focus can move once it returns.
const paint = () =>
renderVue(
h(CreditsView, {
to: root,
panelId: PANEL_ID,
inline,
listed,
open,
locale: getLocale(),
elements,
onExpand,
onClose,
onKeydown,
}),
host,
);
const label = () => {
expand.textContent = t('Data attribution');
title.textContent = t('Data provided by:');
close.setAttribute('aria-label', t('Close data attribution'));
};
const setOpen = (open, { focus = false } = {}) => {
panel.hidden = !open;
expand.setAttribute('aria-expanded', String(open));
if (open) close.focus();
else if (focus) expand.focus();
const setOpen = (next, { focus = false } = {}) => {
open = next;
paint();
if (open) elements.close.focus();
else if (focus) elements.expand.focus();
};
const render = (all) => {
const { bar, line, panel } = elements;
const focused = panel.contains(doc.activeElement);
const shown = distinct(Array.isArray(all) ? all : []);
const inline = shown.filter((credit) => credit.inline);
const listed = shown.filter((credit) => !credit.inline);
line.replaceChildren();
inline.forEach((credit, i) => {
if (i) line.append(doc.createTextNode(' · '));
line.append(creditElement(doc, credit));
});
if (inline.length && listed.length) line.append(doc.createTextNode(' · '));
list.replaceChildren(
...listed.map((credit) => {
const item = doc.createElement('li');
item.append(creditElement(doc, credit));
return item;
}),
);
expand.hidden = listed.length === 0;
if (expand.hidden && !panel.hidden) {
inline = shown.filter((credit) => credit.inline);
listed = shown.filter((credit) => !credit.inline);
paint();
if (listed.length === 0 && open) {
// Focus in the list goes back to the line, not to the page.
setOpen(false);
if (focused) (line.querySelector('a') ?? bar).focus();
} else if (focused && !panel.contains(doc.activeElement)) {
// A link that focus was on was redrawn: focus stays in the list.
close.focus();
elements.close.focus();
}
};
const onExpand = () => setOpen(panel.hidden);
const onClose = () => setOpen(false, { focus: true });
function onExpand() {
setOpen(!open);
}
function onClose() {
setOpen(false, { focus: true });
}
// Escape in the open list closes it (it takes focus as it opens).
const onKey = (event) => {
if (event.key !== 'Escape' || panel.hidden) return;
function onKeydown(event) {
if (event.key !== 'Escape' || !open) return;
event.preventDefault();
setOpen(false, { focus: true });
};
expand.addEventListener('click', onExpand);
close.addEventListener('click', onClose);
panel.addEventListener('keydown', onKey);
label();
}
paint();
render(credits.list());
const offChange = credits.on('change', render);
const offLocale = onLocaleChange(label);
// The view words its text again in the new locale, as it renders.
const offLocale = onLocaleChange(paint);
return () => {
offChange();
offLocale();
expand.removeEventListener('click', onExpand);
close.removeEventListener('click', onClose);
panel.removeEventListener('keydown', onKey);
bar.remove();
panel.remove();
renderVue(null, host);
};
}
+56 -1
View File
@@ -4,6 +4,7 @@ import assert from 'node:assert/strict';
import { mountCreditsView } from './creditsView.js';
import { bindRenderer } from '../render/rendererOf.js';
import { createStubRenderer } from '../render/stub/index.js';
import { setLocale } from '../i18n/index.js';
function scene() {
document.body.replaceChildren();
@@ -118,10 +119,12 @@ test('focus in the list stays in it as it redraws, and goes to the line as it em
const off = mountCreditsView(viewer);
const panel = document.getElementById('gev-credits-panel');
document.querySelector('.gev-credits-expand').click();
panel.querySelector('li a').focus();
const link = panel.querySelector('li a');
link.focus();
const removeOther = renderer.credits.addStatic({ text: 'NOAA' });
assert.equal(panel.hidden, false);
assert.ok(panel.contains(document.activeElement), 'still in the list');
assert.equal(document.activeElement, link, 'the focused link keeps it');
remove();
removeOther();
assert.equal(panel.hidden, true);
@@ -152,3 +155,55 @@ test('a credit with linked words links only those words', () => {
);
off();
});
test('the line and its list follow the locale', () => {
const { viewer, renderer } = scene();
renderer.credits.addStatic({ text: 'NOAA' });
const off = mountCreditsView(viewer);
const expand = document.querySelector('.gev-credits-expand');
const close = document.querySelector('.gev-credits-close');
try {
setLocale('fr');
assert.equal(expand.textContent, 'Attribution des données');
assert.equal(
document.getElementById('gev-credits-panel-title').textContent,
'Données fournies par\u202f:',
);
assert.equal(
close.getAttribute('aria-label'),
"Fermer l'attribution des données",
);
} finally {
setLocale('en');
}
assert.equal(expand.textContent, 'Data attribution');
off();
});
test('the line and its list are the last of the body, and its close button is the kit’s', () => {
const { viewer, renderer } = scene();
document.body.append(document.createElement('main'));
renderer.credits.addStatic({ text: 'NOAA' });
const off = mountCreditsView(viewer);
const children = [...document.body.children];
assert.deepEqual(
children.slice(-2).map((element) => element.id),
['gev-credits', 'gev-credits-panel'],
'the page’s rules select them as children of the body',
);
const close = document.querySelector('.gev-credits-close');
assert.ok(close.classList.contains('ui-button'), 'a UiCloseButton');
assert.equal(close.type, 'button');
assert.equal(close.textContent, '×');
assert.equal(close.hasAttribute('title'), false, 'no tip');
assert.equal(
close.classList.contains('ui-close-button'),
false,
'bare: it keeps the browser’s padding',
);
off();
assert.deepEqual(
[...document.body.children].map((element) => element.tagName),
['MAIN'],
);
});
+2 -2
View File
@@ -64,8 +64,8 @@ export class DisplayBindings {
},
toggleOrbit: () => this._toggleOrbit(),
toggleCleanView: () => this.toggleCleanView(),
toggleLayers: () =>
document.getElementById('data-panel').classList.toggle('active'),
// Same collapse as the panel's own button, so its rail entry stays.
toggleLayers: () => this._togglePanel('data-panel'),
cycleDetection: () => {
this.shareLinkManager?.claimRestoreLane?.('visual');
this.claimDetection();
+6 -2
View File
@@ -72,7 +72,11 @@ function settings(store) {
test('before VisualSettings renders, the panel shows its initial markup', (t) => {
const { $ } = fixture(t);
assert.equal($('bloom-toggle').className, 'pp-toggle-btn');
// Beside the kit's ui-* classes, the toggle carries only its own.
assert.deepEqual(
[...$('bloom-toggle').classList].filter((name) => !name.startsWith('ui-')),
['pp-toggle-btn'],
);
assert.equal($('bloom-slider-row').className, 'pp-slider-row');
assert.equal($('bloom-intensity-slider').value, '0');
assert.equal($('bloom-intensity-value').textContent, '0%');
@@ -553,7 +557,7 @@ test('the imported files render what the file import publishes and keep focus',
assert.equal(name.textContent, '<b>a</b>.geojson');
assert.equal(name.children.length, 0, 'the name is text');
assert.match(name.title, /GEOJSON, 2 map objects$/);
assert.equal(toggle.className, 'geo-import-action');
assert.ok(toggle.classList.contains('geo-import-action'));
assert.equal(toggle.getAttribute('type'), 'button');
assert.equal(toggle.getAttribute('aria-pressed'), 'true');
assert.equal(toggle.getAttribute('aria-label'), 'Hide <b>a</b>.geojson');
+1 -1
View File
@@ -162,7 +162,7 @@ export function initGeoFileImport({
? t('Hide {name}', { name: item.name })
: t('Show {name}', { name: item.name }),
action: 'toggle',
pressed: String(item.visible),
pressed: Boolean(item.visible),
},
{
icon: 'my_location',
+1 -1
View File
@@ -220,7 +220,7 @@ test('row buttons hide, show, fly to and remove a file', async () => {
shapes: [],
});
assert.equal(t.tool.list()[0].visible, false);
assert.equal(action(rows(t)[0], 'toggle').pressed, 'false');
assert.equal(action(rows(t)[0], 'toggle').pressed, false);
assert.equal(action(rows(t)[0], 'toggle').icon, 'visibility_off');
assert.equal(action(rows(t)[0], 'toggle').label, 'Show a.gpx');
glyphClick('fly');
+1 -1
View File
@@ -53,7 +53,7 @@ test('the divider renders on the body with its labels and slider', async (t) =>
assert.equal(after.title, 'After');
assert.equal(handle.tagName, 'BUTTON');
assert.equal(handle.type, 'button');
assert.equal(handle.className, 'split-handle');
assert.ok(handle.classList.contains('split-handle'));
assert.equal(handle.textContent, '↔');
assert.equal(handle.getAttribute('role'), 'slider');
assert.equal(handle.getAttribute('aria-label'), 'Divider');
+150
View File
@@ -0,0 +1,150 @@
// The AI chat panel's and the voice control's buttons and Material glyphs
// are the kit's: neither their templates nor the voice card and panel
// layout buttons they render hand-write a <button> or a Material Symbols
// span. Their other glyphs (the chat bubble, the globe, attach, send and
// stop, expand and the two Back chevrons) are inline SVG drawn with their own
// strokes, which no Material symbol the page loads draws the same, so they
// stay SVG. The voice panel's Preview and Settings are tabs (`role="tab"`
// with `aria-selected`), not pressed toggles, and DISMISS is a text button,
// not a cross, so it is a UiButton rather than a UiCloseButton. The chat's
// message box, file picker and the minutes field stay native: the kit has
// no text area, file or number field. The voice modules build no controls
// in script.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync, readdirSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
/** A view's template block: everything outside script, style and comments. */
function template(file) {
const source = readFileSync(
new URL(`../views/panels/${file}`, import.meta.url),
'utf8',
);
return source
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
}
// A tag's attributes, read past quoted values so a handler's `=>` does not
// end the tag early.
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tag = (pattern, flags = '') =>
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
const tags = (markup, name) =>
markup.match(tag(String.raw`<${name}\bATTRS>`, 'g')) ?? [];
const views = {
// Settings, the quick prompts, an attachment's remove, Attach layer,
// Attach a file, Expand conversation, the command suggestions, Expand
// chat, Add attachment and Send / Stop reply.
'ChatPanel.vue': {
UiButton: 10,
UiCloseButton: 1,
UiIcon: 1,
UiSelect: 1,
svgs: 5,
},
// The tier button (dock and panel), the mic, Open AI chat, Back to chat,
// Back to voice, the Preview and Settings tabs and DISMISS.
'VoiceControl.vue': {
UiButton: 9,
UiCloseButton: 1,
UiIcon: 2,
UiSelect: 3,
UiCheckbox: 2,
svgs: 3,
},
'VoiceCard.vue': { UiButton: 0, UiCloseButton: 1, UiIcon: 0, svgs: 0 },
// Dock and minimize.
'PanelLayoutButtons.vue': { UiButton: 2, UiIcon: 0, svgs: 2 },
'VoiceVisualizer.vue': { UiButton: 0, UiIcon: 0, svgs: 1 },
};
const markup = Object.fromEntries(
Object.keys(views).map((file) => [file, template(file)]),
);
test('the chat and voice views hand-write no button; each is the kit', () => {
for (const [file, counts] of Object.entries(views)) {
assert.deepEqual(markup[file].match(/<button\b/gi) ?? [], [], file);
for (const name of ['UiButton', 'UiCloseButton', 'UiSelect', 'UiCheckbox'])
assert.equal(tags(markup[file], name).length, counts[name] ?? 0, file);
}
});
test('the pressed toggles take the kit pressed state', () => {
for (const [file, view] of Object.entries(markup))
assert.doesNotMatch(view, /aria-pressed/, file);
const voice = tags(markup['VoiceControl.vue'], 'UiButton');
const tiers = voice.filter((button) => /id="gev-voice-tier"/.test(button));
assert.equal(tiers.length, 2);
for (const tier of tiers)
assert.match(tier, /\s:pressed="Boolean\(view\.tier\.pressed\)"/);
// The mic writes no aria-pressed while its owner has no state for it.
assert.match(
markup['VoiceControl.vue'],
tag(
String.raw`<UiButton\s+id="gev-voice-button"ATTRS\s:pressed="view\.button\.pressed \?\? undefined"`,
),
);
assert.match(
markup['PanelLayoutButtons.vue'],
tag(
String.raw`<UiButton\s+data-layout-dockATTRS\s:pressed="props\.docked"`,
),
);
// The panel tabs are tabs: selected, never pressed.
const tabs = voice.filter((button) => /role="tab"/.test(button));
assert.equal(tabs.length, 2);
for (const button of tabs) {
assert.match(button, /\s:aria-selected="/);
assert.doesNotMatch(button, /\s:pressed=/);
}
});
test('the views hand-write no Material glyph; each is a UiIcon the site sizes', () => {
for (const [file, { UiIcon, svgs }] of Object.entries(views)) {
assert.deepEqual(markup[file].match(/material-symbols/g) ?? [], [], file);
const icons = tags(markup[file], 'UiIcon');
assert.equal(icons.length, UiIcon, file);
// Without it the kit writes an 18px size that beats voice-cost.css and
// voice-card.css.
for (const icon of icons) assert.match(icon, /\s:size="null"/, file);
assert.equal(markup[file].match(/<svg\b/g)?.length ?? 0, svgs, file);
}
assert.match(
markup['ChatPanel.vue'],
/<UiIcon name="settings" class="gev-voice-settings-icon" :size="null" \/>/,
);
assert.equal(
markup['VoiceControl.vue'].match(
/<UiIcon name="(?:visibility|settings)" class="gev-voice-panel-tab-icon" :size="null" \/>/g,
)?.length,
2,
);
});
test('the only native fields left are the message box, file picker and minutes', () => {
const inputs = Object.values(markup).flatMap((view) => tags(view, 'input'));
assert.equal(inputs.length, 2);
assert.match(inputs[0], /id="gev-chat-file" type="file"/);
assert.match(inputs[1], /id="gev-voice-timeout-input" type="number"/);
assert.equal(tags(markup['ChatPanel.vue'], 'textarea').length, 1);
for (const view of Object.values(markup)) {
assert.deepEqual(view.match(/<select\b/gi) ?? [], []);
assert.doesNotMatch(view, /type="(?:checkbox|range)"/);
}
});
test('the voice modules build no buttons or Material glyphs in script', () => {
const root = fileURLToPath(new URL('../../voice/', import.meta.url));
const modules = readdirSync(root, { recursive: true })
.filter((file) => file.endsWith('.js') && !/test|Harness/.test(file))
.map((file) => path.join(root, file));
assert.ok(modules.length > 50);
for (const file of modules) {
const source = readFileSync(file, 'utf8');
assert.doesNotMatch(source, /createElement\(\s*['"]button/, file);
assert.doesNotMatch(source, /<button\b|material-symbols/, file);
}
});
+2 -5
View File
@@ -1,5 +1,5 @@
// Every checkbox in a Vue view is a UiCheckbox: no SFC template hand-writes
// `<input type="checkbox">`. Story Explore's filters are not converted yet.
// `<input type="checkbox">`.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync, readdirSync } from 'node:fs';
@@ -8,10 +8,7 @@ import { fileURLToPath } from 'node:url';
const SRC_ROOT = fileURLToPath(new URL('../../', import.meta.url));
const REPO_ROOT = path.resolve(SRC_ROOT, '..');
const NOT_YET = new Set([
'src/ui/kit/UiCheckbox.vue',
'src/ui/views/stories/ExploreScreen.vue',
]);
const NOT_YET = new Set(['src/ui/kit/UiCheckbox.vue']);
/** Every SFC under src. */
function sfcFiles(directory = SRC_ROOT) {
+9 -3
View File
@@ -1,6 +1,7 @@
// Every close, dismiss and clear button in a Vue view is a UiCloseButton: no
// SFC template hand-writes a button whose only content is × or the Material
// `close` symbol. Buttons built in script are not read here.
// SFC template hand-writes a button whose only content is × (bare or in a
// span) or the Material `close` symbol. Buttons built in script are not read
// here.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync, readdirSync } from 'node:fs';
@@ -30,8 +31,10 @@ function template(source) {
// An opening tag's attributes, quoted values may hold `>` (`() => x`).
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const BUTTON = String.raw`(button|UiButton)`;
const TIMES = String.raw`×|&times;|&#215;|&#xd7;`;
const CLOSE_GLYPH = [
String.raw`×|&times;|&#215;|&#xd7;`,
TIMES,
String.raw`<span\b${ATTRS}>\s*(?:${TIMES})\s*</span\s*>`,
String.raw`<span\b[^>]*\bmaterial-symbols-outlined\b[^>]*>\s*close\s*</span\s*>`,
String.raw`<UiIcon${ATTRS}\bname="close"${ATTRS}/>`,
].join('|');
@@ -54,11 +57,14 @@ test('the scan finds each hand-written close glyph', () => {
'<template><UiButton class="x" :label="l">&times;</UiButton></template>',
'<template><button type="button" class="x">\n <span class="material-symbols-outlined" aria-hidden="true">close</span>\n</button></template>',
'<template><UiButton class="x"><UiIcon name="close" :size="14" /></UiButton></template>',
'<template><button type="button" :aria-label="l"><span aria-hidden="true">×</span></button></template>',
'<template><UiButton class="x">\n <span class="glyph">&times;</span>\n</UiButton></template>',
])
assert.equal(handWrittenCloses(markup).length, 1, markup);
for (const markup of [
'<template><UiCloseButton class="x" :label="l" /></template>',
'<template><button type="button">{{ name }} ×</button></template>',
'<template><button type="button"><span>{{ name }}</span> ×</button></template>',
'<template><button type="button">On<span class="material-symbols-outlined">close</span></button></template>',
'<template><button type="button"><span class="material-symbols-outlined">close_fullscreen</span></button></template>',
])
+148
View File
@@ -0,0 +1,148 @@
// The Cockpit HUD's controls and glyphs are the kit's: no Cockpit view
// hand-writes a <button>, a Material Symbols span, a select, a checkbox or a
// range. Its buttons are ghost UiButtons that keep their ids, classes and
// labels for the Cockpit controller's listeners and the cockpit stylesheets;
// its glyphs are UiIcons with `:size="null"`, so those stylesheets still size
// them. The utility strip's −, ◀ ▶ and transport glyphs and the orbital
// zoom's − and + are text characters, not Material symbols, and stay text.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readdirSync, readFileSync } from 'node:fs';
/** A view's template block: everything outside script, style and comments. */
function template(file) {
const source = readFileSync(
new URL(`../views/${file}`, import.meta.url),
'utf8',
);
return source
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
}
const views = {
// The vision selector's Previous, Current and Next, Look ahead, and the
// view switcher's Reset and Exit; the speed and altitude rims' pointers,
// the two vision chevrons, the reticle, the heading caret and the view
// switcher's two glyphs.
'CockpitView.vue': { buttons: 6, icons: 8 },
// Display's and Radio's collapse and launcher buttons, Radio's Enable,
// Previous, Play and Next, and the desktop rail's two items and glyphs.
'panels/CockpitUtilityControls.vue': { buttons: 10, icons: 2 },
// Previous, Next, Auto, the card's collapse and the three page tabs; the
// first, second and fourth draw a glyph.
'panels/CockpitBriefing.vue': { buttons: 7, icons: 3 },
// Previous, Next, the card's collapse and Weather; three of them draw a
// glyph, and the nearest contact's arrow is the fourth.
'panels/CockpitContext.vue': { buttons: 4, icons: 4 },
// A signal row's target and its chevron.
'panels/CockpitSignalList.vue': { buttons: 1, icons: 1 },
// TLE, Nadir, Zoom out, Zoom in and Sensor.
'panels/CockpitOrbital.vue': { buttons: 5, icons: 0 },
// The range step.
'panels/CockpitRadar.vue': { buttons: 1, icons: 0 },
// The flight plan's arrow.
'panels/CockpitRoute.vue': { buttons: 0, icons: 1 },
// Readouts only.
'panels/CockpitProgress.vue': { buttons: 0, icons: 0 },
'panels/CockpitRollingValue.vue': { buttons: 0, icons: 0 },
};
// A tag's attributes, read past quoted values so a handler's `=>` does not
// end the tag early.
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tag = (pattern, flags = '') =>
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
const markup = Object.fromEntries(
Object.keys(views).map((file) => [file, template(file)]),
);
test('every Cockpit view is in the list above', () => {
const dir = (sub) =>
readdirSync(new URL(`../views/${sub}`, import.meta.url))
.filter((name) => /^Cockpit.*\.vue$/.test(name))
.map((name) => sub + name);
assert.deepEqual(
[...dir(''), ...dir('panels/')].sort(),
Object.keys(views).sort(),
);
});
test('the Cockpit views hand-write no button; each is a UiButton', () => {
for (const [file, { buttons }] of Object.entries(views)) {
assert.deepEqual(markup[file].match(/<button\b/gi) ?? [], [], file);
assert.equal(
markup[file].match(/<UiButton\b/g)?.length ?? 0,
buttons,
file,
);
}
});
test('the Cockpit views hand-write no select, checkbox or range', () => {
for (const [file, view] of Object.entries(markup)) {
assert.deepEqual(view.match(/<(select|input)\b/gi) ?? [], [], file);
}
// The compact Radio volume.
assert.equal(
markup['panels/CockpitUtilityControls.vue'].match(/<UiSlider\b/g)?.length,
1,
);
});
test('the pressed toggles take the kit pressed state', () => {
for (const view of Object.values(markup))
assert.doesNotMatch(view, tag(String.raw`<\w+\bATTRS\s:?aria-pressed`));
const pressed = Object.values(markup).flatMap(
(view) =>
view.match(tag(String.raw`<UiButton\bATTRS\s:pressed=ATTRS>`, 'g')) ?? [],
);
// Radio's Enable, the briefing's Auto and the Contact card's Weather.
assert.equal(pressed.length, 3);
for (const button of pressed) assert.match(button, /:pressed="Boolean\(/);
assert.match(
markup['panels/CockpitUtilityControls.vue'],
tag(
String.raw`<UiButton\s+id="cockpit-radio-enable-btn"ATTRS\s:pressed="Boolean\(cockpit\?\.enable\.active\)" pressed-class="active"`,
),
);
assert.match(
markup['panels/CockpitBriefing.vue'],
tag(
String.raw`<UiButton\s+id="cockpit-brief-auto"ATTRS\s:pressed="Boolean\(b\.autoRotate\)"`,
),
);
assert.match(
markup['panels/CockpitContext.vue'],
tag(
String.raw`<UiButton\s+id="cockpit-weather-toggle"ATTRS\s:pressed="Boolean\(c\.weather\)"`,
),
);
});
test('the Cockpit views hand-write no Material glyph; each is a UiIcon', () => {
for (const [file, { icons }] of Object.entries(views)) {
assert.deepEqual(
markup[file].match(/material-symbols-outlined/g) ?? [],
[],
file,
);
const found =
markup[file].match(tag(String.raw`<UiIcon\bATTRS>`, 'g')) ?? [];
assert.equal(found.length, icons, file);
// Without it the kit writes an 18px size that beats the cockpit's rules.
for (const icon of found) assert.match(icon, /\s:size="null"/, file);
}
});
test('the heading caret outranks the kit icon rule that loads after it', () => {
const css = readFileSync(
new URL('../styles/cockpit.css', import.meta.url),
'utf8',
);
// kit.css's `.ui-icon` sets display and line-height with one class and
// loads after cockpit.css, so a one-class caret rule would lose to it.
assert.match(
css,
/\n\.cockpit-compass \.cockpit-heading-caret \{\n {2}display: block;/,
);
assert.doesNotMatch(css, /\n\.cockpit-heading-caret \{/);
});
+127
View File
@@ -0,0 +1,127 @@
// The command dock's and the Context panel's buttons and Material glyphs are
// the kit's: neither the dock, the Context view nor the view context it
// shows while nothing is picked hand-writes a <button> or a Material Symbols
// span. The dock's style buttons are pressed toggles with `active`, its
// glyphs (◯ ▦ 🌙 🌡️ ✦ ◐, the search 🔎 and the collapse +) are text
// characters, not Material symbols, and stay plain text. Context's tabs and
// its Contacts mode button are `role="tab"` controls: they say they are
// chosen with `aria-selected` and keep their own `active` class, never
// `aria-pressed`.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
/** A view's template block: everything outside script, style and comments. */
function template(file) {
const source = readFileSync(
new URL(`../views/${file}`, import.meta.url),
'utf8',
);
return source
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
}
// A tag's attributes, read past quoted values so a handler's `=>` does not
// end the tag early.
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tag = (pattern, flags = '') =>
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
const tags = (markup, name) =>
markup.match(tag(String.raw`<${name}\bATTRS>`, 'g')) ?? [];
const dock = template('CommandDockView.vue');
const context = template('ContextView.vue');
const inView = template('panels/ViewContext.vue');
const views = {
// The six style buttons, the two tray toggles and their pins, the map
// source chips, Location's collapse, its landmark and city pills and the
// search toggle.
'CommandDockView.vue': { markup: dock, buttons: 15, icons: 0, closes: 0 },
// Search and Expand in the header, the two tabs, Contacts, the cockpit
// entry, SEARCH NEARBY SITES and the TR-3B chip.
'ContextView.vue': { markup: context, buttons: 8, icons: 7, closes: 0 },
// An off layer's worldwide tile, an item's row, the place and layer chips
// and Ask GEV; a layer's Turn off is a UiCloseButton. The glyphs: the
// header's eye, a worldwide tile's (on and off), a layer group's, an
// item's motion and the layer chips' add.
'panels/ViewContext.vue': { markup: inView, buttons: 5, icons: 6, closes: 1 },
};
test('the dock and Context hand-write no button; each is a UiButton', () => {
for (const [file, { markup, buttons, closes }] of Object.entries(views)) {
assert.deepEqual(markup.match(/<button\b/gi) ?? [], [], file);
assert.deepEqual(markup.match(/<component\b/gi) ?? [], [], file);
assert.equal(tags(markup, 'UiButton').length, buttons, file);
assert.equal(tags(markup, 'UiCloseButton').length, closes, file);
}
});
test('the style buttons are pressed toggles with active', () => {
assert.doesNotMatch(dock, /v-class-toggle="\{[^"]*\bactive\b/);
const styles = tags(dock, 'UiButton').filter((b) =>
/class="style-btn"/.test(b),
);
assert.deepEqual(
styles.map((b) => b.match(/data-style="(\w+)"/)[1]),
['normal', 'retro', 'surveillance', 'thermal', 'anime', 'noir'],
);
for (const button of styles) {
const name = button.match(/data-style="(\w+)"/)[1];
assert.match(button, /\spressed-class="active"/, name);
// Normal stays the pressed one until a style is published.
assert.match(
button,
name === 'normal'
? /\s:pressed="!style \|\| style\.name === 'normal'"/
: new RegExp(String.raw`\s:pressed="style\?\.name === '${name}'"`),
name,
);
}
});
test('no tag hand-writes aria-pressed; the pressed toggles take :pressed', () => {
for (const [file, { markup }] of Object.entries(views))
assert.doesNotMatch(
markup,
tag(String.raw`<\w+\bATTRS\s:?aria-pressed`),
file,
);
const pressed = (markup) =>
tags(markup, 'UiButton').filter((b) => /\s:pressed=/.test(b)).length;
// The six styles, two pins, map sources, landmarks and cities.
assert.equal(pressed(dock), 11);
// Search, Expand and TR-3B.
assert.equal(pressed(context), 3);
assert.equal(pressed(inView), 0);
});
test("Context's tabs say they are chosen, not pressed", () => {
const tabs = tags(context, 'UiButton').filter((b) => /\srole="tab"/.test(b));
assert.equal(tabs.length, 3);
for (const button of tabs) {
assert.match(button, /\s:aria-selected=/);
assert.doesNotMatch(button, /\s:pressed=/);
assert.match(button, /\s(?::class|v-class-toggle)="\{ active: /);
}
});
test('they hand-write no Material glyph; each is a UiIcon', () => {
for (const [file, { markup, icons }] of Object.entries(views)) {
assert.deepEqual(
markup.match(/material-symbols-outlined/g) ?? [],
[],
file,
);
const found = tags(markup, 'UiIcon');
assert.equal(found.length, icons, file);
// Without it the kit writes an 18px size that beats the site rules.
for (const icon of found) assert.match(icon, /\s:size="null"/, file);
}
// An item's motion glyph is an image with its own name, not decoration.
const [motion] = tags(inView, 'UiIcon').filter((i) =>
/view-context__row-motion/.test(i),
);
assert.match(motion, /\srole="img"/);
assert.match(motion, /\s:aria-label=/);
assert.match(motion, /\s:aria-hidden="null"/);
});
+3 -2
View File
@@ -1,7 +1,8 @@
// Every modal dialog in a Vue view is a UiDialog: no SFC template hand-writes
// `<dialog>`. Panels drawn as `role="dialog"` (key setup, the welcome
// launcher, the CCTV popup, Story Explore's filter) and the render failure's
// `alertdialog` are other controls.
// launcher, the CCTV popup, Story Explore's filter, the credits, the Omnibar
// guide's callout) and the render failure's `alertdialog` are other
// controls.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync, readdirSync } from 'node:fs';
+126
View File
@@ -0,0 +1,126 @@
// UTILITIES ▸ Draw (its toggle, Clear, the colour swatches and the drawn
// shapes' rows), Import and the Street Level panel are on the kit: none of
// them hand-writes a <button>, a Material Symbols span, a select, a checkbox
// or a range. The Draw toggle is a pressed toggle with `active`. The colour
// swatches are `role="radio"` buttons: they say they are chosen with
// `aria-checked` and their own `active` class, never `aria-pressed`. A drawn
// shape's show/hide renames itself (Show …, Hide …) rather than being pressed.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const source = (file) =>
readFileSync(new URL(`../views/panels/${file}`, import.meta.url), 'utf8');
/** A view's template block: everything outside script, style and comments. */
const template = (file) =>
source(file)
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
// A tag's attributes, read past quoted values so a handler's `=>` does not
// end the tag early.
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tag = (pattern, flags = '') =>
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
const tags = (markup, name) =>
markup.match(tag(String.raw`<${name}\bATTRS>`, 'g')) ?? [];
const views = {
// Draw and Clear.
'DrawControls.vue': { buttons: 2, icons: 1, closes: 0 },
// The five colours, one v-for.
'DrawSwatches.vue': { buttons: 1, icons: 0, closes: 0 },
// A row's swatch, show/hide, the application's actions and fly to; remove
// is a UiCloseButton.
'DrawMarkList.vue': { buttons: 4, icons: 3, closes: 1 },
// Import and a file's row actions.
'GeoImport.vue': { buttons: 2, icons: 2, closes: 0 },
// The status toggle, EXPAND and the nearest-imagery button; the viewer's
// close. EXPAND's ⤢ ⤡ and the errors' ⚠ are text, not Material symbols.
'StreetLevelPanel.vue': { buttons: 3, icons: 0, closes: 1 },
};
const markup = Object.fromEntries(
Object.keys(views).map((file) => [file, template(file)]),
);
test('the Draw, Import and Street Level views hand-write no button', () => {
for (const [file, { buttons, closes }] of Object.entries(views)) {
const html = markup[file];
assert.deepEqual(html.match(/<button\b/gi) ?? [], [], file);
assert.deepEqual(html.match(/<component\b/gi) ?? [], [], file);
assert.equal(tags(html, 'UiButton').length, buttons, file);
assert.equal(tags(html, 'UiCloseButton').length, closes, file);
}
});
test('they hand-write no select, checkbox or range', () => {
for (const [file, html] of Object.entries(markup)) {
assert.deepEqual(html.match(/<select\b/gi) ?? [], [], file);
assert.doesNotMatch(
html,
tag(String.raw`<input\bATTRS\stype="(?:checkbox|range)"`),
file,
);
}
// SINCE is the kit's range.
assert.equal(tags(markup['StreetLevelPanel.vue'], 'UiSlider').length, 1);
});
test('they hand-write no Material glyph; each is a UiIcon sized by the site', () => {
for (const [file, { icons }] of Object.entries(views)) {
const html = markup[file];
assert.deepEqual(html.match(/material-symbols-outlined/g) ?? [], [], file);
const found = tags(html, 'UiIcon');
assert.equal(found.length, icons, file);
// Without it the kit writes an 18px size that beats the site rules.
for (const icon of found) assert.match(icon, /\s:size="null"/, file);
}
// Draw's and Import's glyphs keep pp-icon, which sizes them.
for (const file of ['DrawControls.vue', 'GeoImport.vue']) {
const [icon] = tags(markup[file], 'UiIcon');
assert.match(icon, /\sclass="pp-icon"/, file);
}
});
test('no tag hand-writes aria-pressed; Draw is a pressed toggle with active', () => {
for (const [file, html] of Object.entries(markup))
assert.doesNotMatch(
html,
tag(String.raw`<\w+\bATTRS\s:?aria-pressed`),
file,
);
const [draw] = tags(markup['DrawControls.vue'], 'UiButton').filter((b) =>
/\sid="draw-toggle"/.test(b),
);
assert.match(draw, /\s:pressed="draw\?\.active \?\? false"/);
assert.match(draw, /\spressed-class="active"/);
const [clear] = tags(markup['DrawControls.vue'], 'UiButton').filter((b) =>
/\sid="draw-clear"/.test(b),
);
assert.doesNotMatch(clear, /\s:pressed=/);
// A shape's show/hide says what it does in its name, not by being pressed.
for (const button of tags(markup['DrawMarkList.vue'], 'UiButton'))
assert.doesNotMatch(button, /\s:pressed=/);
});
test('the colour swatches are radios chosen by aria-checked, never pressed', () => {
const [swatch] = tags(markup['DrawSwatches.vue'], 'UiButton');
assert.match(swatch, /\srole="radio"/);
assert.match(
swatch,
/\s:aria-checked="String\(color === props\.modelValue\)"/,
);
assert.match(swatch, /\s:class="\{ active: color === props\.modelValue \}"/);
assert.doesNotMatch(swatch, /\s:pressed=|\spressed-class=/);
});
test('code that focuses a converted button reaches its element', () => {
// A template ref on a component holds the component, not the button.
assert.match(
source('DrawSwatches.vue'),
/:ref="\(swatch\) => \(buttons\[index\] = swatch\?\.\$el\)"/,
);
assert.match(
source('GeoImport.vue'),
/importButton\.value\?\.\$el\.focus\(\)/,
);
});
+84
View File
@@ -0,0 +1,84 @@
// The entity card's buttons and Material glyphs are the kit's: neither its
// template nor the camera preview and nearby lists it renders hand-writes a
// <button> or a Material Symbols span. The Ask GEV button's chat bubble is
// not a Material symbol the page loads, so it stays drawn as inline SVG; the
// hero views (model, route globe, cockpit view, ground view, graphs) draw
// their own pictures and have no controls.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
/** A view's template block: everything outside script and style. */
function template(file) {
const source = readFileSync(
new URL(`../views/panels/${file}`, import.meta.url),
'utf8',
);
return source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
}
const card = template('EntityCard.vue');
const camera = template('CctvPreview.vue');
const nearby = template('SpotConditions.vue');
const heroViews = [
'AircraftModelHero.vue',
'RouteGlobe.vue',
'FlightCockpitView.vue',
'SatelliteGroundView.vue',
'PreviewHud.vue',
'AltitudeGraph.vue',
].map(template);
test('the entity card hand-writes no button; each is a UiButton', () => {
for (const markup of [card, camera, nearby, ...heroViews])
assert.deepEqual(markup.match(/<button\b/gi) ?? [], []);
// Photos, Route, 3D, Cockpit view, the cockpit entry, Fly to, Follow and
// Ask GEV.
assert.equal(card.match(/<UiButton\b/g)?.length, 8);
assert.equal(card.match(/<UiCloseButton\b/g)?.length, 1);
// A camera's bigger view and More info; its popup closes with a UiCloseButton.
assert.equal(camera.match(/<UiButton\b/g)?.length, 2);
assert.equal(camera.match(/<UiCloseButton\b/g)?.length, 1);
// The traffic, hazard, alert and other nearby rows.
assert.equal(nearby.match(/<UiButton\b/g)?.length, 4);
});
test('the preview switch and Follow are pressed toggles with their classes', () => {
const previews = card.match(/<UiButton v-if="\w+" :pressed[^>]*>/g) ?? [];
assert.equal(previews.length, 4);
for (const button of previews) {
assert.match(button, /pressed-class="active"/);
assert.doesNotMatch(button, /aria-pressed|:class=/);
}
assert.match(
card,
/<UiButton v-if="store\.canFollow\(\)" class="entity-card__action" :pressed="Boolean\(store\.isFollowing\(\)\)" pressed-class="entity-card__action--on"/,
);
});
test('the entity card hand-writes no Material glyph; each is a UiIcon', () => {
for (const markup of [card, camera, nearby, ...heroViews])
assert.deepEqual(markup.match(/material-symbols-outlined/g) ?? [], []);
const counts = [
// The preview switch's three, the hero glyph, the header icon, the
// warning, the route's plane, the route note and the three actions.
[card, 11],
// Bigger view, the popup's camera and More info.
[camera, 3],
// The two weather glyphs, five headings and three row glyphs.
[nearby, 10],
];
for (const [markup, count] of counts) {
const icons = markup.match(/<UiIcon\b[^>]*>/g) ?? [];
assert.equal(icons.length, count);
// Without it the kit writes an 18px size that beats the card's own rules.
for (const icon of icons) assert.match(icon, /:size="null"/);
}
});
test('the only inline SVG glyph is the Ask GEV chat bubble', () => {
const svgs = [...card.matchAll(/<svg\b[\s\S]*?<\/svg\s*>/g)].map((m) => m[0]);
assert.equal(svgs.length, 1);
assert.match(svgs[0], /<path d="M4 5h16v11H9l-5 4z" \/>/);
for (const markup of [camera, nearby])
assert.deepEqual(markup.match(/<svg\b/gi) ?? [], []);
});
+50
View File
@@ -0,0 +1,50 @@
// The Layer Finder's buttons and Material glyphs are the kit's: its template
// hand-writes no <button>, aria-pressed, Material Symbols span or inline SVG.
// Its search field is a UiSearchField.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
/** A view's template block: everything outside script and style. */
function template(file) {
const source = readFileSync(
new URL(`../views/panels/${file}`, import.meta.url),
'utf8',
);
return source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
}
const finder = template('LayerFinder.vue');
test('the Layer Finder hand-writes no button; each is a UiButton', () => {
assert.deepEqual(finder.match(/<button\b/gi) ?? [], []);
// Search, Filter, the Status and Category options, and the two chips.
assert.equal(finder.match(/<UiButton\b/g)?.length, 6);
assert.equal(finder.match(/<UiSearchField\b/g)?.length, 1);
});
test('its pressed toggles leave aria-pressed to UiButton', () => {
assert.deepEqual(finder.match(/aria-pressed/g) ?? [], []);
const pressed = finder.match(/<UiButton\b[^>]*:pressed=[^>]*>/g) ?? [];
// Search and the Status and Category options.
assert.equal(pressed.length, 3);
// Only the options' active class follows their pressed state; Search's
// also stays on while a query is typed, so it keeps its own binding.
assert.equal(
pressed.filter((tag) => tag.includes('pressed-class="active"')).length,
2,
);
assert.match(
finder,
/id="layer-finder-search-btn"[^>]*:class="\{ active: searching \|\| query \}"/,
);
});
test('the Layer Finder hand-writes no Material glyph; each is a UiIcon', () => {
assert.deepEqual(finder.match(/material-symbols-outlined/g) ?? [], []);
assert.deepEqual(finder.match(/<svg\b/gi) ?? [], []);
const icons = finder.match(/<UiIcon\b[^>]*>/g) ?? [];
// Search, Filter, the two option radios and the two chips' close.
assert.equal(icons.length, 6);
// Without it the kit writes an 18px size that beats layer-finder.css.
for (const icon of icons) assert.match(icon, /:size="null"/);
});
+37
View File
@@ -0,0 +1,37 @@
// The Omnibar's buttons and Material glyphs are the kit's: its template
// hand-writes no <button> and no Material Symbols span. Its two inline SVG
// glyphs (the mic and the chat row's bubble) are not Material symbols the
// page loads, so they stay as they are drawn.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const source = readFileSync(
new URL('../views/panels/Omnibar.vue', import.meta.url),
'utf8',
);
/** The template block: everything outside script and style. */
const template = source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
test('the Omnibar hand-writes no button; each is a UiButton', () => {
assert.deepEqual(template.match(/<button\b/gi) ?? [], []);
assert.equal(template.match(/<UiButton\b/g)?.length, 2);
});
test('the Omnibar hand-writes no Material glyph; each is a UiIcon', () => {
assert.deepEqual(template.match(/material-symbols-outlined/g) ?? [], []);
const icons = template.match(/<UiIcon\b[^>]*>/g) ?? [];
assert.equal(icons.length, 3);
// Without it the kit writes an 18px size that beats the Omnibar's own rules.
for (const icon of icons) assert.match(icon, /:size="null"/);
});
test('the only inline SVG glyphs are the mic and the chat row bubble', () => {
const svgs = [...template.matchAll(/<svg\b[\s\S]*?<\/svg\s*>/g)].map(
(m) => m[0],
);
assert.equal(svgs.length, 2);
assert.match(svgs[0], /<rect x="9" y="3" width="6" height="11" rx="3" \/>/);
assert.match(svgs[1], /class="omnibar-item-icon"/);
assert.match(svgs[1], /<path d="M4 5h16v11H9l-5 4z" \/>/);
});
+135
View File
@@ -0,0 +1,135 @@
// The small surfaces' buttons and Material glyphs are the kit's: the locale
// picker, the phone tab bar, the globe actions and compass, the imagery
// divider, the scene sharing dialog, the layer group index, the celestial
// ring, the title logo, Exit clean view, the HUD's cockpit entry, the News
// cards, the rail cards, the layer rows' toggles, the credits line and the
// camera calibration chips hand-write no <button> and no Material Symbols
// span. The Omnibar guide's extra rings are its template's, not built in
// script. The locale picker's globe, caret and check and a News card's
// category icon stay inline SVG: none is a Material symbol the page loads.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const read = (file) =>
readFileSync(new URL(`../${file}`, import.meta.url), 'utf8');
/** The template block: everything outside script, style and comments. */
const template = (file) =>
read(file)
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
// An opening tag's attributes, quoted values may hold `>` (`() => x`).
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tags = (markup, name) =>
markup.match(new RegExp(String.raw`<${name}\b${ATTRS}>`, 'g')) ?? [];
// Per file: its UiButtons, UiCloseButtons and UiIcons.
const SURFACES = {
'views/panels/LocalePicker.vue': [1, 0, 0],
'views/panels/PhoneTabBar.vue': [1, 0, 1],
'views/panels/GlobeCompass.vue': [1, 0, 1],
// Clear, share, tilt and reset; the clear, tilt and reset glyphs.
'views/panels/GlobeActions.vue': [4, 0, 3],
'views/panels/ImagerySplitView.vue': [1, 0, 0],
// The body's buttons and the footer's.
'views/panels/SceneDialog.vue': [2, 0, 0],
'views/panels/LayerSectionIndex.vue': [1, 0, 0],
// The sun and moon markers.
'views/panels/CelestialRing.vue': [0, 0, 2],
'views/panels/OmnibarGuide.vue': [3, 1, 0],
// The overlay targets' buttons and the title logo.
'views/SceneChromeView.vue': [2, 0, 0],
'views/DisplayControlsView.vue': [1, 0, 0],
'views/IntelHudView.vue': [1, 0, 1],
// The card's face and the selected card's clear chip.
'news/NewsCard.vue': [2, 0, 0],
'rail/RailCard.vue': [1, 0, 0],
'layerPanel/LayerRows.vue': [1, 0, 0],
'credits/CreditsView.vue': [1, 1, 0],
'cctv/CctvCalValue.vue': [1, 0, 0],
};
test('the small surfaces hand-write no button; each is a kit button', () => {
for (const [file, [buttons, closes]] of Object.entries(SURFACES)) {
const markup = template(file);
assert.deepEqual(markup.match(/<button\b/gi) ?? [], [], file);
assert.equal(tags(markup, 'UiButton').length, buttons, file);
assert.equal(tags(markup, 'UiCloseButton').length, closes, file);
}
});
test('the small surfaces hand-write no Material glyph; each is a UiIcon', () => {
for (const [file, [, , count]] of Object.entries(SURFACES)) {
const markup = template(file);
assert.deepEqual(
markup.match(/material-symbols-outlined/g) ?? [],
[],
file,
);
const icons = tags(markup, 'UiIcon');
assert.equal(icons.length, count, file);
// Without it the kit writes an 18px size that beats the sites' own rules.
for (const icon of icons) assert.match(icon, /\s:size="null"/, file);
}
});
test('the only inline SVG glyphs are the locale picker’s and a News category’s', () => {
for (const file of Object.keys(SURFACES)) {
const expected =
file === 'views/panels/LocalePicker.vue'
? 3
: file === 'news/NewsCard.vue'
? 1
: 0;
assert.equal(template(file).match(/<svg\b/g)?.length ?? 0, expected, file);
}
});
test('buttons whose owner patches synchronously redraw their contents with it', () => {
// A UiButton's slot renders inside the button, a tick after a change the
// button's own attributes do not carry; a conditional slot is redrawn with
// its view.
// How many of each file's first buttons the owner redraws and reads.
for (const [file, count] of [
['news/NewsCard.vue', 1],
['rail/RailCard.vue', 1],
['credits/CreditsView.vue', 1],
['views/panels/OmnibarGuide.vue', 3],
]) {
const markup = template(file);
const buttons = tags(markup, 'UiButton').slice(0, count);
assert.equal(buttons.length, count, file);
let from = 0;
for (const button of buttons) {
from = markup.indexOf(button, from) + button.length;
assert.match(
markup.slice(from),
/^\s*<template v-if="redrawWithView" #default\s*>/,
file,
);
}
assert.match(read(file), /const redrawWithView = true;/, file);
}
});
test('the Omnibar guide draws its extra rings in its template', () => {
const guide = template('views/panels/OmnibarGuide.vue');
assert.match(
guide,
/<div\s+v-for="i in view\.subRings"\s+:key="i"\s+class="gev-guide-ring gev-guide-ring--sub"\s*><\/div\s*>\s*<\/div\s*>\s*<\/Teleport/,
);
const owner = read('omnibarGuide.js');
assert.deepEqual(owner.match(/createElement\(/g), ['createElement(']);
assert.doesNotMatch(owner, /\.className\s*=|\.append\(/);
assert.match(owner, /view\.subRings = rest\.length;\s*paint\(\);/);
});
test('the layer disclosure builds no control', () => {
// Its one `<button` is a comment's word for the element Chromium focuses.
const disclosure = read('panelDisclosure.js');
assert.doesNotMatch(disclosure, /createElement|innerHTML|insertAdjacentHTML/);
const code = disclosure
.replace(/\/\/.*$/gm, '')
.replace(/\/\*[\s\S]*?\*\//g, '');
assert.doesNotMatch(code, /<button/);
});
+108
View File
@@ -0,0 +1,108 @@
// The Stories views' buttons and checkboxes are the kit's: neither the
// Stories entry nor any Explore or Story screen hand-writes a <button> or an
// `<input type="checkbox">`. Their glyphs are inline SVG drawn for Stories
// (play, pause, back, filter, search, clear, expand, the GEV eye); no
// Material symbol the page loads draws any of them the same, so they stay
// SVG, and no view hand-writes a Material Symbols span. The three search
// fields (Explore's two and the Story context sheet's) keep their own markup
// rather than UiSearchField, whose Material magnifier would replace their
// SVG one, and Explore's two clear buttons stay ghost UiButtons with an SVG
// cross rather than UiCloseButtons, whose glyph is × or the Material `close`
// symbol.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
/** A view's template block: everything outside script and style. */
function template(file) {
const source = readFileSync(
new URL(`../views/${file}`, import.meta.url),
'utf8',
);
return source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
}
const views = {
// The Stories entry, the popup's Browse stories and Not now, and the
// toast's Back to story.
'StoriesView.vue': { buttons: 4, svgs: 2 },
// The list grip, Filter, the two search clears, the topic chips (All and
// each topic), the filter's Clear and Show, Clear all, a card's thumbnail
// play and Play story, the map pins and the preview's Play story.
'stories/ExploreScreen.vue': { buttons: 13, svgs: 8 },
// Back, the logo, the breadcrumb's link, search, Share and Back to GEV or
// GEV Stories.
'stories/StoriesHeader.vue': { buttons: 8, svgs: 5 },
// The sheet handle, voice search, the search results, Close, the key
// moments and the related stories.
'stories/StoryContext.vue': { buttons: 6, svgs: 3 },
// Open in GEV and Share.
'stories/StoryRail.vue': { buttons: 2, svgs: 1 },
// A chapter, Minimise, Expand, the card's page dots, the big Play and
// Context.
'stories/StoryScreen.vue': { buttons: 6, svgs: 5 },
// Play, the key moment pips and Expand map.
'stories/StoryTimeline.vue': { buttons: 3, svgs: 2 },
};
// A tag's attributes, read past quoted values so a handler's `=>` does not
// end the tag early.
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tag = (pattern, flags = '') =>
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
const markup = Object.fromEntries(
Object.keys(views).map((file) => [file, template(file)]),
);
test('the Stories views hand-write no button; each is a UiButton', () => {
for (const [file, { buttons }] of Object.entries(views)) {
assert.deepEqual(markup[file].match(/<button\b/gi) ?? [], [], file);
assert.equal(markup[file].match(/<UiButton\b/g)?.length, buttons, file);
}
});
test('the pressed toggles take the kit pressed state', () => {
for (const view of Object.values(markup))
assert.doesNotMatch(view, tag(String.raw`<UiButton\bATTRS\saria-pressed`));
const explore = markup['stories/ExploreScreen.vue'];
// All, each topic and the map pins; the cards are role="button" divs that
// keep their own aria-pressed.
assert.equal(
explore.match(tag(String.raw`<UiButton\bATTRS\s:pressed=`, 'g'))?.length,
3,
);
assert.match(
explore,
tag(String.raw`class="card"\s+role="button"ATTRS\s:aria-pressed=`),
);
assert.match(
markup['stories/StoryScreen.vue'],
tag(String.raw`<UiButton\s+id="btnCtx"ATTRS\s:pressed="ctxOpen"`),
);
assert.match(
markup['stories/StoryTimeline.vue'],
tag(String.raw`<UiButton\s+id="stExpand"ATTRS\s:pressed="expanded"`),
);
});
test("Explore's filter options are UiCheckboxes in their own label", () => {
const explore = markup['stories/ExploreScreen.vue'];
assert.deepEqual(
explore.match(tag(String.raw`<input\bATTRS\stype="checkbox"`, 'g')) ?? [],
[],
);
const boxes = explore.match(tag(String.raw`<UiCheckbox\bATTRS>`, 'g')) ?? [];
assert.equal(boxes.length, 1);
assert.match(boxes[0], /class="fopt"/);
// Controlled, so the box always shows the applied filter.
assert.match(boxes[0], /:model-value="Boolean\(/);
});
test('the glyphs stay inline SVG; no view hand-writes a Material span', () => {
for (const [file, { svgs }] of Object.entries(views)) {
assert.deepEqual(
markup[file].match(/material-symbols-outlined/g) ?? [],
[],
file,
);
assert.equal(markup[file].match(/<svg\b/g)?.length, svgs, file);
}
});
+174
View File
@@ -0,0 +1,174 @@
// The kit's every-control claims in docs/VUE-MIGRATION.md, read from every
// SFC outside the kit: every select is a UiSelect, every pressed toggle a
// UiButton with `pressed` (no template hand-writes `aria-pressed` on any
// element, as an attribute or inside a `v-bind` object, apart from the
// exceptions below), and every close, dismiss and clear button a
// UiCloseButton.
// Controls built in script are not read here.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync, readdirSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const SRC_ROOT = fileURLToPath(new URL('../../', import.meta.url));
const KIT_ROOT = fileURLToPath(new URL('./', import.meta.url));
const REPO_ROOT = path.resolve(SRC_ROOT, '..');
// The pressed toggles that still hand-write `aria-pressed`, by file: each
// pattern matches exactly one of the file's tags, and no other tag may.
const HAND_WRITTEN_PRESSED = {
// The cinematic button renders the attributes the Bhote Koshi layer
// writes for it, `aria-pressed` among them.
'src/ui/views/panels/BhoteKoshiPanel.vue': [/^<button\b[^]*\bcinematic/],
// Explore's story cards are `role="button"` elements, not buttons.
'src/ui/views/stories/ExploreScreen.vue': [
/^<div class="card" role="button"/,
],
};
/** Every SFC under src, outside the kit. */
function sfcFiles(directory = SRC_ROOT) {
const files = [];
for (const entry of readdirSync(directory, { withFileTypes: true })) {
const absolute = path.join(directory, entry.name);
if (entry.isDirectory()) {
if (path.relative(KIT_ROOT, absolute) !== '')
files.push(...sfcFiles(absolute));
} else if (entry.isFile() && entry.name.endsWith('.vue'))
files.push(absolute);
}
return files.sort();
}
/** The template block: everything outside script, style and comments. */
function template(source) {
return source
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
}
// An opening tag's attributes, quoted values may hold `>` (`() => x`).
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const RAW_SELECT = /<select\b/gi;
const ANY_TAG = new RegExp(String.raw`<[A-Za-z][\w-]*\b(${ATTRS})>`, 'g');
// An attribute's name, outside the quoted values.
const names = (attrs) => attrs.replace(/"[^"]*"|'[^']*'/g, '""');
const PRESSED = /(?:^|\s)(?::|v-bind:)?aria-pressed(?=[\s=/]|$)/;
// A `v-bind` object that names aria-pressed.
const BOUND_PRESSED =
/(?:^|\s)(?:v-bind|:)=(?:"[^"]*aria-?pressed[^"]*"|'[^']*aria-?pressed[^']*')/i;
const TIMES = String.raw`×|&times;|&#215;|&#xd7;`;
const CLOSE_GLYPH = [
TIMES,
String.raw`<span\b${ATTRS}>\s*(?:${TIMES})\s*</span\s*>`,
String.raw`<span\b[^>]*\bmaterial-symbols-outlined\b[^>]*>\s*close\s*</span\s*>`,
String.raw`<UiIcon${ATTRS}\bname="close"${ATTRS}/>`,
].join('|');
const HAND_WRITTEN_CLOSE = new RegExp(
String.raw`<(button|UiButton)\b${ATTRS}>\s*(?:${CLOSE_GLYPH})\s*</\1\s*>`,
'gi',
);
const tidy = (markup) => markup.replace(/\s+/g, ' ');
/** Raw selects in an SFC's template. */
const rawSelects = (source) =>
[...template(source).matchAll(RAW_SELECT)].map((m) => m[0]);
/** Tags that hand-write aria-pressed. */
function handWrittenPressed(source) {
const found = [];
for (const m of template(source).matchAll(ANY_TAG))
if (PRESSED.test(names(m[1])) || BOUND_PRESSED.test(m[1]))
found.push(tidy(m[0]));
return found;
}
/** Hand-written close buttons in an SFC's template. */
const handWrittenCloses = (source) =>
[...template(source).matchAll(HAND_WRITTEN_CLOSE)].map((m) => tidy(m[0]));
const views = sfcFiles().map((file) => ({
file: path.relative(REPO_ROOT, file).split(path.sep).join('/'),
source: readFileSync(file, 'utf8'),
}));
test('the scans find each hand-written control', () => {
for (const markup of [
'<template><select id="x" v-model="a"><option>1</option></select></template>',
'<template><SELECT\n class="x"></SELECT></template>',
])
assert.equal(rawSelects(markup).length, 1, markup);
for (const markup of [
'<template><UiSelect id="x" v-model="a" /></template>',
'<script>const html = "<select>";</script><template><p /></template>',
'<template><!-- a <select> once sat here --><p /></template>',
])
assert.equal(rawSelects(markup).length, 0, markup);
for (const markup of [
'<template><button type="button" :aria-pressed="String(on)">A</button></template>',
'<template><UiButton\n class="x"\n :title="a > b ? 1 : 2"\n aria-pressed="true"\n>A</UiButton></template>',
'<template><button v-bind:aria-pressed="on">A</button></template>',
'<template><div class="card" role="button" tabindex="0" :aria-pressed="on" /></template>',
'<template><li role="option" :aria-pressed="on" /></template>',
'<template><a :role="\'button\'" :aria-pressed="on">A</a></template>',
'<template><UiButton v-bind="{ \'aria-pressed\': on }">A</UiButton></template>',
])
assert.equal(handWrittenPressed(markup).length, 1, markup);
for (const markup of [
'<template><UiButton :pressed="Boolean(on)" pressed-class="active">A</UiButton></template>',
'<template><button :title="\'aria-pressed\'" @click="q(\'[aria-pressed=true]\')">A</button></template>',
'<template><li role="option" :aria-selected="on" /></template>',
])
assert.equal(handWrittenPressed(markup).length, 0, markup);
for (const markup of [
'<template><button type="button" @click="close">×</button></template>',
'<template><button type="button" :aria-label="l"><span aria-hidden="true">×</span></button></template>',
'<template><UiButton class="x"><UiIcon name="close" :size="null" /></UiButton></template>',
])
assert.equal(handWrittenCloses(markup).length, 1, markup);
for (const markup of [
'<template><UiCloseButton class="x" :label="l" /></template>',
'<template><UiButton :label="l"><UiIcon :name="item.icon" :size="null" /></UiButton></template>',
])
assert.equal(handWrittenCloses(markup).length, 0, markup);
});
test('the views are read: the scan reaches the views and skips the kit', () => {
const files = views.map((view) => view.file);
assert.ok(files.includes('src/ui/views/panels/ChatPanel.vue'));
assert.ok(files.includes('src/ui/layerPanel/RowRange.vue'));
assert.ok(!files.some((file) => file.startsWith('src/ui/kit/')));
});
test('every select in the views is a UiSelect', () => {
const found = [];
for (const { file, source } of views)
for (const markup of rawSelects(source)) found.push(`${file}: ${markup}`);
assert.deepEqual(found, []);
});
test('no view hand-writes aria-pressed on a button outside the documented exceptions', () => {
const unexpected = [];
for (const { file, source } of views) {
const allowed = [...(HAND_WRITTEN_PRESSED[file] ?? [])];
for (const markup of handWrittenPressed(source)) {
const at = allowed.findIndex((pattern) => pattern.test(markup));
if (at === -1) unexpected.push(`${file}: ${markup}`);
else allowed.splice(at, 1);
}
assert.deepEqual(allowed, [], `${file}: an exception no longer matches`);
}
assert.deepEqual(unexpected, []);
});
test('no view hand-writes a close button; each is a UiCloseButton', () => {
const found = [];
for (const { file, source } of views)
for (const markup of handWrittenCloses(source))
found.push(`${file}: ${markup}`);
assert.deepEqual(found, []);
});
+53
View File
@@ -0,0 +1,53 @@
// The Visual panel's buttons and Material glyphs are the kit's: neither its
// template nor the presets it renders hand-writes a <button>, a Material
// Symbols span or an inline SVG. The toggles' text glyphs (◎ ▣ ✈ □ ✨ 🔍)
// and the presets' style glyphs are characters, not Material symbols, so
// they stay text the panel's rules size.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
/** A view's template block: everything outside script and style. */
function template(file) {
const source = readFileSync(
new URL(`../views/panels/${file}`, import.meta.url),
'utf8',
);
return source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
}
const panel = template('DisplayPanel.vue');
const presets = template('VisualPresets.vue');
test('the Visual panel hand-writes no button; each is a UiButton', () => {
for (const markup of [panel, presets])
assert.deepEqual(markup.match(/<button\b/gi) ?? [], []);
// HUD, Sonar, Detection, 3D, Clean UI, Celestial, Bloom, Sharpen and
// Reset to default.
assert.equal(panel.match(/<UiButton\b/g)?.length, 9);
// The style presets and the map source chips.
assert.equal(presets.match(/<UiButton\b/g)?.length, 2);
// Scope, the sky rows and the application's toggle rows.
assert.equal(panel.match(/<UiCheckbox\b/g)?.length, 3);
// 3D model coverage and detection label allocation.
assert.equal(panel.match(/<UiSegmented\b/g)?.length, 2);
});
test('the Visual panel hand-writes no Material glyph; each is a UiIcon', () => {
for (const markup of [panel, presets]) {
assert.deepEqual(markup.match(/material-symbols-outlined/g) ?? [], []);
assert.deepEqual(markup.match(/<svg\b/gi) ?? [], []);
}
const icons = panel.match(/<UiIcon\b[^>]*>/g) ?? [];
// Scope, Celestial, the sky rows, the application's rows and Reset.
assert.equal(icons.length, 5);
// Without it the kit writes an 18px size that beats the panel's own rules.
for (const icon of icons) assert.match(icon, /:size="null"/);
});
test('the toggles keep their text glyphs as plain spans', () => {
const glyphs = [...panel.matchAll(/<span class="pp-icon">([^<]*)<\/span>/g)];
assert.deepEqual(
glyphs.map((m) => m[1]),
['&#x25CE;', '&#x25A3;', '&#x2708;', '&#x25A1;', '&#x2728;', '&#x1F50D;'],
);
});
+37
View File
@@ -0,0 +1,37 @@
// The welcome card's buttons and Material glyphs are the kit's: its template
// hand-writes no <button> and no Material Symbols span, and its one box is a
// UiCheckbox. Its two inline SVGs (God mode's globe and its callouts) are
// drawings, not glyphs, and its outbound links stay links.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const source = readFileSync(
new URL('../views/WelcomeView.vue', import.meta.url),
'utf8',
);
/** The template block: everything outside script and style. */
const template = source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
test('the welcome card hand-writes no button; each is a UiButton', () => {
assert.deepEqual(template.match(/<button\b/gi) ?? [], []);
// SKIP, the three start tiles, BROWSE STORIES, BACK and the main action.
assert.equal(template.match(/<UiButton\b/g)?.length, 7);
assert.equal(template.match(/<UiCheckbox\b/g)?.length, 1);
});
test('the welcome card hand-writes no Material glyph; each is a UiIcon', () => {
assert.deepEqual(template.match(/material-symbols-outlined/g) ?? [], []);
const icons = template.match(/<UiIcon\b[^>]*>/g) ?? [];
// The three tiles, the three tips, the Stories card and the main arrow.
assert.equal(icons.length, 8);
// Without it the kit writes an 18px size that beats first-run.css's rules.
for (const icon of icons) assert.match(icon, /:size="null"/);
});
test('the only inline SVGs are God mode preview drawings', () => {
const svgs = [...template.matchAll(/<svg\b[^>]*>/g)].map((m) => m[0]);
assert.equal(svgs.length, 2);
assert.match(svgs[0], /class="first-run-globe"/);
assert.match(svgs[1], /class="first-run-callouts"/);
});
+3 -3
View File
@@ -5,6 +5,7 @@ import RowRange from './RowRange.vue';
import RowSlider from './RowSlider.vue';
import RowSwitch from './RowSwitch.vue';
import RowText from './RowText.vue';
import UiButton from '../kit/UiButton.vue';
import { vClassToggle } from '../rail/classToggle.js';
// The data layer rows under their group headings. LayerPanel presents every
@@ -45,8 +46,7 @@ defineProps({
v-if="item.count"
:class="['data-count', { 'data-count-empty': item.count.empty }]"
:text="item.count.text"
/><button
type="button"
/><UiButton
:class="['data-toggle-btn', item.toggle.classes]"
:data-feed-state="item.toggle.feedState"
:aria-disabled="String(item.toggle.ariaDisabled)"
@@ -54,7 +54,7 @@ defineProps({
:title="item.toggle.title"
:aria-label="item.toggle.ariaLabel"
@click="onToggle(item.id)"
>{{ item.toggle.text }}</button
>{{ item.toggle.text }}</UiButton
></div
></div
><RowText tag="div" class="data-toggle-meta" :text="item.meta" /><template
+10 -4
View File
@@ -1,7 +1,13 @@
<script setup>
import UiSelect from '../kit/UiSelect.js';
// A row's start and end pickers on one line (e.g. the Shipwrecks period).
// Both ends share one option list; `onSelect` reports which end moved
// ('from' or 'to') and the chosen option value.
// ('from' or 'to') and the chosen option value. The owner repaints the row
// on a later frame and may reorder the ends (a start picked after the end
// swaps them), so each select is given its end's value as a plain `value`
// rather than a model: the pick stays until the owner publishes a different
// value, which then shows at once, even on the focused select.
defineProps({
range: { type: Object, required: true },
onSelect: { type: Function, default: () => {} },
@@ -21,18 +27,18 @@ defineProps({
:key="end"
class="data-toggle-range-end"
><span class="data-toggle-range-caption">{{ range[end].label }}</span
><select
><UiSelect
class="data-toggle-range-select"
:data-range-end="end"
:aria-label="range[end].ariaLabel || undefined"
:value="String(range[end].value)"
@change="onSelect(end, $event.target.value)"
@update:model-value="onSelect(end, $event)"
><option
v-for="option in range.options"
:key="option.value"
:value="String(option.value)"
>{{ option.label }}</option
></select
></UiSelect
></label
></div
></div
+1 -1
View File
@@ -241,7 +241,7 @@ test('a Data Library row names its entry and draws icon action chips', () => {
assert.equal(element.dataset.libraryEntry, 'nasa-black-marble');
const button = element.querySelector('[data-chip-id="zoom"]');
const glyph = button.children[0];
assert.equal(glyph.className, 'material-symbols-outlined');
assert.ok(glyph.classList.contains('material-symbols-outlined'));
assert.equal(glyph.textContent, 'zoom_in_map');
assert.equal(glyph.getAttribute('aria-hidden'), 'true');
assert.equal(button.getAttribute('aria-label'), 'Zoom to layer');
+51
View File
@@ -0,0 +1,51 @@
import { after, before, test } from 'node:test';
import assert from 'node:assert/strict';
import { installVueDom } from '../../testSupport/vueDom.mjs';
let mount;
let RowRange;
let uninstall;
before(async () => {
uninstall = installVueDom();
({ mount } = await import('@vue/test-utils'));
RowRange = (await import('./RowRange.vue')).default;
});
after(() => uninstall());
const range = (from, to) => ({
id: 'period',
label: 'Period',
valueText: `${from}–${to}`,
from: { label: 'From', value: from },
to: { label: 'To', value: to },
options: [1900, 1950, 1960, 2000].map((value) => ({
value,
label: String(value),
})),
});
test('a range end keeps a pick until the owner repaints, then shows the owner’s ends', async () => {
const picks = [];
const wrapper = mount(RowRange, {
attachTo: document.body,
props: {
range: range(1900, 1950),
onSelect: (end, value) => picks.push([end, value]),
},
});
const [from, to] = wrapper.findAll('select').map((w) => w.element);
assert.equal(from.value, '1900');
assert.equal(to.value, '1950');
// A start picked after the end: the owner swaps the ends on a later frame.
from.focus();
from.value = '1960';
from.dispatchEvent(new Event('change'));
assert.deepEqual(picks, [['from', '1960']]);
await wrapper.vm.$nextTick();
assert.equal(from.value, '1960');
await wrapper.setProps({ range: range(1950, 1960) });
assert.equal(document.activeElement, from);
assert.equal(from.value, '1950');
assert.equal(to.value, '1960');
wrapper.unmount();
});
+58 -51
View File
@@ -49,6 +49,11 @@ const meta = () =>
]
.filter(Boolean)
.join(' · ');
// The card's face is the slot of a UiButton, which renders inside the
// button: a new item alone would reach it only on a later tick, but the panel
// patches synchronously. A slot given under a condition (`redrawWithView`,
// always true) is redrawn whenever this card is, so it keeps up.
const redrawWithView = true;
</script>
<template>
@@ -58,60 +63,62 @@ const meta = () =>
:data-report-id="item.id"
:style="{ '--news-color': item.color }"
>
<button
type="button"
class="news-card__main ui-focus"
<UiButton
class="news-card__main"
:aria-expanded="open ? 'true' : 'false'"
@click="onChoose(item)"
><template v-if="redrawWithView" #default>
<span v-if="item.picture && !pictureFailed" class="news-card__thumb"
><img
:src="item.picture.url"
alt=""
loading="lazy"
decoding="async"
referrerpolicy="no-referrer"
v-on="{ error: dropPicture }"
/><span
v-if="item.picture.video && !clipFailed"
class="news-card__play"
role="img"
:aria-label="t('Video')"
>▶</span
><span v-if="item.picture.credit" class="news-card__credit">{{
item.picture.credit
}}</span></span
>
<span class="news-card__title">{{ item.title }}</span>
<span v-if="item.original" class="news-card__note">{{
t('English headline by the model')
}}</span>
<span class="news-card__meta ui-mono"
><span
class="news-card__marker"
:class="{ solid: item.solid }"
role="img"
:aria-label="item.severityLabel"
:title="item.severityLabel"
><svg viewBox="0 0 16 16" aria-hidden="true">
<path :d="item.icon" /></svg></span
><span v-if="item.severity >= 2" class="news-card__severity">{{
item.severityLabel
}}</span
>{{ item.severity >= 2 ? ` · ${meta()}` : meta() }}</span
>
<span v-if="item.sides" class="news-card__sides">{{ item.sides }}</span>
<span v-if="item.chips.length" class="news-card__chips"
><span
v-for="chip in item.chips"
:key="`${chip.kind}:${chip.label}`"
class="news-chip"
:class="`news-chip--${chip.kind}`"
>{{ chip.label }}</span
></span
>
<span v-if="item.via" class="news-card__via ui-mono">{{
item.via
}}</span>
</template></UiButton
>
<span v-if="item.picture && !pictureFailed" class="news-card__thumb"
><img
:src="item.picture.url"
alt=""
loading="lazy"
decoding="async"
referrerpolicy="no-referrer"
v-on="{ error: dropPicture }"
/><span
v-if="item.picture.video && !clipFailed"
class="news-card__play"
role="img"
:aria-label="t('Video')"
>▶</span
><span v-if="item.picture.credit" class="news-card__credit">{{
item.picture.credit
}}</span></span
>
<span class="news-card__title">{{ item.title }}</span>
<span v-if="item.original" class="news-card__note">{{
t('English headline by the model')
}}</span>
<span class="news-card__meta ui-mono"
><span
class="news-card__marker"
:class="{ solid: item.solid }"
role="img"
:aria-label="item.severityLabel"
:title="item.severityLabel"
><svg viewBox="0 0 16 16" aria-hidden="true">
<path :d="item.icon" /></svg></span
><span v-if="item.severity >= 2" class="news-card__severity">{{
item.severityLabel
}}</span
>{{ item.severity >= 2 ? ` · ${meta()}` : meta() }}</span
>
<span v-if="item.sides" class="news-card__sides">{{ item.sides }}</span>
<span v-if="item.chips.length" class="news-card__chips"
><span
v-for="chip in item.chips"
:key="`${chip.kind}:${chip.label}`"
class="news-chip"
:class="`news-chip--${chip.kind}`"
>{{ chip.label }}</span
></span
>
<span v-if="item.via" class="news-card__via ui-mono">{{ item.via }}</span>
</button>
<div v-if="open" class="news-card__open">
<video
v-if="item.picture?.video && !clipFailed"
+90 -79
View File
@@ -13,9 +13,11 @@
// features (styles, HUD, compass, tilt, globe view, share, clear) have their
// own. The walk works the same for all of them.
import { h, render as renderVue } from 'vue';
import { t } from '../i18n/index.js';
import { EXCLUSIVE_SURFACE_CLASSES } from '../exclusiveSurfaces.js';
import { LABEL_LAYERS } from './contextLayerTabs.js';
import OmnibarGuide from './views/panels/OmnibarGuide.vue';
const LEFT_RAIL = '.ui-rail--left .ui-rail__item';
const RIGHT_RAIL = '.ui-rail--right .ui-rail__item';
@@ -445,43 +447,76 @@ export function startGuide(steps, { title = '' } = {}) {
active?.stop();
const doc = globalThis.document;
if (!doc?.body || screenIsOwned(doc) || !steps?.length) return;
const root = doc.createElement('div');
root.className = 'gev-guide';
root.innerHTML =
'<div class="gev-guide-ring"><i></i></div>' +
'<div class="gev-guide-callout" role="dialog" aria-modal="false" tabindex="-1" aria-labelledby="gev-guide-title" aria-describedby="gev-guide-text">' +
'<div class="gev-guide-head"><p id="gev-guide-title" class="gev-guide-title"></p>' +
'<p class="gev-guide-count"></p>' +
'<button type="button" class="gev-guide-close"><span aria-hidden="true">×</span></button></div>' +
'<ol class="gev-guide-progress" aria-hidden="true"></ol>' +
'<div class="gev-guide-body"><p id="gev-guide-text" class="gev-guide-text"></p>' +
'<p class="gev-guide-hint"><span class="gev-guide-hint-dot"></span><span></span></p></div>' +
'<div class="gev-guide-actions"><p class="gev-guide-keys"><kbd></kbd><span></span></p>' +
'<span><button type="button" class="gev-guide-skip" hidden></button>' +
'<button type="button" class="gev-guide-offer" hidden></button>' +
'<button type="button" class="gev-guide-next"></button></span></div>' +
// What the view renders: the owner writes it for each step, then paints.
// The view never binds what is set on the elements: the guide's `visible`
// class, the callout's entrance replay, place and side, and the rings'
// boxes, set per frame.
const endLabel = t('End guide');
const view = {
title: title ? t('Guide · {topic}', { topic: title }) : t('Guide'),
endLabel,
count: '',
step: 0,
progress: [],
text: '',
hint: t('Press the highlighted control'),
hintHidden: false,
// i18n-ignore: the Escape keycap, matching the keyboard shortcut.
keyCap: 'Esc',
keyText: t('to end'),
keysHidden: false,
skipLabel: '',
skipHidden: true,
offerLabel: '',
offerHidden: true,
nextLabel: t('Next'),
nextHidden: false,
nextQuiet: false,
// The extra rings for a step's further targets, after the callout; the
// count only grows, and rings a step does not use are faded out.
subRings: 0,
// Announces each step once; the dialog itself is not a live region, so
// its buttons and progress are not read out on every change.
'<p class="gev-guide-status" role="status" aria-live="polite"></p></div>';
status: '',
};
const host = doc.createElement('div');
const handlers = {
onClose: () => stop(),
onSkip: () => stop(),
// Taking the offer carries the walk on with its steps.
onOffer() {
if (!current?.offer) return;
const extra = current.offer.steps() || [];
live.splice(index + 1, live.length, ...extra.filter(Boolean));
next();
},
onNext() {
if (current) next();
},
};
let mounted = true;
/** Render the view now: the guide goes to the end of the body. */
function paint() {
if (!mounted) return null;
const vnode = h(OmnibarGuide, {
to: doc.body,
view: { ...view },
...handlers,
});
renderVue(vnode, host);
return vnode;
}
// Focus returns where it was when the walk ends, if that is still there.
const returnFocus = doc.activeElement;
doc.body.append(root);
const ring = root.querySelector('.gev-guide-ring');
const callout = root.querySelector('.gev-guide-callout');
const subRings = [];
const endLabel = t('End guide');
root.querySelector('.gev-guide-close').setAttribute('aria-label', endLabel);
root.querySelector('.gev-guide-close').title = endLabel;
// i18n-ignore: the Escape keycap, matching the keyboard shortcut.
root.querySelector('.gev-guide-keys kbd').textContent = 'Esc';
root.querySelector('.gev-guide-keys span').textContent = t('to end');
root.querySelector('.gev-guide-title').textContent = title
? t('Guide · {topic}', { topic: title })
: t('Guide');
root.querySelector('.gev-guide-next').textContent = t('Next');
root.querySelector('.gev-guide-hint span:last-child').textContent = t(
'Press the highlighted control',
);
// The elements come from the rendered tree, which is in place as soon as the
// render returns; template refs are filled after it, and later still when
// the walk starts inside one of Vue's own post-render updates.
const root = paint().component.subTree.children[0].el;
const ring = root.querySelector(':scope > .gev-guide-ring');
const callout = root.querySelector(':scope > .gev-guide-callout');
// The extra rings, read again from the rendered tree whenever more are
// drawn.
let subRings = [];
const live = steps.filter(Boolean);
let index = -1;
@@ -503,7 +538,8 @@ export function startGuide(steps, { title = '' } = {}) {
doc.removeEventListener('click', onClick, true);
doc.removeEventListener('keydown', onKey, true);
const hadFocus = root.contains(doc.activeElement);
root.remove();
mounted = false;
renderVue(null, host);
if (hadFocus && returnFocus?.isConnected) returnFocus.focus?.();
if (active?.stop === stop) active = null;
};
@@ -534,41 +570,29 @@ export function startGuide(steps, { title = '' } = {}) {
// would not be skipped as things stand.
const total =
shown + live.slice(index + 1).filter((later) => !later.skip?.()).length;
root.querySelector('.gev-guide-count').textContent = `${shown} / ${total}`;
const progress = root.querySelector('.gev-guide-progress');
progress.replaceChildren(
...Array.from({ length: total }, (_, i) => {
const dot = doc.createElement('li');
if (i < shown - 1) dot.className = 'done';
if (i === shown - 1) dot.className = 'current';
return dot;
}),
view.count = `${shown} / ${total}`;
view.step = shown;
view.progress = Array.from({ length: total }, (_, i) =>
i < shown - 1 ? 'done' : i === shown - 1 ? 'current' : null,
);
const text = step.text();
root.querySelector('.gev-guide-text').textContent = text;
root.querySelector('.gev-guide-status').textContent =
`${shown} / ${total}: ${text}`;
view.text = text;
view.status = `${shown} / ${total}: ${text}`;
// Steps that point at a control wait for it to be pressed; say so.
const waits = Boolean(step.targets) && !step.offer;
root.querySelector('.gev-guide-hint').hidden = !waits;
const offer = root.querySelector('.gev-guide-offer');
const skip = root.querySelector('.gev-guide-skip');
offer.hidden = !step.offer;
skip.hidden = !step.offer;
root.querySelector('.gev-guide-keys').hidden = Boolean(step.offer);
view.hintHidden = !waits;
view.offerHidden = !step.offer;
view.skipHidden = !step.offer;
view.keysHidden = Boolean(step.offer);
if (step.offer) {
offer.textContent = step.offer.label();
skip.textContent = t('Not now');
view.offerLabel = step.offer.label();
view.skipLabel = t('Not now');
}
const last = index === live.length - 1;
const nextButton = root.querySelector('.gev-guide-next');
nextButton.hidden = Boolean(step.offer);
nextButton.textContent = last
? t('Finish')
: waits
? t('Skip step')
: t('Next');
nextButton.classList.toggle('quiet', waits && !last);
view.nextHidden = Boolean(step.offer);
view.nextLabel = last ? t('Finish') : waits ? t('Skip step') : t('Next');
view.nextQuiet = waits && !last;
paint();
// Replay the entrance so each step reads as new.
callout.classList.remove('swap');
void callout.offsetWidth;
@@ -597,18 +621,6 @@ export function startGuide(steps, { title = '' } = {}) {
event.stopPropagation();
stop();
}
root.querySelector('.gev-guide-skip').addEventListener('click', stop);
root.querySelector('.gev-guide-close').addEventListener('click', stop);
root.querySelector('.gev-guide-next').addEventListener('click', () => {
if (current) next();
});
// Taking the offer carries the walk on with its steps.
root.querySelector('.gev-guide-offer').addEventListener('click', () => {
if (!current?.offer) return;
const extra = current.offer.steps() || [];
live.splice(index + 1, live.length, ...extra.filter(Boolean));
next();
});
doc.addEventListener('click', onClick, true);
doc.addEventListener('keydown', onKey, true);
@@ -650,11 +662,10 @@ export function startGuide(steps, { title = '' } = {}) {
width: `${main.width + pad * 2}px`,
height: `${main.height + pad * 2}px`,
});
while (subRings.length < rest.length) {
const sub = doc.createElement('div');
sub.className = 'gev-guide-ring gev-guide-ring--sub';
root.append(sub);
subRings.push(sub);
if (subRings.length < rest.length) {
view.subRings = rest.length;
paint();
subRings = [...root.querySelectorAll(':scope > .gev-guide-ring--sub')];
}
subRings.forEach((sub, i) => {
const box = rest[i];
+172
View File
@@ -0,0 +1,172 @@
// The guided walk's callout, rendered by startGuide() over happy-dom.
import '../testSupport/registerDom.mjs';
import test from 'node:test';
import assert from 'node:assert/strict';
import { createApp, h, onMounted } from 'vue';
import { startGuide } from './omnibarGuide.js';
const settle = () => new Promise((resolve) => setTimeout(resolve, 0));
const $ = (selector) => document.querySelector(selector);
function fixture(t) {
document.body.replaceChildren();
const target = document.body.appendChild(document.createElement('button'));
const field = document.body.appendChild(document.createElement('input'));
field.focus();
t.after(() => $('.gev-guide-close')?.click());
return { target, field };
}
test('the walk is the last of the body, takes focus and gives it back', async (t) => {
const { target, field } = fixture(t);
startGuide([{ targets: () => [target], text: () => 'Press it' }], {
title: 'Flights',
});
await settle();
const guide = $('.gev-guide');
assert.equal(document.body.lastElementChild, guide);
assert.equal(guide.parentElement, document.body);
assert.ok(guide.classList.contains('visible'));
const callout = $('.gev-guide-callout');
assert.equal(document.activeElement, callout);
assert.equal(callout.getAttribute('role'), 'dialog');
assert.equal(callout.getAttribute('aria-modal'), 'false');
assert.equal(callout.getAttribute('tabindex'), '-1');
assert.equal($('.gev-guide-title').textContent, 'Guide · Flights');
const close = $('.gev-guide-close');
assert.equal(close.getAttribute('type'), 'button');
assert.equal(close.getAttribute('aria-label'), 'End guide');
assert.equal(close.getAttribute('title'), 'End guide');
assert.ok(close.classList.contains('ui-close-button'));
close.focus();
close.click();
assert.equal($('.gev-guide'), null);
assert.equal(document.activeElement, field);
});
test('the status line says each step once, and each step draws new progress', async (t) => {
const { target } = fixture(t);
startGuide([
{ targets: () => [target], text: () => 'Press it' },
{ text: () => 'Then this' },
{
text: () => 'More?',
offer: { label: () => 'Show more', steps: () => [] },
},
]);
const status = $('.gev-guide-status');
const said = [];
// One change per step: its text replaced once, never cleared first.
const observer = new MutationObserver(() => said.push(status.textContent));
observer.observe(status, {
childList: true,
characterData: true,
subtree: true,
});
t.after(() => observer.disconnect());
await settle();
const firstDots = [...document.querySelectorAll('.gev-guide-progress li')];
assert.deepEqual(
firstDots.map((dot) => dot.getAttribute('class')),
['current', null, null],
);
const next = $('.gev-guide-next');
assert.equal(next.textContent, 'Skip step');
assert.ok(next.classList.contains('quiet'));
assert.equal($('.gev-guide-hint').hidden, false);
next.click();
await settle();
const secondDots = [...document.querySelectorAll('.gev-guide-progress li')];
assert.deepEqual(
secondDots.map((dot) => dot.getAttribute('class')),
['done', 'current', null],
);
assert.ok(secondDots.every((dot) => !firstDots.includes(dot)));
assert.equal(next.textContent, 'Next');
assert.equal(next.classList.contains('quiet'), false);
assert.equal($('.gev-guide-hint').hidden, true);
next.click();
await settle();
// The closing offer: its two buttons, no Esc hint and no Next.
assert.equal($('.gev-guide-keys').hidden, true);
assert.equal(next.hidden, true);
assert.equal($('.gev-guide-skip').hidden, false);
assert.equal($('.gev-guide-skip').textContent, 'Not now');
assert.equal($('.gev-guide-offer').textContent, 'Show more');
assert.deepEqual(said, [
'1 / 3: Press it',
'2 / 3: Then this',
'3 / 3: More?',
]);
$('.gev-guide-skip').click();
assert.equal($('.gev-guide'), null);
});
test('starting another walk ends the one in progress', async (t) => {
fixture(t);
startGuide([{ text: () => 'First' }]);
startGuide([{ text: () => 'Second' }]);
await settle();
assert.equal(document.querySelectorAll('.gev-guide').length, 1);
assert.equal($('.gev-guide-text').textContent, 'Second');
});
test('a walk started while Vue mounts something else still starts and ends', async (t) => {
const { target, field } = fixture(t);
let stop = null;
const app = createApp({
setup() {
onMounted(() => {
stop = startGuide([
{ targets: () => [target], text: () => 'Press it' },
]);
});
return () => h('span');
},
});
app.mount(document.body.appendChild(document.createElement('div')));
t.after(() => app.unmount());
await settle();
assert.equal(typeof stop, 'function');
assert.equal(document.activeElement, $('.gev-guide-callout'));
assert.ok($('.gev-guide').classList.contains('visible'));
stop();
assert.equal($('.gev-guide'), null);
assert.equal(document.activeElement, field);
});
test('each further target of a step gets its own ring after the callout', async (t) => {
const { target } = fixture(t);
const more = document.body.appendChild(document.createElement('button'));
const box = (left) => () => ({
left,
top: 20,
right: left + 30,
bottom: 50,
width: 30,
height: 30,
});
target.getBoundingClientRect = box(10);
more.getBoundingClientRect = box(100);
let targets = [target, more];
startGuide([{ targets: () => targets, text: () => 'Press these' }]);
const frame = () => new Promise((resolve) => requestAnimationFrame(resolve));
await settle();
await frame();
const subs = () => [...document.querySelectorAll('.gev-guide-ring--sub')];
assert.equal(subs().length, 1);
const [sub] = subs();
assert.equal(sub.className, 'gev-guide-ring gev-guide-ring--sub');
assert.equal(sub.parentElement, $('.gev-guide'));
assert.equal(sub.previousElementSibling, $('.gev-guide-callout'));
assert.equal(sub.childElementCount, 0);
assert.equal(sub.style.opacity, '1');
assert.equal(sub.style.left, '96px');
assert.equal(sub.style.width, '38px');
// A step with fewer targets keeps the ring, faded out.
targets = [target];
$('.gev-guide-ring').dispatchEvent(new Event('scroll', { bubbles: true }));
await frame();
assert.deepEqual(subs(), [sub]);
assert.equal(sub.style.opacity, '0');
});
+41 -16
View File
@@ -205,22 +205,7 @@ export class PanelChrome {
beforeCollapse: () => {
if (panelId === 'location-bar') this._closeLocationSearch?.();
},
// A desktop side panel hides entirely once collapsed; its rail item
// takes the focus its own disclosure can no longer hold.
returnFocusTo: () => {
const panel = document.getElementById(panelId);
if (!panel?.getClientRects || panel.getClientRects().length > 0)
return null;
const item = document.querySelector?.(
`.ui-rail [data-rail-item="${panelId}"]`,
);
return item &&
!item.disabled &&
item.getClientRects().length > 0 &&
getComputedStyle(item).visibility === 'visible'
? item
: null;
},
returnFocusTo: () => this._railFocusStand(panelId),
});
}
@@ -229,9 +214,49 @@ export class PanelChrome {
if (this._disposed || !this._disclosurePanelIds?.has(panelId)) return;
const panel = document.getElementById(panelId);
if (!panel) return;
// Opening a panel folds others too (the side accordion, Cockpit's
// Contact card): note which open ones hold the focus.
const focused = document.activeElement;
const holders = [...this._disclosurePanelIds]
.map((id) => document.getElementById(id))
.filter((el) => el?.contains(focused) && !this._shownPanel(el).collapsed);
const cockpit = this.cockpitView;
const contactHeld =
cockpit?.active &&
!cockpit.contextCollapsed &&
document.getElementById('cockpit-context')?.contains(focused);
this.setPanelCollapsed(panelId, !this._shownPanel(panel).collapsed, {
explicit: true,
});
const stand =
contactHeld && cockpit.contextCollapsed
? document.getElementById('cockpit-context-toggle')
: holders
.filter((el) => this._shownPanel(el).collapsed)
.map((el) => this._railFocusStand(el.id))
.find(Boolean);
stand?.focus({ preventScroll: true });
}
/**
* A desktop side panel hides entirely once collapsed; its rail item takes
* the focus its own disclosure can no longer hold. Null while the panel or
* the item is not shown.
* @param {string} panelId Panel element id.
*/
_railFocusStand(panelId) {
const panel = document.getElementById(panelId);
if (!panel?.getClientRects || panel.getClientRects().length > 0)
return null;
const item = document.querySelector?.(
`.ui-rail [data-rail-item="${panelId}"]`,
);
return item &&
!item.disabled &&
item.getClientRects().length > 0 &&
getComputedStyle(item).visibility === 'visible'
? item
: null;
}
_setCommandDockPanelPinState(
+163
View File
@@ -14,6 +14,8 @@ import PanelCollapseButton from './rail/PanelCollapseButton.vue';
import RailPanel from './rail/RailPanel.vue';
import UiPanel from './kit/UiPanel.vue';
import { usePanelChromeStore } from './stores/panelChrome.js';
import { useDisplayStore } from './stores/display.js';
import { DisplayBindings } from './displayBindings.js';
import CommandDockView from './views/CommandDockView.vue';
function mount(t, component) {
@@ -487,3 +489,164 @@ test('the accordion closes peers through the real store, and opens them again',
assert.equal(panels[0].className, '');
chrome.destroy();
});
test('F collapses Data Layers like its button and keeps its rail entry', (t) => {
document.body.innerHTML = `
<nav class="ui-rail"><button data-rail-item="data-panel" style="visibility: visible"></button></nav>
<div id="data-panel" class="active"><button class="panel-collapse-btn" data-collapse-target="data-panel"></button></div>`;
const panel = document.getElementById('data-panel');
const item = document.querySelector('[data-rail-item="data-panel"]');
panel.getClientRects = () =>
panel.classList.contains('collapsed') ? [] : [{}];
item.getClientRects = () => [{}];
const store = usePanelChromeStore(createPinia());
const chrome = panelChrome(store);
followPanelState(store, 'data-panel', panel);
chrome._disclosurePanelIds = new Set(['data-panel']);
const bindings = new DisplayBindings({
viewer: null,
services: { isScopeMaskEnabled: () => false, cycleDetectionMode() {} },
elements: { _locationSearch: document.createElement('input') },
operations: {
_setScope() {},
_togglePanel: (panelId) => chrome._togglePanel(panelId),
},
readState: () => ({}),
claimDetection() {},
displayStore: useDisplayStore(createPinia()),
});
bindings._initUI();
t.after(() => {
bindings.destroy();
chrome.destroy();
});
const press = (init = {}) =>
document.activeElement.dispatchEvent(
new KeyboardEvent('keydown', { key: 'f', bubbles: true, ...init }),
);
panel.querySelector('button').focus();
press();
assert.equal(store.panels['data-panel']?.collapsed, true);
assert.ok(document.activeElement === item, 'focus moves to the rail');
assert.ok(panel.classList.contains('collapsed'));
// `active` is what shows Data Layers at all (layers.css).
assert.ok(panel.classList.contains('active'));
press({ metaKey: true });
assert.equal(store.panels['data-panel'].collapsed, true, 'Cmd+F is not ours');
press();
assert.equal(store.panels['data-panel'].collapsed, false);
assert.ok(!panel.classList.contains('collapsed'));
assert.ok(panel.classList.contains('active'));
});
test('F that folds a focused peer hands the focus to a rail entry', (t) => {
document.body.innerHTML = `
<nav class="ui-rail">
<button data-rail-item="data-panel" style="visibility: visible"></button>
<button data-rail-item="pp-toggles" style="visibility: visible"></button>
</nav>
<div id="left-panel-stack">
<div id="data-panel" data-panel-id="data-panel" class="active collapsed"><button class="panel-collapse-btn" data-collapse-target="data-panel"></button></div>
<div id="pp-toggles" data-panel-id="pp-toggles"><button class="panel-collapse-btn" data-collapse-target="pp-toggles"></button><button id="crt2">CRT 2</button></div>
</div>`;
const stack = document.getElementById('left-panel-stack');
const store = usePanelChromeStore(createPinia());
const chrome = new PanelChrome({
elements: { _leftPanelStack: stack },
operations: { _showToast() {}, _syncCctvPanelViewport() {} },
readHud: () => ({ visible: false, getVariant: () => null }),
readCockpit: () => null,
readShareLinks: () => null,
readInitialShare: () => null,
readScrollRestoreOwner: () => null,
readDisplayScrollTop: () => 0,
store,
});
for (const id of ['data-panel', 'pp-toggles']) {
const panel = document.getElementById(id);
panel.getClientRects = () =>
panel.classList.contains('collapsed') ? [] : [{}];
followPanelState(store, id, panel);
}
for (const item of document.querySelectorAll('[data-rail-item]'))
item.getClientRects = () => [{}];
chrome._disclosurePanelIds = new Set(['data-panel', 'pp-toggles']);
const bindings = new DisplayBindings({
viewer: null,
services: { isScopeMaskEnabled: () => false, cycleDetectionMode() {} },
elements: { _locationSearch: document.createElement('input') },
operations: {
_setScope() {},
_togglePanel: (panelId) => chrome._togglePanel(panelId),
},
readState: () => ({}),
claimDetection() {},
displayStore: useDisplayStore(createPinia()),
});
bindings._initUI();
t.after(() => {
bindings.destroy();
chrome.destroy();
});
const crt2 = document.getElementById('crt2');
crt2.focus();
assert.equal(document.activeElement, crt2);
crt2.dispatchEvent(new KeyboardEvent('keydown', { key: 'f', bubbles: true }));
assert.equal(
store.panels['data-panel']?.collapsed,
false,
'Data Layers opens',
);
const visual = document.getElementById('pp-toggles');
assert.ok(
visual.classList.contains('collapsed'),
'the accordion folds Visual',
);
assert.ok(
document.activeElement?.matches?.('.ui-rail [data-rail-item]'),
`focus lands on a rail entry, not inside the hidden peer (got ${document.activeElement?.id || document.activeElement?.tagName})`,
);
});
test('opening Data Layers in Cockpit hands the focus from the folded Contact card to its toggle', (t) => {
document.body.innerHTML = `
<div id="left-panel-stack">
<div id="data-panel" data-panel-id="data-panel" class="active collapsed"><button class="panel-collapse-btn" data-collapse-target="data-panel"></button></div>
</div>
<aside id="cockpit-context"><button id="cockpit-context-toggle"></button><button id="cockpit-weather-toggle"></button></aside>`;
const store = usePanelChromeStore(createPinia());
const cockpit = {
active: true,
contextCollapsed: false,
setContextCollapsed(collapsed) {
this.contextCollapsed = collapsed;
},
setSignalCollapsed() {},
scheduleContextLayout() {},
};
const chrome = new PanelChrome({
elements: { _leftPanelStack: document.getElementById('left-panel-stack') },
operations: { _showToast() {}, _syncCctvPanelViewport() {} },
readHud: () => ({ visible: false, getVariant: () => null }),
readCockpit: () => cockpit,
readShareLinks: () => null,
readInitialShare: () => null,
readScrollRestoreOwner: () => null,
readDisplayScrollTop: () => 0,
store,
});
t.after(() => chrome.destroy());
followPanelState(store, 'data-panel', document.getElementById('data-panel'));
chrome._disclosurePanelIds = new Set(['data-panel']);
document.getElementById('cockpit-weather-toggle').focus();
chrome._togglePanel('data-panel');
assert.equal(
store.panels['data-panel']?.collapsed,
false,
'Data Layers opens',
);
assert.equal(cockpit.contextCollapsed, true, 'Contact folds for it');
assert.equal(document.activeElement?.id, 'cockpit-context-toggle');
});
+2 -5
View File
@@ -1,5 +1,5 @@
import PanelRailView from './PanelRailView.vue';
import { PANEL_RAIL_HOST_CLASS, PANEL_RAIL_ITEMS } from './panelRailCatalog.js';
import { PANEL_RAIL_HOST_CLASS } from './panelRailCatalog.js';
import { usePanelStore } from './stores/panels.js';
/**
@@ -71,7 +71,6 @@ export class PanelNavigation {
? [...stack.children]
.filter((panel) => panel.matches('[data-panel-id]'))
.map((panel) => {
const shownBy = PANEL_RAIL_ITEMS[panel.id]?.shownBy;
return {
id: panel.id,
title:
@@ -79,9 +78,7 @@ export class PanelNavigation {
.querySelector('.panel-title, .pp-header-label')
?.textContent.trim() || panel.id,
open: !panel.classList.contains('collapsed'),
available:
!panel.hidden &&
(!shownBy || panel.classList.contains(shownBy)),
available: !panel.hidden,
};
})
: [];
+2 -4
View File
@@ -22,8 +22,6 @@ function panel(id, { collapsed = true, hidden = false, title = '' } = {}) {
element.className = collapsed
? 'panel-collapsible collapsed'
: 'panel-collapsible';
// Data Layers shows only while `active` (the `f` shortcut toggles it).
if (id === 'data-panel') element.classList.add('active');
element.hidden = hidden;
if (title) element.innerHTML = `<span class="panel-title">${title}</span>`;
return element;
@@ -132,8 +130,8 @@ test('the rails follow disclosure and availability changes', async () => {
['global-context-panel', 'false'],
['host-panel', 'false'],
]);
// `f` hides Data Layers outright, so the rail stops offering it.
document.getElementById('data-panel').classList.remove('active');
// A hidden panel leaves its rail.
document.getElementById('data-panel').hidden = true;
await new Promise((resolve) => setTimeout(resolve, 0));
await nextTick();
assert.deepEqual(railItems(left), [['scene-panel', 'true']]);
+3 -8
View File
@@ -7,16 +7,11 @@ export const PANEL_RAIL_HOST_CLASS = 'gev-panel-rail';
export const PANEL_RAIL_FALLBACK_ICON = 'more_horiz';
/**
* How each side panel appears on its rail. Labels are the panels' own titles.
* `shownBy` names a class the panel needs to be shown at all (`f` toggles
* Data Layers' `active`). `context` is the label's translation context.
* How each side panel appears on its rail. Labels are the panels' own titles;
* `context` is the label's translation context.
*/
export const PANEL_RAIL_ITEMS = Object.freeze({
'data-panel': {
icon: 'layers',
label: msg('DATA LAYERS'),
shownBy: 'active',
},
'data-panel': { icon: 'layers', label: msg('DATA LAYERS') },
'utilities-panel': { icon: 'handyman', label: msg('UTILITIES') },
'scene-panel': { icon: 'movie', label: msg('AUTHORING') },
// `context` keeps the panel's name apart from the satellite class of the
+133 -163
View File
@@ -1,3 +1,4 @@
import { h, render as renderVue } from 'vue';
import { fromDegrees } from '../geo/ellipsoid.js';
import { horizonFrom } from '../geo/horizon.js';
import { distance } from '../geo/vector.js';
@@ -8,6 +9,7 @@ import {
findQuery,
} from '../render/rendererOf.js';
import { t } from '../i18n/index.js';
import QuebecCctvOverlay from './views/panels/QuebecCctvOverlay.vue';
function isQuebecCamera(camera) {
return String(camera?.sourceKind || '').startsWith('quebec-');
@@ -77,72 +79,77 @@ function mediaRefreshUrl(value) {
* Attach the active Québec source to a floating browser player and map
* preview. The browser contacts Québec 511 only after the viewer presses Play
* for that camera; selecting it (by click, auto-hop, a scene or voice) only
* shows its details and the play control.
* shows its details and the play control. The panel and marker are the
* `QuebecCctvOverlay` view, rendered synchronously on each change.
*/
export function createQuebecCctvOverlay(viewer) {
if (!viewer || typeof document === 'undefined') return null;
const controller = new AbortController();
const { signal } = controller;
const panel = document.createElement('section');
panel.className = 'qci-panel';
panel.hidden = true;
panel.setAttribute('role', 'region');
panel.setAttribute('aria-label', t('CCTV camera'));
const header = document.createElement('header');
header.className = 'qci-header';
const title = document.createElement('strong');
const close = document.createElement('button');
close.type = 'button';
close.textContent = '×';
close.setAttribute('aria-label', t('Close camera preview'));
header.append(title, close);
const coordinates = document.createElement('p');
coordinates.className = 'qci-coordinates';
const credit = document.createElement('p');
credit.className = 'qci-credit';
const live = document.createElement('video');
live.className = 'qci-live';
live.controls = true;
live.muted = true;
live.autoplay = true;
live.loop = true;
live.playsInline = true;
live.setAttribute('aria-label', t('CCTV camera'));
const actions = document.createElement('div');
actions.className = 'qci-actions';
const play = document.createElement('button');
play.type = 'button';
play.className = 'qci-play';
play.textContent = t('Play');
const refresh = document.createElement('button');
refresh.type = 'button';
refresh.textContent = t('Refresh map still');
actions.append(play, refresh);
const note = document.createElement('p');
note.className = 'qci-note';
const sourceLink = document.createElement('a');
sourceLink.target = '_blank';
sourceLink.rel = 'noopener noreferrer';
sourceLink.textContent = t("Open this image on the provider's site");
panel.append(header, coordinates, credit, live, actions, note, sourceLink);
const marker = document.createElement('div');
marker.className = 'qci-marker';
marker.hidden = true;
const still = document.createElement('video');
still.className = 'qci-marker-still';
still.muted = true;
still.playsInline = true;
still.preload = 'none';
still.setAttribute('aria-hidden', 'true');
const markerLabel = document.createElement('span');
markerLabel.className = 'qci-marker-label';
marker.append(still, markerLabel);
document.body.append(panel, marker);
// What the view renders. The owner writes it where it used to write the
// elements, then paints; the view never binds the media sources, the
// panel's dragged position or the marker's per-frame visibility and place.
const view = {
panelHidden: true,
title: '',
coordinates: '',
credit: '',
creditHidden: false,
liveHidden: false,
actionsHidden: false,
playHidden: false,
refreshHidden: false,
note: '',
noteHidden: false,
sourceHref: null,
sourceHidden: false,
markerLinkOnly: false,
stillHidden: false,
markerLabel: '',
};
const host = document.createElement('div');
let disposed = false;
const handlers = {
onClose: closeWindow,
onPlay: startPlayback,
onRefresh: refreshStill,
onKeydown(event) {
if (event.key === 'Escape') close.click();
},
onHeaderPointerdown: startDrag,
onLiveError: markLiveUnavailable,
onLiveLoadeddata() {
liveUnavailable = false;
view.note = t(
'The map still uses a separate request and may show a different moment.',
);
view.noteHidden = false;
paint();
},
onStillError: markStillUnavailable,
onStillLoadeddata() {
stillUnavailable = false;
if (selected)
view.markerLabel = markerLabelText(selected, Boolean(selectedMediaUrl));
paint();
still.pause();
},
};
/** Render the view now: the panel and marker go to the end of the body. */
function paint() {
if (disposed) return null;
const vnode = h(QuebecCctvOverlay, { view: { ...view }, ...handlers });
renderVue(vnode, host);
return vnode.component.exposed;
}
const elements = paint();
const panel = elements.panel.value;
const header = elements.header.value;
const close = elements.close.value.$el;
const live = elements.live.value;
const marker = elements.marker.value;
const still = elements.still.value;
let selected = null;
let selectedPosition = null;
@@ -166,13 +173,15 @@ export function createQuebecCctvOverlay(viewer) {
function markLiveUnavailable() {
liveUnavailable = true;
note.textContent = t('Source unavailable');
note.hidden = false;
view.note = t('Source unavailable');
view.noteHidden = false;
paint();
}
function markStillUnavailable() {
stillUnavailable = true;
markerLabel.textContent = t('Source unavailable');
view.markerLabel = t('Source unavailable');
paint();
}
function startRender() {
@@ -218,16 +227,17 @@ export function createQuebecCctvOverlay(viewer) {
playingCameraId = selected.id;
liveUnavailable = false;
stillUnavailable = false;
play.hidden = true;
refresh.hidden = false;
live.hidden = false;
still.hidden = false;
marker.classList.remove('qci-marker-link-only');
note.textContent = t(
view.playHidden = true;
view.refreshHidden = false;
view.liveHidden = false;
view.stillHidden = false;
view.markerLinkOnly = false;
view.note = t(
'The map still uses a separate request and may show a different moment.',
);
note.hidden = false;
markerLabel.textContent = markerLabelText(selected, true);
view.noteHidden = false;
view.markerLabel = markerLabelText(selected, true);
paint();
setMedia(live, selectedMediaUrl);
setMedia(still, selectedMediaUrl);
void live.play().catch(onPlayFailure(markLiveUnavailable));
@@ -246,7 +256,8 @@ export function createQuebecCctvOverlay(viewer) {
stillUnavailable = false;
stopMediaRefresh();
stopRender();
panel.hidden = true;
view.panelHidden = true;
paint();
marker.hidden = true;
setMedia(live, '');
setMedia(still, '');
@@ -263,7 +274,8 @@ export function createQuebecCctvOverlay(viewer) {
Number(camera.elevationM) || 10,
);
if (closedWindowCameraId === camera.id && !reselected) {
panel.hidden = true;
view.panelHidden = true;
paint();
updateMarker();
return;
}
@@ -276,8 +288,8 @@ export function createQuebecCctvOverlay(viewer) {
playingCameraId = null;
}
const playing = Boolean(mediaUrl) && playingCameraId === camera.id;
title.textContent = camera.name || t('CCTV camera');
coordinates.textContent = [
view.title = camera.name || t('CCTV camera');
view.coordinates = [
`${Number(camera.lat).toFixed(5)}, ${Number(camera.lon).toFixed(5)}`,
Number.isFinite(camera.accuracyM) && camera.accuracyM > 0
? `±${Math.round(camera.accuracyM)} m`
@@ -286,14 +298,13 @@ export function createQuebecCctvOverlay(viewer) {
]
.filter(Boolean)
.join(' · ');
credit.textContent = camera.credit || camera.provider || '';
credit.hidden = !credit.textContent;
live.hidden = !playing;
play.hidden = !mediaUrl || playing;
refresh.hidden = !playing;
actions.hidden = !mediaUrl;
note.hidden = !mediaUrl;
note.textContent = mediaUrl
view.credit = camera.credit || camera.provider || '';
view.creditHidden = !view.credit;
view.liveHidden = !playing;
view.playHidden = !mediaUrl || playing;
view.refreshHidden = !playing;
view.actionsHidden = !mediaUrl;
view.note = mediaUrl
? !playing
? t('Video plays from Québec 511, which sees your IP address.')
: liveUnavailable
@@ -304,15 +315,16 @@ export function createQuebecCctvOverlay(viewer) {
: sourceUrl
? ''
: t('Source unavailable');
note.hidden = !note.textContent;
sourceLink.href = sourceUrl || '#';
sourceLink.hidden = !sourceUrl;
markerLabel.textContent = stillUnavailable
view.noteHidden = !view.note;
view.sourceHref = sourceUrl || '#';
view.sourceHidden = !sourceUrl;
view.markerLabel = stillUnavailable
? t('Source unavailable')
: markerLabelText(camera, playing);
marker.classList.toggle('qci-marker-link-only', !playing);
still.hidden = !playing;
panel.hidden = false;
view.markerLinkOnly = !playing;
view.stillHidden = !playing;
view.panelHidden = false;
paint();
if (changed || mediaUrl !== selectedMediaUrl) {
selectedMediaUrl = mediaUrl;
@@ -366,34 +378,6 @@ export function createQuebecCctvOverlay(viewer) {
);
}
still.addEventListener(
'loadeddata',
() => {
stillUnavailable = false;
if (selected)
markerLabel.textContent = markerLabelText(
selected,
Boolean(selectedMediaUrl),
);
still.pause();
},
{ signal },
);
still.addEventListener('error', markStillUnavailable, { signal });
live.addEventListener('error', markLiveUnavailable, { signal });
live.addEventListener(
'loadeddata',
() => {
liveUnavailable = false;
note.textContent = t(
'The map still uses a separate request and may show a different moment.',
);
note.hidden = false;
},
{ signal },
);
refresh.addEventListener('click', refreshStill, { signal });
play.addEventListener('click', startPlayback, { signal });
const resetCanvasRect = () => {
canvasRect = null;
};
@@ -403,49 +387,35 @@ export function createQuebecCctvOverlay(viewer) {
capture: true,
passive: true,
});
panel.addEventListener(
'keydown',
(event) => {
if (event.key === 'Escape') close.click();
},
{ signal },
);
close.addEventListener(
'click',
() => {
closedWindowCameraId = selected?.id || null;
panel.hidden = true;
live.pause();
stopMediaRefresh();
// The floating player closes independently; keep the paused map still.
updateMarker();
},
{ signal },
);
header.addEventListener(
'pointerdown',
(event) => {
if (event.target.closest('button')) return;
const rect = panel.getBoundingClientRect();
const offsetX = event.clientX - rect.left;
const offsetY = event.clientY - rect.top;
header.setPointerCapture(event.pointerId);
const move = (moveEvent) => {
panel.style.left = `${Math.max(0, Math.min(window.innerWidth - panel.offsetWidth, moveEvent.clientX - offsetX))}px`;
panel.style.top = `${Math.max(0, Math.min(window.innerHeight - panel.offsetHeight, moveEvent.clientY - offsetY))}px`;
panel.style.right = 'auto';
};
const stop = () => {
header.removeEventListener('pointermove', move);
header.removeEventListener('pointerup', stop);
header.removeEventListener('pointercancel', stop);
};
header.addEventListener('pointermove', move, { signal });
header.addEventListener('pointerup', stop, { once: true, signal });
header.addEventListener('pointercancel', stop, { once: true, signal });
},
{ signal },
);
function closeWindow() {
closedWindowCameraId = selected?.id || null;
view.panelHidden = true;
paint();
live.pause();
stopMediaRefresh();
// The floating player closes independently; keep the paused map still.
updateMarker();
}
function startDrag(event) {
if (event.target.closest('button')) return;
const rect = panel.getBoundingClientRect();
const offsetX = event.clientX - rect.left;
const offsetY = event.clientY - rect.top;
header.setPointerCapture(event.pointerId);
const move = (moveEvent) => {
panel.style.left = `${Math.max(0, Math.min(window.innerWidth - panel.offsetWidth, moveEvent.clientX - offsetX))}px`;
panel.style.top = `${Math.max(0, Math.min(window.innerHeight - panel.offsetHeight, moveEvent.clientY - offsetY))}px`;
panel.style.right = 'auto';
};
const stop = () => {
header.removeEventListener('pointermove', move);
header.removeEventListener('pointerup', stop);
header.removeEventListener('pointercancel', stop);
};
header.addEventListener('pointermove', move, { signal });
header.addEventListener('pointerup', stop, { once: true, signal });
header.addEventListener('pointercancel', stop, { once: true, signal });
}
document.addEventListener(
'visibilitychange',
() => {
@@ -469,8 +439,8 @@ export function createQuebecCctvOverlay(viewer) {
stopRender();
setMedia(live, '');
setMedia(still, '');
panel.remove();
marker.remove();
disposed = true;
renderVue(null, host);
selected = null;
selectedPosition = null;
},
+43 -17
View File
@@ -1,6 +1,6 @@
import '../testSupport/registerDom.mjs';
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { Window } from 'happy-dom';
import { fromDegrees } from '../geo/ellipsoid.js';
import { bindFakeDraw } from '../testSupport/fakeDrawPort.mjs';
import { fakeCameraPort } from '../testSupport/fakeCameraPort.mjs';
@@ -22,23 +22,36 @@ const CAMERA = Object.freeze({
});
/**
* Mount the overlay in a happy-dom window with recorded media loads, timers
* and postRender listeners. `play` decides what each play() returns.
* Mount the overlay in the registered happy-dom window (Vue binds the
* document it loads with) with recorded media loads, timers and postRender
* listeners. `play` decides what each play() returns.
*/
function mountOverlay(t, { play = () => Promise.resolve() } = {}) {
const window = new Window({ url: 'http://localhost:4173/' });
const previousWindow = globalThis.window;
const previousDocument = globalThis.document;
globalThis.window = window;
globalThis.document = window.document;
const { window } = globalThis;
const media = window.HTMLMediaElement.prototype;
const previous = {
load: media.load,
play: media.play,
pause: media.pause,
setInterval: window.setInterval,
clearInterval: window.clearInterval,
};
t.after(() => {
media.load = previous.load;
media.play = previous.play;
media.pause = previous.pause;
window.setInterval = previous.setInterval;
window.clearInterval = previous.clearInterval;
delete window.document.hidden;
});
const loads = [];
window.HTMLMediaElement.prototype.load = function () {
media.load = function () {
if (this.getAttribute('src')) loads.push(this.getAttribute('src'));
};
window.HTMLMediaElement.prototype.play = function () {
media.play = function () {
return play(this);
};
window.HTMLMediaElement.prototype.pause = function () {};
media.pause = function () {};
const intervals = new Map();
let nextTimer = 1;
window.setInterval = (fn) => {
@@ -65,12 +78,7 @@ function mountOverlay(t, { play = () => Promise.resolve() } = {}) {
});
t.after(unbind);
const overlay = createQuebecCctvOverlay(viewer);
t.after(() => {
overlay?.dispose();
globalThis.window = previousWindow;
globalThis.document = previousDocument;
window.close();
});
t.after(() => overlay?.dispose());
const [live, still] = window.document.querySelectorAll('video');
return {
window,
@@ -203,3 +211,21 @@ test('the refresh timer reloads with a cache-buster, skips hidden tabs, and stop
assert.equal(ui.renderListeners.size, 0);
assert.equal(ui.window.document.querySelector('.qci-panel') === null, true);
});
test('Escape in the window closes it and stops the refresh until the camera is picked again', (t) => {
const ui = mountOverlay(t);
ui.overlay.setCamera(CAMERA);
ui.playButton().click();
const panel = ui.window.document.querySelector('.qci-panel');
panel.dispatchEvent(
new ui.window.KeyboardEvent('keydown', { key: 'Escape', bubbles: true }),
);
assert.equal(panel.hidden, true);
assert.equal(ui.intervals.size, 0);
ui.overlay.setCamera({ ...CAMERA });
assert.equal(panel.hidden, true, 'a routine update keeps it closed');
ui.overlay.setCamera({ ...CAMERA }, { reselected: true });
assert.equal(panel.hidden, false, 'picking the camera again reopens it');
assert.equal(ui.intervals.size, 1);
});
+33 -23
View File
@@ -2,6 +2,7 @@
import { computed, onBeforeUnmount } from 'vue';
import RailCardBlocks from './RailCardBlocks.vue';
import UiBadge from '../kit/UiBadge.vue';
import UiButton from '../kit/UiButton.vue';
// One keyed card: a disclosure header and its blocks. The owner decides
// which card is open.
@@ -20,6 +21,12 @@ onBeforeUnmount(() => {
live = false;
});
const select = () => live && props.onOpen(props.card.id);
// The header's contents are the slot of a UiButton, which renders inside the
// button: a new card alone would reach them only on a later tick, but the
// owner patches synchronously and measures at once. A slot given under a
// condition (`redrawWithView`, always true) is redrawn whenever this card is,
// so it keeps up.
const redrawWithView = true;
</script>
<script>
@@ -32,33 +39,36 @@ const nextBodyId = () => ++bodies;
:class="`rail-card${cardClassName ? ` ${cardClassName}` : ''}${open ? ' is-open' : ''}`"
:data-card-id="card.id"
:data-open="String(open)"
><button
><UiButton
class="rail-card-header"
type="button"
:aria-controls="bodyId"
:aria-expanded="String(open)"
@click="select"
><span class="rail-card-labels"
><span class="rail-card-heading"
><span class="data-icon" aria-hidden="true" :hidden="!card.icon">{{
card.icon || ''
}}</span
><span class="rail-card-title rail-card-nowrap" :title="card.title">{{
card.title
}}</span></span
><UiBadge
:class="`gev-status-badge--plain rail-card-badge${badgeClassName ? ` ${badgeClassName}` : ''}`"
:hidden="!card.badge"
>{{ card.badge || '' }}</UiBadge
></span
><span class="rail-card-disclosure" aria-hidden="true">{{
open ? '▾' : '▸'
}}</span
><span
:class="`rail-card-compact${card.compactStatus ? ' status' : ''}`"
:hidden="open"
>{{ card.compact || '' }}</span
></button
><template v-if="redrawWithView" #default
><span class="rail-card-labels"
><span class="rail-card-heading"
><span class="data-icon" aria-hidden="true" :hidden="!card.icon">{{
card.icon || ''
}}</span
><span
class="rail-card-title rail-card-nowrap"
:title="card.title"
>{{ card.title }}</span
></span
><UiBadge
:class="`gev-status-badge--plain rail-card-badge${badgeClassName ? ` ${badgeClassName}` : ''}`"
:hidden="!card.badge"
>{{ card.badge || '' }}</UiBadge
></span
><span class="rail-card-disclosure" aria-hidden="true">{{
open ? '▾' : '▸'
}}</span
><span
:class="`rail-card-compact${card.compactStatus ? ' status' : ''}`"
:hidden="open"
>{{ card.compact || '' }}</span
></template
></UiButton
><div :id="bodyId" class="rail-card-body" :hidden="!open"
><RailCardBlocks
:blocks="card.blocks || []"
+7 -11
View File
@@ -2,6 +2,7 @@
import { onBeforeUnmount } from 'vue';
import { t } from '../../i18n/index.js';
import { formatScaleRange } from '../unitLabels.js';
import UiButton from '../kit/UiButton.vue';
import UiCloseButton from '../kit/UiCloseButton.vue';
import RailCardSetting from './RailCardSetting.vue';
import RailChips from './RailChips.vue';
@@ -166,28 +167,23 @@ function legendView(legend) {
:title="action.title || undefined"
@click="dispatch(action, block)"
>{{ action.label }}</a
><button
><UiButton
v-else
:class="[
'data-toggle-chip',
{ active: action.pressed, 'is-reserved': action.reserved },
]"
type="button"
:class="['data-toggle-chip', { 'is-reserved': action.reserved }]"
:data-action-id="action.id"
:title="action.title || undefined"
:disabled="Boolean(action.disabled)"
:aria-pressed="
action.pressed === undefined
? undefined
: String(Boolean(action.pressed))
:pressed="
action.pressed === undefined ? undefined : Boolean(action.pressed)
"
pressed-class="active"
:aria-hidden="
action.reserved === undefined
? undefined
: String(Boolean(action.reserved))
"
@click="dispatch(action, block)"
>{{ action.label }}</button
>{{ action.label }}</UiButton
><span class="rail-card-action-hint" :hidden="!action.hint">{{
action.hint || ''
}}</span></template
+5 -6
View File
@@ -1,5 +1,6 @@
<script setup>
import UiButton from '../kit/UiButton.vue';
import UiIcon from '../kit/UiIcon.vue';
// Keyed chips shared by rail cards; the owner decides what a click does.
// An `icon` chip shows a Material Symbol (named in index.html's `icon_names`
@@ -29,11 +30,9 @@ const chipClass = (chip) =>
:disabled="Boolean(chip.disabled)"
:aria-busy="String(Boolean(chip.busy))"
@click="onSelect(chip)"
><span
v-if="chip.icon"
class="material-symbols-outlined"
aria-hidden="true"
>{{ chip.icon }}</span
><template v-else>{{ chip.label }}</template></UiButton
><UiIcon v-if="chip.icon" :name="chip.icon" :size="null" /><template
v-else
>{{ chip.label }}</template
></UiButton
>
</template>
+6 -5
View File
@@ -1,5 +1,6 @@
<script setup>
import { onMounted, onUpdated, ref } from 'vue';
import UiButton from '../kit/UiButton.vue';
// An ordered list whose rows keep their identity, so a focused row stays.
const props = defineProps({
@@ -10,7 +11,7 @@ const props = defineProps({
const root = ref(null);
const rowClass = (item) =>
`data-row-list-item${item.disabled ? ' note' : ''}${item.active ? ' active' : ''}${item.current ? ' current' : ''}`;
`data-row-list-item${item.disabled ? ' note' : ''}${item.current ? ' current' : ''}`;
// Follow the flight, but never steal a scroll the reader is making
// themselves: only when the step actually changed.
@@ -43,19 +44,19 @@ onUpdated(followCurrent);
v-for="item in list?.items ?? []"
:key="item.id"
:data-list-item-id="item.id"
><button
type="button"
><UiButton
:class="rowClass(item)"
:data-list-item-id="item.id"
:disabled="Boolean(item.disabled)"
:aria-current="item.current ? 'step' : 'false'"
:aria-pressed="item.active ? 'true' : 'false'"
:pressed="Boolean(item.active)"
pressed-class="active"
:title="String(item.text ?? '')"
@click="onSelect(item)"
><span class="data-row-list-lead">{{ String(item.lead ?? '') }}</span
><span class="data-row-list-text">{{
String(item.text ?? '')
}}</span></button
}}</span></UiButton
></li
></ol
>
+7 -9
View File
@@ -1,5 +1,6 @@
<script setup>
import { t } from '../../i18n/index.js';
import UiButton from '../kit/UiButton.vue';
// One imagery day in the strip. The owner computes every value; clicks reach
// it through the readout's delegated listener.
@@ -46,21 +47,18 @@ defineProps({
><div class="ri-card-sensor">{{ card.sensor }}</div
><div class="ri-card-cloud">{{ card.cloud }}</div
><div class="ri-card-chips"
><button
><UiButton
v-for="chip in card.chips"
:key="chip.slot"
type="button"
:class="[
'data-toggle-chip ri-chip',
{ active: chip.active, 'is-reserved': chip.reserved },
]"
:class="['data-toggle-chip ri-chip', { 'is-reserved': chip.reserved }]"
tabindex="-1"
:data-slot="chip.slot"
:disabled="chip.disabled"
:aria-pressed="String(chip.active)"
:disabled="Boolean(chip.disabled)"
:pressed="Boolean(chip.active)"
pressed-class="active"
:aria-hidden="String(chip.reserved)"
:aria-label="chip.ariaLabel"
>{{ chip.label }}</button
>{{ chip.label }}</UiButton
></div
></div
>
+8 -11
View File
@@ -1,6 +1,7 @@
<script setup>
import { computed } from 'vue';
import { t } from '../../i18n/index.js';
import UiButton from '../kit/UiButton.vue';
import UiCloseButton from '../kit/UiCloseButton.vue';
import UiSegmented from '../kit/UiSegmented.vue';
import RailCardBlocks from '../rail/RailCardBlocks.vue';
@@ -51,17 +52,16 @@ const modeOptions = computed(() =>
aria-live="polite"
:title="view.notice.text"
>{{ view.notice.text }}</span
><button
><UiButton
id="ri-zoom-in"
:class="[
'data-toggle-chip ri-zoom-in',
{ 'is-reserved': !view.notice.fit },
]"
type="button"
:title="t('Fly in until the view fits the 1,000 km limit')"
:disabled="!view.notice.fit"
:aria-hidden="String(!view.notice.fit)"
>{{ t('ZOOM IN') }}</button
>{{ t('ZOOM IN') }}</UiButton
></div
><div
id="ri-strip"
@@ -131,21 +131,18 @@ const modeOptions = computed(() =>
max="100"
step="1"
:aria-label="t('Imagery opacity')"
:disabled="!view.opacityEnabled" /><button
:disabled="!view.opacityEnabled" /><UiButton
id="ri-swap"
:class="[
'data-toggle-chip ri-swap',
{
'is-reserved': !view.swap.live,
active: view.swap.pressed,
},
{ 'is-reserved': !view.swap.live },
]"
type="button"
:title="t('Trade the two sides of the divider')"
:disabled="!view.swap.live"
:aria-hidden="String(!view.swap.live)"
:aria-pressed="String(view.swap.pressed)"
>{{ t('SWAP') }}</button
:pressed="Boolean(view.swap.pressed)"
pressed-class="active"
>{{ t('SWAP') }}</UiButton
><div class="ri-exports"
><RailCardBlocks
:blocks="view.exports"
+4 -3
View File
@@ -417,9 +417,10 @@ export class ShareRestoration {
this._layerStateRestorePromise = this._layerStateCoordinator.start({
shareLayerState: this._initialShareState?.layerState || null,
shareCreatedAtMs: this._initialShareState?.sharedAtMs ?? null,
// Any valid camera/style share isolates recipient-local preferences,
// including legacy and malformed-v2 layer payloads.
allowLocalState: !this._initialShareState,
// A link restores what it carries; a bare address is a clean start
// with the default layers. Saved layer choices never come back on
// their own, so clearing the address always resets the view.
allowLocalState: false,
});
if (this._initialShareSelectionSuperseded) {
this._layerStateCoordinator.cancelPendingShareTracking(
+5 -4
View File
@@ -1,9 +1,10 @@
/* Core's close, dismiss and clear buttons draw a bare glyph: no padding,
* border or background of their own, and a pointer. The kit's
* UiCloseButton wears it as .ui-close-button; the guide's close button,
* built in script, shares the rule. It selects one class and loads before
* the feature stylesheets, so each feature rule still sets its size, colour,
* hover and any surface (a border, a chip, a tinted square). */
* UiCloseButton wears it as .ui-close-button, and the guide's close (a
* UiCloseButton too) shares the rule by its feature class. It selects one
* class and loads before the feature stylesheets, so each feature rule still
* sets its size, colour, hover and any surface (a border, a chip, a tinted
* square). */
.ui-close-button,
.gev-guide-close {
padding: 0;
+3 -1
View File
@@ -703,7 +703,9 @@ html:not([lang='en']) .cockpit-roll-token.is-separator {
color: var(--cockpit-accent);
font-size: 12px;
}
.cockpit-heading-caret {
/* Inside the compass, so it outranks the kit icon's own display and
line height. */
.cockpit-compass .cockpit-heading-caret {
display: block;
height: 20px;
color: var(--cockpit-accent);
+22 -20
View File
@@ -17,6 +17,8 @@ import CockpitProgress from './panels/CockpitProgress.vue';
import CockpitRadar from './panels/CockpitRadar.vue';
import CockpitRollingValue from './panels/CockpitRollingValue.vue';
import CockpitUtilityControls from './panels/CockpitUtilityControls.vue';
import UiButton from '../kit/UiButton.vue';
import UiIcon from '../kit/UiIcon.vue';
// The Cockpit HUD. The Cockpit controller presents the instruments, the
// destination arrow and the vision selector on every HUD update; until it
@@ -171,7 +173,7 @@ const tickStyle = (tick) =>
<span v-for="(tick, index) in hud.speedRim.ticks" :key="index" data-speed-rim-tick :hidden="tick.hidden" :class="{ major: tick.major }" :style="tickStyle(tick)"><b>{{ tick.label }}</b><i></i></span>
</div>
<div class="cockpit-altitude-rim-pointer">
<span class="material-symbols-outlined">arrow_right</span>
<UiIcon name="arrow_right" :size="null" />
<strong id="cockpit-speed-rim-value">{{ hud.speedRim.value }}</strong>
</div>
</div>
@@ -183,7 +185,7 @@ const tickStyle = (tick) =>
</div>
<div class="cockpit-altitude-rim-pointer">
<strong id="cockpit-altitude-rim-value">{{ hud.altitudeRim.value }}</strong>
<span class="material-symbols-outlined">arrow_left</span>
<UiIcon name="arrow_left" :size="null" />
</div>
</div>
<div class="cockpit-topline">
@@ -193,21 +195,21 @@ const tickStyle = (tick) =>
<span id="cockpit-aircraft-meta" v-class-toggle="{ emergency: hud.meta.emergency }" class="cockpit-aircraft-meta" :data-tone="generic ? hud.meta.tone : undefined">{{ hud.meta.text }}</span>
</div>
<div class="cockpit-vision-controls" role="group" :aria-label="t('Cockpit vision style')">
<button id="cockpit-vision-previous" class="cockpit-vision-nav" type="button" :aria-label="t('Previous cockpit vision style')" :title="t('Previous vision style')">
<span class="material-symbols-outlined" aria-hidden="true">chevron_left</span>
<UiButton id="cockpit-vision-previous" class="cockpit-vision-nav" :aria-label="t('Previous cockpit vision style')" :title="t('Previous vision style')">
<UiIcon name="chevron_left" :size="null" />
<small>{{ t('PREV') }}</small>
</button>
<button id="cockpit-vision-current" class="cockpit-vision-current" type="button" :data-cockpit-vision="v.mode" :aria-label="visionLabel" :title="visionTitle">
</UiButton>
<UiButton id="cockpit-vision-current" class="cockpit-vision-current" :data-cockpit-vision="v.mode" :aria-label="visionLabel" :title="visionTitle">
<small>{{ t('CURRENT') }}</small>
<strong id="cockpit-vision-current-label" aria-live="polite">{{ v.label }}</strong>
</button>
<button id="cockpit-vision-next" class="cockpit-vision-nav" type="button" :aria-label="t('Next cockpit vision style')" :title="t('Next vision style')">
</UiButton>
<UiButton id="cockpit-vision-next" class="cockpit-vision-nav" :aria-label="t('Next cockpit vision style')" :title="t('Next vision style')">
<small>{{ t('NEXT') }}</small>
<span class="material-symbols-outlined" aria-hidden="true">chevron_right</span>
</button>
<UiIcon name="chevron_right" :size="null" />
</UiButton>
</div>
</div>
<div v-if="!orbital && !generic" class="cockpit-reticle material-symbols-outlined" aria-hidden="true">my_location</div>
<UiIcon v-if="!orbital && !generic" name="my_location" class="cockpit-reticle" :size="null" />
<!-- A provider's banner: a status that names where the subject is. -->
<div v-if="generic && hud.banner" class="cockpit-banner" role="status" :data-tone="hud.banner.tone">
<strong>{{ hud.banner.title }}</strong>
@@ -216,9 +218,9 @@ const tickStyle = (tick) =>
<!-- A view turned off its rest says where it looks and offers the way back. -->
<div v-if="looks" class="cockpit-look" :hidden="!look.offset">
<span id="cockpit-look-readout" class="cockpit-look-readout" aria-live="polite">{{ look.readout }}</span>
<button id="cockpit-look-ahead" type="button" class="cockpit-look-ahead" :aria-label="aheadLabel" :title="t('Look ahead (Home or 0)')" aria-keyshortcuts="Home 0">
<UiButton id="cockpit-look-ahead" class="cockpit-look-ahead" :aria-label="aheadLabel" :title="t('Look ahead (Home or 0)')" aria-keyshortcuts="Home 0">
<span>{{ t('LOOK AHEAD') }}</span>
</button>
</UiButton>
</div>
<div v-if="!orbital" class="cockpit-compass" :aria-label="generic ? hudLabel : bridge ? t('Current vessel heading') : t('Current aircraft heading')">
<div class="cockpit-instrument-row">
@@ -241,7 +243,7 @@ const tickStyle = (tick) =>
<span class="cockpit-readout-unit">{{ t('FT') }}</span>
</div>
</div>
<span class="cockpit-heading-caret material-symbols-outlined" aria-hidden="true">arrow_drop_down</span>
<UiIcon name="arrow_drop_down" class="cockpit-heading-caret" :size="null" />
<div class="cockpit-compass-tape" id="cockpit-compass-tape" aria-hidden="true" :style="bridge ? { '--tape-shift': tapeShift } : undefined"><span v-for="division in hud.compass" :key="division.heading ?? division.slot" :class="(division.active ?? division.slot === 0) ? 'active' : ''" :style="{ '--slot': division.slot, '--depth': Math.abs(division.slot) }">{{ division.label }}</span><template v-if="bridge"><i v-if="hud.compassMarkers?.prograde != null" class="cockpit-compass-marker cockpit-compass-prograde" aria-hidden="true" :style="{ '--slot': hud.compassMarkers.prograde }"></i><i v-if="hud.compassMarkers?.retrograde != null" class="cockpit-compass-marker cockpit-compass-retrograde" aria-hidden="true" :style="{ '--slot': hud.compassMarkers.retrograde }"></i></template></div>
</div>
<div v-if="!orbital" class="cockpit-position-readout">
@@ -274,13 +276,13 @@ const tickStyle = (tick) =>
</section>
<nav id="view-switcher" :aria-label="t('View switcher')">
<button id="cockpit-reset-globe" type="button" :aria-label="resetBusy ? t('Resetting cockpit to full globe view') : t('Reset cockpit to full globe view')" :title="t('Exit cockpit and return to full globe view')" :hidden="!active" @click="globe.act('reset')">
<span class="material-symbols-outlined" aria-hidden="true">public</span>
<UiButton id="cockpit-reset-globe" :aria-label="resetBusy ? t('Resetting cockpit to full globe view') : t('Reset cockpit to full globe view')" :title="t('Exit cockpit and return to full globe view')" :hidden="!active" @click="globe.act('reset')">
<UiIcon name="public" :size="null" />
<span>{{ t('RESET') }}</span>
</button>
<button id="map-view-switch" type="button" :aria-label="exitLabel" aria-keyshortcuts="Escape" :title="exitLabel" :hidden="!active">
<span class="material-symbols-outlined" aria-hidden="true">close_fullscreen</span>
</UiButton>
<UiButton id="map-view-switch" :aria-label="exitLabel" aria-keyshortcuts="Escape" :title="exitLabel" :hidden="!active">
<UiIcon name="close_fullscreen" :size="null" />
<span>{{ exitText }}</span>
</button>
</UiButton>
</nav>
</template>
+19 -19
View File
@@ -72,45 +72,45 @@ function selectMapSource(chip) {
<div v-if="slot === 'control'" id="control-panel" v-panel-state="'control-panel'" class="panel-collapsible collapsed">
<div class="panel-glow"></div>
<div class="panel-inner">
<button id="control-panel-toggle" class="panel-header dock-tray-toggle" type="button"
<UiButton id="control-panel-toggle" class="panel-header dock-tray-toggle"
data-dock-toggle-target="control-panel" :aria-expanded="String(panels['control-panel']?.collapsed === false)"
aria-controls="control-panel-popover" :aria-label="trayWords('control-panel', t('VISUAL PRESETS'), t('Expand Visual Presets'))" :title="trayWords('control-panel', t('VISUAL PRESETS'), undefined)">
<span class="panel-title"><span class="dock-label-icon dock-label-icon-presets" aria-hidden="true"></span>{{ t('VISUAL PRESETS') }}</span>
<span class="panel-divider"></span>
</button>
</UiButton>
<div id="control-panel-popover" class="dock-popover-content">
<UiButton class="dock-pin-btn" data-pin-target="control-panel" :label="t('Pin visual presets')" :title="t('Keep visual presets open')" :pressed="!!panels['control-panel']?.pinned" @click="pin($event, 'control-panel')"><img src="/pin.svg" alt="" /></UiButton>
<div id="style-buttons" class="button-grid">
<button class="style-btn active" data-style="normal" @click="display.act('setStyle', 'normal')" v-class-toggle="{ ...(style && { active: style.name === 'normal' }) }" :title="t('Show the globe without a visual filter.')">
<UiButton class="style-btn" data-style="normal" :pressed="!style || style.name === 'normal'" pressed-class="active" @click="display.act('setStyle', 'normal')" :title="t('Show the globe without a visual filter.')">
<span class="btn-icon">◯</span>
<span class="btn-label">{{ t('Normal') }}</span>
<span class="btn-key">1</span>
</button>
<button class="style-btn" data-style="retro" @click="display.act('setStyle', 'retro')" v-class-toggle="{ ...(style && { active: style.name === 'retro' }) }" :title="t('Emulate a green phosphor CRT with scanlines and screen curvature.')">
</UiButton>
<UiButton class="style-btn" data-style="retro" :pressed="style?.name === 'retro'" pressed-class="active" @click="display.act('setStyle', 'retro')" :title="t('Emulate a green phosphor CRT with scanlines and screen curvature.')">
<span class="btn-icon">▦</span>
<span class="btn-label">{{ t('CRT') }}</span>
<span class="btn-key">2</span>
</button>
<button class="style-btn" data-style="surveillance" @click="display.act('setStyle', 'surveillance')" v-class-toggle="{ ...(style && { active: style.name === 'surveillance' }) }" :title="t('Simulate night-vision goggles with green intensification and a tube vignette.')">
</UiButton>
<UiButton class="style-btn" data-style="surveillance" :pressed="style?.name === 'surveillance'" pressed-class="active" @click="display.act('setStyle', 'surveillance')" :title="t('Simulate night-vision goggles with green intensification and a tube vignette.')">
<span class="btn-icon">🌙</span>
<span class="btn-label">{{ t('NVG') }}</span>
<span class="btn-key">3</span>
</button>
<button class="style-btn" data-style="thermal" @click="display.act('setStyle', 'thermal')" v-class-toggle="{ ...(style && { active: style.name === 'thermal' }) }" :title="t('Simulate FLIR-style thermal contrast. Turn up Ironbow for color.')">
</UiButton>
<UiButton class="style-btn" data-style="thermal" :pressed="style?.name === 'thermal'" pressed-class="active" @click="display.act('setStyle', 'thermal')" :title="t('Simulate FLIR-style thermal contrast. Turn up Ironbow for color.')">
<span class="btn-icon">🌡️</span>
<span class="btn-label">{{ t('FLIR') }}</span>
<span class="btn-key">4</span>
</button>
<button class="style-btn" data-style="anime" @click="display.act('setStyle', 'anime')" v-class-toggle="{ ...(style && { active: style.name === 'anime' }) }" :title="t('Apply bright cel-shaded color and illustrated outlines.')">
</UiButton>
<UiButton class="style-btn" data-style="anime" :pressed="style?.name === 'anime'" pressed-class="active" @click="display.act('setStyle', 'anime')" :title="t('Apply bright cel-shaded color and illustrated outlines.')">
<span class="btn-icon">✦</span>
<span class="btn-label">{{ t('Anime') }}</span>
<span class="btn-key">5</span>
</button>
<button class="style-btn" data-style="noir" @click="display.act('setStyle', 'noir')" v-class-toggle="{ ...(style && { active: style.name === 'noir' }) }" :title="t('Apply high-contrast monochrome film-noir grading.')">
</UiButton>
<UiButton class="style-btn" data-style="noir" :pressed="style?.name === 'noir'" pressed-class="active" @click="display.act('setStyle', 'noir')" :title="t('Apply high-contrast monochrome film-noir grading.')">
<span class="btn-icon">◐</span>
<span class="btn-label">{{ t('Noir') }}</span>
<span class="btn-key">6</span>
</button>
</UiButton>
</div>
<section class="map-source-section" aria-labelledby="map-source-label">
<div class="map-source-heading">
@@ -134,10 +134,10 @@ function selectMapSource(chip) {
<div class="panel-glow"></div>
<div class="location-inner">
<div class="location-toolbar">
<button id="location-bar-toggle" class="dock-tray-toggle" type="button" data-dock-toggle-target="location-bar" aria-controls="location-bar-popover" :aria-expanded="String(panels['location-bar']?.collapsed === false)" :aria-label="trayWords('location-bar', t('LOCATION'), t('Expand LOCATION'))" :title="trayWords('location-bar', t('LOCATION'), t('Expand LOCATION'))">
<UiButton id="location-bar-toggle" class="dock-tray-toggle" data-dock-toggle-target="location-bar" aria-controls="location-bar-popover" :aria-expanded="String(panels['location-bar']?.collapsed === false)" :aria-label="trayWords('location-bar', t('LOCATION'), t('Expand LOCATION'))" :title="trayWords('location-bar', t('LOCATION'), t('Expand LOCATION'))">
<span class="location-toolbar-label"><span class="dock-label-icon dock-label-icon-location" aria-hidden="true"></span>{{ t('LOCATION') }}</span>
</button>
<button class="panel-collapse-btn" data-collapse-target="location-bar" :title="t('Collapse panel')" @click="chrome.act('toggle', 'location-bar')">+</button>
</UiButton>
<UiButton class="panel-collapse-btn" data-collapse-target="location-bar" :title="t('Collapse panel')" @click="chrome.act('toggle', 'location-bar')">+</UiButton>
</div>
<div id="location-mini-status" class="location-mini-status" aria-live="polite">
<div id="location-mini-city" class="location-mini-city">{{ loc ? loc.status.city : t('📍 Location: --') }}</div>
@@ -150,9 +150,9 @@ function selectMapSource(chip) {
<div class="location-city-row">
<div id="location-pills" class="location-pills"><UiButton v-for="city in loc?.cities" :key="city.id" class="location-pill" :pressed="Boolean(city.active)" pressed-class="active" :data-location-id="city.id" @click="locationControls?.chooseCity(city.id)">{{ city.label }}</UiButton></div>
<div class="location-search-wrap">
<button id="search-toggle" class="search-toggle-btn" :title="t('Search any location')" @click="locationControls?.toggleSearch()">
<UiButton id="search-toggle" class="search-toggle-btn" :title="t('Search any location')" @click="locationControls?.toggleSearch()">
<span>&#x1F50E;</span>
</button>
</UiButton>
<input type="text" id="location-search" v-class-toggle="{ expanded: !!loc?.searchExpanded, searching: !!loc?.searching }" :placeholder="t('Search any location...')" autocomplete="off" spellcheck="false" :aria-label="t('Search location by name or coordinates')" :aria-invalid="loc?.searchOrigin !== 'omnibar' && loc?.searchError ? 'true' : null" :aria-describedby="loc?.searchOrigin !== 'omnibar' && loc?.searchError ? 'location-search-error' : null" />
</div>
</div>
+21 -20
View File
@@ -17,6 +17,7 @@ import ViewContext from './panels/ViewContext.vue';
import SpaceMissionsPanel from './panels/SpaceMissionsPanel.vue';
import RadioPanel from './panels/RadioPanel.vue';
import UiButton from '../kit/UiButton.vue';
import UiIcon from '../kit/UiIcon.vue';
import UiSearchField from '../kit/UiSearchField.vue';
import { cockpitEntryFace } from '../cockpitPresentation.js';
import { LAYER_TABS, TAB_AFFECTS, activeTab, availableTabs, contextReady, enabledLayerIds, setEnabledLayers, tabTarget } from '../contextLayerTabs.js';
@@ -182,27 +183,27 @@ watch(
</RailPanel>
<RailPanel id="global-context-panel" start-collapsed v-class-toggle="{ ...(ctx && { 'context-enabled': ctx.enabled }) }" :data-context-mode="ctx?.mode" :data-context-tab="activeTab" :title="t('CONTEXT')" sideways scroll rail-scroller>
<template #actions>
<button type="button" class="context-dock-btn" :aria-pressed="String(contextSearchOpen)" :aria-label="contextSearchOpen ? t('Close Context search') : t('Search in Context')" :title="contextSearchOpen ? t('Close search') : t('Search in Context')" @click="toggleSearch">
<span class="material-symbols-outlined" aria-hidden="true">search</span>
</button>
<button type="button" class="context-dock-btn" :aria-pressed="String(docked)" :aria-label="docked ? t('Shrink Context back to a panel') : t('Expand Context to a full-height column')" :title="docked ? t('Shrink') : t('Expand')" @click="setDocked(!docked)">
<span class="material-symbols-outlined" aria-hidden="true">{{ docked ? 'close_fullscreen' : 'open_in_full' }}</span>
</button>
<UiButton class="context-dock-btn" :pressed="Boolean(contextSearchOpen)" :aria-label="contextSearchOpen ? t('Close Context search') : t('Search in Context')" :title="contextSearchOpen ? t('Close search') : t('Search in Context')" @click="toggleSearch">
<UiIcon name="search" :size="null" />
</UiButton>
<UiButton class="context-dock-btn" :pressed="docked" :aria-label="docked ? t('Shrink Context back to a panel') : t('Expand Context to a full-height column')" :title="docked ? t('Shrink') : t('Expand')" @click="setDocked(!docked)">
<UiIcon :name="docked ? 'close_fullscreen' : 'open_in_full'" :size="null" />
</UiButton>
</template>
<div class="cyber-panel-body ui-scroll" data-rail-scroller>
<UiSearchField v-if="contextSearchOpen" ref="searchInput" v-model="contextSearchText" class="context-search" role="search" input-class="context-search__input" :label="searchHint" :placeholder="searchHint" autocomplete="off" spellcheck="false" :clear-label="t('Clear search')" clear-class="context-search__clear" @escape="closeContextSearch" />
<div v-if="availableTabs.length" class="context-tabs" role="tablist" :aria-label="t('Context tabs')">
<button id="context-tab-btn-view" type="button" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'view' }" :aria-selected="String(activeTab === 'view')" aria-controls="context-tab-view" :tabindex="activeTab === 'view' ? 0 : -1" @click="activeTab = 'view'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
<span class="material-symbols-outlined" aria-hidden="true">visibility</span><span class="context-tabs__label">{{ t('Inspector') }}</span>
</button>
<button id="context-tab-btn-props" type="button" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'props' }" :aria-selected="String(activeTab === 'props')" aria-controls="context-tab-props" :tabindex="activeTab === 'props' ? 0 : -1" @click="activeTab = 'props'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
<span class="material-symbols-outlined" aria-hidden="true">tune</span><span class="context-tabs__label">{{ t('Properties') }}</span>
</button>
<UiButton id="context-tab-btn-view" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'view' }" :aria-selected="String(activeTab === 'view')" aria-controls="context-tab-view" :tabindex="activeTab === 'view' ? 0 : -1" @click="activeTab = 'view'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
<UiIcon name="visibility" :size="null" /><span class="context-tabs__label">{{ t('Inspector') }}</span>
</UiButton>
<UiButton id="context-tab-btn-props" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'props' }" :aria-selected="String(activeTab === 'props')" aria-controls="context-tab-props" :tabindex="activeTab === 'props' ? 0 : -1" @click="activeTab = 'props'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
<UiIcon name="tune" :size="null" /><span class="context-tabs__label">{{ t('Properties') }}</span>
</UiButton>
</div>
<!-- Properties: settings of the layers that are on, one section each. -->
<div id="context-tab-props" class="context-props" :hidden="activeTab !== 'props'" role="tabpanel" aria-labelledby="context-tab-btn-props">
<section v-for="tab in LAYER_TABS" v-show="isShown(tab.id)" :key="tab.id" class="context-props__section">
<h4 class="context-props__heading"><span class="material-symbols-outlined" aria-hidden="true">{{ tab.icon }}</span>{{ t(tab.label) }}</h4>
<h4 class="context-props__heading"><UiIcon :name="tab.icon" :size="null" />{{ t(tab.label) }}</h4>
<ul v-if="affects(tab.id).length" class="context-props__layers">
<li v-for="layer in affects(tab.id)" :key="layer.id"><i :style="{ background: layer.color }" aria-hidden="true"></i>{{ layer.name }}</li>
</ul>
@@ -211,10 +212,10 @@ watch(
</div>
<RadioPanel />
<div class="global-context-modes" role="tablist" :aria-label="t('Context mode')">
<button id="global-context-flights-btn" class="context-mode-button" v-class-toggle="{ active: ctx?.flightsActive }" type="button" role="tab" tabindex="0" :aria-selected="String(ctx?.flightsActive ?? false)" :aria-disabled="ctx && String(ctx.busy)" :aria-busy="ctx && String(ctx.busy)" aria-controls="context-flights-view" :aria-label="t('CONTACTS')" :title="t('Cycles the nearest contacts of whatever type you select — planes, vessels, installations. Satellites track independently.')">
<span class="material-symbols-outlined" aria-hidden="true">radar</span>
<UiButton id="global-context-flights-btn" class="context-mode-button" v-class-toggle="{ active: ctx?.flightsActive }" role="tab" tabindex="0" :aria-selected="String(ctx?.flightsActive ?? false)" :aria-disabled="ctx && String(ctx.busy)" :aria-busy="ctx && String(ctx.busy)" aria-controls="context-flights-view" :aria-label="t('CONTACTS')" :title="t('Cycles the nearest contacts of whatever type you select — planes, vessels, installations. Satellites track independently.')">
<UiIcon name="radar" :size="null" />
<span>{{ t('CONTACTS') }}</span>
</button>
</UiButton>
</div>
<div id="context-mode-standby" class="context-mode-standby" :hidden="ctx?.enabled">
<strong>{{ t('SELECT CONTEXT') }}</strong>
@@ -222,11 +223,11 @@ watch(
</div>
<section id="context-flights-view" class="context-mode-view" role="tabpanel" aria-labelledby="global-context-flights-btn" :hidden="!ctx?.flightsActive">
<div class="global-context-actions" :aria-label="t('Contact Context actions')">
<button id="cockpit-entry" type="button" :hidden="!cockpit?.entryAvailable">
<span class="material-symbols-outlined" aria-hidden="true">{{ entry.icon }}</span>
<UiButton id="cockpit-entry" :hidden="!cockpit?.entryAvailable">
<UiIcon :name="entry.icon" :size="null" />
<span>{{ entry.label }}</span>
</button>
<button id="installations-search-btn" class="panel-layer-toggle" type="button" :aria-disabled="ctx && String(ctx.installationsBusy)" :aria-busy="ctx && String(ctx.installationsBusy)">{{ t('SEARCH NEARBY SITES') }}</button>
</UiButton>
<UiButton id="installations-search-btn" class="panel-layer-toggle" :aria-disabled="ctx && String(ctx.installationsBusy)" :aria-busy="ctx && String(ctx.installationsBusy)">{{ t('SEARCH NEARBY SITES') }}</UiButton>
<UiButton id="tr3b-toggle" class="tr3b-toggle" :pressed="!!cockpit?.tr3b?.converted" :hidden="!cockpit?.tr3b" :aria-label="t('Reclassify tracked contact as TR-3B')" :title="cockpit?.tr3b?.converted ? t('Restore real aircraft') : t('Reclassify as TR-3B')">🛸</UiButton>
</div>
<AwarenessPanel v-if="!contactsMatchCard" />
+2 -1
View File
@@ -2,11 +2,12 @@
import { t } from '../../i18n/index.js';
import { useDisplayStore } from '../stores/display.js';
import DisplayPanel from './panels/DisplayPanel.vue';
import UiButton from '../kit/UiButton.vue';
const display = useDisplayStore();
</script>
<template>
<DisplayPanel />
<button id="clean-view-exit" @click="display.act('exitCleanView')" :title="t('Return UI controls')">{{ t('EXIT CLEAN VIEW') }}</button>
<UiButton id="clean-view-exit" @click="display.act('exitCleanView')" :title="t('Return UI controls')">{{ t('EXIT CLEAN VIEW') }}</UiButton>
</template>
+5 -3
View File
@@ -4,6 +4,8 @@ import { storeToRefs } from 'pinia';
import { useHudStore } from '../stores/hud.js';
import { useCockpitStore } from '../stores/cockpit.js';
import { cockpitEntryFace } from '../cockpitPresentation.js';
import UiButton from '../kit/UiButton.vue';
import UiIcon from '../kit/UiIcon.vue';
// The readouts, visibility, layout variant and colors IntelHUD publishes.
const { hud } = storeToRefs(useHudStore());
@@ -56,10 +58,10 @@ const entry = computed(() =>
<div class="hud-readout"><div id="hud-gsd">{{ view.gsd }}</div></div>
<div class="hud-readout"><div id="hud-alt">{{ view.alt }}</div></div>
<div class="hud-readout"><div id="hud-ais-vessel" :class="['hud-ais-vessel', { active: view.vessel.active }]">{{ view.vessel.text }}</div></div>
<button id="cockpit-entry-readout" type="button" :hidden="!cockpit?.entryAvailable">
<span class="material-symbols-outlined" aria-hidden="true">{{ entry.icon }}</span>
<UiButton id="cockpit-entry-readout" :hidden="!cockpit?.entryAvailable">
<UiIcon :name="entry.icon" :size="null" />
<span>{{ entry.label }}</span>
</button>
</UiButton>
</div>
<div class="hud-bracket">┘</div>
</div>
+1 -1
View File
@@ -78,7 +78,7 @@ const vToastText = {
<!-- Title -->
<div id="title-bar">
<div class="title-glow"></div>
<h1 aria-labelledby="title-wordmark"><button type="button" class="title-logo brand-logo" data-logo-gaze data-logo-src="/logo.svg" :aria-label="t('Back to live at the starting view')" :title="t('Back to live at the starting view')" @click="globeActions.act('home')"><img src="/logo.svg" alt="" /></button> <span id="title-wordmark" translate="no">GOD'S EYE <span class="title-accent">VIEW</span></span></h1>
<h1 aria-labelledby="title-wordmark"><UiButton class="title-logo brand-logo" data-logo-gaze data-logo-src="/logo.svg" :aria-label="t('Back to live at the starting view')" :title="t('Back to live at the starting view')" @click="globeActions.act('home')"><img src="/logo.svg" alt="" /></UiButton> <span id="title-wordmark" translate="no">GOD'S EYE <span class="title-accent">VIEW</span></span></h1>
<p class="subtitle scene-text-holdout">{{ t('NO PLACE LEFT BEHIND') }}</p>
<div v-if="fps" class="frame-rate-readout scene-text-holdout" :hidden="!fps.visible" :title="t('Rendered globe frames per second · toggle with `')">{{ fps.text }}</div>
</div>
+6 -6
View File
@@ -18,6 +18,7 @@ import {
entryPlacement,
} from '../../stories/format.js';
import { guardStoriesKeyboard } from '../../stories/keyboard.js';
import UiButton from '../kit/UiButton.vue';
// The screens, their styles and the story data load with Stories (see
// src/stories/boot.js); only the button, popup and toast load with GEV.
@@ -318,18 +319,17 @@ watch([mode, storyId], () => nextTick(watchCredit));
<!-- GEV: the Stories entry, its first-visit popup and the Opened-in-GEV toast -->
<template v-if="mode === 'closed' && store.available">
<button
<UiButton
id="hStories"
class="tbtn accent gs-entry"
:class="{ 'gs-entry-compact': entry.compact }"
type="button"
:aria-label="entry.compact ? t('Stories') : undefined"
:style="{ top: `${entry.top}px`, right: `${entry.right}px` }"
@click="openExplore"
>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="3" /><path d="M10 9.5v5l4.5-2.5z" fill="currentColor" /></svg>
<span>{{ t('Stories') }}</span>
</button>
</UiButton>
<div
v-if="popOpen"
id="hPop"
@@ -342,14 +342,14 @@ watch([mode, storyId], () => nextTick(watchCredit));
<h2 id="hPopT">{{ t('GEV Stories') }}</h2>
<p>{{ t('Curated, interactive views of what is happening on Earth. Play one, take over the map whenever you like, then pick the story back up.') }}</p>
<div class="row">
<button class="tbtn solid" type="button" @click="openExplore">{{ t('Browse stories') }}</button>
<button class="tbtn" type="button" @click="markPopSeen">{{ t('Not now') }}</button>
<UiButton class="tbtn solid" @click="openExplore">{{ t('Browse stories') }}</UiButton>
<UiButton class="tbtn" @click="markPopSeen">{{ t('Not now') }}</UiButton>
</div>
</div>
<div v-if="openedToast" id="hToast" class="h-toast glass gs-opened-toast" role="status">
<b>{{ t('Opened in GEV') }}</b>
<span>{{ openedToast.title }} · {{ openedWhen }}</span>
<button class="tbtn" type="button" @click="backToStory">{{ t('Back to story') }}</button>
<UiButton class="tbtn" @click="backToStory">{{ t('Back to story') }}</UiButton>
</div>
</template>
+22 -20
View File
@@ -3,7 +3,9 @@ import { storeToRefs } from 'pinia';
import { nextTick, ref, watch } from 'vue';
import { msg, t } from '../../i18n/index.js';
import { FIRST_RUN_LINKS, environmentalLabel } from '../../firstRunCopy.js';
import UiButton from '../kit/UiButton.vue';
import UiCheckbox from '../kit/UiCheckbox.vue';
import UiIcon from '../kit/UiIcon.vue';
import { useFirstRunStore } from '../stores/firstRun.js';
import { useStoriesStore } from '../stores/stories.js';
@@ -165,10 +167,10 @@ function onSuppress(event) {
<!-- A button, not just a hint: phones and tablets have no ESC key. It
closes exactly as ESC does, for this session only. Touch screens
see SKIP; a keyboard sees SKIP · ESC (first-run.css). -->
<button type="button" class="first-run-dismiss" data-first-run-dismiss @click="controls?.dismiss()">
<UiButton class="first-run-dismiss" data-first-run-dismiss @click="controls?.dismiss()">
<span class="first-run-dismiss-key">{{ t('SKIP · ESC') }}</span>
<span class="first-run-dismiss-touch">{{ t('SKIP') }}</span>
</button>
</UiButton>
</header>
<h2 id="first-run-title">{{ t(TITLES[step - 1]) }}</h2>
<p class="first-run-step-announcement" role="status" aria-live="polite" aria-atomic="true">{{ t(TITLES[step - 1]) }}</p>
@@ -207,22 +209,22 @@ function onSuppress(event) {
<section class="first-run-section" aria-labelledby="first-run-start-heading">
<h3 id="first-run-start-heading" class="first-run-section-title">{{ t('Start with') }}</h3>
<div class="first-run-missions first-run-missions--tiles" role="group" aria-labelledby="first-run-start-heading">
<button type="button" data-first-run-start="space-missions" :aria-pressed="String(start === 'space-missions')" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('space-missions')">
<span class="material-symbols-outlined" aria-hidden="true">rocket_launch</span>
<UiButton data-first-run-start="space-missions" :pressed="start === 'space-missions'" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('space-missions')">
<UiIcon name="rocket_launch" :size="null" />
<span><strong>{{ t('SPACE MISSIONS') }}</strong><small>{{ t('Launches, spacecraft and orbital context') }}</small></span>
</button>
<button type="button" data-first-run-start="environmental" :aria-pressed="String(start === 'environmental')" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('environmental')">
<span class="material-symbols-outlined" aria-hidden="true">local_fire_department</span>
</UiButton>
<UiButton data-first-run-start="environmental" :pressed="start === 'environmental'" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('environmental')">
<UiIcon name="local_fire_department" :size="null" />
<!-- The title is ENVIRONMENTAL_LABEL_CHOICE's label once initialized. -->
<!-- Subcopy names BOTH feeds this tile turns on, because the launcher
optimizes for the fully configured experience (owner ruling,
2026-08-23) — see the mission table in src/firstRunExperience.js. -->
<span><strong data-first-run-environmental-title>{{ launcher?.environmentalTitle ?? environmentalLabel().title }}</strong><small>{{ launcher?.environmentalSub ?? t(ENVIRONMENTAL_SUB) }}</small></span>
</button>
<button type="button" data-first-run-start="explore" :aria-pressed="String(start === 'explore')" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('explore')">
<span class="material-symbols-outlined" aria-hidden="true">public</span>
</UiButton>
<UiButton data-first-run-start="explore" :pressed="start === 'explore'" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('explore')">
<UiIcon name="public" :size="null" />
<span><strong>{{ t('EXPLORE MANUALLY') }}</strong><small>{{ t('Begin with a clean globe') }}</small></span>
</button>
</UiButton>
</div>
</section>
@@ -230,17 +232,17 @@ function onSuppress(event) {
<div v-else key="3" class="first-run-step">
<ul class="first-run-tips">
<li class="first-run-tip first-run-tip--search">
<span class="first-run-tip-art" aria-hidden="true"><span class="material-symbols-outlined">search</span><i class="first-run-tip-caret"></i></span>
<span class="first-run-tip-art" aria-hidden="true"><UiIcon name="search" :size="null" /><i class="first-run-tip-caret"></i></span>
<strong>{{ t('Search places') }}</strong>
<small>{{ t('Type a place into the search bar.') }}</small>
</li>
<li class="first-run-tip first-run-tip--layers">
<span class="first-run-tip-art" aria-hidden="true"><span class="material-symbols-outlined">layers</span><i class="first-run-tip-dot"></i></span>
<span class="first-run-tip-art" aria-hidden="true"><UiIcon name="layers" :size="null" /><i class="first-run-tip-dot"></i></span>
<strong>{{ t('Turn on layers') }}</strong>
<small>{{ t('Turn layers on to see flights, ships, cameras, weather and more.') }}</small>
</li>
<li class="first-run-tip first-run-tip--context">
<span class="first-run-tip-art" aria-hidden="true"><span class="material-symbols-outlined">my_location</span><i class="first-run-tip-ring"></i></span>
<span class="first-run-tip-art" aria-hidden="true"><UiIcon name="my_location" :size="null" /><i class="first-run-tip-ring"></i></span>
<strong>{{ t('Click anything') }}</strong>
<small>{{ t('Select a map item to see its details.') }}</small>
</li>
@@ -248,12 +250,12 @@ function onSuppress(event) {
<section class="first-run-section" aria-labelledby="first-run-deeper-heading">
<h3 id="first-run-deeper-heading" class="first-run-section-title">{{ t('Go deeper') }}</h3>
<div v-if="stories.available" class="first-run-link-card first-run-stories">
<div class="first-run-preview first-run-preview--stories" aria-hidden="true"><span class="material-symbols-outlined">movie</span></div>
<div class="first-run-preview first-run-preview--stories" aria-hidden="true"><UiIcon name="movie" :size="null" /></div>
<div class="first-run-link-body">
<p class="first-run-mode-title"><strong translate="no">GEV Stories</strong> <span class="first-run-tag">{{ t('NEW') }}</span></p>
<p class="first-run-mode-copy">{{ t('Curated, interactive views of what is happening on Earth. Play one, take over the map whenever you like, then pick the story back up.') }}</p>
</div>
<button type="button" class="first-run-link-button" data-first-run-stories :aria-disabled="String(settling || launcher?.busy === 'true')" @click="openStories">{{ t('BROWSE STORIES') }}</button>
<UiButton class="first-run-link-button" data-first-run-stories :aria-disabled="String(settling || launcher?.busy === 'true')" @click="openStories">{{ t('BROWSE STORIES') }}</UiButton>
</div>
</section>
@@ -304,10 +306,10 @@ function onSuppress(event) {
<p class="first-run-note" data-first-run-status role="status" aria-live="polite">{{ launcher?.status ?? '' }}</p>
<!-- The card's main action: God mode, starting where the selected tile
says (a clean globe by default). -->
<button v-if="step > 1" type="button" class="first-run-back" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="go(step - 1, $event)">{{ t('BACK') }}</button>
<button type="button" class="first-run-enter" :data-first-run-choice="step === STEPS ? start : undefined" :data-first-run-next="step < STEPS ? '' : undefined" data-first-run-primary aria-describedby="first-run-title first-run-description" @pointerdown="onPrimaryDown" @keydown.enter="onPrimaryKeydown" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="onPrimary">
{{ step < STEPS ? t('NEXT') : t('ENTER GOD MODE') }} <span class="material-symbols-outlined" aria-hidden="true">arrow_forward</span>
</button>
<UiButton v-if="step > 1" class="first-run-back" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="go(step - 1, $event)">{{ t('BACK') }}</UiButton>
<UiButton class="first-run-enter" :data-first-run-choice="step === STEPS ? start : undefined" :data-first-run-next="step < STEPS ? '' : undefined" data-first-run-primary aria-describedby="first-run-title first-run-description" @pointerdown="onPrimaryDown" @keydown.enter="onPrimaryKeydown" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="onPrimary">
{{ step < STEPS ? t('NEXT') : t('ENTER GOD MODE') }} <UiIcon name="arrow_forward" :size="null" />
</UiButton>
</div>
</aside>
+9 -7
View File
@@ -4,7 +4,9 @@ import { storeToRefs } from 'pinia';
import { t } from '../../../i18n/index.js';
import { useCctvStore } from '../../stores/cctv.js';
import { usePanelChromeStore } from '../../stores/panelChrome.js';
import UiButton from '../../kit/UiButton.vue';
import UiCloseButton from '../../kit/UiCloseButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// A selected camera's card: a thumbnail of its latest frame, a few facts,
// and a button that opens the full CCTV panel. The frame and facts come from
@@ -68,15 +70,15 @@ function openPanel() {
<img v-if="src" :src="src" :alt="name || t('Camera frame')" />
<span v-else>{{ t('Acquiring frame…') }}</span>
<span v-if="sourceBadge?.label" class="cctv-preview__badge">{{ sourceBadge.label }}</span>
<button v-if="src" type="button" class="cctv-preview__expand" :aria-label="t('Show a bigger view')" :title="t('Show a bigger view')" @click="big = true">
<span class="material-symbols-outlined" aria-hidden="true">open_in_full</span>
</button>
<UiButton v-if="src" class="cctv-preview__expand" :label="t('Show a bigger view')" @click="big = true">
<UiIcon name="open_in_full" :size="null" />
</UiButton>
</div>
<Teleport to="body">
<div v-if="big" class="cctv-popup" role="dialog" :aria-label="name || t('Camera view')" @click.self="big = false">
<figure class="cctv-popup__card">
<header class="cctv-popup__head">
<span class="material-symbols-outlined" aria-hidden="true">videocam</span>
<UiIcon name="videocam" :size="null" />
<strong>{{ name || t('Camera view') }}</strong>
<span v-if="sourceBadge?.label" class="cctv-popup__badge">{{ sourceBadge.label }}</span>
<UiCloseButton class="cctv-popup__close" glyph="icon" :label="t('Close')" @click="big = false" />
@@ -94,8 +96,8 @@ function openPanel() {
<dd>{{ fact.value }}</dd>
</div>
</dl>
<button type="button" class="entity-card__action cctv-preview__more" @click="openPanel">
<span class="material-symbols-outlined" aria-hidden="true">videocam</span>{{ t('More info') }}
</button>
<UiButton class="entity-card__action cctv-preview__more" @click="openPanel">
<UiIcon name="videocam" :size="null" />{{ t('More info') }}
</UiButton>
</section>
</template>
+2 -1
View File
@@ -1,6 +1,7 @@
<script setup>
import { storeToRefs } from 'pinia';
import { useCelestialRingStore } from '../../stores/celestialRing.js';
import UiIcon from '../../kit/UiIcon.vue';
// The full-globe sun/moon ring, inside the viewer's container, as the ring
// owner (src/celestialRing.js) presents it.
@@ -44,6 +45,6 @@ const markerStyle = (marker) =>
<template>
<Teleport v-if="ring" :to="ring.container">
<div :key="ring.id" id="celestial-ring-overlay" class="celestial-ring-overlay" :class="{ visible: ring.visible, disabled: !ring.enabled }" aria-hidden="true" :data-globe-visible="ring.globeVisible ?? undefined" :data-ephemeris-updates="ring.ephemerisUpdates ?? undefined"><div class="celestial-ring-outline" :style="outlineStyle(ring.outline)"></div><canvas v-ring-canvas="{ owner: ring.owner, kind: 'sun' }" class="celestial-ring-canvas celestial-sun-canvas" :style="layerStyle(ring.sun)"></canvas><canvas v-ring-canvas="{ owner: ring.owner, kind: 'moon' }" class="celestial-ring-canvas celestial-moon-canvas" :style="layerStyle(ring.moon)"></canvas><span class="celestial-marker celestial-sun material-symbols-outlined" :style="markerStyle(ring.sunMarker)">light_mode</span><span class="celestial-marker celestial-moon material-symbols-outlined" :style="markerStyle(ring.moonMarker)">dark_mode</span></div>
<div :key="ring.id" id="celestial-ring-overlay" class="celestial-ring-overlay" :class="{ visible: ring.visible, disabled: !ring.enabled }" aria-hidden="true" :data-globe-visible="ring.globeVisible ?? undefined" :data-ephemeris-updates="ring.ephemerisUpdates ?? undefined"><div class="celestial-ring-outline" :style="outlineStyle(ring.outline)"></div><canvas v-ring-canvas="{ owner: ring.owner, kind: 'sun' }" class="celestial-ring-canvas celestial-sun-canvas" :style="layerStyle(ring.sun)"></canvas><canvas v-ring-canvas="{ owner: ring.owner, kind: 'moon' }" class="celestial-ring-canvas celestial-moon-canvas" :style="layerStyle(ring.moon)"></canvas><UiIcon class="celestial-marker celestial-sun" name="light_mode" :size="null" :style="markerStyle(ring.sunMarker)" /><UiIcon class="celestial-marker celestial-moon" name="dark_mode" :size="null" :style="markerStyle(ring.moonMarker)" /></div>
</Teleport>
</template>
+15 -14
View File
@@ -5,7 +5,10 @@ import { t } from '../../../i18n/index.js';
import { useVoiceStore } from '../../stores/voice.js';
import { ASSISTANT_NAME } from '../../../voice/control.js';
import PanelLayoutButtons from './PanelLayoutButtons.vue';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
import UiCloseButton from '../../kit/UiCloseButton.vue';
import UiSelect from '../../kit/UiSelect.js';
// The typed chat in the command dock, as its owner (src/voice/chatControl.js)
// writes the voice control presenter. Messages arrive apart from the view, so
@@ -15,7 +18,6 @@ const store = useVoiceStore();
const { controls, chat: messages } = storeToRefs(store);
const emit = (name, ...args) => controls.value?.emit(name, ...args);
const list = ref(null);
const layerSelect = ref(null);
const layerChoice = ref('');
// The input holds what the person types until its owner writes it (history
@@ -55,7 +57,6 @@ watch(messages, (next, previous) => {
function attachLayer() {
const value = layerChoice.value;
layerChoice.value = '';
if (layerSelect.value) layerSelect.value.value = '';
if (value) emit('chat-layer', value);
}
@@ -68,7 +69,7 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
<div><strong>{{ t('GEV CHAT') }}</strong><p>{{ t('Ask about the map. Tell it where to go.') }}</p></div>
<div id="gev-chat-header-actions">
<PanelLayoutButtons :docked="props.view.layout.docked" :minimized="props.view.chat.minimized" @dock="emit('layout-dock')" @minimize="emit('chat-minimize')" />
<button v-if="props.view.panel" id="gev-voice-settings-button" class="gev-voice-settings-button" type="button" :aria-label="t('Settings')" :title="t('Settings')" aria-controls="gev-voice-panel" :aria-expanded="String(props.view.voicePanel.settingsExpanded)" @click="emit('settings-button')"><span class="material-symbols-outlined gev-voice-settings-icon" aria-hidden="true">settings</span></button>
<UiButton v-if="props.view.panel" id="gev-voice-settings-button" class="gev-voice-settings-button" :aria-label="t('Settings')" :title="t('Settings')" aria-controls="gev-voice-panel" :aria-expanded="String(props.view.voicePanel.settingsExpanded)" @click="emit('settings-button')"><UiIcon name="settings" class="gev-voice-settings-icon" :size="null" /></UiButton>
<UiCloseButton id="gev-chat-close" :label="t('Close chat')" @click="emit('chat-close')" />
</div>
</header>
@@ -77,7 +78,7 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
<svg viewBox="0 0 24 24" width="32" height="32" fill="none" stroke="currentColor" stroke-width="1" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><ellipse cx="12" cy="12" rx="4" ry="10"></ellipse><path d="M2 12h20"></path></svg>
<h3>{{ t('Explore with a question') }}</h3>
<p>{{ t('Find a place, explore live data, or change your view.') }}</p>
<button v-for="prompt in quickPrompts()" :key="prompt" type="button" :hidden="!props.view.chat.quickChecked" @click="emit('chat-prompt', prompt)">{{ prompt }}</button>
<UiButton v-for="prompt in quickPrompts()" :key="prompt" :hidden="!props.view.chat.quickChecked" @click="emit('chat-prompt', prompt)">{{ prompt }}</UiButton>
</div>
<div v-for="message in messages" :key="message.id" class="gev-chat-message" :data-role="message.role">
<small>{{ message.role === 'user' ? t('YOU') : ASSISTANT_NAME }}</small><span>{{ message.text }}</span>
@@ -87,36 +88,36 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
<!-- Stays under the status for the whole conversation. -->
<p v-if="props.view.chat.authNote" id="gev-chat-auth-note">{{ props.view.chat.authNote }}</p>
<div id="gev-chat-attachments" :aria-label="t('Attachments')" :hidden="!props.view.chat.attachments.length">
<button v-for="item in props.view.chat.attachments" :key="item.key" type="button" :disabled="props.view.chat.locked" :aria-label="`${t('Remove attachment')}: ${item.name}`" @click="emit('chat-attachment-remove', item.key)">{{ item.name }} ×</button>
<UiButton v-for="item in props.view.chat.attachments" :key="item.key" :disabled="props.view.chat.locked" :aria-label="`${t('Remove attachment')}: ${item.name}`" @click="emit('chat-attachment-remove', item.key)">{{ item.name }} ×</UiButton>
</div>
<div id="gev-chat-attach-menu" :hidden="!props.view.chat.attachMenuOpen" @keydown="emit('chat-attach-keydown', $event)">
<label for="gev-chat-layer">{{ t('Attach a map layer') }}</label>
<div id="gev-chat-layer-row">
<select id="gev-chat-layer" ref="layerSelect" :disabled="props.view.chat.locked" @change="layerChoice = $event.target.value" @keydown.enter.prevent="attachLayer()">
<UiSelect id="gev-chat-layer" v-model="layerChoice" :disabled="props.view.chat.locked" @keydown.enter.prevent="attachLayer()">
<option value="">{{ t('Choose a layer…') }}</option>
<option v-for="layer in props.view.chat.layers" :key="layer.value" :value="layer.value">{{ layer.label }}</option>
</select>
<button id="gev-chat-layer-attach" type="button" :disabled="props.view.chat.locked || !layerChoice" @click="attachLayer()">{{ t('Attach layer') }}</button>
</UiSelect>
<UiButton id="gev-chat-layer-attach" :disabled="props.view.chat.locked || !layerChoice" @click="attachLayer()">{{ t('Attach layer') }}</UiButton>
</div>
<button id="gev-chat-file-button" type="button" :disabled="props.view.chat.locked" @click="emit('chat-file-button')">{{ t('Attach a file') }}</button>
<UiButton id="gev-chat-file-button" :disabled="props.view.chat.locked" @click="emit('chat-file-button')">{{ t('Attach a file') }}</UiButton>
<p>{{ t('TXT, Markdown, CSV, JSON or GeoJSON · up to 10 KB in total. Attachments are sent to your AI provider with your message.') }}</p>
<input id="gev-chat-file" type="file" accept=".txt,.md,.csv,.json,.geojson" multiple hidden @change="emit('chat-files', $event.target)" />
</div>
<aside id="gev-chat-mini-reply" :hidden="!props.view.chat.miniReply" :aria-label="t('Latest AI response')">
<header><span translate="no">{{ ASSISTANT_NAME }}</span><button id="gev-chat-expand-reply" type="button" :aria-label="t('Expand conversation')" :title="t('Expand conversation')" @click="emit('chat-restore')"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M14 4h6v6m0-6-7 7M10 20H4v-6m0 6 7-7"></path></svg></button></header>
<header><span translate="no">{{ ASSISTANT_NAME }}</span><UiButton id="gev-chat-expand-reply" :aria-label="t('Expand conversation')" :title="t('Expand conversation')" @click="emit('chat-restore')"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M14 4h6v6m0-6-7 7M10 20H4v-6m0 6 7-7"></path></svg></UiButton></header>
<p id="gev-chat-mini-text" aria-live="polite">{{ props.view.chat.miniReply }}</p>
</aside>
<div id="gev-chat-suggestions" :aria-label="t('Command suggestions')" :hidden="!props.view.chat.suggestions.length">
<div v-for="group in props.view.chat.suggestions" :key="group.label">
<small>{{ group.label }}</small>
<button v-for="command in group.items" :key="command" type="button" :title="command" @click="emit('chat-suggestion', command)">{{ command }}</button>
<UiButton v-for="command in group.items" :key="command" :title="command" @click="emit('chat-suggestion', command)">{{ command }}</UiButton>
</div>
</div>
<form id="gev-chat-form" @submit.prevent="emit('chat-submit')">
<button id="gev-chat-restore" type="button" :aria-label="t('Expand chat')" :title="t('Expand chat')" @click="emit('chat-restore')"><svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M5 4h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-6 4V6a2 2 0 0 1 2-2Z"></path></svg></button>
<button id="gev-chat-attach" type="button" :disabled="props.view.chat.busy" :aria-label="t('Add attachment')" :aria-expanded="String(props.view.chat.attachMenuOpen)" aria-controls="gev-chat-attach-menu" @click="emit('chat-attach-toggle')" @keydown="emit('chat-attach-keydown', $event)"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m8 12 6-6a3 3 0 0 1 4 4l-8 8a5 5 0 0 1-7-7l9-9"></path></svg></button>
<UiButton id="gev-chat-restore" :aria-label="t('Expand chat')" :title="t('Expand chat')" @click="emit('chat-restore')"><svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M5 4h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-6 4V6a2 2 0 0 1 2-2Z"></path></svg></UiButton>
<UiButton id="gev-chat-attach" :disabled="props.view.chat.busy" :aria-label="t('Add attachment')" :aria-expanded="String(props.view.chat.attachMenuOpen)" aria-controls="gev-chat-attach-menu" @click="emit('chat-attach-toggle')" @keydown="emit('chat-attach-keydown', $event)"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m8 12 6-6a3 3 0 0 1 4 4l-8 8a5 5 0 0 1-7-7l9-9"></path></svg></UiButton>
<textarea id="gev-chat-input" v-owned-draft="{ text: props.view.chat.draft, revision: props.view.chat.draftRevision }" :rows="props.view.chat.rows" maxlength="4000" :aria-label="t('Message GEV')" :placeholder="t('Ask GEV anything about the map…')" @input="emit('chat-input', $event.target.value)" @keydown="emit('chat-keydown', $event)"></textarea>
<button id="gev-chat-send" :type="props.view.chat.busy ? 'button' : 'submit'" :disabled="props.view.chat.sendDisabled" :data-busy="String(props.view.chat.busy)" :aria-label="props.view.chat.busy ? t('Stop reply') : t('Send message')" :title="props.view.chat.busy ? t('Stop reply') : t('Send message')" @click="props.view.chat.busy && emit('chat-stop')"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path class="gev-chat-enter-icon" d="M19 5v8H5m5-5-5 5 5 5"></path><rect class="gev-chat-stop-icon" x="6" y="6" width="12" height="12" rx="1.5" fill="currentColor" stroke="none"></rect></svg></button>
<UiButton id="gev-chat-send" :type="props.view.chat.busy ? 'button' : 'submit'" :disabled="props.view.chat.sendDisabled" :data-busy="String(props.view.chat.busy)" :aria-label="props.view.chat.busy ? t('Stop reply') : t('Send message')" :title="props.view.chat.busy ? t('Stop reply') : t('Send message')" @click="props.view.chat.busy && emit('chat-stop')"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path class="gev-chat-enter-icon" d="M19 5v8H5m5-5-5 5 5 5"></path><rect class="gev-chat-stop-icon" x="6" y="6" width="12" height="12" rx="1.5" fill="currentColor" stroke="none"></rect></svg></UiButton>
</form>
</section>
</template>
+13 -12
View File
@@ -7,6 +7,7 @@ import { useCockpitStore } from '../../stores/cockpit.js';
import CockpitRoute from './CockpitRoute.vue';
import CockpitSignalList from './CockpitSignalList.vue';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// The Cockpit briefing card. The Cockpit controller presents its pages,
// cycle toggle, regional news and local conditions; until it does, the card
@@ -45,17 +46,17 @@ function leaveSignals() {
<strong id="cockpit-brief-subtitle">{{ b.subtitle }}</strong>
</div>
<nav class="cockpit-card-actions cockpit-brief-actions" :aria-label="t('Cockpit briefing controls')">
<button id="cockpit-brief-previous" type="button" :aria-label="t('Previous briefing page')" :title="t('Previous briefing page')">
<span class="material-symbols-outlined" aria-hidden="true">chevron_left</span>
</button>
<UiButton id="cockpit-brief-previous" :aria-label="t('Previous briefing page')" :title="t('Previous briefing page')">
<UiIcon name="chevron_left" :size="null" />
</UiButton>
<span id="cockpit-brief-position" aria-live="polite">{{ b.position }}</span>
<button id="cockpit-brief-next" type="button" :aria-label="t('Next briefing page')" :title="t('Next briefing page')">
<span class="material-symbols-outlined" aria-hidden="true">chevron_right</span>
</button>
<UiButton id="cockpit-brief-next" :aria-label="t('Next briefing page')" :title="t('Next briefing page')">
<UiIcon name="chevron_right" :size="null" />
</UiButton>
<UiButton id="cockpit-brief-auto" :aria-label="b.autoLabel" :pressed="Boolean(b.autoRotate)" :title="b.autoHelp">{{ b.autoLabel }}</UiButton>
<button id="cockpit-signal-toggle" type="button" :aria-label="collapsed ? t('Expand cockpit briefing panel') : t('Collapse cockpit briefing panel')" :aria-expanded="String(!collapsed)" :title="collapsed ? t('Expand briefing panel') : t('Collapse briefing panel')">
<span class="material-symbols-outlined" aria-hidden="true">{{ collapsed ? 'right_panel_open' : 'right_panel_close' }}</span>
</button>
<UiButton id="cockpit-signal-toggle" :aria-label="collapsed ? t('Expand cockpit briefing panel') : t('Collapse cockpit briefing panel')" :aria-expanded="String(!collapsed)" :title="collapsed ? t('Expand briefing panel') : t('Collapse briefing panel')">
<UiIcon :name="collapsed ? 'right_panel_open' : 'right_panel_close'" :size="null" />
</UiButton>
</nav>
</header>
<div class="cockpit-brief-stage">
@@ -83,9 +84,9 @@ function leaveSignals() {
<footer class="cockpit-signal-footer">
<span id="cockpit-brief-source">{{ b.source }}</span>
<nav class="cockpit-brief-tabs" :aria-label="t('Cockpit briefing pages')">
<button type="button" data-cockpit-brief-index="0" :aria-label="t('Show Live Signals')" :aria-current="String(b.pageIndex === 0)">{{ t('SIG') }}</button>
<button type="button" data-cockpit-brief-index="1" :aria-label="t('Show Regional News')" :aria-current="brief ? String(b.pageIndex === 1) : undefined">{{ t('NEWS') }}</button>
<button type="button" data-cockpit-brief-index="2" :aria-label="t('Show Local Info')" :aria-current="brief ? String(b.pageIndex === 2) : undefined">{{ t('LOCAL') }}</button>
<UiButton data-cockpit-brief-index="0" :aria-label="t('Show Live Signals')" :aria-current="String(b.pageIndex === 0)">{{ t('SIG') }}</UiButton>
<UiButton data-cockpit-brief-index="1" :aria-label="t('Show Regional News')" :aria-current="brief ? String(b.pageIndex === 1) : undefined">{{ t('NEWS') }}</UiButton>
<UiButton data-cockpit-brief-index="2" :aria-label="t('Show Local Info')" :aria-current="brief ? String(b.pageIndex === 2) : undefined">{{ t('LOCAL') }}</UiButton>
</nav>
</footer>
</aside>
+11 -10
View File
@@ -6,6 +6,7 @@ import { createContextState } from '../../cockpitContextState.js';
import { vClassToggle } from '../../rail/classToggle.js';
import { useCockpitStore } from '../../stores/cockpit.js';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// The Cockpit Contact card. The Cockpit controller presents its scope,
// navigation, cohort counts, nearest contact and weather toggle; until it
@@ -36,15 +37,15 @@ const weatherLabel = computed(() =>
<strong id="cockpit-context-subject">{{ c.subject }}</strong>
</div>
<nav class="cockpit-card-actions cockpit-context-actions" :aria-label="t('Contact navigation')">
<button id="cockpit-context-previous" type="button" :disabled="!c.canPrevious" :aria-label="t('Previous — prior visited contact in the 250 km window')" :title="t('Previous — prior visited contact in the 250 km window')">
<span class="material-symbols-outlined" aria-hidden="true">skip_previous</span>
</button>
<button id="cockpit-context-next" type="button" :disabled="!c.canNext" :aria-label="t('Next — nearest unvisited contact in the 250 km window')" :title="t('Next — nearest unvisited contact in the 250 km window')">
<span class="material-symbols-outlined" aria-hidden="true">skip_next</span>
</button>
<button id="cockpit-context-toggle" type="button" :aria-label="collapsed ? t('Expand Contact panel') : t('Collapse Contact panel')" :aria-expanded="String(!collapsed)" :title="collapsed ? t('Expand contact panel') : t('Collapse contact panel')">
<span class="material-symbols-outlined" aria-hidden="true">{{ collapsed ? 'chevron_right' : 'chevron_left' }}</span>
</button>
<UiButton id="cockpit-context-previous" :disabled="!c.canPrevious" :aria-label="t('Previous — prior visited contact in the 250 km window')" :title="t('Previous — prior visited contact in the 250 km window')">
<UiIcon name="skip_previous" :size="null" />
</UiButton>
<UiButton id="cockpit-context-next" :disabled="!c.canNext" :aria-label="t('Next — nearest unvisited contact in the 250 km window')" :title="t('Next — nearest unvisited contact in the 250 km window')">
<UiIcon name="skip_next" :size="null" />
</UiButton>
<UiButton id="cockpit-context-toggle" :aria-label="collapsed ? t('Expand Contact panel') : t('Collapse Contact panel')" :aria-expanded="String(!collapsed)" :title="collapsed ? t('Expand contact panel') : t('Collapse contact panel')">
<UiIcon :name="collapsed ? 'chevron_right' : 'chevron_left'" :size="null" />
</UiButton>
</nav>
<span class="cockpit-context-qualifier">{{ t('CONTEXT ONLY') }}</span>
</header>
@@ -55,7 +56,7 @@ const weatherLabel = computed(() =>
<div v-class-toggle="{ unknown: c.cohorts['military-installations'].unknown }" role="listitem" data-context-cohort="military-installations"><span>{{ t('SITE') }}</span><strong>{{ c.cohorts['military-installations'].count }}</strong><small translate="no" :title="c.cohorts['military-installations'].source">{{ c.cohorts['military-installations'].source }}</small></div>
</div>
<div class="cockpit-context-nearest">
<span id="cockpit-context-direction" v-class-toggle="{ unknown: c.direction.unknown }" class="material-symbols-outlined" :style="directionStyle" aria-hidden="true">navigation</span>
<UiIcon id="cockpit-context-direction" v-class-toggle="{ unknown: c.direction.unknown }" name="navigation" :size="null" :style="directionStyle" />
<div>
<small>{{ t('NEAREST OBSERVED / MAPPED') }}</small>
<strong id="cockpit-context-nearest-label" :aria-label="c.nearest.ariaLabel ?? undefined">{{ c.nearest.label }}</strong>
+9 -7
View File
@@ -14,6 +14,7 @@ import {
shownOwnerMark,
} from '../../ownerFlag.js';
import { useCockpitStore } from '../../stores/cockpit.js';
import UiButton from '../../kit/UiButton.vue';
// The orbital view's HUD: a nadir reticle over the picture, the satellite's
// identity and orbit, and the optical zoom. The Cockpit controller presents
@@ -118,14 +119,15 @@ const sensorStepShown = computed(
// A focused control that turns off (a zoom button at the end of its range,
// SENSOR as the view tilts away) hands focus on instead of dropping it to the
// page. The watchers run before the re-render, while it still has focus.
// Each ref holds a UiButton, whose element is its `$el`.
const zoomInButton = ref(null);
const zoomOutButton = ref(null);
const sensorButton = ref(null);
const nadirButton = ref(null);
const handFocus = (from, to) => {
if (!from || document.activeElement !== from) return;
if (!from?.$el || document.activeElement !== from.$el) return;
nextTick(() =>
(to() ?? document.getElementById('map-view-switch'))?.focus({
(to()?.$el ?? document.getElementById('map-view-switch'))?.focus({
preventScroll: true,
}),
);
@@ -298,7 +300,7 @@ const lensStyle = computed(() => {
<div v-if="identText" class="cockpit-orbital-ident">
<!-- Wraps between parts, never inside a date. -->
<span class="cockpit-orbital-ident-text"><template v-for="(part, index) in identParts" :key="index"><template v-if="index"> · </template><span class="cockpit-orbital-ident-part">{{ part }}</span></template></span>
<button v-if="tleText" id="cockpit-orbital-tle-toggle" type="button" class="cockpit-orbital-tle-toggle" :aria-expanded="String(tleOpen)" aria-controls="cockpit-orbital-tle" :aria-label="tleOpen ? t('Hide the two-line element set') : t('Show the two-line element set')" :title="tleOpen ? t('Hide the two-line element set') : t('Show the two-line element set')" @click="tleOpen = !tleOpen">{{ t('TLE') }}</button>
<UiButton v-if="tleText" id="cockpit-orbital-tle-toggle" class="cockpit-orbital-tle-toggle" :aria-expanded="String(tleOpen)" aria-controls="cockpit-orbital-tle" :aria-label="tleOpen ? t('Hide the two-line element set') : t('Show the two-line element set')" :title="tleOpen ? t('Hide the two-line element set') : t('Show the two-line element set')" @click="tleOpen = !tleOpen">{{ t('TLE') }}</UiButton>
</div>
<pre v-if="tleText" v-show="tleOpen" id="cockpit-orbital-tle" class="cockpit-orbital-tle" :aria-label="t('Two-line element set')">{{ tleText }}</pre>
<dl class="cockpit-orbital-data">
@@ -319,17 +321,17 @@ const lensStyle = computed(() => {
<!-- Shown only while the view is tilted off nadir: where it looks and the way back. -->
<div v-if="look.offset" class="cockpit-orbital-look">
<span id="cockpit-orbital-look-readout" class="cockpit-orbital-look-readout" :aria-live="look.focus ? 'off' : 'polite'">{{ look.readout }}</span>
<button id="cockpit-orbital-nadir" ref="nadirButton" type="button" class="cockpit-orbital-nadir" :aria-label="t('Return the view to nadir')" :title="t('Return to nadir (Home or 0)')" aria-keyshortcuts="Home 0">{{ t('NADIR') }}</button>
<UiButton id="cockpit-orbital-nadir" ref="nadirButton" class="cockpit-orbital-nadir" :aria-label="t('Return the view to nadir')" :title="t('Return to nadir (Home or 0)')" aria-keyshortcuts="Home 0">{{ t('NADIR') }}</UiButton>
</div>
<p id="cockpit-orbital-focus" class="cockpit-orbital-focus" aria-live="polite">{{ focusText }}</p>
</div>
<div class="cockpit-orbital-optics">
<button id="cockpit-orbital-zoom-out" ref="zoomOutButton" type="button" class="cockpit-orbital-zoom-button" :disabled="atWidest" :aria-label="t('Zoom out')" :title="t('Zoom out (−)')" aria-keyshortcuts="- _">−</button>
<UiButton id="cockpit-orbital-zoom-out" ref="zoomOutButton" class="cockpit-orbital-zoom-button" :disabled="atWidest" :aria-label="t('Zoom out')" :title="t('Zoom out (−)')" aria-keyshortcuts="- _">−</UiButton>
<span class="cockpit-orbital-zoom" aria-live="polite">{{ zoomText }}</span>
<button id="cockpit-orbital-zoom-in" ref="zoomInButton" type="button" class="cockpit-orbital-zoom-button" :disabled="atTightest" :aria-label="t('Zoom in')" :title="t('Zoom in (+)')" aria-keyshortcuts="+ =">+</button>
<UiButton id="cockpit-orbital-zoom-in" ref="zoomInButton" class="cockpit-orbital-zoom-button" :disabled="atTightest" :aria-label="t('Zoom in')" :title="t('Zoom in (+)')" aria-keyshortcuts="+ =">+</UiButton>
<span v-if="swathText" class="cockpit-orbital-swath">{{ swathText }}</span>
<span v-if="sensorText" class="cockpit-orbital-swath cockpit-orbital-sensor-swath">{{ sensorText }}</span>
<button v-if="sensorStepShown" id="cockpit-orbital-sensor" ref="sensorButton" type="button" class="cockpit-orbital-sensor-step" :aria-label="t('Zoom to the imaging sensor swath')" :title="t('Zoom to the imaging sensor swath')">{{ t('SENSOR') }}</button>
<UiButton v-if="sensorStepShown" id="cockpit-orbital-sensor" ref="sensorButton" class="cockpit-orbital-sensor-step" :aria-label="t('Zoom to the imaging sensor swath')" :title="t('Zoom to the imaging sensor swath')">{{ t('SENSOR') }}</UiButton>
</div>
</template>
</section>
+2 -1
View File
@@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia';
import { computed, onBeforeUnmount, ref, watch } from 'vue';
import { formatNumber, t, tn } from '../../../i18n/index.js';
import { useCockpitStore } from '../../stores/cockpit.js';
import UiButton from '../../kit/UiButton.vue';
// The bridge radar: a heading-up scope of nearby AIS vessels, with a line
// where the bridge view looks when it is turned off the bow. The Cockpit
@@ -158,7 +159,7 @@ const rangeAction = computed(() =>
</template>
</div>
<div class="cockpit-radar-readout">
<button id="cockpit-radar-range" type="button" class="cockpit-radar-range" :aria-label="rangeAction" :title="rangeAction">{{ rangeLabel }}</button>
<UiButton id="cockpit-radar-range" class="cockpit-radar-range" :aria-label="rangeAction" :title="rangeAction">{{ rangeLabel }}</UiButton>
<span class="cockpit-radar-rings">{{ ringLabel }}</span>
<span class="cockpit-radar-count">{{ countLabel }}</span>
</div>
Loaded 100 of 132 files, more files were not shown because too many files have changed in this diff. Show more