Merge branch 'main' into fix/zoom-freeze-under-icons

This commit is contained in:
Sameh Khamis authored and GitHub committed 2026-11-19 12:41:34 -08:00
commit 222c152360
40 files changed
+651 -202

No files matched your search

+8 -2
View File
@@ -90,8 +90,14 @@ test('the ring renders its overlay in the viewer container', async (t) => {
['DIV', 'celestial-ring-outline'],
['CANVAS', 'celestial-ring-canvas celestial-sun-canvas'],
['CANVAS', 'celestial-ring-canvas celestial-moon-canvas'],
['SPAN', 'celestial-marker celestial-sun material-symbols-outlined'],
['SPAN', 'celestial-marker celestial-moon material-symbols-outlined'],
[
'SPAN',
'ui-icon material-symbols-outlined celestial-marker celestial-sun',
],
[
'SPAN',
'ui-icon material-symbols-outlined celestial-marker celestial-moon',
],
],
);
assert.equal(root.children[0].style.display, 'none');
+21 -8
View File
@@ -74,10 +74,14 @@ const voiceActions = fs.readFileSync(
test('Cockpit has one reset action beside its bottom exit path', () => {
assert.doesNotMatch(html, /id="cockpit-quick-entry"/);
assert.doesNotMatch(html, /id="cockpit-exit"/);
assert.match(
html,
/id="map-view-switch"[^>]*aria-label="Exit cockpit view"[^>]*aria-keyshortcuts="Escape"[\s\S]*?close_fullscreen[\s\S]*?EXIT COCKPIT/,
// The exit button's attributes, in whatever order the button renders them.
const exit = html.match(
/<button\b(?=[^>]*\sid="map-view-switch")([^>]*)>([\s\S]*?)<\/button>/,
);
assert.ok(exit, 'Cockpit exit is missing');
assert.match(exit[1], /\saria-label="Exit cockpit view"/);
assert.match(exit[1], /\saria-keyshortcuts="Escape"/);
assert.match(exit[2], /close_fullscreen[\s\S]*?EXIT COCKPIT/);
const topCenterActions = html.match(
/<nav id="top-center-actions"[\s\S]*?<\/nav>/,
);
@@ -108,9 +112,18 @@ test('Cockpit has one reset action beside its bottom exit path', () => {
/id="reset-globe-view"/,
'map-only reset must stay outside Cockpit',
);
assert.match(
viewSwitcher[0],
/id="cockpit-reset-globe"[^>]*type="button"[^>]*aria-label="Reset cockpit to full globe view"[^>]*hidden[\s\S]*?public[\s\S]*?RESET[\s\S]*?id="map-view-switch"/,
// The reset button's attributes, in whatever order the button renders them.
const reset = viewSwitcher[0].match(
/<button\b(?=[^>]*\sid="cockpit-reset-globe")([^>]*)>([\s\S]*?)<\/button>/,
);
assert.ok(reset, 'Cockpit Reset is missing from the view switcher');
assert.match(reset[1], /\stype="button"/);
assert.match(reset[1], /\saria-label="Reset cockpit to full globe view"/);
assert.match(reset[1], /\shidden(?=[\s>=]|$)/);
assert.match(reset[2], /public[\s\S]*?RESET/);
assert.ok(
viewSwitcher[0].indexOf('id="map-view-switch"') > reset.index,
'Cockpit Reset must sit before the exit button',
);
const actions = html.match(
@@ -369,11 +382,11 @@ test('Cockpit owns a focused shared Display portal and compact Radio controls',
assert.doesNotMatch(html, /data-cockpit-display-slot="presets"/);
assert.match(
html,
/id="clear-selected-layers"[^>]*aria-label="Clear selected data layers"/,
/<button\b(?=[^>]*\bid="clear-selected-layers")[^>]*aria-label="Clear selected data layers"/,
);
assert.match(
html,
/id="reset-globe-view"[^>]*aria-label="Reset to full globe view"/,
/<button\b(?=[^>]*\bid="reset-globe-view")[^>]*aria-label="Reset to full globe view"/,
);
assert.match(
css,
+1 -1
View File
@@ -140,7 +140,7 @@ test('Context async action buttons remain focused while busy', () => {
'utf8',
);
const clearButton = globeActions.match(
/<button id="clear-selected-layers"[^>]*>/,
/<UiButton id="clear-selected-layers"[^>]*>/,
)?.[0];
assert.ok(clearButton, 'Clear selected layers button is missing');
assert.doesNotMatch(clearButton, /disabled(?!=")|:disabled=/);
+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>
+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
@@ -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');
+148
View File
@@ -0,0 +1,148 @@
// The Cockpit HUD's controls and glyphs are the kit's: no Cockpit view
// hand-writes a <button>, a Material Symbols span, a select, a checkbox or a
// range. Its buttons are ghost UiButtons that keep their ids, classes and
// labels for the Cockpit controller's listeners and the cockpit stylesheets;
// its glyphs are UiIcons with `:size="null"`, so those stylesheets still size
// them. The utility strip's −, ◀ ▶ and transport glyphs and the orbital
// zoom's − and + are text characters, not Material symbols, and stay text.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readdirSync, readFileSync } from 'node:fs';
/** A view's template block: everything outside script, style and comments. */
function template(file) {
const source = readFileSync(
new URL(`../views/${file}`, import.meta.url),
'utf8',
);
return source
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
}
const views = {
// The vision selector's Previous, Current and Next, Look ahead, and the
// view switcher's Reset and Exit; the speed and altitude rims' pointers,
// the two vision chevrons, the reticle, the heading caret and the view
// switcher's two glyphs.
'CockpitView.vue': { buttons: 6, icons: 8 },
// Display's and Radio's collapse and launcher buttons, Radio's Enable,
// Previous, Play and Next, and the desktop rail's two items and glyphs.
'panels/CockpitUtilityControls.vue': { buttons: 10, icons: 2 },
// Previous, Next, Auto, the card's collapse and the three page tabs; the
// first, second and fourth draw a glyph.
'panels/CockpitBriefing.vue': { buttons: 7, icons: 3 },
// Previous, Next, the card's collapse and Weather; three of them draw a
// glyph, and the nearest contact's arrow is the fourth.
'panels/CockpitContext.vue': { buttons: 4, icons: 4 },
// A signal row's target and its chevron.
'panels/CockpitSignalList.vue': { buttons: 1, icons: 1 },
// TLE, Nadir, Zoom out, Zoom in and Sensor.
'panels/CockpitOrbital.vue': { buttons: 5, icons: 0 },
// The range step.
'panels/CockpitRadar.vue': { buttons: 1, icons: 0 },
// The flight plan's arrow.
'panels/CockpitRoute.vue': { buttons: 0, icons: 1 },
// Readouts only.
'panels/CockpitProgress.vue': { buttons: 0, icons: 0 },
'panels/CockpitRollingValue.vue': { buttons: 0, icons: 0 },
};
// A tag's attributes, read past quoted values so a handler's `=>` does not
// end the tag early.
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tag = (pattern, flags = '') =>
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
const markup = Object.fromEntries(
Object.keys(views).map((file) => [file, template(file)]),
);
test('every Cockpit view is in the list above', () => {
const dir = (sub) =>
readdirSync(new URL(`../views/${sub}`, import.meta.url))
.filter((name) => /^Cockpit.*\.vue$/.test(name))
.map((name) => sub + name);
assert.deepEqual(
[...dir(''), ...dir('panels/')].sort(),
Object.keys(views).sort(),
);
});
test('the Cockpit views hand-write no button; each is a UiButton', () => {
for (const [file, { buttons }] of Object.entries(views)) {
assert.deepEqual(markup[file].match(/<button\b/gi) ?? [], [], file);
assert.equal(
markup[file].match(/<UiButton\b/g)?.length ?? 0,
buttons,
file,
);
}
});
test('the Cockpit views hand-write no select, checkbox or range', () => {
for (const [file, view] of Object.entries(markup)) {
assert.deepEqual(view.match(/<(select|input)\b/gi) ?? [], [], file);
}
// The compact Radio volume.
assert.equal(
markup['panels/CockpitUtilityControls.vue'].match(/<UiSlider\b/g)?.length,
1,
);
});
test('the pressed toggles take the kit pressed state', () => {
for (const view of Object.values(markup))
assert.doesNotMatch(view, tag(String.raw`<\w+\bATTRS\s:?aria-pressed`));
const pressed = Object.values(markup).flatMap(
(view) =>
view.match(tag(String.raw`<UiButton\bATTRS\s:pressed=ATTRS>`, 'g')) ?? [],
);
// Radio's Enable, the briefing's Auto and the Contact card's Weather.
assert.equal(pressed.length, 3);
for (const button of pressed) assert.match(button, /:pressed="Boolean\(/);
assert.match(
markup['panels/CockpitUtilityControls.vue'],
tag(
String.raw`<UiButton\s+id="cockpit-radio-enable-btn"ATTRS\s:pressed="Boolean\(cockpit\?\.enable\.active\)" pressed-class="active"`,
),
);
assert.match(
markup['panels/CockpitBriefing.vue'],
tag(
String.raw`<UiButton\s+id="cockpit-brief-auto"ATTRS\s:pressed="Boolean\(b\.autoRotate\)"`,
),
);
assert.match(
markup['panels/CockpitContext.vue'],
tag(
String.raw`<UiButton\s+id="cockpit-weather-toggle"ATTRS\s:pressed="Boolean\(c\.weather\)"`,
),
);
});
test('the Cockpit views hand-write no Material glyph; each is a UiIcon', () => {
for (const [file, { icons }] of Object.entries(views)) {
assert.deepEqual(
markup[file].match(/material-symbols-outlined/g) ?? [],
[],
file,
);
const found =
markup[file].match(tag(String.raw`<UiIcon\bATTRS>`, 'g')) ?? [];
assert.equal(found.length, icons, file);
// Without it the kit writes an 18px size that beats the cockpit's rules.
for (const icon of found) assert.match(icon, /\s:size="null"/, file);
}
});
test('the heading caret outranks the kit icon rule that loads after it', () => {
const css = readFileSync(
new URL('../styles/cockpit.css', import.meta.url),
'utf8',
);
// kit.css's `.ui-icon` sets display and line-height with one class and
// loads after cockpit.css, so a one-class caret rule would lose to it.
assert.match(
css,
/\n\.cockpit-compass \.cockpit-heading-caret \{\n {2}display: block;/,
);
assert.doesNotMatch(css, /\n\.cockpit-heading-caret \{/);
});
+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/);
});
+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
+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');
});
+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 || []"
+3 -1
View File
@@ -703,7 +703,9 @@ html:not([lang='en']) .cockpit-roll-token.is-separator {
color: var(--cockpit-accent);
font-size: 12px;
}
.cockpit-heading-caret {
/* Inside the compass, so it outranks the kit icon's own display and
line height. */
.cockpit-compass .cockpit-heading-caret {
display: block;
height: 20px;
color: var(--cockpit-accent);
+22 -20
View File
@@ -17,6 +17,8 @@ import CockpitProgress from './panels/CockpitProgress.vue';
import CockpitRadar from './panels/CockpitRadar.vue';
import CockpitRollingValue from './panels/CockpitRollingValue.vue';
import CockpitUtilityControls from './panels/CockpitUtilityControls.vue';
import UiButton from '../kit/UiButton.vue';
import UiIcon from '../kit/UiIcon.vue';
// The Cockpit HUD. The Cockpit controller presents the instruments, the
// destination arrow and the vision selector on every HUD update; until it
@@ -171,7 +173,7 @@ const tickStyle = (tick) =>
<span v-for="(tick, index) in hud.speedRim.ticks" :key="index" data-speed-rim-tick :hidden="tick.hidden" :class="{ major: tick.major }" :style="tickStyle(tick)"><b>{{ tick.label }}</b><i></i></span>
</div>
<div class="cockpit-altitude-rim-pointer">
<span class="material-symbols-outlined">arrow_right</span>
<UiIcon name="arrow_right" :size="null" />
<strong id="cockpit-speed-rim-value">{{ hud.speedRim.value }}</strong>
</div>
</div>
@@ -183,7 +185,7 @@ const tickStyle = (tick) =>
</div>
<div class="cockpit-altitude-rim-pointer">
<strong id="cockpit-altitude-rim-value">{{ hud.altitudeRim.value }}</strong>
<span class="material-symbols-outlined">arrow_left</span>
<UiIcon name="arrow_left" :size="null" />
</div>
</div>
<div class="cockpit-topline">
@@ -193,21 +195,21 @@ const tickStyle = (tick) =>
<span id="cockpit-aircraft-meta" v-class-toggle="{ emergency: hud.meta.emergency }" class="cockpit-aircraft-meta" :data-tone="generic ? hud.meta.tone : undefined">{{ hud.meta.text }}</span>
</div>
<div class="cockpit-vision-controls" role="group" :aria-label="t('Cockpit vision style')">
<button id="cockpit-vision-previous" class="cockpit-vision-nav" type="button" :aria-label="t('Previous cockpit vision style')" :title="t('Previous vision style')">
<span class="material-symbols-outlined" aria-hidden="true">chevron_left</span>
<UiButton id="cockpit-vision-previous" class="cockpit-vision-nav" :aria-label="t('Previous cockpit vision style')" :title="t('Previous vision style')">
<UiIcon name="chevron_left" :size="null" />
<small>{{ t('PREV') }}</small>
</button>
<button id="cockpit-vision-current" class="cockpit-vision-current" type="button" :data-cockpit-vision="v.mode" :aria-label="visionLabel" :title="visionTitle">
</UiButton>
<UiButton id="cockpit-vision-current" class="cockpit-vision-current" :data-cockpit-vision="v.mode" :aria-label="visionLabel" :title="visionTitle">
<small>{{ t('CURRENT') }}</small>
<strong id="cockpit-vision-current-label" aria-live="polite">{{ v.label }}</strong>
</button>
<button id="cockpit-vision-next" class="cockpit-vision-nav" type="button" :aria-label="t('Next cockpit vision style')" :title="t('Next vision style')">
</UiButton>
<UiButton id="cockpit-vision-next" class="cockpit-vision-nav" :aria-label="t('Next cockpit vision style')" :title="t('Next vision style')">
<small>{{ t('NEXT') }}</small>
<span class="material-symbols-outlined" aria-hidden="true">chevron_right</span>
</button>
<UiIcon name="chevron_right" :size="null" />
</UiButton>
</div>
</div>
<div v-if="!orbital && !generic" class="cockpit-reticle material-symbols-outlined" aria-hidden="true">my_location</div>
<UiIcon v-if="!orbital && !generic" name="my_location" class="cockpit-reticle" :size="null" />
<!-- A provider's banner: a status that names where the subject is. -->
<div v-if="generic && hud.banner" class="cockpit-banner" role="status" :data-tone="hud.banner.tone">
<strong>{{ hud.banner.title }}</strong>
@@ -216,9 +218,9 @@ const tickStyle = (tick) =>
<!-- A view turned off its rest says where it looks and offers the way back. -->
<div v-if="looks" class="cockpit-look" :hidden="!look.offset">
<span id="cockpit-look-readout" class="cockpit-look-readout" aria-live="polite">{{ look.readout }}</span>
<button id="cockpit-look-ahead" type="button" class="cockpit-look-ahead" :aria-label="aheadLabel" :title="t('Look ahead (Home or 0)')" aria-keyshortcuts="Home 0">
<UiButton id="cockpit-look-ahead" class="cockpit-look-ahead" :aria-label="aheadLabel" :title="t('Look ahead (Home or 0)')" aria-keyshortcuts="Home 0">
<span>{{ t('LOOK AHEAD') }}</span>
</button>
</UiButton>
</div>
<div v-if="!orbital" class="cockpit-compass" :aria-label="generic ? hudLabel : bridge ? t('Current vessel heading') : t('Current aircraft heading')">
<div class="cockpit-instrument-row">
@@ -241,7 +243,7 @@ const tickStyle = (tick) =>
<span class="cockpit-readout-unit">{{ t('FT') }}</span>
</div>
</div>
<span class="cockpit-heading-caret material-symbols-outlined" aria-hidden="true">arrow_drop_down</span>
<UiIcon name="arrow_drop_down" class="cockpit-heading-caret" :size="null" />
<div class="cockpit-compass-tape" id="cockpit-compass-tape" aria-hidden="true" :style="bridge ? { '--tape-shift': tapeShift } : undefined"><span v-for="division in hud.compass" :key="division.heading ?? division.slot" :class="(division.active ?? division.slot === 0) ? 'active' : ''" :style="{ '--slot': division.slot, '--depth': Math.abs(division.slot) }">{{ division.label }}</span><template v-if="bridge"><i v-if="hud.compassMarkers?.prograde != null" class="cockpit-compass-marker cockpit-compass-prograde" aria-hidden="true" :style="{ '--slot': hud.compassMarkers.prograde }"></i><i v-if="hud.compassMarkers?.retrograde != null" class="cockpit-compass-marker cockpit-compass-retrograde" aria-hidden="true" :style="{ '--slot': hud.compassMarkers.retrograde }"></i></template></div>
</div>
<div v-if="!orbital" class="cockpit-position-readout">
@@ -274,13 +276,13 @@ const tickStyle = (tick) =>
</section>
<nav id="view-switcher" :aria-label="t('View switcher')">
<button id="cockpit-reset-globe" type="button" :aria-label="resetBusy ? t('Resetting cockpit to full globe view') : t('Reset cockpit to full globe view')" :title="t('Exit cockpit and return to full globe view')" :hidden="!active" @click="globe.act('reset')">
<span class="material-symbols-outlined" aria-hidden="true">public</span>
<UiButton id="cockpit-reset-globe" :aria-label="resetBusy ? t('Resetting cockpit to full globe view') : t('Reset cockpit to full globe view')" :title="t('Exit cockpit and return to full globe view')" :hidden="!active" @click="globe.act('reset')">
<UiIcon name="public" :size="null" />
<span>{{ t('RESET') }}</span>
</button>
<button id="map-view-switch" type="button" :aria-label="exitLabel" aria-keyshortcuts="Escape" :title="exitLabel" :hidden="!active">
<span class="material-symbols-outlined" aria-hidden="true">close_fullscreen</span>
</UiButton>
<UiButton id="map-view-switch" :aria-label="exitLabel" aria-keyshortcuts="Escape" :title="exitLabel" :hidden="!active">
<UiIcon name="close_fullscreen" :size="null" />
<span>{{ exitText }}</span>
</button>
</UiButton>
</nav>
</template>
+2 -1
View File
@@ -2,11 +2,12 @@
import { t } from '../../i18n/index.js';
import { useDisplayStore } from '../stores/display.js';
import DisplayPanel from './panels/DisplayPanel.vue';
import UiButton from '../kit/UiButton.vue';
const display = useDisplayStore();
</script>
<template>
<DisplayPanel />
<button id="clean-view-exit" @click="display.act('exitCleanView')" :title="t('Return UI controls')">{{ t('EXIT CLEAN VIEW') }}</button>
<UiButton id="clean-view-exit" @click="display.act('exitCleanView')" :title="t('Return UI controls')">{{ t('EXIT CLEAN VIEW') }}</UiButton>
</template>
+5 -3
View File
@@ -4,6 +4,8 @@ import { storeToRefs } from 'pinia';
import { useHudStore } from '../stores/hud.js';
import { useCockpitStore } from '../stores/cockpit.js';
import { cockpitEntryFace } from '../cockpitPresentation.js';
import UiButton from '../kit/UiButton.vue';
import UiIcon from '../kit/UiIcon.vue';
// The readouts, visibility, layout variant and colors IntelHUD publishes.
const { hud } = storeToRefs(useHudStore());
@@ -56,10 +58,10 @@ const entry = computed(() =>
<div class="hud-readout"><div id="hud-gsd">{{ view.gsd }}</div></div>
<div class="hud-readout"><div id="hud-alt">{{ view.alt }}</div></div>
<div class="hud-readout"><div id="hud-ais-vessel" :class="['hud-ais-vessel', { active: view.vessel.active }]">{{ view.vessel.text }}</div></div>
<button id="cockpit-entry-readout" type="button" :hidden="!cockpit?.entryAvailable">
<span class="material-symbols-outlined" aria-hidden="true">{{ entry.icon }}</span>
<UiButton id="cockpit-entry-readout" :hidden="!cockpit?.entryAvailable">
<UiIcon :name="entry.icon" :size="null" />
<span>{{ entry.label }}</span>
</button>
</UiButton>
</div>
<div class="hud-bracket">┘</div>
</div>
+1 -1
View File
@@ -78,7 +78,7 @@ const vToastText = {
<!-- Title -->
<div id="title-bar">
<div class="title-glow"></div>
<h1 aria-labelledby="title-wordmark"><button type="button" class="title-logo brand-logo" data-logo-gaze data-logo-src="/logo.svg" :aria-label="t('Back to live at the starting view')" :title="t('Back to live at the starting view')" @click="globeActions.act('home')"><img src="/logo.svg" alt="" /></button> <span id="title-wordmark" translate="no">GOD'S EYE <span class="title-accent">VIEW</span></span></h1>
<h1 aria-labelledby="title-wordmark"><UiButton class="title-logo brand-logo" data-logo-gaze data-logo-src="/logo.svg" :aria-label="t('Back to live at the starting view')" :title="t('Back to live at the starting view')" @click="globeActions.act('home')"><img src="/logo.svg" alt="" /></UiButton> <span id="title-wordmark" translate="no">GOD'S EYE <span class="title-accent">VIEW</span></span></h1>
<p class="subtitle scene-text-holdout">{{ t('NO PLACE LEFT BEHIND') }}</p>
<div v-if="fps" class="frame-rate-readout scene-text-holdout" :hidden="!fps.visible" :title="t('Rendered globe frames per second · toggle with `')">{{ fps.text }}</div>
</div>
+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>
+13 -12
View File
@@ -7,6 +7,7 @@ import { useCockpitStore } from '../../stores/cockpit.js';
import CockpitRoute from './CockpitRoute.vue';
import CockpitSignalList from './CockpitSignalList.vue';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// The Cockpit briefing card. The Cockpit controller presents its pages,
// cycle toggle, regional news and local conditions; until it does, the card
@@ -45,17 +46,17 @@ function leaveSignals() {
<strong id="cockpit-brief-subtitle">{{ b.subtitle }}</strong>
</div>
<nav class="cockpit-card-actions cockpit-brief-actions" :aria-label="t('Cockpit briefing controls')">
<button id="cockpit-brief-previous" type="button" :aria-label="t('Previous briefing page')" :title="t('Previous briefing page')">
<span class="material-symbols-outlined" aria-hidden="true">chevron_left</span>
</button>
<UiButton id="cockpit-brief-previous" :aria-label="t('Previous briefing page')" :title="t('Previous briefing page')">
<UiIcon name="chevron_left" :size="null" />
</UiButton>
<span id="cockpit-brief-position" aria-live="polite">{{ b.position }}</span>
<button id="cockpit-brief-next" type="button" :aria-label="t('Next briefing page')" :title="t('Next briefing page')">
<span class="material-symbols-outlined" aria-hidden="true">chevron_right</span>
</button>
<UiButton id="cockpit-brief-next" :aria-label="t('Next briefing page')" :title="t('Next briefing page')">
<UiIcon name="chevron_right" :size="null" />
</UiButton>
<UiButton id="cockpit-brief-auto" :aria-label="b.autoLabel" :pressed="Boolean(b.autoRotate)" :title="b.autoHelp">{{ b.autoLabel }}</UiButton>
<button id="cockpit-signal-toggle" type="button" :aria-label="collapsed ? t('Expand cockpit briefing panel') : t('Collapse cockpit briefing panel')" :aria-expanded="String(!collapsed)" :title="collapsed ? t('Expand briefing panel') : t('Collapse briefing panel')">
<span class="material-symbols-outlined" aria-hidden="true">{{ collapsed ? 'right_panel_open' : 'right_panel_close' }}</span>
</button>
<UiButton id="cockpit-signal-toggle" :aria-label="collapsed ? t('Expand cockpit briefing panel') : t('Collapse cockpit briefing panel')" :aria-expanded="String(!collapsed)" :title="collapsed ? t('Expand briefing panel') : t('Collapse briefing panel')">
<UiIcon :name="collapsed ? 'right_panel_open' : 'right_panel_close'" :size="null" />
</UiButton>
</nav>
</header>
<div class="cockpit-brief-stage">
@@ -83,9 +84,9 @@ function leaveSignals() {
<footer class="cockpit-signal-footer">
<span id="cockpit-brief-source">{{ b.source }}</span>
<nav class="cockpit-brief-tabs" :aria-label="t('Cockpit briefing pages')">
<button type="button" data-cockpit-brief-index="0" :aria-label="t('Show Live Signals')" :aria-current="String(b.pageIndex === 0)">{{ t('SIG') }}</button>
<button type="button" data-cockpit-brief-index="1" :aria-label="t('Show Regional News')" :aria-current="brief ? String(b.pageIndex === 1) : undefined">{{ t('NEWS') }}</button>
<button type="button" data-cockpit-brief-index="2" :aria-label="t('Show Local Info')" :aria-current="brief ? String(b.pageIndex === 2) : undefined">{{ t('LOCAL') }}</button>
<UiButton data-cockpit-brief-index="0" :aria-label="t('Show Live Signals')" :aria-current="String(b.pageIndex === 0)">{{ t('SIG') }}</UiButton>
<UiButton data-cockpit-brief-index="1" :aria-label="t('Show Regional News')" :aria-current="brief ? String(b.pageIndex === 1) : undefined">{{ t('NEWS') }}</UiButton>
<UiButton data-cockpit-brief-index="2" :aria-label="t('Show Local Info')" :aria-current="brief ? String(b.pageIndex === 2) : undefined">{{ t('LOCAL') }}</UiButton>
</nav>
</footer>
</aside>
+11 -10
View File
@@ -6,6 +6,7 @@ import { createContextState } from '../../cockpitContextState.js';
import { vClassToggle } from '../../rail/classToggle.js';
import { useCockpitStore } from '../../stores/cockpit.js';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
// The Cockpit Contact card. The Cockpit controller presents its scope,
// navigation, cohort counts, nearest contact and weather toggle; until it
@@ -36,15 +37,15 @@ const weatherLabel = computed(() =>
<strong id="cockpit-context-subject">{{ c.subject }}</strong>
</div>
<nav class="cockpit-card-actions cockpit-context-actions" :aria-label="t('Contact navigation')">
<button id="cockpit-context-previous" type="button" :disabled="!c.canPrevious" :aria-label="t('Previous — prior visited contact in the 250 km window')" :title="t('Previous — prior visited contact in the 250 km window')">
<span class="material-symbols-outlined" aria-hidden="true">skip_previous</span>
</button>
<button id="cockpit-context-next" type="button" :disabled="!c.canNext" :aria-label="t('Next — nearest unvisited contact in the 250 km window')" :title="t('Next — nearest unvisited contact in the 250 km window')">
<span class="material-symbols-outlined" aria-hidden="true">skip_next</span>
</button>
<button id="cockpit-context-toggle" type="button" :aria-label="collapsed ? t('Expand Contact panel') : t('Collapse Contact panel')" :aria-expanded="String(!collapsed)" :title="collapsed ? t('Expand contact panel') : t('Collapse contact panel')">
<span class="material-symbols-outlined" aria-hidden="true">{{ collapsed ? 'chevron_right' : 'chevron_left' }}</span>
</button>
<UiButton id="cockpit-context-previous" :disabled="!c.canPrevious" :aria-label="t('Previous — prior visited contact in the 250 km window')" :title="t('Previous — prior visited contact in the 250 km window')">
<UiIcon name="skip_previous" :size="null" />
</UiButton>
<UiButton id="cockpit-context-next" :disabled="!c.canNext" :aria-label="t('Next — nearest unvisited contact in the 250 km window')" :title="t('Next — nearest unvisited contact in the 250 km window')">
<UiIcon name="skip_next" :size="null" />
</UiButton>
<UiButton id="cockpit-context-toggle" :aria-label="collapsed ? t('Expand Contact panel') : t('Collapse Contact panel')" :aria-expanded="String(!collapsed)" :title="collapsed ? t('Expand contact panel') : t('Collapse contact panel')">
<UiIcon :name="collapsed ? 'chevron_right' : 'chevron_left'" :size="null" />
</UiButton>
</nav>
<span class="cockpit-context-qualifier">{{ t('CONTEXT ONLY') }}</span>
</header>
@@ -55,7 +56,7 @@ const weatherLabel = computed(() =>
<div v-class-toggle="{ unknown: c.cohorts['military-installations'].unknown }" role="listitem" data-context-cohort="military-installations"><span>{{ t('SITE') }}</span><strong>{{ c.cohorts['military-installations'].count }}</strong><small translate="no" :title="c.cohorts['military-installations'].source">{{ c.cohorts['military-installations'].source }}</small></div>
</div>
<div class="cockpit-context-nearest">
<span id="cockpit-context-direction" v-class-toggle="{ unknown: c.direction.unknown }" class="material-symbols-outlined" :style="directionStyle" aria-hidden="true">navigation</span>
<UiIcon id="cockpit-context-direction" v-class-toggle="{ unknown: c.direction.unknown }" name="navigation" :size="null" :style="directionStyle" />
<div>
<small>{{ t('NEAREST OBSERVED / MAPPED') }}</small>
<strong id="cockpit-context-nearest-label" :aria-label="c.nearest.ariaLabel ?? undefined">{{ c.nearest.label }}</strong>
+9 -7
View File
@@ -14,6 +14,7 @@ import {
shownOwnerMark,
} from '../../ownerFlag.js';
import { useCockpitStore } from '../../stores/cockpit.js';
import UiButton from '../../kit/UiButton.vue';
// The orbital view's HUD: a nadir reticle over the picture, the satellite's
// identity and orbit, and the optical zoom. The Cockpit controller presents
@@ -118,14 +119,15 @@ const sensorStepShown = computed(
// A focused control that turns off (a zoom button at the end of its range,
// SENSOR as the view tilts away) hands focus on instead of dropping it to the
// page. The watchers run before the re-render, while it still has focus.
// Each ref holds a UiButton, whose element is its `$el`.
const zoomInButton = ref(null);
const zoomOutButton = ref(null);
const sensorButton = ref(null);
const nadirButton = ref(null);
const handFocus = (from, to) => {
if (!from || document.activeElement !== from) return;
if (!from?.$el || document.activeElement !== from.$el) return;
nextTick(() =>
(to() ?? document.getElementById('map-view-switch'))?.focus({
(to()?.$el ?? document.getElementById('map-view-switch'))?.focus({
preventScroll: true,
}),
);
@@ -298,7 +300,7 @@ const lensStyle = computed(() => {
<div v-if="identText" class="cockpit-orbital-ident">
<!-- Wraps between parts, never inside a date. -->
<span class="cockpit-orbital-ident-text"><template v-for="(part, index) in identParts" :key="index"><template v-if="index"> · </template><span class="cockpit-orbital-ident-part">{{ part }}</span></template></span>
<button v-if="tleText" id="cockpit-orbital-tle-toggle" type="button" class="cockpit-orbital-tle-toggle" :aria-expanded="String(tleOpen)" aria-controls="cockpit-orbital-tle" :aria-label="tleOpen ? t('Hide the two-line element set') : t('Show the two-line element set')" :title="tleOpen ? t('Hide the two-line element set') : t('Show the two-line element set')" @click="tleOpen = !tleOpen">{{ t('TLE') }}</button>
<UiButton v-if="tleText" id="cockpit-orbital-tle-toggle" class="cockpit-orbital-tle-toggle" :aria-expanded="String(tleOpen)" aria-controls="cockpit-orbital-tle" :aria-label="tleOpen ? t('Hide the two-line element set') : t('Show the two-line element set')" :title="tleOpen ? t('Hide the two-line element set') : t('Show the two-line element set')" @click="tleOpen = !tleOpen">{{ t('TLE') }}</UiButton>
</div>
<pre v-if="tleText" v-show="tleOpen" id="cockpit-orbital-tle" class="cockpit-orbital-tle" :aria-label="t('Two-line element set')">{{ tleText }}</pre>
<dl class="cockpit-orbital-data">
@@ -319,17 +321,17 @@ const lensStyle = computed(() => {
<!-- Shown only while the view is tilted off nadir: where it looks and the way back. -->
<div v-if="look.offset" class="cockpit-orbital-look">
<span id="cockpit-orbital-look-readout" class="cockpit-orbital-look-readout" :aria-live="look.focus ? 'off' : 'polite'">{{ look.readout }}</span>
<button id="cockpit-orbital-nadir" ref="nadirButton" type="button" class="cockpit-orbital-nadir" :aria-label="t('Return the view to nadir')" :title="t('Return to nadir (Home or 0)')" aria-keyshortcuts="Home 0">{{ t('NADIR') }}</button>
<UiButton id="cockpit-orbital-nadir" ref="nadirButton" class="cockpit-orbital-nadir" :aria-label="t('Return the view to nadir')" :title="t('Return to nadir (Home or 0)')" aria-keyshortcuts="Home 0">{{ t('NADIR') }}</UiButton>
</div>
<p id="cockpit-orbital-focus" class="cockpit-orbital-focus" aria-live="polite">{{ focusText }}</p>
</div>
<div class="cockpit-orbital-optics">
<button id="cockpit-orbital-zoom-out" ref="zoomOutButton" type="button" class="cockpit-orbital-zoom-button" :disabled="atWidest" :aria-label="t('Zoom out')" :title="t('Zoom out (−)')" aria-keyshortcuts="- _">−</button>
<UiButton id="cockpit-orbital-zoom-out" ref="zoomOutButton" class="cockpit-orbital-zoom-button" :disabled="atWidest" :aria-label="t('Zoom out')" :title="t('Zoom out (−)')" aria-keyshortcuts="- _">−</UiButton>
<span class="cockpit-orbital-zoom" aria-live="polite">{{ zoomText }}</span>
<button id="cockpit-orbital-zoom-in" ref="zoomInButton" type="button" class="cockpit-orbital-zoom-button" :disabled="atTightest" :aria-label="t('Zoom in')" :title="t('Zoom in (+)')" aria-keyshortcuts="+ =">+</button>
<UiButton id="cockpit-orbital-zoom-in" ref="zoomInButton" class="cockpit-orbital-zoom-button" :disabled="atTightest" :aria-label="t('Zoom in')" :title="t('Zoom in (+)')" aria-keyshortcuts="+ =">+</UiButton>
<span v-if="swathText" class="cockpit-orbital-swath">{{ swathText }}</span>
<span v-if="sensorText" class="cockpit-orbital-swath cockpit-orbital-sensor-swath">{{ sensorText }}</span>
<button v-if="sensorStepShown" id="cockpit-orbital-sensor" ref="sensorButton" type="button" class="cockpit-orbital-sensor-step" :aria-label="t('Zoom to the imaging sensor swath')" :title="t('Zoom to the imaging sensor swath')">{{ t('SENSOR') }}</button>
<UiButton v-if="sensorStepShown" id="cockpit-orbital-sensor" ref="sensorButton" class="cockpit-orbital-sensor-step" :aria-label="t('Zoom to the imaging sensor swath')" :title="t('Zoom to the imaging sensor swath')">{{ t('SENSOR') }}</UiButton>
</div>
</template>
</section>
+2 -1
View File
@@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia';
import { computed, onBeforeUnmount, ref, watch } from 'vue';
import { formatNumber, t, tn } from '../../../i18n/index.js';
import { useCockpitStore } from '../../stores/cockpit.js';
import UiButton from '../../kit/UiButton.vue';
// The bridge radar: a heading-up scope of nearby AIS vessels, with a line
// where the bridge view looks when it is turned off the bow. The Cockpit
@@ -158,7 +159,7 @@ const rangeAction = computed(() =>
</template>
</div>
<div class="cockpit-radar-readout">
<button id="cockpit-radar-range" type="button" class="cockpit-radar-range" :aria-label="rangeAction" :title="rangeAction">{{ rangeLabel }}</button>
<UiButton id="cockpit-radar-range" class="cockpit-radar-range" :aria-label="rangeAction" :title="rangeAction">{{ rangeLabel }}</UiButton>
<span class="cockpit-radar-rings">{{ ringLabel }}</span>
<span class="cockpit-radar-count">{{ countLabel }}</span>
</div>
+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>
+8 -8
View File
@@ -20,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>
</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" />
+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 -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>
+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>