mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 10:12:18 +00:00
Merge remote-tracking branch 'origin/main' into german/cctv-camera-counts
This commit is contained in:
commit
b322ac1df9
132 files changed
+3673
-1073
No files matched your search
@@ -90,8 +90,14 @@ test('the ring renders its overlay in the viewer container', async (t) => {
|
||||
['DIV', 'celestial-ring-outline'],
|
||||
['CANVAS', 'celestial-ring-canvas celestial-sun-canvas'],
|
||||
['CANVAS', 'celestial-ring-canvas celestial-moon-canvas'],
|
||||
['SPAN', 'celestial-marker celestial-sun material-symbols-outlined'],
|
||||
['SPAN', 'celestial-marker celestial-moon material-symbols-outlined'],
|
||||
[
|
||||
'SPAN',
|
||||
'ui-icon material-symbols-outlined celestial-marker celestial-sun',
|
||||
],
|
||||
[
|
||||
'SPAN',
|
||||
'ui-icon material-symbols-outlined celestial-marker celestial-moon',
|
||||
],
|
||||
],
|
||||
);
|
||||
assert.equal(root.children[0].style.display, 'none');
|
||||
|
||||
+24
-11
@@ -74,10 +74,14 @@ const voiceActions = fs.readFileSync(
|
||||
test('Cockpit has one reset action beside its bottom exit path', () => {
|
||||
assert.doesNotMatch(html, /id="cockpit-quick-entry"/);
|
||||
assert.doesNotMatch(html, /id="cockpit-exit"/);
|
||||
assert.match(
|
||||
html,
|
||||
/id="map-view-switch"[^>]*aria-label="Exit cockpit view"[^>]*aria-keyshortcuts="Escape"[\s\S]*?close_fullscreen[\s\S]*?EXIT COCKPIT/,
|
||||
// The exit button's attributes, in whatever order the button renders them.
|
||||
const exit = html.match(
|
||||
/<button\b(?=[^>]*\sid="map-view-switch")([^>]*)>([\s\S]*?)<\/button>/,
|
||||
);
|
||||
assert.ok(exit, 'Cockpit exit is missing');
|
||||
assert.match(exit[1], /\saria-label="Exit cockpit view"/);
|
||||
assert.match(exit[1], /\saria-keyshortcuts="Escape"/);
|
||||
assert.match(exit[2], /close_fullscreen[\s\S]*?EXIT COCKPIT/);
|
||||
const topCenterActions = html.match(
|
||||
/<nav id="top-center-actions"[\s\S]*?<\/nav>/,
|
||||
);
|
||||
@@ -108,9 +112,18 @@ test('Cockpit has one reset action beside its bottom exit path', () => {
|
||||
/id="reset-globe-view"/,
|
||||
'map-only reset must stay outside Cockpit',
|
||||
);
|
||||
assert.match(
|
||||
viewSwitcher[0],
|
||||
/id="cockpit-reset-globe"[^>]*type="button"[^>]*aria-label="Reset cockpit to full globe view"[^>]*hidden[\s\S]*?public[\s\S]*?RESET[\s\S]*?id="map-view-switch"/,
|
||||
// The reset button's attributes, in whatever order the button renders them.
|
||||
const reset = viewSwitcher[0].match(
|
||||
/<button\b(?=[^>]*\sid="cockpit-reset-globe")([^>]*)>([\s\S]*?)<\/button>/,
|
||||
);
|
||||
assert.ok(reset, 'Cockpit Reset is missing from the view switcher');
|
||||
assert.match(reset[1], /\stype="button"/);
|
||||
assert.match(reset[1], /\saria-label="Reset cockpit to full globe view"/);
|
||||
assert.match(reset[1], /\shidden(?=[\s>=]|$)/);
|
||||
assert.match(reset[2], /public[\s\S]*?RESET/);
|
||||
assert.ok(
|
||||
viewSwitcher[0].indexOf('id="map-view-switch"') > reset.index,
|
||||
'Cockpit Reset must sit before the exit button',
|
||||
);
|
||||
|
||||
const actions = html.match(
|
||||
@@ -194,12 +207,12 @@ test('Cockpit vision cycle exposes every map preset exactly once', () => {
|
||||
|
||||
test('Contacts uses the approved radar icon', () => {
|
||||
const button = html.match(
|
||||
/<button id="global-context-flights-btn"[\s\S]*?<\/button>/,
|
||||
/<button\b[^>]*\bid="global-context-flights-btn"[\s\S]*?<\/button>/,
|
||||
);
|
||||
assert.ok(button, 'Contacts button is missing');
|
||||
assert.match(
|
||||
button[0],
|
||||
/material-symbols-outlined" aria-hidden="true">radar<\/span>/,
|
||||
/material-symbols-outlined"[^>]*aria-hidden="true">radar<\/span>/,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -369,11 +382,11 @@ test('Cockpit owns a focused shared Display portal and compact Radio controls',
|
||||
assert.doesNotMatch(html, /data-cockpit-display-slot="presets"/);
|
||||
assert.match(
|
||||
html,
|
||||
/id="clear-selected-layers"[^>]*aria-label="Clear selected data layers"/,
|
||||
/<button\b(?=[^>]*\bid="clear-selected-layers")[^>]*aria-label="Clear selected data layers"/,
|
||||
);
|
||||
assert.match(
|
||||
html,
|
||||
/id="reset-globe-view"[^>]*aria-label="Reset to full globe view"/,
|
||||
/<button\b(?=[^>]*\bid="reset-globe-view")[^>]*aria-label="Reset to full globe view"/,
|
||||
);
|
||||
assert.match(
|
||||
css,
|
||||
@@ -1231,7 +1244,7 @@ test('Cockpit Contact navigation omits the redundant Focus camera action', () =>
|
||||
|
||||
test('Global Context names its mixed contact cycle without changing the stable mode id', () => {
|
||||
const match = html.match(
|
||||
/<button id="global-context-flights-btn"[\s\S]*?<\/button>/,
|
||||
/<button\b[^>]*\bid="global-context-flights-btn"[\s\S]*?<\/button>/,
|
||||
);
|
||||
assert.ok(match, 'Global Context contacts button is missing');
|
||||
assert.match(match[0], />CONTACTS</);
|
||||
|
||||
@@ -25,12 +25,12 @@ const css = readStylesheet(new URL('../style.css', import.meta.url));
|
||||
|
||||
test('Contacts stays in the keyboard sequence and Space Missions owns its rail item', () => {
|
||||
const button = html.match(
|
||||
/<button id="global-context-flights-btn"[\s\S]*?<\/button>/,
|
||||
/<button\b[^>]*\bid="global-context-flights-btn"[\s\S]*?<\/button>/,
|
||||
)?.[0];
|
||||
assert.ok(button, 'Contacts control is missing');
|
||||
assert.match(button, /role="tab"/);
|
||||
assert.match(button, /tabindex="0"/);
|
||||
const tag = contextView.match(/<button id="global-context-flights-btn"[^>]*>/)?.[0];
|
||||
const tag = contextView.match(/<UiButton id="global-context-flights-btn"[^>]*>/)?.[0];
|
||||
assert.ok(tag, 'Contacts control is missing from the view');
|
||||
assert.doesNotMatch(tag, /:tabindex|:disabled|\sdisabled/);
|
||||
assert.doesNotMatch(html, /id="global-context-missions-btn"/);
|
||||
@@ -111,7 +111,7 @@ test('Context async action buttons remain focused while busy', () => {
|
||||
assert.match(init, /if \(this\._installationsSearchBusy\) return;/);
|
||||
assert.doesNotMatch(init, /\.disabled\s*=\s*true/);
|
||||
const search = contextView.match(
|
||||
/<button id="installations-search-btn"[^>]*>/,
|
||||
/<UiButton id="installations-search-btn"[^>]*>/,
|
||||
)?.[0];
|
||||
assert.ok(search, 'nearby sites search is missing');
|
||||
assert.doesNotMatch(search, /:disabled|\sdisabled/);
|
||||
@@ -140,7 +140,7 @@ test('Context async action buttons remain focused while busy', () => {
|
||||
'utf8',
|
||||
);
|
||||
const clearButton = globeActions.match(
|
||||
/<button id="clear-selected-layers"[^>]*>/,
|
||||
/<UiButton id="clear-selected-layers"[^>]*>/,
|
||||
)?.[0];
|
||||
assert.ok(clearButton, 'Clear selected layers button is missing');
|
||||
assert.doesNotMatch(clearButton, /disabled(?!=")|:disabled=/);
|
||||
|
||||
@@ -946,7 +946,7 @@ test('the card closes without a keyboard: the ESC hint is a button, kept on phon
|
||||
);
|
||||
assert.match(
|
||||
header,
|
||||
/<button type="button" class="first-run-dismiss" data-first-run-dismiss>/,
|
||||
/<button type="button" class="[^"]*\bfirst-run-dismiss\b[^"]*" data-first-run-dismiss>/,
|
||||
);
|
||||
assert.match(header, />SKIP · ESC</);
|
||||
assert.match(header, />SKIP</);
|
||||
|
||||
@@ -110,7 +110,7 @@ function harness({ hidden = false, selected = true, noChips = false } = {}) {
|
||||
window.performance = { now: () => now };
|
||||
document.defaultView = window;
|
||||
const methods = new Function('createHoverDisclosure', 'collapsePanelOnEscape', 'document', 'window', 'clearTimeout', 'performance', 'requestAnimationFrame', 't', 'msg', 'readPanelState',
|
||||
`return ({${shellMethod('_initAutoHoverPanel').toString()},\n${shellMethod('_collapsePanelOnEscape').toString()},\n${shellMethod('setPanelCollapsed').toString()},\n${shellMethod('_presentPanel').toString()},\n${shellMethod('_shownPanel').toString()}});`)(
|
||||
`return ({${shellMethod('_initAutoHoverPanel').toString()},\n${shellMethod('_collapsePanelOnEscape').toString()},\n${shellMethod('_railFocusStand').toString()},\n${shellMethod('setPanelCollapsed').toString()},\n${shellMethod('_presentPanel').toString()},\n${shellMethod('_shownPanel').toString()}});`)(
|
||||
createHoverDisclosure, collapsePanelOnEscape, document, window, (id) => timers.delete(id), { now: () => now }, () => {}, t, msg, readPanelState,
|
||||
);
|
||||
const saves = [];
|
||||
@@ -294,7 +294,7 @@ test('Location markup provides one named native disclosure linked to its popover
|
||||
assert.match(locationToggleMarkup[2], /class="location-toolbar-label"/);
|
||||
assert.doesNotMatch(locationToggleMarkup[2], /<button\b/);
|
||||
assert.match(locationMarkup.slice(locationToggleMarkup.index + locationToggleMarkup[0].length),
|
||||
/^\s*<button class="panel-collapse-btn" data-collapse-target="location-bar"/);
|
||||
/^\s*<button type="button" class="[^"]*\bpanel-collapse-btn\b[^"]*"[^>]*\sdata-collapse-target="location-bar"/);
|
||||
assert.match(locationMarkup, /<div id="location-bar-popover" class="dock-popover-content">/);
|
||||
});
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@ test('the Visual Presets tray owns Map Source and the retired left panel is abse
|
||||
);
|
||||
assert.match(
|
||||
html,
|
||||
/<button id="control-panel-toggle"[\s\S]*?data-dock-toggle-target="control-panel"[\s\S]*?aria-controls="control-panel-popover"/,
|
||||
/<button\b[^>]*\bid="control-panel-toggle"[\s\S]*?data-dock-toggle-target="control-panel"[\s\S]*?aria-controls="control-panel-popover"/,
|
||||
'the compact wing must expose a semantic keyboard disclosure',
|
||||
);
|
||||
const panels = readFileSync(
|
||||
|
||||
@@ -42,7 +42,7 @@ function panelFixture({ id = 'data-panel', nested = false, nestedCollapsed = fal
|
||||
disclosure.closest = () => panel;
|
||||
}
|
||||
const document = { getElementById: (candidate) => candidate === id ? panel : null };
|
||||
const manager = new Function('document', 'getComputedStyle', 'collapsePanelOnEscape', `return {${method('_collapsePanelOnEscape', '_togglePanel')}};`)(document, (el) => ({ visibility: el.visibility ?? 'visible' }), collapsePanelOnEscape);
|
||||
const manager = new Function('document', 'getComputedStyle', 'collapsePanelOnEscape', `return {${method('_collapsePanelOnEscape', '_togglePanel')}, ${method('_railFocusStand', '_setCommandDockPanelPinState')}};`)(document, (el) => ({ visibility: el.visibility ?? 'visible' }), collapsePanelOnEscape);
|
||||
manager.setPanelCollapsed = (candidate, value, options) => {
|
||||
assert.equal(candidate, id);
|
||||
assert.equal(value, true);
|
||||
|
||||
@@ -92,6 +92,7 @@ out vec2 v_uv;
|
||||
out vec4 v_color;
|
||||
out vec4 v_pickColor;
|
||||
out float v_proxy;
|
||||
out float v_overDepth; // 1 for a row drawn over depth, on the near plane
|
||||
|
||||
// The row's anchor in clip space before screen offsets, for effects that wrap
|
||||
// main() (sonar) and must not change geometry or picks.
|
||||
@@ -125,6 +126,7 @@ void main() {
|
||||
v_uv = vec2(0.0);
|
||||
v_color = vec4(0.0);
|
||||
v_proxy = 0.0;
|
||||
v_overDepth = 0.0;
|
||||
gl_Position = vec4(0.0, 0.0, 2.0, 1.0); // outside the clip volume: not drawn
|
||||
|
||||
float flags = style1.z;
|
||||
@@ -260,14 +262,9 @@ void main() {
|
||||
distanceSq < style3.w * style3.w;
|
||||
if (overDepth && zclip >= -1.0 && zclip <= 1.0) {
|
||||
gl_Position.z = -gl_Position.w;
|
||||
#ifdef LOG_DEPTH
|
||||
// Just past the near plane, not on it: czm_writeLogDepth discards a
|
||||
// fragment at or below 0.9999999, and 1.0 interpolated across the quad
|
||||
// can arrive a rounding step or two under that, dropping the icon for a
|
||||
// frame as it moves (flicker). 1e-4 m past the near plane is still in
|
||||
// front of everything the scene draws.
|
||||
v_depthFromNearPlusOne = 1.0001;
|
||||
#endif
|
||||
// With a log depth buffer the fragment shader writes the near plane's
|
||||
// depth itself.
|
||||
v_overDepth = 1.0;
|
||||
}
|
||||
|
||||
v_uv = mix(rect.xy, rect.zw, vec2(corner.x * 0.5 + 0.5, 0.5 - corner.y * 0.5));
|
||||
@@ -282,6 +279,7 @@ in vec2 v_uv;
|
||||
in vec4 v_color;
|
||||
in vec4 v_pickColor;
|
||||
in float v_proxy;
|
||||
in float v_overDepth;
|
||||
|
||||
void main() {
|
||||
vec4 color = czm_gammaCorrect(texture(u_atlas, v_uv));
|
||||
@@ -296,7 +294,16 @@ void main() {
|
||||
#endif
|
||||
out_FragColor = color;
|
||||
#ifdef LOG_DEPTH
|
||||
czm_writeLogDepth(v_depthFromNearPlusOne);
|
||||
// Over depth: exactly the near plane's depth, written here and not through
|
||||
// czm_writeLogDepth. That function discards a fragment whose interpolated
|
||||
// depth arrives a rounding step under the near plane (the icon drops for a
|
||||
// frame as it moves), and any depth past the near plane is a surface to
|
||||
// Cesium's depth pick: the camera controller then sizes a zoom step from an
|
||||
// icon under the canvas centre, a near plane's distance away, and the wheel
|
||||
// stops zooming. The pick reads a depth of 0 as nothing drawn, and keeps
|
||||
// the depth of the ground under the icon.
|
||||
if (v_overDepth > 0.5) gl_FragDepth = 0.0;
|
||||
else czm_writeLogDepth(v_depthFromNearPlusOne);
|
||||
#endif
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import fs from 'node:fs';
|
||||
import * as Cesium from 'cesium';
|
||||
import { createIconSet } from '../../data/iconSet.js';
|
||||
import { IconSetPrimitive } from './iconSetPrimitive.js';
|
||||
@@ -58,3 +59,29 @@ test('by default the set draws an opaque pass and a translucent one, and draws n
|
||||
assert.equal(translucent.renderState.depthMask, false);
|
||||
assert.equal(primitive.drawsBlend('translucent'), false);
|
||||
});
|
||||
|
||||
test('an over-depth row writes a depth of exactly 0, which a depth pick ignores', () => {
|
||||
// Shaders do not compile under node: this reads the fragment shader's
|
||||
// source. A depth past the near plane (as 1.0001 through
|
||||
// czm_writeLogDepth was) is a surface to Cesium's depth pick, a near
|
||||
// plane's distance from the camera, and the wheel stops zooming with an
|
||||
// icon under the canvas centre (scripts/qa-zoom-under-icon.mjs).
|
||||
const source = fs.readFileSync(
|
||||
new URL('./iconSetPrimitive.js', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
const [vertex, fragment] = source
|
||||
.slice(source.indexOf('const VERTEX_SHADER'))
|
||||
.split('const FRAGMENT_SHADER')
|
||||
.map((shader) => shader.replace(/\/\/.*$/gm, '')); // comments out
|
||||
assert.match(
|
||||
fragment,
|
||||
/if \(v_overDepth > 0\.5\) gl_FragDepth = 0\.0;\s+else czm_writeLogDepth\(v_depthFromNearPlusOne\);/,
|
||||
);
|
||||
// The vertex shader flags the row and leaves its log depth alone.
|
||||
assert.match(
|
||||
vertex,
|
||||
/gl_Position\.z = -gl_Position\.w;[^}]*v_overDepth = 1\.0;/,
|
||||
);
|
||||
assert.doesNotMatch(vertex, /v_depthFromNearPlusOne\s*=/);
|
||||
});
|
||||
@@ -637,6 +637,7 @@ export class StyleManager extends ShellFacade {
|
||||
_toggleOrbit: (...args) => this._toggleOrbit(...args),
|
||||
toggleCleanView: (...args) => this.toggleCleanView(...args),
|
||||
_toggleCctvEnabled: (...args) => this._toggleCctvEnabled(...args),
|
||||
_togglePanel: (panelId) => this._panelChrome._togglePanel(panelId),
|
||||
_setBloomEnabled: (...args) => this._setBloomEnabled(...args),
|
||||
_setBloomIntensity: (...args) => this._setBloomIntensity(...args),
|
||||
_setSharpenEnabled: (...args) => this._setSharpenEnabled(...args),
|
||||
|
||||
@@ -3,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>
|
||||
@@ -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);
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import {
|
||||
LINK_SCHEMES,
|
||||
LOGO_SCHEMES,
|
||||
safeUrl,
|
||||
splitLink,
|
||||
} from '../../render/creditMarkup.js';
|
||||
|
||||
// One credit: its logo or its text, linked when it has a link. A credit is
|
||||
// plain data (`src/render/contract/credits.d.ts`): its text is set as text,
|
||||
// and a link or logo is kept only for a safe scheme.
|
||||
const props = defineProps({
|
||||
credit: { type: Object, required: true },
|
||||
});
|
||||
|
||||
const href = computed(() =>
|
||||
props.credit.href ? safeUrl(props.credit.href, LINK_SCHEMES) : null,
|
||||
);
|
||||
// A logo is drawn in place of the text, which names it (its alt text).
|
||||
const logo = computed(() =>
|
||||
props.credit.logoUrl ? safeUrl(props.credit.logoUrl, LOGO_SCHEMES) : null,
|
||||
);
|
||||
// Only the credit's linked words are the link, as the source wrote it.
|
||||
const parts = computed(() =>
|
||||
href.value && !logo.value && props.credit.linkText
|
||||
? splitLink(props.credit)
|
||||
: null,
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span v-if="parts" class="gev-credit"
|
||||
>{{ parts[0]
|
||||
}}<a :href="href" target="_blank" rel="noopener noreferrer">{{
|
||||
parts[1]
|
||||
}}</a
|
||||
>{{ parts[2] }}</span
|
||||
><component
|
||||
:is="href ? 'a' : 'span'"
|
||||
v-else
|
||||
class="gev-credit"
|
||||
:href="href || undefined"
|
||||
:target="href ? '_blank' : undefined"
|
||||
:rel="href ? 'noopener noreferrer' : undefined"
|
||||
><img
|
||||
v-if="logo"
|
||||
class="gev-credit-logo"
|
||||
:src="logo"
|
||||
:alt="credit.text"
|
||||
/><template v-else>{{ credit.text }}</template></component
|
||||
>
|
||||
</template>
|
||||
@@ -0,0 +1,90 @@
|
||||
<script setup>
|
||||
import { t } from '../../i18n/index.js';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
import UiCloseButton from '../kit/UiCloseButton.vue';
|
||||
import CreditItem from './CreditItem.vue';
|
||||
|
||||
// The attribution line at the bottom left and the "Data attribution" list it
|
||||
// opens, both at the end of `to` (the page's body), where the page's rules
|
||||
// place them. The owner (src/ui/creditsView.js) computes the credits shown,
|
||||
// keeps the list's open state and its focus, and takes the clicks and keys;
|
||||
// `elements` receives the line's, the button's and the list's elements for
|
||||
// it.
|
||||
const props = defineProps({
|
||||
to: { type: Object, required: true },
|
||||
panelId: { type: String, required: true },
|
||||
/** The credits on the line, once each. */
|
||||
inline: { type: Array, required: true },
|
||||
/** The credits in the list, once each. */
|
||||
listed: { type: Array, required: true },
|
||||
open: { type: Boolean, default: false },
|
||||
/**
|
||||
* The locale its words are in: a change words them again. The template
|
||||
* never reads it; `t()` is not reactive, so a new value is what makes the
|
||||
* view render again in the new language.
|
||||
*/
|
||||
locale: { type: String, default: '' },
|
||||
elements: { type: Object, required: true },
|
||||
onExpand: { type: Function, default: () => {} },
|
||||
onClose: { type: Function, default: () => {} },
|
||||
onKeydown: { type: Function, default: () => {} },
|
||||
});
|
||||
|
||||
/** Between the line's credits, and before the list's button. */
|
||||
const SEPARATOR = ' · ';
|
||||
/** A credit's key: the same text and link are one credit. */
|
||||
const key = (credit) => `${credit.text}\u0000${credit.href ?? ''}`;
|
||||
// The list button's words are the slot of a UiButton, which renders inside
|
||||
// the button: a locale that is not bound to a ref changes nothing the button
|
||||
// reads, and the owner patches synchronously and reads the result at once. A
|
||||
// slot given under a condition (`redrawWithView`, always true) is redrawn
|
||||
// whenever this view is, so the words follow a new locale with the rest.
|
||||
const redrawWithView = true;
|
||||
/** Keep `name`'s element for the owner. */
|
||||
const keep = (name) => (element) => {
|
||||
props.elements[name] = element?.$el ?? element;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport :to="props.to"
|
||||
><div id="gev-credits" :ref="keep('bar')" class="gev-credits" tabindex="-1"
|
||||
><span :ref="keep('line')" class="gev-credits-line"
|
||||
><template v-for="(credit, i) in props.inline" :key="key(credit)"
|
||||
>{{ i ? SEPARATOR : '' }}<CreditItem :credit="credit" /></template
|
||||
>{{ props.inline.length && props.listed.length ? SEPARATOR : '' }}</span
|
||||
><UiButton
|
||||
:ref="keep('expand')"
|
||||
class="gev-credits-expand"
|
||||
aria-haspopup="dialog"
|
||||
:aria-controls="props.panelId"
|
||||
:aria-expanded="String(props.open)"
|
||||
:hidden="props.listed.length === 0"
|
||||
@click="props.onExpand()"
|
||||
><template v-if="redrawWithView" #default>{{
|
||||
t('Data attribution')
|
||||
}}</template></UiButton
|
||||
></div
|
||||
><div
|
||||
:id="props.panelId"
|
||||
:ref="keep('panel')"
|
||||
class="gev-credits-panel"
|
||||
role="dialog"
|
||||
:aria-labelledby="`${props.panelId}-title`"
|
||||
:hidden="!props.open"
|
||||
@keydown="props.onKeydown($event)"
|
||||
><div class="gev-credits-header"
|
||||
><span class="gev-credits-title" :id="`${props.panelId}-title`">{{
|
||||
t('Data provided by:')
|
||||
}}</span
|
||||
><UiCloseButton
|
||||
:ref="keep('close')"
|
||||
class="gev-credits-close"
|
||||
bare
|
||||
:label="t('Close data attribution')"
|
||||
@click="props.onClose()" /></div
|
||||
><ul class="gev-credits-list"
|
||||
><li v-for="credit in props.listed" :key="key(credit)"
|
||||
><CreditItem :credit="credit" /></li></ul></div
|
||||
></Teleport>
|
||||
</template>
|
||||
+55
-122
@@ -6,16 +6,14 @@
|
||||
* credits). Inline credits are shown on the line at the bottom left; the
|
||||
* rest are in the "Data attribution" list it opens. A credit is plain data
|
||||
* (`src/render/contract/credits.d.ts`): its text is set as text, and a link
|
||||
* or logo is kept only for a safe scheme.
|
||||
* or logo is kept only for a safe scheme. `CreditsView` renders the line and
|
||||
* the list; this owner keeps the credits shown, the list's open state and
|
||||
* its focus.
|
||||
*/
|
||||
import { h, render as renderVue } from 'vue';
|
||||
import { findCredits } from '../render/rendererOf.js';
|
||||
import {
|
||||
LINK_SCHEMES,
|
||||
LOGO_SCHEMES,
|
||||
safeUrl,
|
||||
splitLink,
|
||||
} from '../render/creditMarkup.js';
|
||||
import { onLocaleChange, t } from '../i18n/index.js';
|
||||
import { getLocale, onLocaleChange } from '../i18n/index.js';
|
||||
import CreditsView from './credits/CreditsView.vue';
|
||||
|
||||
const PANEL_ID = 'gev-credits-panel';
|
||||
|
||||
@@ -30,42 +28,6 @@ function distinct(list) {
|
||||
});
|
||||
}
|
||||
|
||||
/** One credit as DOM: its logo or its text, linked when it has a link. */
|
||||
function creditElement(doc, credit) {
|
||||
const href = credit.href ? safeUrl(credit.href, LINK_SCHEMES) : null;
|
||||
const logoUrl = credit.logoUrl ? safeUrl(credit.logoUrl, LOGO_SCHEMES) : null;
|
||||
// Only the credit's linked words are the link, as the source wrote it.
|
||||
if (href && !logoUrl && credit.linkText) {
|
||||
const [before, words, after] = splitLink(credit);
|
||||
const element = doc.createElement('span');
|
||||
element.className = 'gev-credit';
|
||||
const link = doc.createElement('a');
|
||||
link.href = href;
|
||||
link.target = '_blank';
|
||||
link.rel = 'noopener noreferrer';
|
||||
link.textContent = words;
|
||||
element.append(before, link, after);
|
||||
return element;
|
||||
}
|
||||
const element = doc.createElement(href ? 'a' : 'span');
|
||||
element.className = 'gev-credit';
|
||||
if (href) {
|
||||
element.href = href;
|
||||
element.target = '_blank';
|
||||
element.rel = 'noopener noreferrer';
|
||||
}
|
||||
// A logo is drawn in place of the text, which names it (its alt text).
|
||||
const logo = credit.logoUrl ? safeUrl(credit.logoUrl, LOGO_SCHEMES) : null;
|
||||
if (logo) {
|
||||
const image = doc.createElement('img');
|
||||
image.className = 'gev-credit-logo';
|
||||
image.src = logo;
|
||||
image.alt = credit.text;
|
||||
element.append(image);
|
||||
} else element.textContent = credit.text;
|
||||
return element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show `viewer`'s renderer credits at the bottom left of `root`'s page.
|
||||
* @param {object} viewer The scene object, bound to its renderer.
|
||||
@@ -76,106 +38,77 @@ export function mountCreditsView(viewer, { root = document.body } = {}) {
|
||||
const credits = findCredits(viewer);
|
||||
if (!credits || !root) return () => {};
|
||||
const doc = root.ownerDocument;
|
||||
const bar = doc.createElement('div');
|
||||
bar.id = 'gev-credits';
|
||||
bar.className = 'gev-credits';
|
||||
// Takes focus back from an emptied list when the line has no link.
|
||||
bar.tabIndex = -1;
|
||||
const line = doc.createElement('span');
|
||||
line.className = 'gev-credits-line';
|
||||
const expand = doc.createElement('button');
|
||||
expand.type = 'button';
|
||||
expand.className = 'gev-credits-expand';
|
||||
expand.setAttribute('aria-haspopup', 'dialog');
|
||||
expand.setAttribute('aria-controls', PANEL_ID);
|
||||
expand.setAttribute('aria-expanded', 'false');
|
||||
// The view teleports the line and the list to the end of `root`; this
|
||||
// host, never in the page, holds only its place.
|
||||
const host = doc.createElement('div');
|
||||
const elements = {};
|
||||
let inline = [];
|
||||
let listed = [];
|
||||
let open = false;
|
||||
|
||||
const panel = doc.createElement('div');
|
||||
panel.id = PANEL_ID;
|
||||
panel.className = 'gev-credits-panel';
|
||||
panel.setAttribute('role', 'dialog');
|
||||
panel.hidden = true;
|
||||
const header = doc.createElement('div');
|
||||
header.className = 'gev-credits-header';
|
||||
const title = doc.createElement('span');
|
||||
title.className = 'gev-credits-title';
|
||||
title.id = `${PANEL_ID}-title`;
|
||||
panel.setAttribute('aria-labelledby', title.id);
|
||||
const close = doc.createElement('button');
|
||||
close.type = 'button';
|
||||
close.className = 'gev-credits-close';
|
||||
close.textContent = '×';
|
||||
header.append(title, close);
|
||||
const list = doc.createElement('ul');
|
||||
list.className = 'gev-credits-list';
|
||||
panel.append(header, list);
|
||||
bar.append(line, expand);
|
||||
root.append(bar, panel);
|
||||
// The view patches synchronously, so focus can move once it returns.
|
||||
const paint = () =>
|
||||
renderVue(
|
||||
h(CreditsView, {
|
||||
to: root,
|
||||
panelId: PANEL_ID,
|
||||
inline,
|
||||
listed,
|
||||
open,
|
||||
locale: getLocale(),
|
||||
elements,
|
||||
onExpand,
|
||||
onClose,
|
||||
onKeydown,
|
||||
}),
|
||||
host,
|
||||
);
|
||||
|
||||
const label = () => {
|
||||
expand.textContent = t('Data attribution');
|
||||
title.textContent = t('Data provided by:');
|
||||
close.setAttribute('aria-label', t('Close data attribution'));
|
||||
};
|
||||
|
||||
const setOpen = (open, { focus = false } = {}) => {
|
||||
panel.hidden = !open;
|
||||
expand.setAttribute('aria-expanded', String(open));
|
||||
if (open) close.focus();
|
||||
else if (focus) expand.focus();
|
||||
const setOpen = (next, { focus = false } = {}) => {
|
||||
open = next;
|
||||
paint();
|
||||
if (open) elements.close.focus();
|
||||
else if (focus) elements.expand.focus();
|
||||
};
|
||||
|
||||
const render = (all) => {
|
||||
const { bar, line, panel } = elements;
|
||||
const focused = panel.contains(doc.activeElement);
|
||||
const shown = distinct(Array.isArray(all) ? all : []);
|
||||
const inline = shown.filter((credit) => credit.inline);
|
||||
const listed = shown.filter((credit) => !credit.inline);
|
||||
line.replaceChildren();
|
||||
inline.forEach((credit, i) => {
|
||||
if (i) line.append(doc.createTextNode(' · '));
|
||||
line.append(creditElement(doc, credit));
|
||||
});
|
||||
if (inline.length && listed.length) line.append(doc.createTextNode(' · '));
|
||||
list.replaceChildren(
|
||||
...listed.map((credit) => {
|
||||
const item = doc.createElement('li');
|
||||
item.append(creditElement(doc, credit));
|
||||
return item;
|
||||
}),
|
||||
);
|
||||
expand.hidden = listed.length === 0;
|
||||
if (expand.hidden && !panel.hidden) {
|
||||
inline = shown.filter((credit) => credit.inline);
|
||||
listed = shown.filter((credit) => !credit.inline);
|
||||
paint();
|
||||
if (listed.length === 0 && open) {
|
||||
// Focus in the list goes back to the line, not to the page.
|
||||
setOpen(false);
|
||||
if (focused) (line.querySelector('a') ?? bar).focus();
|
||||
} else if (focused && !panel.contains(doc.activeElement)) {
|
||||
// A link that focus was on was redrawn: focus stays in the list.
|
||||
close.focus();
|
||||
elements.close.focus();
|
||||
}
|
||||
};
|
||||
|
||||
const onExpand = () => setOpen(panel.hidden);
|
||||
const onClose = () => setOpen(false, { focus: true });
|
||||
function onExpand() {
|
||||
setOpen(!open);
|
||||
}
|
||||
function onClose() {
|
||||
setOpen(false, { focus: true });
|
||||
}
|
||||
// Escape in the open list closes it (it takes focus as it opens).
|
||||
const onKey = (event) => {
|
||||
if (event.key !== 'Escape' || panel.hidden) return;
|
||||
function onKeydown(event) {
|
||||
if (event.key !== 'Escape' || !open) return;
|
||||
event.preventDefault();
|
||||
setOpen(false, { focus: true });
|
||||
};
|
||||
expand.addEventListener('click', onExpand);
|
||||
close.addEventListener('click', onClose);
|
||||
panel.addEventListener('keydown', onKey);
|
||||
label();
|
||||
}
|
||||
|
||||
paint();
|
||||
render(credits.list());
|
||||
const offChange = credits.on('change', render);
|
||||
const offLocale = onLocaleChange(label);
|
||||
// The view words its text again in the new locale, as it renders.
|
||||
const offLocale = onLocaleChange(paint);
|
||||
return () => {
|
||||
offChange();
|
||||
offLocale();
|
||||
expand.removeEventListener('click', onExpand);
|
||||
close.removeEventListener('click', onClose);
|
||||
panel.removeEventListener('keydown', onKey);
|
||||
bar.remove();
|
||||
panel.remove();
|
||||
renderVue(null, host);
|
||||
};
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import assert from 'node:assert/strict';
|
||||
import { mountCreditsView } from './creditsView.js';
|
||||
import { bindRenderer } from '../render/rendererOf.js';
|
||||
import { createStubRenderer } from '../render/stub/index.js';
|
||||
import { setLocale } from '../i18n/index.js';
|
||||
|
||||
function scene() {
|
||||
document.body.replaceChildren();
|
||||
@@ -118,10 +119,12 @@ test('focus in the list stays in it as it redraws, and goes to the line as it em
|
||||
const off = mountCreditsView(viewer);
|
||||
const panel = document.getElementById('gev-credits-panel');
|
||||
document.querySelector('.gev-credits-expand').click();
|
||||
panel.querySelector('li a').focus();
|
||||
const link = panel.querySelector('li a');
|
||||
link.focus();
|
||||
const removeOther = renderer.credits.addStatic({ text: 'NOAA' });
|
||||
assert.equal(panel.hidden, false);
|
||||
assert.ok(panel.contains(document.activeElement), 'still in the list');
|
||||
assert.equal(document.activeElement, link, 'the focused link keeps it');
|
||||
remove();
|
||||
removeOther();
|
||||
assert.equal(panel.hidden, true);
|
||||
@@ -152,3 +155,55 @@ test('a credit with linked words links only those words', () => {
|
||||
);
|
||||
off();
|
||||
});
|
||||
|
||||
test('the line and its list follow the locale', () => {
|
||||
const { viewer, renderer } = scene();
|
||||
renderer.credits.addStatic({ text: 'NOAA' });
|
||||
const off = mountCreditsView(viewer);
|
||||
const expand = document.querySelector('.gev-credits-expand');
|
||||
const close = document.querySelector('.gev-credits-close');
|
||||
try {
|
||||
setLocale('fr');
|
||||
assert.equal(expand.textContent, 'Attribution des données');
|
||||
assert.equal(
|
||||
document.getElementById('gev-credits-panel-title').textContent,
|
||||
'Données fournies par\u202f:',
|
||||
);
|
||||
assert.equal(
|
||||
close.getAttribute('aria-label'),
|
||||
"Fermer l'attribution des données",
|
||||
);
|
||||
} finally {
|
||||
setLocale('en');
|
||||
}
|
||||
assert.equal(expand.textContent, 'Data attribution');
|
||||
off();
|
||||
});
|
||||
|
||||
test('the line and its list are the last of the body, and its close button is the kit’s', () => {
|
||||
const { viewer, renderer } = scene();
|
||||
document.body.append(document.createElement('main'));
|
||||
renderer.credits.addStatic({ text: 'NOAA' });
|
||||
const off = mountCreditsView(viewer);
|
||||
const children = [...document.body.children];
|
||||
assert.deepEqual(
|
||||
children.slice(-2).map((element) => element.id),
|
||||
['gev-credits', 'gev-credits-panel'],
|
||||
'the page’s rules select them as children of the body',
|
||||
);
|
||||
const close = document.querySelector('.gev-credits-close');
|
||||
assert.ok(close.classList.contains('ui-button'), 'a UiCloseButton');
|
||||
assert.equal(close.type, 'button');
|
||||
assert.equal(close.textContent, '×');
|
||||
assert.equal(close.hasAttribute('title'), false, 'no tip');
|
||||
assert.equal(
|
||||
close.classList.contains('ui-close-button'),
|
||||
false,
|
||||
'bare: it keeps the browser’s padding',
|
||||
);
|
||||
off();
|
||||
assert.deepEqual(
|
||||
[...document.body.children].map((element) => element.tagName),
|
||||
['MAIN'],
|
||||
);
|
||||
});
|
||||
@@ -64,8 +64,8 @@ export class DisplayBindings {
|
||||
},
|
||||
toggleOrbit: () => this._toggleOrbit(),
|
||||
toggleCleanView: () => this.toggleCleanView(),
|
||||
toggleLayers: () =>
|
||||
document.getElementById('data-panel').classList.toggle('active'),
|
||||
// Same collapse as the panel's own button, so its rail entry stays.
|
||||
toggleLayers: () => this._togglePanel('data-panel'),
|
||||
cycleDetection: () => {
|
||||
this.shareLinkManager?.claimRestoreLane?.('visual');
|
||||
this.claimDetection();
|
||||
|
||||
@@ -72,7 +72,11 @@ function settings(store) {
|
||||
|
||||
test('before VisualSettings renders, the panel shows its initial markup', (t) => {
|
||||
const { $ } = fixture(t);
|
||||
assert.equal($('bloom-toggle').className, 'pp-toggle-btn');
|
||||
// Beside the kit's ui-* classes, the toggle carries only its own.
|
||||
assert.deepEqual(
|
||||
[...$('bloom-toggle').classList].filter((name) => !name.startsWith('ui-')),
|
||||
['pp-toggle-btn'],
|
||||
);
|
||||
assert.equal($('bloom-slider-row').className, 'pp-slider-row');
|
||||
assert.equal($('bloom-intensity-slider').value, '0');
|
||||
assert.equal($('bloom-intensity-value').textContent, '0%');
|
||||
@@ -553,7 +557,7 @@ test('the imported files render what the file import publishes and keep focus',
|
||||
assert.equal(name.textContent, '<b>a</b>.geojson');
|
||||
assert.equal(name.children.length, 0, 'the name is text');
|
||||
assert.match(name.title, /GEOJSON, 2 map objects$/);
|
||||
assert.equal(toggle.className, 'geo-import-action');
|
||||
assert.ok(toggle.classList.contains('geo-import-action'));
|
||||
assert.equal(toggle.getAttribute('type'), 'button');
|
||||
assert.equal(toggle.getAttribute('aria-pressed'), 'true');
|
||||
assert.equal(toggle.getAttribute('aria-label'), 'Hide <b>a</b>.geojson');
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
// Every checkbox in a Vue view is a UiCheckbox: no SFC template hand-writes
|
||||
// `<input type="checkbox">`. Story Explore's filters are not converted yet.
|
||||
// `<input type="checkbox">`.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync, readdirSync } from 'node:fs';
|
||||
@@ -8,10 +8,7 @@ import { fileURLToPath } from 'node:url';
|
||||
|
||||
const SRC_ROOT = fileURLToPath(new URL('../../', import.meta.url));
|
||||
const REPO_ROOT = path.resolve(SRC_ROOT, '..');
|
||||
const NOT_YET = new Set([
|
||||
'src/ui/kit/UiCheckbox.vue',
|
||||
'src/ui/views/stories/ExploreScreen.vue',
|
||||
]);
|
||||
const NOT_YET = new Set(['src/ui/kit/UiCheckbox.vue']);
|
||||
|
||||
/** Every SFC under src. */
|
||||
function sfcFiles(directory = SRC_ROOT) {
|
||||
|
||||
@@ -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`×|×|×|×`;
|
||||
const CLOSE_GLYPH = [
|
||||
String.raw`×|×|×|×`,
|
||||
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">×</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">×</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>',
|
||||
])
|
||||
|
||||
@@ -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 \{/);
|
||||
});
|
||||
@@ -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"/);
|
||||
});
|
||||
@@ -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';
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
// UTILITIES ▸ Draw (its toggle, Clear, the colour swatches and the drawn
|
||||
// shapes' rows), Import and the Street Level panel are on the kit: none of
|
||||
// them hand-writes a <button>, a Material Symbols span, a select, a checkbox
|
||||
// or a range. The Draw toggle is a pressed toggle with `active`. The colour
|
||||
// swatches are `role="radio"` buttons: they say they are chosen with
|
||||
// `aria-checked` and their own `active` class, never `aria-pressed`. A drawn
|
||||
// shape's show/hide renames itself (Show …, Hide …) rather than being pressed.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
const source = (file) =>
|
||||
readFileSync(new URL(`../views/panels/${file}`, import.meta.url), 'utf8');
|
||||
/** A view's template block: everything outside script, style and comments. */
|
||||
const template = (file) =>
|
||||
source(file)
|
||||
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
|
||||
.replace(/<!--[\s\S]*?-->/g, '');
|
||||
// A tag's attributes, read past quoted values so a handler's `=>` does not
|
||||
// end the tag early.
|
||||
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
|
||||
const tag = (pattern, flags = '') =>
|
||||
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
|
||||
const tags = (markup, name) =>
|
||||
markup.match(tag(String.raw`<${name}\bATTRS>`, 'g')) ?? [];
|
||||
|
||||
const views = {
|
||||
// Draw and Clear.
|
||||
'DrawControls.vue': { buttons: 2, icons: 1, closes: 0 },
|
||||
// The five colours, one v-for.
|
||||
'DrawSwatches.vue': { buttons: 1, icons: 0, closes: 0 },
|
||||
// A row's swatch, show/hide, the application's actions and fly to; remove
|
||||
// is a UiCloseButton.
|
||||
'DrawMarkList.vue': { buttons: 4, icons: 3, closes: 1 },
|
||||
// Import and a file's row actions.
|
||||
'GeoImport.vue': { buttons: 2, icons: 2, closes: 0 },
|
||||
// The status toggle, EXPAND and the nearest-imagery button; the viewer's
|
||||
// close. EXPAND's ⤢ ⤡ and the errors' ⚠ are text, not Material symbols.
|
||||
'StreetLevelPanel.vue': { buttons: 3, icons: 0, closes: 1 },
|
||||
};
|
||||
const markup = Object.fromEntries(
|
||||
Object.keys(views).map((file) => [file, template(file)]),
|
||||
);
|
||||
|
||||
test('the Draw, Import and Street Level views hand-write no button', () => {
|
||||
for (const [file, { buttons, closes }] of Object.entries(views)) {
|
||||
const html = markup[file];
|
||||
assert.deepEqual(html.match(/<button\b/gi) ?? [], [], file);
|
||||
assert.deepEqual(html.match(/<component\b/gi) ?? [], [], file);
|
||||
assert.equal(tags(html, 'UiButton').length, buttons, file);
|
||||
assert.equal(tags(html, 'UiCloseButton').length, closes, file);
|
||||
}
|
||||
});
|
||||
|
||||
test('they hand-write no select, checkbox or range', () => {
|
||||
for (const [file, html] of Object.entries(markup)) {
|
||||
assert.deepEqual(html.match(/<select\b/gi) ?? [], [], file);
|
||||
assert.doesNotMatch(
|
||||
html,
|
||||
tag(String.raw`<input\bATTRS\stype="(?:checkbox|range)"`),
|
||||
file,
|
||||
);
|
||||
}
|
||||
// SINCE is the kit's range.
|
||||
assert.equal(tags(markup['StreetLevelPanel.vue'], 'UiSlider').length, 1);
|
||||
});
|
||||
|
||||
test('they hand-write no Material glyph; each is a UiIcon sized by the site', () => {
|
||||
for (const [file, { icons }] of Object.entries(views)) {
|
||||
const html = markup[file];
|
||||
assert.deepEqual(html.match(/material-symbols-outlined/g) ?? [], [], file);
|
||||
const found = tags(html, 'UiIcon');
|
||||
assert.equal(found.length, icons, file);
|
||||
// Without it the kit writes an 18px size that beats the site rules.
|
||||
for (const icon of found) assert.match(icon, /\s:size="null"/, file);
|
||||
}
|
||||
// Draw's and Import's glyphs keep pp-icon, which sizes them.
|
||||
for (const file of ['DrawControls.vue', 'GeoImport.vue']) {
|
||||
const [icon] = tags(markup[file], 'UiIcon');
|
||||
assert.match(icon, /\sclass="pp-icon"/, file);
|
||||
}
|
||||
});
|
||||
|
||||
test('no tag hand-writes aria-pressed; Draw is a pressed toggle with active', () => {
|
||||
for (const [file, html] of Object.entries(markup))
|
||||
assert.doesNotMatch(
|
||||
html,
|
||||
tag(String.raw`<\w+\bATTRS\s:?aria-pressed`),
|
||||
file,
|
||||
);
|
||||
const [draw] = tags(markup['DrawControls.vue'], 'UiButton').filter((b) =>
|
||||
/\sid="draw-toggle"/.test(b),
|
||||
);
|
||||
assert.match(draw, /\s:pressed="draw\?\.active \?\? false"/);
|
||||
assert.match(draw, /\spressed-class="active"/);
|
||||
const [clear] = tags(markup['DrawControls.vue'], 'UiButton').filter((b) =>
|
||||
/\sid="draw-clear"/.test(b),
|
||||
);
|
||||
assert.doesNotMatch(clear, /\s:pressed=/);
|
||||
// A shape's show/hide says what it does in its name, not by being pressed.
|
||||
for (const button of tags(markup['DrawMarkList.vue'], 'UiButton'))
|
||||
assert.doesNotMatch(button, /\s:pressed=/);
|
||||
});
|
||||
|
||||
test('the colour swatches are radios chosen by aria-checked, never pressed', () => {
|
||||
const [swatch] = tags(markup['DrawSwatches.vue'], 'UiButton');
|
||||
assert.match(swatch, /\srole="radio"/);
|
||||
assert.match(
|
||||
swatch,
|
||||
/\s:aria-checked="String\(color === props\.modelValue\)"/,
|
||||
);
|
||||
assert.match(swatch, /\s:class="\{ active: color === props\.modelValue \}"/);
|
||||
assert.doesNotMatch(swatch, /\s:pressed=|\spressed-class=/);
|
||||
});
|
||||
|
||||
test('code that focuses a converted button reaches its element', () => {
|
||||
// A template ref on a component holds the component, not the button.
|
||||
assert.match(
|
||||
source('DrawSwatches.vue'),
|
||||
/:ref="\(swatch\) => \(buttons\[index\] = swatch\?\.\$el\)"/,
|
||||
);
|
||||
assert.match(
|
||||
source('GeoImport.vue'),
|
||||
/importButton\.value\?\.\$el\.focus\(\)/,
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,84 @@
|
||||
// The entity card's buttons and Material glyphs are the kit's: neither its
|
||||
// template nor the camera preview and nearby lists it renders hand-writes a
|
||||
// <button> or a Material Symbols span. The Ask GEV button's chat bubble is
|
||||
// not a Material symbol the page loads, so it stays drawn as inline SVG; the
|
||||
// hero views (model, route globe, cockpit view, ground view, graphs) draw
|
||||
// their own pictures and have no controls.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
/** A view's template block: everything outside script and style. */
|
||||
function template(file) {
|
||||
const source = readFileSync(
|
||||
new URL(`../views/panels/${file}`, import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
return source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
|
||||
}
|
||||
const card = template('EntityCard.vue');
|
||||
const camera = template('CctvPreview.vue');
|
||||
const nearby = template('SpotConditions.vue');
|
||||
const heroViews = [
|
||||
'AircraftModelHero.vue',
|
||||
'RouteGlobe.vue',
|
||||
'FlightCockpitView.vue',
|
||||
'SatelliteGroundView.vue',
|
||||
'PreviewHud.vue',
|
||||
'AltitudeGraph.vue',
|
||||
].map(template);
|
||||
|
||||
test('the entity card hand-writes no button; each is a UiButton', () => {
|
||||
for (const markup of [card, camera, nearby, ...heroViews])
|
||||
assert.deepEqual(markup.match(/<button\b/gi) ?? [], []);
|
||||
// Photos, Route, 3D, Cockpit view, the cockpit entry, Fly to, Follow and
|
||||
// Ask GEV.
|
||||
assert.equal(card.match(/<UiButton\b/g)?.length, 8);
|
||||
assert.equal(card.match(/<UiCloseButton\b/g)?.length, 1);
|
||||
// A camera's bigger view and More info; its popup closes with a UiCloseButton.
|
||||
assert.equal(camera.match(/<UiButton\b/g)?.length, 2);
|
||||
assert.equal(camera.match(/<UiCloseButton\b/g)?.length, 1);
|
||||
// The traffic, hazard, alert and other nearby rows.
|
||||
assert.equal(nearby.match(/<UiButton\b/g)?.length, 4);
|
||||
});
|
||||
|
||||
test('the preview switch and Follow are pressed toggles with their classes', () => {
|
||||
const previews = card.match(/<UiButton v-if="\w+" :pressed[^>]*>/g) ?? [];
|
||||
assert.equal(previews.length, 4);
|
||||
for (const button of previews) {
|
||||
assert.match(button, /pressed-class="active"/);
|
||||
assert.doesNotMatch(button, /aria-pressed|:class=/);
|
||||
}
|
||||
assert.match(
|
||||
card,
|
||||
/<UiButton v-if="store\.canFollow\(\)" class="entity-card__action" :pressed="Boolean\(store\.isFollowing\(\)\)" pressed-class="entity-card__action--on"/,
|
||||
);
|
||||
});
|
||||
|
||||
test('the entity card hand-writes no Material glyph; each is a UiIcon', () => {
|
||||
for (const markup of [card, camera, nearby, ...heroViews])
|
||||
assert.deepEqual(markup.match(/material-symbols-outlined/g) ?? [], []);
|
||||
const counts = [
|
||||
// The preview switch's three, the hero glyph, the header icon, the
|
||||
// warning, the route's plane, the route note and the three actions.
|
||||
[card, 11],
|
||||
// Bigger view, the popup's camera and More info.
|
||||
[camera, 3],
|
||||
// The two weather glyphs, five headings and three row glyphs.
|
||||
[nearby, 10],
|
||||
];
|
||||
for (const [markup, count] of counts) {
|
||||
const icons = markup.match(/<UiIcon\b[^>]*>/g) ?? [];
|
||||
assert.equal(icons.length, count);
|
||||
// Without it the kit writes an 18px size that beats the card's own rules.
|
||||
for (const icon of icons) assert.match(icon, /:size="null"/);
|
||||
}
|
||||
});
|
||||
|
||||
test('the only inline SVG glyph is the Ask GEV chat bubble', () => {
|
||||
const svgs = [...card.matchAll(/<svg\b[\s\S]*?<\/svg\s*>/g)].map((m) => m[0]);
|
||||
assert.equal(svgs.length, 1);
|
||||
assert.match(svgs[0], /<path d="M4 5h16v11H9l-5 4z" \/>/);
|
||||
for (const markup of [camera, nearby])
|
||||
assert.deepEqual(markup.match(/<svg\b/gi) ?? [], []);
|
||||
});
|
||||
@@ -0,0 +1,50 @@
|
||||
// The Layer Finder's buttons and Material glyphs are the kit's: its template
|
||||
// hand-writes no <button>, aria-pressed, Material Symbols span or inline SVG.
|
||||
// Its search field is a UiSearchField.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
/** A view's template block: everything outside script and style. */
|
||||
function template(file) {
|
||||
const source = readFileSync(
|
||||
new URL(`../views/panels/${file}`, import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
return source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
|
||||
}
|
||||
const finder = template('LayerFinder.vue');
|
||||
|
||||
test('the Layer Finder hand-writes no button; each is a UiButton', () => {
|
||||
assert.deepEqual(finder.match(/<button\b/gi) ?? [], []);
|
||||
// Search, Filter, the Status and Category options, and the two chips.
|
||||
assert.equal(finder.match(/<UiButton\b/g)?.length, 6);
|
||||
assert.equal(finder.match(/<UiSearchField\b/g)?.length, 1);
|
||||
});
|
||||
|
||||
test('its pressed toggles leave aria-pressed to UiButton', () => {
|
||||
assert.deepEqual(finder.match(/aria-pressed/g) ?? [], []);
|
||||
const pressed = finder.match(/<UiButton\b[^>]*:pressed=[^>]*>/g) ?? [];
|
||||
// Search and the Status and Category options.
|
||||
assert.equal(pressed.length, 3);
|
||||
// Only the options' active class follows their pressed state; Search's
|
||||
// also stays on while a query is typed, so it keeps its own binding.
|
||||
assert.equal(
|
||||
pressed.filter((tag) => tag.includes('pressed-class="active"')).length,
|
||||
2,
|
||||
);
|
||||
assert.match(
|
||||
finder,
|
||||
/id="layer-finder-search-btn"[^>]*:class="\{ active: searching \|\| query \}"/,
|
||||
);
|
||||
});
|
||||
|
||||
test('the Layer Finder hand-writes no Material glyph; each is a UiIcon', () => {
|
||||
assert.deepEqual(finder.match(/material-symbols-outlined/g) ?? [], []);
|
||||
assert.deepEqual(finder.match(/<svg\b/gi) ?? [], []);
|
||||
const icons = finder.match(/<UiIcon\b[^>]*>/g) ?? [];
|
||||
// Search, Filter, the two option radios and the two chips' close.
|
||||
assert.equal(icons.length, 6);
|
||||
// Without it the kit writes an 18px size that beats layer-finder.css.
|
||||
for (const icon of icons) assert.match(icon, /:size="null"/);
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
// The Omnibar's buttons and Material glyphs are the kit's: its template
|
||||
// hand-writes no <button> and no Material Symbols span. Its two inline SVG
|
||||
// glyphs (the mic and the chat row's bubble) are not Material symbols the
|
||||
// page loads, so they stay as they are drawn.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
const source = readFileSync(
|
||||
new URL('../views/panels/Omnibar.vue', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
/** The template block: everything outside script and style. */
|
||||
const template = source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
|
||||
|
||||
test('the Omnibar hand-writes no button; each is a UiButton', () => {
|
||||
assert.deepEqual(template.match(/<button\b/gi) ?? [], []);
|
||||
assert.equal(template.match(/<UiButton\b/g)?.length, 2);
|
||||
});
|
||||
|
||||
test('the Omnibar hand-writes no Material glyph; each is a UiIcon', () => {
|
||||
assert.deepEqual(template.match(/material-symbols-outlined/g) ?? [], []);
|
||||
const icons = template.match(/<UiIcon\b[^>]*>/g) ?? [];
|
||||
assert.equal(icons.length, 3);
|
||||
// Without it the kit writes an 18px size that beats the Omnibar's own rules.
|
||||
for (const icon of icons) assert.match(icon, /:size="null"/);
|
||||
});
|
||||
|
||||
test('the only inline SVG glyphs are the mic and the chat row bubble', () => {
|
||||
const svgs = [...template.matchAll(/<svg\b[\s\S]*?<\/svg\s*>/g)].map(
|
||||
(m) => m[0],
|
||||
);
|
||||
assert.equal(svgs.length, 2);
|
||||
assert.match(svgs[0], /<rect x="9" y="3" width="6" height="11" rx="3" \/>/);
|
||||
assert.match(svgs[1], /class="omnibar-item-icon"/);
|
||||
assert.match(svgs[1], /<path d="M4 5h16v11H9l-5 4z" \/>/);
|
||||
});
|
||||
@@ -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/);
|
||||
});
|
||||
@@ -0,0 +1,108 @@
|
||||
// The Stories views' buttons and checkboxes are the kit's: neither the
|
||||
// Stories entry nor any Explore or Story screen hand-writes a <button> or an
|
||||
// `<input type="checkbox">`. Their glyphs are inline SVG drawn for Stories
|
||||
// (play, pause, back, filter, search, clear, expand, the GEV eye); no
|
||||
// Material symbol the page loads draws any of them the same, so they stay
|
||||
// SVG, and no view hand-writes a Material Symbols span. The three search
|
||||
// fields (Explore's two and the Story context sheet's) keep their own markup
|
||||
// rather than UiSearchField, whose Material magnifier would replace their
|
||||
// SVG one, and Explore's two clear buttons stay ghost UiButtons with an SVG
|
||||
// cross rather than UiCloseButtons, whose glyph is × or the Material `close`
|
||||
// symbol.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
/** A view's template block: everything outside script and style. */
|
||||
function template(file) {
|
||||
const source = readFileSync(
|
||||
new URL(`../views/${file}`, import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
return source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
|
||||
}
|
||||
const views = {
|
||||
// The Stories entry, the popup's Browse stories and Not now, and the
|
||||
// toast's Back to story.
|
||||
'StoriesView.vue': { buttons: 4, svgs: 2 },
|
||||
// The list grip, Filter, the two search clears, the topic chips (All and
|
||||
// each topic), the filter's Clear and Show, Clear all, a card's thumbnail
|
||||
// play and Play story, the map pins and the preview's Play story.
|
||||
'stories/ExploreScreen.vue': { buttons: 13, svgs: 8 },
|
||||
// Back, the logo, the breadcrumb's link, search, Share and Back to GEV or
|
||||
// GEV Stories.
|
||||
'stories/StoriesHeader.vue': { buttons: 8, svgs: 5 },
|
||||
// The sheet handle, voice search, the search results, Close, the key
|
||||
// moments and the related stories.
|
||||
'stories/StoryContext.vue': { buttons: 6, svgs: 3 },
|
||||
// Open in GEV and Share.
|
||||
'stories/StoryRail.vue': { buttons: 2, svgs: 1 },
|
||||
// A chapter, Minimise, Expand, the card's page dots, the big Play and
|
||||
// Context.
|
||||
'stories/StoryScreen.vue': { buttons: 6, svgs: 5 },
|
||||
// Play, the key moment pips and Expand map.
|
||||
'stories/StoryTimeline.vue': { buttons: 3, svgs: 2 },
|
||||
};
|
||||
// A tag's attributes, read past quoted values so a handler's `=>` does not
|
||||
// end the tag early.
|
||||
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
|
||||
const tag = (pattern, flags = '') =>
|
||||
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
|
||||
const markup = Object.fromEntries(
|
||||
Object.keys(views).map((file) => [file, template(file)]),
|
||||
);
|
||||
|
||||
test('the Stories views hand-write no button; each is a UiButton', () => {
|
||||
for (const [file, { buttons }] of Object.entries(views)) {
|
||||
assert.deepEqual(markup[file].match(/<button\b/gi) ?? [], [], file);
|
||||
assert.equal(markup[file].match(/<UiButton\b/g)?.length, buttons, file);
|
||||
}
|
||||
});
|
||||
|
||||
test('the pressed toggles take the kit pressed state', () => {
|
||||
for (const view of Object.values(markup))
|
||||
assert.doesNotMatch(view, tag(String.raw`<UiButton\bATTRS\saria-pressed`));
|
||||
const explore = markup['stories/ExploreScreen.vue'];
|
||||
// All, each topic and the map pins; the cards are role="button" divs that
|
||||
// keep their own aria-pressed.
|
||||
assert.equal(
|
||||
explore.match(tag(String.raw`<UiButton\bATTRS\s:pressed=`, 'g'))?.length,
|
||||
3,
|
||||
);
|
||||
assert.match(
|
||||
explore,
|
||||
tag(String.raw`class="card"\s+role="button"ATTRS\s:aria-pressed=`),
|
||||
);
|
||||
assert.match(
|
||||
markup['stories/StoryScreen.vue'],
|
||||
tag(String.raw`<UiButton\s+id="btnCtx"ATTRS\s:pressed="ctxOpen"`),
|
||||
);
|
||||
assert.match(
|
||||
markup['stories/StoryTimeline.vue'],
|
||||
tag(String.raw`<UiButton\s+id="stExpand"ATTRS\s:pressed="expanded"`),
|
||||
);
|
||||
});
|
||||
|
||||
test("Explore's filter options are UiCheckboxes in their own label", () => {
|
||||
const explore = markup['stories/ExploreScreen.vue'];
|
||||
assert.deepEqual(
|
||||
explore.match(tag(String.raw`<input\bATTRS\stype="checkbox"`, 'g')) ?? [],
|
||||
[],
|
||||
);
|
||||
const boxes = explore.match(tag(String.raw`<UiCheckbox\bATTRS>`, 'g')) ?? [];
|
||||
assert.equal(boxes.length, 1);
|
||||
assert.match(boxes[0], /class="fopt"/);
|
||||
// Controlled, so the box always shows the applied filter.
|
||||
assert.match(boxes[0], /:model-value="Boolean\(/);
|
||||
});
|
||||
|
||||
test('the glyphs stay inline SVG; no view hand-writes a Material span', () => {
|
||||
for (const [file, { svgs }] of Object.entries(views)) {
|
||||
assert.deepEqual(
|
||||
markup[file].match(/material-symbols-outlined/g) ?? [],
|
||||
[],
|
||||
file,
|
||||
);
|
||||
assert.equal(markup[file].match(/<svg\b/g)?.length, svgs, file);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,174 @@
|
||||
// The kit's every-control claims in docs/VUE-MIGRATION.md, read from every
|
||||
// SFC outside the kit: every select is a UiSelect, every pressed toggle a
|
||||
// UiButton with `pressed` (no template hand-writes `aria-pressed` on any
|
||||
// element, as an attribute or inside a `v-bind` object, apart from the
|
||||
// exceptions below), and every close, dismiss and clear button a
|
||||
// UiCloseButton.
|
||||
// Controls built in script are not read here.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync, readdirSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const SRC_ROOT = fileURLToPath(new URL('../../', import.meta.url));
|
||||
const KIT_ROOT = fileURLToPath(new URL('./', import.meta.url));
|
||||
const REPO_ROOT = path.resolve(SRC_ROOT, '..');
|
||||
|
||||
// The pressed toggles that still hand-write `aria-pressed`, by file: each
|
||||
// pattern matches exactly one of the file's tags, and no other tag may.
|
||||
const HAND_WRITTEN_PRESSED = {
|
||||
// The cinematic button renders the attributes the Bhote Koshi layer
|
||||
// writes for it, `aria-pressed` among them.
|
||||
'src/ui/views/panels/BhoteKoshiPanel.vue': [/^<button\b[^]*\bcinematic/],
|
||||
// Explore's story cards are `role="button"` elements, not buttons.
|
||||
'src/ui/views/stories/ExploreScreen.vue': [
|
||||
/^<div class="card" role="button"/,
|
||||
],
|
||||
};
|
||||
|
||||
/** Every SFC under src, outside the kit. */
|
||||
function sfcFiles(directory = SRC_ROOT) {
|
||||
const files = [];
|
||||
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
||||
const absolute = path.join(directory, entry.name);
|
||||
if (entry.isDirectory()) {
|
||||
if (path.relative(KIT_ROOT, absolute) !== '')
|
||||
files.push(...sfcFiles(absolute));
|
||||
} else if (entry.isFile() && entry.name.endsWith('.vue'))
|
||||
files.push(absolute);
|
||||
}
|
||||
return files.sort();
|
||||
}
|
||||
|
||||
/** The template block: everything outside script, style and comments. */
|
||||
function template(source) {
|
||||
return source
|
||||
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
|
||||
.replace(/<!--[\s\S]*?-->/g, '');
|
||||
}
|
||||
|
||||
// An opening tag's attributes, quoted values may hold `>` (`() => x`).
|
||||
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
|
||||
const RAW_SELECT = /<select\b/gi;
|
||||
const ANY_TAG = new RegExp(String.raw`<[A-Za-z][\w-]*\b(${ATTRS})>`, 'g');
|
||||
// An attribute's name, outside the quoted values.
|
||||
const names = (attrs) => attrs.replace(/"[^"]*"|'[^']*'/g, '""');
|
||||
const PRESSED = /(?:^|\s)(?::|v-bind:)?aria-pressed(?=[\s=/]|$)/;
|
||||
// A `v-bind` object that names aria-pressed.
|
||||
const BOUND_PRESSED =
|
||||
/(?:^|\s)(?:v-bind|:)=(?:"[^"]*aria-?pressed[^"]*"|'[^']*aria-?pressed[^']*')/i;
|
||||
const TIMES = String.raw`×|×|×|×`;
|
||||
const CLOSE_GLYPH = [
|
||||
TIMES,
|
||||
String.raw`<span\b${ATTRS}>\s*(?:${TIMES})\s*</span\s*>`,
|
||||
String.raw`<span\b[^>]*\bmaterial-symbols-outlined\b[^>]*>\s*close\s*</span\s*>`,
|
||||
String.raw`<UiIcon${ATTRS}\bname="close"${ATTRS}/>`,
|
||||
].join('|');
|
||||
const HAND_WRITTEN_CLOSE = new RegExp(
|
||||
String.raw`<(button|UiButton)\b${ATTRS}>\s*(?:${CLOSE_GLYPH})\s*</\1\s*>`,
|
||||
'gi',
|
||||
);
|
||||
|
||||
const tidy = (markup) => markup.replace(/\s+/g, ' ');
|
||||
|
||||
/** Raw selects in an SFC's template. */
|
||||
const rawSelects = (source) =>
|
||||
[...template(source).matchAll(RAW_SELECT)].map((m) => m[0]);
|
||||
|
||||
/** Tags that hand-write aria-pressed. */
|
||||
function handWrittenPressed(source) {
|
||||
const found = [];
|
||||
for (const m of template(source).matchAll(ANY_TAG))
|
||||
if (PRESSED.test(names(m[1])) || BOUND_PRESSED.test(m[1]))
|
||||
found.push(tidy(m[0]));
|
||||
return found;
|
||||
}
|
||||
|
||||
/** Hand-written close buttons in an SFC's template. */
|
||||
const handWrittenCloses = (source) =>
|
||||
[...template(source).matchAll(HAND_WRITTEN_CLOSE)].map((m) => tidy(m[0]));
|
||||
|
||||
const views = sfcFiles().map((file) => ({
|
||||
file: path.relative(REPO_ROOT, file).split(path.sep).join('/'),
|
||||
source: readFileSync(file, 'utf8'),
|
||||
}));
|
||||
|
||||
test('the scans find each hand-written control', () => {
|
||||
for (const markup of [
|
||||
'<template><select id="x" v-model="a"><option>1</option></select></template>',
|
||||
'<template><SELECT\n class="x"></SELECT></template>',
|
||||
])
|
||||
assert.equal(rawSelects(markup).length, 1, markup);
|
||||
for (const markup of [
|
||||
'<template><UiSelect id="x" v-model="a" /></template>',
|
||||
'<script>const html = "<select>";</script><template><p /></template>',
|
||||
'<template><!-- a <select> once sat here --><p /></template>',
|
||||
])
|
||||
assert.equal(rawSelects(markup).length, 0, markup);
|
||||
|
||||
for (const markup of [
|
||||
'<template><button type="button" :aria-pressed="String(on)">A</button></template>',
|
||||
'<template><UiButton\n class="x"\n :title="a > b ? 1 : 2"\n aria-pressed="true"\n>A</UiButton></template>',
|
||||
'<template><button v-bind:aria-pressed="on">A</button></template>',
|
||||
'<template><div class="card" role="button" tabindex="0" :aria-pressed="on" /></template>',
|
||||
'<template><li role="option" :aria-pressed="on" /></template>',
|
||||
'<template><a :role="\'button\'" :aria-pressed="on">A</a></template>',
|
||||
'<template><UiButton v-bind="{ \'aria-pressed\': on }">A</UiButton></template>',
|
||||
])
|
||||
assert.equal(handWrittenPressed(markup).length, 1, markup);
|
||||
for (const markup of [
|
||||
'<template><UiButton :pressed="Boolean(on)" pressed-class="active">A</UiButton></template>',
|
||||
'<template><button :title="\'aria-pressed\'" @click="q(\'[aria-pressed=true]\')">A</button></template>',
|
||||
'<template><li role="option" :aria-selected="on" /></template>',
|
||||
])
|
||||
assert.equal(handWrittenPressed(markup).length, 0, markup);
|
||||
|
||||
for (const markup of [
|
||||
'<template><button type="button" @click="close">×</button></template>',
|
||||
'<template><button type="button" :aria-label="l"><span aria-hidden="true">×</span></button></template>',
|
||||
'<template><UiButton class="x"><UiIcon name="close" :size="null" /></UiButton></template>',
|
||||
])
|
||||
assert.equal(handWrittenCloses(markup).length, 1, markup);
|
||||
for (const markup of [
|
||||
'<template><UiCloseButton class="x" :label="l" /></template>',
|
||||
'<template><UiButton :label="l"><UiIcon :name="item.icon" :size="null" /></UiButton></template>',
|
||||
])
|
||||
assert.equal(handWrittenCloses(markup).length, 0, markup);
|
||||
});
|
||||
|
||||
test('the views are read: the scan reaches the views and skips the kit', () => {
|
||||
const files = views.map((view) => view.file);
|
||||
assert.ok(files.includes('src/ui/views/panels/ChatPanel.vue'));
|
||||
assert.ok(files.includes('src/ui/layerPanel/RowRange.vue'));
|
||||
assert.ok(!files.some((file) => file.startsWith('src/ui/kit/')));
|
||||
});
|
||||
|
||||
test('every select in the views is a UiSelect', () => {
|
||||
const found = [];
|
||||
for (const { file, source } of views)
|
||||
for (const markup of rawSelects(source)) found.push(`${file}: ${markup}`);
|
||||
assert.deepEqual(found, []);
|
||||
});
|
||||
|
||||
test('no view hand-writes aria-pressed on a button outside the documented exceptions', () => {
|
||||
const unexpected = [];
|
||||
for (const { file, source } of views) {
|
||||
const allowed = [...(HAND_WRITTEN_PRESSED[file] ?? [])];
|
||||
for (const markup of handWrittenPressed(source)) {
|
||||
const at = allowed.findIndex((pattern) => pattern.test(markup));
|
||||
if (at === -1) unexpected.push(`${file}: ${markup}`);
|
||||
else allowed.splice(at, 1);
|
||||
}
|
||||
assert.deepEqual(allowed, [], `${file}: an exception no longer matches`);
|
||||
}
|
||||
assert.deepEqual(unexpected, []);
|
||||
});
|
||||
|
||||
test('no view hand-writes a close button; each is a UiCloseButton', () => {
|
||||
const found = [];
|
||||
for (const { file, source } of views)
|
||||
for (const markup of handWrittenCloses(source))
|
||||
found.push(`${file}: ${markup}`);
|
||||
assert.deepEqual(found, []);
|
||||
});
|
||||
@@ -0,0 +1,53 @@
|
||||
// The Visual panel's buttons and Material glyphs are the kit's: neither its
|
||||
// template nor the presets it renders hand-writes a <button>, a Material
|
||||
// Symbols span or an inline SVG. The toggles' text glyphs (◎ ▣ ✈ □ ✨ 🔍)
|
||||
// and the presets' style glyphs are characters, not Material symbols, so
|
||||
// they stay text the panel's rules size.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
/** A view's template block: everything outside script and style. */
|
||||
function template(file) {
|
||||
const source = readFileSync(
|
||||
new URL(`../views/panels/${file}`, import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
return source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
|
||||
}
|
||||
const panel = template('DisplayPanel.vue');
|
||||
const presets = template('VisualPresets.vue');
|
||||
|
||||
test('the Visual panel hand-writes no button; each is a UiButton', () => {
|
||||
for (const markup of [panel, presets])
|
||||
assert.deepEqual(markup.match(/<button\b/gi) ?? [], []);
|
||||
// HUD, Sonar, Detection, 3D, Clean UI, Celestial, Bloom, Sharpen and
|
||||
// Reset to default.
|
||||
assert.equal(panel.match(/<UiButton\b/g)?.length, 9);
|
||||
// The style presets and the map source chips.
|
||||
assert.equal(presets.match(/<UiButton\b/g)?.length, 2);
|
||||
// Scope, the sky rows and the application's toggle rows.
|
||||
assert.equal(panel.match(/<UiCheckbox\b/g)?.length, 3);
|
||||
// 3D model coverage and detection label allocation.
|
||||
assert.equal(panel.match(/<UiSegmented\b/g)?.length, 2);
|
||||
});
|
||||
|
||||
test('the Visual panel hand-writes no Material glyph; each is a UiIcon', () => {
|
||||
for (const markup of [panel, presets]) {
|
||||
assert.deepEqual(markup.match(/material-symbols-outlined/g) ?? [], []);
|
||||
assert.deepEqual(markup.match(/<svg\b/gi) ?? [], []);
|
||||
}
|
||||
const icons = panel.match(/<UiIcon\b[^>]*>/g) ?? [];
|
||||
// Scope, Celestial, the sky rows, the application's rows and Reset.
|
||||
assert.equal(icons.length, 5);
|
||||
// Without it the kit writes an 18px size that beats the panel's own rules.
|
||||
for (const icon of icons) assert.match(icon, /:size="null"/);
|
||||
});
|
||||
|
||||
test('the toggles keep their text glyphs as plain spans', () => {
|
||||
const glyphs = [...panel.matchAll(/<span class="pp-icon">([^<]*)<\/span>/g)];
|
||||
assert.deepEqual(
|
||||
glyphs.map((m) => m[1]),
|
||||
['◎', '▣', '✈', '□', '✨', '🔍'],
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
// The welcome card's buttons and Material glyphs are the kit's: its template
|
||||
// hand-writes no <button> and no Material Symbols span, and its one box is a
|
||||
// UiCheckbox. Its two inline SVGs (God mode's globe and its callouts) are
|
||||
// drawings, not glyphs, and its outbound links stay links.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
const source = readFileSync(
|
||||
new URL('../views/WelcomeView.vue', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
/** The template block: everything outside script and style. */
|
||||
const template = source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
|
||||
|
||||
test('the welcome card hand-writes no button; each is a UiButton', () => {
|
||||
assert.deepEqual(template.match(/<button\b/gi) ?? [], []);
|
||||
// SKIP, the three start tiles, BROWSE STORIES, BACK and the main action.
|
||||
assert.equal(template.match(/<UiButton\b/g)?.length, 7);
|
||||
assert.equal(template.match(/<UiCheckbox\b/g)?.length, 1);
|
||||
});
|
||||
|
||||
test('the welcome card hand-writes no Material glyph; each is a UiIcon', () => {
|
||||
assert.deepEqual(template.match(/material-symbols-outlined/g) ?? [], []);
|
||||
const icons = template.match(/<UiIcon\b[^>]*>/g) ?? [];
|
||||
// The three tiles, the three tips, the Stories card and the main arrow.
|
||||
assert.equal(icons.length, 8);
|
||||
// Without it the kit writes an 18px size that beats first-run.css's rules.
|
||||
for (const icon of icons) assert.match(icon, /:size="null"/);
|
||||
});
|
||||
|
||||
test('the only inline SVGs are God mode preview drawings', () => {
|
||||
const svgs = [...template.matchAll(/<svg\b[^>]*>/g)].map((m) => m[0]);
|
||||
assert.equal(svgs.length, 2);
|
||||
assert.match(svgs[0], /class="first-run-globe"/);
|
||||
assert.match(svgs[1], /class="first-run-callouts"/);
|
||||
});
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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
@@ -49,6 +49,11 @@ const meta = () =>
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' · ');
|
||||
// The card's face is the slot of a UiButton, which renders inside the
|
||||
// button: a new item alone would reach it only on a later tick, but the panel
|
||||
// patches synchronously. A slot given under a condition (`redrawWithView`,
|
||||
// always true) is redrawn whenever this card is, so it keeps up.
|
||||
const redrawWithView = true;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -58,60 +63,62 @@ const meta = () =>
|
||||
:data-report-id="item.id"
|
||||
:style="{ '--news-color': item.color }"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="news-card__main ui-focus"
|
||||
<UiButton
|
||||
class="news-card__main"
|
||||
:aria-expanded="open ? 'true' : 'false'"
|
||||
@click="onChoose(item)"
|
||||
><template v-if="redrawWithView" #default>
|
||||
<span v-if="item.picture && !pictureFailed" class="news-card__thumb"
|
||||
><img
|
||||
:src="item.picture.url"
|
||||
alt=""
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
referrerpolicy="no-referrer"
|
||||
v-on="{ error: dropPicture }"
|
||||
/><span
|
||||
v-if="item.picture.video && !clipFailed"
|
||||
class="news-card__play"
|
||||
role="img"
|
||||
:aria-label="t('Video')"
|
||||
>▶</span
|
||||
><span v-if="item.picture.credit" class="news-card__credit">{{
|
||||
item.picture.credit
|
||||
}}</span></span
|
||||
>
|
||||
<span class="news-card__title">{{ item.title }}</span>
|
||||
<span v-if="item.original" class="news-card__note">{{
|
||||
t('English headline by the model')
|
||||
}}</span>
|
||||
<span class="news-card__meta ui-mono"
|
||||
><span
|
||||
class="news-card__marker"
|
||||
:class="{ solid: item.solid }"
|
||||
role="img"
|
||||
:aria-label="item.severityLabel"
|
||||
:title="item.severityLabel"
|
||||
><svg viewBox="0 0 16 16" aria-hidden="true">
|
||||
<path :d="item.icon" /></svg></span
|
||||
><span v-if="item.severity >= 2" class="news-card__severity">{{
|
||||
item.severityLabel
|
||||
}}</span
|
||||
>{{ item.severity >= 2 ? ` · ${meta()}` : meta() }}</span
|
||||
>
|
||||
<span v-if="item.sides" class="news-card__sides">{{ item.sides }}</span>
|
||||
<span v-if="item.chips.length" class="news-card__chips"
|
||||
><span
|
||||
v-for="chip in item.chips"
|
||||
:key="`${chip.kind}:${chip.label}`"
|
||||
class="news-chip"
|
||||
:class="`news-chip--${chip.kind}`"
|
||||
>{{ chip.label }}</span
|
||||
></span
|
||||
>
|
||||
<span v-if="item.via" class="news-card__via ui-mono">{{
|
||||
item.via
|
||||
}}</span>
|
||||
</template></UiButton
|
||||
>
|
||||
<span v-if="item.picture && !pictureFailed" class="news-card__thumb"
|
||||
><img
|
||||
:src="item.picture.url"
|
||||
alt=""
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
referrerpolicy="no-referrer"
|
||||
v-on="{ error: dropPicture }"
|
||||
/><span
|
||||
v-if="item.picture.video && !clipFailed"
|
||||
class="news-card__play"
|
||||
role="img"
|
||||
:aria-label="t('Video')"
|
||||
>▶</span
|
||||
><span v-if="item.picture.credit" class="news-card__credit">{{
|
||||
item.picture.credit
|
||||
}}</span></span
|
||||
>
|
||||
<span class="news-card__title">{{ item.title }}</span>
|
||||
<span v-if="item.original" class="news-card__note">{{
|
||||
t('English headline by the model')
|
||||
}}</span>
|
||||
<span class="news-card__meta ui-mono"
|
||||
><span
|
||||
class="news-card__marker"
|
||||
:class="{ solid: item.solid }"
|
||||
role="img"
|
||||
:aria-label="item.severityLabel"
|
||||
:title="item.severityLabel"
|
||||
><svg viewBox="0 0 16 16" aria-hidden="true">
|
||||
<path :d="item.icon" /></svg></span
|
||||
><span v-if="item.severity >= 2" class="news-card__severity">{{
|
||||
item.severityLabel
|
||||
}}</span
|
||||
>{{ item.severity >= 2 ? ` · ${meta()}` : meta() }}</span
|
||||
>
|
||||
<span v-if="item.sides" class="news-card__sides">{{ item.sides }}</span>
|
||||
<span v-if="item.chips.length" class="news-card__chips"
|
||||
><span
|
||||
v-for="chip in item.chips"
|
||||
:key="`${chip.kind}:${chip.label}`"
|
||||
class="news-chip"
|
||||
:class="`news-chip--${chip.kind}`"
|
||||
>{{ chip.label }}</span
|
||||
></span
|
||||
>
|
||||
<span v-if="item.via" class="news-card__via ui-mono">{{ item.via }}</span>
|
||||
</button>
|
||||
<div v-if="open" class="news-card__open">
|
||||
<video
|
||||
v-if="item.picture?.video && !clipFailed"
|
||||
|
||||
+90
-79
@@ -13,9 +13,11 @@
|
||||
// features (styles, HUD, compass, tilt, globe view, share, clear) have their
|
||||
// own. The walk works the same for all of them.
|
||||
|
||||
import { h, render as renderVue } from 'vue';
|
||||
import { t } from '../i18n/index.js';
|
||||
import { EXCLUSIVE_SURFACE_CLASSES } from '../exclusiveSurfaces.js';
|
||||
import { LABEL_LAYERS } from './contextLayerTabs.js';
|
||||
import OmnibarGuide from './views/panels/OmnibarGuide.vue';
|
||||
|
||||
const LEFT_RAIL = '.ui-rail--left .ui-rail__item';
|
||||
const RIGHT_RAIL = '.ui-rail--right .ui-rail__item';
|
||||
@@ -445,43 +447,76 @@ export function startGuide(steps, { title = '' } = {}) {
|
||||
active?.stop();
|
||||
const doc = globalThis.document;
|
||||
if (!doc?.body || screenIsOwned(doc) || !steps?.length) return;
|
||||
const root = doc.createElement('div');
|
||||
root.className = 'gev-guide';
|
||||
root.innerHTML =
|
||||
'<div class="gev-guide-ring"><i></i></div>' +
|
||||
'<div class="gev-guide-callout" role="dialog" aria-modal="false" tabindex="-1" aria-labelledby="gev-guide-title" aria-describedby="gev-guide-text">' +
|
||||
'<div class="gev-guide-head"><p id="gev-guide-title" class="gev-guide-title"></p>' +
|
||||
'<p class="gev-guide-count"></p>' +
|
||||
'<button type="button" class="gev-guide-close"><span aria-hidden="true">×</span></button></div>' +
|
||||
'<ol class="gev-guide-progress" aria-hidden="true"></ol>' +
|
||||
'<div class="gev-guide-body"><p id="gev-guide-text" class="gev-guide-text"></p>' +
|
||||
'<p class="gev-guide-hint"><span class="gev-guide-hint-dot"></span><span></span></p></div>' +
|
||||
'<div class="gev-guide-actions"><p class="gev-guide-keys"><kbd></kbd><span></span></p>' +
|
||||
'<span><button type="button" class="gev-guide-skip" hidden></button>' +
|
||||
'<button type="button" class="gev-guide-offer" hidden></button>' +
|
||||
'<button type="button" class="gev-guide-next"></button></span></div>' +
|
||||
// What the view renders: the owner writes it for each step, then paints.
|
||||
// The view never binds what is set on the elements: the guide's `visible`
|
||||
// class, the callout's entrance replay, place and side, and the rings'
|
||||
// boxes, set per frame.
|
||||
const endLabel = t('End guide');
|
||||
const view = {
|
||||
title: title ? t('Guide · {topic}', { topic: title }) : t('Guide'),
|
||||
endLabel,
|
||||
count: '',
|
||||
step: 0,
|
||||
progress: [],
|
||||
text: '',
|
||||
hint: t('Press the highlighted control'),
|
||||
hintHidden: false,
|
||||
// i18n-ignore: the Escape keycap, matching the keyboard shortcut.
|
||||
keyCap: 'Esc',
|
||||
keyText: t('to end'),
|
||||
keysHidden: false,
|
||||
skipLabel: '',
|
||||
skipHidden: true,
|
||||
offerLabel: '',
|
||||
offerHidden: true,
|
||||
nextLabel: t('Next'),
|
||||
nextHidden: false,
|
||||
nextQuiet: false,
|
||||
// The extra rings for a step's further targets, after the callout; the
|
||||
// count only grows, and rings a step does not use are faded out.
|
||||
subRings: 0,
|
||||
// Announces each step once; the dialog itself is not a live region, so
|
||||
// its buttons and progress are not read out on every change.
|
||||
'<p class="gev-guide-status" role="status" aria-live="polite"></p></div>';
|
||||
status: '',
|
||||
};
|
||||
const host = doc.createElement('div');
|
||||
const handlers = {
|
||||
onClose: () => stop(),
|
||||
onSkip: () => stop(),
|
||||
// Taking the offer carries the walk on with its steps.
|
||||
onOffer() {
|
||||
if (!current?.offer) return;
|
||||
const extra = current.offer.steps() || [];
|
||||
live.splice(index + 1, live.length, ...extra.filter(Boolean));
|
||||
next();
|
||||
},
|
||||
onNext() {
|
||||
if (current) next();
|
||||
},
|
||||
};
|
||||
let mounted = true;
|
||||
/** Render the view now: the guide goes to the end of the body. */
|
||||
function paint() {
|
||||
if (!mounted) return null;
|
||||
const vnode = h(OmnibarGuide, {
|
||||
to: doc.body,
|
||||
view: { ...view },
|
||||
...handlers,
|
||||
});
|
||||
renderVue(vnode, host);
|
||||
return vnode;
|
||||
}
|
||||
// Focus returns where it was when the walk ends, if that is still there.
|
||||
const returnFocus = doc.activeElement;
|
||||
doc.body.append(root);
|
||||
const ring = root.querySelector('.gev-guide-ring');
|
||||
const callout = root.querySelector('.gev-guide-callout');
|
||||
const subRings = [];
|
||||
const endLabel = t('End guide');
|
||||
root.querySelector('.gev-guide-close').setAttribute('aria-label', endLabel);
|
||||
root.querySelector('.gev-guide-close').title = endLabel;
|
||||
// i18n-ignore: the Escape keycap, matching the keyboard shortcut.
|
||||
root.querySelector('.gev-guide-keys kbd').textContent = 'Esc';
|
||||
root.querySelector('.gev-guide-keys span').textContent = t('to end');
|
||||
root.querySelector('.gev-guide-title').textContent = title
|
||||
? t('Guide · {topic}', { topic: title })
|
||||
: t('Guide');
|
||||
root.querySelector('.gev-guide-next').textContent = t('Next');
|
||||
root.querySelector('.gev-guide-hint span:last-child').textContent = t(
|
||||
'Press the highlighted control',
|
||||
);
|
||||
// The elements come from the rendered tree, which is in place as soon as the
|
||||
// render returns; template refs are filled after it, and later still when
|
||||
// the walk starts inside one of Vue's own post-render updates.
|
||||
const root = paint().component.subTree.children[0].el;
|
||||
const ring = root.querySelector(':scope > .gev-guide-ring');
|
||||
const callout = root.querySelector(':scope > .gev-guide-callout');
|
||||
// The extra rings, read again from the rendered tree whenever more are
|
||||
// drawn.
|
||||
let subRings = [];
|
||||
|
||||
const live = steps.filter(Boolean);
|
||||
let index = -1;
|
||||
@@ -503,7 +538,8 @@ export function startGuide(steps, { title = '' } = {}) {
|
||||
doc.removeEventListener('click', onClick, true);
|
||||
doc.removeEventListener('keydown', onKey, true);
|
||||
const hadFocus = root.contains(doc.activeElement);
|
||||
root.remove();
|
||||
mounted = false;
|
||||
renderVue(null, host);
|
||||
if (hadFocus && returnFocus?.isConnected) returnFocus.focus?.();
|
||||
if (active?.stop === stop) active = null;
|
||||
};
|
||||
@@ -534,41 +570,29 @@ export function startGuide(steps, { title = '' } = {}) {
|
||||
// would not be skipped as things stand.
|
||||
const total =
|
||||
shown + live.slice(index + 1).filter((later) => !later.skip?.()).length;
|
||||
root.querySelector('.gev-guide-count').textContent = `${shown} / ${total}`;
|
||||
const progress = root.querySelector('.gev-guide-progress');
|
||||
progress.replaceChildren(
|
||||
...Array.from({ length: total }, (_, i) => {
|
||||
const dot = doc.createElement('li');
|
||||
if (i < shown - 1) dot.className = 'done';
|
||||
if (i === shown - 1) dot.className = 'current';
|
||||
return dot;
|
||||
}),
|
||||
view.count = `${shown} / ${total}`;
|
||||
view.step = shown;
|
||||
view.progress = Array.from({ length: total }, (_, i) =>
|
||||
i < shown - 1 ? 'done' : i === shown - 1 ? 'current' : null,
|
||||
);
|
||||
const text = step.text();
|
||||
root.querySelector('.gev-guide-text').textContent = text;
|
||||
root.querySelector('.gev-guide-status').textContent =
|
||||
`${shown} / ${total}: ${text}`;
|
||||
view.text = text;
|
||||
view.status = `${shown} / ${total}: ${text}`;
|
||||
// Steps that point at a control wait for it to be pressed; say so.
|
||||
const waits = Boolean(step.targets) && !step.offer;
|
||||
root.querySelector('.gev-guide-hint').hidden = !waits;
|
||||
const offer = root.querySelector('.gev-guide-offer');
|
||||
const skip = root.querySelector('.gev-guide-skip');
|
||||
offer.hidden = !step.offer;
|
||||
skip.hidden = !step.offer;
|
||||
root.querySelector('.gev-guide-keys').hidden = Boolean(step.offer);
|
||||
view.hintHidden = !waits;
|
||||
view.offerHidden = !step.offer;
|
||||
view.skipHidden = !step.offer;
|
||||
view.keysHidden = Boolean(step.offer);
|
||||
if (step.offer) {
|
||||
offer.textContent = step.offer.label();
|
||||
skip.textContent = t('Not now');
|
||||
view.offerLabel = step.offer.label();
|
||||
view.skipLabel = t('Not now');
|
||||
}
|
||||
const last = index === live.length - 1;
|
||||
const nextButton = root.querySelector('.gev-guide-next');
|
||||
nextButton.hidden = Boolean(step.offer);
|
||||
nextButton.textContent = last
|
||||
? t('Finish')
|
||||
: waits
|
||||
? t('Skip step')
|
||||
: t('Next');
|
||||
nextButton.classList.toggle('quiet', waits && !last);
|
||||
view.nextHidden = Boolean(step.offer);
|
||||
view.nextLabel = last ? t('Finish') : waits ? t('Skip step') : t('Next');
|
||||
view.nextQuiet = waits && !last;
|
||||
paint();
|
||||
// Replay the entrance so each step reads as new.
|
||||
callout.classList.remove('swap');
|
||||
void callout.offsetWidth;
|
||||
@@ -597,18 +621,6 @@ export function startGuide(steps, { title = '' } = {}) {
|
||||
event.stopPropagation();
|
||||
stop();
|
||||
}
|
||||
root.querySelector('.gev-guide-skip').addEventListener('click', stop);
|
||||
root.querySelector('.gev-guide-close').addEventListener('click', stop);
|
||||
root.querySelector('.gev-guide-next').addEventListener('click', () => {
|
||||
if (current) next();
|
||||
});
|
||||
// Taking the offer carries the walk on with its steps.
|
||||
root.querySelector('.gev-guide-offer').addEventListener('click', () => {
|
||||
if (!current?.offer) return;
|
||||
const extra = current.offer.steps() || [];
|
||||
live.splice(index + 1, live.length, ...extra.filter(Boolean));
|
||||
next();
|
||||
});
|
||||
doc.addEventListener('click', onClick, true);
|
||||
doc.addEventListener('keydown', onKey, true);
|
||||
|
||||
@@ -650,11 +662,10 @@ export function startGuide(steps, { title = '' } = {}) {
|
||||
width: `${main.width + pad * 2}px`,
|
||||
height: `${main.height + pad * 2}px`,
|
||||
});
|
||||
while (subRings.length < rest.length) {
|
||||
const sub = doc.createElement('div');
|
||||
sub.className = 'gev-guide-ring gev-guide-ring--sub';
|
||||
root.append(sub);
|
||||
subRings.push(sub);
|
||||
if (subRings.length < rest.length) {
|
||||
view.subRings = rest.length;
|
||||
paint();
|
||||
subRings = [...root.querySelectorAll(':scope > .gev-guide-ring--sub')];
|
||||
}
|
||||
subRings.forEach((sub, i) => {
|
||||
const box = rest[i];
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
// The guided walk's callout, rendered by startGuide() over happy-dom.
|
||||
import '../testSupport/registerDom.mjs';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { createApp, h, onMounted } from 'vue';
|
||||
import { startGuide } from './omnibarGuide.js';
|
||||
|
||||
const settle = () => new Promise((resolve) => setTimeout(resolve, 0));
|
||||
const $ = (selector) => document.querySelector(selector);
|
||||
|
||||
function fixture(t) {
|
||||
document.body.replaceChildren();
|
||||
const target = document.body.appendChild(document.createElement('button'));
|
||||
const field = document.body.appendChild(document.createElement('input'));
|
||||
field.focus();
|
||||
t.after(() => $('.gev-guide-close')?.click());
|
||||
return { target, field };
|
||||
}
|
||||
|
||||
test('the walk is the last of the body, takes focus and gives it back', async (t) => {
|
||||
const { target, field } = fixture(t);
|
||||
startGuide([{ targets: () => [target], text: () => 'Press it' }], {
|
||||
title: 'Flights',
|
||||
});
|
||||
await settle();
|
||||
const guide = $('.gev-guide');
|
||||
assert.equal(document.body.lastElementChild, guide);
|
||||
assert.equal(guide.parentElement, document.body);
|
||||
assert.ok(guide.classList.contains('visible'));
|
||||
const callout = $('.gev-guide-callout');
|
||||
assert.equal(document.activeElement, callout);
|
||||
assert.equal(callout.getAttribute('role'), 'dialog');
|
||||
assert.equal(callout.getAttribute('aria-modal'), 'false');
|
||||
assert.equal(callout.getAttribute('tabindex'), '-1');
|
||||
assert.equal($('.gev-guide-title').textContent, 'Guide · Flights');
|
||||
const close = $('.gev-guide-close');
|
||||
assert.equal(close.getAttribute('type'), 'button');
|
||||
assert.equal(close.getAttribute('aria-label'), 'End guide');
|
||||
assert.equal(close.getAttribute('title'), 'End guide');
|
||||
assert.ok(close.classList.contains('ui-close-button'));
|
||||
close.focus();
|
||||
close.click();
|
||||
assert.equal($('.gev-guide'), null);
|
||||
assert.equal(document.activeElement, field);
|
||||
});
|
||||
|
||||
test('the status line says each step once, and each step draws new progress', async (t) => {
|
||||
const { target } = fixture(t);
|
||||
startGuide([
|
||||
{ targets: () => [target], text: () => 'Press it' },
|
||||
{ text: () => 'Then this' },
|
||||
{
|
||||
text: () => 'More?',
|
||||
offer: { label: () => 'Show more', steps: () => [] },
|
||||
},
|
||||
]);
|
||||
const status = $('.gev-guide-status');
|
||||
const said = [];
|
||||
// One change per step: its text replaced once, never cleared first.
|
||||
const observer = new MutationObserver(() => said.push(status.textContent));
|
||||
observer.observe(status, {
|
||||
childList: true,
|
||||
characterData: true,
|
||||
subtree: true,
|
||||
});
|
||||
t.after(() => observer.disconnect());
|
||||
await settle();
|
||||
const firstDots = [...document.querySelectorAll('.gev-guide-progress li')];
|
||||
assert.deepEqual(
|
||||
firstDots.map((dot) => dot.getAttribute('class')),
|
||||
['current', null, null],
|
||||
);
|
||||
const next = $('.gev-guide-next');
|
||||
assert.equal(next.textContent, 'Skip step');
|
||||
assert.ok(next.classList.contains('quiet'));
|
||||
assert.equal($('.gev-guide-hint').hidden, false);
|
||||
next.click();
|
||||
await settle();
|
||||
const secondDots = [...document.querySelectorAll('.gev-guide-progress li')];
|
||||
assert.deepEqual(
|
||||
secondDots.map((dot) => dot.getAttribute('class')),
|
||||
['done', 'current', null],
|
||||
);
|
||||
assert.ok(secondDots.every((dot) => !firstDots.includes(dot)));
|
||||
assert.equal(next.textContent, 'Next');
|
||||
assert.equal(next.classList.contains('quiet'), false);
|
||||
assert.equal($('.gev-guide-hint').hidden, true);
|
||||
next.click();
|
||||
await settle();
|
||||
// The closing offer: its two buttons, no Esc hint and no Next.
|
||||
assert.equal($('.gev-guide-keys').hidden, true);
|
||||
assert.equal(next.hidden, true);
|
||||
assert.equal($('.gev-guide-skip').hidden, false);
|
||||
assert.equal($('.gev-guide-skip').textContent, 'Not now');
|
||||
assert.equal($('.gev-guide-offer').textContent, 'Show more');
|
||||
assert.deepEqual(said, [
|
||||
'1 / 3: Press it',
|
||||
'2 / 3: Then this',
|
||||
'3 / 3: More?',
|
||||
]);
|
||||
$('.gev-guide-skip').click();
|
||||
assert.equal($('.gev-guide'), null);
|
||||
});
|
||||
|
||||
test('starting another walk ends the one in progress', async (t) => {
|
||||
fixture(t);
|
||||
startGuide([{ text: () => 'First' }]);
|
||||
startGuide([{ text: () => 'Second' }]);
|
||||
await settle();
|
||||
assert.equal(document.querySelectorAll('.gev-guide').length, 1);
|
||||
assert.equal($('.gev-guide-text').textContent, 'Second');
|
||||
});
|
||||
|
||||
test('a walk started while Vue mounts something else still starts and ends', async (t) => {
|
||||
const { target, field } = fixture(t);
|
||||
let stop = null;
|
||||
const app = createApp({
|
||||
setup() {
|
||||
onMounted(() => {
|
||||
stop = startGuide([
|
||||
{ targets: () => [target], text: () => 'Press it' },
|
||||
]);
|
||||
});
|
||||
return () => h('span');
|
||||
},
|
||||
});
|
||||
app.mount(document.body.appendChild(document.createElement('div')));
|
||||
t.after(() => app.unmount());
|
||||
await settle();
|
||||
assert.equal(typeof stop, 'function');
|
||||
assert.equal(document.activeElement, $('.gev-guide-callout'));
|
||||
assert.ok($('.gev-guide').classList.contains('visible'));
|
||||
stop();
|
||||
assert.equal($('.gev-guide'), null);
|
||||
assert.equal(document.activeElement, field);
|
||||
});
|
||||
|
||||
test('each further target of a step gets its own ring after the callout', async (t) => {
|
||||
const { target } = fixture(t);
|
||||
const more = document.body.appendChild(document.createElement('button'));
|
||||
const box = (left) => () => ({
|
||||
left,
|
||||
top: 20,
|
||||
right: left + 30,
|
||||
bottom: 50,
|
||||
width: 30,
|
||||
height: 30,
|
||||
});
|
||||
target.getBoundingClientRect = box(10);
|
||||
more.getBoundingClientRect = box(100);
|
||||
let targets = [target, more];
|
||||
startGuide([{ targets: () => targets, text: () => 'Press these' }]);
|
||||
const frame = () => new Promise((resolve) => requestAnimationFrame(resolve));
|
||||
await settle();
|
||||
await frame();
|
||||
const subs = () => [...document.querySelectorAll('.gev-guide-ring--sub')];
|
||||
assert.equal(subs().length, 1);
|
||||
const [sub] = subs();
|
||||
assert.equal(sub.className, 'gev-guide-ring gev-guide-ring--sub');
|
||||
assert.equal(sub.parentElement, $('.gev-guide'));
|
||||
assert.equal(sub.previousElementSibling, $('.gev-guide-callout'));
|
||||
assert.equal(sub.childElementCount, 0);
|
||||
assert.equal(sub.style.opacity, '1');
|
||||
assert.equal(sub.style.left, '96px');
|
||||
assert.equal(sub.style.width, '38px');
|
||||
// A step with fewer targets keeps the ring, faded out.
|
||||
targets = [target];
|
||||
$('.gev-guide-ring').dispatchEvent(new Event('scroll', { bubbles: true }));
|
||||
await frame();
|
||||
assert.deepEqual(subs(), [sub]);
|
||||
assert.equal(sub.style.opacity, '0');
|
||||
});
|
||||
+41
-16
@@ -205,22 +205,7 @@ export class PanelChrome {
|
||||
beforeCollapse: () => {
|
||||
if (panelId === 'location-bar') this._closeLocationSearch?.();
|
||||
},
|
||||
// A desktop side panel hides entirely once collapsed; its rail item
|
||||
// takes the focus its own disclosure can no longer hold.
|
||||
returnFocusTo: () => {
|
||||
const panel = document.getElementById(panelId);
|
||||
if (!panel?.getClientRects || panel.getClientRects().length > 0)
|
||||
return null;
|
||||
const item = document.querySelector?.(
|
||||
`.ui-rail [data-rail-item="${panelId}"]`,
|
||||
);
|
||||
return item &&
|
||||
!item.disabled &&
|
||||
item.getClientRects().length > 0 &&
|
||||
getComputedStyle(item).visibility === 'visible'
|
||||
? item
|
||||
: null;
|
||||
},
|
||||
returnFocusTo: () => this._railFocusStand(panelId),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -229,9 +214,49 @@ export class PanelChrome {
|
||||
if (this._disposed || !this._disclosurePanelIds?.has(panelId)) return;
|
||||
const panel = document.getElementById(panelId);
|
||||
if (!panel) return;
|
||||
// Opening a panel folds others too (the side accordion, Cockpit's
|
||||
// Contact card): note which open ones hold the focus.
|
||||
const focused = document.activeElement;
|
||||
const holders = [...this._disclosurePanelIds]
|
||||
.map((id) => document.getElementById(id))
|
||||
.filter((el) => el?.contains(focused) && !this._shownPanel(el).collapsed);
|
||||
const cockpit = this.cockpitView;
|
||||
const contactHeld =
|
||||
cockpit?.active &&
|
||||
!cockpit.contextCollapsed &&
|
||||
document.getElementById('cockpit-context')?.contains(focused);
|
||||
this.setPanelCollapsed(panelId, !this._shownPanel(panel).collapsed, {
|
||||
explicit: true,
|
||||
});
|
||||
const stand =
|
||||
contactHeld && cockpit.contextCollapsed
|
||||
? document.getElementById('cockpit-context-toggle')
|
||||
: holders
|
||||
.filter((el) => this._shownPanel(el).collapsed)
|
||||
.map((el) => this._railFocusStand(el.id))
|
||||
.find(Boolean);
|
||||
stand?.focus({ preventScroll: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* A desktop side panel hides entirely once collapsed; its rail item takes
|
||||
* the focus its own disclosure can no longer hold. Null while the panel or
|
||||
* the item is not shown.
|
||||
* @param {string} panelId Panel element id.
|
||||
*/
|
||||
_railFocusStand(panelId) {
|
||||
const panel = document.getElementById(panelId);
|
||||
if (!panel?.getClientRects || panel.getClientRects().length > 0)
|
||||
return null;
|
||||
const item = document.querySelector?.(
|
||||
`.ui-rail [data-rail-item="${panelId}"]`,
|
||||
);
|
||||
return item &&
|
||||
!item.disabled &&
|
||||
item.getClientRects().length > 0 &&
|
||||
getComputedStyle(item).visibility === 'visible'
|
||||
? item
|
||||
: null;
|
||||
}
|
||||
|
||||
_setCommandDockPanelPinState(
|
||||
|
||||
@@ -14,6 +14,8 @@ import PanelCollapseButton from './rail/PanelCollapseButton.vue';
|
||||
import RailPanel from './rail/RailPanel.vue';
|
||||
import UiPanel from './kit/UiPanel.vue';
|
||||
import { usePanelChromeStore } from './stores/panelChrome.js';
|
||||
import { useDisplayStore } from './stores/display.js';
|
||||
import { DisplayBindings } from './displayBindings.js';
|
||||
import CommandDockView from './views/CommandDockView.vue';
|
||||
|
||||
function mount(t, component) {
|
||||
@@ -487,3 +489,164 @@ test('the accordion closes peers through the real store, and opens them again',
|
||||
assert.equal(panels[0].className, '');
|
||||
chrome.destroy();
|
||||
});
|
||||
|
||||
test('F collapses Data Layers like its button and keeps its rail entry', (t) => {
|
||||
document.body.innerHTML = `
|
||||
<nav class="ui-rail"><button data-rail-item="data-panel" style="visibility: visible"></button></nav>
|
||||
<div id="data-panel" class="active"><button class="panel-collapse-btn" data-collapse-target="data-panel"></button></div>`;
|
||||
const panel = document.getElementById('data-panel');
|
||||
const item = document.querySelector('[data-rail-item="data-panel"]');
|
||||
panel.getClientRects = () =>
|
||||
panel.classList.contains('collapsed') ? [] : [{}];
|
||||
item.getClientRects = () => [{}];
|
||||
const store = usePanelChromeStore(createPinia());
|
||||
const chrome = panelChrome(store);
|
||||
followPanelState(store, 'data-panel', panel);
|
||||
chrome._disclosurePanelIds = new Set(['data-panel']);
|
||||
const bindings = new DisplayBindings({
|
||||
viewer: null,
|
||||
services: { isScopeMaskEnabled: () => false, cycleDetectionMode() {} },
|
||||
elements: { _locationSearch: document.createElement('input') },
|
||||
operations: {
|
||||
_setScope() {},
|
||||
_togglePanel: (panelId) => chrome._togglePanel(panelId),
|
||||
},
|
||||
readState: () => ({}),
|
||||
claimDetection() {},
|
||||
displayStore: useDisplayStore(createPinia()),
|
||||
});
|
||||
bindings._initUI();
|
||||
t.after(() => {
|
||||
bindings.destroy();
|
||||
chrome.destroy();
|
||||
});
|
||||
const press = (init = {}) =>
|
||||
document.activeElement.dispatchEvent(
|
||||
new KeyboardEvent('keydown', { key: 'f', bubbles: true, ...init }),
|
||||
);
|
||||
|
||||
panel.querySelector('button').focus();
|
||||
press();
|
||||
assert.equal(store.panels['data-panel']?.collapsed, true);
|
||||
assert.ok(document.activeElement === item, 'focus moves to the rail');
|
||||
assert.ok(panel.classList.contains('collapsed'));
|
||||
// `active` is what shows Data Layers at all (layers.css).
|
||||
assert.ok(panel.classList.contains('active'));
|
||||
press({ metaKey: true });
|
||||
assert.equal(store.panels['data-panel'].collapsed, true, 'Cmd+F is not ours');
|
||||
press();
|
||||
assert.equal(store.panels['data-panel'].collapsed, false);
|
||||
assert.ok(!panel.classList.contains('collapsed'));
|
||||
assert.ok(panel.classList.contains('active'));
|
||||
});
|
||||
|
||||
test('F that folds a focused peer hands the focus to a rail entry', (t) => {
|
||||
document.body.innerHTML = `
|
||||
<nav class="ui-rail">
|
||||
<button data-rail-item="data-panel" style="visibility: visible"></button>
|
||||
<button data-rail-item="pp-toggles" style="visibility: visible"></button>
|
||||
</nav>
|
||||
<div id="left-panel-stack">
|
||||
<div id="data-panel" data-panel-id="data-panel" class="active collapsed"><button class="panel-collapse-btn" data-collapse-target="data-panel"></button></div>
|
||||
<div id="pp-toggles" data-panel-id="pp-toggles"><button class="panel-collapse-btn" data-collapse-target="pp-toggles"></button><button id="crt2">CRT 2</button></div>
|
||||
</div>`;
|
||||
const stack = document.getElementById('left-panel-stack');
|
||||
const store = usePanelChromeStore(createPinia());
|
||||
const chrome = new PanelChrome({
|
||||
elements: { _leftPanelStack: stack },
|
||||
operations: { _showToast() {}, _syncCctvPanelViewport() {} },
|
||||
readHud: () => ({ visible: false, getVariant: () => null }),
|
||||
readCockpit: () => null,
|
||||
readShareLinks: () => null,
|
||||
readInitialShare: () => null,
|
||||
readScrollRestoreOwner: () => null,
|
||||
readDisplayScrollTop: () => 0,
|
||||
store,
|
||||
});
|
||||
for (const id of ['data-panel', 'pp-toggles']) {
|
||||
const panel = document.getElementById(id);
|
||||
panel.getClientRects = () =>
|
||||
panel.classList.contains('collapsed') ? [] : [{}];
|
||||
followPanelState(store, id, panel);
|
||||
}
|
||||
for (const item of document.querySelectorAll('[data-rail-item]'))
|
||||
item.getClientRects = () => [{}];
|
||||
chrome._disclosurePanelIds = new Set(['data-panel', 'pp-toggles']);
|
||||
const bindings = new DisplayBindings({
|
||||
viewer: null,
|
||||
services: { isScopeMaskEnabled: () => false, cycleDetectionMode() {} },
|
||||
elements: { _locationSearch: document.createElement('input') },
|
||||
operations: {
|
||||
_setScope() {},
|
||||
_togglePanel: (panelId) => chrome._togglePanel(panelId),
|
||||
},
|
||||
readState: () => ({}),
|
||||
claimDetection() {},
|
||||
displayStore: useDisplayStore(createPinia()),
|
||||
});
|
||||
bindings._initUI();
|
||||
t.after(() => {
|
||||
bindings.destroy();
|
||||
chrome.destroy();
|
||||
});
|
||||
|
||||
const crt2 = document.getElementById('crt2');
|
||||
crt2.focus();
|
||||
assert.equal(document.activeElement, crt2);
|
||||
crt2.dispatchEvent(new KeyboardEvent('keydown', { key: 'f', bubbles: true }));
|
||||
assert.equal(
|
||||
store.panels['data-panel']?.collapsed,
|
||||
false,
|
||||
'Data Layers opens',
|
||||
);
|
||||
const visual = document.getElementById('pp-toggles');
|
||||
assert.ok(
|
||||
visual.classList.contains('collapsed'),
|
||||
'the accordion folds Visual',
|
||||
);
|
||||
assert.ok(
|
||||
document.activeElement?.matches?.('.ui-rail [data-rail-item]'),
|
||||
`focus lands on a rail entry, not inside the hidden peer (got ${document.activeElement?.id || document.activeElement?.tagName})`,
|
||||
);
|
||||
});
|
||||
|
||||
test('opening Data Layers in Cockpit hands the focus from the folded Contact card to its toggle', (t) => {
|
||||
document.body.innerHTML = `
|
||||
<div id="left-panel-stack">
|
||||
<div id="data-panel" data-panel-id="data-panel" class="active collapsed"><button class="panel-collapse-btn" data-collapse-target="data-panel"></button></div>
|
||||
</div>
|
||||
<aside id="cockpit-context"><button id="cockpit-context-toggle"></button><button id="cockpit-weather-toggle"></button></aside>`;
|
||||
const store = usePanelChromeStore(createPinia());
|
||||
const cockpit = {
|
||||
active: true,
|
||||
contextCollapsed: false,
|
||||
setContextCollapsed(collapsed) {
|
||||
this.contextCollapsed = collapsed;
|
||||
},
|
||||
setSignalCollapsed() {},
|
||||
scheduleContextLayout() {},
|
||||
};
|
||||
const chrome = new PanelChrome({
|
||||
elements: { _leftPanelStack: document.getElementById('left-panel-stack') },
|
||||
operations: { _showToast() {}, _syncCctvPanelViewport() {} },
|
||||
readHud: () => ({ visible: false, getVariant: () => null }),
|
||||
readCockpit: () => cockpit,
|
||||
readShareLinks: () => null,
|
||||
readInitialShare: () => null,
|
||||
readScrollRestoreOwner: () => null,
|
||||
readDisplayScrollTop: () => 0,
|
||||
store,
|
||||
});
|
||||
t.after(() => chrome.destroy());
|
||||
followPanelState(store, 'data-panel', document.getElementById('data-panel'));
|
||||
chrome._disclosurePanelIds = new Set(['data-panel']);
|
||||
document.getElementById('cockpit-weather-toggle').focus();
|
||||
chrome._togglePanel('data-panel');
|
||||
assert.equal(
|
||||
store.panels['data-panel']?.collapsed,
|
||||
false,
|
||||
'Data Layers opens',
|
||||
);
|
||||
assert.equal(cockpit.contextCollapsed, true, 'Contact folds for it');
|
||||
assert.equal(document.activeElement?.id, 'cockpit-context-toggle');
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
import PanelRailView from './PanelRailView.vue';
|
||||
import { PANEL_RAIL_HOST_CLASS, PANEL_RAIL_ITEMS } from './panelRailCatalog.js';
|
||||
import { PANEL_RAIL_HOST_CLASS } from './panelRailCatalog.js';
|
||||
import { usePanelStore } from './stores/panels.js';
|
||||
|
||||
/**
|
||||
@@ -71,7 +71,6 @@ export class PanelNavigation {
|
||||
? [...stack.children]
|
||||
.filter((panel) => panel.matches('[data-panel-id]'))
|
||||
.map((panel) => {
|
||||
const shownBy = PANEL_RAIL_ITEMS[panel.id]?.shownBy;
|
||||
return {
|
||||
id: panel.id,
|
||||
title:
|
||||
@@ -79,9 +78,7 @@ export class PanelNavigation {
|
||||
.querySelector('.panel-title, .pp-header-label')
|
||||
?.textContent.trim() || panel.id,
|
||||
open: !panel.classList.contains('collapsed'),
|
||||
available:
|
||||
!panel.hidden &&
|
||||
(!shownBy || panel.classList.contains(shownBy)),
|
||||
available: !panel.hidden,
|
||||
};
|
||||
})
|
||||
: [];
|
||||
|
||||
@@ -22,8 +22,6 @@ function panel(id, { collapsed = true, hidden = false, title = '' } = {}) {
|
||||
element.className = collapsed
|
||||
? 'panel-collapsible collapsed'
|
||||
: 'panel-collapsible';
|
||||
// Data Layers shows only while `active` (the `f` shortcut toggles it).
|
||||
if (id === 'data-panel') element.classList.add('active');
|
||||
element.hidden = hidden;
|
||||
if (title) element.innerHTML = `<span class="panel-title">${title}</span>`;
|
||||
return element;
|
||||
@@ -132,8 +130,8 @@ test('the rails follow disclosure and availability changes', async () => {
|
||||
['global-context-panel', 'false'],
|
||||
['host-panel', 'false'],
|
||||
]);
|
||||
// `f` hides Data Layers outright, so the rail stops offering it.
|
||||
document.getElementById('data-panel').classList.remove('active');
|
||||
// A hidden panel leaves its rail.
|
||||
document.getElementById('data-panel').hidden = true;
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
await nextTick();
|
||||
assert.deepEqual(railItems(left), [['scene-panel', 'true']]);
|
||||
|
||||
@@ -7,16 +7,11 @@ export const PANEL_RAIL_HOST_CLASS = 'gev-panel-rail';
|
||||
export const PANEL_RAIL_FALLBACK_ICON = 'more_horiz';
|
||||
|
||||
/**
|
||||
* How each side panel appears on its rail. Labels are the panels' own titles.
|
||||
* `shownBy` names a class the panel needs to be shown at all (`f` toggles
|
||||
* Data Layers' `active`). `context` is the label's translation context.
|
||||
* How each side panel appears on its rail. Labels are the panels' own titles;
|
||||
* `context` is the label's translation context.
|
||||
*/
|
||||
export const PANEL_RAIL_ITEMS = Object.freeze({
|
||||
'data-panel': {
|
||||
icon: 'layers',
|
||||
label: msg('DATA LAYERS'),
|
||||
shownBy: 'active',
|
||||
},
|
||||
'data-panel': { icon: 'layers', label: msg('DATA LAYERS') },
|
||||
'utilities-panel': { icon: 'handyman', label: msg('UTILITIES') },
|
||||
'scene-panel': { icon: 'movie', label: msg('AUTHORING') },
|
||||
// `context` keeps the panel's name apart from the satellite class of the
|
||||
|
||||
+133
-163
@@ -1,3 +1,4 @@
|
||||
import { h, render as renderVue } from 'vue';
|
||||
import { fromDegrees } from '../geo/ellipsoid.js';
|
||||
import { horizonFrom } from '../geo/horizon.js';
|
||||
import { distance } from '../geo/vector.js';
|
||||
@@ -8,6 +9,7 @@ import {
|
||||
findQuery,
|
||||
} from '../render/rendererOf.js';
|
||||
import { t } from '../i18n/index.js';
|
||||
import QuebecCctvOverlay from './views/panels/QuebecCctvOverlay.vue';
|
||||
|
||||
function isQuebecCamera(camera) {
|
||||
return String(camera?.sourceKind || '').startsWith('quebec-');
|
||||
@@ -77,72 +79,77 @@ function mediaRefreshUrl(value) {
|
||||
* Attach the active Québec source to a floating browser player and map
|
||||
* preview. The browser contacts Québec 511 only after the viewer presses Play
|
||||
* for that camera; selecting it (by click, auto-hop, a scene or voice) only
|
||||
* shows its details and the play control.
|
||||
* shows its details and the play control. The panel and marker are the
|
||||
* `QuebecCctvOverlay` view, rendered synchronously on each change.
|
||||
*/
|
||||
export function createQuebecCctvOverlay(viewer) {
|
||||
if (!viewer || typeof document === 'undefined') return null;
|
||||
|
||||
const controller = new AbortController();
|
||||
const { signal } = controller;
|
||||
const panel = document.createElement('section');
|
||||
panel.className = 'qci-panel';
|
||||
panel.hidden = true;
|
||||
panel.setAttribute('role', 'region');
|
||||
panel.setAttribute('aria-label', t('CCTV camera'));
|
||||
|
||||
const header = document.createElement('header');
|
||||
header.className = 'qci-header';
|
||||
const title = document.createElement('strong');
|
||||
const close = document.createElement('button');
|
||||
close.type = 'button';
|
||||
close.textContent = '×';
|
||||
close.setAttribute('aria-label', t('Close camera preview'));
|
||||
header.append(title, close);
|
||||
|
||||
const coordinates = document.createElement('p');
|
||||
coordinates.className = 'qci-coordinates';
|
||||
const credit = document.createElement('p');
|
||||
credit.className = 'qci-credit';
|
||||
const live = document.createElement('video');
|
||||
live.className = 'qci-live';
|
||||
live.controls = true;
|
||||
live.muted = true;
|
||||
live.autoplay = true;
|
||||
live.loop = true;
|
||||
live.playsInline = true;
|
||||
live.setAttribute('aria-label', t('CCTV camera'));
|
||||
|
||||
const actions = document.createElement('div');
|
||||
actions.className = 'qci-actions';
|
||||
const play = document.createElement('button');
|
||||
play.type = 'button';
|
||||
play.className = 'qci-play';
|
||||
play.textContent = t('Play');
|
||||
const refresh = document.createElement('button');
|
||||
refresh.type = 'button';
|
||||
refresh.textContent = t('Refresh map still');
|
||||
actions.append(play, refresh);
|
||||
const note = document.createElement('p');
|
||||
note.className = 'qci-note';
|
||||
const sourceLink = document.createElement('a');
|
||||
sourceLink.target = '_blank';
|
||||
sourceLink.rel = 'noopener noreferrer';
|
||||
sourceLink.textContent = t("Open this image on the provider's site");
|
||||
panel.append(header, coordinates, credit, live, actions, note, sourceLink);
|
||||
|
||||
const marker = document.createElement('div');
|
||||
marker.className = 'qci-marker';
|
||||
marker.hidden = true;
|
||||
const still = document.createElement('video');
|
||||
still.className = 'qci-marker-still';
|
||||
still.muted = true;
|
||||
still.playsInline = true;
|
||||
still.preload = 'none';
|
||||
still.setAttribute('aria-hidden', 'true');
|
||||
const markerLabel = document.createElement('span');
|
||||
markerLabel.className = 'qci-marker-label';
|
||||
marker.append(still, markerLabel);
|
||||
document.body.append(panel, marker);
|
||||
// What the view renders. The owner writes it where it used to write the
|
||||
// elements, then paints; the view never binds the media sources, the
|
||||
// panel's dragged position or the marker's per-frame visibility and place.
|
||||
const view = {
|
||||
panelHidden: true,
|
||||
title: '',
|
||||
coordinates: '',
|
||||
credit: '',
|
||||
creditHidden: false,
|
||||
liveHidden: false,
|
||||
actionsHidden: false,
|
||||
playHidden: false,
|
||||
refreshHidden: false,
|
||||
note: '',
|
||||
noteHidden: false,
|
||||
sourceHref: null,
|
||||
sourceHidden: false,
|
||||
markerLinkOnly: false,
|
||||
stillHidden: false,
|
||||
markerLabel: '',
|
||||
};
|
||||
const host = document.createElement('div');
|
||||
let disposed = false;
|
||||
const handlers = {
|
||||
onClose: closeWindow,
|
||||
onPlay: startPlayback,
|
||||
onRefresh: refreshStill,
|
||||
onKeydown(event) {
|
||||
if (event.key === 'Escape') close.click();
|
||||
},
|
||||
onHeaderPointerdown: startDrag,
|
||||
onLiveError: markLiveUnavailable,
|
||||
onLiveLoadeddata() {
|
||||
liveUnavailable = false;
|
||||
view.note = t(
|
||||
'The map still uses a separate request and may show a different moment.',
|
||||
);
|
||||
view.noteHidden = false;
|
||||
paint();
|
||||
},
|
||||
onStillError: markStillUnavailable,
|
||||
onStillLoadeddata() {
|
||||
stillUnavailable = false;
|
||||
if (selected)
|
||||
view.markerLabel = markerLabelText(selected, Boolean(selectedMediaUrl));
|
||||
paint();
|
||||
still.pause();
|
||||
},
|
||||
};
|
||||
/** Render the view now: the panel and marker go to the end of the body. */
|
||||
function paint() {
|
||||
if (disposed) return null;
|
||||
const vnode = h(QuebecCctvOverlay, { view: { ...view }, ...handlers });
|
||||
renderVue(vnode, host);
|
||||
return vnode.component.exposed;
|
||||
}
|
||||
const elements = paint();
|
||||
const panel = elements.panel.value;
|
||||
const header = elements.header.value;
|
||||
const close = elements.close.value.$el;
|
||||
const live = elements.live.value;
|
||||
const marker = elements.marker.value;
|
||||
const still = elements.still.value;
|
||||
|
||||
let selected = null;
|
||||
let selectedPosition = null;
|
||||
@@ -166,13 +173,15 @@ export function createQuebecCctvOverlay(viewer) {
|
||||
|
||||
function markLiveUnavailable() {
|
||||
liveUnavailable = true;
|
||||
note.textContent = t('Source unavailable');
|
||||
note.hidden = false;
|
||||
view.note = t('Source unavailable');
|
||||
view.noteHidden = false;
|
||||
paint();
|
||||
}
|
||||
|
||||
function markStillUnavailable() {
|
||||
stillUnavailable = true;
|
||||
markerLabel.textContent = t('Source unavailable');
|
||||
view.markerLabel = t('Source unavailable');
|
||||
paint();
|
||||
}
|
||||
|
||||
function startRender() {
|
||||
@@ -218,16 +227,17 @@ export function createQuebecCctvOverlay(viewer) {
|
||||
playingCameraId = selected.id;
|
||||
liveUnavailable = false;
|
||||
stillUnavailable = false;
|
||||
play.hidden = true;
|
||||
refresh.hidden = false;
|
||||
live.hidden = false;
|
||||
still.hidden = false;
|
||||
marker.classList.remove('qci-marker-link-only');
|
||||
note.textContent = t(
|
||||
view.playHidden = true;
|
||||
view.refreshHidden = false;
|
||||
view.liveHidden = false;
|
||||
view.stillHidden = false;
|
||||
view.markerLinkOnly = false;
|
||||
view.note = t(
|
||||
'The map still uses a separate request and may show a different moment.',
|
||||
);
|
||||
note.hidden = false;
|
||||
markerLabel.textContent = markerLabelText(selected, true);
|
||||
view.noteHidden = false;
|
||||
view.markerLabel = markerLabelText(selected, true);
|
||||
paint();
|
||||
setMedia(live, selectedMediaUrl);
|
||||
setMedia(still, selectedMediaUrl);
|
||||
void live.play().catch(onPlayFailure(markLiveUnavailable));
|
||||
@@ -246,7 +256,8 @@ export function createQuebecCctvOverlay(viewer) {
|
||||
stillUnavailable = false;
|
||||
stopMediaRefresh();
|
||||
stopRender();
|
||||
panel.hidden = true;
|
||||
view.panelHidden = true;
|
||||
paint();
|
||||
marker.hidden = true;
|
||||
setMedia(live, '');
|
||||
setMedia(still, '');
|
||||
@@ -263,7 +274,8 @@ export function createQuebecCctvOverlay(viewer) {
|
||||
Number(camera.elevationM) || 10,
|
||||
);
|
||||
if (closedWindowCameraId === camera.id && !reselected) {
|
||||
panel.hidden = true;
|
||||
view.panelHidden = true;
|
||||
paint();
|
||||
updateMarker();
|
||||
return;
|
||||
}
|
||||
@@ -276,8 +288,8 @@ export function createQuebecCctvOverlay(viewer) {
|
||||
playingCameraId = null;
|
||||
}
|
||||
const playing = Boolean(mediaUrl) && playingCameraId === camera.id;
|
||||
title.textContent = camera.name || t('CCTV camera');
|
||||
coordinates.textContent = [
|
||||
view.title = camera.name || t('CCTV camera');
|
||||
view.coordinates = [
|
||||
`${Number(camera.lat).toFixed(5)}, ${Number(camera.lon).toFixed(5)}`,
|
||||
Number.isFinite(camera.accuracyM) && camera.accuracyM > 0
|
||||
? `±${Math.round(camera.accuracyM)} m`
|
||||
@@ -286,14 +298,13 @@ export function createQuebecCctvOverlay(viewer) {
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' · ');
|
||||
credit.textContent = camera.credit || camera.provider || '';
|
||||
credit.hidden = !credit.textContent;
|
||||
live.hidden = !playing;
|
||||
play.hidden = !mediaUrl || playing;
|
||||
refresh.hidden = !playing;
|
||||
actions.hidden = !mediaUrl;
|
||||
note.hidden = !mediaUrl;
|
||||
note.textContent = mediaUrl
|
||||
view.credit = camera.credit || camera.provider || '';
|
||||
view.creditHidden = !view.credit;
|
||||
view.liveHidden = !playing;
|
||||
view.playHidden = !mediaUrl || playing;
|
||||
view.refreshHidden = !playing;
|
||||
view.actionsHidden = !mediaUrl;
|
||||
view.note = mediaUrl
|
||||
? !playing
|
||||
? t('Video plays from Québec 511, which sees your IP address.')
|
||||
: liveUnavailable
|
||||
@@ -304,15 +315,16 @@ export function createQuebecCctvOverlay(viewer) {
|
||||
: sourceUrl
|
||||
? ''
|
||||
: t('Source unavailable');
|
||||
note.hidden = !note.textContent;
|
||||
sourceLink.href = sourceUrl || '#';
|
||||
sourceLink.hidden = !sourceUrl;
|
||||
markerLabel.textContent = stillUnavailable
|
||||
view.noteHidden = !view.note;
|
||||
view.sourceHref = sourceUrl || '#';
|
||||
view.sourceHidden = !sourceUrl;
|
||||
view.markerLabel = stillUnavailable
|
||||
? t('Source unavailable')
|
||||
: markerLabelText(camera, playing);
|
||||
marker.classList.toggle('qci-marker-link-only', !playing);
|
||||
still.hidden = !playing;
|
||||
panel.hidden = false;
|
||||
view.markerLinkOnly = !playing;
|
||||
view.stillHidden = !playing;
|
||||
view.panelHidden = false;
|
||||
paint();
|
||||
|
||||
if (changed || mediaUrl !== selectedMediaUrl) {
|
||||
selectedMediaUrl = mediaUrl;
|
||||
@@ -366,34 +378,6 @@ export function createQuebecCctvOverlay(viewer) {
|
||||
);
|
||||
}
|
||||
|
||||
still.addEventListener(
|
||||
'loadeddata',
|
||||
() => {
|
||||
stillUnavailable = false;
|
||||
if (selected)
|
||||
markerLabel.textContent = markerLabelText(
|
||||
selected,
|
||||
Boolean(selectedMediaUrl),
|
||||
);
|
||||
still.pause();
|
||||
},
|
||||
{ signal },
|
||||
);
|
||||
still.addEventListener('error', markStillUnavailable, { signal });
|
||||
live.addEventListener('error', markLiveUnavailable, { signal });
|
||||
live.addEventListener(
|
||||
'loadeddata',
|
||||
() => {
|
||||
liveUnavailable = false;
|
||||
note.textContent = t(
|
||||
'The map still uses a separate request and may show a different moment.',
|
||||
);
|
||||
note.hidden = false;
|
||||
},
|
||||
{ signal },
|
||||
);
|
||||
refresh.addEventListener('click', refreshStill, { signal });
|
||||
play.addEventListener('click', startPlayback, { signal });
|
||||
const resetCanvasRect = () => {
|
||||
canvasRect = null;
|
||||
};
|
||||
@@ -403,49 +387,35 @@ export function createQuebecCctvOverlay(viewer) {
|
||||
capture: true,
|
||||
passive: true,
|
||||
});
|
||||
panel.addEventListener(
|
||||
'keydown',
|
||||
(event) => {
|
||||
if (event.key === 'Escape') close.click();
|
||||
},
|
||||
{ signal },
|
||||
);
|
||||
close.addEventListener(
|
||||
'click',
|
||||
() => {
|
||||
closedWindowCameraId = selected?.id || null;
|
||||
panel.hidden = true;
|
||||
live.pause();
|
||||
stopMediaRefresh();
|
||||
// The floating player closes independently; keep the paused map still.
|
||||
updateMarker();
|
||||
},
|
||||
{ signal },
|
||||
);
|
||||
header.addEventListener(
|
||||
'pointerdown',
|
||||
(event) => {
|
||||
if (event.target.closest('button')) return;
|
||||
const rect = panel.getBoundingClientRect();
|
||||
const offsetX = event.clientX - rect.left;
|
||||
const offsetY = event.clientY - rect.top;
|
||||
header.setPointerCapture(event.pointerId);
|
||||
const move = (moveEvent) => {
|
||||
panel.style.left = `${Math.max(0, Math.min(window.innerWidth - panel.offsetWidth, moveEvent.clientX - offsetX))}px`;
|
||||
panel.style.top = `${Math.max(0, Math.min(window.innerHeight - panel.offsetHeight, moveEvent.clientY - offsetY))}px`;
|
||||
panel.style.right = 'auto';
|
||||
};
|
||||
const stop = () => {
|
||||
header.removeEventListener('pointermove', move);
|
||||
header.removeEventListener('pointerup', stop);
|
||||
header.removeEventListener('pointercancel', stop);
|
||||
};
|
||||
header.addEventListener('pointermove', move, { signal });
|
||||
header.addEventListener('pointerup', stop, { once: true, signal });
|
||||
header.addEventListener('pointercancel', stop, { once: true, signal });
|
||||
},
|
||||
{ signal },
|
||||
);
|
||||
function closeWindow() {
|
||||
closedWindowCameraId = selected?.id || null;
|
||||
view.panelHidden = true;
|
||||
paint();
|
||||
live.pause();
|
||||
stopMediaRefresh();
|
||||
// The floating player closes independently; keep the paused map still.
|
||||
updateMarker();
|
||||
}
|
||||
function startDrag(event) {
|
||||
if (event.target.closest('button')) return;
|
||||
const rect = panel.getBoundingClientRect();
|
||||
const offsetX = event.clientX - rect.left;
|
||||
const offsetY = event.clientY - rect.top;
|
||||
header.setPointerCapture(event.pointerId);
|
||||
const move = (moveEvent) => {
|
||||
panel.style.left = `${Math.max(0, Math.min(window.innerWidth - panel.offsetWidth, moveEvent.clientX - offsetX))}px`;
|
||||
panel.style.top = `${Math.max(0, Math.min(window.innerHeight - panel.offsetHeight, moveEvent.clientY - offsetY))}px`;
|
||||
panel.style.right = 'auto';
|
||||
};
|
||||
const stop = () => {
|
||||
header.removeEventListener('pointermove', move);
|
||||
header.removeEventListener('pointerup', stop);
|
||||
header.removeEventListener('pointercancel', stop);
|
||||
};
|
||||
header.addEventListener('pointermove', move, { signal });
|
||||
header.addEventListener('pointerup', stop, { once: true, signal });
|
||||
header.addEventListener('pointercancel', stop, { once: true, signal });
|
||||
}
|
||||
document.addEventListener(
|
||||
'visibilitychange',
|
||||
() => {
|
||||
@@ -469,8 +439,8 @@ export function createQuebecCctvOverlay(viewer) {
|
||||
stopRender();
|
||||
setMedia(live, '');
|
||||
setMedia(still, '');
|
||||
panel.remove();
|
||||
marker.remove();
|
||||
disposed = true;
|
||||
renderVue(null, host);
|
||||
selected = null;
|
||||
selectedPosition = null;
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import '../testSupport/registerDom.mjs';
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { Window } from 'happy-dom';
|
||||
import { fromDegrees } from '../geo/ellipsoid.js';
|
||||
import { bindFakeDraw } from '../testSupport/fakeDrawPort.mjs';
|
||||
import { fakeCameraPort } from '../testSupport/fakeCameraPort.mjs';
|
||||
@@ -22,23 +22,36 @@ const CAMERA = Object.freeze({
|
||||
});
|
||||
|
||||
/**
|
||||
* Mount the overlay in a happy-dom window with recorded media loads, timers
|
||||
* and postRender listeners. `play` decides what each play() returns.
|
||||
* Mount the overlay in the registered happy-dom window (Vue binds the
|
||||
* document it loads with) with recorded media loads, timers and postRender
|
||||
* listeners. `play` decides what each play() returns.
|
||||
*/
|
||||
function mountOverlay(t, { play = () => Promise.resolve() } = {}) {
|
||||
const window = new Window({ url: 'http://localhost:4173/' });
|
||||
const previousWindow = globalThis.window;
|
||||
const previousDocument = globalThis.document;
|
||||
globalThis.window = window;
|
||||
globalThis.document = window.document;
|
||||
const { window } = globalThis;
|
||||
const media = window.HTMLMediaElement.prototype;
|
||||
const previous = {
|
||||
load: media.load,
|
||||
play: media.play,
|
||||
pause: media.pause,
|
||||
setInterval: window.setInterval,
|
||||
clearInterval: window.clearInterval,
|
||||
};
|
||||
t.after(() => {
|
||||
media.load = previous.load;
|
||||
media.play = previous.play;
|
||||
media.pause = previous.pause;
|
||||
window.setInterval = previous.setInterval;
|
||||
window.clearInterval = previous.clearInterval;
|
||||
delete window.document.hidden;
|
||||
});
|
||||
const loads = [];
|
||||
window.HTMLMediaElement.prototype.load = function () {
|
||||
media.load = function () {
|
||||
if (this.getAttribute('src')) loads.push(this.getAttribute('src'));
|
||||
};
|
||||
window.HTMLMediaElement.prototype.play = function () {
|
||||
media.play = function () {
|
||||
return play(this);
|
||||
};
|
||||
window.HTMLMediaElement.prototype.pause = function () {};
|
||||
media.pause = function () {};
|
||||
const intervals = new Map();
|
||||
let nextTimer = 1;
|
||||
window.setInterval = (fn) => {
|
||||
@@ -65,12 +78,7 @@ function mountOverlay(t, { play = () => Promise.resolve() } = {}) {
|
||||
});
|
||||
t.after(unbind);
|
||||
const overlay = createQuebecCctvOverlay(viewer);
|
||||
t.after(() => {
|
||||
overlay?.dispose();
|
||||
globalThis.window = previousWindow;
|
||||
globalThis.document = previousDocument;
|
||||
window.close();
|
||||
});
|
||||
t.after(() => overlay?.dispose());
|
||||
const [live, still] = window.document.querySelectorAll('video');
|
||||
return {
|
||||
window,
|
||||
@@ -203,3 +211,21 @@ test('the refresh timer reloads with a cache-buster, skips hidden tabs, and stop
|
||||
assert.equal(ui.renderListeners.size, 0);
|
||||
assert.equal(ui.window.document.querySelector('.qci-panel') === null, true);
|
||||
});
|
||||
|
||||
test('Escape in the window closes it and stops the refresh until the camera is picked again', (t) => {
|
||||
const ui = mountOverlay(t);
|
||||
ui.overlay.setCamera(CAMERA);
|
||||
ui.playButton().click();
|
||||
const panel = ui.window.document.querySelector('.qci-panel');
|
||||
panel.dispatchEvent(
|
||||
new ui.window.KeyboardEvent('keydown', { key: 'Escape', bubbles: true }),
|
||||
);
|
||||
assert.equal(panel.hidden, true);
|
||||
assert.equal(ui.intervals.size, 0);
|
||||
|
||||
ui.overlay.setCamera({ ...CAMERA });
|
||||
assert.equal(panel.hidden, true, 'a routine update keeps it closed');
|
||||
ui.overlay.setCamera({ ...CAMERA }, { reselected: true });
|
||||
assert.equal(panel.hidden, false, 'picking the camera again reopens it');
|
||||
assert.equal(ui.intervals.size, 1);
|
||||
});
|
||||
+33
-23
@@ -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 || []"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
@@ -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
|
||||
>
|
||||
|
||||
@@ -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
|
||||
>
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -417,9 +417,10 @@ export class ShareRestoration {
|
||||
this._layerStateRestorePromise = this._layerStateCoordinator.start({
|
||||
shareLayerState: this._initialShareState?.layerState || null,
|
||||
shareCreatedAtMs: this._initialShareState?.sharedAtMs ?? null,
|
||||
// Any valid camera/style share isolates recipient-local preferences,
|
||||
// including legacy and malformed-v2 layer payloads.
|
||||
allowLocalState: !this._initialShareState,
|
||||
// A link restores what it carries; a bare address is a clean start
|
||||
// with the default layers. Saved layer choices never come back on
|
||||
// their own, so clearing the address always resets the view.
|
||||
allowLocalState: false,
|
||||
});
|
||||
if (this._initialShareSelectionSuperseded) {
|
||||
this._layerStateCoordinator.cancelPendingShareTracking(
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
/* Core's close, dismiss and clear buttons draw a bare glyph: no padding,
|
||||
* border or background of their own, and a pointer. The kit's
|
||||
* UiCloseButton wears it as .ui-close-button; the guide's close button,
|
||||
* built in script, shares the rule. It selects one class and loads before
|
||||
* the feature stylesheets, so each feature rule still sets its size, colour,
|
||||
* hover and any surface (a border, a chip, a tinted square). */
|
||||
* UiCloseButton wears it as .ui-close-button, and the guide's close (a
|
||||
* UiCloseButton too) shares the rule by its feature class. It selects one
|
||||
* class and loads before the feature stylesheets, so each feature rule still
|
||||
* sets its size, colour, hover and any surface (a border, a chip, a tinted
|
||||
* square). */
|
||||
.ui-close-button,
|
||||
.gev-guide-close {
|
||||
padding: 0;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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>
|
||||
@@ -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>🔎</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>
|
||||
|
||||
@@ -17,6 +17,7 @@ import ViewContext from './panels/ViewContext.vue';
|
||||
import SpaceMissionsPanel from './panels/SpaceMissionsPanel.vue';
|
||||
import RadioPanel from './panels/RadioPanel.vue';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
import UiIcon from '../kit/UiIcon.vue';
|
||||
import UiSearchField from '../kit/UiSearchField.vue';
|
||||
import { cockpitEntryFace } from '../cockpitPresentation.js';
|
||||
import { LAYER_TABS, TAB_AFFECTS, activeTab, availableTabs, contextReady, enabledLayerIds, setEnabledLayers, tabTarget } from '../contextLayerTabs.js';
|
||||
@@ -182,27 +183,27 @@ watch(
|
||||
</RailPanel>
|
||||
<RailPanel id="global-context-panel" start-collapsed v-class-toggle="{ ...(ctx && { 'context-enabled': ctx.enabled }) }" :data-context-mode="ctx?.mode" :data-context-tab="activeTab" :title="t('CONTEXT')" sideways scroll rail-scroller>
|
||||
<template #actions>
|
||||
<button type="button" class="context-dock-btn" :aria-pressed="String(contextSearchOpen)" :aria-label="contextSearchOpen ? t('Close Context search') : t('Search in Context')" :title="contextSearchOpen ? t('Close search') : t('Search in Context')" @click="toggleSearch">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">search</span>
|
||||
</button>
|
||||
<button type="button" class="context-dock-btn" :aria-pressed="String(docked)" :aria-label="docked ? t('Shrink Context back to a panel') : t('Expand Context to a full-height column')" :title="docked ? t('Shrink') : t('Expand')" @click="setDocked(!docked)">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ docked ? 'close_fullscreen' : 'open_in_full' }}</span>
|
||||
</button>
|
||||
<UiButton class="context-dock-btn" :pressed="Boolean(contextSearchOpen)" :aria-label="contextSearchOpen ? t('Close Context search') : t('Search in Context')" :title="contextSearchOpen ? t('Close search') : t('Search in Context')" @click="toggleSearch">
|
||||
<UiIcon name="search" :size="null" />
|
||||
</UiButton>
|
||||
<UiButton class="context-dock-btn" :pressed="docked" :aria-label="docked ? t('Shrink Context back to a panel') : t('Expand Context to a full-height column')" :title="docked ? t('Shrink') : t('Expand')" @click="setDocked(!docked)">
|
||||
<UiIcon :name="docked ? 'close_fullscreen' : 'open_in_full'" :size="null" />
|
||||
</UiButton>
|
||||
</template>
|
||||
<div class="cyber-panel-body ui-scroll" data-rail-scroller>
|
||||
<UiSearchField v-if="contextSearchOpen" ref="searchInput" v-model="contextSearchText" class="context-search" role="search" input-class="context-search__input" :label="searchHint" :placeholder="searchHint" autocomplete="off" spellcheck="false" :clear-label="t('Clear search')" clear-class="context-search__clear" @escape="closeContextSearch" />
|
||||
<div v-if="availableTabs.length" class="context-tabs" role="tablist" :aria-label="t('Context tabs')">
|
||||
<button id="context-tab-btn-view" type="button" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'view' }" :aria-selected="String(activeTab === 'view')" aria-controls="context-tab-view" :tabindex="activeTab === 'view' ? 0 : -1" @click="activeTab = 'view'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">visibility</span><span class="context-tabs__label">{{ t('Inspector') }}</span>
|
||||
</button>
|
||||
<button id="context-tab-btn-props" type="button" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'props' }" :aria-selected="String(activeTab === 'props')" aria-controls="context-tab-props" :tabindex="activeTab === 'props' ? 0 : -1" @click="activeTab = 'props'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">tune</span><span class="context-tabs__label">{{ t('Properties') }}</span>
|
||||
</button>
|
||||
<UiButton id="context-tab-btn-view" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'view' }" :aria-selected="String(activeTab === 'view')" aria-controls="context-tab-view" :tabindex="activeTab === 'view' ? 0 : -1" @click="activeTab = 'view'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
|
||||
<UiIcon name="visibility" :size="null" /><span class="context-tabs__label">{{ t('Inspector') }}</span>
|
||||
</UiButton>
|
||||
<UiButton id="context-tab-btn-props" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'props' }" :aria-selected="String(activeTab === 'props')" aria-controls="context-tab-props" :tabindex="activeTab === 'props' ? 0 : -1" @click="activeTab = 'props'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
|
||||
<UiIcon name="tune" :size="null" /><span class="context-tabs__label">{{ t('Properties') }}</span>
|
||||
</UiButton>
|
||||
</div>
|
||||
<!-- Properties: settings of the layers that are on, one section each. -->
|
||||
<div id="context-tab-props" class="context-props" :hidden="activeTab !== 'props'" role="tabpanel" aria-labelledby="context-tab-btn-props">
|
||||
<section v-for="tab in LAYER_TABS" v-show="isShown(tab.id)" :key="tab.id" class="context-props__section">
|
||||
<h4 class="context-props__heading"><span class="material-symbols-outlined" aria-hidden="true">{{ tab.icon }}</span>{{ t(tab.label) }}</h4>
|
||||
<h4 class="context-props__heading"><UiIcon :name="tab.icon" :size="null" />{{ t(tab.label) }}</h4>
|
||||
<ul v-if="affects(tab.id).length" class="context-props__layers">
|
||||
<li v-for="layer in affects(tab.id)" :key="layer.id"><i :style="{ background: layer.color }" aria-hidden="true"></i>{{ layer.name }}</li>
|
||||
</ul>
|
||||
@@ -211,10 +212,10 @@ watch(
|
||||
</div>
|
||||
<RadioPanel />
|
||||
<div class="global-context-modes" role="tablist" :aria-label="t('Context mode')">
|
||||
<button id="global-context-flights-btn" class="context-mode-button" v-class-toggle="{ active: ctx?.flightsActive }" type="button" role="tab" tabindex="0" :aria-selected="String(ctx?.flightsActive ?? false)" :aria-disabled="ctx && String(ctx.busy)" :aria-busy="ctx && String(ctx.busy)" aria-controls="context-flights-view" :aria-label="t('CONTACTS')" :title="t('Cycles the nearest contacts of whatever type you select — planes, vessels, installations. Satellites track independently.')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">radar</span>
|
||||
<UiButton id="global-context-flights-btn" class="context-mode-button" v-class-toggle="{ active: ctx?.flightsActive }" role="tab" tabindex="0" :aria-selected="String(ctx?.flightsActive ?? false)" :aria-disabled="ctx && String(ctx.busy)" :aria-busy="ctx && String(ctx.busy)" aria-controls="context-flights-view" :aria-label="t('CONTACTS')" :title="t('Cycles the nearest contacts of whatever type you select — planes, vessels, installations. Satellites track independently.')">
|
||||
<UiIcon name="radar" :size="null" />
|
||||
<span>{{ t('CONTACTS') }}</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
</div>
|
||||
<div id="context-mode-standby" class="context-mode-standby" :hidden="ctx?.enabled">
|
||||
<strong>{{ t('SELECT CONTEXT') }}</strong>
|
||||
@@ -222,11 +223,11 @@ watch(
|
||||
</div>
|
||||
<section id="context-flights-view" class="context-mode-view" role="tabpanel" aria-labelledby="global-context-flights-btn" :hidden="!ctx?.flightsActive">
|
||||
<div class="global-context-actions" :aria-label="t('Contact Context actions')">
|
||||
<button id="cockpit-entry" type="button" :hidden="!cockpit?.entryAvailable">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ entry.icon }}</span>
|
||||
<UiButton id="cockpit-entry" :hidden="!cockpit?.entryAvailable">
|
||||
<UiIcon :name="entry.icon" :size="null" />
|
||||
<span>{{ entry.label }}</span>
|
||||
</button>
|
||||
<button id="installations-search-btn" class="panel-layer-toggle" type="button" :aria-disabled="ctx && String(ctx.installationsBusy)" :aria-busy="ctx && String(ctx.installationsBusy)">{{ t('SEARCH NEARBY SITES') }}</button>
|
||||
</UiButton>
|
||||
<UiButton id="installations-search-btn" class="panel-layer-toggle" :aria-disabled="ctx && String(ctx.installationsBusy)" :aria-busy="ctx && String(ctx.installationsBusy)">{{ t('SEARCH NEARBY SITES') }}</UiButton>
|
||||
<UiButton id="tr3b-toggle" class="tr3b-toggle" :pressed="!!cockpit?.tr3b?.converted" :hidden="!cockpit?.tr3b" :aria-label="t('Reclassify tracked contact as TR-3B')" :title="cockpit?.tr3b?.converted ? t('Restore real aircraft') : t('Reclassify as TR-3B')">🛸</UiButton>
|
||||
</div>
|
||||
<AwarenessPanel v-if="!contactsMatchCard" />
|
||||
|
||||
@@ -2,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>
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
entryPlacement,
|
||||
} from '../../stories/format.js';
|
||||
import { guardStoriesKeyboard } from '../../stories/keyboard.js';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
|
||||
// The screens, their styles and the story data load with Stories (see
|
||||
// src/stories/boot.js); only the button, popup and toast load with GEV.
|
||||
@@ -318,18 +319,17 @@ watch([mode, storyId], () => nextTick(watchCredit));
|
||||
|
||||
<!-- GEV: the Stories entry, its first-visit popup and the Opened-in-GEV toast -->
|
||||
<template v-if="mode === 'closed' && store.available">
|
||||
<button
|
||||
<UiButton
|
||||
id="hStories"
|
||||
class="tbtn accent gs-entry"
|
||||
:class="{ 'gs-entry-compact': entry.compact }"
|
||||
type="button"
|
||||
:aria-label="entry.compact ? t('Stories') : undefined"
|
||||
:style="{ top: `${entry.top}px`, right: `${entry.right}px` }"
|
||||
@click="openExplore"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="3" /><path d="M10 9.5v5l4.5-2.5z" fill="currentColor" /></svg>
|
||||
<span>{{ t('Stories') }}</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
<div
|
||||
v-if="popOpen"
|
||||
id="hPop"
|
||||
@@ -342,14 +342,14 @@ watch([mode, storyId], () => nextTick(watchCredit));
|
||||
<h2 id="hPopT">{{ t('GEV Stories') }}</h2>
|
||||
<p>{{ t('Curated, interactive views of what is happening on Earth. Play one, take over the map whenever you like, then pick the story back up.') }}</p>
|
||||
<div class="row">
|
||||
<button class="tbtn solid" type="button" @click="openExplore">{{ t('Browse stories') }}</button>
|
||||
<button class="tbtn" type="button" @click="markPopSeen">{{ t('Not now') }}</button>
|
||||
<UiButton class="tbtn solid" @click="openExplore">{{ t('Browse stories') }}</UiButton>
|
||||
<UiButton class="tbtn" @click="markPopSeen">{{ t('Not now') }}</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="openedToast" id="hToast" class="h-toast glass gs-opened-toast" role="status">
|
||||
<b>{{ t('Opened in GEV') }}</b>
|
||||
<span>{{ openedToast.title }} · {{ openedWhen }}</span>
|
||||
<button class="tbtn" type="button" @click="backToStory">{{ t('Back to story') }}</button>
|
||||
<UiButton class="tbtn" @click="backToStory">{{ t('Back to story') }}</UiButton>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@ import { storeToRefs } from 'pinia';
|
||||
import { nextTick, ref, watch } from 'vue';
|
||||
import { msg, t } from '../../i18n/index.js';
|
||||
import { FIRST_RUN_LINKS, environmentalLabel } from '../../firstRunCopy.js';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
import UiCheckbox from '../kit/UiCheckbox.vue';
|
||||
import UiIcon from '../kit/UiIcon.vue';
|
||||
import { useFirstRunStore } from '../stores/firstRun.js';
|
||||
import { useStoriesStore } from '../stores/stories.js';
|
||||
|
||||
@@ -165,10 +167,10 @@ function onSuppress(event) {
|
||||
<!-- A button, not just a hint: phones and tablets have no ESC key. It
|
||||
closes exactly as ESC does, for this session only. Touch screens
|
||||
see SKIP; a keyboard sees SKIP · ESC (first-run.css). -->
|
||||
<button type="button" class="first-run-dismiss" data-first-run-dismiss @click="controls?.dismiss()">
|
||||
<UiButton class="first-run-dismiss" data-first-run-dismiss @click="controls?.dismiss()">
|
||||
<span class="first-run-dismiss-key">{{ t('SKIP · ESC') }}</span>
|
||||
<span class="first-run-dismiss-touch">{{ t('SKIP') }}</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
</header>
|
||||
<h2 id="first-run-title">{{ t(TITLES[step - 1]) }}</h2>
|
||||
<p class="first-run-step-announcement" role="status" aria-live="polite" aria-atomic="true">{{ t(TITLES[step - 1]) }}</p>
|
||||
@@ -207,22 +209,22 @@ function onSuppress(event) {
|
||||
<section class="first-run-section" aria-labelledby="first-run-start-heading">
|
||||
<h3 id="first-run-start-heading" class="first-run-section-title">{{ t('Start with') }}</h3>
|
||||
<div class="first-run-missions first-run-missions--tiles" role="group" aria-labelledby="first-run-start-heading">
|
||||
<button type="button" data-first-run-start="space-missions" :aria-pressed="String(start === 'space-missions')" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('space-missions')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">rocket_launch</span>
|
||||
<UiButton data-first-run-start="space-missions" :pressed="start === 'space-missions'" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('space-missions')">
|
||||
<UiIcon name="rocket_launch" :size="null" />
|
||||
<span><strong>{{ t('SPACE MISSIONS') }}</strong><small>{{ t('Launches, spacecraft and orbital context') }}</small></span>
|
||||
</button>
|
||||
<button type="button" data-first-run-start="environmental" :aria-pressed="String(start === 'environmental')" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('environmental')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">local_fire_department</span>
|
||||
</UiButton>
|
||||
<UiButton data-first-run-start="environmental" :pressed="start === 'environmental'" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('environmental')">
|
||||
<UiIcon name="local_fire_department" :size="null" />
|
||||
<!-- The title is ENVIRONMENTAL_LABEL_CHOICE's label once initialized. -->
|
||||
<!-- Subcopy names BOTH feeds this tile turns on, because the launcher
|
||||
optimizes for the fully configured experience (owner ruling,
|
||||
2026-08-23) — see the mission table in src/firstRunExperience.js. -->
|
||||
<span><strong data-first-run-environmental-title>{{ launcher?.environmentalTitle ?? environmentalLabel().title }}</strong><small>{{ launcher?.environmentalSub ?? t(ENVIRONMENTAL_SUB) }}</small></span>
|
||||
</button>
|
||||
<button type="button" data-first-run-start="explore" :aria-pressed="String(start === 'explore')" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('explore')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">public</span>
|
||||
</UiButton>
|
||||
<UiButton data-first-run-start="explore" :pressed="start === 'explore'" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('explore')">
|
||||
<UiIcon name="public" :size="null" />
|
||||
<span><strong>{{ t('EXPLORE MANUALLY') }}</strong><small>{{ t('Begin with a clean globe') }}</small></span>
|
||||
</button>
|
||||
</UiButton>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -230,17 +232,17 @@ function onSuppress(event) {
|
||||
<div v-else key="3" class="first-run-step">
|
||||
<ul class="first-run-tips">
|
||||
<li class="first-run-tip first-run-tip--search">
|
||||
<span class="first-run-tip-art" aria-hidden="true"><span class="material-symbols-outlined">search</span><i class="first-run-tip-caret"></i></span>
|
||||
<span class="first-run-tip-art" aria-hidden="true"><UiIcon name="search" :size="null" /><i class="first-run-tip-caret"></i></span>
|
||||
<strong>{{ t('Search places') }}</strong>
|
||||
<small>{{ t('Type a place into the search bar.') }}</small>
|
||||
</li>
|
||||
<li class="first-run-tip first-run-tip--layers">
|
||||
<span class="first-run-tip-art" aria-hidden="true"><span class="material-symbols-outlined">layers</span><i class="first-run-tip-dot"></i></span>
|
||||
<span class="first-run-tip-art" aria-hidden="true"><UiIcon name="layers" :size="null" /><i class="first-run-tip-dot"></i></span>
|
||||
<strong>{{ t('Turn on layers') }}</strong>
|
||||
<small>{{ t('Turn layers on to see flights, ships, cameras, weather and more.') }}</small>
|
||||
</li>
|
||||
<li class="first-run-tip first-run-tip--context">
|
||||
<span class="first-run-tip-art" aria-hidden="true"><span class="material-symbols-outlined">my_location</span><i class="first-run-tip-ring"></i></span>
|
||||
<span class="first-run-tip-art" aria-hidden="true"><UiIcon name="my_location" :size="null" /><i class="first-run-tip-ring"></i></span>
|
||||
<strong>{{ t('Click anything') }}</strong>
|
||||
<small>{{ t('Select a map item to see its details.') }}</small>
|
||||
</li>
|
||||
@@ -248,12 +250,12 @@ function onSuppress(event) {
|
||||
<section class="first-run-section" aria-labelledby="first-run-deeper-heading">
|
||||
<h3 id="first-run-deeper-heading" class="first-run-section-title">{{ t('Go deeper') }}</h3>
|
||||
<div v-if="stories.available" class="first-run-link-card first-run-stories">
|
||||
<div class="first-run-preview first-run-preview--stories" aria-hidden="true"><span class="material-symbols-outlined">movie</span></div>
|
||||
<div class="first-run-preview first-run-preview--stories" aria-hidden="true"><UiIcon name="movie" :size="null" /></div>
|
||||
<div class="first-run-link-body">
|
||||
<p class="first-run-mode-title"><strong translate="no">GEV Stories</strong> <span class="first-run-tag">{{ t('NEW') }}</span></p>
|
||||
<p class="first-run-mode-copy">{{ t('Curated, interactive views of what is happening on Earth. Play one, take over the map whenever you like, then pick the story back up.') }}</p>
|
||||
</div>
|
||||
<button type="button" class="first-run-link-button" data-first-run-stories :aria-disabled="String(settling || launcher?.busy === 'true')" @click="openStories">{{ t('BROWSE STORIES') }}</button>
|
||||
<UiButton class="first-run-link-button" data-first-run-stories :aria-disabled="String(settling || launcher?.busy === 'true')" @click="openStories">{{ t('BROWSE STORIES') }}</UiButton>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -304,10 +306,10 @@ function onSuppress(event) {
|
||||
<p class="first-run-note" data-first-run-status role="status" aria-live="polite">{{ launcher?.status ?? '' }}</p>
|
||||
<!-- The card's main action: God mode, starting where the selected tile
|
||||
says (a clean globe by default). -->
|
||||
<button v-if="step > 1" type="button" class="first-run-back" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="go(step - 1, $event)">{{ t('BACK') }}</button>
|
||||
<button type="button" class="first-run-enter" :data-first-run-choice="step === STEPS ? start : undefined" :data-first-run-next="step < STEPS ? '' : undefined" data-first-run-primary aria-describedby="first-run-title first-run-description" @pointerdown="onPrimaryDown" @keydown.enter="onPrimaryKeydown" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="onPrimary">
|
||||
{{ step < STEPS ? t('NEXT') : t('ENTER GOD MODE') }} <span class="material-symbols-outlined" aria-hidden="true">arrow_forward</span>
|
||||
</button>
|
||||
<UiButton v-if="step > 1" class="first-run-back" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="go(step - 1, $event)">{{ t('BACK') }}</UiButton>
|
||||
<UiButton class="first-run-enter" :data-first-run-choice="step === STEPS ? start : undefined" :data-first-run-next="step < STEPS ? '' : undefined" data-first-run-primary aria-describedby="first-run-title first-run-description" @pointerdown="onPrimaryDown" @keydown.enter="onPrimaryKeydown" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="onPrimary">
|
||||
{{ step < STEPS ? t('NEXT') : t('ENTER GOD MODE') }} <UiIcon name="arrow_forward" :size="null" />
|
||||
</UiButton>
|
||||
</div>
|
||||
|
||||
</aside>
|
||||
|
||||
@@ -4,7 +4,9 @@ import { storeToRefs } from 'pinia';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { useCctvStore } from '../../stores/cctv.js';
|
||||
import { usePanelChromeStore } from '../../stores/panelChrome.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiCloseButton from '../../kit/UiCloseButton.vue';
|
||||
import UiIcon from '../../kit/UiIcon.vue';
|
||||
|
||||
// A selected camera's card: a thumbnail of its latest frame, a few facts,
|
||||
// and a button that opens the full CCTV panel. The frame and facts come from
|
||||
@@ -68,15 +70,15 @@ function openPanel() {
|
||||
<img v-if="src" :src="src" :alt="name || t('Camera frame')" />
|
||||
<span v-else>{{ t('Acquiring frame…') }}</span>
|
||||
<span v-if="sourceBadge?.label" class="cctv-preview__badge">{{ sourceBadge.label }}</span>
|
||||
<button v-if="src" type="button" class="cctv-preview__expand" :aria-label="t('Show a bigger view')" :title="t('Show a bigger view')" @click="big = true">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">open_in_full</span>
|
||||
</button>
|
||||
<UiButton v-if="src" class="cctv-preview__expand" :label="t('Show a bigger view')" @click="big = true">
|
||||
<UiIcon name="open_in_full" :size="null" />
|
||||
</UiButton>
|
||||
</div>
|
||||
<Teleport to="body">
|
||||
<div v-if="big" class="cctv-popup" role="dialog" :aria-label="name || t('Camera view')" @click.self="big = false">
|
||||
<figure class="cctv-popup__card">
|
||||
<header class="cctv-popup__head">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">videocam</span>
|
||||
<UiIcon name="videocam" :size="null" />
|
||||
<strong>{{ name || t('Camera view') }}</strong>
|
||||
<span v-if="sourceBadge?.label" class="cctv-popup__badge">{{ sourceBadge.label }}</span>
|
||||
<UiCloseButton class="cctv-popup__close" glyph="icon" :label="t('Close')" @click="big = false" />
|
||||
@@ -94,8 +96,8 @@ function openPanel() {
|
||||
<dd>{{ fact.value }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<button type="button" class="entity-card__action cctv-preview__more" @click="openPanel">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">videocam</span>{{ t('More info') }}
|
||||
</button>
|
||||
<UiButton class="entity-card__action cctv-preview__more" @click="openPanel">
|
||||
<UiIcon name="videocam" :size="null" />{{ t('More info') }}
|
||||
</UiButton>
|
||||
</section>
|
||||
</template>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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,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>
|
||||
@@ -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>
|
||||
|
||||
@@ -12,6 +12,7 @@ import UiSlider from '../../kit/UiSlider.js';
|
||||
import { useDisplayStore } from '../../stores/display.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiCheckbox from '../../kit/UiCheckbox.vue';
|
||||
import UiIcon from '../../kit/UiIcon.vue';
|
||||
import UiSelect from '../../kit/UiSelect.js';
|
||||
import { StyleParameterRows } from '../../styleParameters.js';
|
||||
import VisualPresets from './VisualPresets.vue';
|
||||
@@ -85,10 +86,10 @@ const allocationOptions = computed(() => [
|
||||
<p class="pp-section-heading">{{ t('Overlay') }}</p>
|
||||
<Teleport :to="cockpitPortal?.hud ?? 'body'" :disabled="!cockpitPortal?.hud">
|
||||
<div class="pp-toggle-group">
|
||||
<button class="pp-toggle-btn" :class="{ active: hud?.visible }" :aria-pressed="String(Boolean(hud?.visible))" id="hud-toggle" @click="act('toggleHud')" :title="t('Intelligence HUD (H)')">
|
||||
<UiButton class="pp-toggle-btn" :pressed="Boolean(hud?.visible)" pressed-class="active" id="hud-toggle" @click="act('toggleHud')" :title="t('Intelligence HUD (H)')">
|
||||
<span class="pp-icon">◎</span>
|
||||
<span class="pp-label" translate="no">HUD</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
<div class="pp-slider-row" :class="{ visible: hud?.visible }" id="hud-layout-row">
|
||||
<span class="pp-slider-mini-label">{{ t('Layout') }}</span>
|
||||
<UiSelect id="hud-layout-select" class="pp-select gev-field gev-field--compact" :model-value="hud?.variant ?? 'tactical'" @update:model-value="act('setHudLayout', $event)" :aria-label="t('HUD layout')">
|
||||
@@ -184,7 +185,7 @@ const allocationOptions = computed(() => [
|
||||
</Teleport>
|
||||
<div class="pp-toggle-group">
|
||||
<UiCheckbox class="pp-toggle-btn pp-scope-toggle" :title="t('Scope — the circular viewport mask')" input-id="scope-toggle" trailing :model-value="scopeOn" @update:model-value="act('setScopeEnabled', $event)">
|
||||
<span class="pp-icon material-symbols-outlined" aria-hidden="true">adjust</span>
|
||||
<UiIcon class="pp-icon" name="adjust" :size="null" />
|
||||
<span class="pp-label">{{ t('Scope') }}</span>
|
||||
</UiCheckbox>
|
||||
<div class="pp-slider-row visible" id="scope-slider-row">
|
||||
@@ -198,21 +199,21 @@ const allocationOptions = computed(() => [
|
||||
<span class="pp-slider-value" id="scope-opacity-value">{{ pct(scopeOpacity) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<button class="pp-toggle-btn" id="clean-view-toggle" @click="act('toggleCleanView')" :title="t('Hide UI chrome')">
|
||||
<UiButton class="pp-toggle-btn" id="clean-view-toggle" @click="act('toggleCleanView')" :title="t('Hide UI chrome')">
|
||||
<span class="pp-icon">□</span>
|
||||
<span class="pp-label">{{ t('Clean UI') }}</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
<p class="pp-section-heading">{{ t('Effects') }}</p>
|
||||
<div class="pp-toggle-group">
|
||||
<UiButton class="pp-toggle-btn" :pressed="celestial?.active ?? false" pressed-class="active" id="celestial-toggle" @click="act('toggleCelestial')" :title="celestialTitle" :disabled="celestial ? !celestial.supported : undefined" :aria-disabled="celestial ? String(!celestial.supported) : undefined">
|
||||
<span class="pp-icon material-symbols-outlined" aria-hidden="true">flare</span>
|
||||
<UiIcon class="pp-icon" name="flare" :size="null" />
|
||||
<span class="pp-label">{{ t('Celestial') }}</span>
|
||||
</UiButton>
|
||||
</div>
|
||||
<!-- Sky: only where the renderer has a sky to set. -->
|
||||
<div v-if="sky" class="pp-toggle-group" id="sky-group">
|
||||
<UiCheckbox v-for="row in skyRows" :key="row.key" class="pp-toggle-btn pp-scope-toggle" :id="`sky-${row.key}-row`" :input-id="`sky-${row.key}-toggle`" trailing :model-value="sky.switches[row.key]" @update:model-value="act('setSkySwitch', row.key, $event)">
|
||||
<span class="pp-icon material-symbols-outlined" aria-hidden="true">{{ row.icon }}</span>
|
||||
<UiIcon class="pp-icon" :name="row.icon" :size="null" />
|
||||
<span class="pp-label">{{ row.label }}</span>
|
||||
</UiCheckbox>
|
||||
<div class="pp-slider-row visible" id="sky-milkyway-row">
|
||||
@@ -225,7 +226,7 @@ const allocationOptions = computed(() => [
|
||||
<div v-for="group in groups" :key="group.id" class="pp-toggle-group" :id="`${group.id}-group`">
|
||||
<template v-for="row in group.rows" :key="row.id">
|
||||
<UiCheckbox v-if="row.kind === 'toggle'" class="pp-toggle-btn pp-scope-toggle" :title="row.title" :input-id="`${group.id}-${row.id}-toggle`" trailing :model-value="row.checked" @update:model-value="row.onChange?.($event)">
|
||||
<span v-if="row.icon" class="pp-icon material-symbols-outlined" aria-hidden="true">{{ row.icon }}</span>
|
||||
<UiIcon v-if="row.icon" class="pp-icon" :name="row.icon" :size="null" />
|
||||
<span class="pp-label">{{ row.label }}</span>
|
||||
</UiCheckbox>
|
||||
<div v-else-if="row.kind === 'note'" class="pp-slider-row visible" :id="`${group.id}-${row.id}`">
|
||||
@@ -239,28 +240,28 @@ const allocationOptions = computed(() => [
|
||||
</template>
|
||||
</div>
|
||||
<div class="pp-toggle-group">
|
||||
<button class="pp-toggle-btn" :class="{ active: view?.bloom.active }" :aria-pressed="String(Boolean(view?.bloom.active))" id="bloom-toggle" @click="act('toggleBloom')" :title="t('Bloom / Glow')">
|
||||
<UiButton class="pp-toggle-btn" :pressed="Boolean(view?.bloom.active)" pressed-class="active" id="bloom-toggle" @click="act('toggleBloom')" :title="t('Bloom / Glow')">
|
||||
<span class="pp-icon">✨</span>
|
||||
<span class="pp-label">{{ t('Bloom') }}</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
<div class="pp-slider-row" :class="{ visible: view?.bloom.active }" id="bloom-slider-row">
|
||||
<UiSlider class="pp-slider" id="bloom-intensity-slider" @update:model-value="act('setBloomIntensity', $event)" min="0" max="200" :model-value="view?.bloom.intensity ?? 0" :aria-label="t('Bloom intensity')" />
|
||||
<span class="pp-slider-value" id="bloom-intensity-value">{{ pct(view?.bloom.intensity ?? 0) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pp-toggle-group">
|
||||
<button class="pp-toggle-btn" :class="{ active: view?.sharpen.active }" :aria-pressed="String(Boolean(view?.sharpen.active))" id="sharpen-toggle" @click="act('toggleSharpen')" :title="t('Sharpening')">
|
||||
<UiButton class="pp-toggle-btn" :pressed="Boolean(view?.sharpen.active)" pressed-class="active" id="sharpen-toggle" @click="act('toggleSharpen')" :title="t('Sharpening')">
|
||||
<span class="pp-icon">🔍</span>
|
||||
<span class="pp-label">{{ t('Sharpen') }}</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
<div class="pp-slider-row" :class="{ visible: view?.sharpen.active }" id="sharpen-slider-row">
|
||||
<UiSlider class="pp-slider" id="sharpen-intensity-slider" @update:model-value="act('setSharpenIntensity', $event)" min="0" max="100" :model-value="view?.sharpen.intensity ?? 49" :aria-label="t('Sharpen intensity')" />
|
||||
<span class="pp-slider-value" id="sharpen-intensity-value">{{ pct(view?.sharpen.intensity ?? 49) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="pp-reset-btn" :title="t('Reset Visual to its defaults: Normal look, HUD, scope, labels and effects')" @click="act('resetVisual')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">restart_alt</span>{{ t('Reset to default') }}
|
||||
</button>
|
||||
<UiButton class="pp-reset-btn" :title="t('Reset Visual to its defaults: Normal look, HUD, scope, labels and effects')" @click="act('resetVisual')">
|
||||
<UiIcon name="restart_alt" :size="null" />{{ t('Reset to default') }}
|
||||
</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiIcon from '../../kit/UiIcon.vue';
|
||||
import UiSegmented from '../../kit/UiSegmented.vue';
|
||||
import { useDisplayStore } from '../../stores/display.js';
|
||||
import DrawMarkList from './DrawMarkList.vue';
|
||||
@@ -27,7 +28,7 @@ const shapeOptions = computed(() => [
|
||||
<template>
|
||||
<div class="pp-toggle-group" id="draw-group">
|
||||
<UiButton class="pp-toggle-btn" :pressed="draw?.active ?? false" pressed-class="active" id="draw-toggle" @click="act('toggleDraw')" :title="t('Draw on the world — click vertices, double-click or Enter to finish, Esc to cancel')">
|
||||
<span class="pp-icon material-symbols-outlined" aria-hidden="true">draw</span>
|
||||
<UiIcon class="pp-icon" name="draw" :size="null" />
|
||||
<span class="pp-label">{{ t('Draw') }}</span>
|
||||
</UiButton>
|
||||
<div class="pp-slider-row" :class="{ visible: draw?.active }" id="draw-mode-row">
|
||||
@@ -36,7 +37,7 @@ const shapeOptions = computed(() => [
|
||||
</div>
|
||||
<div class="pp-slider-row" :class="{ visible: draw?.active }" id="draw-label-row">
|
||||
<span class="draw-hint" id="draw-hint" aria-live="polite">{{ draw?.hint ?? '' }}</span>
|
||||
<button class="pp-mode-btn draw-clear-btn" id="draw-clear" type="button" @click="act('clearDraw')" :title="t('Remove every mark from the board')">{{ t('Clear') }}</button>
|
||||
<UiButton class="pp-mode-btn draw-clear-btn" id="draw-clear" @click="act('clearDraw')" :title="t('Remove every mark from the board')">{{ t('Clear') }}</UiButton>
|
||||
</div>
|
||||
<DrawMarkList />
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,9 @@ import { DRAW_COLOR_CSS } from '../../../annotations/drawMarks.js';
|
||||
import { vFieldValue } from '../../rail/fieldValue.js';
|
||||
import { vFocusSafeChildren } from '../../rail/focusSafeChildren.js';
|
||||
import DrawSwatches from './DrawSwatches.vue';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiCloseButton from '../../kit/UiCloseButton.vue';
|
||||
import UiIcon from '../../kit/UiIcon.vue';
|
||||
import { useDisplayStore } from '../../stores/display.js';
|
||||
|
||||
// UTILITIES ▸ Draw's shapes, one row each like Import's files: the colour
|
||||
@@ -100,5 +102,5 @@ function leave() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ul class="geo-import-list draw-mark-list" :class="{ visible: listed }" id="draw-mark-list" v-focus-safe-children="leave" :aria-label="t('Drawn shapes')"><li v-for="row in rows" :key="row.id" class="geo-import-row draw-mark-row" :class="{ 'hidden-mark': row.hidden }" :data-mark-id="row.id" @keydown="onRowKey(row, $event)"><button type="button" class="geo-import-swatch draw-mark-swatch" data-control="swatch" :style="{ background: DRAW_COLOR_CSS[row.color] }" :title="row.labels.swatch" :aria-label="row.labels.swatch" :aria-expanded="String(picking === row.id)" :aria-controls="`draw-mark-colors-${row.id}`" @click="picking = picking === row.id ? null : row.id"></button><DrawSwatches v-if="picking === row.id" :id="`draw-mark-colors-${row.id}`" class="draw-mark-colors" data-control="picker" autofocus :label="row.labels.colors" :model-value="row.color" @update:model-value="recolor(row, $event)" @choose="closePicker(row.id)" /><input type="text" class="geo-import-name draw-mark-name" data-control="name" maxlength="120" autocomplete="off" spellcheck="false" v-field-value="row.name" :placeholder="row.placeholder" :aria-label="row.labels.name" @keydown="onNameKey(row, $event)" @focusout="commit(row, $event.currentTarget)"><button type="button" class="geo-import-action" data-control="toggle" :title="row.labels.toggle" :aria-label="row.labels.toggle" @click="display.act('toggleDrawMark', row.id)"><span class="material-symbols-outlined" aria-hidden="true">{{ row.hidden ? 'visibility_off' : 'visibility' }}</span></button><button v-for="action in row.actions" :key="action.id" type="button" class="geo-import-action draw-mark-action" :data-control="`action-${action.id}`" :data-action="action.id" :title="action.label" :aria-label="action.label" :aria-disabled="String(row.busy)" @click="display.act('runDrawMarkAction', row.id, action.id)"><span class="material-symbols-outlined" aria-hidden="true">{{ action.icon }}</span></button><button type="button" class="geo-import-action" data-control="fly" :title="row.labels.fly" :aria-label="row.labels.fly" @click="display.act('flyToDrawMark', row.id)"><span class="material-symbols-outlined" aria-hidden="true">my_location</span></button><UiCloseButton class="geo-import-action" glyph="icon" data-control="remove" :title="row.labels.remove" :label="row.labels.remove" @click="display.act('removeDrawMark', row.id)" /><span v-if="row.actions.length" class="draw-mark-note" role="status" :aria-busy="String(row.busy)">{{ row.busy ? '…' : row.note }}</span></li></ul>
|
||||
<ul class="geo-import-list draw-mark-list" :class="{ visible: listed }" id="draw-mark-list" v-focus-safe-children="leave" :aria-label="t('Drawn shapes')"><li v-for="row in rows" :key="row.id" class="geo-import-row draw-mark-row" :class="{ 'hidden-mark': row.hidden }" :data-mark-id="row.id" @keydown="onRowKey(row, $event)"><UiButton class="geo-import-swatch draw-mark-swatch" data-control="swatch" :style="{ background: DRAW_COLOR_CSS[row.color] }" :label="row.labels.swatch" :aria-expanded="String(picking === row.id)" :aria-controls="`draw-mark-colors-${row.id}`" @click="picking = picking === row.id ? null : row.id" /><DrawSwatches v-if="picking === row.id" :id="`draw-mark-colors-${row.id}`" class="draw-mark-colors" data-control="picker" autofocus :label="row.labels.colors" :model-value="row.color" @update:model-value="recolor(row, $event)" @choose="closePicker(row.id)" /><input type="text" class="geo-import-name draw-mark-name" data-control="name" maxlength="120" autocomplete="off" spellcheck="false" v-field-value="row.name" :placeholder="row.placeholder" :aria-label="row.labels.name" @keydown="onNameKey(row, $event)" @focusout="commit(row, $event.currentTarget)"><UiButton class="geo-import-action" data-control="toggle" :label="row.labels.toggle" @click="display.act('toggleDrawMark', row.id)"><UiIcon :name="row.hidden ? 'visibility_off' : 'visibility'" :size="null" /></UiButton><UiButton v-for="action in row.actions" :key="action.id" class="geo-import-action draw-mark-action" :data-control="`action-${action.id}`" :data-action="action.id" :label="action.label" :aria-disabled="String(row.busy)" @click="display.act('runDrawMarkAction', row.id, action.id)"><UiIcon :name="action.icon" :size="null" /></UiButton><UiButton class="geo-import-action" data-control="fly" :label="row.labels.fly" @click="display.act('flyToDrawMark', row.id)"><UiIcon name="my_location" :size="null" /></UiButton><UiCloseButton class="geo-import-action" glyph="icon" data-control="remove" :title="row.labels.remove" :label="row.labels.remove" @click="display.act('removeDrawMark', row.id)" /><span v-if="row.actions.length" class="draw-mark-note" role="status" :aria-busy="String(row.busy)">{{ row.busy ? '…' : row.note }}</span></li></ul>
|
||||
</template>
|
||||
@@ -6,11 +6,15 @@ import {
|
||||
DRAW_COLOR_CSS,
|
||||
DRAW_COLOR_NAMES,
|
||||
} from '../../../annotations/drawMarks.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
|
||||
// Draw's five colours as one radio group: the next shape's colour and a
|
||||
// drawn shape's picker. Only the checked colour is a tab stop; the arrows,
|
||||
// Home and End move to and choose another, as a radio group's do. Each swatch
|
||||
// shows its colour from DRAW_COLOR_CSS, the same value the shape is drawn in.
|
||||
// The swatches are ghost UiButtons with role="radio": they say they are
|
||||
// chosen with aria-checked and their own `active` class, never aria-pressed,
|
||||
// and `buttons` keeps their elements for the arrows.
|
||||
// The template is one line: templates keep whitespace.
|
||||
const props = defineProps({
|
||||
modelValue: { type: String, default: 'primary' },
|
||||
@@ -44,5 +48,5 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="draw-colors" role="radiogroup" :aria-label="props.label" @keydown="onKey"><button v-for="(color, index) in DRAW_COLORS" :key="color" :ref="(el) => (buttons[index] = el)" type="button" class="draw-color" :class="{ active: color === props.modelValue }" role="radio" :data-color="color" :data-control="`color-${color}`" :aria-checked="String(color === props.modelValue)" :tabindex="color === props.modelValue ? 0 : -1" :style="{ background: DRAW_COLOR_CSS[color] }" :title="t(DRAW_COLOR_NAMES[color])" :aria-label="t(DRAW_COLOR_NAMES[color])" @click="emit('update:modelValue', color), emit('choose', color)"></button></div>
|
||||
<div class="draw-colors" role="radiogroup" :aria-label="props.label" @keydown="onKey"><UiButton v-for="(color, index) in DRAW_COLORS" :key="color" :ref="(swatch) => (buttons[index] = swatch?.$el)" class="draw-color" :class="{ active: color === props.modelValue }" role="radio" :data-color="color" :data-control="`color-${color}`" :aria-checked="String(color === props.modelValue)" :tabindex="color === props.modelValue ? 0 : -1" :style="{ background: DRAW_COLOR_CSS[color] }" :label="t(DRAW_COLOR_NAMES[color])" @click="emit('update:modelValue', color), emit('choose', color)" /></div>
|
||||
</template>
|
||||
@@ -10,7 +10,9 @@ import AltitudeGraph from './AltitudeGraph.vue';
|
||||
import { contextNeedle, contextSearchText, matchesContextSearch } from '../../contextSearch.js';
|
||||
import RouteGlobe from './RouteGlobe.vue';
|
||||
import CctvPreview from './CctvPreview.vue';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiCloseButton from '../../kit/UiCloseButton.vue';
|
||||
import UiIcon from '../../kit/UiIcon.vue';
|
||||
import { useCctvStore } from '../../stores/cctv.js';
|
||||
import SpotConditions from './SpotConditions.vue';
|
||||
import { shownLayerName } from '../../layerNames.js';
|
||||
@@ -365,10 +367,10 @@ watch(
|
||||
<AircraftModelHero v-if="modelKnown" :key="card.key" class="entity-hero__layer" :class="{ 'is-shown': activeFlightPreview === 'model' }" :active="activeFlightPreview === 'model'" :aircraft="card.aircraftModel" :heading="card.heading || 0" :callouts="callouts" @failed="modelFailed = true" @cycle="showOtherView" />
|
||||
<FlightCockpitView v-if="cockpitMade && cockpitKnown" :key="`cockpit-${card.key}`" class="entity-hero__layer" :class="{ 'is-shown': activeFlightPreview === 'cockpit' }" :active="activeFlightPreview === 'cockpit'" :lat="card.lat" :lon="card.lon" :altitude-m="card.altitudeM" :heading="card.heading" :speed-mps="card.speedMps" @failed="onCockpitFailed" />
|
||||
<div v-if="cockpitKnown || (routeKnown && modelKnown) || (photoAvailable && (routeKnown || modelKnown))" class="entity-card__preview-switch" role="group" :aria-label="t('Preview')">
|
||||
<button v-if="photoAvailable" type="button" :class="{ active: activeFlightPreview === 'photo' }" :aria-pressed="String(activeFlightPreview === 'photo')" :aria-label="t('Photos')" :title="t('Photos')" @click="choosePreview('photo')"><span class="material-symbols-outlined" aria-hidden="true">photo_camera</span></button>
|
||||
<button v-if="routeKnown" type="button" :class="{ active: activeFlightPreview === 'route' }" :aria-pressed="String(activeFlightPreview === 'route')" :aria-label="t('Route')" :title="t('Route')" @click="choosePreview('route')"><span class="material-symbols-outlined" aria-hidden="true">timeline</span></button>
|
||||
<button v-if="modelKnown" type="button" :class="{ active: activeFlightPreview === 'model' }" :aria-pressed="String(activeFlightPreview === 'model')" :title="t('3D model')" @click="choosePreview('model')">{{ t('3D') }}</button>
|
||||
<button v-if="cockpitKnown" type="button" :class="{ active: activeFlightPreview === 'cockpit' }" :aria-pressed="String(activeFlightPreview === 'cockpit')" :aria-label="t('Cockpit view')" :title="t('Cockpit view')" @click="choosePreview('cockpit')"><span class="material-symbols-outlined" aria-hidden="true">visibility</span></button>
|
||||
<UiButton v-if="photoAvailable" :pressed="activeFlightPreview === 'photo'" pressed-class="active" :label="t('Photos')" @click="choosePreview('photo')"><UiIcon name="photo_camera" :size="null" /></UiButton>
|
||||
<UiButton v-if="routeKnown" :pressed="activeFlightPreview === 'route'" pressed-class="active" :label="t('Route')" @click="choosePreview('route')"><UiIcon name="timeline" :size="null" /></UiButton>
|
||||
<UiButton v-if="modelKnown" :pressed="activeFlightPreview === 'model'" pressed-class="active" :title="t('3D model')" @click="choosePreview('model')">{{ t('3D') }}</UiButton>
|
||||
<UiButton v-if="cockpitKnown" :pressed="activeFlightPreview === 'cockpit'" pressed-class="active" :label="t('Cockpit view')" @click="choosePreview('cockpit')"><UiIcon name="visibility" :size="null" /></UiButton>
|
||||
</div>
|
||||
</template>
|
||||
<a v-else-if="heroKind === 'photo'" :key="photo.src" class="entity-hero__layer entity-hero__photo is-shown" :href="photo.link || undefined" target="_blank" rel="noopener">
|
||||
@@ -379,7 +381,7 @@ watch(
|
||||
<CctvPreview v-else-if="heroKind === 'camera'" :camera-id="card.identity?.id || ''" />
|
||||
<!-- No imagery for it yet: its icon, with its headline figures beside it. -->
|
||||
<div v-else class="entity-hero__placeholder" :class="{ 'entity-hero__placeholder--bare': props.withContacts || !tiles.length }">
|
||||
<span class="material-symbols-outlined entity-hero__glyph" aria-hidden="true">{{ card.icon }}</span>
|
||||
<UiIcon class="entity-hero__glyph" :name="card.icon" :size="null" />
|
||||
<div v-if="!props.withContacts && tiles.length" class="entity-hero__figures">
|
||||
<div v-for="fact in tiles" :key="fact.field" class="entity-hero__figure">
|
||||
<strong>{{ factFigure(fact).number }}<small v-if="factFigure(fact).unit">{{ factFigure(fact).unit }}</small></strong>
|
||||
@@ -391,7 +393,7 @@ watch(
|
||||
</div>
|
||||
|
||||
<header class="entity-card__head">
|
||||
<span class="material-symbols-outlined entity-card__icon" aria-hidden="true">{{ card.icon }}</span>
|
||||
<UiIcon class="entity-card__icon" :name="card.icon" :size="null" />
|
||||
<div class="entity-card__name">
|
||||
<span class="entity-card__kind">{{ kindLine }}</span>
|
||||
<h3 class="entity-card__title">{{ shownTitle }}</h3>
|
||||
@@ -406,14 +408,14 @@ watch(
|
||||
</div>
|
||||
|
||||
<div v-if="card.warnings?.length" class="entity-card__warning" role="alert">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">warning</span>
|
||||
<UiIcon name="warning" :size="null" />
|
||||
<span>{{ card.warnings.map((warning, index) => sayWords(card.warningWords?.[index], warning)).join(' · ') }}</span>
|
||||
</div>
|
||||
|
||||
<div v-if="card.route" class="entity-card__route" :class="{ 'entity-card__route--unverified': !card.route.verified, 'entity-card__route--progress': routeProgress }">
|
||||
<strong>{{ card.route.from }}</strong>
|
||||
<span class="entity-card__route-line" :style="routeProgress ? { '--route-share': `${(routeProgress.share * 100).toFixed(1)}%` } : null" aria-hidden="true">
|
||||
<span class="material-symbols-outlined">flight</span>
|
||||
<UiIcon name="flight" :size="null" />
|
||||
</span>
|
||||
<strong>{{ card.route.to }}</strong>
|
||||
</div>
|
||||
@@ -435,7 +437,7 @@ watch(
|
||||
class="entity-card__route-note"
|
||||
:title="t('The scheduled route for this flight number does not match where the plane is; it may be another leg of the same flight.')"
|
||||
>
|
||||
<span class="material-symbols-outlined" aria-hidden="true">warning</span>{{ t('Scheduled · unverified: does not match where the plane is') }}
|
||||
<UiIcon name="warning" :size="null" />{{ t('Scheduled · unverified: does not match where the plane is') }}
|
||||
</p>
|
||||
|
||||
<div v-if="!props.withContacts && tiles.length && heroKind !== 'none' && !contextNeedle" class="entity-card__tiles" :style="{ gridTemplateColumns: `repeat(${tiles.length}, minmax(0, 1fr))` }">
|
||||
@@ -462,20 +464,21 @@ watch(
|
||||
|
||||
<div class="entity-card__actions">
|
||||
<!-- On an aircraft or a satellite, Cockpit leads: it is the action people come for. -->
|
||||
<button v-if="store.canCockpit()" type="button" class="entity-card__action entity-card__action--primary" data-entity-cockpit-entry @click="store.cockpit()">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ card.layerId === 'satellites' ? 'satellite_alt' : 'flight' }}</span>{{ card.layerId === 'satellites' ? t('Enter orbital view') : t('Enter Cockpit') }}
|
||||
</button>
|
||||
<UiButton v-if="store.canCockpit()" class="entity-card__action entity-card__action--primary" data-entity-cockpit-entry @click="store.cockpit()">
|
||||
<UiIcon :name="card.layerId === 'satellites' ? 'satellite_alt' : 'flight'" :size="null" />{{ card.layerId === 'satellites' ? t('Enter orbital view') : t('Enter Cockpit') }}
|
||||
</UiButton>
|
||||
<div class="entity-card__action-row">
|
||||
<button type="button" class="entity-card__action" @click="store.flyTo()">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">my_location</span>{{ t('Fly to') }}
|
||||
</button>
|
||||
<button v-if="store.canFollow()" type="button" class="entity-card__action" :class="{ 'entity-card__action--on': store.isFollowing() }" :aria-pressed="String(store.isFollowing())" @click="store.follow()">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">navigation</span>{{ store.isFollowing() ? t('Following') : t('Follow') }}
|
||||
</button>
|
||||
<UiButton class="entity-card__action" @click="store.flyTo()">
|
||||
<UiIcon name="my_location" :size="null" />{{ t('Fly to') }}
|
||||
</UiButton>
|
||||
<UiButton v-if="store.canFollow()" class="entity-card__action" :pressed="Boolean(store.isFollowing())" pressed-class="entity-card__action--on" @click="store.follow()">
|
||||
<UiIcon name="navigation" :size="null" />{{ store.isFollowing() ? t('Following') : t('Follow') }}
|
||||
</UiButton>
|
||||
</div>
|
||||
<button type="button" class="entity-card__action entity-card__action--ask" @click="store.ask()">
|
||||
<!-- The chat bubble is no Material symbol the page loads, so it stays drawn. -->
|
||||
<UiButton class="entity-card__action entity-card__action--ask" @click="store.ask()">
|
||||
<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 about {name}', { name: shownTitle }) }}
|
||||
</button>
|
||||
</UiButton>
|
||||
</div>
|
||||
|
||||
<slot />
|
||||
|
||||
@@ -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>
|
||||
@@ -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">🔗</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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -22,6 +22,8 @@ const finder = {
|
||||
<script setup>
|
||||
import { nextTick, onBeforeUnmount, onMounted, ref, watch, computed } from 'vue';
|
||||
import { msg, t } from '../../../i18n/index.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiIcon from '../../kit/UiIcon.vue';
|
||||
import UiSearchField from '../../kit/UiSearchField.vue';
|
||||
|
||||
// Search and filter for the Data Layers list. The rows are rendered elsewhere
|
||||
@@ -185,7 +187,8 @@ async function toggleFilter() {
|
||||
}
|
||||
function closeFilter({ refocus = false } = {}) {
|
||||
filtering.value = false;
|
||||
if (refocus) triggerEl.value?.focus();
|
||||
// The trigger is a UiButton; its root is the button.
|
||||
if (refocus) triggerEl.value?.$el?.focus();
|
||||
}
|
||||
function onMenuKey(event) {
|
||||
if (event.key === 'Escape') {
|
||||
@@ -223,37 +226,37 @@ if (props.part === 'buttons') {
|
||||
|
||||
<template>
|
||||
<template v-if="part === 'buttons'">
|
||||
<button id="layer-finder-search-btn" type="button" class="layer-finder__btn" :class="{ active: searching || query }" :aria-pressed="String(searching)" :aria-label="t('Search layers')" :title="t('Search layers')" @click="toggleSearch">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">search</span>
|
||||
</button>
|
||||
<UiButton id="layer-finder-search-btn" class="layer-finder__btn" :class="{ active: searching || query }" :pressed="Boolean(searching)" :aria-label="t('Search layers')" :title="t('Search layers')" @click="toggleSearch">
|
||||
<UiIcon name="search" :size="null" />
|
||||
</UiButton>
|
||||
<span ref="filterEl" class="layer-finder__filter">
|
||||
<button ref="triggerEl" type="button" class="layer-finder__btn" :class="{ active: show !== 'all' || category }" :aria-expanded="String(filtering)" aria-controls="layer-finder-menu" :aria-label="t('Filter layers')" :title="t('Filter layers')" @click="toggleFilter">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">filter_list</span>
|
||||
</button>
|
||||
<UiButton ref="triggerEl" class="layer-finder__btn" :class="{ active: show !== 'all' || category }" :aria-expanded="String(filtering)" aria-controls="layer-finder-menu" :aria-label="t('Filter layers')" :title="t('Filter layers')" @click="toggleFilter">
|
||||
<UiIcon name="filter_list" :size="null" />
|
||||
</UiButton>
|
||||
<span v-if="filtering" id="layer-finder-menu" ref="menuEl" class="layer-finder__menu" role="group" :aria-label="t('Filter layers')" @keydown="onMenuKey">
|
||||
<span role="group" :aria-label="t('Status')">
|
||||
<span class="layer-finder__menu-head" aria-hidden="true">{{ t('Status') }}</span>
|
||||
<button v-for="s in SHOWS" :key="s.id" type="button" :aria-pressed="String(show === s.id)" :class="{ active: show === s.id }" @click="show = s.id">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ show === s.id ? 'radio_button_checked' : 'radio_button_unchecked' }}</span>{{ t(s.label) }}
|
||||
</button>
|
||||
<UiButton v-for="s in SHOWS" :key="s.id" :pressed="show === s.id" pressed-class="active" @click="show = s.id">
|
||||
<UiIcon :name="show === s.id ? 'radio_button_checked' : 'radio_button_unchecked'" :size="null" />{{ t(s.label) }}
|
||||
</UiButton>
|
||||
</span>
|
||||
<span v-if="categories.length" role="group" :aria-label="t('Category')">
|
||||
<span class="layer-finder__menu-head" aria-hidden="true">{{ t('Category') }}</span>
|
||||
<button v-for="c in categories" :key="c.key" type="button" :aria-pressed="String(category === c.key)" :class="{ active: category === c.key }" @click="pickCategory(c.key)">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ category === c.key ? 'radio_button_checked' : 'radio_button_unchecked' }}</span>{{ c.label }}
|
||||
</button>
|
||||
<UiButton v-for="c in categories" :key="c.key" :pressed="category === c.key" pressed-class="active" @click="pickCategory(c.key)">
|
||||
<UiIcon :name="category === c.key ? 'radio_button_checked' : 'radio_button_unchecked'" :size="null" />{{ c.label }}
|
||||
</UiButton>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
<div v-else-if="searching || narrowed" class="layer-finder__bar">
|
||||
<UiSearchField v-if="searching" v-model="query" tag="label" class="layer-finder__field" input-id="layer-finder-input" :label="t('Search layers')" :placeholder="t('Search layers…')" @escape="(event) => { event.preventDefault(); closeSearch(); }" />
|
||||
<button v-if="show !== 'all'" type="button" class="layer-finder__chip" @click="show = 'all'">
|
||||
{{ show === 'on' ? t('On') : t('Off') }}<span class="material-symbols-outlined" aria-hidden="true">close</span>
|
||||
</button>
|
||||
<button v-if="category" type="button" class="layer-finder__chip" @click="category = ''">
|
||||
{{ categoryLabel }}<span class="material-symbols-outlined" aria-hidden="true">close</span>
|
||||
</button>
|
||||
<UiButton v-if="show !== 'all'" class="layer-finder__chip" @click="show = 'all'">
|
||||
{{ show === 'on' ? t('On') : t('Off') }}<UiIcon name="close" :size="null" />
|
||||
</UiButton>
|
||||
<UiButton v-if="category" class="layer-finder__chip" @click="category = ''">
|
||||
{{ categoryLabel }}<UiIcon name="close" :size="null" />
|
||||
</UiButton>
|
||||
<p v-if="narrowed && shown === 0" class="layer-finder__empty" role="status">{{ t('No layers match') }}</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -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>
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -72,7 +72,7 @@ watch(
|
||||
<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>
|
||||
<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">
|
||||
|
||||
@@ -16,6 +16,8 @@ import { useGlobeActionsStore } from '../../stores/globeActions.js';
|
||||
import { useLocationStore } from '../../stores/location.js';
|
||||
import { useOmnibarStore } from '../../stores/omnibar.js';
|
||||
import { useVoiceStore } from '../../stores/voice.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiIcon from '../../kit/UiIcon.vue';
|
||||
|
||||
// One field for places, layers and questions. Places run through the location
|
||||
// controls, layers through the shell's omnibar actions, and anything else can
|
||||
@@ -1028,7 +1030,7 @@ watch(
|
||||
<section id="gev-omnibar" :class="{ 'has-results': showResults }" :aria-label="t('Search')">
|
||||
<div class="omnibar-field">
|
||||
<span class="omnibar-edge" aria-hidden="true"></span>
|
||||
<span class="material-symbols-outlined omnibar-search-icon" aria-hidden="true">search</span>
|
||||
<UiIcon class="omnibar-search-icon" name="search" :size="null" />
|
||||
<input
|
||||
ref="input"
|
||||
id="gev-omnibar-input"
|
||||
@@ -1055,9 +1057,9 @@ watch(
|
||||
@blur="focused = false"
|
||||
/>
|
||||
<kbd class="omnibar-kbd" aria-hidden="true">{{ shortcut }}</kbd>
|
||||
<button type="button" class="omnibar-mic" :class="{ active: voiceOn }" :disabled="!voice.controls" :aria-pressed="String(voiceOn)" :aria-label="t('Talk to GEV')" :title="t('Talk to GEV')" @click="onMic(true)">
|
||||
<UiButton class="omnibar-mic" :pressed="voiceOn" pressed-class="active" :disabled="!voice.controls" :label="t('Talk to GEV')" @click="onMic(true)">
|
||||
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><rect x="9" y="3" width="6" height="11" rx="3" /><path d="M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21" /></svg>
|
||||
</button>
|
||||
</UiButton>
|
||||
</div>
|
||||
<div v-show="showResults" ref="results" class="omnibar-results" :class="{ 'has-feedback': showFeedback }">
|
||||
<p id="omnibar-error" v-show="showFeedback" role="alert">{{ feedback }}</p>
|
||||
@@ -1065,11 +1067,10 @@ watch(
|
||||
<li v-if="strip" class="omnibar-strip" role="group" :aria-label="strip.title">
|
||||
<span class="omnibar-strip__title" aria-hidden="true">{{ strip.title }}</span>
|
||||
<div ref="stripChips" class="omnibar-strip__chips" role="presentation" @wheel="onStripWheel">
|
||||
<button
|
||||
<UiButton
|
||||
v-for="(chip, index) in strip.chips"
|
||||
:id="`gev-omnibar-chip-${index}`"
|
||||
:key="chip.key"
|
||||
type="button"
|
||||
tabindex="-1"
|
||||
class="omnibar-strip__chip"
|
||||
:class="{ active: chip.pressed, focused: inStrip && index === chipIndex }"
|
||||
@@ -1079,8 +1080,8 @@ watch(
|
||||
@mousedown.prevent
|
||||
@click="chooseChip(chip)"
|
||||
>
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ chip.icon }}</span>{{ chip.name }}
|
||||
</button>
|
||||
<UiIcon :name="chip.icon" :size="null" />{{ chip.name }}
|
||||
</UiButton>
|
||||
</div>
|
||||
</li>
|
||||
<li
|
||||
@@ -1095,7 +1096,7 @@ watch(
|
||||
@click="choose(item)"
|
||||
@mousemove="inStrip = false"
|
||||
>
|
||||
<span v-if="item.icon" class="material-symbols-outlined omnibar-item-icon" aria-hidden="true">{{ item.icon }}</span>
|
||||
<UiIcon v-if="item.icon" class="omnibar-item-icon" :name="item.icon" :size="null" />
|
||||
<svg v-else class="omnibar-item-icon" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path d="M4 5h16v11H9l-5 4z" /></svg>
|
||||
<span class="omnibar-item-label">{{ item.label }}</span>
|
||||
<small>{{ item.hint }}</small>
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
<script setup>
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiCloseButton from '../../kit/UiCloseButton.vue';
|
||||
|
||||
// The Omnibar's guided walk: the spotlight ring and the callout beside it,
|
||||
// teleported to the end of `to` (the page's body). `startGuide()` in
|
||||
// src/ui/omnibarGuide.js owns every decision and every word: it renders this
|
||||
// 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. 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 },
|
||||
onClose: { type: Function, required: true },
|
||||
onSkip: { type: Function, required: true },
|
||||
onOffer: { type: Function, required: true },
|
||||
onNext: { type: Function, required: true },
|
||||
});
|
||||
|
||||
/** 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. -->
|
||||
<template><Teleport :to="to"
|
||||
><div class="gev-guide"
|
||||
><div class="gev-guide-ring"><i></i></div
|
||||
><div
|
||||
class="gev-guide-callout"
|
||||
role="dialog"
|
||||
aria-modal="false"
|
||||
tabindex="-1"
|
||||
aria-labelledby="gev-guide-title"
|
||||
aria-describedby="gev-guide-text"
|
||||
><div class="gev-guide-head"
|
||||
><p id="gev-guide-title" class="gev-guide-title">{{ view.title }}</p
|
||||
><p class="gev-guide-count">{{ view.count }}</p
|
||||
><UiCloseButton
|
||||
class="gev-guide-close"
|
||||
:label="view.endLabel"
|
||||
:title="view.endLabel"
|
||||
@click="onClose()" /></div
|
||||
><ol class="gev-guide-progress" aria-hidden="true"
|
||||
><li
|
||||
v-for="(name, i) in view.progress"
|
||||
:key="`${view.step}-${i}`"
|
||||
v-bind="dot(name)"></li></ol
|
||||
><div class="gev-guide-body"
|
||||
><p id="gev-guide-text" class="gev-guide-text">{{ view.text }}</p
|
||||
><p class="gev-guide-hint" :hidden="view.hintHidden"
|
||||
><span class="gev-guide-hint-dot"></span
|
||||
><span>{{ view.hint }}</span></p
|
||||
></div
|
||||
><div class="gev-guide-actions"
|
||||
><p class="gev-guide-keys" :hidden="view.keysHidden"
|
||||
><kbd>{{ view.keyCap }}</kbd><span>{{ view.keyText }}</span></p
|
||||
><span
|
||||
><UiButton
|
||||
class="gev-guide-skip"
|
||||
:hidden="view.skipHidden"
|
||||
@click="onSkip()"
|
||||
><template v-if="redrawWithView" #default>{{ view.skipLabel }}</template></UiButton
|
||||
><UiButton
|
||||
class="gev-guide-offer"
|
||||
:hidden="view.offerHidden"
|
||||
@click="onOffer()"
|
||||
><template v-if="redrawWithView" #default>{{ view.offerLabel }}</template></UiButton
|
||||
><UiButton
|
||||
class="gev-guide-next"
|
||||
:class="{ quiet: view.nextQuiet }"
|
||||
:hidden="view.nextHidden"
|
||||
@click="onNext()"
|
||||
><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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,110 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiCloseButton from '../../kit/UiCloseButton.vue';
|
||||
|
||||
// The Québec 511 camera's floating player and its map preview, teleported to
|
||||
// the end of the page. `createQuebecCctvOverlay()` owns every decision: it
|
||||
// renders this with the `view` it computes and keeps the imperative parts,
|
||||
// which the template never binds: each video's source, playback and load, the
|
||||
// panel's dragged position, and the marker's per-frame visibility and place.
|
||||
// The elements those parts need are exposed.
|
||||
defineProps({
|
||||
view: { type: Object, required: true },
|
||||
});
|
||||
const emit = defineEmits([
|
||||
'close',
|
||||
'play',
|
||||
'refresh',
|
||||
'keydown',
|
||||
'headerPointerdown',
|
||||
'liveError',
|
||||
'liveLoadeddata',
|
||||
'stillError',
|
||||
'stillLoadeddata',
|
||||
]);
|
||||
|
||||
const panel = ref(null);
|
||||
const header = ref(null);
|
||||
const close = ref(null);
|
||||
const live = ref(null);
|
||||
const marker = ref(null);
|
||||
const still = ref(null);
|
||||
defineExpose({ panel, header, close, live, marker, still });
|
||||
// Each video's load and failure go to the owner, which marks the source.
|
||||
const liveListeners = {
|
||||
error: () => emit('liveError'),
|
||||
loadeddata: () => emit('liveLoadeddata'),
|
||||
};
|
||||
const stillListeners = {
|
||||
error: () => emit('stillError'),
|
||||
loadeddata: () => emit('stillLoadeddata'),
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- Only line breaks inside tags: the markup has no whitespace between elements. -->
|
||||
<template><Teleport to="body"
|
||||
><section
|
||||
ref="panel"
|
||||
class="qci-panel"
|
||||
:hidden="view.panelHidden"
|
||||
role="region"
|
||||
:aria-label="t('CCTV camera')"
|
||||
@keydown="emit('keydown', $event)"
|
||||
><header
|
||||
ref="header"
|
||||
class="qci-header"
|
||||
@pointerdown="emit('headerPointerdown', $event)"
|
||||
><strong>{{ view.title }}</strong
|
||||
><UiCloseButton
|
||||
ref="close"
|
||||
:label="t('Close camera preview')"
|
||||
@click="emit('close')" /></header
|
||||
><p class="qci-coordinates">{{ view.coordinates }}</p
|
||||
><p class="qci-credit" :hidden="view.creditHidden">{{ view.credit }}</p
|
||||
><video
|
||||
ref="live"
|
||||
class="qci-live"
|
||||
controls
|
||||
muted
|
||||
autoplay
|
||||
loop
|
||||
playsinline
|
||||
:hidden="view.liveHidden"
|
||||
:aria-label="t('CCTV camera')"
|
||||
v-on="liveListeners"></video
|
||||
><div class="qci-actions" :hidden="view.actionsHidden"
|
||||
><UiButton
|
||||
class="qci-play"
|
||||
:hidden="view.playHidden"
|
||||
@click="emit('play')"
|
||||
>{{ t('Play') }}</UiButton
|
||||
><UiButton :hidden="view.refreshHidden" @click="emit('refresh')">{{
|
||||
t('Refresh map still')
|
||||
}}</UiButton></div
|
||||
><p class="qci-note" :hidden="view.noteHidden">{{ view.note }}</p
|
||||
><a
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
:href="view.sourceHref"
|
||||
:hidden="view.sourceHidden"
|
||||
>{{ t("Open this image on the provider's site") }}</a
|
||||
></section
|
||||
><div
|
||||
ref="marker"
|
||||
class="qci-marker"
|
||||
:class="{ 'qci-marker-link-only': view.markerLinkOnly }"
|
||||
hidden
|
||||
><video
|
||||
ref="still"
|
||||
class="qci-marker-still"
|
||||
muted
|
||||
playsinline
|
||||
preload="none"
|
||||
:hidden="view.stillHidden"
|
||||
aria-hidden="true"
|
||||
v-on="stillListeners"></video
|
||||
><span class="qci-marker-label">{{ view.markerLabel }}</span></div
|
||||
></Teleport
|
||||
></template>
|
||||
@@ -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,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,6 +5,8 @@ import { compassName, hazardsNear, regionalBrief, weatherLook } from '../../spot
|
||||
import { distanceKm } from '../../../data/entityContext.js';
|
||||
import { CONTEXT_RADIUS_STEPS, contextRadiusKm, setContextRadiusKm } from '../../contextRadius.js';
|
||||
import { contextNeedle, matchesContextSearch } from '../../contextSearch.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiIcon from '../../kit/UiIcon.vue';
|
||||
import UiSlider from '../../kit/UiSlider.js';
|
||||
import { sayWords, useEntityCardStore } from '../../stores/entityCard.js';
|
||||
import { useOmnibarStore } from '../../stores/omnibar.js';
|
||||
@@ -265,7 +267,7 @@ const sources = computed(() => {
|
||||
<template v-if="entity">
|
||||
<div v-if="weather || entity" class="spot-conditions__weather" :class="{ 'spot-conditions__weather--timed': entity }">
|
||||
<template v-if="weather">
|
||||
<span class="material-symbols-outlined spot-conditions__weather-icon" aria-hidden="true">{{ look.icon }}</span>
|
||||
<UiIcon class="spot-conditions__weather-icon" :name="look.icon" :size="null" />
|
||||
<div class="spot-conditions__weather-now">
|
||||
<strong>{{ round(weather.temperatureC) }}°C</strong>
|
||||
<span>{{ t(look.label) }}<template v-if="Number.isFinite(weather.apparentTemperatureC)"> · {{ t('feels {n}°', { n: round(weather.apparentTemperatureC) }) }}</template></span>
|
||||
@@ -298,18 +300,18 @@ const sources = computed(() => {
|
||||
|
||||
<div v-for="block in trafficBlocks" v-show="!searching || block.items.length" :key="block.id" class="spot-conditions__block">
|
||||
<h4>
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ block.icon }}</span>
|
||||
<UiIcon :name="block.icon" :size="null" />
|
||||
<span>{{ block.title }}</span>
|
||||
<span class="spot-conditions__count">{{ block.count }}</span>
|
||||
</h4>
|
||||
<ul v-if="block.items.length">
|
||||
<li v-for="item in block.items" :key="item.key">
|
||||
<button type="button" @click="store.select(item.identity, { fly: true })">
|
||||
<UiButton @click="store.select(item.identity, { fly: true })">
|
||||
<span class="spot-conditions__row-main">
|
||||
<span class="spot-conditions__row-title">{{ item.title }}</span>
|
||||
</span>
|
||||
<span class="spot-conditions__row-meta">{{ distance(item.distanceKm) }}</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
</li>
|
||||
</ul>
|
||||
<p v-else class="spot-conditions__none">{{ block.none }}</p>
|
||||
@@ -317,14 +319,14 @@ const sources = computed(() => {
|
||||
|
||||
<div v-show="!searching || shownHazards.length" class="spot-conditions__block">
|
||||
<h4>
|
||||
<span class="material-symbols-outlined" aria-hidden="true">warning</span>
|
||||
<UiIcon name="warning" :size="null" />
|
||||
<span>{{ t('Hazards within {radius}', { radius: radiusText }) }}</span>
|
||||
<span class="spot-conditions__count" :class="{ 'spot-conditions__count--hot': hazards.length }">{{ loading ? '…' : searching ? shownHazards.length : hazards.length }}</span>
|
||||
</h4>
|
||||
<ul v-if="shownHazards.length">
|
||||
<li v-for="hazard in shownHazards" :key="`${hazard.kind}-${hazard.title}-${hazard.distanceKm}`" :class="`spot-conditions__hazard--${hazard.kind}`">
|
||||
<button type="button" @click="flyTo(hazard)">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ hazard.icon }}</span>
|
||||
<UiButton @click="flyTo(hazard)">
|
||||
<UiIcon :name="hazard.icon" :size="null" />
|
||||
<span class="spot-conditions__row-main">
|
||||
<span class="spot-conditions__row-title">{{ hazard.title }}</span>
|
||||
<span v-if="hazard.detail || hazard.time" class="spot-conditions__row-detail">{{ [hazard.detail, ago(hazard.time)].filter(Boolean).join(' · ') }}</span>
|
||||
@@ -333,7 +335,7 @@ const sources = computed(() => {
|
||||
</span>
|
||||
</span>
|
||||
<span class="spot-conditions__row-meta">{{ distance(hazard.distanceKm) }} {{ t(hazard.direction) }}</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
</li>
|
||||
</ul>
|
||||
<p v-else-if="!loading" class="spot-conditions__none">{{ t('No earthquakes, tropical storms or wildfires reported within {radius}.', { radius: radiusText }) }}</p>
|
||||
@@ -341,40 +343,40 @@ const sources = computed(() => {
|
||||
|
||||
<div v-if="alerts.length" class="spot-conditions__block">
|
||||
<h4>
|
||||
<span class="material-symbols-outlined" aria-hidden="true">emergency_home</span>
|
||||
<UiIcon name="emergency_home" :size="null" />
|
||||
<span>{{ t('Broadcast alerts within {radius}', { radius: radiusText }) }}</span>
|
||||
<span class="spot-conditions__count spot-conditions__count--hot">{{ alerts.length }}</span>
|
||||
</h4>
|
||||
<ul>
|
||||
<li v-for="alert in alerts" :key="alert.key" class="spot-conditions__hazard--alert">
|
||||
<button type="button" @click="store.select(alert.identity, { fly: true })">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ alert.icon }}</span>
|
||||
<UiButton @click="store.select(alert.identity, { fly: true })">
|
||||
<UiIcon :name="alert.icon" :size="null" />
|
||||
<span class="spot-conditions__row-main">
|
||||
<span class="spot-conditions__row-title">{{ alert.title }}</span>
|
||||
<span class="spot-conditions__row-detail">{{ sayWords(alert.words, alert.text) }}</span>
|
||||
</span>
|
||||
<span class="spot-conditions__row-meta">{{ distance(alert.distanceKm) }}</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div v-if="groups?.other.length" class="spot-conditions__block">
|
||||
<h4>
|
||||
<span class="material-symbols-outlined" aria-hidden="true">layers</span>
|
||||
<UiIcon name="layers" :size="null" />
|
||||
<span>{{ t('Also within {radius}', { radius: radiusText }) }}</span>
|
||||
<span class="spot-conditions__count">{{ groups.other.length }}</span>
|
||||
</h4>
|
||||
<ul>
|
||||
<li v-for="item in groups.other" :key="item.key">
|
||||
<button type="button" @click="store.select(item.identity, { fly: true })">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ item.icon }}</span>
|
||||
<UiButton @click="store.select(item.identity, { fly: true })">
|
||||
<UiIcon :name="item.icon" :size="null" />
|
||||
<span class="spot-conditions__row-main">
|
||||
<span class="spot-conditions__row-title">{{ item.title }}</span>
|
||||
<span class="spot-conditions__row-detail">{{ shownLayerName(item.layerName, item.layerId) }}</span>
|
||||
</span>
|
||||
<span class="spot-conditions__row-meta">{{ distance(item.distanceKm) }}</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -384,7 +386,7 @@ const sources = computed(() => {
|
||||
<slot name="before-weather" />
|
||||
<div v-if="weather || entity" class="spot-conditions__weather" :class="{ 'spot-conditions__weather--timed': entity }">
|
||||
<template v-if="weather">
|
||||
<span class="material-symbols-outlined spot-conditions__weather-icon" aria-hidden="true">{{ look.icon }}</span>
|
||||
<UiIcon class="spot-conditions__weather-icon" :name="look.icon" :size="null" />
|
||||
<div class="spot-conditions__weather-now">
|
||||
<strong>{{ round(weather.temperatureC) }}°C</strong>
|
||||
<span>{{ t(look.label) }}<template v-if="Number.isFinite(weather.apparentTemperatureC)"> · {{ t('feels {n}°', { n: round(weather.apparentTemperatureC) }) }}</template></span>
|
||||
@@ -407,7 +409,7 @@ const sources = computed(() => {
|
||||
|
||||
<div v-if="articles.length" class="spot-conditions__block">
|
||||
<h4>
|
||||
<span class="material-symbols-outlined" aria-hidden="true">newspaper</span>
|
||||
<UiIcon name="newspaper" :size="null" />
|
||||
<span>{{ t('Local news') }}</span>
|
||||
<span v-if="brief?.newsQuery" class="spot-conditions__query">{{ brief.newsQuery }}</span>
|
||||
</h4>
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
Loaded 100 of 132 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user