mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 02:02:21 +00:00
Merge remote-tracking branch 'origin/main' into samehkhamis/kit-sweep-bhote-koshi
# Conflicts: # scripts/format-scope.json
This commit is contained in:
commit
36ef856ca2
28 files changed
+834
-71
No files matched your search
@@ -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).
|
||||
@@ -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).
|
||||
@@ -0,0 +1,2 @@
|
||||
- The AI chat panel's and voice control's buttons and glyphs are now kit
|
||||
controls (manjunath22466, samehkhamis, #1862).
|
||||
@@ -0,0 +1,2 @@
|
||||
- Draw's and Import's buttons and glyphs are now kit controls
|
||||
(manjunath22466, samehkhamis, #1863).
|
||||
@@ -0,0 +1,2 @@
|
||||
- Space Missions', Contacts', Radio's, the RTL-SDR card's and key setup's
|
||||
buttons and glyphs are now kit controls (manjunath22466, samehkhamis, #1864).
|
||||
+17
-5
@@ -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
|
||||
@@ -8562,7 +8572,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
|
||||
@@ -8805,13 +8815,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
|
||||
|
||||
+55
-2
@@ -96,8 +96,16 @@ header's search and expand, the imported files' 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`
|
||||
sources, cities and places, the view context's place and layer chips and
|
||||
the key setup chip) are `UiButton`s too. `UiChip` is a non-interactive
|
||||
label chip, used by the voice card.
|
||||
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:
|
||||
@@ -191,6 +199,51 @@ while a query is typed. The Filter button opens a disclosure and carries
|
||||
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.
|
||||
The Space Missions panel's buttons (a mission's roster row, FOCUS,
|
||||
REPLAY ASCENT, the replay's pause, PREV, NEXT and SHOW ALL / DESELECT),
|
||||
the Contacts panel's (PREV, FOCUS, NEXT and a contact's row), the Radio
|
||||
panel's (Enable, PREV, PLAY, NEXT and STOP), the RTL-SDR card's (Connect,
|
||||
Locate, Change device, FM, ADS-B, Tune and the two seeks) and the key
|
||||
setup's (the POWER UP chip, a key's REMOVE, the voice auth toggle and
|
||||
SAVE KEYS) are ghost `UiButton`s. Radio's Enable and the card's Connect,
|
||||
FM and ADS-B are pressed toggles with `active`; PLAY and Locate keep
|
||||
their own `active` class without `aria-pressed`, since their words say
|
||||
what they will do or have done. The chip's bolt is a `UiIcon` with
|
||||
`:size="null"`, so provider-settings.css still sizes it
|
||||
(`src/ui/kit/missionsRadioControls.test.mjs` pins it). The card's FM
|
||||
frequency stays a native number field, which the kit has no control for,
|
||||
and the replay's pause, the roster's chevron and the compass arrows are
|
||||
text characters, not Material symbols.
|
||||
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
|
||||
|
||||
@@ -1290,6 +1290,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",
|
||||
@@ -1350,11 +1351,14 @@
|
||||
"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/bhoteKoshiControls.test.mjs",
|
||||
"src/ui/bhoteKoshi/BhoteKoshiMediaCards.vue",
|
||||
"src/ui/kit/missionsRadioControls.test.mjs",
|
||||
"src/ui/kit/drawControls.test.mjs",
|
||||
"src/ui/styles/chip.css",
|
||||
"src/ui/styles/empty-state.css",
|
||||
"src/ui/rail/RailChips.vue",
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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*=/);
|
||||
});
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
@@ -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\(\)/,
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,142 @@
|
||||
// The space missions, Contacts, Radio and provider settings controls are the
|
||||
// kit's: none of their views hand-writes a <button>, a Material Symbols span,
|
||||
// a select or a checkbox. Radio's Enable, the RTL-SDR card's Connect and its
|
||||
// FM and ADS-B modes are pressed toggles with `active`; Radio's Play and the
|
||||
// card's Locate keep their own `active` class, since their words change
|
||||
// with their state rather than saying they are pressed. The RTL-SDR card's
|
||||
// FM frequency stays a native number field (the kit has none), and the radio
|
||||
// tuner's range stays native: its owner moves the handle back to the
|
||||
// selected station on a drag's first input without changing the slot.
|
||||
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 byId = (markup, name, id) => {
|
||||
const found = tags(markup, name).filter((t) =>
|
||||
new RegExp(String.raw`\sid="${id}"`).test(t),
|
||||
);
|
||||
assert.equal(found.length, 1, id);
|
||||
return found[0];
|
||||
};
|
||||
|
||||
// Each view's UiButtons, UiCloseButtons, UiIcons, UiSelects and UiSliders.
|
||||
const VIEWS = {
|
||||
// FOCUS, REPLAY ASCENT, the replay's pause, PREV, NEXT and SHOW ALL; the
|
||||
// header's deselect and the replay's Cancel close.
|
||||
'panels/MissionDetail.vue': [6, 2, 0, 0, 1],
|
||||
// A mission's row.
|
||||
'panels/MissionRoster.vue': [1, 0, 0, 0, 0],
|
||||
'panels/MissionReplayOverlay.vue': [0, 0, 0, 0, 0],
|
||||
'panels/SpaceMissionsPanel.vue': [0, 0, 0, 0, 0],
|
||||
// PREV, FOCUS, NEXT and a contact's row.
|
||||
'panels/AwarenessPanel.vue': [4, 0, 0, 0, 0],
|
||||
'panels/AwarenessDirection.vue': [0, 0, 0, 0, 0],
|
||||
'panels/AwarenessNames.vue': [0, 0, 0, 0, 0],
|
||||
// Connect, Locate, Change device, FM, ADS-B, Tune and the two seeks.
|
||||
'panels/SdrCard.vue': [8, 0, 0, 1, 1],
|
||||
// Enable, PREV, PLAY, NEXT and STOP.
|
||||
'panels/RadioPanel.vue': [5, 0, 0, 1, 1],
|
||||
'panels/RadioTuner.vue': [0, 0, 0, 0, 0],
|
||||
// The POWER UP chip and its bolt, a key's REMOVE, the voice auth toggle
|
||||
// and SAVE KEYS; the dialog's close.
|
||||
'ProviderSettingsView.vue': [4, 1, 1, 0, 0],
|
||||
};
|
||||
const views = Object.entries(VIEWS).map(([file, counts]) => ({
|
||||
file,
|
||||
markup: template(file),
|
||||
counts,
|
||||
}));
|
||||
|
||||
test('they hand-write no button; each is a UiButton or UiCloseButton', () => {
|
||||
for (const { file, markup, counts } of views) {
|
||||
assert.deepEqual(markup.match(/<button\b/gi) ?? [], [], file);
|
||||
assert.deepEqual(markup.match(/<component\b/gi) ?? [], [], file);
|
||||
assert.equal(tags(markup, 'UiButton').length, counts[0], file);
|
||||
assert.equal(tags(markup, 'UiCloseButton').length, counts[1], file);
|
||||
}
|
||||
});
|
||||
|
||||
test('they hand-write no Material glyph; each is a UiIcon sized by its site', () => {
|
||||
for (const { file, markup, counts } of views) {
|
||||
assert.deepEqual(
|
||||
markup.match(/material-symbols-outlined/g) ?? [],
|
||||
[],
|
||||
file,
|
||||
);
|
||||
const icons = tags(markup, 'UiIcon');
|
||||
assert.equal(icons.length, counts[2], file);
|
||||
// Without it the kit writes an 18px size that beats the site rules.
|
||||
for (const icon of icons) assert.match(icon, /\s:size="null"/, file);
|
||||
}
|
||||
});
|
||||
|
||||
test('their selects and ranges are the kit’s, apart from the tuner', () => {
|
||||
for (const { file, markup, counts } of views) {
|
||||
assert.deepEqual(markup.match(/<select\b/gi) ?? [], [], file);
|
||||
assert.doesNotMatch(markup, /type="checkbox"/, file);
|
||||
assert.equal(tags(markup, 'UiSelect').length, counts[3], file);
|
||||
assert.equal(tags(markup, 'UiSlider').length, counts[4], file);
|
||||
const ranges = tags(markup, 'input').filter((i) =>
|
||||
/\stype="range"/.test(i),
|
||||
);
|
||||
assert.equal(ranges.length, file === 'panels/RadioTuner.vue' ? 1 : 0, file);
|
||||
}
|
||||
});
|
||||
|
||||
test('no tag hand-writes aria-pressed; the pressed toggles take :pressed', () => {
|
||||
const pressed = {
|
||||
'panels/MissionDetail.vue': 1,
|
||||
'panels/SdrCard.vue': 3,
|
||||
'panels/RadioPanel.vue': 1,
|
||||
};
|
||||
for (const { file, markup } of views) {
|
||||
assert.doesNotMatch(
|
||||
markup,
|
||||
tag(String.raw`<\w+\bATTRS\s(?:v-bind)?:?aria-pressed`),
|
||||
file,
|
||||
);
|
||||
const toggles = tags(markup, 'UiButton').filter((b) =>
|
||||
/\s:pressed=/.test(b),
|
||||
);
|
||||
assert.equal(toggles.length, pressed[file] ?? 0, file);
|
||||
}
|
||||
const sdr = views.find((v) => v.file === 'panels/SdrCard.vue').markup;
|
||||
const radio = views.find((v) => v.file === 'panels/RadioPanel.vue').markup;
|
||||
for (const [markup, id] of [
|
||||
[sdr, 'sdr-connect-btn'],
|
||||
[sdr, 'sdr-mode-fm-btn'],
|
||||
[sdr, 'sdr-mode-adsb-btn'],
|
||||
[radio, 'radio-enable-btn'],
|
||||
])
|
||||
assert.match(byId(markup, 'UiButton', id), /\spressed-class="active"/, id);
|
||||
});
|
||||
|
||||
test('Play and Locate keep their own active class rather than pressed', () => {
|
||||
const sdr = views.find((v) => v.file === 'panels/SdrCard.vue').markup;
|
||||
const radio = views.find((v) => v.file === 'panels/RadioPanel.vue').markup;
|
||||
for (const [markup, id] of [
|
||||
[radio, 'radio-play-btn'],
|
||||
[sdr, 'sdr-locate-btn'],
|
||||
]) {
|
||||
const button = byId(markup, 'UiButton', id);
|
||||
assert.doesNotMatch(button, /\s:pressed=/, id);
|
||||
assert.match(button, /\sv-class-toggle="\{ active: /, id);
|
||||
}
|
||||
});
|
||||
@@ -68,7 +68,7 @@ test('before RadioControls renders, the panel shows its initial markup', (t) =>
|
||||
assert.equal($('radio-filter').options.length, 1);
|
||||
assert.equal($('radio-filter').options[0].value, 'all');
|
||||
assert.equal($('radio-filter').options[0].textContent, 'All');
|
||||
assert.equal($('radio-play-btn').getAttribute('class'), null);
|
||||
assert.equal(coreClasses($('radio-play-btn')), '');
|
||||
assert.equal($('radio-play-btn').disabled, true);
|
||||
assert.equal($('radio-volume').value, '80');
|
||||
assert.equal($('radio-volume-value').textContent, '80%');
|
||||
@@ -120,7 +120,7 @@ test('the panel renders the presented directory, station, transport and playback
|
||||
assert.equal($('radio-station-homepage').getAttribute('href'), 'https://example.org/');
|
||||
assert.equal($('radio-station-homepage').hidden, false);
|
||||
const play = $('radio-play-btn');
|
||||
assert.equal(play.className, 'active');
|
||||
assert.equal(coreClasses(play), 'active');
|
||||
assert.equal(play.textContent, 'PAUSE');
|
||||
assert.equal(play.getAttribute('aria-label'), 'Pause selected radio station');
|
||||
assert.equal($('radio-prev-btn').disabled, false);
|
||||
@@ -128,7 +128,7 @@ test('the panel renders the presented directory, station, transport and playback
|
||||
assert.equal($('radio-playback-state').textContent, 'Playing KJAZ');
|
||||
|
||||
await render({ audioState: 'error', filter: 'all' });
|
||||
assert.equal(play.className, '');
|
||||
assert.equal(coreClasses(play), '');
|
||||
assert.equal($('radio-playback-state').className, 'radio-playback-state error');
|
||||
assert.equal($('radio-station-homepage').hasAttribute('href'), false);
|
||||
assert.equal($('radio-station-homepage').hidden, true);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -8,7 +8,9 @@ import { vStatusText } from '../rail/statusText.js';
|
||||
import { useLocaleStore } from '../stores/locale.js';
|
||||
import { useProviderSettingsStore } from '../stores/providerSettings.js';
|
||||
import LocalePicker from './panels/LocalePicker.vue';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
import UiCloseButton from '../kit/UiCloseButton.vue';
|
||||
import UiIcon from '../kit/UiIcon.vue';
|
||||
|
||||
const { picker } = storeToRefs(useLocaleStore());
|
||||
// The key setup owner (src/keySetup.js) presents the chip, the dialog and its
|
||||
@@ -39,10 +41,10 @@ const removeTitle = (title) =>
|
||||
<!-- Bottom-right HUD row: the POWER UP chip (while keys are missing) and
|
||||
the language picker, once the shell publishes it. -->
|
||||
<div id="corner-actions">
|
||||
<button v-if="available" id="key-setup-chip" type="button" :hidden="!chip || chip.hidden" aria-haspopup="dialog" aria-controls="key-setup" :title="chip?.title" :aria-label="chip?.title" @click="controls?.open()">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">bolt</span>
|
||||
<UiButton v-if="available" id="key-setup-chip" :hidden="!chip || chip.hidden" aria-haspopup="dialog" aria-controls="key-setup" :title="chip?.title" :aria-label="chip?.title" @click="controls?.open()">
|
||||
<UiIcon name="bolt" :size="null" />
|
||||
<span data-key-setup-chip-label>{{ chip ? chip.label : t('POWER UP') }}</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
<LocalePicker v-if="picker" :key="picker.current" :current="picker.current" :on-select="picker.onSelect" :focus="picker.focus" />
|
||||
</div>
|
||||
<aside v-if="available" id="key-setup" role="dialog" aria-labelledby="key-setup-title" aria-describedby="key-setup-description" :hidden="dialog.hidden" v-class-toggle="{ visible: dialog.visible }" :data-ready="view?.ready ? 'true' : undefined" @transitionend="controls?.transitionEnd()">
|
||||
@@ -66,16 +68,16 @@ const removeTitle = (title) =>
|
||||
<p class="key-setup-unlocks">{{ key.unlocks }}</p>
|
||||
<div v-if="!key.external" class="key-setup-fields">
|
||||
<input v-for="envVar in key.envVars" :key="envVar" type="password" autocomplete="off" spellcheck="false" :data-env-var="envVar" :aria-label="envVar" :placeholder="key.set ? t('{envVar} saved — paste to replace', { envVar }) : t('paste {envVar}', { envVar })" v-field-value="view.fields[envVar] ?? ''" @input="controls?.setField(envVar, $event.target.value)" />
|
||||
<button v-if="key.managed === 'file'" type="button" class="key-setup-remove" :data-key-setup-remove="JSON.stringify(key.envVars)" :title="removeTitle(key.title)" @click="controls?.remove(key.envVars)">{{ t('REMOVE') }}</button>
|
||||
<UiButton v-if="key.managed === 'file'" class="key-setup-remove" :data-key-setup-remove="JSON.stringify(key.envVars)" :title="removeTitle(key.title)" @click="controls?.remove(key.envVars)">{{ t('REMOVE') }}</UiButton>
|
||||
</div>
|
||||
<div v-if="key.id === 'openai'" class="key-setup-cloud-auth">
|
||||
<span class="key-setup-cloud-auth-state">{{ view.auth.mode === 'oauth' ? t('VOICE AUTH · CHATGPT OAUTH') : t('VOICE AUTH · API KEY') }}</span>
|
||||
<button type="button" class="key-setup-cloud-auth-toggle" data-cloud-voice-auth-toggle="true" :title="view.auth.mode === 'oauth' ? t('Use OPENAI_API_KEY for the next cloud voice session') : t('Use the signed-in local ChatGPT/Codex OAuth session for the next cloud voice session')" :aria-disabled="String(view.auth.busy)" @click="controls?.toggleAuth()">{{ view.auth.mode === 'oauth' ? t('USE API KEY') : t('USE CHATGPT OAUTH') }}</button>
|
||||
<UiButton class="key-setup-cloud-auth-toggle" data-cloud-voice-auth-toggle="true" :title="view.auth.mode === 'oauth' ? t('Use OPENAI_API_KEY for the next cloud voice session') : t('Use the signed-in local ChatGPT/Codex OAuth session for the next cloud voice session')" :aria-disabled="String(view.auth.busy)" @click="controls?.toggleAuth()">{{ view.auth.mode === 'oauth' ? t('USE API KEY') : t('USE CHATGPT OAUTH') }}</UiButton>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div class="key-setup-footer">
|
||||
<button type="button" class="key-setup-apply" data-key-setup-apply :aria-disabled="view?.saving == null ? undefined : String(view.saving)" @click="controls?.apply()">{{ t('SAVE KEYS') }}</button>
|
||||
<UiButton class="key-setup-apply" data-key-setup-apply :aria-disabled="view?.saving == null ? undefined : String(view.saving)" @click="controls?.apply()">{{ t('SAVE KEYS') }}</UiButton>
|
||||
<span class="key-setup-hint">{{ t('ESC to close') }}</span>
|
||||
</div>
|
||||
<p class="key-setup-note" data-key-setup-status role="status" aria-live="polite" v-status-text="statusText"></p>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia';
|
||||
import { onBeforeUpdate, onUpdated, ref } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { useContextStore } from '../../stores/context.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import AwarenessNames from './AwarenessNames.vue';
|
||||
|
||||
// The Contacts panel inside Context. The Contacts layer publishes its view
|
||||
@@ -66,16 +67,16 @@ onUpdated(() => {
|
||||
</a>
|
||||
<AwarenessNames v-if="view.subjectNames" :names="view.subjectNames" />
|
||||
<div class="military-awareness-controls" role="group" :aria-label="view.navigation.label">
|
||||
<button type="button" data-awareness-action="previous" :title="view.navigation.previous.title" :disabled="view.navigation.previous.disabled" @click="layer?.navigatePrevious(user)">{{ view.navigation.previous.text }}</button>
|
||||
<button type="button" data-awareness-action="focus" @click="layer?.focusCurrent(user)">{{ view.navigation.focus.text }}</button>
|
||||
<button type="button" data-awareness-action="next" :title="view.navigation.next.title" :disabled="view.navigation.next.disabled" @click="layer?.navigateNext(user)">{{ view.navigation.next.text }}</button>
|
||||
<UiButton data-awareness-action="previous" :title="view.navigation.previous.title" :disabled="view.navigation.previous.disabled" @click="layer?.navigatePrevious(user)">{{ view.navigation.previous.text }}</UiButton>
|
||||
<UiButton data-awareness-action="focus" @click="layer?.focusCurrent(user)">{{ view.navigation.focus.text }}</UiButton>
|
||||
<UiButton data-awareness-action="next" :title="view.navigation.next.title" :disabled="view.navigation.next.disabled" @click="layer?.navigateNext(user)">{{ view.navigation.next.text }}</UiButton>
|
||||
</div>
|
||||
<section v-for="row in view.rows" :key="row.id" :class="['military-awareness-row', row.relationship]">
|
||||
<div><strong>{{ row.label }}</strong><b aria-live="polite">{{ row.count }}</b></div>
|
||||
<small>{{ row.detail }}</small>
|
||||
<ul v-if="row.nearest.length">
|
||||
<li v-for="item in row.nearest" :key="item.key">
|
||||
<button v-if="item.targetId" type="button" class="military-awareness-target" :data-awareness-layer="item.layer" :data-awareness-id="item.targetId" :aria-label="item.ariaLabel" @click="layer?.focusTarget(item.layer, item.targetId, user)">{{ item.label }} <span>{{ item.distance }}</span></button>
|
||||
<UiButton v-if="item.targetId" class="military-awareness-target" :data-awareness-layer="item.layer" :data-awareness-id="item.targetId" :aria-label="item.ariaLabel" @click="layer?.focusTarget(item.layer, item.targetId, user)">{{ item.label }} <span>{{ item.distance }}</span></UiButton>
|
||||
<span v-else class="military-awareness-target unavailable" :aria-label="item.ariaLabel">{{ item.label }} <span>{{ item.distance }}</span></span>
|
||||
<AwarenessNames v-if="item.names" :names="item.names" />
|
||||
</li>
|
||||
|
||||
@@ -5,6 +5,8 @@ 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';
|
||||
|
||||
@@ -67,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>
|
||||
@@ -76,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>
|
||||
@@ -86,7 +88,7 @@ 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>
|
||||
@@ -95,27 +97,27 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
|
||||
<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>
|
||||
</UiSelect>
|
||||
<button id="gev-chat-layer-attach" type="button" :disabled="props.view.chat.locked || !layerChoice" @click="attachLayer()">{{ t('Attach layer') }}</button>
|
||||
<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>
|
||||
@@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiIcon from '../../kit/UiIcon.vue';
|
||||
import UiSegmented from '../../kit/UiSegmented.vue';
|
||||
import { useDisplayStore } from '../../stores/display.js';
|
||||
import DrawMarkList from './DrawMarkList.vue';
|
||||
@@ -27,7 +28,7 @@ const shapeOptions = computed(() => [
|
||||
<template>
|
||||
<div class="pp-toggle-group" id="draw-group">
|
||||
<UiButton class="pp-toggle-btn" :pressed="draw?.active ?? false" pressed-class="active" id="draw-toggle" @click="act('toggleDraw')" :title="t('Draw on the world — click vertices, double-click or Enter to finish, Esc to cancel')">
|
||||
<span class="pp-icon material-symbols-outlined" aria-hidden="true">draw</span>
|
||||
<UiIcon class="pp-icon" name="draw" :size="null" />
|
||||
<span class="pp-label">{{ t('Draw') }}</span>
|
||||
</UiButton>
|
||||
<div class="pp-slider-row" :class="{ visible: draw?.active }" id="draw-mode-row">
|
||||
@@ -36,7 +37,7 @@ const shapeOptions = computed(() => [
|
||||
</div>
|
||||
<div class="pp-slider-row" :class="{ visible: draw?.active }" id="draw-label-row">
|
||||
<span class="draw-hint" id="draw-hint" aria-live="polite">{{ draw?.hint ?? '' }}</span>
|
||||
<button class="pp-mode-btn draw-clear-btn" id="draw-clear" type="button" @click="act('clearDraw')" :title="t('Remove every mark from the board')">{{ t('Clear') }}</button>
|
||||
<UiButton class="pp-mode-btn draw-clear-btn" id="draw-clear" @click="act('clearDraw')" :title="t('Remove every mark from the board')">{{ t('Clear') }}</UiButton>
|
||||
</div>
|
||||
<DrawMarkList />
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,9 @@ import { DRAW_COLOR_CSS } from '../../../annotations/drawMarks.js';
|
||||
import { vFieldValue } from '../../rail/fieldValue.js';
|
||||
import { vFocusSafeChildren } from '../../rail/focusSafeChildren.js';
|
||||
import DrawSwatches from './DrawSwatches.vue';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiCloseButton from '../../kit/UiCloseButton.vue';
|
||||
import UiIcon from '../../kit/UiIcon.vue';
|
||||
import { useDisplayStore } from '../../stores/display.js';
|
||||
|
||||
// UTILITIES ▸ Draw's shapes, one row each like Import's files: the colour
|
||||
@@ -100,5 +102,5 @@ function leave() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ul class="geo-import-list draw-mark-list" :class="{ visible: listed }" id="draw-mark-list" v-focus-safe-children="leave" :aria-label="t('Drawn shapes')"><li v-for="row in rows" :key="row.id" class="geo-import-row draw-mark-row" :class="{ 'hidden-mark': row.hidden }" :data-mark-id="row.id" @keydown="onRowKey(row, $event)"><button type="button" class="geo-import-swatch draw-mark-swatch" data-control="swatch" :style="{ background: DRAW_COLOR_CSS[row.color] }" :title="row.labels.swatch" :aria-label="row.labels.swatch" :aria-expanded="String(picking === row.id)" :aria-controls="`draw-mark-colors-${row.id}`" @click="picking = picking === row.id ? null : row.id"></button><DrawSwatches v-if="picking === row.id" :id="`draw-mark-colors-${row.id}`" class="draw-mark-colors" data-control="picker" autofocus :label="row.labels.colors" :model-value="row.color" @update:model-value="recolor(row, $event)" @choose="closePicker(row.id)" /><input type="text" class="geo-import-name draw-mark-name" data-control="name" maxlength="120" autocomplete="off" spellcheck="false" v-field-value="row.name" :placeholder="row.placeholder" :aria-label="row.labels.name" @keydown="onNameKey(row, $event)" @focusout="commit(row, $event.currentTarget)"><button type="button" class="geo-import-action" data-control="toggle" :title="row.labels.toggle" :aria-label="row.labels.toggle" @click="display.act('toggleDrawMark', row.id)"><span class="material-symbols-outlined" aria-hidden="true">{{ row.hidden ? 'visibility_off' : 'visibility' }}</span></button><button v-for="action in row.actions" :key="action.id" type="button" class="geo-import-action draw-mark-action" :data-control="`action-${action.id}`" :data-action="action.id" :title="action.label" :aria-label="action.label" :aria-disabled="String(row.busy)" @click="display.act('runDrawMarkAction', row.id, action.id)"><span class="material-symbols-outlined" aria-hidden="true">{{ action.icon }}</span></button><button type="button" class="geo-import-action" data-control="fly" :title="row.labels.fly" :aria-label="row.labels.fly" @click="display.act('flyToDrawMark', row.id)"><span class="material-symbols-outlined" aria-hidden="true">my_location</span></button><UiCloseButton class="geo-import-action" glyph="icon" data-control="remove" :title="row.labels.remove" :label="row.labels.remove" @click="display.act('removeDrawMark', row.id)" /><span v-if="row.actions.length" class="draw-mark-note" role="status" :aria-busy="String(row.busy)">{{ row.busy ? '…' : row.note }}</span></li></ul>
|
||||
<ul class="geo-import-list draw-mark-list" :class="{ visible: listed }" id="draw-mark-list" v-focus-safe-children="leave" :aria-label="t('Drawn shapes')"><li v-for="row in rows" :key="row.id" class="geo-import-row draw-mark-row" :class="{ 'hidden-mark': row.hidden }" :data-mark-id="row.id" @keydown="onRowKey(row, $event)"><UiButton class="geo-import-swatch draw-mark-swatch" data-control="swatch" :style="{ background: DRAW_COLOR_CSS[row.color] }" :label="row.labels.swatch" :aria-expanded="String(picking === row.id)" :aria-controls="`draw-mark-colors-${row.id}`" @click="picking = picking === row.id ? null : row.id" /><DrawSwatches v-if="picking === row.id" :id="`draw-mark-colors-${row.id}`" class="draw-mark-colors" data-control="picker" autofocus :label="row.labels.colors" :model-value="row.color" @update:model-value="recolor(row, $event)" @choose="closePicker(row.id)" /><input type="text" class="geo-import-name draw-mark-name" data-control="name" maxlength="120" autocomplete="off" spellcheck="false" v-field-value="row.name" :placeholder="row.placeholder" :aria-label="row.labels.name" @keydown="onNameKey(row, $event)" @focusout="commit(row, $event.currentTarget)"><UiButton class="geo-import-action" data-control="toggle" :label="row.labels.toggle" @click="display.act('toggleDrawMark', row.id)"><UiIcon :name="row.hidden ? 'visibility_off' : 'visibility'" :size="null" /></UiButton><UiButton v-for="action in row.actions" :key="action.id" class="geo-import-action draw-mark-action" :data-control="`action-${action.id}`" :data-action="action.id" :label="action.label" :aria-disabled="String(row.busy)" @click="display.act('runDrawMarkAction', row.id, action.id)"><UiIcon :name="action.icon" :size="null" /></UiButton><UiButton class="geo-import-action" data-control="fly" :label="row.labels.fly" @click="display.act('flyToDrawMark', row.id)"><UiIcon name="my_location" :size="null" /></UiButton><UiCloseButton class="geo-import-action" glyph="icon" data-control="remove" :title="row.labels.remove" :label="row.labels.remove" @click="display.act('removeDrawMark', row.id)" /><span v-if="row.actions.length" class="draw-mark-note" role="status" :aria-busy="String(row.busy)">{{ row.busy ? '…' : row.note }}</span></li></ul>
|
||||
</template>
|
||||
@@ -6,11 +6,15 @@ import {
|
||||
DRAW_COLOR_CSS,
|
||||
DRAW_COLOR_NAMES,
|
||||
} from '../../../annotations/drawMarks.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
|
||||
// Draw's five colours as one radio group: the next shape's colour and a
|
||||
// drawn shape's picker. Only the checked colour is a tab stop; the arrows,
|
||||
// Home and End move to and choose another, as a radio group's do. Each swatch
|
||||
// shows its colour from DRAW_COLOR_CSS, the same value the shape is drawn in.
|
||||
// The swatches are ghost UiButtons with role="radio": they say they are
|
||||
// chosen with aria-checked and their own `active` class, never aria-pressed,
|
||||
// and `buttons` keeps their elements for the arrows.
|
||||
// The template is one line: templates keep whitespace.
|
||||
const props = defineProps({
|
||||
modelValue: { type: String, default: 'primary' },
|
||||
@@ -44,5 +48,5 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="draw-colors" role="radiogroup" :aria-label="props.label" @keydown="onKey"><button v-for="(color, index) in DRAW_COLORS" :key="color" :ref="(el) => (buttons[index] = el)" type="button" class="draw-color" :class="{ active: color === props.modelValue }" role="radio" :data-color="color" :data-control="`color-${color}`" :aria-checked="String(color === props.modelValue)" :tabindex="color === props.modelValue ? 0 : -1" :style="{ background: DRAW_COLOR_CSS[color] }" :title="t(DRAW_COLOR_NAMES[color])" :aria-label="t(DRAW_COLOR_NAMES[color])" @click="emit('update:modelValue', color), emit('choose', color)"></button></div>
|
||||
<div class="draw-colors" role="radiogroup" :aria-label="props.label" @keydown="onKey"><UiButton v-for="(color, index) in DRAW_COLORS" :key="color" :ref="(swatch) => (buttons[index] = swatch?.$el)" class="draw-color" :class="{ active: color === props.modelValue }" role="radio" :data-color="color" :data-control="`color-${color}`" :aria-checked="String(color === props.modelValue)" :tabindex="color === props.modelValue ? 0 : -1" :style="{ background: DRAW_COLOR_CSS[color] }" :label="t(DRAW_COLOR_NAMES[color])" @click="emit('update:modelValue', color), emit('choose', color)" /></div>
|
||||
</template>
|
||||
@@ -56,16 +56,16 @@ function leave() {
|
||||
other.querySelector('button');
|
||||
if (target) return target.focus();
|
||||
}
|
||||
importButton.value?.focus();
|
||||
importButton.value?.$el.focus();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="pp-toggle-group" id="geo-import-group">
|
||||
<button ref="importButton" class="pp-toggle-btn" id="geo-import-button" type="button" @click="openPicker" :title="t('Show your own GeoJSON, KML, KMZ or GPX files on the globe (or drop them onto it). File bytes stay on this device; overlays can appear in map screenshots shared with voice.')">
|
||||
<span class="pp-icon material-symbols-outlined" aria-hidden="true">upload_file</span>
|
||||
<UiButton ref="importButton" class="pp-toggle-btn" id="geo-import-button" @click="openPicker" :title="t('Show your own GeoJSON, KML, KMZ or GPX files on the globe (or drop them onto it). File bytes stay on this device; overlays can appear in map screenshots shared with voice.')">
|
||||
<UiIcon class="pp-icon" name="upload_file" :size="null" />
|
||||
<span class="pp-label">{{ t('Import') }}</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
<input ref="picker" type="file" id="geo-import-input" accept=".geojson,.json,.kml,.kmz,.gpx" multiple hidden @change="pick" :aria-label="t('Choose GeoJSON, KML, KMZ or GPX files')">
|
||||
<ul class="geo-import-list" :class="{ visible: listed }" id="geo-import-list" v-focus-safe-children="leave" :aria-label="t('Imported files')"><li v-for="row in rows" :key="row.id" class="geo-import-row" :data-import-id="row.id"><span :class="['geo-import-swatch', { 'own-styles': row.ownStyles }]" :style="row.ownStyles ? null : { background: row.color }"></span><span class="geo-import-name" :title="row.title">{{ row.name }}</span><UiButton v-for="item in row.actions" :key="item.action" class="geo-import-action" :data-action="item.action" :label="item.label" :pressed="item.pressed" @click="display.act(ROW_ACTIONS[item.action], row.id)"><UiIcon :name="item.icon" :size="null" /></UiButton></li></ul>
|
||||
<span class="draw-hint geo-import-hint" id="geo-import-hint" aria-live="polite">{{ geoImport?.hint ?? '' }}</span>
|
||||
|
||||
@@ -68,18 +68,18 @@ watch(
|
||||
<div class="mission-replay-speed-scale" aria-hidden="true"><span>0.25×</span><span>1×</span><span>4×</span></div>
|
||||
</div>
|
||||
<div class="mission-action-row">
|
||||
<button type="button" class="mission-focus-button" data-mission-focus @click="layer?.focusSelectedLaunchSite()">{{ t('FOCUS') }}</button>
|
||||
<UiButton class="mission-focus-button" data-mission-focus @click="layer?.focusSelectedLaunchSite()">{{ t('FOCUS') }}</UiButton>
|
||||
<UiButton class="mission-replay-button" data-mission-replay :pressed="m?.replay.active ?? false" :title="t('Replay the estimated ascent with a following camera')" :hidden="m && (m.replay.active || !m.replay.available)" :disabled="m && !m.replay.available" @click="layer?.startSelectedReplay()">{{ t('REPLAY ASCENT') }}</UiButton>
|
||||
<div class="mission-replay-transport" :class="{ 'is-paused': m?.replay.paused }" data-mission-replay-transport :hidden="!m?.replay.active" :aria-label="m?.replay.transportLabel">
|
||||
<button type="button" data-mission-replay-toggle :title="m ? m.replay.toggleLabel : t('Pause replay')" :aria-label="m ? m.replay.toggleLabel : t('Pause replay')" :disabled="m && !m.replay.active" @click="layer?.toggleReplayPause()">{{ m ? m.replay.toggleText : 'Ⅱ' }}</button>
|
||||
<UiButton data-mission-replay-toggle :title="m ? m.replay.toggleLabel : t('Pause replay')" :aria-label="m ? m.replay.toggleLabel : t('Pause replay')" :disabled="m && !m.replay.active" @click="layer?.toggleReplayPause()">{{ m ? m.replay.toggleText : 'Ⅱ' }}</UiButton>
|
||||
<UiCloseButton class="cancel" data-mission-replay-cancel bare :title="t('Cancel replay')" :label="t('Cancel replay')" @click="layer?.cancelReplay()" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="space-mission-nav">
|
||||
<button type="button" class="mission-nav-button" data-mission-prev :title="t('Previous mission')" :disabled="m?.previousDisabled" @click="layer?.selectPreviousMission()"><span aria-hidden="true">‹</span> {{ t('PREV') }}</button>
|
||||
<UiButton class="mission-nav-button" data-mission-prev :title="t('Previous mission')" :disabled="m?.previousDisabled" @click="layer?.selectPreviousMission()"><span aria-hidden="true">‹</span> {{ t('PREV') }}</UiButton>
|
||||
<span class="mission-nav-index" data-mission-index>{{ m ? m.index : '—' }}</span>
|
||||
<button type="button" class="mission-nav-button" data-mission-next :title="t('Next mission')" :disabled="m?.nextDisabled" @click="layer?.selectNextMission()">{{ t('NEXT') }} <span aria-hidden="true">›</span></button>
|
||||
<UiButton class="mission-nav-button" data-mission-next :title="t('Next mission')" :disabled="m?.nextDisabled" @click="layer?.selectNextMission()">{{ t('NEXT') }} <span aria-hidden="true">›</span></UiButton>
|
||||
</div>
|
||||
<button type="button" class="panel-layer-toggle" data-mission-show-all @click="layer?.deselectMission()">{{ t('SHOW ALL / DESELECT') }}</button>
|
||||
<UiButton class="panel-layer-toggle" data-mission-show-all @click="layer?.deselectMission()">{{ t('SHOW ALL / DESELECT') }}</UiButton>
|
||||
</aside>
|
||||
</template>
|
||||
@@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia';
|
||||
import { onBeforeUpdate, onUpdated, ref } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { useSpaceMissionsStore } from '../../stores/spaceMissions.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiEmpty from '../../kit/UiEmpty.vue';
|
||||
|
||||
// The Space Missions roster. The launches layer presents it; until it does,
|
||||
@@ -72,7 +73,7 @@ onUpdated(() => {
|
||||
<div class="space-mission-roster-list ui-scroll" data-mission-roster-list>
|
||||
<UiEmpty v-if="!roster" class="space-mission-roster-empty" :title="t('LOADING 30-DAY MISSION INDEX')" />
|
||||
<UiEmpty v-else-if="!roster.entries.length" class="space-mission-roster-empty" :title="roster.empty" />
|
||||
<button v-for="entry in roster?.entries" v-else :key="entry.id" type="button" class="space-mission-roster-item" :data-mission-roster-index="entry.index" :data-mission-roster-id="entry.id" :aria-label="entry.ariaLabel" @click="layer?.selectMissionAt(entry.index)" @mouseenter="enter(entry.index)" @mousemove="move(entry.index)" @mouseleave="layer?.rosterPointerLeave()" @focus="layer?.rosterFocus(entry.index)" @blur="blur"><span class="space-mission-roster-marker" :style="{ '--mission-roster-color': entry.color }" aria-hidden="true"></span><span class="space-mission-roster-copy"><strong>{{ entry.label }}</strong><small>{{ entry.provider }} · {{ entry.date }}</small></span><span class="space-mission-roster-chevron" aria-hidden="true">›</span></button>
|
||||
<UiButton v-for="entry in roster?.entries" v-else :key="entry.id" class="space-mission-roster-item" :data-mission-roster-index="entry.index" :data-mission-roster-id="entry.id" :aria-label="entry.ariaLabel" @click="layer?.selectMissionAt(entry.index)" @mouseenter="enter(entry.index)" @mousemove="move(entry.index)" @mouseleave="layer?.rosterPointerLeave()" @focus="layer?.rosterFocus(entry.index)" @blur="blur"><span class="space-mission-roster-marker" :style="{ '--mission-roster-color': entry.color }" aria-hidden="true"></span><span class="space-mission-roster-copy"><strong>{{ entry.label }}</strong><small>{{ entry.provider }} · {{ entry.date }}</small></span><span class="space-mission-roster-chevron" aria-hidden="true">›</span></UiButton>
|
||||
</div>
|
||||
<p class="space-mission-roster-focus-continuation" tabindex="-1" data-mission-roster-focus-continuation>{{ t('TAB PREVIEWS · ENTER / SPACE SELECTS') }}</p>
|
||||
</div>
|
||||
|
||||
@@ -52,10 +52,10 @@ const radioWords = computed(() => ({
|
||||
</div>
|
||||
<RadioTuner />
|
||||
<div class="radio-transport" role="group" :aria-label="t('Radio playback')">
|
||||
<button id="radio-prev-btn" @click="act('cycleRadio', -1)" type="button" :aria-label="t('Previous filtered station')" :disabled="radio ? radio.transport.stepDisabled : true">{{ t('PREV') }}</button>
|
||||
<button id="radio-play-btn" @click="act('toggleRadioPlayback')" type="button" v-class-toggle="{ active: radio?.transport.play.active }" :aria-label="radio ? radio.transport.play.label : t('Play selected station')" :disabled="radio ? radio.transport.play.disabled : true">{{ radio ? radio.transport.play.text : t('PLAY') }}</button>
|
||||
<button id="radio-next-btn" @click="act('cycleRadio', 1)" type="button" :aria-label="t('Next filtered station')" :disabled="radio ? radio.transport.stepDisabled : true">{{ t('NEXT') }}</button>
|
||||
<button id="radio-stop-btn" @click="act('stopRadio')" type="button" :aria-label="t('Stop radio playback')" :disabled="radio ? radio.transport.stopDisabled : true">{{ t('STOP') }}</button>
|
||||
<UiButton id="radio-prev-btn" @click="act('cycleRadio', -1)" :aria-label="t('Previous filtered station')" :disabled="radio ? radio.transport.stepDisabled : true">{{ t('PREV') }}</UiButton>
|
||||
<UiButton id="radio-play-btn" @click="act('toggleRadioPlayback')" v-class-toggle="{ active: radio?.transport.play.active }" :aria-label="radio ? radio.transport.play.label : t('Play selected station')" :disabled="radio ? radio.transport.play.disabled : true">{{ radio ? radio.transport.play.text : t('PLAY') }}</UiButton>
|
||||
<UiButton id="radio-next-btn" @click="act('cycleRadio', 1)" :aria-label="t('Next filtered station')" :disabled="radio ? radio.transport.stepDisabled : true">{{ t('NEXT') }}</UiButton>
|
||||
<UiButton id="radio-stop-btn" @click="act('stopRadio')" :aria-label="t('Stop radio playback')" :disabled="radio ? radio.transport.stopDisabled : true">{{ t('STOP') }}</UiButton>
|
||||
</div>
|
||||
<label class="radio-volume-row" for="radio-volume">
|
||||
<span>{{ t('VOLUME') }}</span>
|
||||
|
||||
@@ -32,8 +32,8 @@ const tune = () => act('tuneSdr', frequency.value.value);
|
||||
<p>{{ t('Chrome/Edge · WebUSB · one local tuner shared by FM and the Local ADS-B layer.') }}</p>
|
||||
<div class="sdr-radio-actions">
|
||||
<UiButton id="sdr-connect-btn" @click="act('toggleSdrConnection')" class="panel-layer-toggle" :pressed="sdr?.connectPressed ?? false" pressed-class="active" :disabled="sdr?.connectDisabled">{{ sdr ? sdr.connectLabel : t('CONNECT') }}</UiButton>
|
||||
<button id="sdr-locate-btn" type="button" @click="act('locateSdr')" v-class-toggle="{ active: sdr?.locateActive }" :title="t('Use your location for faster ADS-B position decoding')" :disabled="sdr?.locateDisabled">{{ sdr ? sdr.locateLabel : t('LOCATE') }}</button>
|
||||
<button id="sdr-change-device-btn" type="button" @click="act('changeSdrDevice')" :title="t('Choose a different RTL-SDR or receiver channel')" :disabled="sdr?.changeDeviceDisabled">{{ t('CHANGE DEVICE') }}</button>
|
||||
<UiButton id="sdr-locate-btn" @click="act('locateSdr')" v-class-toggle="{ active: sdr?.locateActive }" :title="t('Use your location for faster ADS-B position decoding')" :disabled="sdr?.locateDisabled">{{ sdr ? sdr.locateLabel : t('LOCATE') }}</UiButton>
|
||||
<UiButton id="sdr-change-device-btn" @click="act('changeSdrDevice')" :title="t('Choose a different RTL-SDR or receiver channel')" :disabled="sdr?.changeDeviceDisabled">{{ t('CHANGE DEVICE') }}</UiButton>
|
||||
</div>
|
||||
<div class="sdr-mode-row" role="group" :aria-label="t('RTL-SDR receiver mode')">
|
||||
<UiButton id="sdr-mode-fm-btn" @click="act('setSdrMode', 'fm')" :pressed="sdr ? sdr.fmActive : true" pressed-class="active" :disabled="sdr?.modeDisabled" translate="no">FM</UiButton>
|
||||
@@ -55,11 +55,11 @@ const tune = () => act('tuneSdr', frequency.value.value);
|
||||
<div class="sdr-frequency-row">
|
||||
<label for="sdr-frequency-input">{{ t('FM MHZ') }}</label>
|
||||
<input ref="frequency" class="gev-field" id="sdr-frequency-input" @keydown.enter.prevent="tune" type="number" min="87.5" max="108" step="0.1" value="98.5" inputmode="decimal" :disabled="sdr?.frequencyDisabled" v-field-value="sdr ? sdr.frequency : '98.5'" />
|
||||
<button id="sdr-tune-btn" type="button" @click="tune" :disabled="sdr?.tuneDisabled">{{ t('TUNE') }}</button>
|
||||
<UiButton id="sdr-tune-btn" @click="tune" :disabled="sdr?.tuneDisabled">{{ t('TUNE') }}</UiButton>
|
||||
</div>
|
||||
<div class="sdr-seek-row" role="group" :aria-label="t('Seek broadcast FM stations')">
|
||||
<button id="sdr-seek-back-btn" type="button" @click="act('seekSdr', -1)" :disabled="sdr ? sdr.seekDisabled : true">{{ t('◀ SEEK') }}</button>
|
||||
<button id="sdr-seek-forward-btn" type="button" @click="act('seekSdr', 1)" :disabled="sdr ? sdr.seekDisabled : true">{{ t('SEEK ▶') }}</button>
|
||||
<UiButton id="sdr-seek-back-btn" @click="act('seekSdr', -1)" :disabled="sdr ? sdr.seekDisabled : true">{{ t('◀ SEEK') }}</UiButton>
|
||||
<UiButton id="sdr-seek-forward-btn" @click="act('seekSdr', 1)" :disabled="sdr ? sdr.seekDisabled : true">{{ t('SEEK ▶') }}</UiButton>
|
||||
</div>
|
||||
<label class="radio-volume-row" for="sdr-volume">
|
||||
<span>{{ t('SDR VOL') }}</span>
|
||||
|
||||
@@ -11,6 +11,7 @@ import PanelLayoutButtons from './PanelLayoutButtons.vue';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiCheckbox from '../../kit/UiCheckbox.vue';
|
||||
import UiCloseButton from '../../kit/UiCloseButton.vue';
|
||||
import UiIcon from '../../kit/UiIcon.vue';
|
||||
import UiSelect from '../../kit/UiSelect.js';
|
||||
|
||||
// The voice control in the command dock, as its presenter
|
||||
@@ -79,7 +80,7 @@ const frameStyle = (panel) => ({
|
||||
<span class="gev-mic-orbit"><img src="/mic.svg" alt="" /></span>
|
||||
<span class="gev-mic-label">{{ view.mic.text }}</span>
|
||||
</UiButton>
|
||||
<button v-if="view.panel" id="gev-chat-button" type="button" :aria-label="t('Open AI chat')" aria-controls="gev-chat-panel" :aria-expanded="String(view.chat.open && !view.chat.minimized)" @click="emit('chat-button')"><svg viewBox="0 0 24 24" width="24" height="24" 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><span class="gev-chat-label">{{ t('CHAT') }}</span></button>
|
||||
<UiButton v-if="view.panel" id="gev-chat-button" :aria-label="t('Open AI chat')" aria-controls="gev-chat-panel" :aria-expanded="String(view.chat.open && !view.chat.minimized)" @click="emit('chat-button')"><svg viewBox="0 0 24 24" width="24" height="24" 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><span class="gev-chat-label">{{ t('CHAT') }}</span></UiButton>
|
||||
<ChatPanel v-if="view.panel" :view="view" />
|
||||
<VoiceVisualizer />
|
||||
<div class="gev-chat-thinking" aria-hidden="true"><span></span><span></span><span></span></div>
|
||||
@@ -94,12 +95,12 @@ const frameStyle = (panel) => ({
|
||||
</div>
|
||||
<section v-if="view.panel" id="gev-voice-panel" class="gev-voice-panel" :hidden="view.voicePanel.hidden" :data-view="optional(view.voicePanel.view)" :data-minimized="view.voicePanel.minimized ? 'true' : undefined" :data-context="optional(view.voicePanel.context)" :style="frameStyle(view.voicePanel)" :aria-label="t('Voice Settings')" @keydown="emit('panel-keydown', $event)">
|
||||
<div class="gev-voice-panel-header">
|
||||
<button id="gev-chat-back" type="button" :hidden="!view.chat.backVisible" @click="emit('chat-back')"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path d="M15 5l-7 7 7 7"></path></svg><span>{{ t('Back to chat') }}</span></button>
|
||||
<button id="gev-voice-back" type="button" @click="emit('voice-back')"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path d="M15 5l-7 7 7 7"></path></svg><span>{{ t('Back to voice') }}</span></button>
|
||||
<UiButton id="gev-chat-back" :hidden="!view.chat.backVisible" @click="emit('chat-back')"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path d="M15 5l-7 7 7 7"></path></svg><span>{{ t('Back to chat') }}</span></UiButton>
|
||||
<UiButton id="gev-voice-back" @click="emit('voice-back')"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path d="M15 5l-7 7 7 7"></path></svg><span>{{ t('Back to voice') }}</span></UiButton>
|
||||
<span class="gev-voice-panel-title">{{ t('VOICE') }}</span>
|
||||
<div class="gev-voice-panel-tabs" role="tablist" :aria-label="t('Voice Settings')">
|
||||
<button id="gev-voice-preview-tab" class="gev-voice-panel-tab" type="button" role="tab" :aria-label="t('Preview')" :title="t('Preview')" :aria-selected="String(view.voicePanel.selected === 'preview')" :tabindex="view.voicePanel.selected === 'preview' ? 0 : -1" aria-controls="gev-voice-preview-panel" @click="emit('tab', 0)" @keydown="emit('tab-keydown', 0, $event)"><span class="material-symbols-outlined gev-voice-panel-tab-icon" aria-hidden="true">visibility</span></button>
|
||||
<button id="gev-voice-settings-tab" class="gev-voice-panel-tab" type="button" role="tab" :aria-label="t('Settings')" :title="t('Settings')" :aria-selected="String(view.voicePanel.selected === 'settings')" :tabindex="view.voicePanel.selected === 'settings' ? 0 : -1" aria-controls="gev-voice-settings-panel" @click="emit('tab', 1)" @keydown="emit('tab-keydown', 1, $event)"><span class="material-symbols-outlined gev-voice-panel-tab-icon" aria-hidden="true">settings</span></button>
|
||||
<UiButton id="gev-voice-preview-tab" class="gev-voice-panel-tab" role="tab" :aria-label="t('Preview')" :title="t('Preview')" :aria-selected="String(view.voicePanel.selected === 'preview')" :tabindex="view.voicePanel.selected === 'preview' ? 0 : -1" aria-controls="gev-voice-preview-panel" @click="emit('tab', 0)" @keydown="emit('tab-keydown', 0, $event)"><UiIcon name="visibility" class="gev-voice-panel-tab-icon" :size="null" /></UiButton>
|
||||
<UiButton id="gev-voice-settings-tab" class="gev-voice-panel-tab" role="tab" :aria-label="t('Settings')" :title="t('Settings')" :aria-selected="String(view.voicePanel.selected === 'settings')" :tabindex="view.voicePanel.selected === 'settings' ? 0 : -1" aria-controls="gev-voice-settings-panel" @click="emit('tab', 1)" @keydown="emit('tab-keydown', 1, $event)"><UiIcon name="settings" class="gev-voice-panel-tab-icon" :size="null" /></UiButton>
|
||||
</div>
|
||||
<PanelLayoutButtons :docked="view.layout.docked" :minimized="view.voicePanel.minimized" @dock="emit('layout-dock')" @minimize="emit('voice-minimize')" />
|
||||
<UiCloseButton id="gev-voice-settings-close" :label="t('Close voice panel')" @click="emit('settings-close')" />
|
||||
@@ -158,7 +159,7 @@ const frameStyle = (panel) => ({
|
||||
<div class="gev-voice-error-tray" role="alert" aria-live="assertive">
|
||||
<div class="gev-voice-error-header">
|
||||
<span>{{ view.error.typed ? `${t('Chat')} · ${t('ERROR', { context: 'voice' })}` : t('VOICE SYSTEM ERROR') }}</span>
|
||||
<button class="gev-voice-error-dismiss" type="button" @click="controls?.dismissError()">{{ t('DISMISS') }}</button>
|
||||
<UiButton class="gev-voice-error-dismiss" @click="controls?.dismissError()">{{ t('DISMISS') }}</UiButton>
|
||||
</div>
|
||||
<div id="gev-voice-error-detail">{{ view.error.text }}</div>
|
||||
<div class="gev-voice-error-hint" :hidden="view.error.typed || view.error.hint === false">{{ t('Check microphone permission and network access, then try again.') }}</div>
|
||||
|
||||
Reference in new issue
Block a user