diff --git a/changelog.d/1598-f-collapses-data-layers.md b/changelog.d/1598-f-collapses-data-layers.md new file mode 100644 index 0000000000..42bdc9d833 --- /dev/null +++ b/changelog.d/1598-f-collapses-data-layers.md @@ -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). diff --git a/changelog.d/1803-shots-click-to-go-reorder.md b/changelog.d/1803-shots-click-to-go-reorder.md index 427a9a5f4d..3158a3fcd4 100644 --- a/changelog.d/1803-shots-click-to-go-reorder.md +++ b/changelog.d/1803-shots-click-to-go-reorder.md @@ -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). diff --git a/changelog.d/1820-fleet-entry.md b/changelog.d/1820-fleet-entry.md index 78d09ddf22..eab448489f 100644 --- a/changelog.d/1820-fleet-entry.md +++ b/changelog.d/1820-fleet-entry.md @@ -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). diff --git a/changelog.d/1844-sfc-credits.md b/changelog.d/1844-sfc-credits.md new file mode 100644 index 0000000000..df9de4f430 --- /dev/null +++ b/changelog.d/1844-sfc-credits.md @@ -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). diff --git a/changelog.d/1845-sfc-quebec-cctv.md b/changelog.d/1845-sfc-quebec-cctv.md new file mode 100644 index 0000000000..10ea7d1feb --- /dev/null +++ b/changelog.d/1845-sfc-quebec-cctv.md @@ -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). diff --git a/changelog.d/1846-sfc-omnibar-guide.md b/changelog.d/1846-sfc-omnibar-guide.md new file mode 100644 index 0000000000..cdd91d63c1 --- /dev/null +++ b/changelog.d/1846-sfc-omnibar-guide.md @@ -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). diff --git a/changelog.d/1847-kit-sweep-omnibar.md b/changelog.d/1847-kit-sweep-omnibar.md new file mode 100644 index 0000000000..7d52cede37 --- /dev/null +++ b/changelog.d/1847-kit-sweep-omnibar.md @@ -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). diff --git a/changelog.d/1848-kit-sweep-welcome.md b/changelog.d/1848-kit-sweep-welcome.md new file mode 100644 index 0000000000..d3154e0195 --- /dev/null +++ b/changelog.d/1848-kit-sweep-welcome.md @@ -0,0 +1,2 @@ +- The welcome card's buttons and glyphs are now kit controls, with the same + look and behaviour (manjunath22466, samehkhamis, #1848). diff --git a/changelog.d/1849-kit-sweep-display.md b/changelog.d/1849-kit-sweep-display.md new file mode 100644 index 0000000000..cabf38e8d2 --- /dev/null +++ b/changelog.d/1849-kit-sweep-display.md @@ -0,0 +1,2 @@ +- The Visual panel's buttons and glyphs are now kit controls, with the same + look and behaviour (manjunath22466, samehkhamis, #1849). diff --git a/changelog.d/1850-kit-sweep-entity-card.md b/changelog.d/1850-kit-sweep-entity-card.md new file mode 100644 index 0000000000..06d464488e --- /dev/null +++ b/changelog.d/1850-kit-sweep-entity-card.md @@ -0,0 +1,2 @@ +- The entity card's buttons and glyphs are now kit controls, with the same + look and behaviour (manjunath22466, samehkhamis, #1850). diff --git a/changelog.d/1851-kit-sweep-layer-finder.md b/changelog.d/1851-kit-sweep-layer-finder.md new file mode 100644 index 0000000000..e5b573d22d --- /dev/null +++ b/changelog.d/1851-kit-sweep-layer-finder.md @@ -0,0 +1,2 @@ +- The Layer Finder's buttons and glyphs are now kit controls, with the same + look and behaviour (manjunath22466, samehkhamis, #1851). diff --git a/changelog.d/1852-kit-sweep-stories.md b/changelog.d/1852-kit-sweep-stories.md new file mode 100644 index 0000000000..ea55506827 --- /dev/null +++ b/changelog.d/1852-kit-sweep-stories.md @@ -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). diff --git a/changelog.d/1854-kit-doc-claims.md b/changelog.d/1854-kit-doc-claims.md new file mode 100644 index 0000000000..82ac20444a --- /dev/null +++ b/changelog.d/1854-kit-doc-claims.md @@ -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). diff --git a/changelog.d/1855-kit-sweep-command-dock.md b/changelog.d/1855-kit-sweep-command-dock.md new file mode 100644 index 0000000000..da8c33a820 --- /dev/null +++ b/changelog.d/1855-kit-sweep-command-dock.md @@ -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). diff --git a/changelog.d/1856-kit-sweep-small-surfaces.md b/changelog.d/1856-kit-sweep-small-surfaces.md new file mode 100644 index 0000000000..a3d6130ee1 --- /dev/null +++ b/changelog.d/1856-kit-sweep-small-surfaces.md @@ -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). diff --git a/changelog.d/1857-zoom-freeze-under-icons.md b/changelog.d/1857-zoom-freeze-under-icons.md new file mode 100644 index 0000000000..6816fdfa88 --- /dev/null +++ b/changelog.d/1857-zoom-freeze-under-icons.md @@ -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). diff --git a/changelog.d/1858-kit-sweep-cockpit.md b/changelog.d/1858-kit-sweep-cockpit.md new file mode 100644 index 0000000000..47f07f3b48 --- /dev/null +++ b/changelog.d/1858-kit-sweep-cockpit.md @@ -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). diff --git a/changelog.d/1861-bare-address-defaults.md b/changelog.d/1861-bare-address-defaults.md new file mode 100644 index 0000000000..77faf35c49 --- /dev/null +++ b/changelog.d/1861-bare-address-defaults.md @@ -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). diff --git a/changelog.d/1862-kit-sweep-chat-voice.md b/changelog.d/1862-kit-sweep-chat-voice.md new file mode 100644 index 0000000000..511c798fcb --- /dev/null +++ b/changelog.d/1862-kit-sweep-chat-voice.md @@ -0,0 +1,2 @@ +- The AI chat panel's and voice control's buttons and glyphs are now kit + controls (manjunath22466, samehkhamis, #1862). diff --git a/changelog.d/1863-kit-sweep-draw.md b/changelog.d/1863-kit-sweep-draw.md new file mode 100644 index 0000000000..4822dd8265 --- /dev/null +++ b/changelog.d/1863-kit-sweep-draw.md @@ -0,0 +1,2 @@ +- Draw's and Import's buttons and glyphs are now kit controls + (manjunath22466, samehkhamis, #1863). diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index d941e17f9b..d6760df2b1 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -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 diff --git a/docs/VUE-MIGRATION.md b/docs/VUE-MIGRATION.md index b7c030dc10..7e8c323cd0 100644 --- a/docs/VUE-MIGRATION.md +++ b/docs/VUE-MIGRATION.md @@ -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 `` 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 +(` diff --git a/src/ui/contextPanel.test.mjs b/src/ui/contextPanel.test.mjs index 9cb11da611..1ce7eceb6d 100644 --- a/src/ui/contextPanel.test.mjs +++ b/src/ui/contextPanel.test.mjs @@ -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); diff --git a/src/ui/credits/CreditItem.vue b/src/ui/credits/CreditItem.vue new file mode 100644 index 0000000000..fd3f95478c --- /dev/null +++ b/src/ui/credits/CreditItem.vue @@ -0,0 +1,53 @@ + + + diff --git a/src/ui/credits/CreditsView.vue b/src/ui/credits/CreditsView.vue new file mode 100644 index 0000000000..95f7b8cc99 --- /dev/null +++ b/src/ui/credits/CreditsView.vue @@ -0,0 +1,90 @@ + + + diff --git a/src/ui/creditsView.js b/src/ui/creditsView.js index 03acd1358d..738d116161 100644 --- a/src/ui/creditsView.js +++ b/src/ui/creditsView.js @@ -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); }; } diff --git a/src/ui/creditsView.test.mjs b/src/ui/creditsView.test.mjs index 17e443b52b..34a66b4255 100644 --- a/src/ui/creditsView.test.mjs +++ b/src/ui/creditsView.test.mjs @@ -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'], + ); +}); diff --git a/src/ui/displayBindings.js b/src/ui/displayBindings.js index 6aa2af9eea..401450222e 100644 --- a/src/ui/displayBindings.js +++ b/src/ui/displayBindings.js @@ -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(); diff --git a/src/ui/displayPanel.test.mjs b/src/ui/displayPanel.test.mjs index 2928b10487..5e61660434 100644 --- a/src/ui/displayPanel.test.mjs +++ b/src/ui/displayPanel.test.mjs @@ -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, 'a.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 a.geojson'); diff --git a/src/ui/geoFileImport.js b/src/ui/geoFileImport.js index 3b55f13ede..e65ab0ae3d 100644 --- a/src/ui/geoFileImport.js +++ b/src/ui/geoFileImport.js @@ -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', diff --git a/src/ui/geoFileImport.test.mjs b/src/ui/geoFileImport.test.mjs index 11c3e4dad3..e65fed015f 100644 --- a/src/ui/geoFileImport.test.mjs +++ b/src/ui/geoFileImport.test.mjs @@ -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'); diff --git a/src/ui/imagerySplitView.test.mjs b/src/ui/imagerySplitView.test.mjs index 0bf6323b75..da068197c5 100644 --- a/src/ui/imagerySplitView.test.mjs +++ b/src/ui/imagerySplitView.test.mjs @@ -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'); diff --git a/src/ui/kit/chatVoiceControls.test.mjs b/src/ui/kit/chatVoiceControls.test.mjs new file mode 100644 index 0000000000..b1716157ca --- /dev/null +++ b/src/ui/kit/chatVoiceControls.test.mjs @@ -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