Merge main into denis/iss-live-telemetry

Conflicts: the locale catalogs and package boundaries are three-way merges
(no message changed differently on both sides); zh-Hant is regenerated
from zh-CN. bhoteKoshiEmbeddedMedia.js keeps main's card counter and the
branch's shared YouTube loader (youtubeApi.js), so the media file builds
one script element fewer. The Cockpit briefing's LIVE tab and the orbital
NADIR/RESET button are main's UiButton.
This commit is contained in:
Denis Groshev committed 2026-11-20 10:50:16 +01:00
commit edbf3a234d
244 files changed
+11747 -1273

No files matched your search

+19
View File
@@ -68,6 +68,7 @@ import { useStationStore } from './stores/station.js';
import { useSpaceMissionsStore } from './stores/spaceMissions.js';
import { SpaceMissionsControls } from './spaceMissionsControls.js';
import { useMissionReplayStore } from './stores/missionReplay.js';
import { useStreetLevelPhotoStore } from './stores/streetLevelPhoto.js';
import { useCelestialRingStore } from './stores/celestialRing.js';
import { icrfToFixedAxes } from '../sky/icrf.js';
import { useWorldOverlayActionsStore } from './stores/worldOverlayActions.js';
@@ -120,6 +121,8 @@ export class StyleManager extends ShellFacade {
* @param {{lon: number, lat: number, height: number, heading?: number,
* pitch?: number}|null} [options.homeView] - where the title's logo goes
* back to (degrees): the view the app started from.
* @param {string[]} [options.startLayers] - the layers a bare address (one
* that carries no link) starts with; none by default.
*/
constructor(
viewer,
@@ -131,6 +134,7 @@ export class StyleManager extends ShellFacade {
initialShareCode = null,
localePicker = true,
homeView = null,
startLayers = [],
} = {},
) {
super();
@@ -259,6 +263,7 @@ export class StyleManager extends ShellFacade {
updateFeedback: () => this._updateGlobalLoadingFeedback(),
applyFollowOffset: (followed, offset) =>
applyShareFollowOffset(viewer, followed, offset),
startLayers,
});
this._visualSettings = new VisualSettings({
@@ -1240,7 +1245,18 @@ export class StyleManager extends ShellFacade {
const { streetLevelLayer } = this.services;
this._streetLevelControls?.destroy();
this._streetLevelControls = null;
// The photo viewer (KartaView, Panoramax), which the layer panels draw
// into the viewer host. A viewer left by an earlier shell must
// not outlive its layer.
const streetLevelPhotoStore = useStreetLevelPhotoStore(applicationPinia());
this._streetLevelPhotoUnsubscribe?.();
this._streetLevelPhotoUnsubscribe = null;
streetLevelPhotoStore.publish(null);
if (!this._streetLevelPanel || !streetLevelLayer) return;
this._streetLevelPhotoUnsubscribe =
streetLevelLayer.subscribePhotoViewer?.((view) =>
streetLevelPhotoStore.publish(view),
) ?? null;
// Photo framing yields to newer navigation and releases tracking like
// any deferred flight.
streetLevelLayer.attachNavigation?.({
@@ -2017,7 +2033,10 @@ export class StyleManager extends ShellFacade {
this._spaceMissionsControls = null;
this._missionReplayUnsubscribe?.();
this._missionReplayUnsubscribe = null;
this._streetLevelPhotoUnsubscribe?.();
this._streetLevelPhotoUnsubscribe = null;
useMissionReplayStore(applicationPinia()).publish(null);
useStreetLevelPhotoStore(applicationPinia()).publish(null);
const contextStore = useContextStore(applicationPinia());
contextStore.connectAwareness(null);
contextStore.publishAwareness(null);
@@ -0,0 +1,98 @@
<script setup>
import { t } from '../../i18n/index.js';
// The Bhote Koshi event's embedded media cards and the hidden YouTube
// preload, as src/data/bhoteKoshiEmbeddedMedia.js presents them inside its
// overlay root. The owner renders synchronously on every change and places
// each card beside its map anchor after each frame (its position, its
// leader's line and whether it shows); a card's player is filled by the
// provider: the YouTube frame drawn here, or the Facebook player and X post
// the provider SDKs build inside it. The card's body takes taps (the root
// and the leader do not); Stories keeps that.
defineProps({
/** `{key, src, title}` of the hidden YouTube preload, or null. */
warm: { type: Object, default: null },
/**
* The cards in insertion order: `{id, provider, portrait, entering,
* leaving, unavailable, label, title, status, url, frame, bind}`; `frame`
* is `{src, title, onLoad}` for a YouTube card and null otherwise, and
* `bind(name, element)` hands the owner the elements it places and fills.
*/
cards: { type: Array, default: () => [] },
});
</script>
<template>
<iframe
v-if="warm"
:key="warm.key"
class="bhote-embedded-media-warmup"
:src="warm.src"
:title="warm.title"
tabindex="-1"
aria-hidden="true"
loading="eager"
referrerpolicy="strict-origin-when-cross-origin"
></iframe>
<section
v-for="card in cards"
:key="card.id"
:ref="(el) => card.bind('card', el)"
class="bhote-embedded-callout"
:class="[
`is-${card.provider}`,
{
'is-portrait': card.portrait,
'is-entering': card.entering,
'is-leaving': card.leaving,
'is-unavailable': card.unavailable,
},
]"
:data-provider="card.provider"
:aria-label="card.label"
>
<svg
:ref="(el) => card.bind('leader', el)"
class="bhote-embedded-callout-leader"
aria-hidden="true"
>
<path
pathLength="1"
fill="none"
stroke="rgba(147,213,228,.72)"
stroke-width="1.5"
/>
<circle r="4" fill="#6be8ff" stroke="#ffffff" stroke-width="1.5" />
</svg>
<div class="bhote-embedded-callout-body" data-overlay-input>
<div
v-if="card.frame"
:ref="(el) => card.bind('player', el)"
class="bhote-embedded-callout-player ui-scroll"
>
<iframe
:ref="(el) => card.bind('frameElement', el)"
:src="card.frame.src"
:title="card.frame.title"
allow="autoplay; encrypted-media; picture-in-picture; fullscreen"
allowfullscreen
loading="eager"
referrerpolicy="strict-origin-when-cross-origin"
@load.once="card.frame.onLoad"
></iframe>
</div>
<div
v-else
:ref="(el) => card.bind('player', el)"
class="bhote-embedded-callout-player ui-scroll"
></div>
<footer>
<strong>{{ card.title }}</strong>
<small role="status">{{ card.status }}</small>
<a :href="card.url" target="_blank" rel="noopener noreferrer">{{
t('OPEN ORIGINAL ↗')
}}</a>
</footer>
</div>
</section>
</template>
+3 -2
View File
@@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia';
import { computed } from 'vue';
import { t } from '../../i18n/index.js';
import { useCctvStore } from '../stores/cctv.js';
import UiButton from '../kit/UiButton.vue';
// One click-to-type pose chip. The panel's delegated click starts an edit
// in CctvControls, which publishes it; the chip then holds a number input
@@ -42,7 +43,7 @@ function onBlur(event) {
</script>
<template>
<button
<UiButton
class="cctv-cal-value"
:data-cal-field="field"
:disabled="edit ? false : view?.calibration.disabled"
@@ -60,6 +61,6 @@ function onBlur(event) {
@click.stop /></template
><template v-else>{{
view?.calibration.values[field] ?? `${t(label)} --`
}}</template></button
}}</template></UiButton
>
</template>
+4 -1
View File
@@ -58,7 +58,10 @@ test('before ContextControls renders, the switch shows its initial markup', (t)
);
assert.equal(panel.hasAttribute('data-context-mode'), false);
const tab = $('global-context-flights-btn');
assert.equal(tab.className, 'context-mode-button');
assert.equal(
tab.className,
'ui-button ui-focus ui-button--ghost ui-button--accent context-mode-button',
);
assert.equal(tab.getAttribute('aria-selected'), 'false');
assert.equal(tab.getAttribute('tabindex'), '0');
assert.equal(tab.hasAttribute('aria-busy'), false);
+11 -3
View File
@@ -1,5 +1,6 @@
<script setup>
import { t } from '../../i18n/index.js';
import UiButton from '../kit/UiButton.vue';
import UiCloseButton from '../kit/UiCloseButton.vue';
import CreditItem from './CreditItem.vue';
@@ -33,6 +34,12 @@ const props = defineProps({
const SEPARATOR = ' · ';
/** A credit's key: the same text and link are one credit. */
const key = (credit) => `${credit.text}\u0000${credit.href ?? ''}`;
// The list button's words are the slot of a UiButton, which renders inside
// the button: a locale that is not bound to a ref changes nothing the button
// reads, and the owner patches synchronously and reads the result at once. A
// slot given under a condition (`redrawWithView`, always true) is redrawn
// whenever this view is, so the words follow a new locale with the rest.
const redrawWithView = true;
/** Keep `name`'s element for the owner. */
const keep = (name) => (element) => {
props.elements[name] = element?.$el ?? element;
@@ -46,16 +53,17 @@ const keep = (name) => (element) => {
><template v-for="(credit, i) in props.inline" :key="key(credit)"
>{{ i ? SEPARATOR : '' }}<CreditItem :credit="credit" /></template
>{{ props.inline.length && props.listed.length ? SEPARATOR : '' }}</span
><button
><UiButton
:ref="keep('expand')"
type="button"
class="gev-credits-expand"
aria-haspopup="dialog"
:aria-controls="props.panelId"
:aria-expanded="String(props.open)"
:hidden="props.listed.length === 0"
@click="props.onExpand()"
>{{ t('Data attribution') }}</button
><template v-if="redrawWithView" #default>{{
t('Data attribution')
}}</template></UiButton
></div
><div
:id="props.panelId"
+1 -1
View File
@@ -557,7 +557,7 @@ test('the imported files render what the file import publishes and keep focus',
assert.equal(name.textContent, '<b>a</b>.geojson');
assert.equal(name.children.length, 0, 'the name is text');
assert.match(name.title, /GEOJSON, 2 map objects$/);
assert.equal(toggle.className, 'geo-import-action');
assert.ok(toggle.classList.contains('geo-import-action'));
assert.equal(toggle.getAttribute('type'), 'button');
assert.equal(toggle.getAttribute('aria-pressed'), 'true');
assert.equal(toggle.getAttribute('aria-label'), 'Hide <b>a</b>.geojson');
+30 -1
View File
@@ -1,4 +1,5 @@
import { resolvePickedContext } from '../data/pickedContext.js';
import { onScreen } from '../data/locate.js';
import { clickCard } from '../data/pickRegistry.js';
import { followedOf, onFollowChanged } from '../data/followed.js';
import { fromDegreesInto } from '../geo/ellipsoid.js';
@@ -136,6 +137,21 @@ export function installEntityContext({
}
}
// An item back in its feed after it left it is selected again in its layer,
// as the click that picked it: a vessel is highlighted with its trail, and
// an aircraft found again (`follow`) is followed.
function reselect(card, { follow: andFollow = false } = {}) {
const layer = getDataManager()?.layers?.get?.(card?.layerId)?.module;
const id = card?.identity?.id;
if (!layer || !id) return;
try {
if (card.layerId === 'ais-live-vessels') layer.selectById?.(id);
else if (andFollow && FOLLOWABLE.has(card.layerId)) follow(card);
} catch {
// A layer going away meanwhile has nothing to select.
}
}
// Aircraft can be flown from, and a satellite ridden in the orbital view:
// track the craft, then enter Cockpit on it. Only layers the tracking
// action can follow are offered (local ADS-B cannot be tracked).
@@ -197,6 +213,14 @@ export function installEntityContext({
flyTo,
follow,
letGo,
reselect,
// Whether the camera shows the card's item; null when it cannot tell.
onScreen: (card) => {
const pose = camera()?.pose();
if (!pose || !Number.isFinite(card?.lat) || !Number.isFinite(card?.lon))
return null;
return onScreen(pose, card.lat, card.lon, card.altitudeM ?? 0);
},
isOpen,
regionalBrief,
// The renderer's card previews, when it has them.
@@ -343,7 +367,12 @@ export function installEntityContext({
if (!record?.layerId || inCockpit()) return;
store.select({
layerId: record.layerId,
id: record.id,
// A vessel goes by its own id, as a click on it names it, not by the
// context store's (src/data/pickedContext.js).
id:
record.layerId === 'ais-live-vessels' && record.properties?.vesselId
? String(record.properties.vesselId)
: record.id,
label: record.label || record.properties?.name,
lat: record.latitude,
lon: record.longitude,
+57
View File
@@ -83,3 +83,60 @@ test('Context names nothing under a card painted on top, and keeps its card', (t
tap(null, null);
assert.equal(clears, cleared, 'a card over open map is not open map');
});
// A vessel's layer announces its selection with the context store's id; the
// card names it by the vessel's own id, as a click on it does.
test('a vessel announced by its layer is named by its own id', (t) => {
// The page's events, which Node lacks.
const events = new EventTarget();
for (const name of [
'addEventListener',
'removeEventListener',
'dispatchEvent',
])
globalThis[name] = events[name].bind(events);
t.after(() => {
for (const name of [
'addEventListener',
'removeEventListener',
'dispatchEvent',
])
delete globalThis[name];
});
const pinia = createPinia();
const viewer = { scene: { pick: () => null, drillPick: () => [] } };
const input = fakeInput(viewer);
const disconnect = installEntityContext({
viewer,
getDataManager: () => ({
isEnabled: () => true,
layers: new Map(),
getAll: () => [],
}),
pinia,
});
t.after(() => {
disconnect();
input.destroy();
});
const store = useEntityCardStore(pinia);
const named = [];
store.select = (identity) => named.push(identity.id);
globalThis.dispatchEvent(
new CustomEvent('gev:entity-selected', {
detail: {
layerId: 'ais-live-vessels',
id: 'ais-5fdca702',
properties: { vesselId: '5fdca702' },
latitude: 1,
longitude: 2,
},
}),
);
globalThis.dispatchEvent(
new CustomEvent('gev:entity-selected', {
detail: { layerId: 'fires', id: 'fire:1', latitude: 1, longitude: 2 },
}),
);
assert.deepEqual(named, ['5fdca702', 'fire:1']);
});
+1 -1
View File
@@ -162,7 +162,7 @@ export function initGeoFileImport({
? t('Hide {name}', { name: item.name })
: t('Show {name}', { name: item.name }),
action: 'toggle',
pressed: String(item.visible),
pressed: Boolean(item.visible),
},
{
icon: 'my_location',
+1 -1
View File
@@ -220,7 +220,7 @@ test('row buttons hide, show, fly to and remove a file', async () => {
shapes: [],
});
assert.equal(t.tool.list()[0].visible, false);
assert.equal(action(rows(t)[0], 'toggle').pressed, 'false');
assert.equal(action(rows(t)[0], 'toggle').pressed, false);
assert.equal(action(rows(t)[0], 'toggle').icon, 'visibility_off');
assert.equal(action(rows(t)[0], 'toggle').label, 'Show a.gpx');
glyphClick('fly');
+27 -8
View File
@@ -769,19 +769,38 @@ test('shared panel hooks affect only opted-in rail surfaces without overriding d
);
});
test('narrow Omnibar corners clear the World Timeline over the dock', () => {
test('the Omnibar dock sits above the World Timeline, and narrow corners clear the dock', () => {
const css = read('./styles/omnibar-dock.css');
const timeline = css.match(
/#world-timeline \{\s*bottom: calc\(var\(--omnibar-dock-bottom\) \+ (\d+)px\);/,
// The bar takes the dock's floor; the dock and the field inside it rise by
// the bar's lift (world-timeline.css), as the plain dock does.
assert.match(
css,
/#world-timeline \{\s*bottom: var\(--omnibar-dock-bottom\);/,
);
assert.match(
css,
/--omnibar-dock-raised: calc\(\s*var\(--omnibar-dock-bottom\) \+ var\(--world-timeline-lift, 0px\)\s*\);/,
);
assert.match(
css,
/#command-dock \{[^}]*bottom: var\(--omnibar-dock-raised\);/,
);
assert.match(
css,
/#gev-omnibar \{[^}]*bottom: calc\(var\(--omnibar-dock-raised\) \+ 11px\);/,
);
assert.doesNotMatch(css, /--world-timeline-lift\s*:/);
const lift = read('./styles/world-timeline.css').match(
/body:has\(#world-timeline\) \{\s*--world-timeline-lift: (\d+)px;/,
);
const height = read('./styles/world-timeline.css').match(
/#world-timeline \{[^}]*\n {2}height: (\d+)px;/,
);
assert.ok(lift && height && Number(lift[1]) > Number(height[1]));
const corners = css.match(
/&:has\(#world-timeline\) \{\s*--omnibar-coordinates-bottom: max\(\s*calc\(var\(--omnibar-dock-bottom\) \+ (\d+)px \+ (\d+)px \+ (\d+)px\)/,
/--omnibar-coordinates-bottom: max\(\s*calc\(var\(--omnibar-dock-raised\) \+ (\d+)px \+ (\d+)px\)/,
);
assert.ok(timeline && height && corners);
assert.equal(Number(corners[1]), Number(timeline[1]));
assert.equal(Number(corners[2]), Number(height[1]));
assert.ok(Number(corners[3]) >= 6);
assert.ok(corners);
assert.equal(Number(corners[1]), 56);
assert.ok(Number(corners[2]) >= 6);
});
+1 -1
View File
@@ -53,7 +53,7 @@ test('the divider renders on the body with its labels and slider', async (t) =>
assert.equal(after.title, 'After');
assert.equal(handle.tagName, 'BUTTON');
assert.equal(handle.type, 'button');
assert.equal(handle.className, 'split-handle');
assert.ok(handle.classList.contains('split-handle'));
assert.equal(handle.textContent, '↔');
assert.equal(handle.getAttribute('role'), 'slider');
assert.equal(handle.getAttribute('aria-label'), 'Divider');
+119
View File
@@ -0,0 +1,119 @@
// The Bhote Koshi event's controls are the kit's: its reconstruction panel
// hand-writes no <button> and no Material Symbols span, its buttons are ghost
// UiButtons that keep their data-action hooks for bhote-koshi.css and the
// tests, and its cinematic button is a pressed toggle whose state the event
// layer presents as `pressed`, not as an `aria-pressed` it writes. The
// embedded media cards are an SFC rather than markup built in script; they
// hold no control (the original link stays a link), and the script builds
// only what the provider SDKs need: their script and preconnect tags, the
// overlay root, and the Facebook player node it warms and carries into a
// card.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const read = (file) =>
readFileSync(new URL(`../../${file}`, import.meta.url), 'utf8');
/** The template block: everything outside script, style and comments. */
const template = (file) =>
read(file)
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
// An opening tag's attributes, quoted values may hold `>` (`() => x`).
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tags = (markup, name) =>
markup.match(new RegExp(String.raw`<${name}\b${ATTRS}>`, 'g')) ?? [];
// An attribute's name, outside the quoted values.
const names = (attrs) => attrs.replace(/"[^"]*"|'[^']*'/g, '""');
const PANEL = 'ui/views/panels/BhoteKoshiPanel.vue';
const CARDS = 'ui/bhoteKoshi/BhoteKoshiMediaCards.vue';
// Per file: its UiButtons, UiCloseButtons, UiSliders and UiIcons.
const SURFACES = {
// Previous and next beat, Play, Play scene, Cinematic, Full story, Open
// original, Lower gorge, a field report (one tag, one per report) and Open
// public map; Close; the split and progress sliders.
[PANEL]: [10, 1, 2, 0],
// The media cards: a frame, a leader, a footer and the original link.
[CARDS]: [0, 0, 0, 0],
};
test('the Bhote Koshi views hand-write no button; each is a kit button', () => {
for (const [file, [buttons, closes, sliders]] of Object.entries(SURFACES)) {
const markup = template(file);
assert.deepEqual(markup.match(/<button\b/gi) ?? [], [], file);
assert.deepEqual(markup.match(/<(select|input)\b/gi) ?? [], [], file);
assert.equal(tags(markup, 'UiButton').length, buttons, file);
assert.equal(tags(markup, 'UiCloseButton').length, closes, file);
assert.equal(tags(markup, 'UiSlider').length, sliders, file);
}
});
test('the Bhote Koshi views hand-write no Material glyph', () => {
for (const [file, [, , , icons]] of Object.entries(SURFACES)) {
const markup = template(file);
assert.deepEqual(markup.match(/material-symbols/g) ?? [], [], file);
const found = tags(markup, 'UiIcon');
assert.equal(found.length, icons, file);
for (const icon of found) assert.match(icon, /\s:size="null"/, file);
}
});
test('the cinematic button takes the kit pressed state', () => {
for (const file of Object.keys(SURFACES))
for (const [tag, attrs] of template(file).matchAll(
new RegExp(String.raw`<[A-Za-z][\w-]*\b(${ATTRS})>`, 'g'),
)) {
assert.doesNotMatch(
names(attrs),
/(?:^|\s)(?::|v-bind:)?aria-pressed(?=[\s=/]|$)/,
tag,
);
assert.doesNotMatch(
attrs,
/(?:^|\s)(?:v-bind|:)=(?:"[^"]*aria-?pressed[^"]*"|'[^']*aria-?pressed[^']*')/i,
tag,
);
}
const pressed = tags(template(PANEL), 'UiButton').filter((tag) =>
/\s:pressed=/.test(tag),
);
assert.equal(pressed.length, 1);
assert.match(
pressed[0],
/^<UiButton data-action="cinematic" :pressed="Boolean\(panel\.refs\.cinematicButton\.pressed\)"/,
);
// bhote-koshi.css styles the pressed button by its aria-pressed.
assert.doesNotMatch(pressed[0], /pressed-class/);
// The layer presents the state; it writes no aria-pressed of its own.
const layer = read('data/bhoteKoshiEvent.js');
assert.doesNotMatch(layer, /aria-pressed/);
assert.match(
layer,
/setElementProperty\(button, 'pressed', _cinematicActive\)/,
);
});
test('the media cards are drawn by their view, not built in script', () => {
const source = read('data/bhoteKoshiEmbeddedMedia.js');
assert.doesNotMatch(source, /innerHTML|insertAdjacentHTML|createElementNS/);
// Provider scripts and preconnects, the overlay root, and the Facebook
// embed node and its warm host. The YouTube API's script is youtubeApi.js's.
assert.deepEqual(
[...source.matchAll(/createElement\('(\w+)'\)/g)].map((m) => m[1]),
['script', 'script', 'link', 'div', 'div', 'div'],
);
assert.match(source, /renderVue\(\s*h\(BhoteKoshiMediaCards,/);
const cards = template(CARDS);
const opening = (name, attribute) =>
new RegExp(String.raw`<${name}\b${ATTRS}\s${attribute}${ATTRS}>`);
for (const part of [
opening('iframe', 'class="bhote-embedded-media-warmup"'),
opening('section', 'class="bhote-embedded-callout"'),
opening('svg', 'class="bhote-embedded-callout-leader"'),
opening('div', 'class="bhote-embedded-callout-body" data-overlay-input'),
opening('small', 'role="status"'),
opening('a', 'target="_blank" rel="noopener noreferrer"'),
])
assert.match(cards, part);
});
+150
View File
@@ -0,0 +1,150 @@
// The AI chat panel's and the voice control's buttons and Material glyphs
// are the kit's: neither their templates nor the voice card and panel
// layout buttons they render hand-write a <button> or a Material Symbols
// span. Their other glyphs (the chat bubble, the globe, attach, send and
// stop, expand and the two Back chevrons) are inline SVG drawn with their own
// strokes, which no Material symbol the page loads draws the same, so they
// stay SVG. The voice panel's Preview and Settings are tabs (`role="tab"`
// with `aria-selected`), not pressed toggles, and DISMISS is a text button,
// not a cross, so it is a UiButton rather than a UiCloseButton. The chat's
// message box, file picker and the minutes field stay native: the kit has
// no text area, file or number field. The voice modules build no controls
// in script.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync, readdirSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
/** A view's template block: everything outside script, style and comments. */
function template(file) {
const source = readFileSync(
new URL(`../views/panels/${file}`, import.meta.url),
'utf8',
);
return source
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
}
// A tag's attributes, read past quoted values so a handler's `=>` does not
// end the tag early.
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tag = (pattern, flags = '') =>
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
const tags = (markup, name) =>
markup.match(tag(String.raw`<${name}\bATTRS>`, 'g')) ?? [];
const views = {
// Settings, the quick prompts, an attachment's remove, Attach layer,
// Attach a file, Expand conversation, the command suggestions, Expand
// chat, Add attachment and Send / Stop reply.
'ChatPanel.vue': {
UiButton: 10,
UiCloseButton: 1,
UiIcon: 1,
UiSelect: 1,
svgs: 5,
},
// The tier button (dock and panel), the mic, Open AI chat, Back to chat,
// Back to voice, the Preview and Settings tabs and DISMISS.
'VoiceControl.vue': {
UiButton: 9,
UiCloseButton: 1,
UiIcon: 2,
UiSelect: 3,
UiCheckbox: 2,
svgs: 3,
},
'VoiceCard.vue': { UiButton: 0, UiCloseButton: 1, UiIcon: 0, svgs: 0 },
// Dock and minimize.
'PanelLayoutButtons.vue': { UiButton: 2, UiIcon: 0, svgs: 2 },
'VoiceVisualizer.vue': { UiButton: 0, UiIcon: 0, svgs: 1 },
};
const markup = Object.fromEntries(
Object.keys(views).map((file) => [file, template(file)]),
);
test('the chat and voice views hand-write no button; each is the kit', () => {
for (const [file, counts] of Object.entries(views)) {
assert.deepEqual(markup[file].match(/<button\b/gi) ?? [], [], file);
for (const name of ['UiButton', 'UiCloseButton', 'UiSelect', 'UiCheckbox'])
assert.equal(tags(markup[file], name).length, counts[name] ?? 0, file);
}
});
test('the pressed toggles take the kit pressed state', () => {
for (const [file, view] of Object.entries(markup))
assert.doesNotMatch(view, /aria-pressed/, file);
const voice = tags(markup['VoiceControl.vue'], 'UiButton');
const tiers = voice.filter((button) => /id="gev-voice-tier"/.test(button));
assert.equal(tiers.length, 2);
for (const tier of tiers)
assert.match(tier, /\s:pressed="Boolean\(view\.tier\.pressed\)"/);
// The mic writes no aria-pressed while its owner has no state for it.
assert.match(
markup['VoiceControl.vue'],
tag(
String.raw`<UiButton\s+id="gev-voice-button"ATTRS\s:pressed="view\.button\.pressed \?\? undefined"`,
),
);
assert.match(
markup['PanelLayoutButtons.vue'],
tag(
String.raw`<UiButton\s+data-layout-dockATTRS\s:pressed="props\.docked"`,
),
);
// The panel tabs are tabs: selected, never pressed.
const tabs = voice.filter((button) => /role="tab"/.test(button));
assert.equal(tabs.length, 2);
for (const button of tabs) {
assert.match(button, /\s:aria-selected="/);
assert.doesNotMatch(button, /\s:pressed=/);
}
});
test('the views hand-write no Material glyph; each is a UiIcon the site sizes', () => {
for (const [file, { UiIcon, svgs }] of Object.entries(views)) {
assert.deepEqual(markup[file].match(/material-symbols/g) ?? [], [], file);
const icons = tags(markup[file], 'UiIcon');
assert.equal(icons.length, UiIcon, file);
// Without it the kit writes an 18px size that beats voice-cost.css and
// voice-card.css.
for (const icon of icons) assert.match(icon, /\s:size="null"/, file);
assert.equal(markup[file].match(/<svg\b/g)?.length ?? 0, svgs, file);
}
assert.match(
markup['ChatPanel.vue'],
/<UiIcon name="settings" class="gev-voice-settings-icon" :size="null" \/>/,
);
assert.equal(
markup['VoiceControl.vue'].match(
/<UiIcon name="(?:visibility|settings)" class="gev-voice-panel-tab-icon" :size="null" \/>/g,
)?.length,
2,
);
});
test('the only native fields left are the message box, file picker and minutes', () => {
const inputs = Object.values(markup).flatMap((view) => tags(view, 'input'));
assert.equal(inputs.length, 2);
assert.match(inputs[0], /id="gev-chat-file" type="file"/);
assert.match(inputs[1], /id="gev-voice-timeout-input" type="number"/);
assert.equal(tags(markup['ChatPanel.vue'], 'textarea').length, 1);
for (const view of Object.values(markup)) {
assert.deepEqual(view.match(/<select\b/gi) ?? [], []);
assert.doesNotMatch(view, /type="(?:checkbox|range)"/);
}
});
test('the voice modules build no buttons or Material glyphs in script', () => {
const root = fileURLToPath(new URL('../../voice/', import.meta.url));
const modules = readdirSync(root, { recursive: true })
.filter((file) => file.endsWith('.js') && !/test|Harness/.test(file))
.map((file) => path.join(root, file));
assert.ok(modules.length > 50);
for (const file of modules) {
const source = readFileSync(file, 'utf8');
assert.doesNotMatch(source, /createElement\(\s*['"]button/, file);
assert.doesNotMatch(source, /<button\b|material-symbols/, file);
}
});
+9 -3
View File
@@ -1,6 +1,7 @@
// Every close, dismiss and clear button in a Vue view is a UiCloseButton: no
// SFC template hand-writes a button whose only content is × or the Material
// `close` symbol. Buttons built in script are not read here.
// SFC template hand-writes a button whose only content is × (bare or in a
// span) or the Material `close` symbol. Buttons built in script are not read
// here.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync, readdirSync } from 'node:fs';
@@ -30,8 +31,10 @@ function template(source) {
// An opening tag's attributes, quoted values may hold `>` (`() => x`).
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const BUTTON = String.raw`(button|UiButton)`;
const TIMES = String.raw`×|&times;|&#215;|&#xd7;`;
const CLOSE_GLYPH = [
String.raw`×|&times;|&#215;|&#xd7;`,
TIMES,
String.raw`<span\b${ATTRS}>\s*(?:${TIMES})\s*</span\s*>`,
String.raw`<span\b[^>]*\bmaterial-symbols-outlined\b[^>]*>\s*close\s*</span\s*>`,
String.raw`<UiIcon${ATTRS}\bname="close"${ATTRS}/>`,
].join('|');
@@ -54,11 +57,14 @@ test('the scan finds each hand-written close glyph', () => {
'<template><UiButton class="x" :label="l">&times;</UiButton></template>',
'<template><button type="button" class="x">\n <span class="material-symbols-outlined" aria-hidden="true">close</span>\n</button></template>',
'<template><UiButton class="x"><UiIcon name="close" :size="14" /></UiButton></template>',
'<template><button type="button" :aria-label="l"><span aria-hidden="true">×</span></button></template>',
'<template><UiButton class="x">\n <span class="glyph">&times;</span>\n</UiButton></template>',
])
assert.equal(handWrittenCloses(markup).length, 1, markup);
for (const markup of [
'<template><UiCloseButton class="x" :label="l" /></template>',
'<template><button type="button">{{ name }} ×</button></template>',
'<template><button type="button"><span>{{ name }}</span> ×</button></template>',
'<template><button type="button">On<span class="material-symbols-outlined">close</span></button></template>',
'<template><button type="button"><span class="material-symbols-outlined">close_fullscreen</span></button></template>',
])
+148
View File
@@ -0,0 +1,148 @@
// The Cockpit HUD's controls and glyphs are the kit's: no Cockpit view
// hand-writes a <button>, a Material Symbols span, a select, a checkbox or a
// range. Its buttons are ghost UiButtons that keep their ids, classes and
// labels for the Cockpit controller's listeners and the cockpit stylesheets;
// its glyphs are UiIcons with `:size="null"`, so those stylesheets still size
// them. The utility strip's −, ◀ ▶ and transport glyphs and the orbital
// zoom's − and + are text characters, not Material symbols, and stay text.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readdirSync, readFileSync } from 'node:fs';
/** A view's template block: everything outside script, style and comments. */
function template(file) {
const source = readFileSync(
new URL(`../views/${file}`, import.meta.url),
'utf8',
);
return source
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
}
const views = {
// The vision selector's Previous, Current and Next, Look ahead, and the
// view switcher's Reset and Exit; the speed and altitude rims' pointers,
// the two vision chevrons, the reticle, the heading caret and the view
// switcher's two glyphs.
'CockpitView.vue': { buttons: 6, icons: 8 },
// Display's and Radio's collapse and launcher buttons, Radio's Enable,
// Previous, Play and Next, and the desktop rail's two items and glyphs.
'panels/CockpitUtilityControls.vue': { buttons: 10, icons: 2 },
// Previous, Next, Auto, the card's collapse and the four page tabs (LIVE
// shows only with a stream); the first, second and fourth draw a glyph.
'panels/CockpitBriefing.vue': { buttons: 8, icons: 3 },
// Previous, Next, the card's collapse and Weather; three of them draw a
// glyph, and the nearest contact's arrow is the fourth.
'panels/CockpitContext.vue': { buttons: 4, icons: 4 },
// A signal row's target and its chevron.
'panels/CockpitSignalList.vue': { buttons: 1, icons: 1 },
// TLE, Nadir, Zoom out, Zoom in and Sensor.
'panels/CockpitOrbital.vue': { buttons: 5, icons: 0 },
// The range step.
'panels/CockpitRadar.vue': { buttons: 1, icons: 0 },
// The flight plan's arrow.
'panels/CockpitRoute.vue': { buttons: 0, icons: 1 },
// Readouts only.
'panels/CockpitProgress.vue': { buttons: 0, icons: 0 },
'panels/CockpitRollingValue.vue': { buttons: 0, icons: 0 },
};
// A tag's attributes, read past quoted values so a handler's `=>` does not
// end the tag early.
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tag = (pattern, flags = '') =>
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
const markup = Object.fromEntries(
Object.keys(views).map((file) => [file, template(file)]),
);
test('every Cockpit view is in the list above', () => {
const dir = (sub) =>
readdirSync(new URL(`../views/${sub}`, import.meta.url))
.filter((name) => /^Cockpit.*\.vue$/.test(name))
.map((name) => sub + name);
assert.deepEqual(
[...dir(''), ...dir('panels/')].sort(),
Object.keys(views).sort(),
);
});
test('the Cockpit views hand-write no button; each is a UiButton', () => {
for (const [file, { buttons }] of Object.entries(views)) {
assert.deepEqual(markup[file].match(/<button\b/gi) ?? [], [], file);
assert.equal(
markup[file].match(/<UiButton\b/g)?.length ?? 0,
buttons,
file,
);
}
});
test('the Cockpit views hand-write no select, checkbox or range', () => {
for (const [file, view] of Object.entries(markup)) {
assert.deepEqual(view.match(/<(select|input)\b/gi) ?? [], [], file);
}
// The compact Radio volume.
assert.equal(
markup['panels/CockpitUtilityControls.vue'].match(/<UiSlider\b/g)?.length,
1,
);
});
test('the pressed toggles take the kit pressed state', () => {
for (const view of Object.values(markup))
assert.doesNotMatch(view, tag(String.raw`<\w+\bATTRS\s:?aria-pressed`));
const pressed = Object.values(markup).flatMap(
(view) =>
view.match(tag(String.raw`<UiButton\bATTRS\s:pressed=ATTRS>`, 'g')) ?? [],
);
// Radio's Enable, the briefing's Auto and the Contact card's Weather.
assert.equal(pressed.length, 3);
for (const button of pressed) assert.match(button, /:pressed="Boolean\(/);
assert.match(
markup['panels/CockpitUtilityControls.vue'],
tag(
String.raw`<UiButton\s+id="cockpit-radio-enable-btn"ATTRS\s:pressed="Boolean\(cockpit\?\.enable\.active\)" pressed-class="active"`,
),
);
assert.match(
markup['panels/CockpitBriefing.vue'],
tag(
String.raw`<UiButton\s+id="cockpit-brief-auto"ATTRS\s:pressed="Boolean\(b\.autoRotate\)"`,
),
);
assert.match(
markup['panels/CockpitContext.vue'],
tag(
String.raw`<UiButton\s+id="cockpit-weather-toggle"ATTRS\s:pressed="Boolean\(c\.weather\)"`,
),
);
});
test('the Cockpit views hand-write no Material glyph; each is a UiIcon', () => {
for (const [file, { icons }] of Object.entries(views)) {
assert.deepEqual(
markup[file].match(/material-symbols-outlined/g) ?? [],
[],
file,
);
const found =
markup[file].match(tag(String.raw`<UiIcon\bATTRS>`, 'g')) ?? [];
assert.equal(found.length, icons, file);
// Without it the kit writes an 18px size that beats the cockpit's rules.
for (const icon of found) assert.match(icon, /\s:size="null"/, file);
}
});
test('the heading caret outranks the kit icon rule that loads after it', () => {
const css = readFileSync(
new URL('../styles/cockpit.css', import.meta.url),
'utf8',
);
// kit.css's `.ui-icon` sets display and line-height with one class and
// loads after cockpit.css, so a one-class caret rule would lose to it.
assert.match(
css,
/\n\.cockpit-compass \.cockpit-heading-caret \{\n {2}display: block;/,
);
assert.doesNotMatch(css, /\n\.cockpit-heading-caret \{/);
});
+127
View File
@@ -0,0 +1,127 @@
// The command dock's and the Context panel's buttons and Material glyphs are
// the kit's: neither the dock, the Context view nor the view context it
// shows while nothing is picked hand-writes a <button> or a Material Symbols
// span. The dock's style buttons are pressed toggles with `active`, its
// glyphs (◯ ▦ 🌙 🌡️ ✦ ◐, the search 🔎 and the collapse +) are text
// characters, not Material symbols, and stay plain text. Context's tabs and
// its Contacts mode button are `role="tab"` controls: they say they are
// chosen with `aria-selected` and keep their own `active` class, never
// `aria-pressed`.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
/** A view's template block: everything outside script, style and comments. */
function template(file) {
const source = readFileSync(
new URL(`../views/${file}`, import.meta.url),
'utf8',
);
return source
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
}
// A tag's attributes, read past quoted values so a handler's `=>` does not
// end the tag early.
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tag = (pattern, flags = '') =>
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
const tags = (markup, name) =>
markup.match(tag(String.raw`<${name}\bATTRS>`, 'g')) ?? [];
const dock = template('CommandDockView.vue');
const context = template('ContextView.vue');
const inView = template('panels/ViewContext.vue');
const views = {
// The six style buttons, the two tray toggles and their pins, the map
// source chips, Location's collapse, its landmark and city pills and the
// search toggle.
'CommandDockView.vue': { markup: dock, buttons: 15, icons: 0, closes: 0 },
// Search and Expand in the header, the two tabs, Contacts, the cockpit
// entry, SEARCH NEARBY SITES and the TR-3B chip.
'ContextView.vue': { markup: context, buttons: 8, icons: 7, closes: 0 },
// An off layer's worldwide tile, an item's row, the place and layer chips
// and Ask GEV; a layer's Turn off is a UiCloseButton. The glyphs: the
// header's eye, a worldwide tile's (on and off), a layer group's, an
// item's motion and the layer chips' add.
'panels/ViewContext.vue': { markup: inView, buttons: 5, icons: 6, closes: 1 },
};
test('the dock and Context hand-write no button; each is a UiButton', () => {
for (const [file, { markup, buttons, closes }] of Object.entries(views)) {
assert.deepEqual(markup.match(/<button\b/gi) ?? [], [], file);
assert.deepEqual(markup.match(/<component\b/gi) ?? [], [], file);
assert.equal(tags(markup, 'UiButton').length, buttons, file);
assert.equal(tags(markup, 'UiCloseButton').length, closes, file);
}
});
test('the style buttons are pressed toggles with active', () => {
assert.doesNotMatch(dock, /v-class-toggle="\{[^"]*\bactive\b/);
const styles = tags(dock, 'UiButton').filter((b) =>
/class="style-btn"/.test(b),
);
assert.deepEqual(
styles.map((b) => b.match(/data-style="(\w+)"/)[1]),
['normal', 'retro', 'surveillance', 'thermal', 'anime', 'noir'],
);
for (const button of styles) {
const name = button.match(/data-style="(\w+)"/)[1];
assert.match(button, /\spressed-class="active"/, name);
// Normal stays the pressed one until a style is published.
assert.match(
button,
name === 'normal'
? /\s:pressed="!style \|\| style\.name === 'normal'"/
: new RegExp(String.raw`\s:pressed="style\?\.name === '${name}'"`),
name,
);
}
});
test('no tag hand-writes aria-pressed; the pressed toggles take :pressed', () => {
for (const [file, { markup }] of Object.entries(views))
assert.doesNotMatch(
markup,
tag(String.raw`<\w+\bATTRS\s:?aria-pressed`),
file,
);
const pressed = (markup) =>
tags(markup, 'UiButton').filter((b) => /\s:pressed=/.test(b)).length;
// The six styles, two pins, map sources, landmarks and cities.
assert.equal(pressed(dock), 11);
// Search, Expand and TR-3B.
assert.equal(pressed(context), 3);
assert.equal(pressed(inView), 0);
});
test("Context's tabs say they are chosen, not pressed", () => {
const tabs = tags(context, 'UiButton').filter((b) => /\srole="tab"/.test(b));
assert.equal(tabs.length, 3);
for (const button of tabs) {
assert.match(button, /\s:aria-selected=/);
assert.doesNotMatch(button, /\s:pressed=/);
assert.match(button, /\s(?::class|v-class-toggle)="\{ active: /);
}
});
test('they hand-write no Material glyph; each is a UiIcon', () => {
for (const [file, { markup, icons }] of Object.entries(views)) {
assert.deepEqual(
markup.match(/material-symbols-outlined/g) ?? [],
[],
file,
);
const found = tags(markup, 'UiIcon');
assert.equal(found.length, icons, file);
// Without it the kit writes an 18px size that beats the site rules.
for (const icon of found) assert.match(icon, /\s:size="null"/, file);
}
// An item's motion glyph is an image with its own name, not decoration.
const [motion] = tags(inView, 'UiIcon').filter((i) =>
/view-context__row-motion/.test(i),
);
assert.match(motion, /\srole="img"/);
assert.match(motion, /\s:aria-label=/);
assert.match(motion, /\s:aria-hidden="null"/);
});
+3 -2
View File
@@ -1,7 +1,8 @@
// Every modal dialog in a Vue view is a UiDialog: no SFC template hand-writes
// `<dialog>`. Panels drawn as `role="dialog"` (key setup, the welcome
// launcher, the CCTV popup, Story Explore's filter) and the render failure's
// `alertdialog` are other controls.
// launcher, the CCTV popup, Story Explore's filter, the credits, the Omnibar
// guide's callout) and the render failure's `alertdialog` are other
// controls.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync, readdirSync } from 'node:fs';
+126
View File
@@ -0,0 +1,126 @@
// UTILITIES ▸ Draw (its toggle, Clear, the colour swatches and the drawn
// shapes' rows), Import and the Street Level panel are on the kit: none of
// them hand-writes a <button>, a Material Symbols span, a select, a checkbox
// or a range. The Draw toggle is a pressed toggle with `active`. The colour
// swatches are `role="radio"` buttons: they say they are chosen with
// `aria-checked` and their own `active` class, never `aria-pressed`. A drawn
// shape's show/hide renames itself (Show …, Hide …) rather than being pressed.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const source = (file) =>
readFileSync(new URL(`../views/panels/${file}`, import.meta.url), 'utf8');
/** A view's template block: everything outside script, style and comments. */
const template = (file) =>
source(file)
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
// A tag's attributes, read past quoted values so a handler's `=>` does not
// end the tag early.
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tag = (pattern, flags = '') =>
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
const tags = (markup, name) =>
markup.match(tag(String.raw`<${name}\bATTRS>`, 'g')) ?? [];
const views = {
// Draw and Clear.
'DrawControls.vue': { buttons: 2, icons: 1, closes: 0 },
// The five colours, one v-for.
'DrawSwatches.vue': { buttons: 1, icons: 0, closes: 0 },
// A row's swatch, show/hide, the application's actions and fly to; remove
// is a UiCloseButton.
'DrawMarkList.vue': { buttons: 4, icons: 3, closes: 1 },
// Import and a file's row actions.
'GeoImport.vue': { buttons: 2, icons: 2, closes: 0 },
// The status toggle, EXPAND and the nearest-imagery button; the viewer's
// close. EXPAND's ⤢ ⤡ and the errors' ⚠ are text, not Material symbols.
'StreetLevelPanel.vue': { buttons: 3, icons: 0, closes: 1 },
};
const markup = Object.fromEntries(
Object.keys(views).map((file) => [file, template(file)]),
);
test('the Draw, Import and Street Level views hand-write no button', () => {
for (const [file, { buttons, closes }] of Object.entries(views)) {
const html = markup[file];
assert.deepEqual(html.match(/<button\b/gi) ?? [], [], file);
assert.deepEqual(html.match(/<component\b/gi) ?? [], [], file);
assert.equal(tags(html, 'UiButton').length, buttons, file);
assert.equal(tags(html, 'UiCloseButton').length, closes, file);
}
});
test('they hand-write no select, checkbox or range', () => {
for (const [file, html] of Object.entries(markup)) {
assert.deepEqual(html.match(/<select\b/gi) ?? [], [], file);
assert.doesNotMatch(
html,
tag(String.raw`<input\bATTRS\stype="(?:checkbox|range)"`),
file,
);
}
// SINCE is the kit's range.
assert.equal(tags(markup['StreetLevelPanel.vue'], 'UiSlider').length, 1);
});
test('they hand-write no Material glyph; each is a UiIcon sized by the site', () => {
for (const [file, { icons }] of Object.entries(views)) {
const html = markup[file];
assert.deepEqual(html.match(/material-symbols-outlined/g) ?? [], [], file);
const found = tags(html, 'UiIcon');
assert.equal(found.length, icons, file);
// Without it the kit writes an 18px size that beats the site rules.
for (const icon of found) assert.match(icon, /\s:size="null"/, file);
}
// Draw's and Import's glyphs keep pp-icon, which sizes them.
for (const file of ['DrawControls.vue', 'GeoImport.vue']) {
const [icon] = tags(markup[file], 'UiIcon');
assert.match(icon, /\sclass="pp-icon"/, file);
}
});
test('no tag hand-writes aria-pressed; Draw is a pressed toggle with active', () => {
for (const [file, html] of Object.entries(markup))
assert.doesNotMatch(
html,
tag(String.raw`<\w+\bATTRS\s:?aria-pressed`),
file,
);
const [draw] = tags(markup['DrawControls.vue'], 'UiButton').filter((b) =>
/\sid="draw-toggle"/.test(b),
);
assert.match(draw, /\s:pressed="draw\?\.active \?\? false"/);
assert.match(draw, /\spressed-class="active"/);
const [clear] = tags(markup['DrawControls.vue'], 'UiButton').filter((b) =>
/\sid="draw-clear"/.test(b),
);
assert.doesNotMatch(clear, /\s:pressed=/);
// A shape's show/hide says what it does in its name, not by being pressed.
for (const button of tags(markup['DrawMarkList.vue'], 'UiButton'))
assert.doesNotMatch(button, /\s:pressed=/);
});
test('the colour swatches are radios chosen by aria-checked, never pressed', () => {
const [swatch] = tags(markup['DrawSwatches.vue'], 'UiButton');
assert.match(swatch, /\srole="radio"/);
assert.match(
swatch,
/\s:aria-checked="String\(color === props\.modelValue\)"/,
);
assert.match(swatch, /\s:class="\{ active: color === props\.modelValue \}"/);
assert.doesNotMatch(swatch, /\s:pressed=|\spressed-class=/);
});
test('code that focuses a converted button reaches its element', () => {
// A template ref on a component holds the component, not the button.
assert.match(
source('DrawSwatches.vue'),
/:ref="\(swatch\) => \(buttons\[index\] = swatch\?\.\$el\)"/,
);
assert.match(
source('GeoImport.vue'),
/importButton\.value\?\.\$el\.focus\(\)/,
);
});
+7 -6
View File
@@ -31,9 +31,9 @@ const heroViews = [
test('the entity card hand-writes no button; each is a UiButton', () => {
for (const markup of [card, camera, nearby, ...heroViews])
assert.deepEqual(markup.match(/<button\b/gi) ?? [], []);
// Photos, Route, 3D, Cockpit view, the cockpit entry, Fly to, Follow and
// Ask GEV.
assert.equal(card.match(/<UiButton\b/g)?.length, 8);
// Photos, Route, 3D, Cockpit view, Find it, the cockpit entry, Fly to,
// Follow and Ask GEV.
assert.equal(card.match(/<UiButton\b/g)?.length, 9);
assert.equal(card.match(/<UiCloseButton\b/g)?.length, 1);
// A camera's bigger view and More info; its popup closes with a UiCloseButton.
assert.equal(camera.match(/<UiButton\b/g)?.length, 2);
@@ -59,9 +59,10 @@ test('the entity card hand-writes no Material glyph; each is a UiIcon', () => {
for (const markup of [card, camera, nearby, ...heroViews])
assert.deepEqual(markup.match(/material-symbols-outlined/g) ?? [], []);
const counts = [
// The preview switch's three, the hero glyph, the header icon, the
// warning, the route's plane, the route note and the three actions.
[card, 11],
// The preview switch's three, the hero glyph, the header icon, Find
// it, the warning, the route's plane, the route note and the three
// actions.
[card, 12],
// Bigger view, the popup's camera and More info.
[camera, 3],
// The two weather glyphs, five headings and three row glyphs.
+142
View File
@@ -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);
}
});
+135
View File
@@ -0,0 +1,135 @@
// The small surfaces' buttons and Material glyphs are the kit's: the locale
// picker, the phone tab bar, the globe actions and compass, the imagery
// divider, the scene sharing dialog, the layer group index, the celestial
// ring, the title logo, Exit clean view, the HUD's cockpit entry, the News
// cards, the rail cards, the layer rows' toggles, the credits line and the
// camera calibration chips hand-write no <button> and no Material Symbols
// span. The Omnibar guide's extra rings are its template's, not built in
// script. The locale picker's globe, caret and check and a News card's
// category icon stay inline SVG: none is a Material symbol the page loads.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const read = (file) =>
readFileSync(new URL(`../${file}`, import.meta.url), 'utf8');
/** The template block: everything outside script, style and comments. */
const template = (file) =>
read(file)
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
// An opening tag's attributes, quoted values may hold `>` (`() => x`).
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tags = (markup, name) =>
markup.match(new RegExp(String.raw`<${name}\b${ATTRS}>`, 'g')) ?? [];
// Per file: its UiButtons, UiCloseButtons and UiIcons.
const SURFACES = {
'views/panels/LocalePicker.vue': [1, 0, 0],
'views/panels/PhoneTabBar.vue': [1, 0, 1],
'views/panels/GlobeCompass.vue': [1, 0, 1],
// Clear, share, tilt and reset; the clear, tilt and reset glyphs.
'views/panels/GlobeActions.vue': [4, 0, 3],
'views/panels/ImagerySplitView.vue': [1, 0, 0],
// The body's buttons and the footer's.
'views/panels/SceneDialog.vue': [2, 0, 0],
'views/panels/LayerSectionIndex.vue': [1, 0, 0],
// The sun and moon markers.
'views/panels/CelestialRing.vue': [0, 0, 2],
'views/panels/OmnibarGuide.vue': [3, 1, 0],
// The overlay targets' buttons and the title logo.
'views/SceneChromeView.vue': [2, 0, 0],
'views/DisplayControlsView.vue': [1, 0, 0],
'views/IntelHudView.vue': [1, 0, 1],
// The card's face and the selected card's clear chip.
'news/NewsCard.vue': [2, 0, 0],
'rail/RailCard.vue': [1, 0, 0],
'layerPanel/LayerRows.vue': [1, 0, 0],
'credits/CreditsView.vue': [1, 1, 0],
'cctv/CctvCalValue.vue': [1, 0, 0],
};
test('the small surfaces hand-write no button; each is a kit button', () => {
for (const [file, [buttons, closes]] of Object.entries(SURFACES)) {
const markup = template(file);
assert.deepEqual(markup.match(/<button\b/gi) ?? [], [], file);
assert.equal(tags(markup, 'UiButton').length, buttons, file);
assert.equal(tags(markup, 'UiCloseButton').length, closes, file);
}
});
test('the small surfaces hand-write no Material glyph; each is a UiIcon', () => {
for (const [file, [, , count]] of Object.entries(SURFACES)) {
const markup = template(file);
assert.deepEqual(
markup.match(/material-symbols-outlined/g) ?? [],
[],
file,
);
const icons = tags(markup, 'UiIcon');
assert.equal(icons.length, count, file);
// Without it the kit writes an 18px size that beats the sites' own rules.
for (const icon of icons) assert.match(icon, /\s:size="null"/, file);
}
});
test('the only inline SVG glyphs are the locale picker’s and a News category’s', () => {
for (const file of Object.keys(SURFACES)) {
const expected =
file === 'views/panels/LocalePicker.vue'
? 3
: file === 'news/NewsCard.vue'
? 1
: 0;
assert.equal(template(file).match(/<svg\b/g)?.length ?? 0, expected, file);
}
});
test('buttons whose owner patches synchronously redraw their contents with it', () => {
// A UiButton's slot renders inside the button, a tick after a change the
// button's own attributes do not carry; a conditional slot is redrawn with
// its view.
// How many of each file's first buttons the owner redraws and reads.
for (const [file, count] of [
['news/NewsCard.vue', 1],
['rail/RailCard.vue', 1],
['credits/CreditsView.vue', 1],
['views/panels/OmnibarGuide.vue', 3],
]) {
const markup = template(file);
const buttons = tags(markup, 'UiButton').slice(0, count);
assert.equal(buttons.length, count, file);
let from = 0;
for (const button of buttons) {
from = markup.indexOf(button, from) + button.length;
assert.match(
markup.slice(from),
/^\s*<template v-if="redrawWithView" #default\s*>/,
file,
);
}
assert.match(read(file), /const redrawWithView = true;/, file);
}
});
test('the Omnibar guide draws its extra rings in its template', () => {
const guide = template('views/panels/OmnibarGuide.vue');
assert.match(
guide,
/<div\s+v-for="i in view\.subRings"\s+:key="i"\s+class="gev-guide-ring gev-guide-ring--sub"\s*><\/div\s*>\s*<\/div\s*>\s*<\/Teleport/,
);
const owner = read('omnibarGuide.js');
assert.deepEqual(owner.match(/createElement\(/g), ['createElement(']);
assert.doesNotMatch(owner, /\.className\s*=|\.append\(/);
assert.match(owner, /view\.subRings = rest\.length;\s*paint\(\);/);
});
test('the layer disclosure builds no control', () => {
// Its one `<button` is a comment's word for the element Chromium focuses.
const disclosure = read('panelDisclosure.js');
assert.doesNotMatch(disclosure, /createElement|innerHTML|insertAdjacentHTML/);
const code = disclosure
.replace(/\/\/.*$/gm, '')
.replace(/\/\*[\s\S]*?\*\//g, '');
assert.doesNotMatch(code, /<button/);
});
+6 -5
View File
@@ -3,11 +3,12 @@
// `<input type="checkbox">`. Their glyphs are inline SVG drawn for Stories
// (play, pause, back, filter, search, clear, expand, the GEV eye); no
// Material symbol the page loads draws any of them the same, so they stay
// SVG, and no view hand-writes a Material Symbols span. The two search
// fields keep their own markup rather than UiSearchField, whose Material
// magnifier would replace their SVG one, and their clear buttons stay ghost
// UiButtons with an SVG cross rather than UiCloseButtons, whose glyph is ×
// or the Material `close` symbol.
// SVG, and no view hand-writes a Material Symbols span. The three search
// fields (Explore's two and the Story context sheet's) keep their own markup
// rather than UiSearchField, whose Material magnifier would replace their
// SVG one, and Explore's two clear buttons stay ghost UiButtons with an SVG
// cross rather than UiCloseButtons, whose glyph is × or the Material `close`
// symbol.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
@@ -0,0 +1,182 @@
// The Street Level photo viewer (KartaView, Panoramax) is a view with kit
// controls: StreetLevelPhotoViewer draws what the photo viewer presents and
// hand-writes no <button> and no Material Symbols span; its ‹ › are ghost
// UiButtons, not pressed toggles, whose glyphs are text characters. The
// photo viewer builds no element of its own, and the street-level layer it
// belongs to needs no Vue: the application shell publishes its
// presentation to the store the view renders.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const read = (file) =>
readFileSync(new URL(`../../${file}`, import.meta.url), 'utf8');
/** The template block: everything outside script, style and comments. */
const template = (file) =>
read(file)
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
// An opening tag's attributes, quoted values may hold `>` (`() => x`).
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tags = (markup, name) =>
markup.match(new RegExp(String.raw`<${name}\b${ATTRS}>`, 'g')) ?? [];
// An attribute's name, outside the quoted values.
const names = (attrs) => attrs.replace(/"[^"]*"|'[^']*'/g, '""');
const VIEW = 'ui/views/panels/StreetLevelPhotoViewer.vue';
const VIEWER = 'layers/streetLevel/photoViewer.js';
test('the photo viewer hand-writes no button; ‹ and › are kit buttons', () => {
const markup = template(VIEW);
assert.deepEqual(markup.match(/<button\b/gi) ?? [], [], VIEW);
assert.deepEqual(markup.match(/<(select|input)\b/gi) ?? [], [], VIEW);
const buttons = tags(markup, 'UiButton');
assert.equal(buttons.length, 2);
assert.equal(tags(markup, 'UiCloseButton').length, 0);
// Ghost buttons with the classes street-level.css styles.
for (const [button, side] of [
[buttons[0], 'prev'],
[buttons[1], 'next'],
]) {
assert.doesNotMatch(button, /\svariant=/);
assert.match(
button,
new RegExp(`\\sclass="sl-photo-step sl-photo-step-${side}"`),
);
}
});
test('the photo viewer hand-writes no Material glyph', () => {
const markup = template(VIEW);
assert.deepEqual(markup.match(/material-symbols/g) ?? [], [], VIEW);
assert.equal(tags(markup, 'UiIcon').length, 0);
// ‹ and › are text characters.
assert.match(markup, />‹<\/UiButton\s*>/);
assert.match(markup, />›<\/UiButton\s*>/);
});
test('the step buttons are not pressed toggles', () => {
const markup = template(VIEW);
for (const [tag, attrs] of markup.matchAll(
new RegExp(String.raw`<[A-Za-z][\w-]*\b(${ATTRS})>`, 'g'),
)) {
assert.doesNotMatch(
names(attrs),
/(?:^|\s)(?::|v-bind:)?aria-pressed(?=[\s=/]|$)/,
tag,
);
assert.doesNotMatch(
attrs,
/(?:^|\s)(?:v-bind|:)=(?:"[^"]*aria-?pressed[^"]*"|'[^']*aria-?pressed[^']*')/i,
tag,
);
assert.doesNotMatch(names(attrs), /(?:^|\s)(?::|v-bind:)?pressed\b/, tag);
}
});
/**
* `loadImage`, which downloads through an Image of its own that is never on
* the page: the one place a `.src` is written.
*/
const LOADER = /^export function loadImage\([\s\S]*?^}$/m;
// An assignment, plain or compound (`=`, `+=`, `||=`, `??=`, `**=`…), not
// a comparison or an arrow.
const ASSIGN = String.raw`\s*(?:[-+*/%&|^]|\*\*|<<|>>>?|&&|\|\||\?\?)?=(?![=>])`;
const assigned = (target, flags = '') =>
new RegExp(String.raw`${target}${ASSIGN}`, flags);
// A member or computed member: what a destructuring write must not target.
const MEMBER = /[\w$)\]]\s*(?:\.\s*[\w$]|\[)/;
test('the photo viewer is drawn by its view, and its layer needs no Vue', () => {
const source = read(VIEWER);
const loader = source.match(LOADER)?.[0];
assert.ok(loader, 'loadImage is found');
const rest = source.replace(LOADER, '');
// No element made, inserted, moved, removed or written: the view does
// all of that. (The panorama renderer in panorama.js sizes its canvas's
// drawing buffer, as WebGL drawing does; nothing here does.)
for (const write of [
/createElement/,
/\b(?:inner|outer)HTML\b/,
/insertAdjacent(?:HTML|Element|Text)/,
/\.(?:append|prepend|appendChild|insertBefore|replaceWith|replaceChildren|before|after)\(/,
/\.remove\(\)/,
/\.(?:set|remove|toggle)Attribute(?:NS)?\(/,
/\.(?:classList|className|dataset|style)\b/,
assigned(
String.raw`\.(?:hidden|disabled|textContent|innerText|tabIndex|title|alt)`,
),
assigned(String.raw`\.(?:width|height|ariaLabel|id|value)`),
// Properties written in bulk or by reflection (an Error's own fields
// aside).
/\bObject\.assign\(\s*(?!new Error\()/,
/\bObject\.definePropert(?:y|ies)\(/,
/\bReflect\.(?:set|defineProperty)\(/,
/from 'vue'|\.vue'/,
])
assert.doesNotMatch(source, write);
// No property written through brackets (`picture['src'] = …`,
// `el[name] ||= …`), outside array destructuring declarations.
assert.doesNotMatch(
source.replace(/\b(?:const|let|var)\s*\[/g, ''),
assigned(String.raw`[\w$)\]]\s*\[[^[\]]*\]`),
'a bracket write',
);
// No destructuring write to a property (`[el.src] = …`,
// `({ a: el.id } = …)`); declarations bind names only.
for (const pattern of [
/(?<!\b(?:const|let|var)\s*)\[((?:[^[\]=;]|\[[^[\]=;]*\])*)\]\s*=(?![=>])/g,
/(?<!\b(?:const|let|var)\s*)\{((?:[^{}=;]|\{[^{}=;]*\})*)\}\s*\)?\s*=(?![=>])/g,
])
for (const [write, targets] of source.matchAll(pattern))
assert.doesNotMatch(targets, MEMBER, write);
const SRC = assigned(String.raw`\.src`, 'g');
assert.doesNotMatch(rest, SRC, 'a .src written on the page');
// In loadImage, only on the off-page Image it creates: `image` is bound
// once, to that Image, and never rebound or shadowed.
assert.match(loader, /\bconst image = new Image\(\);/);
assert.equal(
loader.match(/\b(?:const|let|var|function|class)\s+image\b/g)?.length,
1,
'one binding of image',
);
for (const rebinding of [
assigned(String.raw`(?<!\b(?:const|let|var)\s+)(?<![\w$.])image`),
/(?<![\w$.])image\s*=>/,
/\((?:[^()]*[,{[\s(])?image\b[^()]*\)\s*=>/,
/\bfunction\b[^(]*\((?:[^)]*[,{[\s(])?image\b[^)]*\)/,
/\b(?:const|let|var)\s*[{[][^=]*\bimage\b/,
/\bcatch\s*\([^)]*\bimage\b/,
])
assert.doesNotMatch(loader, rebinding, 'image rebound or shadowed');
const writes = loader.match(SRC)?.length ?? 0;
assert.equal(
loader.match(assigned(String.raw`(?<![\w$.)\]])image\.src`, 'g'))?.length ??
0,
writes,
'a .src written on something other than the Image',
);
const markup = template(VIEW);
const opening = (name, attribute) =>
new RegExp(String.raw`<${name}\b${ATTRS}\s${attribute}${ATTRS}>`);
for (const part of [
opening('div', 'class="sl-photo-viewer"'),
opening('img', 'class="sl-photo-flat"'),
opening('canvas', ':key="photo.canvasKey"'),
opening('canvas', 'class="sl-photo-pano"'),
])
assert.match(markup, part);
const groups = JSON.parse(
readFileSync(
new URL('../../../scripts/package-boundaries.json', import.meta.url),
'utf8',
),
);
const layer = groups['street-level-layer'];
assert.ok(layer.modules.includes(`src/${VIEWER}`));
assert.equal(layer.external.includes('vue'), false);
assert.equal(
layer.modules.some((module) => module.endsWith('.vue')),
false,
);
});
+439
View File
@@ -0,0 +1,439 @@
// The kit's every-control claims in docs/VUE-MIGRATION.md, read from every
// SFC outside the kit: every button is a kit button, every select a
// UiSelect, every checkbox a UiCheckbox, every range a UiSlider apart from
// the two named below, and every Material Symbols glyph a UiIcon; every
// pressed toggle is a UiButton with `pressed` (no template hand-writes
// `aria-pressed` on any element, as an attribute or inside a `v-bind`
// object, apart from the exceptions below), and every close, dismiss and
// clear button a UiCloseButton. Outside the kit, no module (nor an SFC's
// script) builds a button, select, field or Material glyph in script, or
// writes one as markup in a string, apart from the globe panel's standalone
// page named below.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync, readdirSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const SRC_ROOT = fileURLToPath(new URL('../../', import.meta.url));
const KIT_ROOT = fileURLToPath(new URL('./', import.meta.url));
const REPO_ROOT = path.resolve(SRC_ROOT, '..');
// The pressed toggles that still hand-write `aria-pressed`, by file: each
// pattern matches exactly one of the file's tags, and no other tag may.
const HAND_WRITTEN_PRESSED = {
// Explore's story cards are `role="button"` elements, not buttons.
'src/ui/views/stories/ExploreScreen.vue': [
/^<div class="card" role="button"/,
],
};
/** Every SFC under src, outside the kit. */
function sfcFiles(directory = SRC_ROOT) {
const files = [];
for (const entry of readdirSync(directory, { withFileTypes: true })) {
const absolute = path.join(directory, entry.name);
if (entry.isDirectory()) {
if (path.relative(KIT_ROOT, absolute) !== '')
files.push(...sfcFiles(absolute));
} else if (entry.isFile() && entry.name.endsWith('.vue'))
files.push(absolute);
}
return files.sort();
}
/** The template block: everything outside script, style and comments. */
function template(source) {
return source
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
}
// An opening tag's attributes, quoted values may hold `>` (`() => x`).
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const RAW_SELECT = /<select\b/gi;
const ANY_TAG = new RegExp(String.raw`<[A-Za-z][\w-]*\b(${ATTRS})>`, 'g');
// An attribute's name, outside the quoted values.
const names = (attrs) => attrs.replace(/"[^"]*"|'[^']*'/g, '""');
const PRESSED = /(?:^|\s)(?::|v-bind:)?aria-pressed(?=[\s=/]|$)/;
// A `v-bind` object that names aria-pressed.
const BOUND_PRESSED =
/(?:^|\s)(?:v-bind|:)=(?:"[^"]*aria-?pressed[^"]*"|'[^']*aria-?pressed[^']*')/i;
const TIMES = String.raw`×|&times;|&#215;|&#xd7;`;
const CLOSE_GLYPH = [
TIMES,
String.raw`<span\b${ATTRS}>\s*(?:${TIMES})\s*</span\s*>`,
String.raw`<span\b[^>]*\bmaterial-symbols-outlined\b[^>]*>\s*close\s*</span\s*>`,
String.raw`<UiIcon${ATTRS}\bname="close"${ATTRS}/>`,
].join('|');
const HAND_WRITTEN_CLOSE = new RegExp(
String.raw`<(button|UiButton)\b${ATTRS}>\s*(?:${CLOSE_GLYPH})\s*</\1\s*>`,
'gi',
);
const tidy = (markup) => markup.replace(/\s+/g, ' ');
// The two ranges that stay native, by file (docs/VUE-MIGRATION.md says why).
const NATIVE_RANGES = {
'src/ui/views/panels/RadioTuner.vue': 1,
'src/ui/views/panels/WorldTimeline.vue': 1,
};
const RAW_BUTTON = /<button\b/gi;
// A tag whose class, static or bound (alone or in a `v-bind` object), names
// a Material Symbols style.
const MATERIAL_CLASS =
/(?:^|\s)(?:(?::|v-bind:)?class|v-bind|:)=(?:"[^"]*material-symbols[^"]*"|'[^']*material-symbols[^']*')/i;
const INPUT_TAG = new RegExp(String.raw`<input\b(${ATTRS})>`, 'gi');
// An attribute and its value, read from the tag rather than other values.
const ATTRIBUTE = /([^\s=/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'/>]+)))?/g;
/**
* A tag's `type`: written, bound to a quoted literal (`:type="'checkbox'"`),
* or named in a `v-bind` object; null when it is bound to anything else.
*/
function inputType(attrs) {
for (const m of attrs.matchAll(ATTRIBUTE)) {
const name = m[1].toLowerCase();
const value = m[2] ?? m[3] ?? m[4] ?? '';
if (name === 'type') return value.toLowerCase();
if (name === ':type' || name === 'v-bind:type') {
const literal = /^\s*(['`])([^'`]*)\1\s*$/.exec(value);
if (literal) return literal[2].toLowerCase();
}
if (name === 'v-bind' || name === ':') {
const named = /\btype\s*:\s*(['`])([^'`]*)\1/.exec(value);
if (named) return named[2].toLowerCase();
}
}
return null;
}
/** Hand-written buttons in an SFC's template. */
const rawButtons = (source) =>
[...template(source).matchAll(RAW_BUTTON)].map((m) => m[0]);
/** Tags in an SFC's template that draw a Material glyph by hand. */
function materialGlyphs(source) {
const found = [];
for (const m of template(source).matchAll(ANY_TAG))
if (!/^<UiIcon\b/.test(m[0]) && MATERIAL_CLASS.test(m[1]))
found.push(tidy(m[0]));
return found;
}
/** Native inputs of a type in an SFC's template. */
const nativeInputs = (source, type) =>
[...template(source).matchAll(INPUT_TAG)]
.filter((m) => inputType(m[1]) === type)
.map((m) => tidy(m[0]));
/** Raw selects in an SFC's template. */
const rawSelects = (source) =>
[...template(source).matchAll(RAW_SELECT)].map((m) => m[0]);
/** Tags that hand-write aria-pressed. */
function handWrittenPressed(source) {
const found = [];
for (const m of template(source).matchAll(ANY_TAG))
if (PRESSED.test(names(m[1])) || BOUND_PRESSED.test(m[1]))
found.push(tidy(m[0]));
return found;
}
/** Hand-written close buttons in an SFC's template. */
const handWrittenCloses = (source) =>
[...template(source).matchAll(HAND_WRITTEN_CLOSE)].map((m) => tidy(m[0]));
const views = sfcFiles().map((file) => ({
file: path.relative(REPO_ROOT, file).split(path.sep).join('/'),
source: readFileSync(file, 'utf8'),
}));
test('the scans find each hand-written control', () => {
for (const markup of [
'<template><select id="x" v-model="a"><option>1</option></select></template>',
'<template><SELECT\n class="x"></SELECT></template>',
])
assert.equal(rawSelects(markup).length, 1, markup);
for (const markup of [
'<template><UiSelect id="x" v-model="a" /></template>',
'<script>const html = "<select>";</script><template><p /></template>',
'<template><!-- a <select> once sat here --><p /></template>',
])
assert.equal(rawSelects(markup).length, 0, markup);
for (const markup of [
'<template><button type="button" :aria-pressed="String(on)">A</button></template>',
'<template><UiButton\n class="x"\n :title="a > b ? 1 : 2"\n aria-pressed="true"\n>A</UiButton></template>',
'<template><button v-bind:aria-pressed="on">A</button></template>',
'<template><div class="card" role="button" tabindex="0" :aria-pressed="on" /></template>',
'<template><li role="option" :aria-pressed="on" /></template>',
'<template><a :role="\'button\'" :aria-pressed="on">A</a></template>',
'<template><UiButton v-bind="{ \'aria-pressed\': on }">A</UiButton></template>',
])
assert.equal(handWrittenPressed(markup).length, 1, markup);
for (const markup of [
'<template><UiButton :pressed="Boolean(on)" pressed-class="active">A</UiButton></template>',
'<template><button :title="\'aria-pressed\'" @click="q(\'[aria-pressed=true]\')">A</button></template>',
'<template><li role="option" :aria-selected="on" /></template>',
])
assert.equal(handWrittenPressed(markup).length, 0, markup);
for (const markup of [
'<template><button type="button" @click="close">×</button></template>',
'<template><button type="button" :aria-label="l"><span aria-hidden="true">×</span></button></template>',
'<template><UiButton class="x"><UiIcon name="close" :size="null" /></UiButton></template>',
])
assert.equal(handWrittenCloses(markup).length, 1, markup);
for (const markup of [
'<template><UiCloseButton class="x" :label="l" /></template>',
'<template><UiButton :label="l"><UiIcon :name="item.icon" :size="null" /></UiButton></template>',
])
assert.equal(handWrittenCloses(markup).length, 0, markup);
});
test('the scans find each hand-written button, glyph, checkbox and range', () => {
for (const markup of [
'<template><button type="button">A</button></template>',
'<template><BUTTON\n class="x">A</BUTTON></template>',
])
assert.equal(rawButtons(markup).length, 1, markup);
for (const markup of [
'<template><UiButton>A</UiButton></template>',
'<script>const html = "<button>";</script><template><p /></template>',
'<template><!-- a <button> once sat here --><p /></template>',
])
assert.equal(rawButtons(markup).length, 0, markup);
for (const markup of [
'<template><span class="material-symbols-outlined">search</span></template>',
'<template><i class="pp-icon material-symbols-rounded" aria-hidden="true">add</i></template>',
'<template><span :class="\'material-symbols-outlined \' + extra">add</span></template>',
'<template><span\n class="x material-symbols-sharp"\n :title="a > b ? 1 : 2"\n>add</span></template>',
])
assert.equal(materialGlyphs(markup).length, 1, markup);
for (const markup of [
'<template><UiIcon name="search" class="material-symbols-outlined" :size="null" /></template>',
'<template><span class="x">search</span></template>',
'<template><p /></template><style>.x .material-symbols-outlined { color: red; }</style>',
])
assert.equal(materialGlyphs(markup).length, 0, markup);
assert.equal(
nativeInputs(
'<template><input type="checkbox" v-model="a" /></template>',
'checkbox',
).length,
1,
);
assert.equal(
nativeInputs(
'<template><input\n class="x"\n type="range"\n :max="a > b ? 1 : 2"\n/></template>',
'range',
).length,
1,
);
assert.equal(
nativeInputs(
'<template><input type="text" :title="\'type=checkbox\'" /></template>',
'checkbox',
).length,
0,
);
assert.equal(
nativeInputs(
'<template><UiCheckbox v-model="a">A</UiCheckbox></template>',
'checkbox',
).length,
0,
);
for (const markup of [
`<template><input :type="'checkbox'" /></template>`,
`<template><input v-bind:type="'checkbox'" /></template>`,
`<template><input v-bind="{ type: 'checkbox' }" /></template>`,
'<template><input TYPE="checkbox" /></template>',
'<template><input type=checkbox/></template>',
])
assert.equal(nativeInputs(markup, 'checkbox').length, 1, markup);
assert.equal(
nativeInputs('<template><input :type="item.type" /></template>', 'checkbox')
.length,
0,
);
assert.equal(
materialGlyphs(
`<template><span v-bind="{ class: 'material-symbols-outlined' }">add</span></template>`,
).length,
1,
);
});
test('the views are read: the scan reaches the views and skips the kit', () => {
const files = views.map((view) => view.file);
assert.ok(files.includes('src/ui/views/panels/ChatPanel.vue'));
assert.ok(files.includes('src/ui/layerPanel/RowRange.vue'));
assert.ok(!files.some((file) => file.startsWith('src/ui/kit/')));
});
test('every select in the views is a UiSelect', () => {
const found = [];
for (const { file, source } of views)
for (const markup of rawSelects(source)) found.push(`${file}: ${markup}`);
assert.deepEqual(found, []);
});
test('no view hand-writes aria-pressed on a button outside the documented exceptions', () => {
const unexpected = [];
for (const { file, source } of views) {
const allowed = [...(HAND_WRITTEN_PRESSED[file] ?? [])];
for (const markup of handWrittenPressed(source)) {
const at = allowed.findIndex((pattern) => pattern.test(markup));
if (at === -1) unexpected.push(`${file}: ${markup}`);
else allowed.splice(at, 1);
}
assert.deepEqual(allowed, [], `${file}: an exception no longer matches`);
}
assert.deepEqual(unexpected, []);
});
test('no view hand-writes a close button; each is a UiCloseButton', () => {
const found = [];
for (const { file, source } of views)
for (const markup of handWrittenCloses(source))
found.push(`${file}: ${markup}`);
assert.deepEqual(found, []);
});
test('every button in the views is a kit button', () => {
const found = [];
for (const { file, source } of views)
for (const markup of rawButtons(source)) found.push(`${file}: ${markup}`);
assert.deepEqual(found, []);
});
test('every Material Symbols glyph in the views is a UiIcon', () => {
const found = [];
for (const { file, source } of views)
for (const markup of materialGlyphs(source))
found.push(`${file}: ${markup}`);
assert.deepEqual(found, []);
});
test('every checkbox in the views is a UiCheckbox', () => {
const found = [];
for (const { file, source } of views)
for (const markup of nativeInputs(source, 'checkbox'))
found.push(`${file}: ${markup}`);
assert.deepEqual(found, []);
});
test('every range in the views is a UiSlider apart from the two named', () => {
const counts = {};
for (const { file, source } of views) {
const n = nativeInputs(source, 'range').length;
if (n) counts[file] = n;
}
assert.deepEqual(counts, NATIVE_RANGES);
});
// The globe panel's standalone page: plain HTML a host serves, with no Vue
// and no kit, so its two buttons are written as markup.
const STRING_MARKUP_PAGES = new Set(['src/tools/globePanel.js']);
/**
* Every module under src outside the kit, tests and test support, and every
* SFC's script blocks, as `{ file, source }`.
*/
function scriptSources(directory = SRC_ROOT) {
const found = [];
for (const entry of readdirSync(directory, { withFileTypes: true })) {
const absolute = path.join(directory, entry.name);
const file = path.relative(REPO_ROOT, absolute).split(path.sep).join('/');
if (entry.isDirectory()) {
if (
path.relative(KIT_ROOT, absolute) !== '' &&
entry.name !== 'testSupport'
)
found.push(...scriptSources(absolute));
} else if (
!entry.isFile() ||
/\.test\.(?:js|mjs|ts)$|Fixture\.mjs$/.test(entry.name)
) {
continue;
} else if (/\.(?:js|mjs|ts)$/.test(entry.name)) {
found.push({ file, source: readFileSync(absolute, 'utf8') });
} else if (entry.name.endsWith('.vue')) {
const blocks = [
...readFileSync(absolute, 'utf8').matchAll(
/<script\b[^>]*>([\s\S]*?)<\/script\s*>/g,
),
];
found.push({ file, source: blocks.map((m) => m[1]).join('\n') });
}
}
return found;
}
const SCRIPT_CONTROL =
/\bcreateElement(?:NS)?\(\s*(?:[^,)]*,\s*)?['"`](?:button|select|input|textarea)['"`]/gi;
const SCRIPT_GLYPH =
/['"`][^'"`]*\bmaterial-symbols-(?:outlined|rounded|sharp|\$\{)/g;
const STRING_MARKUP = /<(?:button|select|input|textarea)\b/gi;
/** A source with its comments blanked, line numbers kept. */
const uncommented = (source) =>
source
.replace(/\/\*[\s\S]*?\*\//g, (comment) => comment.replace(/[^\n]/g, ' '))
.replace(/(^|[^:'"`\\])\/\/[^\n]*/g, '$1');
/** Each match in a source, as `file:line: text`. */
function hits(file, source, pattern) {
return [...source.matchAll(pattern)].map((m) => {
const line = source.slice(0, m.index).split('\n').length;
return `${file}:${line}: ${source.split('\n')[line - 1].trim()}`;
});
}
test('no module outside the kit builds a control or Material glyph in script', () => {
const sees = (pattern, text) => [...text.matchAll(pattern)].length > 0;
assert.ok(
sees(SCRIPT_CONTROL, "const b = document.createElement('button');"),
);
assert.ok(sees(SCRIPT_CONTROL, 'doc.createElement("INPUT")'));
assert.ok(
sees(SCRIPT_CONTROL, "someDocument.createElement(\n 'button',\n);"),
);
assert.ok(!sees(SCRIPT_CONTROL, "document.createElement('div')"));
assert.ok(
sees(SCRIPT_GLYPH, "span.className = 'material-symbols-outlined';"),
);
assert.ok(sees(SCRIPT_GLYPH, 'el.className = `material-symbols-${style}`;'));
assert.ok(
!sees(SCRIPT_GLYPH, 'ctx.font = \'24px "Material Symbols Outlined"\';'),
);
assert.ok(sees(STRING_MARKUP, "host.innerHTML = '<button>x</button>';"));
assert.ok(
!sees(STRING_MARKUP, "'<button-row>'".replace('<button-row>', '<buttons>')),
);
const sources = scriptSources();
assert.ok(
sources.some(({ file }) => file === 'src/ui/views/panels/ChatPanel.vue'),
);
const found = [];
for (const { file, source } of sources) {
found.push(
...hits(file, source, SCRIPT_CONTROL),
...hits(file, source, SCRIPT_GLYPH),
);
if (!STRING_MARKUP_PAGES.has(file))
found.push(...hits(file, uncommented(source), STRING_MARKUP));
}
assert.deepEqual(found, []);
for (const file of STRING_MARKUP_PAGES) {
const page = sources.find((s) => s.file === file);
assert.ok(
page && hits(file, page.source, STRING_MARKUP).length,
`${file} no longer writes markup`,
);
}
});
+3 -3
View File
@@ -5,6 +5,7 @@ import RowRange from './RowRange.vue';
import RowSlider from './RowSlider.vue';
import RowSwitch from './RowSwitch.vue';
import RowText from './RowText.vue';
import UiButton from '../kit/UiButton.vue';
import { vClassToggle } from '../rail/classToggle.js';
// The data layer rows under their group headings. LayerPanel presents every
@@ -45,8 +46,7 @@ defineProps({
v-if="item.count"
:class="['data-count', { 'data-count-empty': item.count.empty }]"
:text="item.count.text"
/><button
type="button"
/><UiButton
:class="['data-toggle-btn', item.toggle.classes]"
:data-feed-state="item.toggle.feedState"
:aria-disabled="String(item.toggle.ariaDisabled)"
@@ -54,7 +54,7 @@ defineProps({
:title="item.toggle.title"
:aria-label="item.toggle.ariaLabel"
@click="onToggle(item.id)"
>{{ item.toggle.text }}</button
>{{ item.toggle.text }}</UiButton
></div
></div
><RowText tag="div" class="data-toggle-meta" :text="item.meta" /><template
+10 -4
View File
@@ -1,7 +1,13 @@
<script setup>
import UiSelect from '../kit/UiSelect.js';
// A row's start and end pickers on one line (e.g. the Shipwrecks period).
// Both ends share one option list; `onSelect` reports which end moved
// ('from' or 'to') and the chosen option value.
// ('from' or 'to') and the chosen option value. The owner repaints the row
// on a later frame and may reorder the ends (a start picked after the end
// swaps them), so each select is given its end's value as a plain `value`
// rather than a model: the pick stays until the owner publishes a different
// value, which then shows at once, even on the focused select.
defineProps({
range: { type: Object, required: true },
onSelect: { type: Function, default: () => {} },
@@ -21,18 +27,18 @@ defineProps({
:key="end"
class="data-toggle-range-end"
><span class="data-toggle-range-caption">{{ range[end].label }}</span
><select
><UiSelect
class="data-toggle-range-select"
:data-range-end="end"
:aria-label="range[end].ariaLabel || undefined"
:value="String(range[end].value)"
@change="onSelect(end, $event.target.value)"
@update:model-value="onSelect(end, $event)"
><option
v-for="option in range.options"
:key="option.value"
:value="String(option.value)"
>{{ option.label }}</option
></select
></UiSelect
></label
></div
></div
+1 -1
View File
@@ -241,7 +241,7 @@ test('a Data Library row names its entry and draws icon action chips', () => {
assert.equal(element.dataset.libraryEntry, 'nasa-black-marble');
const button = element.querySelector('[data-chip-id="zoom"]');
const glyph = button.children[0];
assert.equal(glyph.className, 'material-symbols-outlined');
assert.ok(glyph.classList.contains('material-symbols-outlined'));
assert.equal(glyph.textContent, 'zoom_in_map');
assert.equal(glyph.getAttribute('aria-hidden'), 'true');
assert.equal(button.getAttribute('aria-label'), 'Zoom to layer');
+51
View File
@@ -0,0 +1,51 @@
import { after, before, test } from 'node:test';
import assert from 'node:assert/strict';
import { installVueDom } from '../../testSupport/vueDom.mjs';
let mount;
let RowRange;
let uninstall;
before(async () => {
uninstall = installVueDom();
({ mount } = await import('@vue/test-utils'));
RowRange = (await import('./RowRange.vue')).default;
});
after(() => uninstall());
const range = (from, to) => ({
id: 'period',
label: 'Period',
valueText: `${from}–${to}`,
from: { label: 'From', value: from },
to: { label: 'To', value: to },
options: [1900, 1950, 1960, 2000].map((value) => ({
value,
label: String(value),
})),
});
test('a range end keeps a pick until the owner repaints, then shows the owner’s ends', async () => {
const picks = [];
const wrapper = mount(RowRange, {
attachTo: document.body,
props: {
range: range(1900, 1950),
onSelect: (end, value) => picks.push([end, value]),
},
});
const [from, to] = wrapper.findAll('select').map((w) => w.element);
assert.equal(from.value, '1900');
assert.equal(to.value, '1950');
// A start picked after the end: the owner swaps the ends on a later frame.
from.focus();
from.value = '1960';
from.dispatchEvent(new Event('change'));
assert.deepEqual(picks, [['from', '1960']]);
await wrapper.vm.$nextTick();
assert.equal(from.value, '1960');
await wrapper.setProps({ range: range(1950, 1960) });
assert.equal(document.activeElement, from);
assert.equal(from.value, '1950');
assert.equal(to.value, '1960');
wrapper.unmount();
});
+58 -51
View File
@@ -49,6 +49,11 @@ const meta = () =>
]
.filter(Boolean)
.join(' · ');
// The card's face is the slot of a UiButton, which renders inside the
// button: a new item alone would reach it only on a later tick, but the panel
// patches synchronously. A slot given under a condition (`redrawWithView`,
// always true) is redrawn whenever this card is, so it keeps up.
const redrawWithView = true;
</script>
<template>
@@ -58,60 +63,62 @@ const meta = () =>
:data-report-id="item.id"
:style="{ '--news-color': item.color }"
>
<button
type="button"
class="news-card__main ui-focus"
<UiButton
class="news-card__main"
:aria-expanded="open ? 'true' : 'false'"
@click="onChoose(item)"
><template v-if="redrawWithView" #default>
<span v-if="item.picture && !pictureFailed" class="news-card__thumb"
><img
:src="item.picture.url"
alt=""
loading="lazy"
decoding="async"
referrerpolicy="no-referrer"
v-on="{ error: dropPicture }"
/><span
v-if="item.picture.video && !clipFailed"
class="news-card__play"
role="img"
:aria-label="t('Video')"
>▶</span
><span v-if="item.picture.credit" class="news-card__credit">{{
item.picture.credit
}}</span></span
>
<span class="news-card__title">{{ item.title }}</span>
<span v-if="item.original" class="news-card__note">{{
t('English headline by the model')
}}</span>
<span class="news-card__meta ui-mono"
><span
class="news-card__marker"
:class="{ solid: item.solid }"
role="img"
:aria-label="item.severityLabel"
:title="item.severityLabel"
><svg viewBox="0 0 16 16" aria-hidden="true">
<path :d="item.icon" /></svg></span
><span v-if="item.severity >= 2" class="news-card__severity">{{
item.severityLabel
}}</span
>{{ item.severity >= 2 ? ` · ${meta()}` : meta() }}</span
>
<span v-if="item.sides" class="news-card__sides">{{ item.sides }}</span>
<span v-if="item.chips.length" class="news-card__chips"
><span
v-for="chip in item.chips"
:key="`${chip.kind}:${chip.label}`"
class="news-chip"
:class="`news-chip--${chip.kind}`"
>{{ chip.label }}</span
></span
>
<span v-if="item.via" class="news-card__via ui-mono">{{
item.via
}}</span>
</template></UiButton
>
<span v-if="item.picture && !pictureFailed" class="news-card__thumb"
><img
:src="item.picture.url"
alt=""
loading="lazy"
decoding="async"
referrerpolicy="no-referrer"
v-on="{ error: dropPicture }"
/><span
v-if="item.picture.video && !clipFailed"
class="news-card__play"
role="img"
:aria-label="t('Video')"
>▶</span
><span v-if="item.picture.credit" class="news-card__credit">{{
item.picture.credit
}}</span></span
>
<span class="news-card__title">{{ item.title }}</span>
<span v-if="item.original" class="news-card__note">{{
t('English headline by the model')
}}</span>
<span class="news-card__meta ui-mono"
><span
class="news-card__marker"
:class="{ solid: item.solid }"
role="img"
:aria-label="item.severityLabel"
:title="item.severityLabel"
><svg viewBox="0 0 16 16" aria-hidden="true">
<path :d="item.icon" /></svg></span
><span v-if="item.severity >= 2" class="news-card__severity">{{
item.severityLabel
}}</span
>{{ item.severity >= 2 ? ` · ${meta()}` : meta() }}</span
>
<span v-if="item.sides" class="news-card__sides">{{ item.sides }}</span>
<span v-if="item.chips.length" class="news-card__chips"
><span
v-for="chip in item.chips"
:key="`${chip.kind}:${chip.label}`"
class="news-chip"
:class="`news-chip--${chip.kind}`"
>{{ chip.label }}</span
></span
>
<span v-if="item.via" class="news-card__via ui-mono">{{ item.via }}</span>
</button>
<div v-if="open" class="news-card__open">
<video
v-if="item.picture?.video && !clipFailed"
+10 -6
View File
@@ -472,6 +472,9 @@ export function startGuide(steps, { title = '' } = {}) {
nextLabel: t('Next'),
nextHidden: false,
nextQuiet: false,
// The extra rings for a step's further targets, after the callout; the
// count only grows, and rings a step does not use are faded out.
subRings: 0,
// Announces each step once; the dialog itself is not a live region, so
// its buttons and progress are not read out on every change.
status: '',
@@ -511,7 +514,9 @@ export function startGuide(steps, { title = '' } = {}) {
const root = paint().component.subTree.children[0].el;
const ring = root.querySelector(':scope > .gev-guide-ring');
const callout = root.querySelector(':scope > .gev-guide-callout');
const subRings = [];
// The extra rings, read again from the rendered tree whenever more are
// drawn.
let subRings = [];
const live = steps.filter(Boolean);
let index = -1;
@@ -657,11 +662,10 @@ export function startGuide(steps, { title = '' } = {}) {
width: `${main.width + pad * 2}px`,
height: `${main.height + pad * 2}px`,
});
while (subRings.length < rest.length) {
const sub = doc.createElement('div');
sub.className = 'gev-guide-ring gev-guide-ring--sub';
root.append(sub);
subRings.push(sub);
if (subRings.length < rest.length) {
view.subRings = rest.length;
paint();
subRings = [...root.querySelectorAll(':scope > .gev-guide-ring--sub')];
}
subRings.forEach((sub, i) => {
const box = rest[i];
+36
View File
@@ -134,3 +134,39 @@ test('a walk started while Vue mounts something else still starts and ends', asy
assert.equal($('.gev-guide'), null);
assert.equal(document.activeElement, field);
});
test('each further target of a step gets its own ring after the callout', async (t) => {
const { target } = fixture(t);
const more = document.body.appendChild(document.createElement('button'));
const box = (left) => () => ({
left,
top: 20,
right: left + 30,
bottom: 50,
width: 30,
height: 30,
});
target.getBoundingClientRect = box(10);
more.getBoundingClientRect = box(100);
let targets = [target, more];
startGuide([{ targets: () => targets, text: () => 'Press these' }]);
const frame = () => new Promise((resolve) => requestAnimationFrame(resolve));
await settle();
await frame();
const subs = () => [...document.querySelectorAll('.gev-guide-ring--sub')];
assert.equal(subs().length, 1);
const [sub] = subs();
assert.equal(sub.className, 'gev-guide-ring gev-guide-ring--sub');
assert.equal(sub.parentElement, $('.gev-guide'));
assert.equal(sub.previousElementSibling, $('.gev-guide-callout'));
assert.equal(sub.childElementCount, 0);
assert.equal(sub.style.opacity, '1');
assert.equal(sub.style.left, '96px');
assert.equal(sub.style.width, '38px');
// A step with fewer targets keeps the ring, faded out.
targets = [target];
$('.gev-guide-ring').dispatchEvent(new Event('scroll', { bubbles: true }));
await frame();
assert.deepEqual(subs(), [sub]);
assert.equal(sub.style.opacity, '0');
});
+3 -3
View File
@@ -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);
+33 -23
View File
@@ -2,6 +2,7 @@
import { computed, onBeforeUnmount } from 'vue';
import RailCardBlocks from './RailCardBlocks.vue';
import UiBadge from '../kit/UiBadge.vue';
import UiButton from '../kit/UiButton.vue';
// One keyed card: a disclosure header and its blocks. The owner decides
// which card is open.
@@ -20,6 +21,12 @@ onBeforeUnmount(() => {
live = false;
});
const select = () => live && props.onOpen(props.card.id);
// The header's contents are the slot of a UiButton, which renders inside the
// button: a new card alone would reach them only on a later tick, but the
// owner patches synchronously and measures at once. A slot given under a
// condition (`redrawWithView`, always true) is redrawn whenever this card is,
// so it keeps up.
const redrawWithView = true;
</script>
<script>
@@ -32,33 +39,36 @@ const nextBodyId = () => ++bodies;
:class="`rail-card${cardClassName ? ` ${cardClassName}` : ''}${open ? ' is-open' : ''}`"
:data-card-id="card.id"
:data-open="String(open)"
><button
><UiButton
class="rail-card-header"
type="button"
:aria-controls="bodyId"
:aria-expanded="String(open)"
@click="select"
><span class="rail-card-labels"
><span class="rail-card-heading"
><span class="data-icon" aria-hidden="true" :hidden="!card.icon">{{
card.icon || ''
}}</span
><span class="rail-card-title rail-card-nowrap" :title="card.title">{{
card.title
}}</span></span
><UiBadge
:class="`gev-status-badge--plain rail-card-badge${badgeClassName ? ` ${badgeClassName}` : ''}`"
:hidden="!card.badge"
>{{ card.badge || '' }}</UiBadge
></span
><span class="rail-card-disclosure" aria-hidden="true">{{
open ? '▾' : '▸'
}}</span
><span
:class="`rail-card-compact${card.compactStatus ? ' status' : ''}`"
:hidden="open"
>{{ card.compact || '' }}</span
></button
><template v-if="redrawWithView" #default
><span class="rail-card-labels"
><span class="rail-card-heading"
><span class="data-icon" aria-hidden="true" :hidden="!card.icon">{{
card.icon || ''
}}</span
><span
class="rail-card-title rail-card-nowrap"
:title="card.title"
>{{ card.title }}</span
></span
><UiBadge
:class="`gev-status-badge--plain rail-card-badge${badgeClassName ? ` ${badgeClassName}` : ''}`"
:hidden="!card.badge"
>{{ card.badge || '' }}</UiBadge
></span
><span class="rail-card-disclosure" aria-hidden="true">{{
open ? '▾' : '▸'
}}</span
><span
:class="`rail-card-compact${card.compactStatus ? ' status' : ''}`"
:hidden="open"
>{{ card.compact || '' }}</span
></template
></UiButton
><div :id="bodyId" class="rail-card-body" :hidden="!open"
><RailCardBlocks
:blocks="card.blocks || []"
+7 -11
View File
@@ -2,6 +2,7 @@
import { onBeforeUnmount } from 'vue';
import { t } from '../../i18n/index.js';
import { formatScaleRange } from '../unitLabels.js';
import UiButton from '../kit/UiButton.vue';
import UiCloseButton from '../kit/UiCloseButton.vue';
import RailCardSetting from './RailCardSetting.vue';
import RailChips from './RailChips.vue';
@@ -166,28 +167,23 @@ function legendView(legend) {
:title="action.title || undefined"
@click="dispatch(action, block)"
>{{ action.label }}</a
><button
><UiButton
v-else
:class="[
'data-toggle-chip',
{ active: action.pressed, 'is-reserved': action.reserved },
]"
type="button"
:class="['data-toggle-chip', { 'is-reserved': action.reserved }]"
:data-action-id="action.id"
:title="action.title || undefined"
:disabled="Boolean(action.disabled)"
:aria-pressed="
action.pressed === undefined
? undefined
: String(Boolean(action.pressed))
:pressed="
action.pressed === undefined ? undefined : Boolean(action.pressed)
"
pressed-class="active"
:aria-hidden="
action.reserved === undefined
? undefined
: String(Boolean(action.reserved))
"
@click="dispatch(action, block)"
>{{ action.label }}</button
>{{ action.label }}</UiButton
><span class="rail-card-action-hint" :hidden="!action.hint">{{
action.hint || ''
}}</span></template
+5 -6
View File
@@ -1,5 +1,6 @@
<script setup>
import UiButton from '../kit/UiButton.vue';
import UiIcon from '../kit/UiIcon.vue';
// Keyed chips shared by rail cards; the owner decides what a click does.
// An `icon` chip shows a Material Symbol (named in index.html's `icon_names`
@@ -29,11 +30,9 @@ const chipClass = (chip) =>
:disabled="Boolean(chip.disabled)"
:aria-busy="String(Boolean(chip.busy))"
@click="onSelect(chip)"
><span
v-if="chip.icon"
class="material-symbols-outlined"
aria-hidden="true"
>{{ chip.icon }}</span
><template v-else>{{ chip.label }}</template></UiButton
><UiIcon v-if="chip.icon" :name="chip.icon" :size="null" /><template
v-else
>{{ chip.label }}</template
></UiButton
>
</template>
+6 -5
View File
@@ -1,5 +1,6 @@
<script setup>
import { onMounted, onUpdated, ref } from 'vue';
import UiButton from '../kit/UiButton.vue';
// An ordered list whose rows keep their identity, so a focused row stays.
const props = defineProps({
@@ -10,7 +11,7 @@ const props = defineProps({
const root = ref(null);
const rowClass = (item) =>
`data-row-list-item${item.disabled ? ' note' : ''}${item.active ? ' active' : ''}${item.current ? ' current' : ''}`;
`data-row-list-item${item.disabled ? ' note' : ''}${item.current ? ' current' : ''}`;
// Follow the flight, but never steal a scroll the reader is making
// themselves: only when the step actually changed.
@@ -43,19 +44,19 @@ onUpdated(followCurrent);
v-for="item in list?.items ?? []"
:key="item.id"
:data-list-item-id="item.id"
><button
type="button"
><UiButton
:class="rowClass(item)"
:data-list-item-id="item.id"
:disabled="Boolean(item.disabled)"
:aria-current="item.current ? 'step' : 'false'"
:aria-pressed="item.active ? 'true' : 'false'"
:pressed="Boolean(item.active)"
pressed-class="active"
:title="String(item.text ?? '')"
@click="onSelect(item)"
><span class="data-row-list-lead">{{ String(item.lead ?? '') }}</span
><span class="data-row-list-text">{{
String(item.text ?? '')
}}</span></button
}}</span></UiButton
></li
></ol
>
+7 -9
View File
@@ -1,5 +1,6 @@
<script setup>
import { t } from '../../i18n/index.js';
import UiButton from '../kit/UiButton.vue';
// One imagery day in the strip. The owner computes every value; clicks reach
// it through the readout's delegated listener.
@@ -46,21 +47,18 @@ defineProps({
><div class="ri-card-sensor">{{ card.sensor }}</div
><div class="ri-card-cloud">{{ card.cloud }}</div
><div class="ri-card-chips"
><button
><UiButton
v-for="chip in card.chips"
:key="chip.slot"
type="button"
:class="[
'data-toggle-chip ri-chip',
{ active: chip.active, 'is-reserved': chip.reserved },
]"
:class="['data-toggle-chip ri-chip', { 'is-reserved': chip.reserved }]"
tabindex="-1"
:data-slot="chip.slot"
:disabled="chip.disabled"
:aria-pressed="String(chip.active)"
:disabled="Boolean(chip.disabled)"
:pressed="Boolean(chip.active)"
pressed-class="active"
:aria-hidden="String(chip.reserved)"
:aria-label="chip.ariaLabel"
>{{ chip.label }}</button
>{{ chip.label }}</UiButton
></div
></div
>
+8 -11
View File
@@ -1,6 +1,7 @@
<script setup>
import { computed } from 'vue';
import { t } from '../../i18n/index.js';
import UiButton from '../kit/UiButton.vue';
import UiCloseButton from '../kit/UiCloseButton.vue';
import UiSegmented from '../kit/UiSegmented.vue';
import RailCardBlocks from '../rail/RailCardBlocks.vue';
@@ -51,17 +52,16 @@ const modeOptions = computed(() =>
aria-live="polite"
:title="view.notice.text"
>{{ view.notice.text }}</span
><button
><UiButton
id="ri-zoom-in"
:class="[
'data-toggle-chip ri-zoom-in',
{ 'is-reserved': !view.notice.fit },
]"
type="button"
:title="t('Fly in until the view fits the 1,000 km limit')"
:disabled="!view.notice.fit"
:aria-hidden="String(!view.notice.fit)"
>{{ t('ZOOM IN') }}</button
>{{ t('ZOOM IN') }}</UiButton
></div
><div
id="ri-strip"
@@ -131,21 +131,18 @@ const modeOptions = computed(() =>
max="100"
step="1"
:aria-label="t('Imagery opacity')"
:disabled="!view.opacityEnabled" /><button
:disabled="!view.opacityEnabled" /><UiButton
id="ri-swap"
:class="[
'data-toggle-chip ri-swap',
{
'is-reserved': !view.swap.live,
active: view.swap.pressed,
},
{ 'is-reserved': !view.swap.live },
]"
type="button"
:title="t('Trade the two sides of the divider')"
:disabled="!view.swap.live"
:aria-hidden="String(!view.swap.live)"
:aria-pressed="String(view.swap.pressed)"
>{{ t('SWAP') }}</button
:pressed="Boolean(view.swap.pressed)"
pressed-class="active"
>{{ t('SWAP') }}</UiButton
><div class="ri-exports"
><RailCardBlocks
:blocks="view.exports"
+8 -3
View File
@@ -167,7 +167,10 @@ export class ShareRestoration {
feedback,
updateFeedback,
applyFollowOffset = null,
startLayers = [],
}) {
// The layers a bare address starts with; a link names its own.
this._startLayers = startLayers;
Object.assign(this, {
viewer,
navigation,
@@ -417,9 +420,11 @@ 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,
startLayerIds: this._initialShareState ? [] : this._startLayers,
});
if (this._initialShareSelectionSuperseded) {
this._layerStateCoordinator.cancelPendingShareTracking(
+2 -1
View File
@@ -13,7 +13,8 @@ export const useBhoteKoshiPanelStore = defineStore(
/**
* `{owner, sceneBeat, refs, beforeDate, afterDate, reports}`, or null while
* the event layer is off. Each entry of `refs` holds one control's
* `textContent`, `hidden`, `disabled`, `value` and `attributes`.
* `textContent`, `hidden`, `disabled`, `value` and `attributes`; the
* cinematic button's also holds `pressed`.
*/
const panel = shallowRef(null);
+125
View File
@@ -93,6 +93,26 @@ export const useEntityCardStore = defineStore('gev-entity-card', () => {
const lost = ref(false);
/** Bumped on each refresh, so ages shown on the card tick. */
const tick = ref(0);
/**
* True while the item is not to be seen: out of its feed, off screen or
* behind the globe. The card then offers to find it.
*/
const away = ref(false);
/**
* Finding the item again (see locate): `'idle'`, `'finding'` while its
* layer looks it up, or `'none'` when it has no reading at the time.
*/
const finding = ref('idle');
/**
* Where an item out of its feed was found (see locate):
* `{lat, lon, altitudeM, observedAtMs, atMs}`, or null.
*/
const located = shallowRef(null);
/** The track reference of the card's item, kept for when it leaves its feed. */
let reference = null;
let locating = null;
/** An aircraft found again is followed once it is back in its feed. */
let followWhenBack = false;
/**
* What the camera shows, for the panel to describe when nothing is picked:
* `{center: {lat, lon}, rect: {west, south, east, north}, heightM}`.
@@ -229,12 +249,105 @@ export const useEntityCardStore = defineStore('gev-entity-card', () => {
// Keep showing the last reading when the item drops out of its feed.
if (!next || next.key !== current.key || next.basis !== 'record') {
lost.value = current.basis === 'record';
away.value = lost.value || !shown(current);
tick.value++;
return;
}
const wasLost = lost.value;
card.value = markRaw(next);
lost.value = false;
// The camera follows it where it is drawn, which can be ahead of its last
// reading; one being followed is always in view.
away.value = !isFollowing() && !shown(next);
tick.value++;
if (wasLost) back(next);
}
/** Whether the camera shows the item; true when the shell cannot tell. */
function shown(current) {
const test = shell.value?.onScreen;
return typeof test === 'function' ? test(current) !== false : true;
}
/**
* The item is back in its feed: its layer selects it again, as the click
* that picked it did, and an aircraft just found is followed.
*/
function back(current) {
const follows = followWhenBack;
// A lookup still running is no longer needed: the feed has it.
stopLocating();
reference =
layerOf(current.layerId)?.referenceOf?.(current.identity?.id) ??
reference;
shell.value?.reselect?.(current, { follow: follows });
}
const layerOf = (layerId) =>
shell.value?.dataManager?.()?.layers?.get?.(layerId)?.module ?? null;
/**
* Take the camera back to the item. One the camera can see or one still in
* its feed is flown to (an aircraft followed); one out of its feed is
* looked up at the layer's time (the world clock's while it follows the
* clock) on its own track, shown there and flown to, and its layer picks
* it up again once its feed has it.
* @returns {Promise<void>}
*/
async function locate() {
const current = card.value;
if (!current) return;
if (!lost.value) {
if (canFollow()) follow();
else flyTo();
return;
}
const layer = layerOf(current.layerId);
if (typeof layer?.locate !== 'function') {
flyTo();
return;
}
locating?.abort();
const controller = new AbortController();
locating = controller;
finding.value = 'finding';
let result;
try {
result = await layer.locate(current.identity?.id, {
reference,
signal: controller.signal,
});
} catch {
result = { status: 'none' };
}
if (locating !== controller) return;
locating = null;
const now = card.value;
if (!now || now.key !== current.key) return;
if (result?.status !== 'found') {
finding.value = 'none';
return;
}
finding.value = 'idle';
located.value = markRaw({ ...result });
card.value = markRaw({
...now,
lat: result.lat,
lon: result.lon,
altitudeM: Number.isFinite(result.altitudeM)
? result.altitudeM
: now.altitudeM,
});
followWhenBack = canFollow();
shell.value?.flyTo?.(card.value);
}
function stopLocating() {
locating?.abort();
locating = null;
finding.value = 'idle';
located.value = null;
followWhenBack = false;
}
/**
@@ -261,6 +374,11 @@ export const useEntityCardStore = defineStore('gev-entity-card', () => {
*/
function select(identity, { fly = false, follow: autoFollow = true } = {}) {
if (!read(identity)) return false;
stopLocating();
away.value = false;
reference =
layerOf(identity.layerId)?.referenceOf?.(card.value?.identity?.id) ??
null;
clearInterval(timer);
timer = setInterval(refresh, REFRESH_MS);
shell.value?.openPanel?.();
@@ -292,6 +410,9 @@ export const useEntityCardStore = defineStore('gev-entity-card', () => {
timer = null;
card.value = null;
lost.value = false;
away.value = false;
reference = null;
stopLocating();
}
const flyTo = () => card.value && shell.value?.flyTo?.(card.value);
@@ -324,6 +445,10 @@ export const useEntityCardStore = defineStore('gev-entity-card', () => {
card,
lost,
tick,
away,
finding,
located,
locate,
connect,
select,
clear,
+154
View File
@@ -0,0 +1,154 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { createPinia } from 'pinia';
import { useEntityCardStore } from './entityCard.js';
/**
* A vessels layer whose one vessel can leave its feed, and a shell that
* records what the card asks of it.
*/
function setup({ found = true } = {}) {
const vessel = {
id: 'v1',
name: 'ARCADIA',
lat: 1,
lon: 10,
reference: 'vessel:v1',
};
let inFeed = true;
const asked = [];
const module = {
getAnalystRecords: () => (inFeed ? [{ ...vessel }] : []),
referenceOf: (id) => (id === 'v1' && inFeed ? vessel.reference : null),
async locate(id, { reference }) {
asked.push({ id, reference });
return found
? {
status: 'found',
lat: 5,
lon: 50,
altitudeM: null,
observedAtMs: 1_000,
atMs: 61_000,
}
: { status: 'none' };
},
};
const dataManager = {
isEnabled: () => true,
layers: new Map([['ais-live-vessels', { module }]]),
getAll: () => [],
};
const shell = {
flown: [],
followed: [],
reselected: [],
visible: true,
dataManager: () => dataManager,
openPanel() {},
flyTo(card) {
shell.flown.push([card.lat, card.lon]);
},
follow(card) {
shell.followed.push(card.key);
},
reselect(card, options) {
shell.reselected.push([card.identity.id, options.follow]);
},
onScreen: () => shell.visible,
canFollow: () => false,
};
const store = useEntityCardStore(createPinia());
store.connect(shell);
return {
store,
shell,
asked,
leave: () => (inFeed = false),
come: () => (inFeed = true),
};
}
test('a vessel out of its feed is looked up, shown where it was and flown to', async (t) => {
const { store, shell, asked, leave, come } = setup();
t.after(() => store.clear());
assert.equal(store.select({ layerId: 'ais-live-vessels', id: 'v1' }), true);
assert.equal(store.away, false, 'on screen and in its feed');
leave();
store.refresh();
assert.equal(store.lost, true);
assert.equal(store.away, true, 'out of its feed: the card offers to find it');
await store.locate();
assert.deepEqual(
asked,
[{ id: 'v1', reference: 'vessel:v1' }],
'by the reference it had',
);
assert.equal(store.card.lat, 5);
assert.equal(store.card.lon, 50);
assert.deepEqual(shell.flown, [[5, 50]]);
assert.equal(store.located.observedAtMs, 1_000);
assert.equal(store.finding, 'idle');
come();
store.refresh();
assert.equal(store.lost, false, 'back in its feed');
assert.equal(store.located, null);
assert.deepEqual(
shell.reselected,
[['v1', false]],
'its layer selects it again',
);
});
test('a vessel with no reading at the time says so and stays put', async (t) => {
const { store, shell, leave } = setup({ found: false });
t.after(() => store.clear());
store.select({ layerId: 'ais-live-vessels', id: 'v1' });
leave();
store.refresh();
await store.locate();
assert.equal(store.finding, 'none');
assert.deepEqual(shell.flown, [], 'the camera stays');
assert.equal(store.card.lat, 1, 'the card keeps its last reading');
});
test('an item in its feed but off screen is flown to without a lookup', async (t) => {
const { store, shell, asked } = setup();
t.after(() => store.clear());
store.select({ layerId: 'ais-live-vessels', id: 'v1' });
shell.visible = false;
store.refresh();
assert.equal(store.away, true, 'off screen');
await store.locate();
assert.deepEqual(asked, []);
assert.deepEqual(shell.flown, [[1, 10]]);
});
test('an item the camera follows is never away, wherever its last reading is', (t) => {
const { store, shell } = setup();
t.after(() => store.clear());
store.select({ layerId: 'ais-live-vessels', id: 'v1' });
shell.visible = false;
store.following = store.card.key;
store.refresh();
assert.equal(store.away, false);
});
test('a lookup still running when the item comes back is dropped', async (t) => {
const { store, shell, leave, come } = setup();
t.after(() => store.clear());
store.select({ layerId: 'ais-live-vessels', id: 'v1' });
leave();
store.refresh();
const pending = store.locate();
come();
store.refresh();
await pending;
assert.equal(store.lost, false);
assert.equal(store.located, null, 'no old reading on a live card');
assert.equal(store.card.lat, 1, 'the card keeps its live position');
assert.deepEqual(shell.flown, [], 'the camera stays');
});
+29
View File
@@ -0,0 +1,29 @@
import { defineStore } from 'pinia';
import { markRaw, shallowRef } from 'vue';
/**
* The Street Level photo viewer (KartaView, Panoramax) as its view renders
* it. The street-level layer presents it through `subscribePhotoViewer()`
* and the application shell publishes each presentation here.
*/
export const useStreetLevelPhotoStore = defineStore(
'gev-street-level-photo',
() => {
/**
* `{host, mountKey, providerId, label, alt, kind, src, fit, canvasKey,
* dragging, prevLabel, prevDisabled, nextLabel, nextDisabled, actions}`,
* or null while no photo viewer is mounted. Of the viewers mounting in
* the host, only the one mounted last (the largest `mountKey`) is
* published; `actions.supersede()` tells the others they are not drawn
* (see `ViewerAdapter.subscribeView` in src/layers/streetLevel/registry.js).
*/
const photo = shallowRef(null);
/** @param {?object} next A fresh presentation; every publish re-renders. */
function publish(next) {
photo.value = next && markRaw(next);
}
return { photo, publish };
},
);
+27
View File
@@ -6,6 +6,33 @@ import { createPinia } from 'pinia';
import { useStoriesStore } from './stores/stories.js';
import { storyById } from '../stories/catalog.js';
import StoryScreen from './views/stories/StoryScreen.vue';
import StoriesView from './views/StoriesView.vue';
test('the announcement stays unread when a lazy Stories open resolves to false', async (t) => {
const host = document.body.appendChild(document.createElement('div'));
const pinia = createPinia();
const store = useStoriesStore(pinia);
let allowed = false;
store.connect({ open: async () => allowed });
const app = createApp(StoriesView).use(pinia);
app.mount(host);
t.after(() => {
app.unmount();
host.remove();
localStorage.removeItem('gevStoriesPopSeen');
});
const entry = host.querySelector('#hStories');
entry.click();
await nextTick();
assert.equal(localStorage.getItem('gevStoriesPopSeen'), null);
assert.ok(host.querySelector('#hPop'));
allowed = true;
entry.click();
await nextTick();
assert.equal(localStorage.getItem('gevStoriesPopSeen'), '1');
});
test('the story screen previews a drag and seeks once on release', async (t) => {
const host = document.body.appendChild(document.createElement('div'));
+34 -4
View File
@@ -78,6 +78,8 @@
--cockpit-side-panel-width: min(340px, 28vw);
/* HUD bottom offset + tallest scaled telemetry block + 20px clear border. */
--cockpit-bottom-rail-safe: calc(clamp(84px, 11vh, 118px) + 100px);
/* The phone Display/Radio row shares the visor inset with the roll arc. */
--cockpit-visor-top: clamp(62px, 9vh, 90px);
position: fixed;
inset: 0;
z-index: 145;
@@ -95,7 +97,7 @@
}
.cockpit-visor-shell {
position: absolute;
inset: clamp(62px, 9vh, 90px) clamp(18px, 3vw, 48px) clamp(38px, 5vh, 56px);
inset: var(--cockpit-visor-top) clamp(18px, 3vw, 48px) clamp(38px, 5vh, 56px);
transform-style: preserve-3d;
perspective: 880px;
}
@@ -703,7 +705,9 @@ html:not([lang='en']) .cockpit-roll-token.is-separator {
color: var(--cockpit-accent);
font-size: 12px;
}
.cockpit-heading-caret {
/* Inside the compass, so it outranks the kit icon's own display and
line height. */
.cockpit-compass .cockpit-heading-caret {
display: block;
height: 20px;
color: var(--cockpit-accent);
@@ -2079,6 +2083,11 @@ body.cockpit-mode
) {
display: none !important;
}
/* The first-visit Stories announcement waits, unread, until Cockpit closes:
on a phone it would cover the Display/Radio row. */
body.cockpit-mode #gev-stories #hPop {
display: none;
}
body.cockpit-mode #left-panel-stack {
z-index: 147;
display: flex;
@@ -2175,10 +2184,31 @@ body.cockpit-mode #intel-hud .hud-right-edge {
top: auto;
right: 12px;
bottom: 152px;
flex-direction: row;
max-width: calc(100vw - 24px);
}
body.cockpit-mode .cockpit-utility-controls {
flex-direction: row;
/* Phone flight and bridge views: one row centred on the Reset/Exit axis,
10px below the roll arc (.cockpit-roll-arc: 2px + 96px into the visor).
Shorter screens reserve 36px around the 46% centre of .cockpit-reticle
(about 25px tall on phones), plus an 8px gap below the 42px row.
The row stops at 72px, below the vision controls. Windows under 240px
tall, and narrow ones under 450px tall, keep the right-aligned row above
Reset/Exit, clear of Reset, LOOK AHEAD and the Stories button, as do
satellite and provider views. */
@media (min-width: 390px) and (min-height: 240px), (min-height: 450px) {
body.cockpit-mode.mobile-shell
#cockpit-hud:not([data-generic]):not([data-subject='satellite'])
.cockpit-utility-controls {
top: clamp(
72px,
calc(46% - 68px),
calc(var(--cockpit-visor-top) + 108px)
);
bottom: auto;
left: 12px;
width: max-content;
margin-inline: auto;
}
}
body.cockpit-mode .cockpit-utility-launcher {
width: min(150px, calc((100vw - 31px) / 2));
+32 -1
View File
@@ -104,6 +104,33 @@
font-size: 1rem;
}
/* Find it: shown while the selected item is off screen or out of its feed. */
.entity-card__find {
display: grid;
flex: none;
place-items: center;
width: 1.9rem;
height: 1.9rem;
color: #36dcff;
background: rgba(29, 69, 81, 0.35);
border: 1px solid rgba(48, 194, 224, 0.55);
border-radius: 7px;
}
.entity-card__find:hover,
.entity-card__find:focus-visible {
color: #fff;
background: rgba(48, 194, 224, 0.3);
}
.entity-card__find:disabled {
opacity: 0.55;
}
.entity-card__find .material-symbols-outlined {
font-size: 1.1rem;
}
.entity-card__title {
margin: 0.55rem 0 0.1rem;
overflow-wrap: anywhere;
@@ -2180,7 +2207,11 @@
border-radius: 3px;
}
.entity-hero:is([data-hero='flight'], [data-hero='satellite'], [data-hero='photo']) {
.entity-hero:is(
[data-hero='flight'],
[data-hero='satellite'],
[data-hero='photo']
) {
height: 168px;
background: radial-gradient(
ellipse 55% 60% at 50% 55%,
+11 -23
View File
@@ -8,11 +8,15 @@ body:not(.mobile-shell):not(.cockpit-mode):not(.scene-playback-mode):not(
/* Clear of the attribution line under it, however many lines it wraps
onto (--credit-line-height, src/ui/creditLineHeight.js). */
--omnibar-credits-clear: calc(1rem + var(--credit-line-height, 28px) + 6px);
/* The dock, and the World Timeline and narrow corners placed from it,
/* The World Timeline, and the dock and narrow corners placed from it,
rise over a line wrapped taller than its usual one or two lines. */
--omnibar-dock-bottom: max(74px, calc(var(--omnibar-credits-clear) + 2px));
/* The dock sits above the World Timeline, rising by its height
(--world-timeline-lift, world-timeline.css) as the plain dock does. */
--omnibar-dock-raised: calc(
var(--omnibar-dock-bottom) + var(--world-timeline-lift, 0px)
);
--omnibar-coordinates-bottom: max(4.25rem, var(--omnibar-credits-clear));
--world-timeline-lift: 0px;
#intel-hud:is([data-variant='tactical'], [data-variant='minimal'])
:is(.hud-top-left, .hud-top-right) {
@@ -32,23 +36,14 @@ body:not(.mobile-shell):not(.cockpit-mode):not(.scene-playback-mode):not(
}
#world-timeline {
bottom: calc(var(--omnibar-dock-bottom) + 66px);
bottom: var(--omnibar-dock-bottom);
width: var(--omnibar-dock-width);
}
&:has(#gev-chat-panel:not([hidden]), #gev-voice-panel:not([hidden]))
#world-timeline,
&:has(#gev-omnibar.has-results):not(
:has(#gev-voice-control[data-assistant-mode='voice'])
)
#world-timeline {
visibility: hidden;
}
#command-dock {
--dock-voice-width: var(--omnibar-dock-width);
top: auto;
bottom: var(--omnibar-dock-bottom);
bottom: var(--omnibar-dock-raised);
z-index: 149;
width: var(--omnibar-dock-width);
max-width: none;
@@ -197,7 +192,7 @@ body:not(.mobile-shell):not(.cockpit-mode):not(.scene-playback-mode):not(
#gev-omnibar {
top: auto;
bottom: calc(var(--omnibar-dock-bottom) + 11px);
bottom: calc(var(--omnibar-dock-raised) + 11px);
left: 50%;
width: calc(var(--omnibar-dock-width) - 120px);
transform: translateX(-50%);
@@ -235,7 +230,7 @@ body:not(.mobile-shell):not(.cockpit-mode):not(.scene-playback-mode):not(
bottom: calc(100% + 11px);
max-height: min(
360px,
max(0px, calc(100dvh - var(--omnibar-dock-bottom) - 144px))
max(0px, calc(100dvh - var(--omnibar-dock-raised) - 144px))
);
overflow: auto;
border-radius: 18px 18px 0 0;
@@ -365,16 +360,9 @@ body:not(.mobile-shell):not(.cockpit-mode):not(.scene-playback-mode):not(
rise above the dock. */
@media (max-width: 1119px) {
--omnibar-coordinates-bottom: max(
calc(var(--omnibar-dock-bottom) + 56px + 10px),
calc(var(--omnibar-dock-raised) + 56px + 10px),
var(--omnibar-credits-clear)
);
/* And above the World Timeline (42px tall) over the dock. */
&:has(#world-timeline) {
--omnibar-coordinates-bottom: max(
calc(var(--omnibar-dock-bottom) + 66px + 42px + 10px),
var(--omnibar-credits-clear)
);
}
#intel-hud[data-variant='tactical'] .hud-bottom-right,
&:where(html[dir='rtl'] *):not(.context-docked)
#intel-hud[data-variant='tactical']
+22 -20
View File
@@ -17,6 +17,8 @@ import CockpitProgress from './panels/CockpitProgress.vue';
import CockpitRadar from './panels/CockpitRadar.vue';
import CockpitRollingValue from './panels/CockpitRollingValue.vue';
import CockpitUtilityControls from './panels/CockpitUtilityControls.vue';
import UiButton from '../kit/UiButton.vue';
import UiIcon from '../kit/UiIcon.vue';
// The Cockpit HUD. The Cockpit controller presents the instruments, the
// destination arrow and the vision selector on every HUD update; until it
@@ -180,7 +182,7 @@ const tickStyle = (tick) =>
<span v-for="(tick, index) in hud.speedRim.ticks" :key="index" data-speed-rim-tick :hidden="tick.hidden" :class="{ major: tick.major }" :style="tickStyle(tick)"><b>{{ tick.label }}</b><i></i></span>
</div>
<div class="cockpit-altitude-rim-pointer">
<span class="material-symbols-outlined">arrow_right</span>
<UiIcon name="arrow_right" :size="null" />
<strong id="cockpit-speed-rim-value">{{ hud.speedRim.value }}</strong>
</div>
</div>
@@ -192,7 +194,7 @@ const tickStyle = (tick) =>
</div>
<div class="cockpit-altitude-rim-pointer">
<strong id="cockpit-altitude-rim-value">{{ hud.altitudeRim.value }}</strong>
<span class="material-symbols-outlined">arrow_left</span>
<UiIcon name="arrow_left" :size="null" />
</div>
</div>
<div class="cockpit-topline">
@@ -202,21 +204,21 @@ const tickStyle = (tick) =>
<span id="cockpit-aircraft-meta" v-class-toggle="{ emergency: hud.meta.emergency }" class="cockpit-aircraft-meta" :data-tone="generic ? hud.meta.tone : undefined">{{ hud.meta.text }}</span>
</div>
<div class="cockpit-vision-controls" role="group" :aria-label="t('Cockpit vision style')">
<button id="cockpit-vision-previous" class="cockpit-vision-nav" type="button" :aria-label="t('Previous cockpit vision style')" :title="t('Previous vision style')">
<span class="material-symbols-outlined" aria-hidden="true">chevron_left</span>
<UiButton id="cockpit-vision-previous" class="cockpit-vision-nav" :aria-label="t('Previous cockpit vision style')" :title="t('Previous vision style')">
<UiIcon name="chevron_left" :size="null" />
<small>{{ t('PREV') }}</small>
</button>
<button id="cockpit-vision-current" class="cockpit-vision-current" type="button" :data-cockpit-vision="v.mode" :aria-label="visionLabel" :title="visionTitle">
</UiButton>
<UiButton id="cockpit-vision-current" class="cockpit-vision-current" :data-cockpit-vision="v.mode" :aria-label="visionLabel" :title="visionTitle">
<small>{{ t('CURRENT') }}</small>
<strong id="cockpit-vision-current-label" aria-live="polite">{{ v.label }}</strong>
</button>
<button id="cockpit-vision-next" class="cockpit-vision-nav" type="button" :aria-label="t('Next cockpit vision style')" :title="t('Next vision style')">
</UiButton>
<UiButton id="cockpit-vision-next" class="cockpit-vision-nav" :aria-label="t('Next cockpit vision style')" :title="t('Next vision style')">
<small>{{ t('NEXT') }}</small>
<span class="material-symbols-outlined" aria-hidden="true">chevron_right</span>
</button>
<UiIcon name="chevron_right" :size="null" />
</UiButton>
</div>
</div>
<div v-if="!orbital && !generic" class="cockpit-reticle material-symbols-outlined" aria-hidden="true">my_location</div>
<UiIcon v-if="!orbital && !generic" name="my_location" class="cockpit-reticle" :size="null" />
<!-- A provider's banner: a status that names where the subject is. -->
<div v-if="generic && hud.banner" class="cockpit-banner" role="status" :data-tone="hud.banner.tone">
<strong>{{ hud.banner.title }}</strong>
@@ -225,9 +227,9 @@ const tickStyle = (tick) =>
<!-- A view turned off its rest says where it looks and offers the way back. -->
<div v-if="looks" class="cockpit-look" :hidden="!look.offset">
<span id="cockpit-look-readout" class="cockpit-look-readout" aria-live="polite">{{ look.readout }}</span>
<button id="cockpit-look-ahead" type="button" class="cockpit-look-ahead" :aria-label="aheadLabel" :title="t('Look ahead (Home or 0)')" aria-keyshortcuts="Home 0">
<UiButton id="cockpit-look-ahead" class="cockpit-look-ahead" :aria-label="aheadLabel" :title="t('Look ahead (Home or 0)')" aria-keyshortcuts="Home 0">
<span>{{ t('LOOK AHEAD') }}</span>
</button>
</UiButton>
</div>
<div v-if="!orbital" class="cockpit-compass" :aria-label="generic ? hudLabel : bridge ? t('Current vessel heading') : t('Current aircraft heading')">
<div class="cockpit-instrument-row">
@@ -250,7 +252,7 @@ const tickStyle = (tick) =>
<span class="cockpit-readout-unit">{{ t('FT') }}</span>
</div>
</div>
<span class="cockpit-heading-caret material-symbols-outlined" aria-hidden="true">arrow_drop_down</span>
<UiIcon name="arrow_drop_down" class="cockpit-heading-caret" :size="null" />
<div class="cockpit-compass-tape" id="cockpit-compass-tape" aria-hidden="true" :style="bridge ? { '--tape-shift': tapeShift } : undefined"><span v-for="division in hud.compass" :key="division.heading ?? division.slot" :class="(division.active ?? division.slot === 0) ? 'active' : ''" :style="{ '--slot': division.slot, '--depth': Math.abs(division.slot) }">{{ division.label }}</span><template v-if="bridge"><i v-if="hud.compassMarkers?.prograde != null" class="cockpit-compass-marker cockpit-compass-prograde" aria-hidden="true" :style="{ '--slot': hud.compassMarkers.prograde }"></i><i v-if="hud.compassMarkers?.retrograde != null" class="cockpit-compass-marker cockpit-compass-retrograde" aria-hidden="true" :style="{ '--slot': hud.compassMarkers.retrograde }"></i></template></div>
</div>
<div v-if="!orbital" class="cockpit-position-readout">
@@ -283,13 +285,13 @@ const tickStyle = (tick) =>
</section>
<nav id="view-switcher" :aria-label="t('View switcher')">
<button id="cockpit-reset-globe" type="button" :aria-label="resetBusy ? t('Resetting cockpit to full globe view') : t('Reset cockpit to full globe view')" :title="t('Exit cockpit and return to full globe view')" :hidden="!active" @click="globe.act('reset')">
<span class="material-symbols-outlined" aria-hidden="true">public</span>
<UiButton id="cockpit-reset-globe" :aria-label="resetBusy ? t('Resetting cockpit to full globe view') : t('Reset cockpit to full globe view')" :title="t('Exit cockpit and return to full globe view')" :hidden="!active" @click="globe.act('reset')">
<UiIcon name="public" :size="null" />
<span>{{ t('RESET') }}</span>
</button>
<button id="map-view-switch" type="button" :aria-label="exitLabel" aria-keyshortcuts="Escape" :title="exitLabel" :hidden="!active">
<span class="material-symbols-outlined" aria-hidden="true">close_fullscreen</span>
</UiButton>
<UiButton id="map-view-switch" :aria-label="exitLabel" aria-keyshortcuts="Escape" :title="exitLabel" :hidden="!active">
<UiIcon name="close_fullscreen" :size="null" />
<span>{{ exitText }}</span>
</button>
</UiButton>
</nav>
</template>
+19 -19
View File
@@ -72,45 +72,45 @@ function selectMapSource(chip) {
<div v-if="slot === 'control'" id="control-panel" v-panel-state="'control-panel'" class="panel-collapsible collapsed">
<div class="panel-glow"></div>
<div class="panel-inner">
<button id="control-panel-toggle" class="panel-header dock-tray-toggle" type="button"
<UiButton id="control-panel-toggle" class="panel-header dock-tray-toggle"
data-dock-toggle-target="control-panel" :aria-expanded="String(panels['control-panel']?.collapsed === false)"
aria-controls="control-panel-popover" :aria-label="trayWords('control-panel', t('VISUAL PRESETS'), t('Expand Visual Presets'))" :title="trayWords('control-panel', t('VISUAL PRESETS'), undefined)">
<span class="panel-title"><span class="dock-label-icon dock-label-icon-presets" aria-hidden="true"></span>{{ t('VISUAL PRESETS') }}</span>
<span class="panel-divider"></span>
</button>
</UiButton>
<div id="control-panel-popover" class="dock-popover-content">
<UiButton class="dock-pin-btn" data-pin-target="control-panel" :label="t('Pin visual presets')" :title="t('Keep visual presets open')" :pressed="!!panels['control-panel']?.pinned" @click="pin($event, 'control-panel')"><img src="/pin.svg" alt="" /></UiButton>
<div id="style-buttons" class="button-grid">
<button class="style-btn active" data-style="normal" @click="display.act('setStyle', 'normal')" v-class-toggle="{ ...(style && { active: style.name === 'normal' }) }" :title="t('Show the globe without a visual filter.')">
<UiButton class="style-btn" data-style="normal" :pressed="!style || style.name === 'normal'" pressed-class="active" @click="display.act('setStyle', 'normal')" :title="t('Show the globe without a visual filter.')">
<span class="btn-icon">◯</span>
<span class="btn-label">{{ t('Normal') }}</span>
<span class="btn-key">1</span>
</button>
<button class="style-btn" data-style="retro" @click="display.act('setStyle', 'retro')" v-class-toggle="{ ...(style && { active: style.name === 'retro' }) }" :title="t('Emulate a green phosphor CRT with scanlines and screen curvature.')">
</UiButton>
<UiButton class="style-btn" data-style="retro" :pressed="style?.name === 'retro'" pressed-class="active" @click="display.act('setStyle', 'retro')" :title="t('Emulate a green phosphor CRT with scanlines and screen curvature.')">
<span class="btn-icon">▦</span>
<span class="btn-label">{{ t('CRT') }}</span>
<span class="btn-key">2</span>
</button>
<button class="style-btn" data-style="surveillance" @click="display.act('setStyle', 'surveillance')" v-class-toggle="{ ...(style && { active: style.name === 'surveillance' }) }" :title="t('Simulate night-vision goggles with green intensification and a tube vignette.')">
</UiButton>
<UiButton class="style-btn" data-style="surveillance" :pressed="style?.name === 'surveillance'" pressed-class="active" @click="display.act('setStyle', 'surveillance')" :title="t('Simulate night-vision goggles with green intensification and a tube vignette.')">
<span class="btn-icon">🌙</span>
<span class="btn-label">{{ t('NVG') }}</span>
<span class="btn-key">3</span>
</button>
<button class="style-btn" data-style="thermal" @click="display.act('setStyle', 'thermal')" v-class-toggle="{ ...(style && { active: style.name === 'thermal' }) }" :title="t('Simulate FLIR-style thermal contrast. Turn up Ironbow for color.')">
</UiButton>
<UiButton class="style-btn" data-style="thermal" :pressed="style?.name === 'thermal'" pressed-class="active" @click="display.act('setStyle', 'thermal')" :title="t('Simulate FLIR-style thermal contrast. Turn up Ironbow for color.')">
<span class="btn-icon">🌡️</span>
<span class="btn-label">{{ t('FLIR') }}</span>
<span class="btn-key">4</span>
</button>
<button class="style-btn" data-style="anime" @click="display.act('setStyle', 'anime')" v-class-toggle="{ ...(style && { active: style.name === 'anime' }) }" :title="t('Apply bright cel-shaded color and illustrated outlines.')">
</UiButton>
<UiButton class="style-btn" data-style="anime" :pressed="style?.name === 'anime'" pressed-class="active" @click="display.act('setStyle', 'anime')" :title="t('Apply bright cel-shaded color and illustrated outlines.')">
<span class="btn-icon">✦</span>
<span class="btn-label">{{ t('Anime') }}</span>
<span class="btn-key">5</span>
</button>
<button class="style-btn" data-style="noir" @click="display.act('setStyle', 'noir')" v-class-toggle="{ ...(style && { active: style.name === 'noir' }) }" :title="t('Apply high-contrast monochrome film-noir grading.')">
</UiButton>
<UiButton class="style-btn" data-style="noir" :pressed="style?.name === 'noir'" pressed-class="active" @click="display.act('setStyle', 'noir')" :title="t('Apply high-contrast monochrome film-noir grading.')">
<span class="btn-icon">◐</span>
<span class="btn-label">{{ t('Noir') }}</span>
<span class="btn-key">6</span>
</button>
</UiButton>
</div>
<section class="map-source-section" aria-labelledby="map-source-label">
<div class="map-source-heading">
@@ -134,10 +134,10 @@ function selectMapSource(chip) {
<div class="panel-glow"></div>
<div class="location-inner">
<div class="location-toolbar">
<button id="location-bar-toggle" class="dock-tray-toggle" type="button" data-dock-toggle-target="location-bar" aria-controls="location-bar-popover" :aria-expanded="String(panels['location-bar']?.collapsed === false)" :aria-label="trayWords('location-bar', t('LOCATION'), t('Expand LOCATION'))" :title="trayWords('location-bar', t('LOCATION'), t('Expand LOCATION'))">
<UiButton id="location-bar-toggle" class="dock-tray-toggle" data-dock-toggle-target="location-bar" aria-controls="location-bar-popover" :aria-expanded="String(panels['location-bar']?.collapsed === false)" :aria-label="trayWords('location-bar', t('LOCATION'), t('Expand LOCATION'))" :title="trayWords('location-bar', t('LOCATION'), t('Expand LOCATION'))">
<span class="location-toolbar-label"><span class="dock-label-icon dock-label-icon-location" aria-hidden="true"></span>{{ t('LOCATION') }}</span>
</button>
<button class="panel-collapse-btn" data-collapse-target="location-bar" :title="t('Collapse panel')" @click="chrome.act('toggle', 'location-bar')">+</button>
</UiButton>
<UiButton class="panel-collapse-btn" data-collapse-target="location-bar" :title="t('Collapse panel')" @click="chrome.act('toggle', 'location-bar')">+</UiButton>
</div>
<div id="location-mini-status" class="location-mini-status" aria-live="polite">
<div id="location-mini-city" class="location-mini-city">{{ loc ? loc.status.city : t('📍 Location: --') }}</div>
@@ -150,9 +150,9 @@ function selectMapSource(chip) {
<div class="location-city-row">
<div id="location-pills" class="location-pills"><UiButton v-for="city in loc?.cities" :key="city.id" class="location-pill" :pressed="Boolean(city.active)" pressed-class="active" :data-location-id="city.id" @click="locationControls?.chooseCity(city.id)">{{ city.label }}</UiButton></div>
<div class="location-search-wrap">
<button id="search-toggle" class="search-toggle-btn" :title="t('Search any location')" @click="locationControls?.toggleSearch()">
<UiButton id="search-toggle" class="search-toggle-btn" :title="t('Search any location')" @click="locationControls?.toggleSearch()">
<span>&#x1F50E;</span>
</button>
</UiButton>
<input type="text" id="location-search" v-class-toggle="{ expanded: !!loc?.searchExpanded, searching: !!loc?.searching }" :placeholder="t('Search any location...')" autocomplete="off" spellcheck="false" :aria-label="t('Search location by name or coordinates')" :aria-invalid="loc?.searchOrigin !== 'omnibar' && loc?.searchError ? 'true' : null" :aria-describedby="loc?.searchOrigin !== 'omnibar' && loc?.searchError ? 'location-search-error' : null" />
</div>
</div>
+21 -20
View File
@@ -19,6 +19,7 @@ import LivePanel from './panels/LivePanel.vue';
import RadioPanel from './panels/RadioPanel.vue';
import StationPanel from './panels/StationPanel.vue';
import UiButton from '../kit/UiButton.vue';
import UiIcon from '../kit/UiIcon.vue';
import UiSearchField from '../kit/UiSearchField.vue';
import { cockpitEntryFace } from '../cockpitPresentation.js';
import { LAYER_TABS, TAB_AFFECTS, activeTab, availableTabs, contextReady, enabledLayerIds, setEnabledLayers, tabTarget } from '../contextLayerTabs.js';
@@ -184,27 +185,27 @@ watch(
</RailPanel>
<RailPanel id="global-context-panel" start-collapsed v-class-toggle="{ ...(ctx && { 'context-enabled': ctx.enabled }) }" :data-context-mode="ctx?.mode" :data-context-tab="activeTab" :title="t('CONTEXT')" sideways scroll rail-scroller>
<template #actions>
<button type="button" class="context-dock-btn" :aria-pressed="String(contextSearchOpen)" :aria-label="contextSearchOpen ? t('Close Context search') : t('Search in Context')" :title="contextSearchOpen ? t('Close search') : t('Search in Context')" @click="toggleSearch">
<span class="material-symbols-outlined" aria-hidden="true">search</span>
</button>
<button type="button" class="context-dock-btn" :aria-pressed="String(docked)" :aria-label="docked ? t('Shrink Context back to a panel') : t('Expand Context to a full-height column')" :title="docked ? t('Shrink') : t('Expand')" @click="setDocked(!docked)">
<span class="material-symbols-outlined" aria-hidden="true">{{ docked ? 'close_fullscreen' : 'open_in_full' }}</span>
</button>
<UiButton class="context-dock-btn" :pressed="Boolean(contextSearchOpen)" :aria-label="contextSearchOpen ? t('Close Context search') : t('Search in Context')" :title="contextSearchOpen ? t('Close search') : t('Search in Context')" @click="toggleSearch">
<UiIcon name="search" :size="null" />
</UiButton>
<UiButton class="context-dock-btn" :pressed="docked" :aria-label="docked ? t('Shrink Context back to a panel') : t('Expand Context to a full-height column')" :title="docked ? t('Shrink') : t('Expand')" @click="setDocked(!docked)">
<UiIcon :name="docked ? 'close_fullscreen' : 'open_in_full'" :size="null" />
</UiButton>
</template>
<div class="cyber-panel-body ui-scroll" data-rail-scroller>
<UiSearchField v-if="contextSearchOpen" ref="searchInput" v-model="contextSearchText" class="context-search" role="search" input-class="context-search__input" :label="searchHint" :placeholder="searchHint" autocomplete="off" spellcheck="false" :clear-label="t('Clear search')" clear-class="context-search__clear" @escape="closeContextSearch" />
<div v-if="availableTabs.length" class="context-tabs" role="tablist" :aria-label="t('Context tabs')">
<button id="context-tab-btn-view" type="button" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'view' }" :aria-selected="String(activeTab === 'view')" aria-controls="context-tab-view" :tabindex="activeTab === 'view' ? 0 : -1" @click="activeTab = 'view'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
<span class="material-symbols-outlined" aria-hidden="true">visibility</span><span class="context-tabs__label">{{ t('Inspector') }}</span>
</button>
<button id="context-tab-btn-props" type="button" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'props' }" :aria-selected="String(activeTab === 'props')" aria-controls="context-tab-props" :tabindex="activeTab === 'props' ? 0 : -1" @click="activeTab = 'props'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
<span class="material-symbols-outlined" aria-hidden="true">tune</span><span class="context-tabs__label">{{ t('Properties') }}</span>
</button>
<UiButton id="context-tab-btn-view" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'view' }" :aria-selected="String(activeTab === 'view')" aria-controls="context-tab-view" :tabindex="activeTab === 'view' ? 0 : -1" @click="activeTab = 'view'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
<UiIcon name="visibility" :size="null" /><span class="context-tabs__label">{{ t('Inspector') }}</span>
</UiButton>
<UiButton id="context-tab-btn-props" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'props' }" :aria-selected="String(activeTab === 'props')" aria-controls="context-tab-props" :tabindex="activeTab === 'props' ? 0 : -1" @click="activeTab = 'props'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
<UiIcon name="tune" :size="null" /><span class="context-tabs__label">{{ t('Properties') }}</span>
</UiButton>
</div>
<!-- Properties: settings of the layers that are on, one section each. -->
<div id="context-tab-props" class="context-props" :hidden="activeTab !== 'props'" role="tabpanel" aria-labelledby="context-tab-btn-props">
<section v-for="tab in LAYER_TABS" v-show="isShown(tab.id)" :key="tab.id" class="context-props__section">
<h4 class="context-props__heading"><span class="material-symbols-outlined" aria-hidden="true">{{ tab.icon }}</span>{{ t(tab.label) }}</h4>
<h4 class="context-props__heading"><UiIcon :name="tab.icon" :size="null" />{{ t(tab.label) }}</h4>
<ul v-if="affects(tab.id).length" class="context-props__layers">
<li v-for="layer in affects(tab.id)" :key="layer.id"><i :style="{ background: layer.color }" aria-hidden="true"></i>{{ layer.name }}</li>
</ul>
@@ -218,10 +219,10 @@ watch(
<LivePanel />
<RadioPanel />
<div class="global-context-modes" role="tablist" :aria-label="t('Context mode')">
<button id="global-context-flights-btn" class="context-mode-button" v-class-toggle="{ active: ctx?.flightsActive }" type="button" role="tab" tabindex="0" :aria-selected="String(ctx?.flightsActive ?? false)" :aria-disabled="ctx && String(ctx.busy)" :aria-busy="ctx && String(ctx.busy)" aria-controls="context-flights-view" :aria-label="t('CONTACTS')" :title="t('Cycles the nearest contacts of whatever type you select — planes, vessels, installations. Satellites track independently.')">
<span class="material-symbols-outlined" aria-hidden="true">radar</span>
<UiButton id="global-context-flights-btn" class="context-mode-button" v-class-toggle="{ active: ctx?.flightsActive }" role="tab" tabindex="0" :aria-selected="String(ctx?.flightsActive ?? false)" :aria-disabled="ctx && String(ctx.busy)" :aria-busy="ctx && String(ctx.busy)" aria-controls="context-flights-view" :aria-label="t('CONTACTS')" :title="t('Cycles the nearest contacts of whatever type you select — planes, vessels, installations. Satellites track independently.')">
<UiIcon name="radar" :size="null" />
<span>{{ t('CONTACTS') }}</span>
</button>
</UiButton>
</div>
<div id="context-mode-standby" class="context-mode-standby" :hidden="ctx?.enabled">
<strong>{{ t('SELECT CONTEXT') }}</strong>
@@ -229,11 +230,11 @@ watch(
</div>
<section id="context-flights-view" class="context-mode-view" role="tabpanel" aria-labelledby="global-context-flights-btn" :hidden="!ctx?.flightsActive">
<div class="global-context-actions" :aria-label="t('Contact Context actions')">
<button id="cockpit-entry" type="button" :hidden="!cockpit?.entryAvailable">
<span class="material-symbols-outlined" aria-hidden="true">{{ entry.icon }}</span>
<UiButton id="cockpit-entry" :hidden="!cockpit?.entryAvailable">
<UiIcon :name="entry.icon" :size="null" />
<span>{{ entry.label }}</span>
</button>
<button id="installations-search-btn" class="panel-layer-toggle" type="button" :aria-disabled="ctx && String(ctx.installationsBusy)" :aria-busy="ctx && String(ctx.installationsBusy)">{{ t('SEARCH NEARBY SITES') }}</button>
</UiButton>
<UiButton id="installations-search-btn" class="panel-layer-toggle" :aria-disabled="ctx && String(ctx.installationsBusy)" :aria-busy="ctx && String(ctx.installationsBusy)">{{ t('SEARCH NEARBY SITES') }}</UiButton>
<UiButton id="tr3b-toggle" class="tr3b-toggle" :pressed="!!cockpit?.tr3b?.converted" :hidden="!cockpit?.tr3b" :aria-label="t('Reclassify tracked contact as TR-3B')" :title="cockpit?.tr3b?.converted ? t('Restore real aircraft') : t('Reclassify as TR-3B')">🛸</UiButton>
</div>
<AwarenessPanel v-if="!contactsMatchCard" />
+2 -1
View File
@@ -2,11 +2,12 @@
import { t } from '../../i18n/index.js';
import { useDisplayStore } from '../stores/display.js';
import DisplayPanel from './panels/DisplayPanel.vue';
import UiButton from '../kit/UiButton.vue';
const display = useDisplayStore();
</script>
<template>
<DisplayPanel />
<button id="clean-view-exit" @click="display.act('exitCleanView')" :title="t('Return UI controls')">{{ t('EXIT CLEAN VIEW') }}</button>
<UiButton id="clean-view-exit" @click="display.act('exitCleanView')" :title="t('Return UI controls')">{{ t('EXIT CLEAN VIEW') }}</UiButton>
</template>
+5 -3
View File
@@ -4,6 +4,8 @@ import { storeToRefs } from 'pinia';
import { useHudStore } from '../stores/hud.js';
import { useCockpitStore } from '../stores/cockpit.js';
import { cockpitEntryFace } from '../cockpitPresentation.js';
import UiButton from '../kit/UiButton.vue';
import UiIcon from '../kit/UiIcon.vue';
// The readouts, visibility, layout variant and colors IntelHUD publishes.
const { hud } = storeToRefs(useHudStore());
@@ -56,10 +58,10 @@ const entry = computed(() =>
<div class="hud-readout"><div id="hud-gsd">{{ view.gsd }}</div></div>
<div class="hud-readout"><div id="hud-alt">{{ view.alt }}</div></div>
<div class="hud-readout"><div id="hud-ais-vessel" :class="['hud-ais-vessel', { active: view.vessel.active }]">{{ view.vessel.text }}</div></div>
<button id="cockpit-entry-readout" type="button" :hidden="!cockpit?.entryAvailable">
<span class="material-symbols-outlined" aria-hidden="true">{{ entry.icon }}</span>
<UiButton id="cockpit-entry-readout" :hidden="!cockpit?.entryAvailable">
<UiIcon :name="entry.icon" :size="null" />
<span>{{ entry.label }}</span>
</button>
</UiButton>
</div>
<div class="hud-bracket">┘</div>
</div>
+2
View File
@@ -12,6 +12,7 @@ import SceneOptions from './SceneOptions.vue';
import SceneShotList from './SceneShotList.vue';
import CctvPanel from './panels/CctvPanel.vue';
import StreetLevelPanel from './panels/StreetLevelPanel.vue';
import StreetLevelPhotoViewer from './panels/StreetLevelPhotoViewer.vue';
import DrawControls from './panels/DrawControls.vue';
import GeoImport from './panels/GeoImport.vue';
import UiSelect from '../kit/UiSelect.js';
@@ -71,6 +72,7 @@ async function importChosen(event) {
<!-- Street Level Panel (moved into #right-context-rail at runtime) -->
<StreetLevelPanel />
<StreetLevelPhotoViewer />
<!-- Scene Director Panel -->
<RailPanel id="scene-panel" start-collapsed v-class-toggle="{ running: scene?.running, 'has-shots': scene?.hasShots }" :title="t('AUTHORING')" :hint="t('Create and edit scenes')" scroll>
+8 -6
View File
@@ -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>
+1 -1
View File
@@ -78,7 +78,7 @@ const vToastText = {
<!-- Title -->
<div id="title-bar">
<div class="title-glow"></div>
<h1 aria-labelledby="title-wordmark"><button type="button" class="title-logo brand-logo" data-logo-gaze data-logo-src="/logo.svg" :aria-label="t('Back to live at the starting view')" :title="t('Back to live at the starting view')" @click="globeActions.act('home')"><img src="/logo.svg" alt="" /></button> <span id="title-wordmark" translate="no">GOD'S EYE <span class="title-accent">VIEW</span></span></h1>
<h1 aria-labelledby="title-wordmark"><UiButton class="title-logo brand-logo" data-logo-gaze data-logo-src="/logo.svg" :aria-label="t('Back to live at the starting view')" :title="t('Back to live at the starting view')" @click="globeActions.act('home')"><img src="/logo.svg" alt="" /></UiButton> <span id="title-wordmark" translate="no">GOD'S EYE <span class="title-accent">VIEW</span></span></h1>
<p class="subtitle scene-text-holdout">{{ t('NO PLACE LEFT BEHIND') }}</p>
<div v-if="fps" class="frame-rate-readout scene-text-holdout" :hidden="!fps.visible" :title="t('Rendered globe frames per second · toggle with `')">{{ fps.text }}</div>
</div>
+3 -3
View File
@@ -152,9 +152,9 @@ function markPopSeen() {
/* storage off: the popup comes back next visit */
}
}
function openExplore() {
markPopSeen();
store.controller.open();
async function openExplore() {
// A refused open (Cockpit) leaves the announcement unread.
if (await store.controller.open()) markPopSeen();
}
// ── Opened in GEV: a toast that leads back to the story ──
+5 -4
View File
@@ -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>
+11 -10
View File
@@ -2,6 +2,7 @@
import { storeToRefs } from 'pinia';
import { t } from '../../../i18n/index.js';
import { useBhoteKoshiPanelStore } from '../../stores/bhoteKoshiPanel.js';
import UiButton from '../../kit/UiButton.vue';
import UiCloseButton from '../../kit/UiCloseButton.vue';
import UiSlider from '../../kit/UiSlider.js';
@@ -44,30 +45,30 @@ const sliderValue = (event, scale) => Number(event.target.value) / scale;
</div>
<UiSlider class="bhote-event-range flood" unstyled data-role="progress" min="0" max="1000" :model-value="panel.refs.progressInput.value" :hidden="panel.refs.progressInput.hidden" :disabled="panel.refs.progressInput.disabled" :aria-label="panel.refs.progressInput.attributes['aria-label']" @update:model-value="call('previewProgress', $event / 1000)" @change="call('commitProgress', sliderValue($event, 1000), { final: true })" />
<div class="bhote-event-story-nav" :aria-label="t('Story beat navigation')">
<button type="button" data-action="previous-beat" :title="t('Previous story beat')" :aria-label="panel.refs.previousButton.attributes['aria-label']" :disabled="panel.refs.previousButton.disabled" @click="call('previousBeat')">‹</button>
<UiButton data-action="previous-beat" :title="t('Previous story beat')" :aria-label="panel.refs.previousButton.attributes['aria-label']" :disabled="panel.refs.previousButton.disabled" @click="call('previousBeat')">‹</UiButton>
<div class="bhote-event-story-current">
<span data-role="beat-index">{{ panel.refs.beatIndex.textContent }}</span>
<strong data-role="beat-title" aria-live="polite">{{ panel.refs.beatTitle.textContent }}</strong>
<small data-role="beat-meta">{{ panel.refs.beatMeta.textContent }}</small>
</div>
<button type="button" data-action="next-beat" :title="t('Next story beat')" :aria-label="panel.refs.nextButton.attributes['aria-label']" :disabled="panel.refs.nextButton.disabled" @click="call('nextBeat')">›</button>
<UiButton data-action="next-beat" :title="t('Next story beat')" :aria-label="panel.refs.nextButton.attributes['aria-label']" :disabled="panel.refs.nextButton.disabled" @click="call('nextBeat')">›</UiButton>
</div>
<div class="bhote-event-actions">
<button type="button" data-action="play" :aria-label="panel.refs.playButton.attributes['aria-label']" :disabled="panel.refs.playButton.disabled" @click="call('play')">{{ panel.refs.playButton.textContent }}</button>
<button type="button" data-action="play-scene" :hidden="panel.refs.playSceneButton.hidden" :title="t('Play the next shot and continue through this scene')" :aria-label="panel.refs.playSceneButton.attributes['aria-label']" :disabled="panel.refs.playSceneButton.disabled" @click="call('playScene')">{{ panel.refs.playSceneButton.textContent }}</button>
<button type="button" data-action="cinematic" :aria-pressed="panel.refs.cinematicButton.attributes['aria-pressed']" :hidden="panel.refs.cinematicButton.hidden" :disabled="panel.refs.cinematicButton.disabled" @click="call('toggleCinematic')">{{ panel.refs.cinematicButton.textContent }}</button>
<button type="button" data-action="story-replay" :aria-label="panel.refs.storyReplayButton.attributes['aria-label']" :hidden="panel.refs.storyReplayButton.hidden" :disabled="panel.refs.storyReplayButton.disabled" @click="call('replayCinematic')">{{ panel.refs.storyReplayButton.textContent }}</button>
<button type="button" data-action="open-source" :hidden="panel.refs.openSourceButton.hidden" :disabled="panel.refs.openSourceButton.disabled" @click="call('openActiveSource')">{{ t('↗ OPEN ORIGINAL') }}</button>
<button type="button" data-action="corridor" :hidden="panel.refs.corridorButton.hidden" :disabled="panel.refs.corridorButton.disabled" @click="call('focusCorridor')">{{ t('⌖ LOWER GORGE') }}</button>
<UiButton data-action="play" :aria-label="panel.refs.playButton.attributes['aria-label']" :disabled="panel.refs.playButton.disabled" @click="call('play')">{{ panel.refs.playButton.textContent }}</UiButton>
<UiButton data-action="play-scene" :hidden="panel.refs.playSceneButton.hidden" :title="t('Play the next shot and continue through this scene')" :aria-label="panel.refs.playSceneButton.attributes['aria-label']" :disabled="panel.refs.playSceneButton.disabled" @click="call('playScene')">{{ panel.refs.playSceneButton.textContent }}</UiButton>
<UiButton data-action="cinematic" :pressed="Boolean(panel.refs.cinematicButton.pressed)" :hidden="panel.refs.cinematicButton.hidden" :disabled="panel.refs.cinematicButton.disabled" @click="call('toggleCinematic')">{{ panel.refs.cinematicButton.textContent }}</UiButton>
<UiButton data-action="story-replay" :aria-label="panel.refs.storyReplayButton.attributes['aria-label']" :hidden="panel.refs.storyReplayButton.hidden" :disabled="panel.refs.storyReplayButton.disabled" @click="call('replayCinematic')">{{ panel.refs.storyReplayButton.textContent }}</UiButton>
<UiButton data-action="open-source" :hidden="panel.refs.openSourceButton.hidden" :disabled="panel.refs.openSourceButton.disabled" @click="call('openActiveSource')">{{ t('↗ OPEN ORIGINAL') }}</UiButton>
<UiButton data-action="corridor" :hidden="panel.refs.corridorButton.hidden" :disabled="panel.refs.corridorButton.disabled" @click="call('focusCorridor')">{{ t('⌖ LOWER GORGE') }}</UiButton>
</div>
</section>
<details class="bhote-event-evidence">
<summary>{{ t('FIELD REPORTS · {count}', { count: panel.reports.length }) }}</summary>
<div class="bhote-event-report-list"><button v-for="(report, index) in panel.reports" :key="index" type="button" class="bhote-event-report" @click="call('openReport', index)"><span>{{ report.label }}</span><small>{{ report.status }}</small></button></div>
<div class="bhote-event-report-list"><UiButton v-for="(report, index) in panel.reports" :key="index" class="bhote-event-report" @click="call('openReport', index)"><span>{{ report.label }}</span><small>{{ report.status }}</small></UiButton></div>
</details>
<div class="bhote-event-credit">
<span>{{ t('GEOLOCATIONS · {credit}', { credit: 'GEO GEORGE SHADRACH' }) }}</span>
<button type="button" data-action="geolocation-map" @click="call('openGeolocationMap')">{{ t('↗ OPEN PUBLIC MAP') }}</button>
<UiButton data-action="geolocation-map" @click="call('openGeolocationMap')">{{ t('↗ OPEN PUBLIC MAP') }}</UiButton>
</div>
<p class="bhote-event-caveat"><span data-role="caveat">{{ panel.refs.caveat.textContent }}</span><span data-role="imagery-cloud-note" :hidden="panel.refs.imageryCloudNote.hidden">{{ t(' Clouds are preserved from the source imagery.') }}</span></p>
</aside>
+2 -1
View File
@@ -1,6 +1,7 @@
<script setup>
import { storeToRefs } from 'pinia';
import { useCelestialRingStore } from '../../stores/celestialRing.js';
import UiIcon from '../../kit/UiIcon.vue';
// The full-globe sun/moon ring, inside the viewer's container, as the ring
// owner (src/celestialRing.js) presents it.
@@ -44,6 +45,6 @@ const markerStyle = (marker) =>
<template>
<Teleport v-if="ring" :to="ring.container">
<div :key="ring.id" id="celestial-ring-overlay" class="celestial-ring-overlay" :class="{ visible: ring.visible, disabled: !ring.enabled }" aria-hidden="true" :data-globe-visible="ring.globeVisible ?? undefined" :data-ephemeris-updates="ring.ephemerisUpdates ?? undefined"><div class="celestial-ring-outline" :style="outlineStyle(ring.outline)"></div><canvas v-ring-canvas="{ owner: ring.owner, kind: 'sun' }" class="celestial-ring-canvas celestial-sun-canvas" :style="layerStyle(ring.sun)"></canvas><canvas v-ring-canvas="{ owner: ring.owner, kind: 'moon' }" class="celestial-ring-canvas celestial-moon-canvas" :style="layerStyle(ring.moon)"></canvas><span class="celestial-marker celestial-sun material-symbols-outlined" :style="markerStyle(ring.sunMarker)">light_mode</span><span class="celestial-marker celestial-moon material-symbols-outlined" :style="markerStyle(ring.moonMarker)">dark_mode</span></div>
<div :key="ring.id" id="celestial-ring-overlay" class="celestial-ring-overlay" :class="{ visible: ring.visible, disabled: !ring.enabled }" aria-hidden="true" :data-globe-visible="ring.globeVisible ?? undefined" :data-ephemeris-updates="ring.ephemerisUpdates ?? undefined"><div class="celestial-ring-outline" :style="outlineStyle(ring.outline)"></div><canvas v-ring-canvas="{ owner: ring.owner, kind: 'sun' }" class="celestial-ring-canvas celestial-sun-canvas" :style="layerStyle(ring.sun)"></canvas><canvas v-ring-canvas="{ owner: ring.owner, kind: 'moon' }" class="celestial-ring-canvas celestial-moon-canvas" :style="layerStyle(ring.moon)"></canvas><UiIcon class="celestial-marker celestial-sun" name="light_mode" :size="null" :style="markerStyle(ring.sunMarker)" /><UiIcon class="celestial-marker celestial-moon" name="dark_mode" :size="null" :style="markerStyle(ring.moonMarker)" /></div>
</Teleport>
</template>
+15 -14
View File
@@ -5,7 +5,10 @@ import { t } from '../../../i18n/index.js';
import { useVoiceStore } from '../../stores/voice.js';
import { ASSISTANT_NAME } from '../../../voice/control.js';
import PanelLayoutButtons from './PanelLayoutButtons.vue';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
import UiCloseButton from '../../kit/UiCloseButton.vue';
import UiSelect from '../../kit/UiSelect.js';
// The typed chat in the command dock, as its owner (src/voice/chatControl.js)
// writes the voice control presenter. Messages arrive apart from the view, so
@@ -15,7 +18,6 @@ const store = useVoiceStore();
const { controls, chat: messages } = storeToRefs(store);
const emit = (name, ...args) => controls.value?.emit(name, ...args);
const list = ref(null);
const layerSelect = ref(null);
const layerChoice = ref('');
// The input holds what the person types until its owner writes it (history
@@ -55,7 +57,6 @@ watch(messages, (next, previous) => {
function attachLayer() {
const value = layerChoice.value;
layerChoice.value = '';
if (layerSelect.value) layerSelect.value.value = '';
if (value) emit('chat-layer', value);
}
@@ -68,7 +69,7 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
<div><strong>{{ t('GEV CHAT') }}</strong><p>{{ t('Ask about the map. Tell it where to go.') }}</p></div>
<div id="gev-chat-header-actions">
<PanelLayoutButtons :docked="props.view.layout.docked" :minimized="props.view.chat.minimized" @dock="emit('layout-dock')" @minimize="emit('chat-minimize')" />
<button v-if="props.view.panel" id="gev-voice-settings-button" class="gev-voice-settings-button" type="button" :aria-label="t('Settings')" :title="t('Settings')" aria-controls="gev-voice-panel" :aria-expanded="String(props.view.voicePanel.settingsExpanded)" @click="emit('settings-button')"><span class="material-symbols-outlined gev-voice-settings-icon" aria-hidden="true">settings</span></button>
<UiButton v-if="props.view.panel" id="gev-voice-settings-button" class="gev-voice-settings-button" :aria-label="t('Settings')" :title="t('Settings')" aria-controls="gev-voice-panel" :aria-expanded="String(props.view.voicePanel.settingsExpanded)" @click="emit('settings-button')"><UiIcon name="settings" class="gev-voice-settings-icon" :size="null" /></UiButton>
<UiCloseButton id="gev-chat-close" :label="t('Close chat')" @click="emit('chat-close')" />
</div>
</header>
@@ -77,7 +78,7 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
<svg viewBox="0 0 24 24" width="32" height="32" fill="none" stroke="currentColor" stroke-width="1" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><ellipse cx="12" cy="12" rx="4" ry="10"></ellipse><path d="M2 12h20"></path></svg>
<h3>{{ t('Explore with a question') }}</h3>
<p>{{ t('Find a place, explore live data, or change your view.') }}</p>
<button v-for="prompt in quickPrompts()" :key="prompt" type="button" :hidden="!props.view.chat.quickChecked" @click="emit('chat-prompt', prompt)">{{ prompt }}</button>
<UiButton v-for="prompt in quickPrompts()" :key="prompt" :hidden="!props.view.chat.quickChecked" @click="emit('chat-prompt', prompt)">{{ prompt }}</UiButton>
</div>
<div v-for="message in messages" :key="message.id" class="gev-chat-message" :data-role="message.role">
<small>{{ message.role === 'user' ? t('YOU') : ASSISTANT_NAME }}</small><span>{{ message.text }}</span>
@@ -87,36 +88,36 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
<!-- Stays under the status for the whole conversation. -->
<p v-if="props.view.chat.authNote" id="gev-chat-auth-note">{{ props.view.chat.authNote }}</p>
<div id="gev-chat-attachments" :aria-label="t('Attachments')" :hidden="!props.view.chat.attachments.length">
<button v-for="item in props.view.chat.attachments" :key="item.key" type="button" :disabled="props.view.chat.locked" :aria-label="`${t('Remove attachment')}: ${item.name}`" @click="emit('chat-attachment-remove', item.key)">{{ item.name }} ×</button>
<UiButton v-for="item in props.view.chat.attachments" :key="item.key" :disabled="props.view.chat.locked" :aria-label="`${t('Remove attachment')}: ${item.name}`" @click="emit('chat-attachment-remove', item.key)">{{ item.name }} ×</UiButton>
</div>
<div id="gev-chat-attach-menu" :hidden="!props.view.chat.attachMenuOpen" @keydown="emit('chat-attach-keydown', $event)">
<label for="gev-chat-layer">{{ t('Attach a map layer') }}</label>
<div id="gev-chat-layer-row">
<select id="gev-chat-layer" ref="layerSelect" :disabled="props.view.chat.locked" @change="layerChoice = $event.target.value" @keydown.enter.prevent="attachLayer()">
<UiSelect id="gev-chat-layer" v-model="layerChoice" :disabled="props.view.chat.locked" @keydown.enter.prevent="attachLayer()">
<option value="">{{ t('Choose a layer…') }}</option>
<option v-for="layer in props.view.chat.layers" :key="layer.value" :value="layer.value">{{ layer.label }}</option>
</select>
<button id="gev-chat-layer-attach" type="button" :disabled="props.view.chat.locked || !layerChoice" @click="attachLayer()">{{ t('Attach layer') }}</button>
</UiSelect>
<UiButton id="gev-chat-layer-attach" :disabled="props.view.chat.locked || !layerChoice" @click="attachLayer()">{{ t('Attach layer') }}</UiButton>
</div>
<button id="gev-chat-file-button" type="button" :disabled="props.view.chat.locked" @click="emit('chat-file-button')">{{ t('Attach a file') }}</button>
<UiButton id="gev-chat-file-button" :disabled="props.view.chat.locked" @click="emit('chat-file-button')">{{ t('Attach a file') }}</UiButton>
<p>{{ t('TXT, Markdown, CSV, JSON or GeoJSON · up to 10 KB in total. Attachments are sent to your AI provider with your message.') }}</p>
<input id="gev-chat-file" type="file" accept=".txt,.md,.csv,.json,.geojson" multiple hidden @change="emit('chat-files', $event.target)" />
</div>
<aside id="gev-chat-mini-reply" :hidden="!props.view.chat.miniReply" :aria-label="t('Latest AI response')">
<header><span translate="no">{{ ASSISTANT_NAME }}</span><button id="gev-chat-expand-reply" type="button" :aria-label="t('Expand conversation')" :title="t('Expand conversation')" @click="emit('chat-restore')"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M14 4h6v6m0-6-7 7M10 20H4v-6m0 6 7-7"></path></svg></button></header>
<header><span translate="no">{{ ASSISTANT_NAME }}</span><UiButton id="gev-chat-expand-reply" :aria-label="t('Expand conversation')" :title="t('Expand conversation')" @click="emit('chat-restore')"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M14 4h6v6m0-6-7 7M10 20H4v-6m0 6 7-7"></path></svg></UiButton></header>
<p id="gev-chat-mini-text" aria-live="polite">{{ props.view.chat.miniReply }}</p>
</aside>
<div id="gev-chat-suggestions" :aria-label="t('Command suggestions')" :hidden="!props.view.chat.suggestions.length">
<div v-for="group in props.view.chat.suggestions" :key="group.label">
<small>{{ group.label }}</small>
<button v-for="command in group.items" :key="command" type="button" :title="command" @click="emit('chat-suggestion', command)">{{ command }}</button>
<UiButton v-for="command in group.items" :key="command" :title="command" @click="emit('chat-suggestion', command)">{{ command }}</UiButton>
</div>
</div>
<form id="gev-chat-form" @submit.prevent="emit('chat-submit')">
<button id="gev-chat-restore" type="button" :aria-label="t('Expand chat')" :title="t('Expand chat')" @click="emit('chat-restore')"><svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M5 4h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-6 4V6a2 2 0 0 1 2-2Z"></path></svg></button>
<button id="gev-chat-attach" type="button" :disabled="props.view.chat.busy" :aria-label="t('Add attachment')" :aria-expanded="String(props.view.chat.attachMenuOpen)" aria-controls="gev-chat-attach-menu" @click="emit('chat-attach-toggle')" @keydown="emit('chat-attach-keydown', $event)"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m8 12 6-6a3 3 0 0 1 4 4l-8 8a5 5 0 0 1-7-7l9-9"></path></svg></button>
<UiButton id="gev-chat-restore" :aria-label="t('Expand chat')" :title="t('Expand chat')" @click="emit('chat-restore')"><svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M5 4h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-6 4V6a2 2 0 0 1 2-2Z"></path></svg></UiButton>
<UiButton id="gev-chat-attach" :disabled="props.view.chat.busy" :aria-label="t('Add attachment')" :aria-expanded="String(props.view.chat.attachMenuOpen)" aria-controls="gev-chat-attach-menu" @click="emit('chat-attach-toggle')" @keydown="emit('chat-attach-keydown', $event)"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m8 12 6-6a3 3 0 0 1 4 4l-8 8a5 5 0 0 1-7-7l9-9"></path></svg></UiButton>
<textarea id="gev-chat-input" v-owned-draft="{ text: props.view.chat.draft, revision: props.view.chat.draftRevision }" :rows="props.view.chat.rows" maxlength="4000" :aria-label="t('Message GEV')" :placeholder="t('Ask GEV anything about the map…')" @input="emit('chat-input', $event.target.value)" @keydown="emit('chat-keydown', $event)"></textarea>
<button id="gev-chat-send" :type="props.view.chat.busy ? 'button' : 'submit'" :disabled="props.view.chat.sendDisabled" :data-busy="String(props.view.chat.busy)" :aria-label="props.view.chat.busy ? t('Stop reply') : t('Send message')" :title="props.view.chat.busy ? t('Stop reply') : t('Send message')" @click="props.view.chat.busy && emit('chat-stop')"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path class="gev-chat-enter-icon" d="M19 5v8H5m5-5-5 5 5 5"></path><rect class="gev-chat-stop-icon" x="6" y="6" width="12" height="12" rx="1.5" fill="currentColor" stroke="none"></rect></svg></button>
<UiButton id="gev-chat-send" :type="props.view.chat.busy ? 'button' : 'submit'" :disabled="props.view.chat.sendDisabled" :data-busy="String(props.view.chat.busy)" :aria-label="props.view.chat.busy ? t('Stop reply') : t('Send message')" :title="props.view.chat.busy ? t('Stop reply') : t('Send message')" @click="props.view.chat.busy && emit('chat-stop')"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path class="gev-chat-enter-icon" d="M19 5v8H5m5-5-5 5 5 5"></path><rect class="gev-chat-stop-icon" x="6" y="6" width="12" height="12" rx="1.5" fill="currentColor" stroke="none"></rect></svg></UiButton>
</form>
</section>
</template>
+14 -13
View File
@@ -9,6 +9,7 @@ import CockpitLivePage from './CockpitLivePage.vue';
import CockpitRoute from './CockpitRoute.vue';
import CockpitSignalList from './CockpitSignalList.vue';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// The Cockpit briefing card. The Cockpit controller presents its pages,
// cycle toggle, regional news and local conditions; until it does, the card
@@ -50,17 +51,17 @@ function leaveSignals() {
<strong id="cockpit-brief-subtitle">{{ b.subtitle }}</strong>
</div>
<nav class="cockpit-card-actions cockpit-brief-actions" :aria-label="t('Cockpit briefing controls')">
<button id="cockpit-brief-previous" type="button" :aria-label="t('Previous briefing page')" :title="t('Previous briefing page')">
<span class="material-symbols-outlined" aria-hidden="true">chevron_left</span>
</button>
<UiButton id="cockpit-brief-previous" :aria-label="t('Previous briefing page')" :title="t('Previous briefing page')">
<UiIcon name="chevron_left" :size="null" />
</UiButton>
<span id="cockpit-brief-position" aria-live="polite">{{ b.position }}</span>
<button id="cockpit-brief-next" type="button" :aria-label="t('Next briefing page')" :title="t('Next briefing page')">
<span class="material-symbols-outlined" aria-hidden="true">chevron_right</span>
</button>
<UiButton id="cockpit-brief-next" :aria-label="t('Next briefing page')" :title="t('Next briefing page')">
<UiIcon name="chevron_right" :size="null" />
</UiButton>
<UiButton id="cockpit-brief-auto" :aria-label="b.autoLabel" :pressed="Boolean(b.autoRotate)" :title="b.autoHelp">{{ b.autoLabel }}</UiButton>
<button id="cockpit-signal-toggle" type="button" :aria-label="collapsed ? t('Expand cockpit briefing panel') : t('Collapse cockpit briefing panel')" :aria-expanded="String(!collapsed)" :title="collapsed ? t('Expand briefing panel') : t('Collapse briefing panel')">
<span class="material-symbols-outlined" aria-hidden="true">{{ collapsed ? 'right_panel_open' : 'right_panel_close' }}</span>
</button>
<UiButton id="cockpit-signal-toggle" :aria-label="collapsed ? t('Expand cockpit briefing panel') : t('Collapse cockpit briefing panel')" :aria-expanded="String(!collapsed)" :title="collapsed ? t('Expand briefing panel') : t('Collapse briefing panel')">
<UiIcon :name="collapsed ? 'right_panel_open' : 'right_panel_close'" :size="null" />
</UiButton>
</nav>
</header>
<div class="cockpit-brief-stage">
@@ -91,11 +92,11 @@ function leaveSignals() {
<footer class="cockpit-signal-footer">
<span id="cockpit-brief-source">{{ b.source }}</span>
<nav class="cockpit-brief-tabs" :aria-label="t('Cockpit briefing pages')">
<button type="button" data-cockpit-brief-index="0" :aria-label="t('Show Live Signals')" :aria-current="String(b.pageIndex === 0)">{{ t('SIG') }}</button>
<button type="button" data-cockpit-brief-index="1" :aria-label="t('Show Regional News')" :aria-current="brief ? String(b.pageIndex === 1) : undefined">{{ t('NEWS') }}</button>
<button type="button" data-cockpit-brief-index="2" :aria-label="t('Show Local Info')" :aria-current="brief ? String(b.pageIndex === 2) : undefined">{{ t('LOCAL') }}</button>
<UiButton data-cockpit-brief-index="0" :aria-label="t('Show Live Signals')" :aria-current="String(b.pageIndex === 0)">{{ t('SIG') }}</UiButton>
<UiButton data-cockpit-brief-index="1" :aria-label="t('Show Regional News')" :aria-current="brief ? String(b.pageIndex === 1) : undefined">{{ t('NEWS') }}</UiButton>
<UiButton data-cockpit-brief-index="2" :aria-label="t('Show Local Info')" :aria-current="brief ? String(b.pageIndex === 2) : undefined">{{ t('LOCAL') }}</UiButton>
<!-- Always in the markup (the controller binds the tabs once); hidden without a stream. -->
<button type="button" data-cockpit-brief-index="3" :hidden="!live" :aria-label="t('Show Live Video')" :aria-current="brief ? String(b.pageIndex === 3) : undefined">{{ t('LIVE') }}</button>
<UiButton data-cockpit-brief-index="3" :hidden="!live" :aria-label="t('Show Live Video')" :aria-current="brief ? String(b.pageIndex === 3) : undefined">{{ t('LIVE') }}</UiButton>
</nav>
</footer>
</aside>
+11 -10
View File
@@ -6,6 +6,7 @@ import { createContextState } from '../../cockpitContextState.js';
import { vClassToggle } from '../../rail/classToggle.js';
import { useCockpitStore } from '../../stores/cockpit.js';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// The Cockpit Contact card. The Cockpit controller presents its scope,
// navigation, cohort counts, nearest contact and weather toggle; until it
@@ -36,15 +37,15 @@ const weatherLabel = computed(() =>
<strong id="cockpit-context-subject">{{ c.subject }}</strong>
</div>
<nav class="cockpit-card-actions cockpit-context-actions" :aria-label="t('Contact navigation')">
<button id="cockpit-context-previous" type="button" :disabled="!c.canPrevious" :aria-label="t('Previous — prior visited contact in the 250 km window')" :title="t('Previous — prior visited contact in the 250 km window')">
<span class="material-symbols-outlined" aria-hidden="true">skip_previous</span>
</button>
<button id="cockpit-context-next" type="button" :disabled="!c.canNext" :aria-label="t('Next — nearest unvisited contact in the 250 km window')" :title="t('Next — nearest unvisited contact in the 250 km window')">
<span class="material-symbols-outlined" aria-hidden="true">skip_next</span>
</button>
<button id="cockpit-context-toggle" type="button" :aria-label="collapsed ? t('Expand Contact panel') : t('Collapse Contact panel')" :aria-expanded="String(!collapsed)" :title="collapsed ? t('Expand contact panel') : t('Collapse contact panel')">
<span class="material-symbols-outlined" aria-hidden="true">{{ collapsed ? 'chevron_right' : 'chevron_left' }}</span>
</button>
<UiButton id="cockpit-context-previous" :disabled="!c.canPrevious" :aria-label="t('Previous — prior visited contact in the 250 km window')" :title="t('Previous — prior visited contact in the 250 km window')">
<UiIcon name="skip_previous" :size="null" />
</UiButton>
<UiButton id="cockpit-context-next" :disabled="!c.canNext" :aria-label="t('Next — nearest unvisited contact in the 250 km window')" :title="t('Next — nearest unvisited contact in the 250 km window')">
<UiIcon name="skip_next" :size="null" />
</UiButton>
<UiButton id="cockpit-context-toggle" :aria-label="collapsed ? t('Expand Contact panel') : t('Collapse Contact panel')" :aria-expanded="String(!collapsed)" :title="collapsed ? t('Expand contact panel') : t('Collapse contact panel')">
<UiIcon :name="collapsed ? 'chevron_right' : 'chevron_left'" :size="null" />
</UiButton>
</nav>
<span class="cockpit-context-qualifier">{{ t('CONTEXT ONLY') }}</span>
</header>
@@ -55,7 +56,7 @@ const weatherLabel = computed(() =>
<div v-class-toggle="{ unknown: c.cohorts['military-installations'].unknown }" role="listitem" data-context-cohort="military-installations"><span>{{ t('SITE') }}</span><strong>{{ c.cohorts['military-installations'].count }}</strong><small translate="no" :title="c.cohorts['military-installations'].source">{{ c.cohorts['military-installations'].source }}</small></div>
</div>
<div class="cockpit-context-nearest">
<span id="cockpit-context-direction" v-class-toggle="{ unknown: c.direction.unknown }" class="material-symbols-outlined" :style="directionStyle" aria-hidden="true">navigation</span>
<UiIcon id="cockpit-context-direction" v-class-toggle="{ unknown: c.direction.unknown }" name="navigation" :size="null" :style="directionStyle" />
<div>
<small>{{ t('NEAREST OBSERVED / MAPPED') }}</small>
<strong id="cockpit-context-nearest-label" :aria-label="c.nearest.ariaLabel ?? undefined">{{ c.nearest.label }}</strong>
+9 -7
View File
@@ -14,6 +14,7 @@ import {
shownOwnerMark,
} from '../../ownerFlag.js';
import { useCockpitStore } from '../../stores/cockpit.js';
import UiButton from '../../kit/UiButton.vue';
// The orbital view's HUD: a nadir reticle over the picture, the satellite's
// identity and orbit, and the optical zoom. The Cockpit controller presents
@@ -118,14 +119,15 @@ const sensorStepShown = computed(
// A focused control that turns off (a zoom button at the end of its range,
// SENSOR as the view tilts away) hands focus on instead of dropping it to the
// page. The watchers run before the re-render, while it still has focus.
// Each ref holds a UiButton, whose element is its `$el`.
const zoomInButton = ref(null);
const zoomOutButton = ref(null);
const sensorButton = ref(null);
const nadirButton = ref(null);
const handFocus = (from, to) => {
if (!from || document.activeElement !== from) return;
if (!from?.$el || document.activeElement !== from.$el) return;
nextTick(() =>
(to() ?? document.getElementById('map-view-switch'))?.focus({
(to()?.$el ?? document.getElementById('map-view-switch'))?.focus({
preventScroll: true,
}),
);
@@ -306,7 +308,7 @@ const lensStyle = computed(() => {
<div v-if="identText" class="cockpit-orbital-ident">
<!-- Wraps between parts, never inside a date. -->
<span class="cockpit-orbital-ident-text"><template v-for="(part, index) in identParts" :key="index"><template v-if="index"> · </template><span class="cockpit-orbital-ident-part">{{ part }}</span></template></span>
<button v-if="tleText" id="cockpit-orbital-tle-toggle" type="button" class="cockpit-orbital-tle-toggle" :aria-expanded="String(tleOpen)" aria-controls="cockpit-orbital-tle" :aria-label="tleOpen ? t('Hide the two-line element set') : t('Show the two-line element set')" :title="tleOpen ? t('Hide the two-line element set') : t('Show the two-line element set')" @click="tleOpen = !tleOpen">{{ t('TLE') }}</button>
<UiButton v-if="tleText" id="cockpit-orbital-tle-toggle" class="cockpit-orbital-tle-toggle" :aria-expanded="String(tleOpen)" aria-controls="cockpit-orbital-tle" :aria-label="tleOpen ? t('Hide the two-line element set') : t('Show the two-line element set')" :title="tleOpen ? t('Hide the two-line element set') : t('Show the two-line element set')" @click="tleOpen = !tleOpen">{{ t('TLE') }}</UiButton>
</div>
<pre v-if="tleText" v-show="tleOpen" id="cockpit-orbital-tle" class="cockpit-orbital-tle" :aria-label="t('Two-line element set')">{{ tleText }}</pre>
<dl class="cockpit-orbital-data">
@@ -333,17 +335,17 @@ const lensStyle = computed(() => {
<!-- Shown only while the view is tilted off nadir: where it looks and the way back. -->
<div v-if="look.offset" class="cockpit-orbital-look">
<span id="cockpit-orbital-look-readout" class="cockpit-orbital-look-readout" :aria-live="look.focus ? 'off' : 'polite'">{{ look.readout }}</span>
<button id="cockpit-orbital-nadir" ref="nadirButton" type="button" class="cockpit-orbital-nadir" :aria-label="mount !== null ? t('Return to the default view') : t('Return the view to nadir')" :title="mount !== null ? t('Return to the default view') : t('Return to nadir (Home or 0)')" aria-keyshortcuts="Home 0">{{ mount !== null ? t('RESET') : t('NADIR') }}</button>
<UiButton id="cockpit-orbital-nadir" ref="nadirButton" class="cockpit-orbital-nadir" :aria-label="mount !== null ? t('Return to the default view') : t('Return the view to nadir')" :title="mount !== null ? t('Return to the default view') : t('Return to nadir (Home or 0)')" aria-keyshortcuts="Home 0">{{ mount !== null ? t('RESET') : t('NADIR') }}</UiButton>
</div>
<p id="cockpit-orbital-focus" class="cockpit-orbital-focus" aria-live="polite">{{ focusText }}</p>
</div>
<div class="cockpit-orbital-optics">
<button id="cockpit-orbital-zoom-out" ref="zoomOutButton" type="button" class="cockpit-orbital-zoom-button" :disabled="atWidest" :aria-label="t('Zoom out')" :title="t('Zoom out (−)')" aria-keyshortcuts="- _">−</button>
<UiButton id="cockpit-orbital-zoom-out" ref="zoomOutButton" class="cockpit-orbital-zoom-button" :disabled="atWidest" :aria-label="t('Zoom out')" :title="t('Zoom out (−)')" aria-keyshortcuts="- _">−</UiButton>
<span class="cockpit-orbital-zoom" aria-live="polite">{{ zoomText }}</span>
<button id="cockpit-orbital-zoom-in" ref="zoomInButton" type="button" class="cockpit-orbital-zoom-button" :disabled="atTightest" :aria-label="t('Zoom in')" :title="t('Zoom in (+)')" aria-keyshortcuts="+ =">+</button>
<UiButton id="cockpit-orbital-zoom-in" ref="zoomInButton" class="cockpit-orbital-zoom-button" :disabled="atTightest" :aria-label="t('Zoom in')" :title="t('Zoom in (+)')" aria-keyshortcuts="+ =">+</UiButton>
<span v-if="swathText" class="cockpit-orbital-swath">{{ swathText }}</span>
<span v-if="sensorText" class="cockpit-orbital-swath cockpit-orbital-sensor-swath">{{ sensorText }}</span>
<button v-if="sensorStepShown" id="cockpit-orbital-sensor" ref="sensorButton" type="button" class="cockpit-orbital-sensor-step" :aria-label="t('Zoom to the imaging sensor swath')" :title="t('Zoom to the imaging sensor swath')">{{ t('SENSOR') }}</button>
<UiButton v-if="sensorStepShown" id="cockpit-orbital-sensor" ref="sensorButton" class="cockpit-orbital-sensor-step" :aria-label="t('Zoom to the imaging sensor swath')" :title="t('Zoom to the imaging sensor swath')">{{ t('SENSOR') }}</UiButton>
</div>
</template>
</section>
+2 -1
View File
@@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia';
import { computed, onBeforeUnmount, ref, watch } from 'vue';
import { formatNumber, t, tn } from '../../../i18n/index.js';
import { useCockpitStore } from '../../stores/cockpit.js';
import UiButton from '../../kit/UiButton.vue';
// The bridge radar: a heading-up scope of nearby AIS vessels, with a line
// where the bridge view looks when it is turned off the bow. The Cockpit
@@ -158,7 +159,7 @@ const rangeAction = computed(() =>
</template>
</div>
<div class="cockpit-radar-readout">
<button id="cockpit-radar-range" type="button" class="cockpit-radar-range" :aria-label="rangeAction" :title="rangeAction">{{ rangeLabel }}</button>
<UiButton id="cockpit-radar-range" class="cockpit-radar-range" :aria-label="rangeAction" :title="rangeAction">{{ rangeLabel }}</UiButton>
<span class="cockpit-radar-rings">{{ ringLabel }}</span>
<span class="cockpit-radar-count">{{ countLabel }}</span>
</div>
+2 -1
View File
@@ -4,6 +4,7 @@ import { computed } from 'vue';
import { t } from '../../../i18n/index.js';
import { createRouteState } from '../../cockpitInstrumentState.js';
import { useCockpitStore } from '../../stores/cockpit.js';
import UiIcon from '../../kit/UiIcon.vue';
// The Cockpit flight plan card. The Cockpit controller presents the route's
// endpoints and whether a destination direction exists; until it does, the
@@ -39,7 +40,7 @@ const label = computed(() =>
<span>{{ t('FROM') }}</span>
<strong id="cockpit-route-from">{{ r.from }}</strong>
</div>
<span v-if="r.kind !== 'vessel'" class="cockpit-route-arrow material-symbols-outlined" aria-hidden="true">east</span>
<UiIcon v-if="r.kind !== 'vessel'" name="east" class="cockpit-route-arrow" :size="null" />
<div class="cockpit-route-airport">
<span>{{ t('TO') }}</span>
<strong id="cockpit-route-to">{{ r.to }}</strong>
+3 -1
View File
@@ -3,6 +3,8 @@ import { storeToRefs } from 'pinia';
import { computed } from 'vue';
import { vFocusSafeChildren } from '../../rail/focusSafeChildren.js';
import { useCockpitStore } from '../../stores/cockpit.js';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// The Cockpit's live signal rows. The Cockpit controller presents them;
// until it does, the list is empty. Rows reorder several times a second,
@@ -18,5 +20,5 @@ const rows = computed(() => signals.value ?? []);
</script>
<template>
<ol id="cockpit-signal-list" v-focus-safe-children="leave" class="cockpit-signal-list" aria-live="polite"><li v-for="row in rows" :key="row.key" :class="row.className" :data-signal-key="row.key"><time>{{ row.time }}</time><div><button v-if="row.target" type="button" class="cockpit-signal-target" :data-signal-layer="row.target.layerId" :data-signal-id="row.target.id" :aria-label="row.target.label"><span class="cockpit-signal-target-label">{{ row.title }}</span><span class="cockpit-signal-target-rule" aria-hidden="true"></span><span class="material-symbols-outlined cockpit-signal-target-chevron" aria-hidden="true">chevron_right</span></button><strong v-else>{{ row.title }}</strong><span>{{ row.detail }}</span></div></li></ol>
<ol id="cockpit-signal-list" v-focus-safe-children="leave" class="cockpit-signal-list" aria-live="polite"><li v-for="row in rows" :key="row.key" :class="row.className" :data-signal-key="row.key"><time>{{ row.time }}</time><div><UiButton v-if="row.target" class="cockpit-signal-target" :data-signal-layer="row.target.layerId" :data-signal-id="row.target.id" :aria-label="row.target.label"><span class="cockpit-signal-target-label">{{ row.title }}</span><span class="cockpit-signal-target-rule" aria-hidden="true"></span><UiIcon name="chevron_right" class="cockpit-signal-target-chevron" :size="null" /></UiButton><strong v-else>{{ row.title }}</strong><span>{{ row.detail }}</span></div></li></ol>
</template>
+11 -10
View File
@@ -8,6 +8,7 @@ import { useRadioStore } from '../../stores/radio.js';
import { useCockpitStore } from '../../stores/cockpit.js';
import { useDisplayStore } from '../../stores/display.js';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// The Cockpit's Display and Radio launchers and their popovers, and the
// desktop look's rail, whose icons stay at the edge and open one panel at a
@@ -54,8 +55,8 @@ const radioLabel = computed(() =>
<div class="cockpit-utility-launcher" data-cockpit-launcher="display">
<span>{{ t('DISPLAY') }}</span>
<span class="cockpit-utility-divider" aria-hidden="true"></span>
<button v-if="open.display" type="button" class="cockpit-utility-collapse" :aria-label="t('Collapse panel')" :title="t('Collapse panel')" @click="act('toggleCockpitUtility', 'display', { returnFocus: true })">−</button>
<button id="cockpit-display-toggle-btn" class="cockpit-utility-glyph" type="button" :aria-expanded="String(open.display)" aria-controls="cockpit-display-panel" :aria-label="displayLabel" :title="displayLabel">{{ open.display ? '▶' : '◀' }}</button>
<UiButton v-if="open.display" class="cockpit-utility-collapse" :aria-label="t('Collapse panel')" :title="t('Collapse panel')" @click="act('toggleCockpitUtility', 'display', { returnFocus: true })">−</UiButton>
<UiButton id="cockpit-display-toggle-btn" class="cockpit-utility-glyph" :aria-expanded="String(open.display)" aria-controls="cockpit-display-panel" :aria-label="displayLabel" :title="displayLabel">{{ open.display ? '▶' : '◀' }}</UiButton>
</div>
<div id="cockpit-display-panel" class="cockpit-utility-popover ui-scroll" v-class-toggle="{ 'uses-shared-display-controls': !!cockpitPortal }" role="group" :aria-label="t('Cockpit display options')" :hidden="!open.display">
<div class="cockpit-display-slot" data-cockpit-display-slot="hud"></div>
@@ -68,16 +69,16 @@ const radioLabel = computed(() =>
<div class="cockpit-utility-launcher" data-cockpit-launcher="radio">
<span>{{ t('RADIO') }}</span>
<span class="cockpit-utility-divider" aria-hidden="true"></span>
<button v-if="open.radio" type="button" class="cockpit-utility-collapse" :aria-label="t('Collapse panel')" :title="t('Collapse panel')" @click="act('toggleCockpitUtility', 'radio', { returnFocus: true })">−</button>
<button id="cockpit-radio-toggle-btn" @click="act('toggleCockpitRadio')" class="cockpit-utility-glyph" type="button" :aria-expanded="String(open.radio)" aria-controls="cockpit-radio-panel" :aria-label="radioLabel" :title="radioLabel">{{ open.radio ? '▶' : '◀' }}</button>
<UiButton v-if="open.radio" class="cockpit-utility-collapse" :aria-label="t('Collapse panel')" :title="t('Collapse panel')" @click="act('toggleCockpitUtility', 'radio', { returnFocus: true })">−</UiButton>
<UiButton id="cockpit-radio-toggle-btn" @click="act('toggleCockpitRadio')" class="cockpit-utility-glyph" :aria-expanded="String(open.radio)" aria-controls="cockpit-radio-panel" :aria-label="radioLabel" :title="radioLabel">{{ open.radio ? '▶' : '◀' }}</UiButton>
</div>
<div id="cockpit-radio-panel" class="cockpit-utility-popover cockpit-radio-compact" role="group" :aria-label="t('Cockpit compact Radio controls')" :hidden="!open.radio">
<strong id="cockpit-radio-station" class="cockpit-radio-station">{{ cockpit ? cockpit.station : t('READY') }}</strong>
<UiButton id="cockpit-radio-enable-btn" @click="act('toggleRadio', 'cockpit')" class="panel-layer-toggle" :pressed="cockpit?.enable.active ?? false" pressed-class="active" :aria-label="cockpit?.enable.label" :aria-disabled="cockpit ? String(cockpit.enable.busy) : undefined" :aria-busy="cockpit ? String(cockpit.enable.busy) : undefined">{{ cockpit ? cockpit.enable.text : t('ENABLE') }}</UiButton>
<UiButton id="cockpit-radio-enable-btn" @click="act('toggleRadio', 'cockpit')" class="panel-layer-toggle" :pressed="Boolean(cockpit?.enable.active)" pressed-class="active" :aria-label="cockpit?.enable.label" :aria-disabled="cockpit ? String(cockpit.enable.busy) : undefined" :aria-busy="cockpit ? String(cockpit.enable.busy) : undefined">{{ cockpit ? cockpit.enable.text : t('ENABLE') }}</UiButton>
<div class="cockpit-radio-transport">
<button id="cockpit-radio-prev-btn" @click="act('cycleRadio', -1, { rotate: false })" type="button" :aria-label="t('Previous filtered radio station')" :disabled="radio ? radio.transport.stepDisabled : true">◀◀</button>
<button id="cockpit-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 radio station')" :title="cockpit?.play.title" :disabled="radio ? radio.transport.play.disabled : true">{{ cockpit ? cockpit.play.glyph : '▶' }}</button>
<button id="cockpit-radio-next-btn" @click="act('cycleRadio', 1, { rotate: false })" type="button" :aria-label="t('Next filtered radio station')" :disabled="radio ? radio.transport.stepDisabled : true">▶▶</button>
<UiButton id="cockpit-radio-prev-btn" @click="act('cycleRadio', -1, { rotate: false })" :aria-label="t('Previous filtered radio station')" :disabled="radio ? radio.transport.stepDisabled : true">◀◀</UiButton>
<UiButton id="cockpit-radio-play-btn" @click="act('toggleRadioPlayback')" v-class-toggle="{ active: radio?.transport.play.active }" :aria-label="radio ? radio.transport.play.label : t('Play selected radio station')" :title="cockpit?.play.title" :disabled="radio ? radio.transport.play.disabled : true">{{ cockpit ? cockpit.play.glyph : '▶' }}</UiButton>
<UiButton id="cockpit-radio-next-btn" @click="act('cycleRadio', 1, { rotate: false })" :aria-label="t('Next filtered radio station')" :disabled="radio ? radio.transport.stepDisabled : true">▶▶</UiButton>
</div>
<label class="cockpit-radio-volume" for="cockpit-radio-volume">
<span>{{ t('VOLUME') }}</span>
@@ -92,8 +93,8 @@ const radioLabel = computed(() =>
<span>{{ t('RADIO') }}</span>
</span>
<span class="cockpit-utility-rail__icons">
<button type="button" class="cockpit-utility-rail__item" data-cockpit-rail-item="display" :class="{ 'is-on': open.display }" :aria-expanded="String(open.display)" aria-controls="cockpit-display-panel" :aria-label="displayLabel" :title="displayLabel" @click="act('toggleCockpitUtility', 'display')"><span class="material-symbols-outlined" aria-hidden="true">tune</span></button>
<button type="button" class="cockpit-utility-rail__item" data-cockpit-rail-item="radio" :class="{ 'is-on': open.radio }" :aria-expanded="String(open.radio)" aria-controls="cockpit-radio-panel" :aria-label="radioLabel" :title="radioLabel" @click="act('toggleCockpitUtility', 'radio')"><span class="material-symbols-outlined" aria-hidden="true">radio</span></button>
<UiButton class="cockpit-utility-rail__item" data-cockpit-rail-item="display" :class="{ 'is-on': open.display }" :aria-expanded="String(open.display)" aria-controls="cockpit-display-panel" :aria-label="displayLabel" :title="displayLabel" @click="act('toggleCockpitUtility', 'display')"><UiIcon name="tune" :size="null" /></UiButton>
<UiButton class="cockpit-utility-rail__item" data-cockpit-rail-item="radio" :class="{ 'is-on': open.radio }" :aria-expanded="String(open.radio)" aria-controls="cockpit-radio-panel" :aria-label="radioLabel" :title="radioLabel" @click="act('toggleCockpitUtility', 'radio')"><UiIcon name="radio" :size="null" /></UiButton>
</span>
</div>
</aside>
+3 -2
View File
@@ -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>
+3 -1
View File
@@ -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>
+5 -1
View File
@@ -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>
+11 -1
View File
@@ -26,7 +26,7 @@ const props = defineProps({
withContacts: Boolean,
});
const store = useEntityCardStore();
const { card, lost, tick } = storeToRefs(store);
const { card, lost, tick, away, finding, located } = storeToRefs(store);
// Cameras carry only an id; the CCTV panel's store knows the picked one's name.
const { frame: cctvFrame } = storeToRefs(useCctvStore());
const shownTitle = computed(() => {
@@ -56,6 +56,15 @@ const status = computed(() => {
void tick.value;
const current = card.value;
if (!current) return null;
if (finding.value === 'finding') return { tone: 'aged', text: t('Finding it…') };
if (finding.value === 'none') return { tone: 'lost', text: t('No reading at this time') };
if (lost.value && located.value)
return {
tone: 'aged',
text: t('Last reading · {age}', {
age: ago(Math.max(0, located.value.atMs - located.value.observedAtMs)),
}),
};
if (lost.value) return { tone: 'lost', text: t('Out of feed · last reading') };
if (current.observedAgeMs !== null)
return {
@@ -399,6 +408,7 @@ watch(
<h3 class="entity-card__title">{{ shownTitle }}</h3>
<span v-if="subtitle" class="entity-card__subtitle">{{ subtitle }}</span>
</div>
<UiButton v-if="away && card.moving" class="entity-card__find" data-entity-find :label="t('Find it')" :title="t('Find it')" :disabled="finding === 'finding'" @click="store.locate()"><UiIcon name="my_location" :size="null" /></UiButton>
<UiCloseButton class="entity-card__close" glyph="icon" :label="t('Close card')" :title="t('Close card')" @click="store.clear()" />
</header>
+11 -7
View File
@@ -4,13 +4,17 @@ import { computed, ref } from 'vue';
import { t } from '../../../i18n/index.js';
import { vFocusSafeChildren } from '../../rail/focusSafeChildren.js';
import { useDisplayStore } from '../../stores/display.js';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// DISPLAY ▸ Import: the button, the hidden picker, the imported files and
// the hint. The file import publishes the rows and hint; until it does, the
// list is empty. A pick and the row buttons call its actions. Before the
// row holding keyboard focus goes, focus moves to the next row's same
// button, else the previous row's, else the Import button. The list's
// template is one line: templates keep whitespace.
// button, else the previous row's, else the Import button. Each row's
// actions (show or hide, fly to, remove) are icon buttons the file import
// describes, Show/Hide a pressed toggle. The list's template is one line:
// templates keep whitespace.
const display = useDisplayStore();
const { geoImport } = storeToRefs(display);
const rows = computed(() => geoImport.value?.rows ?? []);
@@ -52,18 +56,18 @@ 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><button v-for="item in row.actions" :key="item.action" type="button" class="geo-import-action" :data-action="item.action" :title="item.label" :aria-label="item.label" :aria-pressed="item.pressed" @click="display.act(ROW_ACTIONS[item.action], row.id)"><span class="material-symbols-outlined" aria-hidden="true">{{ item.icon }}</span></button></li></ul>
<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>
</div>
</template>
+13 -11
View File
@@ -4,6 +4,8 @@ import { computed } from 'vue';
import { t } from '../../../i18n/index.js';
import { useGlobeActionsStore } from '../../stores/globeActions.js';
import GlobeCompass from './GlobeCompass.vue';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// The top-center camera and share actions. The shell answers the buttons
// through the store and publishes a clear under way, which keeps the button
@@ -18,18 +20,18 @@ const tilted = computed(() => Boolean(camera.value?.tilted));
<template>
<nav id="top-center-actions" :aria-label="t('Globe actions')">
<button id="clear-selected-layers" type="button" :aria-label="clearBusy ? t('Clearing selected data layers') : t('Clear selected data layers')" :aria-disabled="clearBusy == null ? undefined : String(clearBusy)" :aria-busy="clearBusy == null ? undefined : String(clearBusy)" :title="t('Turn off all selected data layers')" @click="act('clear')">
<span class="material-symbols-outlined" aria-hidden="true">layers_clear</span>
</button>
<button id="share-btn" type="button" :aria-label="t('Copy share link')" :title="t('Copy share link')" @click="act('share')">
<UiButton id="clear-selected-layers" :aria-label="clearBusy ? t('Clearing selected data layers') : t('Clear selected data layers')" :aria-disabled="clearBusy == null ? undefined : String(clearBusy)" :aria-busy="clearBusy == null ? undefined : String(clearBusy)" :title="t('Turn off all selected data layers')" @click="act('clear')">
<UiIcon name="layers_clear" :size="null" />
</UiButton>
<UiButton id="share-btn" :aria-label="t('Copy share link')" :title="t('Copy share link')" @click="act('share')">
<span class="share-icon" aria-hidden="true">&#x1F517;</span>
</button>
<button id="tilt-map-view" type="button" :aria-label="tilted ? t('Return map to straight-down view') : t('Tilt map to oblique view')" :aria-pressed="String(tilted)" :title="t('Toggle straight-down and tilted map views')" @click="act('tilt')">
<span class="material-symbols-outlined" aria-hidden="true">view_in_ar</span>
</button>
</UiButton>
<UiButton id="tilt-map-view" :aria-label="tilted ? t('Return map to straight-down view') : t('Tilt map to oblique view')" :pressed="tilted" :title="t('Toggle straight-down and tilted map views')" @click="act('tilt')">
<UiIcon name="view_in_ar" :size="null" />
</UiButton>
<GlobeCompass @click="act('northUp')" />
<button id="reset-globe-view" type="button" :aria-label="resetBusy ? t('Resetting to full globe view') : t('Reset to full globe view')" :title="t('Reset camera and return to full globe view')" @click="act('reset')">
<span class="material-symbols-outlined" aria-hidden="true">public</span>
</button>
<UiButton id="reset-globe-view" :aria-label="resetBusy ? t('Resetting to full globe view') : t('Reset to full globe view')" :title="t('Reset camera and return to full globe view')" @click="act('reset')">
<UiIcon name="public" :size="null" />
</UiButton>
</nav>
</template>
+5 -3
View File
@@ -3,6 +3,8 @@ import { storeToRefs } from 'pinia';
import { computed } from 'vue';
import { t } from '../../../i18n/index.js';
import { useGlobeActionsStore } from '../../stores/globeActions.js';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// The north-up button: its needle and label follow the published heading,
// which changes on every frame a rotating camera draws. Before the camera
@@ -20,8 +22,8 @@ const label = computed(() =>
</script>
<template>
<button id="north-up-view" type="button" :aria-label="label" :data-north-up="heading == null ? undefined : String(heading === 0)" :style="heading == null ? undefined : { '--camera-heading': `${heading}deg` }" :title="t('Reset map bearing to north')" @click="$emit('click')">
<UiButton id="north-up-view" :aria-label="label" :data-north-up="heading == null ? undefined : String(heading === 0)" :style="heading == null ? undefined : { '--camera-heading': `${heading}deg` }" :title="t('Reset map bearing to north')" @click="$emit('click')">
<span class="camera-compass-n" aria-hidden="true">N</span>
<span class="camera-compass-needle material-symbols-outlined" aria-hidden="true">navigation</span>
</button>
<UiIcon class="camera-compass-needle" name="navigation" :size="null" />
</UiButton>
</template>
+2 -1
View File
@@ -1,6 +1,7 @@
<script setup>
import { storeToRefs } from 'pinia';
import { useImagerySplitStore } from '../../stores/imagerySplit.js';
import UiButton from '../../kit/UiButton.vue';
// The before/after imagery dividers, as their splits (src/ui/imagerySplit.js)
// present them. Each line is a direct child of the body, above the rails; its
@@ -11,6 +12,6 @@ const optional = (value) => value ?? undefined;
<template>
<Teleport to="body">
<div v-for="split in splits" :key="split.key" :id="optional(split.view.id)" data-globe-overlay :hidden="split.view.hidden"><span class="before" :title="optional(split.view.beforeTitle)">{{ split.view.beforeLabel }}</span><button type="button" :class="optional(split.view.handleClass)" role="slider" :aria-label="optional(split.view.ariaLabel)" aria-valuemin="0" aria-valuemax="100" aria-orientation="horizontal" :aria-valuenow="split.view.valueNow" :aria-valuetext="split.view.valueText" @pointerdown="split.controls.pointerdown($event)" @pointermove="split.controls.pointermove($event)" @pointerup="split.controls.pointerup($event)" @pointercancel="split.controls.pointerup($event)" @keydown="split.controls.keydown($event)">↔</button><span class="after" :title="optional(split.view.afterTitle)">{{ split.view.afterLabel }}</span></div>
<div v-for="split in splits" :key="split.key" :id="optional(split.view.id)" data-globe-overlay :hidden="split.view.hidden"><span class="before" :title="optional(split.view.beforeTitle)">{{ split.view.beforeLabel }}</span><UiButton :class="optional(split.view.handleClass)" role="slider" :aria-label="optional(split.view.ariaLabel)" aria-valuemin="0" aria-valuemax="100" aria-orientation="horizontal" :aria-valuenow="split.view.valueNow" :aria-valuetext="split.view.valueText" @pointerdown="split.controls.pointerdown($event)" @pointermove="split.controls.pointermove($event)" @pointerup="split.controls.pointerup($event)" @pointercancel="split.controls.pointerup($event)" @keydown="split.controls.keydown($event)">↔</UiButton><span class="after" :title="optional(split.view.afterTitle)">{{ split.view.afterLabel }}</span></div>
</Teleport>
</template>
+3 -3
View File
@@ -1,6 +1,7 @@
<script setup>
import { onBeforeUnmount, onMounted, ref } from 'vue';
import { t } from '../../../i18n/index.js';
import UiButton from '../../kit/UiButton.vue';
// A slim index beside the Data Layers list: one tick per group (Movement,
// Cameras, Infrastructure…). Hovering a tick names its group, clicking it
@@ -102,10 +103,9 @@ onBeforeUnmount(() => {
<template>
<nav v-if="sections.length > 1" class="layer-section-index" :aria-label="t('Layer groups')">
<button
<UiButton
v-for="section in sections"
:key="section.i"
type="button"
class="layer-section-index__tick"
:class="{ 'is-current': section.i === current }"
:aria-label="t('Jump to {name}', { name: section.label })"
@@ -115,7 +115,7 @@ onBeforeUnmount(() => {
@mouseleave="hideTip"
@focus="showTip($event, section)"
@blur="hideTip"
></button>
></UiButton>
<Teleport to="body">
<span v-if="tip" class="layer-section-index__label"
:class="{ 'layer-section-index__label--before': tip.before }" :style="{ left: tip.left, top: tip.top }" aria-hidden="true">{{ tip.label }}</span>
+5 -4
View File
@@ -17,6 +17,7 @@ import {
localeOptionCode,
} from '../../localePicker.js';
import { vClassToggle } from '../../rail/classToggle.js';
import UiButton from '../../kit/UiButton.vue';
// The interface language picker. The model in localePicker.js holds the
// list, search, active option and keyboard rules; this renders it and wires
@@ -90,7 +91,7 @@ function close({ restoreFocus = false } = {}) {
render();
globalThis.removeEventListener('keydown', onWindowKeyDown, true);
document.removeEventListener('pointerdown', onDocumentPointerDown, true);
if (restoreFocus) button.value?.focus({ preventScroll: true });
if (restoreFocus) button.value?.$el.focus({ preventScroll: true });
}
// The list is closed on screen before the shell switches.
@@ -179,7 +180,7 @@ function onFocusOut(event) {
}
onMounted(() => {
if (props.focus) button.value?.focus({ preventScroll: true });
if (props.focus) button.value?.$el.focus({ preventScroll: true });
});
onBeforeUnmount(() => close());
@@ -188,11 +189,11 @@ defineExpose({ open, close, isOpen: () => model.open });
<template>
<div id="locale-picker" ref="root" class="locale-picker" v-class-toggle="{ 'is-open': view.open }" @focusout="onFocusOut">
<button ref="button" class="locale-picker-button" type="button" aria-haspopup="listbox" :aria-expanded="String(view.open)" :aria-controls="ids.popup" :aria-label="buttonLabel" :title="t('Change the interface language')" @click="onButtonClick" @keydown="onButtonKeyDown" @keyup="onButtonKeyUp">
<UiButton ref="button" class="locale-picker-button" aria-haspopup="listbox" :aria-expanded="String(view.open)" :aria-controls="ids.popup" :aria-label="buttonLabel" :title="t('Change the interface language')" @click="onButtonClick" @keydown="onButtonKeyDown" @keyup="onButtonKeyUp">
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" class="locale-picker-globe"><path v-for="d in LOCALE_PICKER_ICONS.globe.stroke" :key="d" :d="d" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" /></svg>
<span class="locale-picker-code" translate="no" aria-hidden="true">{{ current.toUpperCase() }}</span>
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" class="locale-picker-caret"><path v-for="d in LOCALE_PICKER_ICONS.caret.fill" :key="d" :d="d" fill="currentColor" /></svg>
</button>
</UiButton>
<div :id="ids.popup" class="locale-picker-popup" :hidden="!view.open">
<div :id="ids.heading" class="locale-picker-heading">{{ t('Interface language') }}</div>
<input v-if="model.searchable" ref="search" class="locale-picker-search" type="search" autocomplete="off" spellcheck="false" role="combobox" aria-autocomplete="list" aria-expanded="true" :aria-controls="ids.listbox" :aria-label="t('Search languages')" :placeholder="t('Search languages')" :aria-activedescendant="activeDescendant" @input="onSearchInput" />
+6 -6
View File
@@ -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>
<button type="button" class="cancel" data-mission-replay-cancel :title="t('Cancel replay')" :aria-label="t('Cancel replay')" @click="layer?.cancelReplay()"><span aria-hidden="true">×</span></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>
+2 -1
View File
@@ -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>
+5 -1
View File
@@ -1347,10 +1347,14 @@ small {
calc(var(--mobile-sheet-cover, 0px) + 6px)
);
left: auto;
inset-inline: 16px 60px;
inset-inline: 16px;
width: auto;
transform: none;
}
/* The language picker sits at the right edge beside the field; the field leaves it room. */
:global(body.mobile-shell:has(#locale-picker) #gev-omnibar) {
inset-inline: 16px 60px;
}
/* A lifted timeline leaves less map above the credits on short phones. */
@media (max-height: 480px) {
:global(body.mobile-shell:has(#world-timeline) #gev-omnibar) {
+15 -4
View File
@@ -8,7 +8,9 @@ import UiCloseButton from '../../kit/UiCloseButton.vue';
// with the `view` it computes for each step and keeps the parts the template
// never binds: the guide's `visible` class, the callout's entrance replay
// (its `swap` class), place and side, the ring's and the extra rings' boxes,
// and focus. It finds those elements in the rendered tree itself.
// and focus. It finds those elements in the rendered tree itself. The extra
// rings, one per further target of a step, follow the callout; `view.subRings`
// says how many are drawn.
defineProps({
to: { type: Object, required: true },
view: { type: Object, required: true },
@@ -20,6 +22,11 @@ defineProps({
/** A progress segment's attributes: no class at all for one still to come. */
const dot = (name) => (name ? { class: name } : {});
// The buttons' words are the slot of a UiButton, which renders inside the
// button: a step that changes only a label would reach it a tick after the
// owner paints. A slot given under a condition (`redrawWithView`, always
// true) is redrawn whenever this view is, so it keeps up.
const redrawWithView = true;
</script>
<!-- Only line breaks inside tags: the markup has no whitespace between elements. -->
@@ -60,23 +67,27 @@ const dot = (name) => (name ? { class: name } : {});
class="gev-guide-skip"
:hidden="view.skipHidden"
@click="onSkip()"
>{{ view.skipLabel }}</UiButton
><template v-if="redrawWithView" #default>{{ view.skipLabel }}</template></UiButton
><UiButton
class="gev-guide-offer"
:hidden="view.offerHidden"
@click="onOffer()"
>{{ view.offerLabel }}</UiButton
><template v-if="redrawWithView" #default>{{ view.offerLabel }}</template></UiButton
><UiButton
class="gev-guide-next"
:class="{ quiet: view.nextQuiet }"
:hidden="view.nextHidden"
@click="onNext()"
>{{ view.nextLabel }}</UiButton
><template v-if="redrawWithView" #default>{{ view.nextLabel }}</template></UiButton
></span
></div
><p class="gev-guide-status" role="status" aria-live="polite">{{
view.status
}}</p></div
><div
v-for="i in view.subRings"
:key="i"
class="gev-guide-ring gev-guide-ring--sub"></div
></div
></Teleport
></template>
+3 -2
View File
@@ -1,5 +1,6 @@
<script setup>
import { t } from '../../../i18n/index.js';
import UiButton from '../../kit/UiButton.vue';
// Dock and minimize for an assistant panel (chat or voice). The owner
// (src/voice/panelLayout.js) places the panel; this reports the choice.
@@ -12,7 +13,7 @@ defineEmits(['dock', 'minimize']);
<template>
<div class="gev-panel-layout" role="group" :aria-label="t('Panel position')">
<button type="button" data-layout-dock :aria-pressed="String(props.docked)" :aria-label="props.docked ? t('Move above the dock') : t('Dock to the right')" :title="props.docked ? t('Move above the dock') : t('Dock to the right')" @click="$emit('dock')"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path :d="props.docked ? 'M4 5h16v14H4ZM4 14h16' : 'M4 5h16v14H4ZM14 5v14'"></path></svg></button>
<button type="button" data-layout-minimize :aria-label="props.minimized ? t('Expand panel') : t('Minimize panel')" :title="props.minimized ? t('Expand panel') : t('Minimize panel')" @click="$emit('minimize')"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path :d="props.minimized ? 'M6 6h12v12H6Z' : 'M6 12h12'"></path></svg></button>
<UiButton data-layout-dock :pressed="props.docked" :label="props.docked ? t('Move above the dock') : t('Dock to the right')" @click="$emit('dock')"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path :d="props.docked ? 'M4 5h16v14H4ZM4 14h16' : 'M4 5h16v14H4ZM14 5v14'"></path></svg></UiButton>
<UiButton data-layout-minimize :label="props.minimized ? t('Expand panel') : t('Minimize panel')" @click="$emit('minimize')"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path :d="props.minimized ? 'M6 6h12v12H6Z' : 'M6 12h12'"></path></svg></UiButton>
</div>
</template>
+3 -1
View File
@@ -4,6 +4,8 @@ import { computed } from 'vue';
import { t } from '../../../i18n/index.js';
import { useDisplayStore } from '../../stores/display.js';
import { useSpaceMissionsStore } from '../../stores/spaceMissions.js';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// The phone shell's tab bar and sheet backdrop. They join the end of the
// page when the shell first publishes, after the scene's credits, and leave
@@ -19,7 +21,7 @@ const tabs = computed(() =>
<Teleport v-if="phone" to="body">
<div id="mobile-sheet-backdrop" :hidden="!phone.sheet"></div>
<nav id="mobile-tab-bar" :aria-label="t('Panels')" :aria-hidden="String(!phone.enabled)">
<button v-for="tab in tabs" :key="tab.sheet" type="button" class="mobile-tab" :data-mobile-sheet="tab.sheet" :aria-expanded="String(phone.sheet === tab.sheet)"><span class="material-symbols-outlined mobile-tab-icon" aria-hidden="true">{{ tab.icon }}</span><span class="mobile-tab-label">{{ t(tab.label) }}</span></button>
<UiButton v-for="tab in tabs" :key="tab.sheet" class="mobile-tab" :data-mobile-sheet="tab.sheet" :aria-expanded="String(phone.sheet === tab.sheet)"><UiIcon class="mobile-tab-icon" :name="tab.icon" :size="null" /><span class="mobile-tab-label">{{ t(tab.label) }}</span></UiButton>
</nav>
</Teleport>
</template>
+4 -4
View File
@@ -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>
+3 -2
View File
@@ -2,6 +2,7 @@
import { storeToRefs } from 'pinia';
import { computed, shallowRef } from 'vue';
import { t, tn } from '../../../i18n/index.js';
import UiButton from '../../kit/UiButton.vue';
import UiDialog from '../../kit/UiDialog.vue';
import { vStatusText } from '../../rail/statusText.js';
import { useSceneSharingStore } from '../../stores/sceneSharing.js';
@@ -47,14 +48,14 @@ const chooserStyle = (focused) => ({ padding: '3px 9px', border: '1px solid #397
<div>
<template v-for="item in bodyItems" :key="item.id">
<p v-if="item.kind === 'text'" style="margin: 8px 0">{{ item.value }}</p>
<button v-else-if="item.kind === 'button'" type="button" :style="buttonStyle" :disabled="item.disabled" v-bind="item.hook ? { [item.hook]: '' } : {}" @click="controls?.click(item.id)">{{ item.label }}</button>
<UiButton v-else-if="item.kind === 'button'" :style="buttonStyle" :disabled="item.disabled" v-bind="item.hook ? { [item.hook]: '' } : {}" @click="controls?.click(item.id)">{{ item.label }}</UiButton>
<label v-else-if="item.type === 'file'" :style="{ display: 'block', position: 'relative' }">{{ item.label }}<input type="file" :aria-label="item.label" :multiple="item.multiple" :webkitdirectory="item.directory || undefined" :style="fileInputStyle" @change="onFiles(item, $event)" @focus="focusedFile = item.id" @blur="focusedFile = null" /><span aria-hidden="true" :style="fileRowStyle"><span :style="chooserStyle(focusedFile === item.id)">{{ t('Choose files') }}</span><span>{{ chosenText(item) }}</span></span></label>
<label v-else style="display: block">{{ item.label }}<textarea v-if="item.multiline" rows="9" dir="ltr" spellcheck="false" :aria-label="item.label" :style="fieldStyle(true)" :value="item.value" @input="controls?.setValue(item.id, $event.target.value)"></textarea><input v-else :type="item.type" :aria-label="item.label" :style="fieldStyle(false)" :value="item.value" @input="controls?.setValue(item.id, $event.target.value)" /></label>
</template>
</div>
<p role="status" v-status-text="statusText"></p>
<div>
<button v-for="item in footerItems" :key="item.id" type="button" :style="buttonStyle" :disabled="item.disabled" :autofocus="item.autofocus || undefined" v-bind="item.hook ? { [item.hook]: '' } : {}" @click="controls?.click(item.id)">{{ item.label }}</button>
<UiButton v-for="item in footerItems" :key="item.id" :style="buttonStyle" :disabled="item.disabled" :autofocus="item.autofocus || undefined" v-bind="item.hook ? { [item.hook]: '' } : {}" @click="controls?.click(item.id)">{{ item.label }}</UiButton>
</div>
</UiDialog>
</template>
+2 -1
View File
@@ -2,6 +2,7 @@
import { storeToRefs } from 'pinia';
import { t } from '../../../i18n/index.js';
import { useSceneInteractionsStore } from '../../stores/sceneInteractions.js';
import UiButton from '../../kit/UiButton.vue';
// The active shot's Scene actions panel, inside the viewer's container, as
// the scene interactions owner (src/scenes/interactions.js) presents it.
@@ -45,6 +46,6 @@ const outline = (id) => ({
<template>
<Teleport v-if="panel" :to="panel.container">
<section :key="panel.id" data-director-interactions="" :aria-label="t('Scene actions')" :style="panelStyle"><strong>{{ t('Scene actions') }}</strong><p role="status">{{ panel.status }}</p><button v-for="item in panel.items" :key="item.id" type="button" :data-director-action="item.id" :disabled="panel.busy" :aria-pressed="String(panel.selected === item.id)" :style="outline(item.id)" :onClick="onClick(panel.owner, item.id)">{{ item.label }}</button><div data-director-action-card=""><template v-if="panel.card"><p>{{ panel.card.text }}</p><a v-if="panel.card.url" :href="panel.card.url" target="_blank" rel="noopener noreferrer" style="color: #6eeaff">{{ t('Source') }}</a></template></div></section>
<section :key="panel.id" data-director-interactions="" :aria-label="t('Scene actions')" :style="panelStyle"><strong>{{ t('Scene actions') }}</strong><p role="status">{{ panel.status }}</p><UiButton v-for="item in panel.items" :key="item.id" :data-director-action="item.id" :disabled="panel.busy" :pressed="panel.selected === item.id" :style="outline(item.id)" :onClick="onClick(panel.owner, item.id)">{{ item.label }}</UiButton><div data-director-action-card=""><template v-if="panel.card"><p>{{ panel.card.text }}</p><a v-if="panel.card.url" :href="panel.card.url" target="_blank" rel="noopener noreferrer" style="color: #6eeaff">{{ t('Source') }}</a></template></div></section>
</Teleport>
</template>
+5 -5
View File
@@ -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>
@@ -0,0 +1,304 @@
// The Street Level photo viewer (KartaView, Panoramax) on a page: the photo
// viewer presents it, the store carries it, and StreetLevelPhotoViewer draws
// it into the viewer host, forwards its events and hands its elements back.
import '../../../testSupport/registerDom.mjs';
import test from 'node:test';
import assert from 'node:assert/strict';
import { createApp, nextTick } from 'vue';
import { createPinia } from 'pinia';
import { createPhotoViewer } from '../../../layers/streetLevel/photoViewer.js';
import { subscribePhotoViewers } from '../../../layers/streetLevel/photoViewers.js';
import { useStreetLevelPhotoStore } from '../../stores/streetLevelPhoto.js';
import StreetLevelPhotoViewer from './StreetLevelPhotoViewer.vue';
const PHOTOS = {
f: { id: 'f', sequenceId: 's', lon: 1, lat: 2, heading: 0, isPano: false },
g: { id: 'g', sequenceId: 's', lon: 1, lat: 2, heading: 0, isPano: false },
p: { id: 'p', sequenceId: 's', lon: 1, lat: 2, heading: 0, isPano: true },
};
const SOURCES = {
hasPano: (photo) => photo.isPano,
panoFirst: (photo) => ({ url: `${photo.id}-pano`, width: 2048 }),
panoSharp: () => null,
flatFirst: (photo) => [`https://photos.test/${photo.id}.jpg`],
flatSharp: () => null,
describe: () => ({ externalUrl: 'https://example.org' }),
};
/**
* The view in an app, a viewer per provider published to its store as the
* street-level layer does, and a panel host.
*/
function mount(t, options = {}, providerIds = ['panoramax']) {
document.body.replaceChildren();
const wrap = document.body.appendChild(document.createElement('div'));
wrap.className = 'sl-viewer-wrap';
const host = wrap.appendChild(document.createElement('div'));
host.id = 'sl-viewer';
const pinia = createPinia();
const app = createApp(StreetLevelPhotoViewer).use(pinia);
app.mount(document.body.appendChild(document.createElement('div')));
const store = useStreetLevelPhotoStore(pinia);
const renderers = [];
const stepped = [];
const create = (providerId) =>
createPhotoViewer({
providerId,
name: providerId === 'panoramax' ? 'Panoramax' : 'KartaView',
sources: SOURCES,
getPhoto: async (id) => PHOTOS[id],
// f, then g: the whole sequence.
step: async (photo, delta) =>
({ f: { 1: 'g' }, g: { '-1': 'f' } })[photo.id]?.[delta] ?? null,
onStep: (id) => stepped.push(id),
load: async (url) => ({ src: url }),
createRenderer: (canvas) => {
const view = { yaw: 0, pitch: 0, fov: 80 };
const renderer = {
canvas,
setImage() {},
setView: (next) => Object.assign(view, next),
getView: () => ({ ...view }),
resize() {},
clear() {},
destroy() {},
};
renderers.push(renderer);
return renderer;
},
...options,
});
const viewers = providerIds.map(create);
const unsubscribe = subscribePhotoViewers(viewers, (view) =>
store.publish(view),
);
t.after(() => {
for (const viewer of viewers) viewer.unmount();
unsubscribe();
app.unmount();
});
return { viewer: viewers[0], viewers, host, wrap, renderers, stepped };
}
const tick = () => new Promise((resolve) => setTimeout(resolve, 0));
test('the viewer draws in its host with the markup its stylesheet reads', async (t) => {
const { viewer, host } = mount(t);
await viewer.mount(host);
const root = host.querySelector(':scope > .sl-photo-viewer');
assert.ok(root, 'drawn in the host');
assert.equal(root.dataset.provider, 'panoramax');
assert.equal(root.getAttribute('tabindex'), '0');
assert.equal(root.getAttribute('role'), 'group');
assert.match(root.getAttribute('aria-label'), /^Panoramax photo\. ← and →/);
assert.equal(root.hasAttribute('data-kind'), false, 'nothing shown yet');
const [picture, canvas, prev, next] = root.children;
assert.equal(picture.tagName, 'IMG');
assert.equal(picture.className, 'sl-photo-flat');
assert.equal(picture.getAttribute('alt'), 'Panoramax street-level photo');
assert.equal(picture.getAttribute('draggable'), 'false');
assert.equal(picture.hidden, true);
assert.equal(picture.hasAttribute('src'), false);
assert.equal(picture.style.objectFit, 'contain');
assert.equal(canvas.tagName, 'CANVAS');
assert.equal(canvas.className, 'sl-photo-pano');
assert.equal(canvas.hidden, true);
for (const [button, side, glyph, label] of [
[prev, 'prev', '‹', 'Previous photo in this sequence (←)'],
[next, 'next', '›', 'Next photo in this sequence (→)'],
]) {
assert.equal(button.tagName, 'BUTTON');
assert.equal(button.type, 'button');
assert.ok(button.classList.contains('sl-photo-step'));
assert.ok(button.classList.contains(`sl-photo-step-${side}`));
assert.equal(button.textContent.trim(), glyph);
assert.equal(button.getAttribute('aria-label'), label);
assert.equal(button.getAttribute('title'), label);
assert.equal(button.disabled, true);
assert.equal(button.hasAttribute('aria-pressed'), false);
}
viewer.setRenderMode('fill');
await nextTick();
assert.equal(picture.style.objectFit, 'cover');
viewer.unmount();
await nextTick();
assert.equal(host.children.length, 0, 'unmounted: gone from the host');
});
test('a flat photo shows, ‹ › and ← → step along its sequence, and close hides it', async (t) => {
const { viewer, host, stepped } = mount(t);
await viewer.mount(host);
await viewer.open('f');
await nextTick();
const root = host.querySelector('.sl-photo-viewer');
const [picture, canvas, prev, next] = root.children;
assert.equal(root.dataset.kind, 'flat');
assert.equal(picture.hidden, false);
assert.equal(canvas.hidden, true);
assert.equal(picture.getAttribute('src'), 'https://photos.test/f.jpg');
// ‹ is disabled once its end is known; › stays.
await tick();
await nextTick();
assert.equal(prev.disabled, true);
assert.equal(next.disabled, false);
let bubbled = 0;
host.addEventListener('click', () => bubbled++);
next.click();
await tick();
assert.deepEqual(stepped, ['g']);
assert.equal(bubbled, 0, 'the click stays in the viewer');
await viewer.open('g');
root.dispatchEvent(
new KeyboardEvent('keydown', { key: 'ArrowLeft', bubbles: true }),
);
await tick();
assert.deepEqual(stepped, ['g', 'f']);
viewer.close();
await nextTick();
assert.equal(root.dataset.kind, '');
assert.equal(picture.hidden, true);
assert.equal(picture.hasAttribute('src'), false);
});
test('a step button that disables under the keyboard hands focus to the viewer', async (t) => {
// The sequence's end is known only once the user is on ›.
let answer;
const asked = new Promise((resolve) => (answer = resolve));
const { viewer, host } = mount(t, {
step: async (photo, delta) => (delta > 0 ? asked : null),
});
await viewer.mount(host);
await viewer.open('g');
await nextTick();
const root = host.querySelector('.sl-photo-viewer');
const next = root.children[3];
assert.equal(next.disabled, false);
next.focus();
assert.ok(document.activeElement === next, 'on ›');
answer(null);
await tick();
await nextTick();
assert.equal(next.disabled, true, 'g is the last photo');
assert.ok(document.activeElement === root, 'focus moved to the viewer');
});
test('a panorama draws on the view’s canvas; drag, wheel and a lost context reach the viewer', async (t) => {
const { viewer, host, renderers } = mount(t);
await viewer.mount(host);
await viewer.open('p');
await nextTick();
const root = host.querySelector('.sl-photo-viewer');
const canvas = root.children[1];
assert.ok(renderers[0].canvas === canvas, 'the canvas the view drew');
assert.equal(root.dataset.kind, 'pano');
assert.equal(canvas.hidden, false);
assert.equal(root.children[0].hidden, true);
canvas.dispatchEvent(
new PointerEvent('pointerdown', {
pointerId: 1,
pointerType: 'mouse',
button: 0,
clientX: 0,
clientY: 0,
}),
);
await nextTick();
assert.ok(canvas.classList.contains('sl-photo-dragging'));
canvas.dispatchEvent(new PointerEvent('pointerup', { pointerId: 1 }));
await nextTick();
assert.equal(canvas.classList.contains('sl-photo-dragging'), false);
const wheel = new WheelEvent('wheel', { deltaY: 100, cancelable: true });
canvas.dispatchEvent(wheel);
assert.equal(wheel.defaultPrevented, true, 'the page does not scroll');
assert.ok(renderers[0].getView().fov > 80, 'zoomed out');
// A lost context: a fresh canvas in its place, which the next renderer takes.
canvas.dispatchEvent(new Event('webglcontextlost', { cancelable: true }));
await nextTick();
const fresh = root.children[1];
assert.ok(fresh !== canvas, 'a new canvas');
assert.equal(fresh.className, 'sl-photo-pano');
assert.equal(canvas.isConnected, false, 'the lost one is gone');
await viewer.open('p');
assert.ok(renderers[1].canvas === fresh, 'the next renderer takes it');
});
test('docked, Esc in the viewer’s box is offered to the provider first', async (t) => {
let asked = 0;
const { viewer, host } = mount(t, { onEscape: () => ++asked > 0 });
await viewer.mount(host);
const root = host.querySelector('.sl-photo-viewer');
const escape = new KeyboardEvent('keydown', {
key: 'Escape',
bubbles: true,
cancelable: true,
});
let reachedPage = false;
document.body.addEventListener('keydown', () => (reachedPage = true));
root.dispatchEvent(escape);
assert.equal(asked, 1);
assert.equal(escape.defaultPrevented, true);
assert.equal(reachedPage, false, 'the panel does not collapse');
});
test('without a view, the viewer cannot mount', async () => {
const viewer = createPhotoViewer({
providerId: 'test',
name: 'Test',
sources: SOURCES,
getPhoto: async (id) => PHOTOS[id],
step: async () => null,
onStep() {},
});
await assert.rejects(
viewer.mount(document.createElement('div')),
/no view to draw it/,
);
});
test('a viewer mounted in the tick another unmounts gets elements of its own', async (t) => {
const { viewers, host, renderers } = mount(t, {}, ['kartaview', 'panoramax']);
const [kartaView, panoramax] = viewers;
await kartaView.mount(host);
await kartaView.open('p');
const root = host.querySelector('.sl-photo-viewer');
const canvas = root.children[1];
assert.ok(renderers[0].canvas === canvas);
// The core switches source: one unmounts and the other mounts at once.
kartaView.unmount();
const mounting = panoramax.mount(host);
await mounting;
await panoramax.open('p');
const fresh = host.querySelector('.sl-photo-viewer');
assert.equal(host.children.length, 1);
assert.ok(fresh !== root, 'a root of its own');
assert.equal(fresh.dataset.provider, 'panoramax');
assert.ok(fresh.children[1] !== canvas, 'not the destroyed renderer’s canvas');
assert.ok(renderers[1].canvas === fresh.children[1]);
assert.equal(fresh.dataset.kind, 'pano', 'not the front view');
});
test('a mount overtaken before it is drawn closes, and never shows later', async (t) => {
const { viewers, host } = mount(t, {}, ['kartaview', 'panoramax']);
const [kartaView, panoramax] = viewers;
// KartaView starts mounting; Panoramax mounts before the view draws it.
const overtaken = kartaView.mount(host);
const current = panoramax.mount(host);
// It settles, rather than wait for a draw that never comes.
const outcome = await Promise.race([
overtaken.then(
() => 'mounted',
(error) => error.message,
),
new Promise((resolve) => setTimeout(() => resolve('still pending'), 100)),
]);
assert.match(outcome, /viewer was closed/);
await current;
await nextTick();
assert.equal(host.children.length, 1);
assert.equal(host.children[0].dataset.provider, 'panoramax');
await assert.rejects(kartaView.open('f'), /not mounted/);
// Once Panoramax goes, nothing is left in the host.
panoramax.unmount();
await nextTick();
assert.equal(host.children.length, 0);
});
@@ -0,0 +1,80 @@
<script setup>
import { storeToRefs } from 'pinia';
import UiButton from '../../kit/UiButton.vue';
import { useStreetLevelPhotoStore } from '../../stores/streetLevelPhoto.js';
// The Street Level photo viewer of the providers whose photos are plain
// files (KartaView, Panoramax), in the viewer host the layer mounts it in.
// The viewer (src/layers/streetLevel/photoViewer.js) keeps every decision:
// which photo shows and how, its loading, the panorama it draws, the keys,
// drag and zoom. This view draws what it presents, forwards the events and
// hands each element back: the canvas it draws on, the frame and picture
// it measures, the root and buttons it keeps focus with. Each mount and each
// canvas has its own key, so a viewer never gets another one's elements.
const { photo } = storeToRefs(useStreetLevelPhotoStore());
/** Hand `name`'s element back to the viewer that presented it. */
const keep = (name) => (element) => {
if (element) photo.value?.actions.attach(name, element.$el ?? element);
};
// One function per element: a new one on each render would hand it back
// again each time.
const refs = {
root: keep('root'),
picture: keep('picture'),
canvas: keep('canvas'),
prev: keep('prev'),
next: keep('next'),
};
</script>
<template>
<Teleport v-if="photo" :to="photo.host"
><div
:key="photo.mountKey"
:ref="refs.root"
class="sl-photo-viewer"
:data-provider="photo.providerId"
tabindex="0"
role="group"
:aria-label="photo.label"
:data-kind="photo.kind"
@keydown="photo.actions.keydown"
><img
:ref="refs.picture"
class="sl-photo-flat"
:alt="photo.alt"
draggable="false"
:hidden="photo.kind !== 'flat'"
:src="photo.src ?? undefined"
:style="{ objectFit: photo.fit }" /><canvas
:key="photo.canvasKey"
:ref="refs.canvas"
class="sl-photo-pano"
:class="{ 'sl-photo-dragging': photo.dragging }"
:hidden="photo.kind !== 'pano'"
@pointerdown="photo.actions.pointerdown"
@pointermove="photo.actions.pointermove"
@pointerup="photo.actions.pointerup"
@pointercancel="photo.actions.pointerup"
@wheel="photo.actions.wheel"
@webglcontextlost="photo.actions.contextLost"
></canvas
><UiButton
:ref="refs.prev"
class="sl-photo-step sl-photo-step-prev"
:label="photo.prevLabel"
:disabled="photo.prevDisabled"
@click="photo.actions.step(-1, $event)"
>‹</UiButton
><UiButton
:ref="refs.next"
class="sl-photo-step sl-photo-step-next"
:label="photo.nextLabel"
:disabled="photo.nextDisabled"
@click="photo.actions.step(1, $event)"
>›</UiButton
></div
></Teleport
>
</template>
+31 -18
View File
@@ -10,7 +10,9 @@ import { shownLayerName } from '../../layerNames.js';
import { entityKind } from '../../../data/entityContext.js';
import SpotConditions from './SpotConditions.vue';
import SunDial from './SunDial.vue';
import UiButton from '../../kit/UiButton.vue';
import UiCloseButton from '../../kit/UiCloseButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
import AltitudeGraph from './AltitudeGraph.vue';
// What the Context panel shows while nothing is picked: where the camera is
@@ -284,7 +286,7 @@ const distance = (km) =>
<h3 v-if="globeView" class="view-context__title">{{ t('Globe view') }}</h3>
<template v-else>
<header class="view-context__head">
<span class="material-symbols-outlined view-context__icon" aria-hidden="true">visibility</span>
<UiIcon class="view-context__icon" name="visibility" :size="null" />
<div class="view-context__kind">
<span>{{ t('In view') }}</span>
<span class="view-context__sub">{{ t('Nothing selected') }}</span>
@@ -298,11 +300,18 @@ const distance = (km) =>
<div v-if="globeView && worldTiles.length" class="view-context__world">
<h4>{{ t('Worldwide now') }}</h4>
<div class="view-context__world-grid">
<component :is="tile.on ? 'div' : 'button'" v-for="tile in worldTiles" :key="tile.id" :type="tile.on ? undefined : 'button'" class="view-context__world-tile" :class="{ 'is-off': !tile.on }" :title="tile.on ? undefined : t('Turn on {name}', { name: tile.name })" @click="tile.on ? undefined : turnOn(tile)">
<span class="material-symbols-outlined" aria-hidden="true">{{ tile.icon }}</span>
<strong>{{ tile.on ? (tile.count === null ? '…' : formatNumber(tile.count)) : t('Off') }}</strong>
<span>{{ tile.name }}</span>
</component>
<template v-for="tile in worldTiles" :key="tile.id">
<div v-if="tile.on" class="view-context__world-tile">
<UiIcon :name="tile.icon" :size="null" />
<strong>{{ tile.count === null ? '…' : formatNumber(tile.count) }}</strong>
<span>{{ tile.name }}</span>
</div>
<UiButton v-else class="view-context__world-tile is-off" :title="t('Turn on {name}', { name: tile.name })" @click="turnOn(tile)">
<UiIcon :name="tile.icon" :size="null" />
<strong>{{ t('Off') }}</strong>
<span>{{ tile.name }}</span>
</UiButton>
</template>
</div>
</div>
@@ -356,24 +365,28 @@ const distance = (km) =>
<p class="view-context__total">{{ totalLine }}</p>
<div v-for="group in groups" :key="group.layerId" class="view-context__group">
<h4>
<span class="material-symbols-outlined" aria-hidden="true">{{ group.icon }}</span>
<UiIcon :name="group.icon" :size="null" />
<span>{{ shownLayerName(group.layerName, group.layerId) }}</span>
<span class="view-context__count">{{ group.count }}</span>
</h4>
<ul>
<li v-for="item in group.items" :key="item.key">
<button type="button" @click="store.select(item.identity, { fly: true })">
<span
<UiButton @click="store.select(item.identity, { fly: true })">
<!-- A motion glyph is an image with its own name, not decoration. -->
<UiIcon
v-if="motionOf(item)"
class="material-symbols-outlined view-context__row-motion"
class="view-context__row-motion"
:name="motionOf(item).icon"
:size="null"
:data-motion="item.identity.record.motion"
:title="motionOf(item).label()"
role="img"
:aria-label="motionOf(item).label()"
>{{ motionOf(item).icon }}</span>
:aria-hidden="null"
/>
<span class="view-context__row-title">{{ item.title }}</span>
<span class="view-context__row-meta">{{ distance(item.distanceKm) }}</span>
</button>
</UiButton>
</li>
</ul>
</div>
@@ -387,7 +400,7 @@ const distance = (km) =>
<div v-if="shownTowns.length" class="view-context__towns">
<h4>{{ t('Places in view') }}</h4>
<div class="view-context__chips">
<button v-for="town in shownTowns" :key="town.name" type="button" @click="goToTown(town)">{{ town.name }}</button>
<UiButton v-for="town in shownTowns" :key="town.name" @click="goToTown(town)">{{ town.name }}</UiButton>
</div>
</div>
@@ -396,16 +409,16 @@ const distance = (km) =>
<div v-if="offLayers.length && !globeView" class="view-context__towns">
<h4>{{ t('Show here') }}</h4>
<div class="view-context__chips">
<button v-for="layer in offLayers" :key="layer.id" type="button" class="view-context__chip--layer" @click="turnOn(layer)">
<span class="material-symbols-outlined" aria-hidden="true">add</span>{{ layer.name }}
</button>
<UiButton v-for="layer in offLayers" :key="layer.id" class="view-context__chip--layer" @click="turnOn(layer)">
<UiIcon name="add" :size="null" />{{ layer.name }}
</UiButton>
</div>
</div>
<div class="view-context__actions">
<button type="button" class="entity-card__action entity-card__action--ask" @click="store.askAboutView(groups)">
<UiButton class="entity-card__action entity-card__action--ask" @click="store.askAboutView(groups)">
<svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path d="M4 5h16v11H9l-5 4z" /></svg>{{ t("Ask GEV what's here") }}
</button>
</UiButton>
</div>
</section>
</template>
+7 -6
View File
@@ -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>
+3 -2
View File
@@ -23,6 +23,7 @@ import {
import StoriesHeader from './StoriesHeader.vue';
import UiButton from '../../kit/UiButton.vue';
import UiCheckbox from '../../kit/UiCheckbox.vue';
import UiSelect from '../../kit/UiSelect.js';
/**
* Explore (prototype `.scr-explore`): the feed beside GEV's Cesium globe,
@@ -446,11 +447,11 @@ defineExpose({
>
<div class="fh-tools">
<label class="sr" for="exSort">{{ t('Sort stories') }}</label>
<select id="exSort" v-model="sort" class="fh-sort">
<UiSelect id="exSort" v-model="sort" class="fh-sort">
<option value="new">{{ t('Newest') }}</option>
<option value="long">{{ t('Longest') }}</option>
<option value="az">{{ t('A–Z') }}</option>
</select>
</UiSelect>
<UiButton
id="exFilterBtn"
ref="filterBtn"