mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Merge Core main into german/hal-644-ar: Arabic on the Vue UI
Main moved the UI to Vue views and Pinia stores, so the Arabic changes to the old DOM controllers now live in their views: the rail legend range comes from formatScaleRange (keeping units a source supplies as given), the voice timeout options are worded by Intl unit formatting in VoiceControl, and the scene editor's JSON fields stay left to right in SceneDialog. Main's CCTV status line, launch panel and calibration values keep the Arabic isolates and Western-digit formatting. isolate() and keepCodesWithValues() read the locale through getLocale(), which follows the page's vue-i18n instance, and the Intl formatters take intlLocale(getLocale()). A language switch now applies in place, and applyDocumentLanguage sets <html dir> on every switch, so the page mirrors without a reload. The icon rails and their tips are placed with logical properties, so they stay on the outer side of the mirrored stacks; Cyber's new stack offsets, padding and edge lines are logical too, and rtl.css moves Cyber's right stack to its new rail clearance. Main removed the Context mini radio, so its right-to-left rules and test go. The Arabic catalog gains main's new strings and drops the ones main no longer uses; the other catalogs keep main's new keys and the branch's landing labels.
This commit is contained in:
commit
bc5d038afd
630 files changed
+41141
-20956
No files matched your search
@@ -0,0 +1,212 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
import { t } from '../../i18n/index.js';
|
||||
import {
|
||||
createInstrumentState,
|
||||
createRouteState,
|
||||
createVisionState,
|
||||
} from '../cockpitInstrumentState.js';
|
||||
import { vClassToggle } from '../rail/classToggle.js';
|
||||
import { useCockpitStore } from '../stores/cockpit.js';
|
||||
import { useGlobeActionsStore } from '../stores/globeActions.js';
|
||||
import CockpitBriefing from './panels/CockpitBriefing.vue';
|
||||
import CockpitContext from './panels/CockpitContext.vue';
|
||||
import CockpitRollingValue from './panels/CockpitRollingValue.vue';
|
||||
import CockpitUtilityControls from './panels/CockpitUtilityControls.vue';
|
||||
|
||||
// The Cockpit HUD. The Cockpit controller presents the instruments, the
|
||||
// destination arrow and the vision selector on every HUD update; until it
|
||||
// does, they show the state they start in. The controller also publishes
|
||||
// which surfaces are shown and the utility strip's measured layout; the
|
||||
// layout pass stays with it, and the controls keep its listeners.
|
||||
const { presence, instruments, route, vision, utilityLayout } =
|
||||
storeToRefs(useCockpitStore());
|
||||
const active = computed(() => Boolean(presence.value?.active));
|
||||
const globe = useGlobeActionsStore();
|
||||
const { resetBusy } = storeToRefs(globe);
|
||||
const initialInstruments = createInstrumentState();
|
||||
const initialRoute = createRouteState();
|
||||
const initialVision = createVisionState();
|
||||
const hud = computed(() => instruments.value ?? initialInstruments);
|
||||
const direction = computed(() => (route.value ?? initialRoute).direction);
|
||||
const v = computed(() => vision.value ?? initialVision);
|
||||
const visionLabel = computed(() =>
|
||||
t('Current cockpit vision style: {style}. Activate for next style.', {
|
||||
style: v.value.name,
|
||||
}),
|
||||
);
|
||||
const visionTitle = computed(() =>
|
||||
t('Current style: {style} — click for next', { style: v.value.name }),
|
||||
);
|
||||
// The utility strip's measured anchor and height limits; a null value leaves
|
||||
// the stylesheet's fallback.
|
||||
const utilityStyle = computed(() => ({
|
||||
'--cockpit-utility-top': utilityLayout.value?.top ?? null,
|
||||
'--cockpit-utility-max-height': utilityLayout.value?.maxHeight ?? null,
|
||||
'--cockpit-utility-expanded-max-height':
|
||||
utilityLayout.value?.expandedMaxHeight ?? null,
|
||||
}));
|
||||
const tickStyle = (tick) =>
|
||||
tick.slot === null
|
||||
? undefined
|
||||
: { '--slot': tick.slot, '--depth': tick.depth, '--curve': tick.curve };
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- Aircraft first-person view. It can be entered from the visible view switcher. -->
|
||||
<section id="cockpit-hud" :aria-label="t('Aircraft cockpit view')" :hidden="!active" :style="utilityStyle" v-class-toggle="{ 'signals-active': active, 'context-active': Boolean(presence?.context) }" :data-layer="hud.layer ?? undefined">
|
||||
<!-- One optical coordinate system: every targeting mark shares this center.
|
||||
Decorative only; telemetry and interactive panels remain separate. -->
|
||||
<svg class="cockpit-frame-lines" viewBox="0 0 1200 720" preserveAspectRatio="none" aria-hidden="true" focusable="false">
|
||||
<g fill="none" stroke="currentColor">
|
||||
<path d="M42 106H234L266 126H334 M866 126H934L966 106H1158 M42 114H226L258 136H318 M882 136H942L974 114H1158"/>
|
||||
<path d="M42 616H226L254 598H320 M880 598H946L974 616H1158 M42 624H238L266 606H330 M870 606H934L962 624H1158"/>
|
||||
<path d="M322 650H878L858 622H728L708 634H492L472 622H342Z M348 659H852"/>
|
||||
<path d="M72 160H144L158 174V186 M1056 160H1128L1142 174V186 M72 562H144L158 548V536 M1056 562H1128L1142 548V536"/>
|
||||
</g>
|
||||
<path class="cockpit-frame-warning" d="M338 645H476L490 654H710L724 645H862" fill="none"/>
|
||||
<path class="cockpit-frame-meter" d="M372 642H418 M782 642H828"/>
|
||||
</svg>
|
||||
<div class="cockpit-scan-array" aria-hidden="true">
|
||||
<svg class="cockpit-target-geometry" viewBox="0 0 600 600" fill="none" focusable="false">
|
||||
<g class="cockpit-target-hairline">
|
||||
<circle cx="300" cy="300" r="276"/>
|
||||
<circle class="cockpit-target-drift" cx="300" cy="300" r="250" stroke-dasharray="1 13"/>
|
||||
<circle cx="300" cy="300" r="164"/>
|
||||
<path d="M190 237V363 M410 237V363 M99 227H139 M461 227H501 M99 373H139 M461 373H501"/>
|
||||
<path d="M86 113H118L134 129 M514 113H482L466 129 M86 487H118L134 471 M514 487H482L466 471"/>
|
||||
</g>
|
||||
<g class="cockpit-target-side-arcs">
|
||||
<path d="M70 167A266 266 0 0 0 70 433 M530 167A266 266 0 0 1 530 433"/>
|
||||
</g>
|
||||
<g class="cockpit-target-ticks">
|
||||
<path d="M166 125A220 220 0 0 1 434 125 M166 475A220 220 0 0 0 434 475"/>
|
||||
</g>
|
||||
<g class="cockpit-target-dots">
|
||||
<path d="M180 130A208 208 0 0 1 420 130 M180 470A208 208 0 0 0 420 470"/>
|
||||
</g>
|
||||
<g class="cockpit-target-warning-dots">
|
||||
<path d="M172 112A227 227 0 0 1 428 112 M172 488A227 227 0 0 0 428 488"/>
|
||||
</g>
|
||||
<g class="cockpit-target-core">
|
||||
<!-- One outer ring and a spaced rotor leave the aiming center open. -->
|
||||
<circle class="cockpit-target-orbit" cx="300" cy="300" r="132" stroke-dasharray="186 21"/>
|
||||
<circle class="cockpit-target-rotor" cx="300" cy="300" r="104" stroke-dasharray="128 35" transform="rotate(9 300 300)"/>
|
||||
<path class="cockpit-target-spokes" d="M206 206L250 250 M350 350L394 394 M394 206L350 250 M250 350L206 394"/>
|
||||
<path d="M168 291H180V309H168 M432 291H420V309H432"/>
|
||||
<circle cx="206" cy="206" r="3"/><circle cx="394" cy="206" r="3"/>
|
||||
<circle cx="206" cy="394" r="3"/><circle cx="394" cy="394" r="3"/>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="cockpit-visor-shell" aria-hidden="true">
|
||||
<div class="cockpit-roll-arc">
|
||||
<span style="--slot:-3;--depth:3">−30</span>
|
||||
<span style="--slot:-2;--depth:2">−20</span>
|
||||
<span style="--slot:-1;--depth:1">−10</span>
|
||||
<span class="active" style="--slot:0;--depth:0">0</span>
|
||||
<span style="--slot:1;--depth:1">+10</span>
|
||||
<span style="--slot:2;--depth:2">+20</span>
|
||||
<span style="--slot:3;--depth:3">+30</span>
|
||||
</div>
|
||||
<div class="cockpit-pitch-rail cockpit-pitch-rail-left">
|
||||
<span>+20</span><span>+10</span><span class="active">00</span><span>−10</span><span>−20</span>
|
||||
</div>
|
||||
<div class="cockpit-pitch-rail cockpit-pitch-rail-right">
|
||||
<span>+20</span><span>+10</span><span class="active">00</span><span>−10</span><span>−20</span>
|
||||
</div>
|
||||
<div class="cockpit-horizon-guide">
|
||||
<span></span><small>{{ t('LEVEL') }}</small><span></span>
|
||||
</div>
|
||||
<div id="cockpit-route-direction" class="cockpit-route-direction" :hidden="!direction.visible" :aria-label="t('Estimated destination direction')" :style="direction.angle === null ? undefined : { '--route-angle': direction.angle }">
|
||||
<svg class="cockpit-route-chevron" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
||||
<path d="M12 2 4.58 19.93c-.34.83.51 1.63 1.31 1.27L12 18.47l6.11 2.73c.8.36 1.65-.44 1.31-1.27L12 2Z" />
|
||||
</svg>
|
||||
<small id="cockpit-route-direction-label">{{ direction.label }}</small>
|
||||
</div>
|
||||
<div class="cockpit-visor-status cockpit-visor-status-left">{{ t('OPTICAL PLANE · 01') }}</div>
|
||||
<div class="cockpit-visor-status cockpit-visor-status-right">{{ t('VISOR LOCK · ACTIVE') }}</div>
|
||||
</div>
|
||||
<div id="cockpit-speed-rim" class="cockpit-altitude-rim cockpit-speed-rim" v-class-toggle="{ unavailable: hud.speedRim.unavailable }">
|
||||
<span class="cockpit-altitude-rim-label">{{ t('GROUND SPEED · KTS') }}</span>
|
||||
<div class="cockpit-altitude-rim-rail"></div>
|
||||
<div class="cockpit-altitude-rim-scale">
|
||||
<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>
|
||||
<strong id="cockpit-speed-rim-value">{{ hud.speedRim.value }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
<div id="cockpit-altitude-rim" class="cockpit-altitude-rim" v-class-toggle="{ unavailable: hud.altitudeRim.unavailable }">
|
||||
<span class="cockpit-altitude-rim-label">{{ t('ALTITUDE · FT') }}</span>
|
||||
<div class="cockpit-altitude-rim-rail"></div>
|
||||
<div class="cockpit-altitude-rim-scale">
|
||||
<span v-for="(tick, index) in hud.altitudeRim.ticks" :key="index" data-altitude-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">
|
||||
<strong id="cockpit-altitude-rim-value">{{ hud.altitudeRim.value }}</strong>
|
||||
<span class="material-symbols-outlined">arrow_left</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cockpit-topline">
|
||||
<div>
|
||||
<span class="cockpit-kicker">{{ t('FIRST PERSON') }}</span>
|
||||
<strong id="cockpit-callsign">{{ hud.callsign }}</strong>
|
||||
<span id="cockpit-aircraft-meta" v-class-toggle="{ emergency: hud.meta.emergency }" class="cockpit-aircraft-meta">{{ 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>
|
||||
<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">
|
||||
<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')">
|
||||
<small>{{ t('NEXT') }}</small>
|
||||
<span class="material-symbols-outlined" aria-hidden="true">chevron_right</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cockpit-reticle material-symbols-outlined" aria-hidden="true">my_location</div>
|
||||
<div class="cockpit-compass" :aria-label="t('Current aircraft heading')">
|
||||
<div class="cockpit-instrument-row">
|
||||
<div class="cockpit-readout cockpit-speed">
|
||||
<span class="cockpit-readout-label">{{ t('GROUND SPEED') }}</span>
|
||||
<CockpitRollingValue id="cockpit-speed-value" tag="strong" :reading="hud.speed" placeholder="---" />
|
||||
<span class="cockpit-readout-unit">{{ t('KTS') }}</span>
|
||||
</div>
|
||||
<div class="cockpit-heading-value"><CockpitRollingValue id="cockpit-heading-value" :reading="hud.heading" placeholder="---" :circular-range="360" /><small>°</small></div>
|
||||
<div class="cockpit-readout cockpit-altitude">
|
||||
<span class="cockpit-readout-label">{{ t('ALTITUDE') }}</span>
|
||||
<CockpitRollingValue id="cockpit-altitude-value" tag="strong" :reading="hud.altitude" placeholder="-----" />
|
||||
<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>
|
||||
<div class="cockpit-compass-tape" id="cockpit-compass-tape" aria-hidden="true"><span v-for="division in hud.compass" :key="division.slot" :class="division.slot === 0 ? 'active' : ''" :style="{ '--slot': division.slot, '--depth': Math.abs(division.slot) }">{{ division.label }}</span></div>
|
||||
</div>
|
||||
<div class="cockpit-position-readout">
|
||||
<span id="cockpit-clock">{{ hud.clock }}</span>
|
||||
<span id="cockpit-position">{{ hud.position }}</span>
|
||||
</div>
|
||||
<CockpitContext />
|
||||
<CockpitBriefing />
|
||||
<CockpitUtilityControls />
|
||||
<div class="cockpit-help"><bdi>{{ t('ESC EXIT') }}</bdi> <span>·</span> <bdi>{{ t('C TOGGLE') }}</bdi></div>
|
||||
</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>
|
||||
<span>{{ t('RESET') }}</span>
|
||||
</button>
|
||||
<button id="map-view-switch" type="button" :aria-label="t('Exit cockpit view')" aria-keyshortcuts="Escape C" :title="t('Exit cockpit view')" :hidden="!active">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">close_fullscreen</span>
|
||||
<span>{{ t('EXIT COCKPIT') }}</span>
|
||||
</button>
|
||||
</nav>
|
||||
</template>
|
||||
@@ -0,0 +1,169 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { msg, t } from '../../i18n/index.js';
|
||||
import { vPanelState } from '../rail/panelState.js';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
import { vClassToggle } from '../rail/classToggle.js';
|
||||
import { useDisplayStore } from '../stores/display.js';
|
||||
import { computed } from 'vue';
|
||||
import { useLocationStore } from '../stores/location.js';
|
||||
import { usePanelChromeStore } from '../stores/panelChrome.js';
|
||||
import { usePointerReticleStore } from '../stores/pointerReticle.js';
|
||||
import { useVoiceStore } from '../stores/voice.js';
|
||||
import PhoneTabBar from './panels/PhoneTabBar.vue';
|
||||
import VoiceControl from './panels/VoiceControl.vue';
|
||||
|
||||
// VisualSettings publishes the active style and the map source controls
|
||||
// their chip row; until they do, the dock shows its initial markup. A style
|
||||
// button calls the Display controls' owner, a chip the map source controls.
|
||||
const display = useDisplayStore();
|
||||
const { style, mapSource, mapSourceControls } = storeToRefs(display);
|
||||
// LocationControls publishes the location tray; pills call the controls,
|
||||
// and the search field keeps their listeners.
|
||||
const { view: loc, controls: locationControls } = storeToRefs(useLocationStore());
|
||||
|
||||
// PanelChrome presents each tray's open and pinned state; the tray toggles
|
||||
// keep its hover and focus listeners, and the pins call it.
|
||||
const chrome = usePanelChromeStore();
|
||||
const { panels } = storeToRefs(chrome);
|
||||
/** A tray toggle's words, or `fallback` until the tray is presented. */
|
||||
function trayWords(panelId, name, fallback) {
|
||||
const state = panels.value[panelId];
|
||||
if (!state) return fallback;
|
||||
return t(state.collapsed ? msg('Expand {name}') : msg('Collapse {name}'), {
|
||||
name,
|
||||
});
|
||||
}
|
||||
/** A pin's click: a pin never opens the tray behind it. */
|
||||
function pin(event, panelId) {
|
||||
event.stopPropagation();
|
||||
chrome.act('pin', panelId);
|
||||
}
|
||||
|
||||
// The voice control, while a voice session presents one. It sits between the
|
||||
// location bar and the visual presets; the trays keep their elements when the
|
||||
// order changes.
|
||||
const { view: voice } = storeToRefs(useVoiceStore());
|
||||
// Once voice has taken its place, the location bar stays first.
|
||||
let voiceShown = false;
|
||||
const dockOrder = computed(() => {
|
||||
if (voice.value) voiceShown = true;
|
||||
return voice.value
|
||||
? ['location', 'voice', 'control']
|
||||
: voiceShown
|
||||
? ['location', 'control']
|
||||
: ['control', 'location'];
|
||||
});
|
||||
|
||||
// Where the user pointed while a voice turn is live (PointerReticle).
|
||||
const { reticles } = storeToRefs(usePointerReticleStore());
|
||||
|
||||
function selectMapSource(chip) {
|
||||
if (!chip.available) return;
|
||||
void mapSourceControls.value?.select(chip.id).catch(() => {});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- Unified bottom command dock: locations, voice, visual presets -->
|
||||
<div id="command-dock" class="ui-scroll" :aria-label="t('Navigation, voice, and visual preset controls')">
|
||||
<template v-for="slot in dockOrder" :key="slot">
|
||||
<!-- Control panel -->
|
||||
<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"
|
||||
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>
|
||||
<div id="control-panel-popover" class="dock-popover-content">
|
||||
<UiButton variant="icon" 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.')">
|
||||
<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.')">
|
||||
<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.')">
|
||||
<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.')">
|
||||
<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.')">
|
||||
<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.')">
|
||||
<span class="btn-icon">◐</span>
|
||||
<span class="btn-label">{{ t('Noir') }}</span>
|
||||
<span class="btn-key">6</span>
|
||||
</button>
|
||||
</div>
|
||||
<section class="map-source-section" aria-labelledby="map-source-label">
|
||||
<div class="map-source-heading">
|
||||
<span id="map-source-label">{{ t('MAP SOURCE') }}</span>
|
||||
<span id="map-stack-status" class="pp-stack-status" v-class-toggle="{ warn: !!mapSource?.status.warn }" aria-live="polite">{{ mapSource ? mapSource.status.text : '3D' }}</span>
|
||||
</div>
|
||||
<div id="map-stack-chips" class="map-stack-chip-row" role="group" :aria-label="t('Map source')"><UiButton v-for="chip in mapSource?.chips" :key="chip.id" class="map-stack-chip" :pressed="Boolean(chip.active)" pressed-class="active" v-class-toggle="{ unavailable: !chip.available }" :data-stack-id="chip.id" :title="chip.title" :aria-disabled="String(!chip.available)" :aria-label="chip.ariaLabel" @click="selectMapSource(chip)"><span class="map-stack-chip-label">{{ chip.label }}</span><span v-if="chip.requirement" class="map-stack-chip-req">{{ chip.requirement }}</span></UiButton></div>
|
||||
</section>
|
||||
</div>
|
||||
<div id="style-mini-status" class="panel-mini-status" aria-live="polite">
|
||||
<span class="panel-mini-label">{{ t('Style') }}</span>
|
||||
<span id="style-mini-value" class="panel-mini-value">{{ style ? style.label : t('NORMAL') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<VoiceControl v-else-if="slot === 'voice'" :key="voice.id" :view="voice" />
|
||||
|
||||
<!-- Location bar -->
|
||||
<div v-else-if="slot === 'location'" id="location-bar" v-panel-state="'location-bar'" class="panel-collapsible collapsed">
|
||||
<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'))">
|
||||
<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>
|
||||
</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>
|
||||
<div id="location-mini-poi" class="location-mini-poi">{{ loc ? loc.status.poi : t('Landmark: --') }}</div>
|
||||
</div>
|
||||
<div id="location-bar-popover" class="dock-popover-content">
|
||||
<UiButton variant="icon" class="dock-pin-btn" data-pin-target="location-bar" :label="t('Pin location tray')" :title="t('Keep location tray open')" :pressed="!!panels['location-bar']?.pinned" @click="pin($event, 'location-bar')"><img src="/pin.svg" alt="" /></UiButton>
|
||||
<div id="poi-row" class="poi-row-container" v-class-toggle="{ expanded: !!loc?.poisExpanded }"><UiButton v-for="poi in loc?.pois" :key="`${loc.poiCity}:${poi.index}`" class="poi-pill" :pressed="Boolean(poi.active)" pressed-class="active" :data-poi-index="poi.index" @click="locationControls?.choosePoi(poi.index)"><span class="poi-pill-key">{{ poi.key }}</span><span class="poi-pill-name">{{ poi.name }}</span></UiButton></div>
|
||||
<div class="location-bar-divider" id="location-bar-divider" v-class-toggle="{ visible: !!loc?.poisExpanded }"></div>
|
||||
<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()">
|
||||
<span>🔎</span>
|
||||
</button>
|
||||
<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?.searchError ? 'true' : null" :aria-describedby="loc?.searchError ? 'location-search-error' : null" />
|
||||
</div>
|
||||
</div>
|
||||
<p id="location-search-error" class="location-search-error" role="alert">{{ loc?.searchError }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<PhoneTabBar />
|
||||
<Teleport to="body">
|
||||
<div v-for="reticle in reticles" :key="reticle.owner.key" class="gev-pointer-reticle" aria-hidden="true" :hidden="!reticle.visible" :data-target="reticle.target" :style="{ left: `${reticle.left}px`, top: `${reticle.top}px` }"></div>
|
||||
</Teleport>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,80 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { t } from '../../i18n/index.js';
|
||||
import RailPanel from '../rail/RailPanel.vue';
|
||||
import { vClassToggle } from '../rail/classToggle.js';
|
||||
import { useCockpitStore } from '../stores/cockpit.js';
|
||||
import { useBhoteKoshiPanelStore } from '../stores/bhoteKoshiPanel.js';
|
||||
import { useContextStore } from '../stores/context.js';
|
||||
import { useSceneStore } from '../stores/scenes.js';
|
||||
import AwarenessPanel from './panels/AwarenessPanel.vue';
|
||||
import BhoteKoshiPanel from './panels/BhoteKoshiPanel.vue';
|
||||
import MissionDetail from './panels/MissionDetail.vue';
|
||||
import MissionRoster from './panels/MissionRoster.vue';
|
||||
import RadioPanel from './panels/RadioPanel.vue';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
|
||||
// ContextControls presents the mode switch and the nearby sites search and
|
||||
// publishes them; until it does, the panel shows its initial markup.
|
||||
const { view: ctx } = storeToRefs(useContextStore());
|
||||
const { presence: cockpit } = storeToRefs(useCockpitStore());
|
||||
// While the Bhote Koshi event is on, its panel is the rail's only content.
|
||||
const { panel: bhotePanel } = storeToRefs(useBhoteKoshiPanelStore());
|
||||
// The Scene runtime chip SceneControls presents while a scene plays.
|
||||
const { panel: scenePanel } = storeToRefs(useSceneStore());
|
||||
const sceneRuntime = computed(() => scenePanel.value?.runtime ?? '');
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- Global Context is deliberately independent from the left layer accordion. -->
|
||||
<aside id="right-context-rail" class="ui-scroll" v-class-toggle="{ 'bhote-event-active': !!bhotePanel }">
|
||||
<RailPanel id="weather-panel" hidden :title="t('WEATHER')" sideways rail-scroller>
|
||||
<template #badge><span id="weather-panel-count" :aria-label="t('Active weather products')">0</span></template>
|
||||
<div id="weather-panel-body" class="ui-scroll" data-rail-scroller></div>
|
||||
</RailPanel>
|
||||
<RailPanel id="recent-imagery-panel" hidden :title="t('RECENT IMAGERY')" sideways rail-scroller>
|
||||
<template #badge><span id="recent-imagery-panel-count" :aria-label="t('Imagery days in the box')"></span></template>
|
||||
<div id="recent-imagery-panel-body" class="ui-scroll" data-rail-scroller></div>
|
||||
</RailPanel>
|
||||
<RailPanel id="global-context-panel" start-collapsed v-class-toggle="{ ...(ctx && { 'context-enabled': ctx.enabled }) }" :data-context-mode="ctx?.mode" :title="t('CONTEXT')" sideways scroll rail-scroller>
|
||||
<div class="cyber-panel-body ui-scroll" data-rail-scroller>
|
||||
<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>
|
||||
<span>{{ t('CONTACTS') }}</span>
|
||||
</button>
|
||||
<button id="global-context-missions-btn" class="context-mode-button" v-class-toggle="{ active: ctx?.missionsActive }" type="button" role="tab" tabindex="0" :aria-selected="String(ctx?.missionsActive ?? false)" :aria-disabled="ctx && String(ctx.busy)" :aria-busy="ctx && String(ctx.busy)" aria-controls="context-missions-view">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">rocket_launch</span>
|
||||
<span>{{ t('SPACE MISSIONS') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div id="context-mode-standby" class="context-mode-standby" :hidden="ctx?.enabled">
|
||||
<strong>{{ t('SELECT CONTEXT') }}</strong>
|
||||
<span>{{ t('CONTACTS — nearest planes · vessels · sites') }}<br>{{ t('SPACE MISSIONS — launches & orbital assets') }}</span>
|
||||
</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">flight</span>
|
||||
<span>{{ t('COCKPIT') }}</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 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 />
|
||||
</section>
|
||||
<section id="context-missions-view" class="context-mode-view" role="tabpanel" aria-labelledby="global-context-missions-btn" :hidden="!ctx?.missionsActive">
|
||||
<div id="space-mission-panel-host">
|
||||
<MissionRoster />
|
||||
<MissionDetail />
|
||||
</div>
|
||||
</section>
|
||||
<RadioPanel />
|
||||
</div>
|
||||
</RailPanel>
|
||||
<BhoteKoshiPanel />
|
||||
</aside>
|
||||
|
||||
<div id="scene-runtime" :class="{ active: !!sceneRuntime }">{{ sceneRuntime }}</div>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
<script setup>
|
||||
import { t } from '../../i18n/index.js';
|
||||
import { useDisplayStore } from '../stores/display.js';
|
||||
import DisplayPanel from './panels/DisplayPanel.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>
|
||||
</template>
|
||||
@@ -0,0 +1,63 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useHudStore } from '../stores/hud.js';
|
||||
|
||||
// The readouts, visibility, layout variant and colors IntelHUD publishes.
|
||||
const { hud } = storeToRefs(useHudStore());
|
||||
// The corners and edges render from mount, before IntelHUD presents them:
|
||||
// the panel layout controllers register them as obstacles synchronously,
|
||||
// right after IntelHUD is built.
|
||||
const EMPTY = Object.freeze({ vessel: {}, sensor: [], recShown: null });
|
||||
const view = computed(() => hud.value ?? EMPTY);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div id="intel-hud" :class="{ active: hud?.active }" :data-variant="hud?.variant" :style="hud?.colors ?? undefined">
|
||||
<div class="hud-sonar" aria-hidden="true"></div>
|
||||
<div class="hud-corner hud-top-left">
|
||||
<div class="hud-bracket">┌</div>
|
||||
<div class="hud-content">
|
||||
<div class="hud-readout"><div class="hud-classification">{{ view.classification }}</div></div>
|
||||
<div class="hud-readout"><div class="hud-system">{{ view.system }}</div></div>
|
||||
<div class="hud-readout"><div class="hud-mode" id="hud-mode">{{ view.mode }}</div></div>
|
||||
<div class="hud-summary-wrap">
|
||||
<div class="hud-readout"><div class="hud-summary-label">{{ view.summaryLabel }}</div></div>
|
||||
<div class="hud-readout"><div class="hud-summary" id="hud-summary">{{ view.summary }}</div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hud-corner hud-top-right">
|
||||
<div class="hud-content" style="text-align: right">
|
||||
<div class="hud-readout"><div class="hud-rec"><span id="hud-rec-dot" :style="view.recShown === null ? undefined : { visibility: view.recShown ? 'visible' : 'hidden' }">●</span>{{ view.rec ? ` ${view.rec} ` : '' }}<span id="hud-timestamp">{{ view.timestamp }}</span></div></div>
|
||||
<div class="hud-readout"><div class="hud-orbital">{{ view.orbital }}</div></div>
|
||||
</div>
|
||||
<div class="hud-bracket">┐</div>
|
||||
</div>
|
||||
<div class="hud-corner hud-bottom-left">
|
||||
<div class="hud-bracket">└</div>
|
||||
<div class="hud-content">
|
||||
<div class="hud-readout"><div id="hud-mgrs">{{ view.mgrs }}</div></div>
|
||||
<div class="hud-readout"><div id="hud-latlon">{{ view.latlon }}</div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hud-corner hud-bottom-right">
|
||||
<div class="hud-content" style="text-align: right">
|
||||
<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>
|
||||
</div>
|
||||
<div class="hud-bracket">┘</div>
|
||||
</div>
|
||||
<div class="hud-edge hud-left-edge">
|
||||
<div class="hud-readout"><div id="hud-coll">{{ view.coll }}</div></div>
|
||||
<div class="hud-readout"><div id="hud-ona">{{ view.ona }}</div></div>
|
||||
</div>
|
||||
<div class="hud-edge hud-right-edge">
|
||||
<div v-for="line in view.sensor" :key="line" class="hud-readout"><div>{{ line }}</div></div>
|
||||
</div>
|
||||
<div class="hud-bottom-bar">
|
||||
<span class="hud-readout"><span id="hud-bottom-line">{{ view.bottom }}</span></span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,94 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { t } from '../../i18n/index.js';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
import RailPanel from '../rail/RailPanel.vue';
|
||||
import { useSceneSharingStore } from '../stores/sceneSharing.js';
|
||||
import { useSceneStore } from '../stores/scenes.js';
|
||||
import { vClassToggle } from '../rail/classToggle.js';
|
||||
import SceneDialog from './panels/SceneDialog.vue';
|
||||
import SceneOptions from './SceneOptions.vue';
|
||||
import SceneShotList from './SceneShotList.vue';
|
||||
import CctvPanel from './panels/CctvPanel.vue';
|
||||
import StreetLevelPanel from './panels/StreetLevelPanel.vue';
|
||||
import UiSelect from '../kit/UiSelect.js';
|
||||
|
||||
// Scene sharing (src/scenes/sharing.js) offers its authoring bar and presents
|
||||
// its dialog through this store; without this view, neither is drawn.
|
||||
const { toolbar, dialog } = storeToRefs(useSceneSharingStore());
|
||||
// SceneControls presents the Scene panel's buttons, status and progress and
|
||||
// answers the buttons through the store.
|
||||
const scenes = useSceneStore();
|
||||
const { panel: scene } = storeToRefs(scenes);
|
||||
const off = (name) => scene.value?.disabled[name] ?? false;
|
||||
// The hidden file input is the IMPORT button's chooser, open only while an
|
||||
// owner presents the panel. It is cleared once the import settles, so the same
|
||||
// file can be chosen again, unless the owner went away meanwhile.
|
||||
function chooseImport(input) {
|
||||
if (scenes.attached) input.click();
|
||||
}
|
||||
async function importChosen(event) {
|
||||
const input = event.currentTarget;
|
||||
const file = input.files?.[0];
|
||||
if (!file || !scenes.attached) return;
|
||||
await scenes.act('importFile', file);
|
||||
if (scenes.attached) input.value = '';
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div id="left-panel-stack" class="ui-scroll">
|
||||
<!-- Data Layer Toggle Panel -->
|
||||
<RailPanel id="data-panel" start-collapsed class="active" :title="t('DATA LAYERS')">
|
||||
<div id="data-toggles" class="data-toggle-list ui-scroll"></div>
|
||||
</RailPanel>
|
||||
|
||||
<!-- CCTV Coverage Panel -->
|
||||
<CctvPanel />
|
||||
|
||||
<!-- Street Level Panel (moved into #right-context-rail at runtime) -->
|
||||
<StreetLevelPanel />
|
||||
|
||||
<!-- Scene Director Panel -->
|
||||
<RailPanel id="scene-panel" start-collapsed v-class-toggle="{ running: scene?.running, 'has-shots': scene?.hasShots }" :title="t('AUTHORING')" :hint="t('Create and edit scenes')" scroll>
|
||||
<p class="scene-step-heading">{{ t('SCENE') }}</p>
|
||||
<div class="scene-controls">
|
||||
<UiSelect class="gev-field" id="scene-select" :aria-label="t('Scene')" :disabled="off('select')" @update:model-value="scenes.act('selectScene', $event)"><SceneOptions /></UiSelect>
|
||||
<UiButton id="scene-new-btn" type="button" :disabled="off('new')" @click="scenes.act('create')" class="gev-action-button scene-btn" :title="t('Start a new, empty scene')">{{ t('NEW SCENE') }}</UiButton>
|
||||
<UiButton tone="alert" id="scene-delete-btn" type="button" :disabled="off('delete')" @click="scenes.act('deleteScene')" class="gev-action-button gev-action-button--danger scene-btn scene-btn-danger" :title="t('Delete this scene and all of its shots')">{{ t('DELETE') }}</UiButton>
|
||||
</div>
|
||||
<p class="scene-step-heading">{{ t('SHOTS') }}</p>
|
||||
<div class="scene-controls">
|
||||
<UiButton variant="primary" id="scene-capture-btn" type="button" :disabled="off('capture')" @click="scenes.act('capture')" class="gev-action-button scene-btn scene-btn-primary" :title="t('Add the current view, style and layers as the next shot')">{{ t('+ CAPTURE SHOT') }}</UiButton>
|
||||
<UiButton id="scene-update-shot-btn" type="button" :disabled="off('update')" @click="scenes.act('update')" class="gev-action-button scene-btn" :title="t('Replace the selected shot with the current view')">{{ t('UPDATE SHOT') }}</UiButton>
|
||||
</div>
|
||||
<SceneShotList />
|
||||
<p class="scene-shot-hint">{{ t('Click a shot to select it, double-click to rename.') }}</p>
|
||||
<p class="scene-step-heading">{{ t('PREVIEW') }}</p>
|
||||
<div class="scene-controls">
|
||||
<UiButton variant="primary" id="scene-start-btn" type="button" class="gev-action-button scene-btn scene-btn-primary" :title="t('Play from this scene through the rest of the project')" :disabled="off('start')" @click="scenes.act('start')">{{ scene?.playLabel ?? t('PLAY', { context: 'scene' }) }}</UiButton>
|
||||
<UiButton tone="alert" id="scene-stop-btn" type="button" :disabled="off('stop')" @click="scenes.act('stop')" class="gev-action-button gev-action-button--danger scene-btn scene-btn-danger" :title="t('Stop playback (Esc)')">{{ t('STOP') }}</UiButton>
|
||||
<UiButton id="scene-next-btn" type="button" :disabled="off('next')" @click="scenes.act('next')" class="gev-action-button scene-btn" :title="t('Play the shot after the selected one, moving on to the next scene when needed')">{{ t('NEXT') }}</UiButton>
|
||||
</div>
|
||||
<p class="scene-step-heading">{{ t('SAVE & SHARE') }}</p>
|
||||
<div class="scene-controls scene-file-controls">
|
||||
<UiButton id="scene-export-btn" type="button" :disabled="off('export')" @click="scenes.act('export')" class="gev-action-button scene-btn" :title="t('Download every scene as a JSON file you can import later')">{{ t('EXPORT') }}</UiButton>
|
||||
<UiButton id="scene-import-btn" type="button" :disabled="off('import')" @click="chooseImport($refs.sceneFile)" class="gev-action-button scene-btn" :title="t('Load scenes from an exported JSON file')">{{ t('IMPORT') }}</UiButton>
|
||||
<UiButton id="scene-download-btn" type="button" :disabled="off('download')" @click="scenes.act('download')" class="gev-action-button scene-btn" :title="t('Download the timing log of the last play')">{{ t('RUN LOG') }}</UiButton>
|
||||
<input ref="sceneFile" type="file" id="scene-import-file" accept="application/json,.json" hidden @change="importChosen" />
|
||||
</div>
|
||||
<div v-if="toolbar" data-director-authoring class="scene-controls">
|
||||
<UiButton type="button" class="gev-action-button scene-btn" :title="t('Edit anchors, data packs and shot details')" @click="toolbar.edit()">{{ t('EDIT DETAILS') }}</UiButton>
|
||||
<UiButton type="button" class="gev-action-button scene-btn" :title="t('Download this scene as JSON or an asset bundle')" @click="toolbar.share()">{{ t('SHARE SCENE') }}</UiButton>
|
||||
</div>
|
||||
<div class="scene-progress">
|
||||
<div id="scene-progress-fill" :style="scene ? { width: `${scene.progress}%` } : undefined">{{ scene?.progress ?? 0 }}%</div>
|
||||
</div>
|
||||
<div id="scene-status" role="status" aria-live="polite">{{ scene?.status ?? t('Ready') }}</div>
|
||||
</RailPanel>
|
||||
|
||||
</div>
|
||||
<Teleport to="body">
|
||||
<SceneDialog v-if="dialog" :key="dialog.id" :view="dialog" />
|
||||
</Teleport>
|
||||
</template>
|
||||
@@ -0,0 +1,103 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed, onBeforeUnmount, onMounted, shallowRef } from 'vue';
|
||||
import { t } from '../../i18n/index.js';
|
||||
import { vClassToggle } from '../rail/classToggle.js';
|
||||
import { vFieldValue } from '../rail/fieldValue.js';
|
||||
import { vStatusText } from '../rail/statusText.js';
|
||||
import { useLocaleStore } from '../stores/locale.js';
|
||||
import { useProviderSettingsStore } from '../stores/providerSettings.js';
|
||||
import LocalePicker from './panels/LocalePicker.vue';
|
||||
|
||||
const { picker } = storeToRefs(useLocaleStore());
|
||||
// The key setup owner (src/keySetup.js) presents the chip, the dialog and its
|
||||
// rows; until it does, the chip stays hidden and the dialog closed. When the
|
||||
// setup endpoint is not there, the owner reports it unavailable and both go.
|
||||
const { view, controls } = storeToRefs(useProviderSettingsStore());
|
||||
const available = computed(() => view.value?.available !== false);
|
||||
const chip = computed(() => view.value?.chip ?? null);
|
||||
const dialog = computed(() => view.value?.dialog ?? { hidden: true, visible: false });
|
||||
|
||||
// Cyber puts the chip in the top toolbar; every other theme keeps it first in
|
||||
// the corner row, beside the language picker.
|
||||
const cyber = shallowRef(false);
|
||||
let themeObserver = null;
|
||||
onMounted(() => {
|
||||
const theme = document.documentElement;
|
||||
const sync = () => {
|
||||
cyber.value =
|
||||
theme.dataset.uiTheme === 'cyber' &&
|
||||
Boolean(document.getElementById('top-center-actions'));
|
||||
};
|
||||
themeObserver = new MutationObserver(sync);
|
||||
themeObserver.observe(theme, { attributes: true, attributeFilter: ['data-ui-theme'] });
|
||||
sync();
|
||||
});
|
||||
onBeforeUnmount(() => themeObserver?.disconnect());
|
||||
|
||||
// The status line is a live region; vStatusText re-announces repeats.
|
||||
const statusText = computed(() => ({
|
||||
text:
|
||||
view.value?.status ??
|
||||
t('The Google Maps key buys the photorealistic planet — everything else stacks on top.'),
|
||||
seq: view.value?.statusSeq ?? 0,
|
||||
}));
|
||||
const removeTitle = (title) =>
|
||||
t("Remove {title} from this app's saved keys", { title });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- POWER UP — in-app key setup. Dev-server only: src/keySetup.js reports
|
||||
it unavailable, removing both the chip and this dialog, when
|
||||
/api/setup/status is not there to answer (prod builds, LAN visitors).
|
||||
Rows are rendered from that payload, so the key registry lives in
|
||||
src/keySetupCore.mjs alone. -->
|
||||
<!-- Bottom-right HUD row: the POWER UP chip (while keys are missing) and
|
||||
the language picker, once the shell publishes it. -->
|
||||
<div id="corner-actions">
|
||||
<Teleport v-if="available" :to="cyber ? '#top-center-actions' : 'body'" :disabled="!cyber">
|
||||
<button id="key-setup-chip" type="button" :hidden="!chip || chip.hidden" aria-haspopup="dialog" aria-controls="key-setup" :title="chip?.title" :aria-label="chip?.title" @click="controls?.open()">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">bolt</span>
|
||||
<span data-key-setup-chip-label>{{ chip ? chip.label : t('POWER UP') }}</span>
|
||||
</button>
|
||||
</Teleport>
|
||||
<LocalePicker v-if="picker" :key="picker.current" :current="picker.current" :on-select="picker.onSelect" :focus="picker.focus" />
|
||||
</div>
|
||||
<aside v-if="available" id="key-setup" role="dialog" aria-labelledby="key-setup-title" aria-describedby="key-setup-description" :hidden="dialog.hidden" v-class-toggle="{ visible: dialog.visible }" :data-ready="view?.ready ? 'true' : undefined" @transitionend="controls?.transitionEnd()">
|
||||
<div class="key-setup-scanline" aria-hidden="true"></div>
|
||||
<header class="key-setup-header">
|
||||
<span class="key-setup-kicker">{{ t('GROUND STATION · PROVIDER SETTINGS') }}</span>
|
||||
<button type="button" class="key-setup-close" data-key-setup-close :aria-label="t('Close key setup')" @click="controls?.close()">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">close</span>
|
||||
</button>
|
||||
</header>
|
||||
<h2 id="key-setup-title">{{ t('Power up the globe') }}</h2>
|
||||
<p id="key-setup-description">{{ t('The globe already flies keyless. Every key below switches on another real feed — paste one and it\'s saved into this app\'s local configuration, then the server restarts itself. Server-side keys stay on this machine; Google Maps and Cesium ion run in the browser and must be provider-restricted. Keys you configured elsewhere are shown but never touched.') }}</p>
|
||||
<div class="key-setup-rows ui-scroll" data-key-setup-rows>
|
||||
<section v-for="key in view?.rows ?? []" :key="`${key.id}:${view.generation}`" class="key-setup-row" :data-key-id="key.id" :data-set="String(key.set)" :data-managed="key.managed || undefined">
|
||||
<div class="key-setup-row-head">
|
||||
<span class="key-setup-led" aria-hidden="true"></span>
|
||||
<strong>{{ key.title }}</strong>
|
||||
<span class="key-setup-tier" :title="key.tierTitle">{{ key.tierDot }}</span>
|
||||
<span v-if="key.clientExposed" class="key-setup-exposed" :title="t('This key runs in the browser by design — restrict it at the provider (see SECURITY.md)')">{{ t('browser-side') }}</span>
|
||||
<span v-if="key.external" class="key-setup-external" :title="t('Supplied by your environment, Keychain, or launcher — change it where it was set')">{{ t('configured externally') }}</span>
|
||||
<a class="key-setup-get" :href="key.getUrl" target="_blank" rel="noopener noreferrer">{{ key.set ? t('MANAGE ↗') : t('GET KEY ↗') }}</a>
|
||||
</div>
|
||||
<p class="key-setup-unlocks">{{ key.unlocks }}</p>
|
||||
<div v-if="!key.external" class="key-setup-fields">
|
||||
<input v-for="envVar in key.envVars" :key="envVar" type="password" autocomplete="off" spellcheck="false" :data-env-var="envVar" :aria-label="envVar" :placeholder="key.set ? t('{envVar} saved — paste to replace', { envVar }) : t('paste {envVar}', { envVar })" v-field-value="view.fields[envVar] ?? ''" @input="controls?.setField(envVar, $event.target.value)" />
|
||||
<button v-if="key.managed === 'file'" type="button" class="key-setup-remove" :data-key-setup-remove="JSON.stringify(key.envVars)" :title="removeTitle(key.title)" @click="controls?.remove(key.envVars)">{{ t('REMOVE') }}</button>
|
||||
</div>
|
||||
<div v-if="key.id === 'openai'" class="key-setup-cloud-auth">
|
||||
<span class="key-setup-cloud-auth-state">{{ view.auth.mode === 'oauth' ? t('VOICE AUTH · CHATGPT OAUTH') : t('VOICE AUTH · API KEY') }}</span>
|
||||
<button type="button" class="key-setup-cloud-auth-toggle" data-cloud-voice-auth-toggle="true" :title="view.auth.mode === 'oauth' ? t('Use OPENAI_API_KEY for the next cloud voice session') : t('Use the signed-in local ChatGPT/Codex OAuth session for the next cloud voice session')" :aria-disabled="String(view.auth.busy)" @click="controls?.toggleAuth()">{{ view.auth.mode === 'oauth' ? t('USE API KEY') : t('USE CHATGPT OAUTH') }}</button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div class="key-setup-footer">
|
||||
<button type="button" class="key-setup-apply" data-key-setup-apply :aria-disabled="view?.saving == null ? undefined : String(view.saving)" @click="controls?.apply()">{{ t('SAVE KEYS') }}</button>
|
||||
<span class="key-setup-hint">{{ t('ESC to close') }}</span>
|
||||
</div>
|
||||
<p class="key-setup-note" data-key-setup-status role="status" aria-live="polite" v-status-text="statusText"></p>
|
||||
</aside>
|
||||
</template>
|
||||
@@ -0,0 +1,120 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { t } from '../../i18n/index.js';
|
||||
import { useDisplayStore } from '../stores/display.js';
|
||||
import { useLocationStore } from '../stores/location.js';
|
||||
import { useRecordingStore } from '../stores/recording.js';
|
||||
import { useStatusStore } from '../stores/status.js';
|
||||
import { useWorldOverlayActionsStore } from '../stores/worldOverlayActions.js';
|
||||
import { vClassToggle } from '../rail/classToggle.js';
|
||||
import ImagerySplitView from './panels/ImagerySplitView.vue';
|
||||
import MissionReplayOverlay from './panels/MissionReplayOverlay.vue';
|
||||
import DataPacks from './panels/DataPacks.vue';
|
||||
import SceneInteractions from './panels/SceneInteractions.vue';
|
||||
import SplitFlapText from './panels/SplitFlapText.vue';
|
||||
import WindInspectionMarker from './panels/WindInspectionMarker.vue';
|
||||
import CelestialRing from './panels/CelestialRing.vue';
|
||||
import ScreenAnnotations from './panels/ScreenAnnotations.vue';
|
||||
import AwarenessDirection from './panels/AwarenessDirection.vue';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
import GlobeActions from './panels/GlobeActions.vue';
|
||||
|
||||
// The ACTIVE STYLE corner shows the style VisualSettings publishes.
|
||||
const { style } = storeToRefs(useDisplayStore());
|
||||
// The status chips, toast and FPS readout show what ShellFeedback,
|
||||
// CctvControls, createToast() and createFrameRateMonitor() publish.
|
||||
const { loading, traffic, cctv, toast, fps } = storeToRefs(useStatusStore());
|
||||
// The safe frame a recording composes in, as RecordingControls publishes it.
|
||||
const { safeFrame } = storeToRefs(useRecordingStore());
|
||||
// The ORBIT indicator LocationControls offers with the location tray.
|
||||
const { view: location } = storeToRefs(useLocationStore());
|
||||
// The focusable mirror of the overlay cards the world overlay painted.
|
||||
const { actions: targets, controls: overlayControls } = storeToRefs(
|
||||
useWorldOverlayActionsStore(),
|
||||
);
|
||||
// Each button activates the target of the list it was rendered for.
|
||||
const onOverlayAction = (owner, key) => () =>
|
||||
overlayControls.value?.activate(owner, key);
|
||||
// Every accepted focus rewrites the status, so the live region announces a
|
||||
// repeated focus again.
|
||||
const vOverlayStatus = {
|
||||
mounted(el, { value }) {
|
||||
el.textContent = value?.status ?? '';
|
||||
},
|
||||
updated(el, { value, oldValue }) {
|
||||
if (value?.announced !== oldValue?.announced || !value)
|
||||
el.textContent = value?.status ?? '';
|
||||
},
|
||||
};
|
||||
// Every show rewrites the toast's text, so the live region announces a
|
||||
// repeated message again; hiding leaves it as it fades.
|
||||
const vToastText = {
|
||||
mounted(el, { value }) {
|
||||
el.textContent = value?.text ?? '';
|
||||
},
|
||||
updated(el, { value, oldValue }) {
|
||||
if (value?.shown !== oldValue?.shown) el.textContent = value?.text ?? '';
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div id="cesiumContainer"></div>
|
||||
<div id="world-overlay-root" aria-hidden="true">
|
||||
<canvas id="world-overlay-canvas"></canvas>
|
||||
</div>
|
||||
<div id="world-overlay-actions" class="world-overlay-accessibility" role="region" :aria-label="t('Visible map targets')">
|
||||
<div id="world-overlay-action-list"><UiButton v-for="item in targets?.items ?? []" :key="item.key" :aria-label="item.label" :pressed="Boolean(item.selected)" :data-overlay-action-key="item.key" :onClick="onOverlayAction(targets.owner, item.key)">{{ item.label }}</UiButton></div>
|
||||
<div id="world-overlay-status" v-overlay-status="targets" role="status" aria-live="polite" aria-atomic="true"></div>
|
||||
</div>
|
||||
|
||||
<!-- Title -->
|
||||
<div id="title-bar">
|
||||
<div class="title-glow"></div>
|
||||
<h1><span class="title-logo brand-logo" data-logo-gaze data-logo-src="/logo.svg" aria-hidden="true"><img src="/logo.svg" alt="" /></span> <span 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>
|
||||
|
||||
<!-- Style indicator -->
|
||||
<div id="style-indicator">
|
||||
<span class="indicator-label scene-text-holdout">{{ t('ACTIVE STYLE') }}</span>
|
||||
<span class="indicator-value scene-text-holdout" id="active-style-name">{{ style ? style.label : t('NORMAL') }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Top-center camera and share actions -->
|
||||
<GlobeActions />
|
||||
<div id="global-loading-status" role="status" aria-live="polite" aria-atomic="true" :hidden="loading ? loading.hidden : true" :data-state="loading?.state ?? undefined">
|
||||
<SplitFlapText id="global-loading-label" :text="loading ? loading.label : t('LOADING LIVE DATA')" :stopped="!!loading?.stopped" />
|
||||
<span id="global-loading-detail">{{ loading ? loading.detail : '' }}</span>
|
||||
</div>
|
||||
<div id="traffic-sync-chip" aria-live="polite" v-class-toggle="{ visible: !!traffic?.visible }">
|
||||
<SplitFlapText id="traffic-sync-label" :text="traffic ? traffic.label : t('syncing road network')" :immediate="!!traffic?.immediate" :stopped="!!traffic?.stopped" />
|
||||
<span id="traffic-sync-progress">{{ traffic ? traffic.progress : '0%' }}</span>
|
||||
</div>
|
||||
<div id="cctv-sync-chip" aria-live="polite" v-class-toggle="{ visible: !!cctv?.visible }">
|
||||
<SplitFlapText id="cctv-sync-label" :text="cctv ? cctv.label : t('loading frames')" :immediate="!!cctv?.immediate" :stopped="!!cctv?.stopped" />
|
||||
<span id="cctv-sync-progress">{{ cctv ? cctv.progress : '0/0' }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Toast notification -->
|
||||
<div id="toast" v-toast-text="toast" role="status" aria-live="polite" aria-atomic="true" v-class-toggle="{ visible: !!toast?.visible }"></div>
|
||||
|
||||
<!-- Safe frame guides for recording composition -->
|
||||
<div id="safe-frame-overlay" v-class-toggle="{ active: !!safeFrame, 'ratio-16-9': safeFrame === '16:9', 'ratio-9-16': safeFrame === '9:16' }">
|
||||
<div id="safe-frame-box"></div>
|
||||
</div>
|
||||
|
||||
<Teleport to="body">
|
||||
<div v-if="location?.orbit" id="orbit-indicator" v-class-toggle="{ active: location.orbit.active }"><span class="orbit-icon">↻</span> {{ t('ORBIT') }}</div>
|
||||
</Teleport>
|
||||
|
||||
<ImagerySplitView />
|
||||
<DataPacks />
|
||||
<CelestialRing />
|
||||
<SceneInteractions />
|
||||
<WindInspectionMarker />
|
||||
<MissionReplayOverlay />
|
||||
<ScreenAnnotations />
|
||||
<AwarenessDirection />
|
||||
</template>
|
||||
@@ -0,0 +1,31 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { getCurrentInstance, watch } from 'vue';
|
||||
import { useSceneStore } from '../stores/scenes.js';
|
||||
|
||||
// The Scene select's options; selecting one stays with SceneControls.
|
||||
const { scenes, listedSceneId, listedRevision } = storeToRefs(useSceneStore());
|
||||
|
||||
// Every option render shows the published scene, as the select did before:
|
||||
// `selected` alone is written only when it changes, so it would leave a
|
||||
// person's later pick standing.
|
||||
const instance = getCurrentInstance();
|
||||
watch(
|
||||
listedRevision,
|
||||
() => {
|
||||
const select = instance.proxy.$el?.parentNode;
|
||||
if (select && listedSceneId.value) select.value = listedSceneId.value;
|
||||
},
|
||||
{ flush: 'post' },
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<option
|
||||
v-for="scene in scenes"
|
||||
:key="scene.id"
|
||||
:value="scene.id"
|
||||
:selected="scene.id === listedSceneId"
|
||||
>{{ scene.title }}</option
|
||||
>
|
||||
</template>
|
||||
@@ -0,0 +1,125 @@
|
||||
<script setup>
|
||||
import { computed, nextTick, ref, watch } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { t } from '../../i18n/index.js';
|
||||
import { describeShot } from '../scenePresentation.js';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
import { useSceneStore } from '../stores/scenes.js';
|
||||
import UiEmpty from '../kit/UiEmpty.vue';
|
||||
|
||||
// The selected scene's shots. Rows keep their identity across selection so a
|
||||
// click followed by a double-click lands on the same label.
|
||||
const store = useSceneStore();
|
||||
const { scenes, selectedSceneId, selectedShotId, attached } =
|
||||
storeToRefs(store);
|
||||
const scene = computed(
|
||||
() => scenes.value.find((item) => item.id === selectedSceneId.value) ?? null,
|
||||
);
|
||||
/** The row being renamed, with the scene it was shown in. */
|
||||
const editing = ref(null);
|
||||
const renameInput = ref(null);
|
||||
|
||||
// A rename ends with its row: another scene, a deleted shot or no owner.
|
||||
watch([scene, attached], () => {
|
||||
if (
|
||||
editing.value &&
|
||||
!(
|
||||
attached.value &&
|
||||
scene.value?.id === editing.value.sceneId &&
|
||||
scene.value.shots.some((shot) => shot.id === editing.value.shotId)
|
||||
)
|
||||
)
|
||||
editing.value = null;
|
||||
});
|
||||
|
||||
// Built-in titles arrive localized as displayTitle; the stored title stays
|
||||
// English, so a rename happens only when the shown text changes.
|
||||
const shownTitle = (shot) => shot.displayTitle || shot.title;
|
||||
const isEditing = (shot) => editing.value?.shotId === shot.id;
|
||||
|
||||
function act(name, shot, ...args) {
|
||||
if (scene.value) store.act(name, scene.value.id, shot.id, ...args);
|
||||
}
|
||||
|
||||
async function startRename(shot) {
|
||||
if (isEditing(shot) || !scene.value) return;
|
||||
editing.value = { sceneId: scene.value.id, shotId: shot.id };
|
||||
await nextTick();
|
||||
const input = renameInput.value?.[0];
|
||||
if (!input) return;
|
||||
// Set once: a re-render while typing keeps what was typed.
|
||||
input.value = shownTitle(shot);
|
||||
input.focus();
|
||||
input.select();
|
||||
}
|
||||
|
||||
function finishRename(shot, input, save) {
|
||||
const rename = editing.value;
|
||||
if (rename?.shotId !== shot.id) return;
|
||||
editing.value = null;
|
||||
const title = input.value.trim();
|
||||
if (save && title && title !== shownTitle(shot))
|
||||
store.act('rename', rename.sceneId, shot.id, title);
|
||||
}
|
||||
|
||||
function onRenameKey(shot, event) {
|
||||
event.stopPropagation();
|
||||
if (event.key === 'Enter' || event.key === 'Escape') {
|
||||
event.preventDefault();
|
||||
finishRename(shot, event.target, event.key === 'Enter');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div id="scene-shot-list" class="scene-shot-list ui-scroll">
|
||||
<template v-if="attached">
|
||||
<UiEmpty
|
||||
v-if="!scene?.shots.length"
|
||||
class="scene-shot-empty"
|
||||
:title="t('No shots yet. Use CAPTURE SHOT to save current look.')"
|
||||
/>
|
||||
<template v-else>
|
||||
<div
|
||||
v-for="shot in scene.shots"
|
||||
:key="shot.id"
|
||||
class="scene-shot-row"
|
||||
:class="{ active: shot.id === selectedShotId }"
|
||||
:data-scene-shot-id="shot.id"
|
||||
>
|
||||
<div class="scene-shot-top">
|
||||
<div
|
||||
class="scene-shot-label"
|
||||
:title="t('Double-click to rename')"
|
||||
@click="store.act('select', shot.id)"
|
||||
@dblclick="startRename(shot)"
|
||||
><input
|
||||
v-if="isEditing(shot)"
|
||||
ref="renameInput"
|
||||
type="text"
|
||||
class="scene-shot-rename"
|
||||
:aria-label="t('Shot name')"
|
||||
@keydown="onRenameKey(shot, $event)"
|
||||
@blur="finishRename(shot, $event.target, true)"
|
||||
/><template v-else>{{ shownTitle(shot) }}</template></div
|
||||
>
|
||||
<div class="scene-shot-actions">
|
||||
<UiButton
|
||||
class="gev-action-button gev-action-button--compact scene-shot-btn"
|
||||
@click="act('load', shot)"
|
||||
>{{ t('LOAD') }}</UiButton
|
||||
>
|
||||
<UiButton
|
||||
tone="alert"
|
||||
class="gev-action-button gev-action-button--danger gev-action-button--compact scene-shot-btn scene-shot-danger"
|
||||
@click="act('remove', shot)"
|
||||
>{{ t('DEL') }}</UiButton
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="scene-shot-meta">{{ describeShot(shot) }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,86 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { msg, t } from '../../i18n/index.js';
|
||||
import {
|
||||
FIRST_RUN_TIP,
|
||||
environmentalLabel,
|
||||
} from '../../firstRunCopy.js';
|
||||
import { useFirstRunStore } from '../stores/firstRun.js';
|
||||
|
||||
// The launcher initFirstRunExperience presents, and the controls it connects.
|
||||
const { launcher, controls } = storeToRefs(useFirstRunStore());
|
||||
// The card stays hidden until it is initialized; these show in the markup.
|
||||
const DESCRIPTION = msg(
|
||||
'It feels like a forbidden cockpit—then you realize the sources are public and the data is real.',
|
||||
);
|
||||
const ENVIRONMENTAL_SUB = msg(
|
||||
'Live earthquakes and active fires, from USGS and NASA',
|
||||
);
|
||||
|
||||
// A refused save puts the box back where the stored preference is.
|
||||
function onSuppress(event) {
|
||||
const box = event.currentTarget;
|
||||
if (controls.value?.suppress(box.checked) === false) box.checked = !box.checked;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- Explicit mission choice on a fresh session. Live feeds are not auto-enabled
|
||||
until the visitor asks; shared links skip this surface entirely. It returns
|
||||
every session until "Don't show this again" is ticked — see
|
||||
src/firstRunExperience.js for the full show policy. -->
|
||||
<aside v-if="!launcher?.removed" id="first-run-launcher" role="dialog" aria-labelledby="first-run-title" aria-describedby="first-run-description" :class="{ visible: launcher?.visible }" :hidden="!launcher?.shown" :aria-hidden="launcher?.closing ? 'true' : undefined" :aria-busy="launcher?.busy ?? undefined" :data-state="launcher?.state ?? undefined">
|
||||
<div class="first-run-scanline" aria-hidden="true"></div>
|
||||
<header class="first-run-header">
|
||||
<span class="first-run-kicker">{{ t('MISSION CONTROL · FIRST LAUNCH') }}</span>
|
||||
</header>
|
||||
<h2 id="first-run-title">{{ t('Choose your first view') }}</h2>
|
||||
<!-- The card's one persuasive line, owner-authored and VERBATIM (2026-08-23)
|
||||
— including the unspaced em dash. The arc it has to carry: this looks
|
||||
like something you should not have access to → the sources are all
|
||||
public → the data is real. Tile subcopy stays purely functional. -->
|
||||
<p id="first-run-description">{{ launcher?.description ?? DESCRIPTION }}</p>
|
||||
<div class="first-run-choices ui-scroll" :data-scrollable="launcher?.scrollable ?? undefined">
|
||||
<button type="button" data-first-run-choice="contacts" :aria-disabled="launcher?.busy ?? undefined" @click="controls?.choose('contacts')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">radar</span>
|
||||
<span><strong>{{ t('LIVE CONTACTS') }}</strong><small>{{ t('Aircraft, vessels and nearby intelligence') }}</small></span>
|
||||
<span class="material-symbols-outlined first-run-arrow" aria-hidden="true">arrow_forward</span>
|
||||
</button>
|
||||
<button type="button" data-first-run-choice="space-missions" :aria-disabled="launcher?.busy ?? undefined" @click="controls?.choose('space-missions')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">rocket_launch</span>
|
||||
<span><strong>{{ t('SPACE MISSIONS') }}</strong><small>{{ t('Launches, spacecraft and orbital context') }}</small></span>
|
||||
<span class="material-symbols-outlined first-run-arrow" aria-hidden="true">arrow_forward</span>
|
||||
</button>
|
||||
<button type="button" data-first-run-choice="environmental" :aria-disabled="launcher?.busy ?? undefined" @click="controls?.choose('environmental')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">local_fire_department</span>
|
||||
<!-- 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 ?? ENVIRONMENTAL_SUB }}</small></span>
|
||||
<span class="material-symbols-outlined first-run-arrow" aria-hidden="true">arrow_forward</span>
|
||||
</button>
|
||||
<button type="button" class="first-run-explore" data-first-run-choice="explore" :aria-disabled="launcher?.busy ?? undefined" @click="controls?.choose('explore')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">public</span>
|
||||
<span><strong>{{ t('EXPLORE MANUALLY') }}</strong><small>{{ t('Begin with a clean globe') }}</small></span>
|
||||
<span class="material-symbols-outlined first-run-arrow" aria-hidden="true">arrow_forward</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="first-run-footer">
|
||||
<label class="first-run-suppress">
|
||||
<input type="checkbox" data-first-run-suppress @change="onSuppress" />
|
||||
<span>{{ t('Don\'t show this again') }}</span>
|
||||
</label>
|
||||
<!-- 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 DISMISS; a keyboard keeps the ESC hint (first-run.css). -->
|
||||
<button type="button" class="first-run-dismiss" data-first-run-dismiss @click="controls?.dismiss()">
|
||||
<span class="first-run-dismiss-key">{{ t('ESC to dismiss') }}</span>
|
||||
<span class="first-run-dismiss-touch">{{ t('DISMISS') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<!-- Kept out of the footer row: it swaps to mission progress and errors, and
|
||||
a live region that also holds layout makes the row jump as it speaks. -->
|
||||
<p class="first-run-note" data-first-run-status role="status" aria-live="polite">{{ launcher?.status ?? FIRST_RUN_TIP }}</p>
|
||||
</aside>
|
||||
</template>
|
||||
@@ -0,0 +1,67 @@
|
||||
import { createApp } from 'vue';
|
||||
import { applicationPinia } from '../vueRuntime.js';
|
||||
import { applicationI18n } from '../i18n.js';
|
||||
import WelcomeView from './WelcomeView.vue';
|
||||
import ContextView from './ContextView.vue';
|
||||
import LayerPanelsView from './LayerPanelsView.vue';
|
||||
import CommandDockView from './CommandDockView.vue';
|
||||
import DisplayControlsView from './DisplayControlsView.vue';
|
||||
import CockpitView from './CockpitView.vue';
|
||||
import SceneChromeView from './SceneChromeView.vue';
|
||||
import ProviderSettingsView from './ProviderSettingsView.vue';
|
||||
import IntelHudView from './IntelHudView.vue';
|
||||
|
||||
/**
|
||||
* Application views by name. A page places each one with a host element,
|
||||
* `<div class="gev-view" data-gev-view="NAME"></div>` (`display: contents`),
|
||||
* where the view's markup belongs.
|
||||
*/
|
||||
export const APPLICATION_VIEWS = Object.freeze({
|
||||
'provider-settings': ProviderSettingsView,
|
||||
'scene-chrome': SceneChromeView,
|
||||
cockpit: CockpitView,
|
||||
'display-controls': DisplayControlsView,
|
||||
'command-dock': CommandDockView,
|
||||
'layer-panels': LayerPanelsView,
|
||||
context: ContextView,
|
||||
welcome: WelcomeView,
|
||||
'intel-hud': IntelHudView,
|
||||
});
|
||||
|
||||
const mounted = new WeakMap();
|
||||
|
||||
/**
|
||||
* Render every application view into its host. Views belong to the page, as
|
||||
* their static markup did, so they are unmounted only when a later call omits
|
||||
* them; omit views before any control code is wired to them. Call before anything
|
||||
* reads or translates the page; repeated calls are harmless.
|
||||
* @param {Document} [doc] Page document.
|
||||
* @param {{omit?: string[]}} [options] Views this page leaves out; their
|
||||
* hosts are removed, unmounting a view an earlier call rendered.
|
||||
*/
|
||||
export function mountApplicationViews(
|
||||
doc = globalThis.document,
|
||||
{ omit = [] } = {},
|
||||
) {
|
||||
for (const name of omit) {
|
||||
if (!Object.hasOwn(APPLICATION_VIEWS, name))
|
||||
throw new Error(`Unknown application view: ${name}`);
|
||||
}
|
||||
for (const host of doc?.querySelectorAll?.('[data-gev-view]') ?? []) {
|
||||
const name = host.getAttribute('data-gev-view');
|
||||
if (omit.includes(name)) {
|
||||
mounted.get(host)?.unmount();
|
||||
mounted.delete(host);
|
||||
host.remove();
|
||||
continue;
|
||||
}
|
||||
if (mounted.has(host)) continue;
|
||||
if (!Object.hasOwn(APPLICATION_VIEWS, name))
|
||||
throw new Error(`Unknown application view: ${name}`);
|
||||
const app = createApp(APPLICATION_VIEWS[name])
|
||||
.use(applicationPinia())
|
||||
.use(applicationI18n());
|
||||
app.mount(host);
|
||||
mounted.set(host, app);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
// src/ui/views/intelHudView.test.mjs — the Intel HUD view renders what
|
||||
// IntelHUD publishes: its readouts, visibility, layout variant and colors.
|
||||
//
|
||||
// hud.js imports `mgrs`, which Node's ESM loader cannot read named exports
|
||||
// from, so a module hook swaps it for a stub before the import (the same
|
||||
// setup as hudPageVisibility.test.mjs).
|
||||
import '../../testSupport/registerDom.mjs';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { createApp, nextTick } from 'vue';
|
||||
import { createPinia } from 'pinia';
|
||||
import { registerHooks } from 'node:module';
|
||||
import { presentSelectedVessel } from '../../hudReadouts.js';
|
||||
import { useHudStore } from '../stores/hud.js';
|
||||
import IntelHudView from './IntelHudView.vue';
|
||||
|
||||
const MGRS_STUB_URL = 'gev-test-stub:mgrs';
|
||||
registerHooks({
|
||||
resolve(specifier, context, next) {
|
||||
if (specifier === 'mgrs') return { url: MGRS_STUB_URL, shortCircuit: true };
|
||||
return next(specifier, context);
|
||||
},
|
||||
load(url, context, next) {
|
||||
if (url === MGRS_STUB_URL) {
|
||||
return {
|
||||
format: 'module',
|
||||
shortCircuit: true,
|
||||
source:
|
||||
'export function forward() { return "10SEG55776339"; }\nexport default { forward };\n',
|
||||
};
|
||||
}
|
||||
return next(url, context);
|
||||
},
|
||||
});
|
||||
|
||||
const { IntelHUD } = await import('../../hud.js');
|
||||
|
||||
const listeners = () => ({ addEventListener() {}, removeEventListener() {} });
|
||||
|
||||
function mount(t) {
|
||||
document.body.replaceChildren();
|
||||
const pinia = createPinia();
|
||||
const store = useHudStore(pinia);
|
||||
const app = createApp(IntelHudView).use(pinia);
|
||||
app.mount(document.body.appendChild(document.createElement('div')));
|
||||
const hud = new IntelHUD(
|
||||
{
|
||||
camera: {
|
||||
pitch: -Math.PI / 2,
|
||||
positionCartographic: { latitude: 0.7, longitude: -1.2, height: 500 },
|
||||
computeViewRectangle: () => undefined,
|
||||
moveStart: listeners(),
|
||||
moveEnd: listeners(),
|
||||
},
|
||||
},
|
||||
{
|
||||
// No AI summary: the readouts are what this test renders.
|
||||
summaryService: { configured: async () => false },
|
||||
publish: (view) => store.publish(view),
|
||||
},
|
||||
);
|
||||
t.after(() => {
|
||||
hud.destroy();
|
||||
presentSelectedVessel(null);
|
||||
app.unmount();
|
||||
});
|
||||
return { hud, root: document.getElementById('intel-hud') };
|
||||
}
|
||||
|
||||
test('the corners are in the document from mount, before IntelHUD presents them', (t) => {
|
||||
document.body.replaceChildren();
|
||||
const pinia = createPinia();
|
||||
const app = createApp(IntelHudView).use(pinia);
|
||||
app.mount(document.body.appendChild(document.createElement('div')));
|
||||
t.after(() => app.unmount());
|
||||
// The panel layout controllers query these synchronously at registration.
|
||||
const root = document.getElementById('intel-hud');
|
||||
assert.equal(root.querySelectorAll('.hud-corner').length, 4);
|
||||
assert.equal(root.querySelectorAll('.hud-edge').length, 2);
|
||||
assert.equal(root.className, '');
|
||||
assert.equal(root.hasAttribute('data-variant'), false);
|
||||
assert.equal(root.getAttribute('style'), null);
|
||||
assert.equal(document.getElementById('hud-summary').textContent, '');
|
||||
assert.equal(root.querySelector('.hud-rec').textContent, '●');
|
||||
});
|
||||
|
||||
test('the first view renders the corners, edges and bottom bar', async (t) => {
|
||||
const { root } = mount(t);
|
||||
await nextTick();
|
||||
assert.equal(root.className, '');
|
||||
assert.equal(root.dataset.variant, 'tactical');
|
||||
assert.deepEqual(
|
||||
[...root.children].map((child) => child.className),
|
||||
[
|
||||
'hud-sonar',
|
||||
'hud-corner hud-top-left',
|
||||
'hud-corner hud-top-right',
|
||||
'hud-corner hud-bottom-left',
|
||||
'hud-corner hud-bottom-right',
|
||||
'hud-edge hud-left-edge',
|
||||
'hud-edge hud-right-edge',
|
||||
'hud-bottom-bar',
|
||||
],
|
||||
);
|
||||
const text = (id) => document.getElementById(id).textContent;
|
||||
assert.equal(text('hud-mode'), 'NORMAL');
|
||||
assert.equal(text('hud-summary'), 'Awaiting telemetry...');
|
||||
assert.equal(text('hud-mgrs'), 'MGRS: ---');
|
||||
assert.equal(text('hud-ais-vessel'), 'AIS: --');
|
||||
assert.equal(
|
||||
root.querySelector('.hud-rec').textContent,
|
||||
'● REC 2026-01-01 00:00:00Z',
|
||||
);
|
||||
assert.equal(
|
||||
document.getElementById('hud-rec-dot').getAttribute('style'),
|
||||
null,
|
||||
);
|
||||
assert.match(
|
||||
root.querySelector('.hud-system').textContent,
|
||||
/^KH11-\d+ {2}OPS-\d+$/,
|
||||
);
|
||||
assert.deepEqual(
|
||||
[...root.querySelectorAll('.hud-right-edge .hud-readout')].map(
|
||||
(line) => line.textContent,
|
||||
),
|
||||
['BAND: PAN', 'BITS: 11', 'LVL: 1A'],
|
||||
);
|
||||
});
|
||||
|
||||
test('visibility, variant, style colors and readouts follow IntelHUD', async (t) => {
|
||||
const { hud, root } = mount(t);
|
||||
hud.onStyleChange('surveillance');
|
||||
hud.setVariant('minimal');
|
||||
hud.setMode('on');
|
||||
await nextTick();
|
||||
assert.equal(root.classList.contains('active'), true);
|
||||
assert.equal(root.dataset.variant, 'minimal');
|
||||
assert.notEqual(root.style.getPropertyValue('--hud-color'), '');
|
||||
assert.equal(document.getElementById('hud-mode').textContent, hud._view.mode);
|
||||
assert.match(document.getElementById('hud-alt').textContent, /^ALT: \d+m/);
|
||||
hud._present({ recShown: false });
|
||||
await nextTick();
|
||||
assert.equal(
|
||||
document.getElementById('hud-rec-dot').style.visibility,
|
||||
'hidden',
|
||||
);
|
||||
hud.setMode('off');
|
||||
await nextTick();
|
||||
assert.equal(root.classList.contains('active'), false);
|
||||
});
|
||||
|
||||
test('the selected vessel readout shows while a vessel is selected', async (t) => {
|
||||
mount(t);
|
||||
presentSelectedVessel({ text: 'AIS: TEST\nCARGO' });
|
||||
await nextTick();
|
||||
const vessel = document.getElementById('hud-ais-vessel');
|
||||
assert.equal(vessel.className, 'hud-ais-vessel active');
|
||||
assert.equal(vessel.textContent, 'AIS: TEST\nCARGO');
|
||||
presentSelectedVessel(null);
|
||||
await nextTick();
|
||||
assert.equal(vessel.className, 'hud-ais-vessel');
|
||||
assert.equal(vessel.textContent, 'AIS: --');
|
||||
});
|
||||
@@ -0,0 +1,77 @@
|
||||
// src/ui/views/mountApplicationViews.test.mjs — a page's view hosts render
|
||||
// their views, and an application can leave views out, over happy-dom.
|
||||
import '../../testSupport/registerDom.mjs';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { createApplication } from '../../app/application.js';
|
||||
import { mountApplicationViews } from './index.js';
|
||||
|
||||
function page(names) {
|
||||
document.body.replaceChildren();
|
||||
for (const name of names) {
|
||||
const host = document.createElement('div');
|
||||
host.className = 'gev-view';
|
||||
host.setAttribute('data-gev-view', name);
|
||||
document.body.append(host);
|
||||
}
|
||||
}
|
||||
|
||||
const hostNames = () =>
|
||||
[...document.querySelectorAll('[data-gev-view]')].map((host) =>
|
||||
host.getAttribute('data-gev-view'),
|
||||
);
|
||||
|
||||
test('omitted views lose their hosts and the rest render', () => {
|
||||
page(['welcome', 'provider-settings']);
|
||||
mountApplicationViews(document, { omit: ['provider-settings'] });
|
||||
assert.deepEqual(hostNames(), ['welcome']);
|
||||
assert.equal(document.getElementById('key-setup-chip'), null);
|
||||
assert.ok(
|
||||
document.querySelector('[data-gev-view="welcome"]').children.length,
|
||||
);
|
||||
});
|
||||
|
||||
test('a view an earlier call rendered is unmounted when a later call omits it', () => {
|
||||
page(['welcome', 'provider-settings']);
|
||||
mountApplicationViews(document);
|
||||
assert.ok(document.getElementById('key-setup-chip'));
|
||||
mountApplicationViews(document, { omit: ['provider-settings'] });
|
||||
assert.deepEqual(hostNames(), ['welcome']);
|
||||
assert.equal(document.getElementById('key-setup-chip'), null);
|
||||
});
|
||||
|
||||
test('unknown view names are refused, in the page or in the omit list', () => {
|
||||
page([]);
|
||||
for (const name of ['toString', 'constructor'])
|
||||
assert.throws(
|
||||
() => mountApplicationViews(document, { omit: [name] }),
|
||||
/Unknown application view/,
|
||||
);
|
||||
page(['toString']);
|
||||
assert.throws(
|
||||
() => mountApplicationViews(document),
|
||||
/Unknown application view/,
|
||||
);
|
||||
assert.throws(
|
||||
() => mountApplicationViews(document, { omit: ['nope'] }),
|
||||
/Unknown application view: nope/,
|
||||
);
|
||||
page(['nope']);
|
||||
assert.throws(
|
||||
() => mountApplicationViews(document),
|
||||
/Unknown application view: nope/,
|
||||
);
|
||||
});
|
||||
|
||||
test('createApplication leaves out the views its omitViews names', () => {
|
||||
page(['welcome', 'provider-settings']);
|
||||
const noop = () => ({});
|
||||
createApplication({
|
||||
createScene: noop,
|
||||
createControls: noop,
|
||||
createData: noop,
|
||||
createTools: noop,
|
||||
omitViews: ['provider-settings'],
|
||||
});
|
||||
assert.deepEqual(hostNames(), ['welcome']);
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useAwarenessDirectionStore } from '../../stores/awarenessDirection.js';
|
||||
|
||||
// The Global Context compass and the nearest contacts' bearings, inside the
|
||||
// viewer's container, as the awareness layer presents them.
|
||||
const { overlay } = storeToRefs(useAwarenessDirectionStore());
|
||||
|
||||
// A part keeps no inline placement until the layer first places it.
|
||||
const place = (part) =>
|
||||
part.left === null ? undefined : { left: part.left, top: part.top };
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport v-if="overlay" :to="overlay.container">
|
||||
<div id="military-awareness-direction-overlay" :hidden="overlay.hidden" aria-hidden="true"><span v-for="label in overlay.labels" :key="label.label" :class="`military-awareness-compass-label cardinal-${label.label.toLowerCase()}`" :data-bearing="String(label.bearing)" :style="place(label)">{{ label.label }}</span><div class="military-awareness-compass-ring" :style="overlay.ring ?? undefined"></div><span class="military-awareness-compass-heading" :style="place(overlay.heading)">{{ overlay.heading.text }}</span><div v-for="(marker, index) in overlay.markers" :key="index" class="military-awareness-direction-marker" :hidden="marker.hidden" :style="marker.style ?? undefined"><span class="military-awareness-direction-arrow" :style="marker.arrow ?? undefined">➜</span><span class="military-awareness-direction-label" :style="marker.caption.style ?? undefined">{{ marker.caption.text }}</span></div></div>
|
||||
</Teleport>
|
||||
</template>
|
||||
@@ -0,0 +1,8 @@
|
||||
<script setup>
|
||||
// The named areas of a Contacts subject or contact, one per line.
|
||||
defineProps({ names: { type: Object, required: true } });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<details class="military-awareness-names"><summary>{{ names.summary }}</summary><div class="ui-scroll"><template v-for="(name, index) in names.names" :key="index"><br v-if="index">{{ name }}</template></div></details>
|
||||
</template>
|
||||
@@ -0,0 +1,75 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { onBeforeUpdate, onUpdated, ref } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { useContextStore } from '../../stores/context.js';
|
||||
import AwarenessNames from './AwarenessNames.vue';
|
||||
|
||||
// The Contacts panel inside Context. The Contacts layer publishes its view
|
||||
// (standby, results or empty); until it does, the panel shows its initial
|
||||
// markup. Buttons call the layer's navigation as the person's own.
|
||||
const { awareness: view, awarenessLayer: layer } = storeToRefs(useContextStore());
|
||||
const user = { origin: 'user' };
|
||||
const root = ref(null);
|
||||
|
||||
// A live repaint keeps focus on the same control by identity: browsers drop
|
||||
// focus from a node Vue moves, removes or disables, so the control is found
|
||||
// again by its key. When it is gone or disabled, focus continues at the note
|
||||
// beyond the list rather than jumping to another contact.
|
||||
const CONTINUATION = '[data-awareness-focus-continuation]';
|
||||
const controlKey = (el) => {
|
||||
if (el?.matches?.(CONTINUATION)) return 'continuation';
|
||||
const { awarenessAction: action, awarenessLayer: layer, awarenessId: id } = el?.dataset ?? {};
|
||||
if (action) return `action:${action}`;
|
||||
return layer && id ? `target:${layer}:${id}` : null;
|
||||
};
|
||||
let focusedKey = null;
|
||||
onBeforeUpdate(() => {
|
||||
const active = document.activeElement;
|
||||
focusedKey = root.value?.contains(active) ? controlKey(active) ?? 'continuation' : null;
|
||||
});
|
||||
onUpdated(() => {
|
||||
const key = focusedKey;
|
||||
focusedKey = null;
|
||||
const panel = root.value;
|
||||
// A disabled control may keep focus until the browser's next frame.
|
||||
const active = document.activeElement;
|
||||
if (!key || !panel || (panel.contains(active) && !active.disabled)) return;
|
||||
const retained = key === 'continuation' ? null : [...panel.querySelectorAll('button[data-awareness-action], button[data-awareness-id]')].find((control) => !control.disabled && controlKey(control) === key);
|
||||
(retained || panel.querySelector(CONTINUATION))?.focus({ preventScroll: true });
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside id="military-awareness-panel" class="ui-scroll" ref="root">
|
||||
<div v-if="!view" class="military-awareness-standby">
|
||||
<strong>{{ t('CONTACTS CONTEXT OFF') }}</strong>
|
||||
<span>{{ t('SELECT CONTACTS TO LOAD OBSERVED / MAPPED PROXIMITY') }}</span>
|
||||
</div>
|
||||
<div v-else-if="view.kind === 'standby'" class="military-awareness-standby">
|
||||
<strong>{{ view.title }}</strong>
|
||||
<span>{{ view.text }}</span>
|
||||
</div>
|
||||
<template v-else-if="view.kind === 'results'">
|
||||
<div class="military-awareness-subject">{{ view.subject }}</div>
|
||||
<AwarenessNames v-if="view.subjectNames" :names="view.subjectNames" />
|
||||
<div class="military-awareness-controls" role="group" :aria-label="view.navigation.label">
|
||||
<button type="button" data-awareness-action="previous" :title="view.navigation.previous.title" :disabled="view.navigation.previous.disabled" @click="layer?.navigatePrevious(user)">{{ view.navigation.previous.text }}</button>
|
||||
<button type="button" data-awareness-action="focus" @click="layer?.focusCurrent(user)">{{ view.navigation.focus.text }}</button>
|
||||
<button type="button" data-awareness-action="next" :title="view.navigation.next.title" :disabled="view.navigation.next.disabled" @click="layer?.navigateNext(user)">{{ view.navigation.next.text }}</button>
|
||||
</div>
|
||||
<section v-for="row in view.rows" :key="row.id" :class="['military-awareness-row', row.relationship]">
|
||||
<div><strong>{{ row.label }}</strong><b aria-live="polite">{{ row.count }}</b></div>
|
||||
<small>{{ row.detail }}</small>
|
||||
<ul v-if="row.nearest.length">
|
||||
<li v-for="item in row.nearest" :key="item.key">
|
||||
<button v-if="item.targetId" type="button" class="military-awareness-target" :data-awareness-layer="item.layer" :data-awareness-id="item.targetId" :aria-label="item.ariaLabel" @click="layer?.focusTarget(item.layer, item.targetId, user)">{{ item.label }} <span>{{ item.distance }}</span></button>
|
||||
<span v-else class="military-awareness-target unavailable" :aria-label="item.ariaLabel">{{ item.label }} <span>{{ item.distance }}</span></span>
|
||||
<AwarenessNames v-if="item.names" :names="item.names" />
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<p class="military-awareness-note" tabindex="-1" data-awareness-focus-continuation>{{ view.note }}</p>
|
||||
</template>
|
||||
</aside>
|
||||
</template>
|
||||
@@ -0,0 +1,73 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { useBhoteKoshiPanelStore } from '../../stores/bhoteKoshiPanel.js';
|
||||
import UiSlider from '../../kit/UiSlider.js';
|
||||
|
||||
// The Bhote Koshi reconstruction controls, at the end of the context rail,
|
||||
// as the event layer (src/data/bhoteKoshiEvent.js) presents them. Clicks and
|
||||
// slider moves go back to the layer.
|
||||
const { panel, controls } = storeToRefs(useBhoteKoshiPanelStore());
|
||||
const call = (name, ...args) => controls.value?.[name]?.(...args);
|
||||
const sliderValue = (event, scale) => Number(event.target.value) / scale;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside v-if="panel" id="bhote-koshi-event-panel" :class="{ 'bhote-event-scene-beat': panel.sceneBeat }" :aria-label="t('Bhote Koshi flood reconstruction controls')">
|
||||
<div class="bhote-event-header">
|
||||
<div>
|
||||
<div class="bhote-event-kicker">{{ t('EVENT RECONSTRUCTION · 26 AUG 2026') }}</div>
|
||||
<div class="bhote-event-title">{{ t('BHOTE KOSHI OUTBURST FLOOD') }}</div>
|
||||
</div>
|
||||
<button class="bhote-event-icon-btn" type="button" data-action="close" :title="t('Close event layer')" :aria-label="t('Close event layer')" @click="call('close')">×</button>
|
||||
</div>
|
||||
<div class="bhote-event-status-row">
|
||||
<span class="bhote-event-status observed" :hidden="panel.refs.observedStatus.hidden">{{ t('OBSERVED IMAGERY') }}</span>
|
||||
<span class="bhote-event-status reconstructed">{{ t('SCHEMATIC CORRIDOR') }}</span>
|
||||
</div>
|
||||
<section class="bhote-event-section" data-role="imagery-comparison" :hidden="panel.refs.imagerySection.hidden">
|
||||
<div class="bhote-event-section-head">
|
||||
<span>{{ t('2021 HISTORICAL REFERENCE / 2026 POST-EVENT') }}</span>
|
||||
<span data-role="split-readout">{{ panel.refs.splitReadout.textContent }}</span>
|
||||
</div>
|
||||
<UiSlider class="bhote-event-range" unstyled data-role="split" min="0" max="100" :model-value="panel.refs.splitInput.value" :aria-label="t('Historical reference and post-event image split')" @update:model-value="call('setSplit', $event / 100)" />
|
||||
<div class="bhote-event-dates">
|
||||
<span data-role="before-date">{{ panel.beforeDate.date ? `${panel.beforeDate.name} · ` : panel.beforeDate.name }}<span v-if="panel.beforeDate.date" class="bhote-event-date">{{ panel.beforeDate.date }}</span></span>
|
||||
<span data-role="after-date">{{ panel.afterDate.date ? `${panel.afterDate.name} · ` : panel.afterDate.name }}<span v-if="panel.afterDate.date" class="bhote-event-date">{{ panel.afterDate.date }}</span></span>
|
||||
</div>
|
||||
</section>
|
||||
<section class="bhote-event-section">
|
||||
<div class="bhote-event-section-head">
|
||||
<span data-role="timeline-label">{{ panel.refs.timelineLabel.textContent }}</span>
|
||||
<span data-role="time">{{ panel.refs.time.textContent }}</span>
|
||||
</div>
|
||||
<UiSlider class="bhote-event-range flood" unstyled data-role="progress" min="0" max="1000" :model-value="panel.refs.progressInput.value" :hidden="panel.refs.progressInput.hidden" :disabled="panel.refs.progressInput.disabled" :aria-label="panel.refs.progressInput.attributes['aria-label']" @update:model-value="call('previewProgress', $event / 1000)" @change="call('commitProgress', sliderValue($event, 1000), { final: true })" />
|
||||
<div class="bhote-event-story-nav" :aria-label="t('Story beat navigation')">
|
||||
<button type="button" data-action="previous-beat" :title="t('Previous story beat')" :aria-label="panel.refs.previousButton.attributes['aria-label']" :disabled="panel.refs.previousButton.disabled" @click="call('previousBeat')">‹</button>
|
||||
<div class="bhote-event-story-current">
|
||||
<span data-role="beat-index">{{ panel.refs.beatIndex.textContent }}</span>
|
||||
<strong data-role="beat-title" aria-live="polite">{{ panel.refs.beatTitle.textContent }}</strong>
|
||||
<small data-role="beat-meta">{{ panel.refs.beatMeta.textContent }}</small>
|
||||
</div>
|
||||
<button type="button" data-action="next-beat" :title="t('Next story beat')" :aria-label="panel.refs.nextButton.attributes['aria-label']" :disabled="panel.refs.nextButton.disabled" @click="call('nextBeat')">›</button>
|
||||
</div>
|
||||
<div class="bhote-event-actions">
|
||||
<button type="button" data-action="play" :aria-label="panel.refs.playButton.attributes['aria-label']" :disabled="panel.refs.playButton.disabled" @click="call('play')">{{ panel.refs.playButton.textContent }}</button>
|
||||
<button type="button" data-action="play-scene" :hidden="panel.refs.playSceneButton.hidden" :title="t('Play the next shot and continue through this scene')" :aria-label="panel.refs.playSceneButton.attributes['aria-label']" :disabled="panel.refs.playSceneButton.disabled" @click="call('playScene')">{{ panel.refs.playSceneButton.textContent }}</button>
|
||||
<button type="button" data-action="cinematic" :aria-pressed="panel.refs.cinematicButton.attributes['aria-pressed']" :hidden="panel.refs.cinematicButton.hidden" :disabled="panel.refs.cinematicButton.disabled" @click="call('toggleCinematic')">{{ panel.refs.cinematicButton.textContent }}</button>
|
||||
<button type="button" data-action="story-replay" :aria-label="panel.refs.storyReplayButton.attributes['aria-label']" :hidden="panel.refs.storyReplayButton.hidden" :disabled="panel.refs.storyReplayButton.disabled" @click="call('replayCinematic')">{{ panel.refs.storyReplayButton.textContent }}</button>
|
||||
<button type="button" data-action="open-source" :hidden="panel.refs.openSourceButton.hidden" :disabled="panel.refs.openSourceButton.disabled" @click="call('openActiveSource')">{{ t('↗ OPEN ORIGINAL') }}</button>
|
||||
<button type="button" data-action="corridor" :hidden="panel.refs.corridorButton.hidden" :disabled="panel.refs.corridorButton.disabled" @click="call('focusCorridor')">{{ t('⌖ LOWER GORGE') }}</button>
|
||||
</div>
|
||||
</section>
|
||||
<details class="bhote-event-evidence">
|
||||
<summary>{{ t('FIELD REPORTS · {count}', { count: panel.reports.length }) }}</summary>
|
||||
<div class="bhote-event-report-list"><button v-for="(report, index) in panel.reports" :key="index" type="button" class="bhote-event-report" @click="call('openReport', index)"><span>{{ report.label }}</span><small>{{ report.status }}</small></button></div>
|
||||
</details>
|
||||
<div class="bhote-event-credit">
|
||||
<span>{{ t('GEOLOCATIONS · {credit}', { credit: 'GEO GEORGE SHADRACH' }) }}</span>
|
||||
<button type="button" data-action="geolocation-map" @click="call('openGeolocationMap')">{{ t('↗ OPEN PUBLIC MAP') }}</button>
|
||||
</div>
|
||||
<p class="bhote-event-caveat"><span data-role="caveat">{{ panel.refs.caveat.textContent }}</span><span data-role="imagery-cloud-note" :hidden="panel.refs.imageryCloudNote.hidden">{{ t(' Clouds are preserved from the source imagery.') }}</span></p>
|
||||
</aside>
|
||||
</template>
|
||||
@@ -0,0 +1,82 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import RailPanel from '../../rail/RailPanel.vue';
|
||||
import CctvCalValue from '../../cctv/CctvCalValue.vue';
|
||||
import CctvPicker from '../../cctv/CctvPicker.vue';
|
||||
import { useCctvStore } from '../../stores/cctv.js';
|
||||
import UiBadge from '../../kit/UiBadge.vue';
|
||||
|
||||
// The CCTV panel, rendered from what CctvControls presents and publishes;
|
||||
// until it renders, the panel shows its initial markup. The controls draw
|
||||
// the live video into its canvas.
|
||||
const { view, frame, live, sourceBadge, summary } = storeToRefs(useCctvStore());
|
||||
// The frame's request state, as data attributes that read "true" or are
|
||||
// empty; none until the controls first publish.
|
||||
const flag = (on) => (on ? 'true' : '');
|
||||
const frameData = computed(() =>
|
||||
frame.value
|
||||
? {
|
||||
'data-camera-id': frame.value.cameraId,
|
||||
'data-current-src': frame.value.currentSrc,
|
||||
'data-loading': flag(frame.value.loading),
|
||||
'data-error': flag(frame.value.error),
|
||||
}
|
||||
: {},
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RailPanel id="cctv-panel" start-collapsed :title="t('CCTV')" sideways scroll rail-scroller>
|
||||
<div class="cyber-panel-body ui-scroll" data-rail-scroller>
|
||||
<div id="cctv-frame-wrap" :class="['cctv-frame-wrap', { loading: frame?.wrapLoading, 'has-frame': frame?.hasFrame }]">
|
||||
<span class="cctv-frame-caption" aria-hidden="true">{{ t('ACQUIRING FRAME') }}</span>
|
||||
<img id="cctv-frame" alt="CCTV feed frame" :class="{ active: frame?.hasFrame }" :src="frame?.src || undefined" :hidden="live" v-bind="frameData" />
|
||||
<canvas id="cctv-video" class="cctv-frame" :hidden="!live"></canvas>
|
||||
</div>
|
||||
<UiBadge id="cctv-source-badge" role="status" aria-live="polite" :data-frame-state="sourceBadge?.state">{{ sourceBadge?.label ?? t('SOURCE · UNKNOWN') }}</UiBadge>
|
||||
<div id="cctv-meta">{{ view?.meta ?? t('Enable CCTV to load camera intersections') }}</div>
|
||||
<div class="cctv-controls">
|
||||
<UiButton class="scene-btn" :pressed="Boolean(view?.enabled)" pressed-class="active" id="cctv-enable-btn">{{ view?.enabled ? t('CCTV ON') : t('CCTV OFF') }}</UiButton>
|
||||
<UiButton id="cctv-nearest-btn" type="button" class="gev-action-button scene-btn" :disabled="view?.navDisabled">{{ t('NEAREST') }}</UiButton>
|
||||
</div>
|
||||
<div class="cctv-controls">
|
||||
<UiButton id="cctv-prev-btn" type="button" class="gev-action-button scene-btn" :disabled="view?.navDisabled">{{ t('PREV') }}</UiButton>
|
||||
<CctvPicker class="gev-field" id="cctv-camera-select" :aria-label="t('CCTV camera')" />
|
||||
<UiButton id="cctv-next-btn" type="button" class="gev-action-button scene-btn" :disabled="view?.navDisabled">{{ t('NEXT') }}</UiButton>
|
||||
</div>
|
||||
<div class="cctv-controls">
|
||||
<UiButton id="cctv-focus-btn" type="button" class="gev-action-button scene-btn" :disabled="view?.focusDisabled">{{ t('FOCUS') }}</UiButton>
|
||||
<UiButton class="scene-btn" :pressed="Boolean(view?.coverage.active)" pressed-class="active" id="cctv-coverage-btn" :disabled="view?.toggleDisabled">{{ view?.coverage.text ?? t('COVERAGE OFF') }}</UiButton>
|
||||
<UiButton class="scene-btn" :pressed="Boolean(view?.autoHop.active)" pressed-class="active" id="cctv-auto-hop-btn" :disabled="view?.toggleDisabled">{{ view?.autoHop.text ?? t('AUTO HOP OFF') }}</UiButton>
|
||||
</div>
|
||||
<div class="cctv-controls">
|
||||
<UiButton class="scene-btn" :pressed="Boolean(view?.projection.active)" pressed-class="active" id="cctv-projection-btn" :disabled="view?.toggleDisabled">{{ view?.projection.text ?? t('PROJECTION ON') }}</UiButton>
|
||||
<UiBadge id="cctv-quality-chip" class="gev-status-badge--box" :data-cal-badge="view?.quality.calBadge">{{ view?.quality.label ?? t('CAL · {badge}', { badge: '--' }) }}</UiBadge>
|
||||
</div>
|
||||
<div class="cctv-calibration-block">
|
||||
<div class="cctv-calibration-header">
|
||||
<div class="cctv-summary-label">{{ t('CALIBRATION') }}</div>
|
||||
<UiButton class="scene-btn" :pressed="Boolean(view?.calibration.adjust.active)" pressed-class="active" id="cctv-adjust-btn" :title="t('Drag the camera in the world: rings rotate, arrows move, handles set range/FOV')" :disabled="view?.calibration.disabled">{{ view?.calibration.adjust.text ?? t('ADJUST') }}</UiButton>
|
||||
</div>
|
||||
<div id="cctv-cal-readout" class="cctv-cal-readout" :aria-label="t('Camera pose — click a value to type')">
|
||||
<CctvCalValue field="heading" label="HDG" :title="t('Heading (compass °) — click to type')" />
|
||||
<CctvCalValue field="pitch" label="PITCH" :title="t('Pitch (° up/down) — click to type')" />
|
||||
<CctvCalValue field="fov" label="FOV" :title="t('Horizontal FOV (°) — click to type')" />
|
||||
<CctvCalValue field="range" label="RANGE" :title="t('Range / monitor-plane distance (m) — click to type')" />
|
||||
<CctvCalValue field="height" label="HGT" :title="t('Mount height above ground (m) — click to type')" />
|
||||
<CctvCalValue field="north" label="ΔN" :title="t('North offset from catalog position (m) — click to type')" />
|
||||
<CctvCalValue field="east" label="ΔE" :title="t('East offset from catalog position (m) — click to type')" />
|
||||
</div>
|
||||
<div class="cctv-controls cctv-calibration-actions">
|
||||
<UiButton id="cctv-calib-save-btn" type="button" class="gev-action-button scene-btn" :disabled="view?.calibration.disabled">{{ t('SAVE CAL') }}</UiButton>
|
||||
<UiButton id="cctv-calib-reset-btn" type="button" class="gev-action-button scene-btn" :disabled="view?.calibration.disabled">{{ t('RESET CAL') }}</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cctv-summary-label">{{ t('SCENE SUMMARY') }}</div>
|
||||
<div id="cctv-summary">{{ summary ?? t('Enable CCTV to start camera-linked intelligence summaries.') }}</div>
|
||||
</div>
|
||||
</RailPanel>
|
||||
</template>
|
||||
@@ -0,0 +1,49 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useCelestialRingStore } from '../../stores/celestialRing.js';
|
||||
|
||||
// The full-globe sun/moon ring, inside the viewer's container, as the ring
|
||||
// owner (src/celestialRing.js) presents it.
|
||||
const { ring, controls } = storeToRefs(useCelestialRingStore());
|
||||
|
||||
// Each canvas goes to the owner it was rendered for, which paints it.
|
||||
const vRingCanvas = {
|
||||
mounted(el, { value }) {
|
||||
controls.value?.attach(value.owner, value.kind, el);
|
||||
},
|
||||
beforeUnmount(el, { value }) {
|
||||
controls.value?.attach(value.owner, value.kind, null);
|
||||
},
|
||||
};
|
||||
const px = (value) => `${value}px`;
|
||||
const layerStyle = (layer) => ({
|
||||
...(ring.value.size && {
|
||||
width: px(ring.value.size.width),
|
||||
height: px(ring.value.size.height),
|
||||
}),
|
||||
...(layer && { transform: layer.transform, opacity: layer.opacity }),
|
||||
});
|
||||
// The outline is hidden before it has ever been placed.
|
||||
const outlineStyle = (outline) =>
|
||||
outline && {
|
||||
display: outline.hidden ? 'none' : '',
|
||||
...(outline.width != null && {
|
||||
left: px(outline.left),
|
||||
top: px(outline.top),
|
||||
width: px(outline.width),
|
||||
height: px(outline.height),
|
||||
}),
|
||||
};
|
||||
const markerStyle = (marker) =>
|
||||
marker && {
|
||||
left: px(marker.left),
|
||||
top: px(marker.top),
|
||||
opacity: marker.opacity,
|
||||
};
|
||||
</script>
|
||||
|
||||
<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>
|
||||
</Teleport>
|
||||
</template>
|
||||
@@ -0,0 +1,92 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed, useTemplateRef } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { createBriefState } from '../../cockpitBriefPages.js';
|
||||
import { useCockpitStore } from '../../stores/cockpit.js';
|
||||
import CockpitRoute from './CockpitRoute.vue';
|
||||
import CockpitSignalList from './CockpitSignalList.vue';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
|
||||
// The Cockpit briefing card. The Cockpit controller presents its pages,
|
||||
// cycle toggle, regional news and local conditions; until it does, the card
|
||||
// shows the state it starts in. The controls keep the controller's
|
||||
// listeners. The route card and the signal rows render themselves.
|
||||
const { presence, brief } = storeToRefs(useCockpitStore());
|
||||
const initial = createBriefState();
|
||||
const b = computed(() => brief.value ?? initial);
|
||||
// The card's collapse, which its toggle and data-collapsed show.
|
||||
const collapsed = computed(() => !!presence.value?.signalCollapsed);
|
||||
// The card's page and the region's answer, as state hooks on the card.
|
||||
const streamState = computed(() => ({
|
||||
'data-brief-page': brief.value?.pageId,
|
||||
'data-regional-status': brief.value?.regionalStatus || undefined,
|
||||
'data-collapsed': presence.value ? String(collapsed.value) : undefined,
|
||||
}));
|
||||
// A departed contact cannot stay selectable. Its row hands focus to the
|
||||
// shown page's tab, which stays, so keyboard traversal carries on from the
|
||||
// card's footer instead of the top of the page.
|
||||
const stream = useTemplateRef('stream');
|
||||
function leaveSignals() {
|
||||
const card = stream.value;
|
||||
(
|
||||
card?.querySelector(`[data-cockpit-brief-index="${b.value.pageIndex}"]`) ??
|
||||
card?.querySelector('#cockpit-signal-toggle')
|
||||
)?.focus({ preventScroll: true });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside id="cockpit-signal-stream" class="cockpit-signal-window" :aria-label="t('Cockpit briefing carousel')" :hidden="!presence?.active" v-bind="streamState" ref="stream">
|
||||
<CockpitRoute />
|
||||
<header class="cockpit-card-header cockpit-signal-header">
|
||||
<div class="cockpit-brief-heading">
|
||||
<span id="cockpit-brief-kicker" class="cockpit-card-kicker cockpit-signal-kicker"><i aria-hidden="true"></i> {{ b.kicker }}</span>
|
||||
<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>
|
||||
<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-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>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="cockpit-brief-stage">
|
||||
<section data-cockpit-brief-page="signals" :aria-label="t('Live signals')" :hidden="b.pageId !== 'signals'">
|
||||
<CockpitSignalList :leave="leaveSignals" />
|
||||
</section>
|
||||
<section data-cockpit-brief-page="news" :aria-label="t('Latest regional news')" :hidden="b.pageId !== 'news'">
|
||||
<div id="cockpit-news-status" class="cockpit-brief-status" :hidden="b.news.statusHidden" :data-state="b.news.state ?? undefined">{{ b.news.status }}</div>
|
||||
<ol id="cockpit-news-list" class="cockpit-news-list" aria-live="polite"><li v-for="article in b.news.articles" :key="article.key"><a :href="article.url" target="_blank" rel="noopener noreferrer"><strong>{{ article.title }}</strong><span>{{ article.meta }}</span></a></li></ol>
|
||||
</section>
|
||||
<section data-cockpit-brief-page="local" :aria-label="t('Location-based information')" :hidden="b.pageId !== 'local'">
|
||||
<div class="cockpit-local-place">
|
||||
<strong id="cockpit-local-place">{{ b.local.place }}</strong>
|
||||
<small id="cockpit-local-coordinates">{{ b.local.coordinates }}</small>
|
||||
</div>
|
||||
<div class="cockpit-local-grid">
|
||||
<div><span>{{ t('TEMP') }}</span><strong id="cockpit-local-temperature">{{ b.local.temperature }}</strong><small translate="no">OPEN-METEO</small></div>
|
||||
<div><span>{{ t('WIND') }}</span><strong id="cockpit-local-wind">{{ b.local.wind }}</strong><small id="cockpit-local-wind-direction">{{ b.local.windDirection }}</small></div>
|
||||
<div><span>{{ t('SKY') }}</span><strong id="cockpit-local-condition">{{ b.local.condition }}</strong><small id="cockpit-local-cloud">{{ b.local.cloud }}</small></div>
|
||||
<div><span>{{ t('PRECIP') }}</span><strong id="cockpit-local-precipitation">{{ b.local.precipitation }}</strong><small>{{ t('MM') }}</small></div>
|
||||
</div>
|
||||
<a class="cockpit-weather-credit" href="https://open-meteo.com/" target="_blank" rel="noopener">{{ t('Weather data by Open-Meteo.com') }}</a>
|
||||
</section>
|
||||
</div>
|
||||
<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>
|
||||
</nav>
|
||||
</footer>
|
||||
</aside>
|
||||
</template>
|
||||
@@ -0,0 +1,75 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { createContextState } from '../../cockpitContextState.js';
|
||||
import { vClassToggle } from '../../rail/classToggle.js';
|
||||
import { useCockpitStore } from '../../stores/cockpit.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
|
||||
// The Cockpit Contact card. The Cockpit controller presents its scope,
|
||||
// navigation, cohort counts, nearest contact and weather toggle; until it
|
||||
// does, the card shows the state it starts in. Its visibility and collapse
|
||||
// render from the presence; its layout stays with the controller, and the
|
||||
// controls keep its listeners.
|
||||
const { presence, context } = storeToRefs(useCockpitStore());
|
||||
const initial = createContextState();
|
||||
const c = computed(() => context.value ?? initial);
|
||||
const directionStyle = computed(() =>
|
||||
c.value.direction.angle === null
|
||||
? undefined
|
||||
: { transform: `rotate(${c.value.direction.angle}deg)` },
|
||||
);
|
||||
const collapsed = computed(() => !!presence.value?.contextCollapsed);
|
||||
const weatherLabel = computed(() =>
|
||||
c.value.weather
|
||||
? t('Disable cockpit weather effects')
|
||||
: t('Enable cockpit weather effects'),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside id="cockpit-context" class="cockpit-context-window" :aria-label="t('Contact cockpit summary')" :hidden="!presence?.context" :data-state="c.state ?? undefined" :data-collapsed="presence ? String(collapsed) : undefined">
|
||||
<header class="cockpit-card-header cockpit-context-header">
|
||||
<div>
|
||||
<span class="cockpit-card-kicker cockpit-context-kicker">{{ t('CONTACT') }}</span>
|
||||
<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>
|
||||
</nav>
|
||||
<span class="cockpit-context-qualifier">{{ t('CONTEXT ONLY') }}</span>
|
||||
</header>
|
||||
<div class="cockpit-context-cohorts" role="list" :aria-label="t('Nearby cohort counts')">
|
||||
<div v-class-toggle="{ unknown: c.cohorts.flights.unknown }" role="listitem" data-context-cohort="flights"><span>{{ t('FLT') }}</span><strong>{{ c.cohorts.flights.count }}</strong><small translate="no">OpenSky</small></div>
|
||||
<div v-class-toggle="{ unknown: c.cohorts.military.unknown }" role="listitem" data-context-cohort="military"><span>{{ t('MIL') }}</span><strong>{{ c.cohorts.military.count }}</strong><small translate="no">adsb.lol</small></div>
|
||||
<div v-class-toggle="{ unknown: c.cohorts['ais-live-vessels'].unknown }" role="listitem" data-context-cohort="ais-live-vessels"><span translate="no">AIS</span><strong>{{ c.cohorts['ais-live-vessels'].count }}</strong><small translate="no">AISStream</small></div>
|
||||
<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">OpenStreetMap</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>
|
||||
<div>
|
||||
<small>{{ t('NEAREST OBSERVED / MAPPED') }}</small>
|
||||
<strong id="cockpit-context-nearest-label" :aria-label="c.nearest.ariaLabel ?? undefined">{{ c.nearest.label }}</strong>
|
||||
</div>
|
||||
<span id="cockpit-context-bearing">{{ c.bearing }}</span>
|
||||
<span id="cockpit-context-distance" :aria-label="c.distance.ariaLabel ?? undefined">{{ c.distance.text }}</span>
|
||||
</div>
|
||||
<footer class="cockpit-context-footer">
|
||||
<span id="cockpit-context-uncertainty">{{ c.uncertainty }}</span>
|
||||
<UiButton id="cockpit-weather-toggle" class="cockpit-context-weather" :aria-label="weatherLabel" :pressed="Boolean(c.weather)" :title="weatherLabel">
|
||||
<span>{{ t('WX') }}</span>
|
||||
<strong id="cockpit-weather-state">{{ c.weather ? t('ON') : t('OFF') }}</strong>
|
||||
</UiButton>
|
||||
<time id="cockpit-context-updated">{{ c.updated }}</time>
|
||||
</footer>
|
||||
</aside>
|
||||
</template>
|
||||
@@ -0,0 +1,38 @@
|
||||
<script setup>
|
||||
import { shallowRef, watch } from 'vue';
|
||||
import {
|
||||
advanceRollingValue,
|
||||
createRollingState,
|
||||
} from '../../cockpitRollingValue.js';
|
||||
|
||||
// One Cockpit odometer readout. Every reading the controller publishes is a
|
||||
// fresh object, so each one restamps the throttle just as the controller's
|
||||
// own repeated writes did. The view takes the last reading of a tick, so
|
||||
// the controller publishes one per HUD update. Until the first reading, the
|
||||
// placeholder shows.
|
||||
// The template is one line: templates keep whitespace, and a space between
|
||||
// glyphs would show.
|
||||
const props = defineProps({
|
||||
tag: { type: String, default: 'span' },
|
||||
reading: { type: Object, default: null },
|
||||
placeholder: { type: String, required: true },
|
||||
circularRange: { type: Number, default: null },
|
||||
});
|
||||
|
||||
const state = shallowRef(createRollingState());
|
||||
watch(
|
||||
() => props.reading,
|
||||
(reading) => {
|
||||
if (!reading) return;
|
||||
state.value = advanceRollingValue(state.value, reading.text, reading.value, {
|
||||
circularRange: props.circularRange,
|
||||
immediate: reading.immediate,
|
||||
});
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<component :is="tag" :aria-label="state.text"><template v-if="!state.tokens">{{ placeholder }}</template><span v-for="(token, index) in state.tokens" :key="`${state.generation}:${index}`" :class="token.className" aria-hidden="true"><span v-if="token.track" class="cockpit-roll-track"><span>{{ token.track[0] }}</span><span>{{ token.track[1] }}</span></span><template v-else>{{ token.text }}</template></span></component>
|
||||
</template>
|
||||
@@ -0,0 +1,34 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { createRouteState } from '../../cockpitInstrumentState.js';
|
||||
import { useCockpitStore } from '../../stores/cockpit.js';
|
||||
|
||||
// The Cockpit flight plan card. The Cockpit controller presents the route's
|
||||
// endpoints and whether a destination direction exists; until it does, the
|
||||
// card stays hidden.
|
||||
const { route } = storeToRefs(useCockpitStore());
|
||||
const initial = createRouteState();
|
||||
const r = computed(() => route.value ?? initial);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section id="cockpit-route" class="cockpit-route-card" :aria-label="t('Estimated flight plan')" :hidden="!r.visible">
|
||||
<div class="cockpit-route-heading">
|
||||
<span class="cockpit-route-kicker">{{ t('ESTIMATED FLIGHT PLAN') }}</span>
|
||||
<small id="cockpit-route-status">{{ r.status }}</small>
|
||||
</div>
|
||||
<div class="cockpit-route-endpoints">
|
||||
<div class="cockpit-route-airport">
|
||||
<span>{{ t('FROM') }}</span>
|
||||
<strong id="cockpit-route-from">{{ r.from }}</strong>
|
||||
</div>
|
||||
<span class="cockpit-route-arrow material-symbols-outlined" aria-hidden="true">east</span>
|
||||
<div class="cockpit-route-airport">
|
||||
<span>{{ t('TO') }}</span>
|
||||
<strong id="cockpit-route-to">{{ r.to }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -0,0 +1,22 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
import { vFocusSafeChildren } from '../../rail/focusSafeChildren.js';
|
||||
import { useCockpitStore } from '../../stores/cockpit.js';
|
||||
|
||||
// The Cockpit's live signal rows. The Cockpit controller presents them;
|
||||
// until it does, the list is empty. Rows reorder several times a second,
|
||||
// so the list keeps keyboard focus on its row while the others move, and
|
||||
// moves focus to `leave` before the focused row goes. Selection stays with
|
||||
// the controller's click listener. The template is one line: templates keep
|
||||
// whitespace.
|
||||
defineProps({
|
||||
leave: { type: Function, required: true },
|
||||
});
|
||||
const { signals } = storeToRefs(useCockpitStore());
|
||||
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>
|
||||
</template>
|
||||
@@ -0,0 +1,86 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { vClassToggle } from '../../rail/classToggle.js';
|
||||
import UiSlider from '../../kit/UiSlider.js';
|
||||
import { useRadioStore } from '../../stores/radio.js';
|
||||
import { useCockpitStore } from '../../stores/cockpit.js';
|
||||
import { useDisplayStore } from '../../stores/display.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
|
||||
// The Cockpit's Display and Radio launchers and their popovers. RadioControls
|
||||
// presents which popover is open and the compact Radio controls; until it
|
||||
// does, both are closed and the controls show their initial state. The
|
||||
// controls call RadioControls through the store. The Display popover's slots
|
||||
// are static: the Display panel teleports its real controls into them while
|
||||
// the Cockpit display portal publishes them.
|
||||
const store = useRadioStore();
|
||||
const { act } = store;
|
||||
const { view: radio, utility } = storeToRefs(store);
|
||||
const open = computed(() => utility.value ?? { display: false, radio: false });
|
||||
const cockpit = computed(() => radio.value?.cockpit ?? null);
|
||||
// The Cockpit's layout pass measures which controls fit; until it runs, the
|
||||
// controls carry no aria-hidden.
|
||||
const { utilityLayout: layout } = storeToRefs(useCockpitStore());
|
||||
// The Display panel's groups sit in the popover's slots while the Cockpit
|
||||
// display portal publishes them.
|
||||
const { cockpitPortal } = storeToRefs(useDisplayStore());
|
||||
const ariaHidden = (expanded) =>
|
||||
layout.value
|
||||
? String(
|
||||
layout.value.hideCollapsed &&
|
||||
!expanded &&
|
||||
(open.value.display || open.value.radio),
|
||||
)
|
||||
: undefined;
|
||||
const displayLabel = computed(() =>
|
||||
open.value.display
|
||||
? t('Collapse Cockpit display options')
|
||||
: t('Expand Cockpit display options'),
|
||||
);
|
||||
const radioLabel = computed(() =>
|
||||
open.value.radio
|
||||
? t('Collapse Cockpit Radio controls')
|
||||
: t('Expand Cockpit Radio controls'),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside id="cockpit-utility-controls" class="cockpit-utility-controls" v-class-toggle="{ 'layout-primary-only': !!layout?.primaryOnly }" :aria-label="t('Cockpit display and Radio controls')">
|
||||
<div class="cockpit-utility-control ui-scroll" v-class-toggle="{ 'is-expanded': open.display }" :aria-hidden="ariaHidden(open.display)">
|
||||
<div class="cockpit-utility-launcher" data-cockpit-launcher="display">
|
||||
<span>{{ t('DISPLAY') }}</span>
|
||||
<span class="cockpit-utility-divider" aria-hidden="true"></span>
|
||||
<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>
|
||||
</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>
|
||||
<div class="cockpit-display-slot" data-cockpit-display-slot="detection"></div>
|
||||
<div class="cockpit-display-slot" data-cockpit-display-slot="parameters"></div>
|
||||
<div class="cockpit-display-slot" data-cockpit-display-slot="models3d"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cockpit-utility-control ui-scroll" v-class-toggle="{ 'is-expanded': open.radio }" :aria-hidden="ariaHidden(open.radio)">
|
||||
<div class="cockpit-utility-launcher" data-cockpit-launcher="radio">
|
||||
<span>{{ t('RADIO') }}</span>
|
||||
<span class="cockpit-utility-divider" aria-hidden="true"></span>
|
||||
<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>
|
||||
</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>
|
||||
<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>
|
||||
</div>
|
||||
<label class="cockpit-radio-volume" for="cockpit-radio-volume">
|
||||
<span>{{ t('VOLUME') }}</span>
|
||||
<UiSlider id="cockpit-radio-volume" hold @update:model-value="act('setRadioVolume', $event)" min="0" max="100" :aria-label="t('Cockpit Radio volume')" :disabled="cockpit ? cockpit.volume.disabled : true" :model-value="cockpit ? cockpit.volume.value : 80" />
|
||||
<output id="cockpit-radio-volume-value" class="gev-slider-value" for="cockpit-radio-volume">{{ cockpit ? `${cockpit.volume.value}%` : '80%' }}</output>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
</template>
|
||||
@@ -0,0 +1,45 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { useDataPacksStore } from '../../stores/dataPacks.js';
|
||||
|
||||
// The loaded data packs' attribution cards, one panel per set of data-pack
|
||||
// presentations (src/scenes/dataPacks/presentation.js), inside the viewer's
|
||||
// container.
|
||||
const { panels } = storeToRefs(useDataPacksStore());
|
||||
|
||||
const panelStyle = {
|
||||
position: 'absolute',
|
||||
right: '10px',
|
||||
bottom: '70px',
|
||||
maxHeight: '40vh',
|
||||
overflowY: 'auto',
|
||||
zIndex: '30',
|
||||
};
|
||||
const cardStyle = {
|
||||
color: '#e3faff',
|
||||
background: '#08141eed',
|
||||
border: '1px solid #2491a8',
|
||||
padding: '8px',
|
||||
margin: '4px',
|
||||
maxWidth: '260px',
|
||||
font: '12px sans-serif',
|
||||
};
|
||||
|
||||
// A removed player stops and lets go of its media, which a detached
|
||||
// element would otherwise keep playing. This runs as Vue renders the
|
||||
// removal, in the same task as the dispose that removed it.
|
||||
const vPackMedia = {
|
||||
beforeUnmount(el) {
|
||||
el.pause();
|
||||
el.removeAttribute('src');
|
||||
el.load();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport v-for="panel in panels" :key="panel.key" :to="panel.container">
|
||||
<div data-director-packs="" :style="panelStyle"><section v-for="card in panel.cards" :key="card.key" :data-director-pack="card.id" :style="cardStyle"><div>{{ card.title }}</div><a v-if="card.url" :href="card.url" target="_blank" rel="noopener noreferrer" style="color: #6eeaff">{{ t('Source') }}</a><video v-if="card.media?.kind === 'video'" v-pack-media controls preload="none" style="width: 240px" :src="card.media.src"></video><audio v-else-if="card.media?.kind === 'audio'" v-pack-media controls preload="none" style="width: 240px" :src="card.media.src"></audio></section></div>
|
||||
</Teleport>
|
||||
</template>
|
||||
@@ -0,0 +1,235 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { vPanelState } from '../../rail/panelState.js';
|
||||
import { vClassToggle } from '../../rail/classToggle.js';
|
||||
import PanelCollapseButton from '../../rail/PanelCollapseButton.vue';
|
||||
import { vRangeValue } from '../../rail/rangeValue.js';
|
||||
import UiSegmented from '../../kit/UiSegmented.vue';
|
||||
import UiSlider from '../../kit/UiSlider.js';
|
||||
import GeoImport from './GeoImport.vue';
|
||||
import { useDisplayStore } from '../../stores/display.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiSelect from '../../kit/UiSelect.js';
|
||||
import { StyleParameterRows } from '../../styleParameters.js';
|
||||
|
||||
// The Display panel. VisualSettings presents the HUD, Sonar, Scope,
|
||||
// Celestial, detection, bloom and sharpen, AircraftDisplay the 3D group and
|
||||
// the draw tool its controls, and each publishes them; until they do, the
|
||||
// panel shows its initial markup. GeoImport renders the file import.
|
||||
const display = useDisplayStore();
|
||||
const { view, models3d, draw, parameters, cockpitPortal } = storeToRefs(display);
|
||||
// A control's change goes to its owner (DisplayBindings or the draw tool).
|
||||
const act = (name, ...args) => display.act(name, ...args);
|
||||
const pct = (value) => `${value}%`;
|
||||
const hud = computed(() => view.value?.hud ?? null);
|
||||
const sonar = computed(() => view.value?.sonar ?? null);
|
||||
const sonarOn = computed(() => sonar.value?.enabled ?? true);
|
||||
const detection = computed(() => view.value?.detection ?? null);
|
||||
const detectButton = computed(() => detection.value?.button ?? null);
|
||||
const allocation = computed(() => detection.value?.allocation ?? 'ELASTIC');
|
||||
const scopeOn = computed(() => view.value?.scope.enabled ?? true);
|
||||
const scopeFeather = computed(() => view.value?.scope.featherPct ?? 100);
|
||||
const celestial = computed(() => view.value?.celestial ?? null);
|
||||
const celestialTitle = computed(() =>
|
||||
celestial.value && !celestial.value.supported
|
||||
? t('Celestial ring — available in Normal style')
|
||||
: t('Celestial ring — reveal the full globe'),
|
||||
);
|
||||
const models3dOn = computed(() => models3d.value?.pressed ?? true);
|
||||
const modelsMode = computed(() => models3d.value?.mode ?? 'proximity');
|
||||
const modelsOptions = computed(() => [
|
||||
{ value: 'proximity', label: t('Proximity'), attrs: { id: 'models3d-mode-proximity', 'data-mode': 'proximity' } },
|
||||
{ value: 'all', label: t('All'), attrs: { id: 'models3d-mode-all', 'data-mode': 'all' } },
|
||||
]);
|
||||
const drawShape = computed(() => draw.value?.shape ?? 'area');
|
||||
const drawShapeOptions = computed(() => [
|
||||
{ value: 'area', label: t('Area'), attrs: { 'data-shape': 'area' } },
|
||||
{ value: 'line', label: t('Line'), attrs: { 'data-shape': 'line' } },
|
||||
{ value: 'pin', label: t('Pin'), attrs: { 'data-shape': 'pin' } },
|
||||
]);
|
||||
const allocationOptions = computed(() => [
|
||||
{ value: 'ELASTIC', label: t('Elastic'), attrs: { id: 'detection-allocation-elastic', 'data-allocation': 'ELASTIC' } },
|
||||
{ value: 'WEIGHTED', label: t('Weighted'), attrs: { id: 'detection-allocation-weighted', 'data-allocation': 'WEIGHTED' } },
|
||||
]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- Post-processing toggles (top-right) -->
|
||||
<div id="pp-toggles" v-panel-state="'pp-toggles'" class="panel-collapsible collapsed ui-scroll" data-panel-id="pp-toggles">
|
||||
<div class="compact pp-header-row">
|
||||
<span class="pp-header-label">{{ t('DISPLAY') }}</span>
|
||||
<span class="panel-divider" aria-hidden="true"></span>
|
||||
<PanelCollapseButton class="pp-collapse-btn" target="pp-toggles" :name="t('DISPLAY')" sideways start-collapsed />
|
||||
</div>
|
||||
<div class="pp-panel-body ui-scroll" data-rail-scroller>
|
||||
<!-- Cockpit shows these four groups in its Display popover: each teleports to the slot the Cockpit display portal publishes. While disabled a Teleport stays in place; its 'body' target only keeps server rendering from dropping it. -->
|
||||
<Teleport :to="cockpitPortal?.hud ?? 'body'" :disabled="!cockpitPortal?.hud">
|
||||
<div class="pp-toggle-group">
|
||||
<button class="pp-toggle-btn" :class="{ active: hud?.visible }" 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>
|
||||
<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')">
|
||||
<option value="tactical">{{ t('Tactical') }}</option>
|
||||
<option value="minimal">{{ t('Minimal') }}</option>
|
||||
<option value="cyber">{{ t('Cyber') }}</option>
|
||||
</UiSelect>
|
||||
</div>
|
||||
<div class="pp-slider-row cyber-sonar-control cyber-sonar-toggle-row" id="cyber-sonar-row">
|
||||
<span class="pp-slider-mini-label">{{ t('Sonar') }}</span>
|
||||
<UiButton class="pp-mode-btn" :pressed="sonarOn" pressed-class="active" id="cyber-sonar-toggle" @click="act('toggleSonar')" :title="t('Cyber sonar contact scanner')" :aria-label="t('Cyber sonar contact scanner')">{{ sonarOn ? t('ON') : t('OFF') }}</UiButton>
|
||||
</div>
|
||||
<output id="cyber-sonar-status" class="cyber-sonar-control" role="status"></output>
|
||||
<div class="pp-slider-row cyber-sonar-control cyber-sonar-setting" id="cyber-sonar-rings-row">
|
||||
<label class="pp-slider-mini-label" for="cyber-sonar-rings">{{ t('Rings') }}</label>
|
||||
<UiSlider class="pp-slider" id="cyber-sonar-rings" @update:model-value="act('setSonarRings', $event)" min="3" max="12" step="1" :model-value="sonar?.rings ?? 8" :aria-label="t('Sonar ring count')" />
|
||||
<span class="pp-slider-value" id="cyber-sonar-rings-value">{{ sonar?.rings ?? 8 }}</span>
|
||||
</div>
|
||||
<div class="pp-slider-row cyber-sonar-control cyber-sonar-setting" id="cyber-sonar-range-row">
|
||||
<label class="pp-slider-mini-label" for="cyber-sonar-range">{{ t('Range') }}</label>
|
||||
<UiSlider class="pp-slider" id="cyber-sonar-range" @update:model-value="act('setSonarRange', $event)" min="60" max="120" step="1" :model-value="sonar?.range ?? 100" :aria-label="t('Sonar ring range')" />
|
||||
<span class="pp-slider-value" id="cyber-sonar-range-value">{{ pct(sonar?.range ?? 100) }}</span>
|
||||
</div>
|
||||
<div class="pp-slider-row cyber-sonar-control cyber-sonar-setting" id="cyber-sonar-intensity-row">
|
||||
<label class="pp-slider-mini-label" for="cyber-sonar-intensity">{{ t('Power') }}</label>
|
||||
<UiSlider class="pp-slider" id="cyber-sonar-intensity" @update:model-value="act('setSonarIntensity', $event)" min="0" max="100" step="1" :model-value="sonar?.intensity ?? 70" :aria-label="t('Sonar intensity')" />
|
||||
<span class="pp-slider-value" id="cyber-sonar-intensity-value">{{ pct(sonar?.intensity ?? 70) }}</span>
|
||||
</div>
|
||||
<div class="pp-slider-row cyber-sonar-control cyber-sonar-setting" id="cyber-sonar-opacity-row">
|
||||
<label class="pp-slider-mini-label" for="cyber-sonar-opacity">{{ t('Opacity') }}</label>
|
||||
<UiSlider class="pp-slider" id="cyber-sonar-opacity" @update:model-value="act('setSonarOpacity', $event)" min="35" max="100" step="1" :model-value="sonar?.opacity ?? 84" :aria-label="t('Cyber contact and label opacity')" :title="t('Minimum opacity for map dots, icons, models, brackets, and labels between sonar passes')" />
|
||||
<span class="pp-slider-value" id="cyber-sonar-opacity-value">{{ pct(sonar?.opacity ?? 84) }}</span>
|
||||
</div>
|
||||
<div class="pp-slider-row cyber-sonar-control cyber-sonar-setting" id="cyber-sonar-sector-row">
|
||||
<label class="pp-slider-mini-label" for="cyber-sonar-sector">{{ t('Sector') }}</label>
|
||||
<UiSlider class="pp-slider" id="cyber-sonar-sector" @update:model-value="act('setSonarSector', $event)" min="8" max="60" step="1" :model-value="sonar?.sector ?? 24" :aria-label="t('Sonar sector width')" />
|
||||
<span class="pp-slider-value" id="cyber-sonar-sector-value">{{ `${sonar?.sector ?? 24}°` }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
<Teleport :to="cockpitPortal?.detection ?? 'body'" :disabled="!cockpitPortal?.detection">
|
||||
<div class="pp-toggle-group">
|
||||
<UiButton class="pp-toggle-btn" :class="{ active: detectButton?.active, panoptic: detectButton?.panoptic }" :pressed="detectButton?.pressed ?? false" id="detection-toggle" @click="act('cycleDetection')" :title="t('Detection Overlay (D)')" :aria-label="detectButton?.ariaLabel ?? t('Detection overlay')">
|
||||
<span class="pp-icon">▣</span>
|
||||
<span class="pp-label">{{ detectButton?.label ?? t('DETECT') }}</span>
|
||||
</UiButton>
|
||||
<div class="pp-slider-row detection-slider-row" :class="{ visible: detection?.rowsVisible }" id="detection-slider-row">
|
||||
<label class="pp-slider-mini-label" for="detection-density-slider">{{ t('Density') }}</label>
|
||||
<UiSlider class="pp-slider" id="detection-density-slider" @update:model-value="act('setDensity', $event)" min="0" max="100" step="25" :model-value="detection?.densityPct ?? 50" :aria-label="t('Detection label density')" />
|
||||
<span class="pp-slider-value" id="detection-density-value">{{ pct(detection?.densityPct ?? 50) }}</span>
|
||||
</div>
|
||||
<div class="pp-slider-row detection-allocation-row" :class="{ visible: detection?.rowsVisible }" id="detection-allocation-row">
|
||||
<span class="pp-slider-mini-label">{{ t('Allocation') }}</span>
|
||||
<UiSegmented class="pp-mode-seg detection-allocation-seg" item-class="pp-mode-btn" keyboard="none" :label="t('Detection label allocation')" :options="allocationOptions" :model-value="allocation" @update:model-value="act('setAllocation', $event)" />
|
||||
</div>
|
||||
<div class="pp-slider-row detection-fade-row" :class="{ visible: detection?.rowsVisible }" id="detection-fade-row">
|
||||
<label class="pp-slider-mini-label" for="detection-fade-slider">{{ t('Fade') }}</label>
|
||||
<UiSlider class="pp-slider" id="detection-fade-slider" @update:model-value="act('setFade', $event)" min="0" max="40" step="1" :model-value="detection?.fadePct ?? 7" :aria-label="t('Detection fade distance')" :title="t('World-overlay fade distance outside the keyhole as a percentage of its radius')" />
|
||||
<span class="pp-slider-value" id="detection-fade-value">{{ pct(detection?.fadePct ?? 7) }}</span>
|
||||
</div>
|
||||
<div class="pp-slider-row detection-opacity-row" :class="{ visible: detection?.rowsVisible }" id="detection-opacity-row">
|
||||
<label class="pp-slider-mini-label" for="detection-opacity-slider">{{ t('Outside') }}</label>
|
||||
<UiSlider class="pp-slider" id="detection-opacity-slider" @update:model-value="act('setOutsideOpacity', $event)" min="0" max="100" step="1" :model-value="detection?.outsideOpacityPct ?? 1" :aria-label="t('Detection opacity outside the keyhole')" :title="t('World-overlay label and card opacity beyond the fade distance')" />
|
||||
<span class="pp-slider-value" id="detection-opacity-value">{{ pct(detection?.outsideOpacityPct ?? 1) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
<!-- The one shared preset-parameter surface: the active style's parameters, as VisualSettings publishes them. -->
|
||||
<Teleport :to="cockpitPortal?.parameters ?? 'body'" :disabled="!cockpitPortal?.parameters">
|
||||
<div id="param-slider-panel" v-panel-state="'param-slider-panel'" v-class-toggle="{ active: !!parameters }">
|
||||
<div class="param-panel-header">
|
||||
<span class="param-panel-title">{{ t('PARAMETERS') }}</span>
|
||||
<span class="param-panel-divider"></span>
|
||||
<PanelCollapseButton id="param-panel-collapse-btn" target="param-slider-panel" />
|
||||
</div>
|
||||
<div id="param-sliders"><StyleParameterRows v-if="parameters" :key="parameters.style" :rows="parameters.rows" :on-input="(name, value) => act('setStyleParameter', name, value)" /></div>
|
||||
</div>
|
||||
</Teleport>
|
||||
<Teleport :to="cockpitPortal?.models3d ?? 'body'" :disabled="!cockpitPortal?.models3d">
|
||||
<div class="pp-toggle-group">
|
||||
<!-- 3D aircraft is DEFAULT-ON in Proximity (owner directive 2026-08-22), so the
|
||||
button ships lit and the mode row ships open — the same markup-carries-the-default
|
||||
convention as #scope-toggle. ui.js re-syncs both from durable layer state, which
|
||||
is what flips them back for a share link or a stored session carrying 3D off. -->
|
||||
<UiButton class="pp-toggle-btn" :pressed="models3dOn" pressed-class="active" id="models3d-toggle" @click="act('toggleModels')" :title="t('3D aircraft — flat icons zoomed out, 3D models up close')">
|
||||
<span class="pp-icon">✈</span>
|
||||
<span class="pp-label">3D</span>
|
||||
</UiButton>
|
||||
<div class="pp-slider-row" :class="{ visible: models3d?.rowVisible ?? true }" id="models3d-mode-row">
|
||||
<span class="pp-slider-mini-label">{{ t('Models') }}</span>
|
||||
<UiSegmented class="pp-mode-seg" item-class="pp-mode-btn" keyboard="none" :label="t('3D model coverage')" :options="modelsOptions" :model-value="modelsMode" @update:model-value="act('setModelsMode', $event)" />
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
<div class="pp-toggle-group">
|
||||
<label class="pp-toggle-btn pp-scope-toggle" :title="t('Scope — the circular viewport mask')">
|
||||
<span class="pp-icon material-symbols-outlined" aria-hidden="true">adjust</span>
|
||||
<span class="pp-label">{{ t('Scope') }}</span>
|
||||
<input type="checkbox" id="scope-toggle" @change="act('setScopeEnabled', $event.target.checked)" :checked="scopeOn" />
|
||||
</label>
|
||||
<div class="pp-slider-row visible" id="scope-slider-row">
|
||||
<span class="pp-slider-mini-label">{{ t('Feather') }}</span>
|
||||
<UiSlider class="pp-slider" id="scope-feather-slider" @update:model-value="act('setScopeFeather', $event)" min="0" max="200" :model-value="scopeFeather" :disabled="!scopeOn" :aria-label="t('Scope edge feather')" :title="t('Scope edge feather as a percentage of the keyhole radius')" />
|
||||
<span class="pp-slider-value" id="scope-feather-value">{{ pct(scopeFeather) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pp-toggle-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>
|
||||
<span class="pp-label">{{ t('Draw') }}</span>
|
||||
</UiButton>
|
||||
<div class="pp-slider-row" :class="{ visible: draw?.active }" id="draw-mode-row">
|
||||
<span class="pp-slider-mini-label">{{ t('Shape') }}</span>
|
||||
<UiSegmented class="pp-mode-seg" item-class="pp-mode-btn" keyboard="none" :label="t('Shape to draw')" :options="drawShapeOptions" :model-value="drawShape" @update:model-value="act('setDrawShape', $event)" />
|
||||
</div>
|
||||
<div class="pp-slider-row" :class="{ visible: draw?.active }" id="draw-label-row">
|
||||
<input type="text" class="pp-text-input" id="draw-label-input" v-range-value="draw?.label ?? ''" @input="act('setDrawLabel', $event.target.value)" maxlength="120" :placeholder="t('Label (optional)')" :aria-label="t('Label for the drawn shape')" autocomplete="off" spellcheck="false">
|
||||
<UiSelect class="pp-select draw-color-select gev-field gev-field--compact" id="draw-color-select" :model-value="draw?.color ?? 'primary'" @update:model-value="act('setDrawColor', $event)" :aria-label="t('Colour of the drawn shape')">
|
||||
<option value="primary">{{ t('Primary') }}</option>
|
||||
<option value="amber">{{ t('Amber') }}</option>
|
||||
<option value="cyan">{{ t('Cyan') }}</option>
|
||||
<option value="green">{{ t('Green') }}</option>
|
||||
<option value="red">{{ t('Red') }}</option>
|
||||
</UiSelect>
|
||||
<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>
|
||||
<span class="draw-hint" id="draw-hint" aria-live="polite">{{ draw?.hint ?? '' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<GeoImport />
|
||||
<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>
|
||||
<span class="pp-label">{{ t('Celestial') }}</span>
|
||||
</UiButton>
|
||||
</div>
|
||||
<button 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>
|
||||
<div class="pp-toggle-group">
|
||||
<button class="pp-toggle-btn" :class="{ active: view?.bloom.active }" id="bloom-toggle" @click="act('toggleBloom')" :title="t('Bloom / Glow')">
|
||||
<span class="pp-icon">✨</span>
|
||||
<span class="pp-label">{{ t('Bloom') }}</span>
|
||||
</button>
|
||||
<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 }" id="sharpen-toggle" @click="act('toggleSharpen')" :title="t('Sharpening')">
|
||||
<span class="pp-icon">🔍</span>
|
||||
<span class="pp-label">{{ t('Sharpen') }}</span>
|
||||
</button>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,154 @@
|
||||
// src/ui/views/panels/GeoImport.test.mjs — DISPLAY ▸ Import renders the file
|
||||
// import's rows, sends a pick and the row buttons through the display store,
|
||||
// and keeps keyboard focus on a row that stays when the focused one goes.
|
||||
import '../../../testSupport/registerDom.mjs';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { createApp, nextTick } from 'vue';
|
||||
import { createPinia } from 'pinia';
|
||||
import { GEO_FILE_ACCEPT } from '../../../data/geoFileImport.js';
|
||||
import { useDisplayStore } from '../../stores/display.js';
|
||||
import GeoImport from './GeoImport.vue';
|
||||
|
||||
function mount(t) {
|
||||
document.body.replaceChildren();
|
||||
const pinia = createPinia();
|
||||
const store = useDisplayStore(pinia);
|
||||
const calls = [];
|
||||
const record =
|
||||
(name) =>
|
||||
(...args) =>
|
||||
calls.push([name, ...args]);
|
||||
store.connect({
|
||||
importGeoFiles: record('importGeoFiles'),
|
||||
toggleGeoImport: record('toggleGeoImport'),
|
||||
flyToGeoImport: record('flyToGeoImport'),
|
||||
removeGeoImport: record('removeGeoImport'),
|
||||
});
|
||||
const app = createApp(GeoImport).use(pinia);
|
||||
app.mount(document.body.appendChild(document.createElement('div')));
|
||||
t.after(() => app.unmount());
|
||||
return { store, calls };
|
||||
}
|
||||
const $ = (id) => document.getElementById(id);
|
||||
const row = (id) => ({
|
||||
id,
|
||||
name: `${id}.geojson`,
|
||||
ownStyles: false,
|
||||
color: '#39d0ff',
|
||||
title: id,
|
||||
actions: ['toggle', 'fly', 'remove'].map((action) => ({
|
||||
icon: action,
|
||||
label: `${action} ${id}`,
|
||||
action,
|
||||
pressed: action === 'toggle' ? 'true' : undefined,
|
||||
})),
|
||||
});
|
||||
async function show(store, ids, hint = '') {
|
||||
store.publishGeoImport({ rows: ids.map(row), hint });
|
||||
await nextTick();
|
||||
}
|
||||
const button = (id, action) =>
|
||||
document.querySelector(
|
||||
`[data-import-id="${id}"] button[data-action="${action}"]`,
|
||||
);
|
||||
|
||||
test('the Import button opens the picker, and a pick goes to the file import', async (t) => {
|
||||
const { store, calls } = mount(t);
|
||||
const picker = $('geo-import-input');
|
||||
assert.equal(picker.getAttribute('accept'), GEO_FILE_ACCEPT);
|
||||
let opened = 0;
|
||||
picker.click = () => (opened += 1);
|
||||
$('geo-import-button').click();
|
||||
assert.equal(opened, 0, 'not before the file import presents itself');
|
||||
await show(store, []);
|
||||
$('geo-import-button').click();
|
||||
assert.equal(opened, 1);
|
||||
let cleared = false;
|
||||
Object.defineProperty(picker, 'value', {
|
||||
configurable: true,
|
||||
get: () => '',
|
||||
set: (value) => (cleared = value === ''),
|
||||
});
|
||||
const files = [new File(['{}'], 'a.geojson'), new File(['{}'], 'b.kml')];
|
||||
Object.defineProperty(picker, 'files', { value: files, configurable: true });
|
||||
picker.dispatchEvent(new Event('change'));
|
||||
assert.equal(calls.length, 1);
|
||||
assert.equal(calls[0][0], 'importGeoFiles');
|
||||
assert.deepEqual(
|
||||
calls[0][1].map((file) => file.name),
|
||||
['a.geojson', 'b.kml'],
|
||||
);
|
||||
assert.ok(cleared, 'the selection clears, so the same file can be picked again');
|
||||
Object.defineProperty(picker, 'files', { value: [], configurable: true });
|
||||
picker.dispatchEvent(new Event('change'));
|
||||
assert.equal(calls.length, 1, 'an empty pick sends nothing');
|
||||
});
|
||||
|
||||
test('rows render what the file import publishes and their buttons call it', async (t) => {
|
||||
const { store, calls } = mount(t);
|
||||
assert.equal($('geo-import-list').classList.contains('visible'), false);
|
||||
await show(store, ['a', 'b'], 'Added 2 files.');
|
||||
assert.ok($('geo-import-list').classList.contains('visible'));
|
||||
assert.equal($('geo-import-hint').textContent, 'Added 2 files.');
|
||||
assert.equal(button('a', 'toggle').getAttribute('aria-pressed'), 'true');
|
||||
assert.equal(button('a', 'toggle').getAttribute('aria-label'), 'toggle a');
|
||||
button('a', 'toggle').click();
|
||||
button('b', 'fly').click();
|
||||
button('a', 'remove').click();
|
||||
assert.deepEqual(calls, [
|
||||
['toggleGeoImport', 'a'],
|
||||
['flyToGeoImport', 'b'],
|
||||
['removeGeoImport', 'a'],
|
||||
]);
|
||||
});
|
||||
|
||||
test('focus goes to the next row’s same button, then the previous, then Import', async (t) => {
|
||||
const { store } = mount(t);
|
||||
await show(store, ['a', 'b', 'c']);
|
||||
button('b', 'fly').focus();
|
||||
await show(store, ['a', 'c']);
|
||||
assert.equal(document.activeElement, button('c', 'fly'), 'the next row');
|
||||
await show(store, ['a']);
|
||||
assert.equal(document.activeElement, button('a', 'fly'), 'the previous row');
|
||||
await show(store, []);
|
||||
assert.equal(document.activeElement, $('geo-import-button'));
|
||||
});
|
||||
|
||||
test('two rows gone in one render leave focus on the first one’s next row', async (t) => {
|
||||
const { store } = mount(t);
|
||||
await show(store, ['a', 'b', 'c', 'd', 'e']);
|
||||
button('b', 'remove').focus();
|
||||
await show(store, ['a', 'c', 'e']);
|
||||
assert.equal(document.activeElement, button('c', 'remove'));
|
||||
});
|
||||
|
||||
test('focus outside the removed row stays where it is', async (t) => {
|
||||
const { store } = mount(t);
|
||||
await show(store, ['a', 'b']);
|
||||
button('b', 'toggle').focus();
|
||||
await show(store, ['b']);
|
||||
assert.equal(document.activeElement, button('b', 'toggle'));
|
||||
$('geo-import-button').focus();
|
||||
await show(store, []);
|
||||
assert.equal(document.activeElement, $('geo-import-button'));
|
||||
});
|
||||
|
||||
test('focus passes through a neighbour that goes in the same render', async (t) => {
|
||||
const { store } = mount(t);
|
||||
await show(store, ['a', 'b', 'c', 'd']);
|
||||
button('b', 'fly').focus();
|
||||
await show(store, ['a', 'd']);
|
||||
assert.equal(document.activeElement, button('d', 'fly'));
|
||||
});
|
||||
|
||||
test('a row without the same button gives focus to its first one', async (t) => {
|
||||
const { store } = mount(t);
|
||||
const short = { ...row('b'), actions: row('b').actions.slice(1) };
|
||||
store.publishGeoImport({ rows: [row('a'), short], hint: '' });
|
||||
await nextTick();
|
||||
button('a', 'toggle').focus();
|
||||
store.publishGeoImport({ rows: [short], hint: '' });
|
||||
await nextTick();
|
||||
assert.equal(document.activeElement, button('b', 'fly'));
|
||||
});
|
||||
@@ -0,0 +1,69 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed, ref } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { vFocusSafeChildren } from '../../rail/focusSafeChildren.js';
|
||||
import { useDisplayStore } from '../../stores/display.js';
|
||||
|
||||
// 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.
|
||||
const display = useDisplayStore();
|
||||
const { geoImport } = storeToRefs(display);
|
||||
const rows = computed(() => geoImport.value?.rows ?? []);
|
||||
// No `>` in the template: the catalog reads its tags with a regex.
|
||||
const listed = computed(() => rows.value.length > 0);
|
||||
const importButton = ref(null);
|
||||
const picker = ref(null);
|
||||
const ROW_ACTIONS = {
|
||||
toggle: 'toggleGeoImport',
|
||||
fly: 'flyToGeoImport',
|
||||
remove: 'removeGeoImport',
|
||||
};
|
||||
|
||||
// The picker opens once the file import has presented itself, so a pick
|
||||
// always has somewhere to go.
|
||||
function openPicker() {
|
||||
if (geoImport.value) picker.value.click();
|
||||
}
|
||||
|
||||
function pick() {
|
||||
const files = [...(picker.value.files || [])];
|
||||
// Clear the selection so choosing the same file again fires `change`.
|
||||
picker.value.value = '';
|
||||
if (files.length) display.act('importGeoFiles', files);
|
||||
}
|
||||
|
||||
function leave() {
|
||||
const active = document.activeElement;
|
||||
const row = active?.closest('[data-import-id]');
|
||||
const action = active?.dataset.action;
|
||||
const others = [];
|
||||
for (let next = row?.nextElementSibling; next; next = next.nextElementSibling)
|
||||
others.push(next);
|
||||
for (let prev = row?.previousElementSibling; prev; prev = prev.previousElementSibling)
|
||||
others.push(prev);
|
||||
for (const other of others) {
|
||||
const target =
|
||||
other.querySelector(`button[data-action="${action}"]`) ||
|
||||
other.querySelector('button');
|
||||
if (target) return target.focus();
|
||||
}
|
||||
importButton.value?.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>
|
||||
<span class="pp-label">{{ t('Import') }}</span>
|
||||
</button>
|
||||
<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>
|
||||
<span class="draw-hint geo-import-hint" id="geo-import-hint" aria-live="polite">{{ geoImport?.hint ?? '' }}</span>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,35 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { useGlobeActionsStore } from '../../stores/globeActions.js';
|
||||
import GlobeCompass from './GlobeCompass.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
|
||||
// focusable and marks it busy, and the camera's tilt and heading. The heading
|
||||
// changes on every frame a rotating camera draws, so only the compass reads
|
||||
// it; the bar renders again only when the tilt changes.
|
||||
const globe = useGlobeActionsStore();
|
||||
const { clearBusy, resetBusy, camera } = storeToRefs(globe);
|
||||
const { act } = globe;
|
||||
const tilted = computed(() => Boolean(camera.value?.tilted));
|
||||
</script>
|
||||
|
||||
<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')">
|
||||
<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>
|
||||
<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>
|
||||
</nav>
|
||||
</template>
|
||||
@@ -0,0 +1,27 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { useGlobeActionsStore } from '../../stores/globeActions.js';
|
||||
|
||||
// The north-up button: its needle and label follow the published heading,
|
||||
// which changes on every frame a rotating camera draws. Before the camera
|
||||
// controls first publish, it shows no heading.
|
||||
defineEmits(['click']);
|
||||
const { camera } = storeToRefs(useGlobeActionsStore());
|
||||
const heading = computed(() => camera.value?.heading);
|
||||
const label = computed(() =>
|
||||
heading.value == null
|
||||
? t('Reset map to north up')
|
||||
: t('Reset map to north up. Current heading {heading} degrees', {
|
||||
heading: heading.value,
|
||||
}),
|
||||
);
|
||||
</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')">
|
||||
<span class="camera-compass-n" aria-hidden="true">N</span>
|
||||
<span class="camera-compass-needle material-symbols-outlined" aria-hidden="true">navigation</span>
|
||||
</button>
|
||||
</template>
|
||||
@@ -0,0 +1,16 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useImagerySplitStore } from '../../stores/imagerySplit.js';
|
||||
|
||||
// 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
|
||||
// handle reports pointer and keyboard input back to its split.
|
||||
const { splits } = storeToRefs(useImagerySplitStore());
|
||||
const optional = (value) => value ?? undefined;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div v-for="split in splits" :key="split.key" :id="optional(split.view.id)" :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>
|
||||
</Teleport>
|
||||
</template>
|
||||
@@ -0,0 +1,208 @@
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
nextTick,
|
||||
onBeforeUnmount,
|
||||
onMounted,
|
||||
shallowRef,
|
||||
useTemplateRef,
|
||||
} from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { LOCALES, LOCALE_NAMES } from '../../../i18n/locale.js';
|
||||
import {
|
||||
LOCALE_PICKER_ICONS,
|
||||
LOCALE_SEARCH_THRESHOLD,
|
||||
createLocalNameReader,
|
||||
createLocalePickerModel,
|
||||
localeOptionCode,
|
||||
} from '../../localePicker.js';
|
||||
import { vClassToggle } from '../../rail/classToggle.js';
|
||||
|
||||
// The interface language picker. The model in localePicker.js holds the
|
||||
// list, search, active option and keyboard rules; this renders it and wires
|
||||
// the listbox pattern. The shell decides what a choice does.
|
||||
const props = defineProps({
|
||||
current: { type: String, required: true },
|
||||
onSelect: { type: Function, required: true },
|
||||
/** Focus the button once drawn: the picker is drawn again after a choice. */
|
||||
focus: { type: Boolean, default: false },
|
||||
locales: { type: Array, default: () => LOCALES },
|
||||
nativeNames: { type: Object, default: () => LOCALE_NAMES },
|
||||
searchThreshold: { type: Number, default: LOCALE_SEARCH_THRESHOLD },
|
||||
});
|
||||
|
||||
const model = createLocalePickerModel({
|
||||
locales: props.locales,
|
||||
current: props.current,
|
||||
nativeNames: props.nativeNames,
|
||||
localName: createLocalNameReader(props.current),
|
||||
searchThreshold: props.searchThreshold,
|
||||
});
|
||||
const id = 'locale-picker';
|
||||
const ids = {
|
||||
popup: `${id}-popup`,
|
||||
heading: `${id}-heading`,
|
||||
listbox: `${id}-listbox`,
|
||||
option: (code) => `${id}-option-${code}`,
|
||||
};
|
||||
|
||||
// The model is plain state; each change bumps this so the template rereads it.
|
||||
const revision = shallowRef(0);
|
||||
const view = computed(() => {
|
||||
void revision.value;
|
||||
return {
|
||||
open: model.open,
|
||||
visible: model.visible,
|
||||
active: model.activeOption?.code ?? null,
|
||||
};
|
||||
});
|
||||
// Each render keeps the active option in view, as the list opens too.
|
||||
const render = () => {
|
||||
revision.value += 1;
|
||||
nextTick(() => {
|
||||
const code = model.open ? model.activeOption?.code : null;
|
||||
if (!code) return;
|
||||
root.value
|
||||
?.querySelector(`#${CSS.escape(ids.option(code))}`)
|
||||
?.scrollIntoView?.({ block: 'nearest' });
|
||||
});
|
||||
};
|
||||
|
||||
const root = useTemplateRef('root');
|
||||
const button = useTemplateRef('button');
|
||||
const listbox = useTemplateRef('listbox');
|
||||
const search = useTemplateRef('search');
|
||||
const focusTarget = () => search.value || listbox.value;
|
||||
const activeDescendant = computed(() =>
|
||||
view.value.active ? ids.option(view.value.active) : undefined,
|
||||
);
|
||||
const buttonLabel = computed(() =>
|
||||
t('Language: {language}', {
|
||||
language: props.nativeNames[props.current] || props.current,
|
||||
}),
|
||||
);
|
||||
|
||||
let swallowSpaceKeyup = false;
|
||||
|
||||
function close({ restoreFocus = false } = {}) {
|
||||
if (!model.open) return;
|
||||
model.closeList();
|
||||
render();
|
||||
globalThis.removeEventListener('keydown', onWindowKeyDown, true);
|
||||
document.removeEventListener('pointerdown', onDocumentPointerDown, true);
|
||||
if (restoreFocus) button.value?.focus({ preventScroll: true });
|
||||
}
|
||||
|
||||
// The list is closed on screen before the shell switches.
|
||||
async function choose(code) {
|
||||
close({ restoreFocus: true });
|
||||
if (code === props.current) return;
|
||||
await nextTick();
|
||||
props.onSelect(code);
|
||||
}
|
||||
|
||||
async function open() {
|
||||
if (model.open) return;
|
||||
model.openList();
|
||||
if (search.value) search.value.value = '';
|
||||
render();
|
||||
// Window capture runs before the document-level shortcut handlers
|
||||
// (cockpit, hotkeys, push-to-talk), so keys typed in the list stay here.
|
||||
globalThis.addEventListener('keydown', onWindowKeyDown, true);
|
||||
document.addEventListener('pointerdown', onDocumentPointerDown, true);
|
||||
// The popup shows when Vue renders it; focus it after.
|
||||
await nextTick();
|
||||
if (model.open) focusTarget()?.focus({ preventScroll: true });
|
||||
}
|
||||
|
||||
function onWindowKeyDown(event) {
|
||||
if (!model.open || event.isComposing) return;
|
||||
const inside = root.value?.contains(event.target);
|
||||
if (!inside && event.key !== 'Escape') return;
|
||||
const result = model.keydown(event);
|
||||
if (!result.handled) return;
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
if (result.close) close({ restoreFocus: true });
|
||||
else if (result.choose) {
|
||||
if (event.key === ' ') swallowSpaceKeyup = true;
|
||||
choose(result.choose);
|
||||
} else render();
|
||||
}
|
||||
|
||||
function onDocumentPointerDown(event) {
|
||||
if (!root.value?.contains(event.target)) close();
|
||||
}
|
||||
|
||||
function onButtonClick() {
|
||||
if (model.open) close({ restoreFocus: true });
|
||||
else open();
|
||||
}
|
||||
|
||||
function onButtonKeyDown(event) {
|
||||
if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
open();
|
||||
}
|
||||
|
||||
// Space chose an option and moved focus here; its keyup must not click.
|
||||
function onButtonKeyUp(event) {
|
||||
if (event.key !== ' ' || !swallowSpaceKeyup) return;
|
||||
swallowSpaceKeyup = false;
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
const optionFromEvent = (event) =>
|
||||
event.target?.closest?.('[role="option"]')?.dataset.locale || null;
|
||||
|
||||
function onListClick(event) {
|
||||
const code = optionFromEvent(event);
|
||||
if (code) choose(code);
|
||||
}
|
||||
|
||||
function onListPointerMove(event) {
|
||||
const code = optionFromEvent(event);
|
||||
if (!code || model.activeOption?.code === code) return;
|
||||
model.setActive(model.visible.findIndex((option) => option.code === code));
|
||||
render();
|
||||
}
|
||||
|
||||
function onSearchInput(event) {
|
||||
model.setQuery(event.target.value);
|
||||
render();
|
||||
}
|
||||
|
||||
function onFocusOut(event) {
|
||||
const next = event.relatedTarget;
|
||||
if (model.open && next && !root.value?.contains(next)) close();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (props.focus) button.value?.focus({ preventScroll: true });
|
||||
});
|
||||
onBeforeUnmount(() => close());
|
||||
|
||||
defineExpose({ open, close, isOpen: () => model.open });
|
||||
</script>
|
||||
|
||||
<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">
|
||||
<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>
|
||||
<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" />
|
||||
<ul ref="listbox" :id="ids.listbox" class="locale-picker-list ui-scroll" role="listbox" :aria-labelledby="ids.heading" tabindex="-1" :aria-activedescendant="model.searchable ? undefined : activeDescendant" @click="onListClick" @pointermove="onListPointerMove">
|
||||
<li v-for="option in view.visible" :key="option.code" :id="ids.option(option.code)" class="locale-picker-option" v-class-toggle="{ 'is-active': view.active === option.code }" role="option" :aria-selected="String(option.selected)" :lang="option.code" :data-locale="option.code">
|
||||
<span class="locale-picker-text"><span class="locale-picker-native">{{ option.nativeName }}</span><span class="locale-picker-meta"><span class="locale-picker-option-code" translate="no" :lang="localeOptionCode(option.code).lang">{{ localeOptionCode(option.code).text }}</span></span></span>
|
||||
<svg v-if="option.selected" viewBox="0 0 24 24" aria-hidden="true" focusable="false" class="locale-picker-check"><path v-for="d in LOCALE_PICKER_ICONS.check.stroke" :key="d" :d="d" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" /></svg>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="locale-picker-empty" role="status" :hidden="view.visible.length > 0">{{ t('No matching languages') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,84 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { nextTick, ref, watch } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import UiSlider from '../../kit/UiSlider.js';
|
||||
import { useContextStore } from '../../stores/context.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
|
||||
// The selected space mission inside Context. The launches layer presents it
|
||||
// and hides the panel while none is selected; the roster beside it hides
|
||||
// while it shows. Buttons call the layer's panel commands.
|
||||
const { mission: m, missionsLayer: layer } = storeToRefs(useContextStore());
|
||||
const root = ref(null);
|
||||
|
||||
// Each newly presented selection returns the Context panel to the top.
|
||||
const SCROLLER = ":root[data-ui-theme='cyber'] .cyber-panel-body, .global-context-panel-inner";
|
||||
watch(
|
||||
() => m.value?.scrollRequest,
|
||||
async (request) => {
|
||||
if (request === undefined) return;
|
||||
await nextTick();
|
||||
const scroller = root.value?.closest(SCROLLER);
|
||||
if (scroller) scroller.scrollTop = 0;
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside id="space-mission-panel" ref="root" class="context-space-mission-detail" :aria-label="t('Selected Space Mission')" :hidden="!m">
|
||||
<div class="space-mission-view-header"><span>{{ t('SELECTED SPACE MISSION') }}</span><button type="button" data-mission-close :title="t('Show all missions')" :aria-label="t('Deselect mission')" @click="layer?.deselectMission()">×</button></div>
|
||||
<div class="space-mission-detail">
|
||||
<strong data-mission-title>{{ m ? m.title : t('MISSION') }}</strong>
|
||||
<span data-mission-field data-mission-provider :hidden="m && !m.provider">{{ m?.provider }}</span>
|
||||
<span data-mission-field :hidden="m && !m.status">{{ t('STATUS · ') }}<b data-mission-status>{{ m?.status }}</b></span>
|
||||
<span data-mission-field :hidden="m && !m.site">{{ t('LAUNCH SITE · ') }}<b data-mission-site>{{ m?.site }}</b></span>
|
||||
<span data-mission-field :hidden="m && !m.time">{{ t('LAUNCH TIME · ') }}<b data-mission-time>{{ m?.time }}</b></span>
|
||||
<span data-mission-field :hidden="m && !m.orbit">{{ t('ORBIT · ') }}<b data-mission-orbit>{{ m?.orbit }}</b></span>
|
||||
<span>{{ t('ASCENT PATH · ') }}<b data-mission-ascent-source>{{ m?.ascent }}</b></span>
|
||||
<span data-mission-field :hidden="m && !m.distance">{{ t('CURRENT DISTANCE FROM EARTH · ') }}<b data-mission-distance>{{ m?.distance }}</b></span>
|
||||
<span data-mission-field :hidden="m && !m.speed">{{ t('SATELLITE SPEED · ') }}<b data-mission-speed :title="m?.speedTitle">{{ m?.speed }}</b></span>
|
||||
</div>
|
||||
<section class="mission-data-section">
|
||||
<h4>{{ t('PAYLOAD') }}</h4>
|
||||
<div class="mission-table-scroll ui-scroll">
|
||||
<table class="mission-data-table">
|
||||
<thead><tr><th>{{ t('NAME') }}</th><th>{{ t('TYPE') }}</th><th>{{ t('DESTINATION') }}</th></tr></thead>
|
||||
<tbody data-mission-payloads>
|
||||
<template v-if="m"><tr v-if="!m.payloads.length"><td colspan="3" class="mission-table-empty">{{ t('PAYLOAD DATA UNAVAILABLE') }}</td></tr><tr v-for="(payload, index) in m.payloads" :key="index"><td>{{ payload.name }}<small v-if="payload.detail">{{ payload.detail }}</small></td><td>{{ payload.type }}</td><td>{{ payload.destination }}</td></tr><tr v-if="m.payloadsMore"><td colspan="3" class="mission-table-empty">{{ m.payloadsMore }}</td></tr></template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
<section class="mission-data-section" data-mission-stages-section :hidden="m && !m.stages.length">
|
||||
<h4>{{ t('STAGE / RE-ENTRY / RECOVERY') }}</h4>
|
||||
<div class="mission-table-scroll ui-scroll">
|
||||
<table class="mission-data-table">
|
||||
<thead><tr><th>{{ t('STAGE') }}</th><th>{{ t('STATUS') }}</th><th>{{ t('FINAL POSITION') }}</th></tr></thead>
|
||||
<tbody data-mission-stages>
|
||||
<template v-if="m"><tr v-if="!m.stages.length"><td colspan="3" class="mission-table-empty">{{ t('NO STAGE RE-ENTRY / RECOVERY DATA') }}</td></tr><tr v-for="(stage, index) in m.stages" :key="index"><td>{{ stage.name }}<small v-if="stage.detail">{{ stage.detail }}</small></td><td>{{ stage.status }}</td><td>{{ stage.destination }}<small>{{ stage.position }}</small></td></tr></template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
<div class="mission-replay-speed-control" :hidden="m && !m.replay.available">
|
||||
<div class="mission-replay-speed-header"><label for="space-mission-replay-speed">{{ t('REPLAY SPEED') }}</label><output class="gev-slider-value" for="space-mission-replay-speed" data-mission-replay-speed-output>{{ m ? m.replay.speedText : '1×' }}</output></div>
|
||||
<UiSlider id="space-mission-replay-speed" hold min="0.25" max="4" step="0.25" data-mission-replay-speed :aria-label="t('Replay speed multiplier')" :model-value="m ? m.replay.speed : 1" :style="m && { '--replay-speed-progress': m.replay.speedProgress }" @update:model-value="layer?.setReplaySpeed($event)" />
|
||||
<div class="mission-replay-speed-scale" aria-hidden="true"><span>0.25×</span><span>1×</span><span>4×</span></div>
|
||||
</div>
|
||||
<div class="mission-action-row">
|
||||
<button type="button" class="mission-focus-button" data-mission-focus @click="layer?.focusSelectedLaunchSite()">{{ t('FOCUS') }}</button>
|
||||
<UiButton class="mission-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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="space-mission-nav">
|
||||
<button type="button" class="mission-nav-button" data-mission-prev :title="t('Previous mission')" :disabled="m?.previousDisabled" @click="layer?.selectPreviousMission()"><span aria-hidden="true">‹</span> {{ t('PREV') }}</button>
|
||||
<span class="mission-nav-index" data-mission-index>{{ m ? m.index : '—' }}</span>
|
||||
<button type="button" class="mission-nav-button" data-mission-next :title="t('Next mission')" :disabled="m?.nextDisabled" @click="layer?.selectNextMission()">{{ t('NEXT') }} <span aria-hidden="true">›</span></button>
|
||||
</div>
|
||||
<button type="button" class="panel-layer-toggle" data-mission-show-all @click="layer?.deselectMission()">{{ t('SHOW ALL / DESELECT') }}</button>
|
||||
</aside>
|
||||
</template>
|
||||
@@ -0,0 +1,14 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useMissionReplayStore } from '../../stores/missionReplay.js';
|
||||
|
||||
// The replay vehicle, its orbit dot and callout over the globe, where the
|
||||
// launches layer places them after each rendered frame.
|
||||
const { overlay } = storeToRefs(useMissionReplayStore());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport v-if="overlay" defer to="#cesiumContainer">
|
||||
<div class="mission-replay-vehicle-overlay" :class="{ 'is-thrusting': overlay.thrusting, 'is-paused': overlay.paused }" :hidden="!overlay.visible" aria-hidden="true" :data-mode="overlay.mode ?? undefined" :style="{ transform: overlay.transform ?? undefined, '--mission-replay-rotation': overlay.rotation ?? undefined }"><div class="mission-replay-flight-symbol" :style="{ opacity: overlay.iconOpacity ?? undefined }"><svg class="mission-replay-rocket" viewBox="0 0 48 72" aria-hidden="true"><path class="mission-replay-rocket-body" d="M24 5C16 14 14 27 15 45L9 54L18 51L24 58L30 51L39 54L33 45C34 27 32 14 24 5Z"></path><circle class="mission-replay-rocket-port" cx="24" cy="29" r="3.4"></circle></svg><svg class="mission-replay-thrust" viewBox="0 0 72 72" aria-hidden="true"><ellipse style="--thrust-index:0" cx="36" cy="7" rx="5" ry="1.8"></ellipse><ellipse style="--thrust-index:1" cx="36" cy="15" rx="8" ry="2.4"></ellipse><ellipse style="--thrust-index:2" cx="36" cy="24" rx="11" ry="3"></ellipse><ellipse style="--thrust-index:3" cx="36" cy="35" rx="15" ry="3.8"></ellipse><ellipse style="--thrust-index:4" cx="36" cy="48" rx="20" ry="4.7"></ellipse><ellipse style="--thrust-index:5" cx="36" cy="63" rx="26" ry="5.8"></ellipse></svg></div><div class="mission-replay-orbit-dot" aria-hidden="true" :style="{ opacity: overlay.iconOpacity ?? undefined }"></div><div class="mission-replay-overlay-callout" :style="{ opacity: overlay.labelOpacity ?? undefined }"><strong data-replay-overlay-title="">{{ overlay.title }}</strong><span data-replay-overlay-detail="">{{ overlay.detail }}</span></div></div>
|
||||
</Teleport>
|
||||
</template>
|
||||
@@ -0,0 +1,79 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { onBeforeUpdate, onUpdated, ref } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { useContextStore } from '../../stores/context.js';
|
||||
import UiEmpty from '../../kit/UiEmpty.vue';
|
||||
|
||||
// The Space Missions roster. The launches layer presents it; until it does,
|
||||
// the list shows its loading line. Hover and keyboard focus drive the
|
||||
// layer's preview, and a click selects the mission.
|
||||
const { missionRoster: roster, missionsLayer: layer } = storeToRefs(useContextStore());
|
||||
const root = ref(null);
|
||||
|
||||
const CONTINUATION = '[data-mission-roster-focus-continuation]';
|
||||
const rosterIndex = (el) => {
|
||||
const item = el?.closest?.('[data-mission-roster-index]');
|
||||
return item && root.value?.contains(item) ? Number(item.dataset.missionRosterIndex) : null;
|
||||
};
|
||||
|
||||
// A changed roster resets the layer's preview. The old list rebuilt its
|
||||
// rows, so the next pointer movement entered the row under the pointer; a
|
||||
// row Vue keeps re-enters on its next movement the same way.
|
||||
let pointerStale = false;
|
||||
function move(index) {
|
||||
if (!pointerStale) return;
|
||||
pointerStale = false;
|
||||
layer.value?.rosterPointerEnter(index);
|
||||
}
|
||||
function enter(index) {
|
||||
pointerStale = false;
|
||||
layer.value?.rosterPointerEnter(index);
|
||||
}
|
||||
|
||||
function blur(event) {
|
||||
layer.value?.rosterBlur(rosterIndex(event.relatedTarget));
|
||||
}
|
||||
|
||||
// A refresh keeps keyboard focus on the same mission by identity: browsers
|
||||
// drop focus from a node Vue moves or removes, so it is found again by id,
|
||||
// or continues beyond the list when the mission departed. A changed roster
|
||||
// resets the layer's preview, so a mission still focused takes it back.
|
||||
let focusedId = null;
|
||||
onBeforeUpdate(() => {
|
||||
const active = document.activeElement;
|
||||
focusedId = root.value?.contains(active) ? active.closest?.('[data-mission-roster-id]')?.dataset.missionRosterId ?? null : null;
|
||||
});
|
||||
onUpdated(() => {
|
||||
pointerStale = true;
|
||||
const id = focusedId;
|
||||
focusedId = null;
|
||||
const list = root.value;
|
||||
if (!id || !list) return;
|
||||
const active = document.activeElement;
|
||||
if (!list.contains(active)) {
|
||||
const retained = [...list.querySelectorAll('[data-mission-roster-id]')].find((item) => item.dataset.missionRosterId === id);
|
||||
(retained || list.querySelector(CONTINUATION))?.focus({ preventScroll: true });
|
||||
}
|
||||
const index = rosterIndex(document.activeElement);
|
||||
if (index !== null) layer.value?.rosterFocus(index);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div id="space-mission-roster" ref="root" class="space-mission-roster" :aria-label="t('Available Space Missions')">
|
||||
<div class="space-mission-roster-header">
|
||||
<div>
|
||||
<strong>{{ t('AVAILABLE MISSIONS') }}</strong>
|
||||
<span>{{ t('SELECT A MISSION TO INSPECT') }}</span>
|
||||
</div>
|
||||
<output data-mission-roster-count>{{ roster ? roster.count : '—' }}</output>
|
||||
</div>
|
||||
<div class="space-mission-roster-list ui-scroll" data-mission-roster-list>
|
||||
<UiEmpty v-if="!roster" class="space-mission-roster-empty" :title="t('LOADING 30-DAY MISSION INDEX')" />
|
||||
<UiEmpty v-else-if="!roster.entries.length" class="space-mission-roster-empty" :title="roster.empty" />
|
||||
<button v-for="entry in roster?.entries" v-else :key="entry.id" type="button" class="space-mission-roster-item" :data-mission-roster-index="entry.index" :data-mission-roster-id="entry.id" :aria-label="entry.ariaLabel" @click="layer?.selectMissionAt(entry.index)" @mouseenter="enter(entry.index)" @mousemove="move(entry.index)" @mouseleave="layer?.rosterPointerLeave()" @focus="layer?.rosterFocus(entry.index)" @blur="blur"><span class="space-mission-roster-marker" :style="{ '--mission-roster-color': entry.color }" aria-hidden="true"></span><span class="space-mission-roster-copy"><strong>{{ entry.label }}</strong><small>{{ entry.provider }} · {{ entry.date }}</small></span><span class="space-mission-roster-chevron" aria-hidden="true">›</span></button>
|
||||
</div>
|
||||
<p class="space-mission-roster-focus-continuation" tabindex="-1" data-mission-roster-focus-continuation>{{ t('TAB PREVIEWS · ENTER / SPACE SELECTS') }}</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,19 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { useDisplayStore } from '../../stores/display.js';
|
||||
|
||||
// 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
|
||||
// it when the shell is destroyed; desktop CSS hides them meanwhile.
|
||||
const { phoneShell: phone } = storeToRefs(useDisplayStore());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<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 phone.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>
|
||||
</nav>
|
||||
</Teleport>
|
||||
</template>
|
||||
@@ -0,0 +1,73 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import RailPanel from '../../rail/RailPanel.vue';
|
||||
import { vClassToggle } from '../../rail/classToggle.js';
|
||||
import UiSlider from '../../kit/UiSlider.js';
|
||||
import { useRadioStore } from '../../stores/radio.js';
|
||||
import RadioTuner from './RadioTuner.vue';
|
||||
import SdrCard from './SdrCard.vue';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiSelect from '../../kit/UiSelect.js';
|
||||
|
||||
// The Radio panel inside Context. RadioControls presents the directory row,
|
||||
// station card, transport, volume and playback line and publishes them;
|
||||
// until it does, the panel shows its initial markup. RadioTuner renders the
|
||||
// directory tuner and SdrCard the local RTL-SDR card. Its controls call
|
||||
// RadioControls through the store.
|
||||
const store = useRadioStore();
|
||||
const { act } = store;
|
||||
const { view: radio, sdr } = storeToRefs(store);
|
||||
// A refused station tag puts the select back on the tag the filter keeps.
|
||||
const setFilter = (select) => {
|
||||
select.value = act('setRadioFilter', select.value) ?? select.value;
|
||||
};
|
||||
// Only whether the receiver is connected reaches the panel; the card renders
|
||||
// its own frames.
|
||||
const sdrConnected = computed(() => sdr.value?.connectionActive ?? null);
|
||||
// The collapse button keeps Radio's own wording, not "Expand RADIO".
|
||||
const radioWords = computed(() => ({
|
||||
expandLabel: t('Expand Radio section'),
|
||||
collapseLabel: t('Collapse Radio section'),
|
||||
expandTitle: t('Expand Radio'),
|
||||
collapseTitle: t('Collapse Radio'),
|
||||
}));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RailPanel id="radio-panel" tag="section" start-collapsed v-class-toggle="{ ...(radio && { 'radio-enabled': radio.enabled, 'lifecycle-uncertain': radio.uncertain }), ...(sdrConnected !== null && { 'sdr-connected': sdrConnected }) }" :aria-label="t('Internet radio and local SDR')" :title="t('RADIO')" :toggle-words="radioWords" :glow="false" scroll>
|
||||
<template #badge><span id="radio-layer-state" class="radio-layer-state" :class="{ active: radio?.layerState.active }">{{ radio ? radio.layerState.text : t('OFF') }}</span></template>
|
||||
<div class="radio-directory-row">
|
||||
<UiButton id="radio-enable-btn" @click="act('toggleRadio', 'panel')" class="panel-layer-toggle" :pressed="radio?.enable.active ?? false" pressed-class="active" :aria-label="radio?.enable.label" :aria-disabled="radio ? String(radio.enable.busy) : undefined" :aria-busy="radio ? String(radio.enable.busy) : undefined">{{ radio ? radio.enable.text : t('ENABLE') }}</UiButton>
|
||||
<label class="radio-filter-label" for="radio-filter">{{ t('STATION TAG') }}</label>
|
||||
<UiSelect class="gev-field" id="radio-filter" @change="setFilter($event.target)" :aria-label="t('Filter stations by station tag')" :disabled="radio ? radio.filter.disabled : true" v-bind="radio?.filter.color ? { style: { color: radio.filter.color } } : {}" :model-value="radio ? radio.filter.value : 'all'">
|
||||
<option v-if="!radio?.filter.options" value="all">{{ t('All', { context: 'radio tag' }) }}</option><template v-else><option v-for="option in radio.filter.options" :key="option.id" :value="option.id" :data-radio-color="option.color" :style="{ color: option.color }" :aria-label="option.label">● {{ option.label }}</option></template>
|
||||
</UiSelect>
|
||||
</div>
|
||||
<div id="radio-station-card" class="radio-station-card" aria-live="polite">
|
||||
<strong id="radio-station-name">{{ radio ? radio.station.name : t('NO STATION SELECTED') }}</strong>
|
||||
<span id="radio-station-meta">{{ radio ? radio.station.meta : t('Enable Radio, then choose a globe marker or use next.') }}</span>
|
||||
<span id="radio-station-tags">{{ radio?.station.tags ?? '' }}</span>
|
||||
</div>
|
||||
<RadioTuner />
|
||||
<div class="radio-transport" role="group" :aria-label="t('Radio playback')">
|
||||
<button id="radio-prev-btn" @click="act('cycleRadio', -1)" type="button" :aria-label="t('Previous filtered station')" :disabled="radio ? radio.transport.stepDisabled : true">{{ t('PREV') }}</button>
|
||||
<button id="radio-play-btn" @click="act('toggleRadioPlayback')" type="button" v-class-toggle="{ active: radio?.transport.play.active }" :aria-label="radio ? radio.transport.play.label : t('Play selected station')" :disabled="radio ? radio.transport.play.disabled : true">{{ radio ? radio.transport.play.text : t('PLAY') }}</button>
|
||||
<button id="radio-next-btn" @click="act('cycleRadio', 1)" type="button" :aria-label="t('Next filtered station')" :disabled="radio ? radio.transport.stepDisabled : true">{{ t('NEXT') }}</button>
|
||||
<button id="radio-stop-btn" @click="act('stopRadio')" type="button" :aria-label="t('Stop radio playback')" :disabled="radio ? radio.transport.stopDisabled : true">{{ t('STOP') }}</button>
|
||||
</div>
|
||||
<label class="radio-volume-row" for="radio-volume">
|
||||
<span>{{ t('VOLUME') }}</span>
|
||||
<UiSlider id="radio-volume" hold @update:model-value="act('setRadioVolume', $event)" min="0" max="100" :aria-label="t('Radio volume')" :disabled="radio?.volume.disabled" :model-value="radio ? radio.volume.value : 80" />
|
||||
<output id="radio-volume-value" class="gev-slider-value" for="radio-volume">{{ radio ? `${radio.volume.value}%` : '80%' }}</output>
|
||||
</label>
|
||||
<div id="radio-playback-state" class="radio-playback-state" :class="{ error: radio?.playback.error }" role="status" aria-live="polite">{{ radio ? radio.playback.text : t('Radio off') }}</div>
|
||||
<div class="radio-links">
|
||||
<a id="radio-station-homepage" :href="radio ? radio.station.homepage || undefined : '#'" target="_blank" rel="noopener noreferrer" :hidden="radio ? !radio.station.homepage : true">{{ t('STATION SITE') }}</a>
|
||||
<a href="https://www.radio-browser.info/" target="_blank" rel="noopener noreferrer">{{ t('DIRECTORY: RADIO BROWSER') }}</a>
|
||||
</div>
|
||||
<p class="radio-privacy">{{ t('Audio connects directly to the broadcaster after you press play. Your IP is visible to that broadcaster.') }}</p>
|
||||
<SdrCard />
|
||||
</RailPanel>
|
||||
</template>
|
||||
@@ -0,0 +1,84 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import {
|
||||
computed,
|
||||
onBeforeUnmount,
|
||||
onMounted,
|
||||
shallowRef,
|
||||
useTemplateRef,
|
||||
} from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { vClassToggle } from '../../rail/classToggle.js';
|
||||
import { vRangeValue } from '../../rail/rangeValue.js';
|
||||
import { buildRadioTunerTicks } from '../../radioTunerModel.js';
|
||||
import { useRadioStore } from '../../stores/radio.js';
|
||||
|
||||
// The Radio panel's directory tuner. RadioControls owns the drag and
|
||||
// publishes the band, the readouts, the slider and where the needle sits;
|
||||
// until it does, the tuner shows its initial markup. The slider hands its
|
||||
// pointer, key and value events to RadioControls through the store. The
|
||||
// tick tape is laid out here against the dial's width. A hidden dial
|
||||
// measures 0 wide, so the last real width is kept and no ticks are drawn
|
||||
// before there is one: ticks laid out for no width would slide into place
|
||||
// when the tuner appears.
|
||||
const store = useRadioStore();
|
||||
const { act } = store;
|
||||
const { tuner } = storeToRefs(store);
|
||||
const dial = useTemplateRef('dial');
|
||||
const dialWidth = shallowRef(0);
|
||||
let resizeObserver = null;
|
||||
onMounted(() => {
|
||||
const measure = () => {
|
||||
const width = dial.value?.getBoundingClientRect().width ?? 0;
|
||||
if (width > 0) dialWidth.value = width;
|
||||
};
|
||||
measure();
|
||||
if (typeof ResizeObserver !== 'function') return;
|
||||
resizeObserver = new ResizeObserver(measure);
|
||||
resizeObserver.observe(dial.value);
|
||||
});
|
||||
onBeforeUnmount(() => resizeObserver?.disconnect());
|
||||
const tape = computed(() =>
|
||||
tuner.value && dialWidth.value > 0
|
||||
? buildRadioTunerTicks(
|
||||
tuner.value.coordinate,
|
||||
tuner.value.count,
|
||||
dialWidth.value,
|
||||
)
|
||||
: null,
|
||||
);
|
||||
// The drag class comes off only once the snapped needle has been laid out
|
||||
// with transitions still off, so the needle cannot animate from where the
|
||||
// drag let go.
|
||||
const vTunerDragging = {
|
||||
mounted(el, { value }) {
|
||||
el.classList.toggle('is-dragging', Boolean(value));
|
||||
},
|
||||
updated(el, { value }) {
|
||||
if (!value && el.classList.contains('is-dragging'))
|
||||
void el.querySelector('.radio-tuner-needle')?.offsetLeft;
|
||||
el.classList.toggle('is-dragging', Boolean(value));
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div id="radio-tuner" class="radio-tuner" :hidden="tuner ? !tuner.available : true" :style="tuner?.ratio == null ? null : { '--radio-tuner-ratio': String(tuner.ratio) }" v-class-toggle="{ 'is-static': tuner?.static }" v-tuner-dragging="tuner?.dragging">
|
||||
<div class="radio-tuner-header">
|
||||
<span id="radio-tuner-band-label">{{ tuner?.band ?? t('DIRECTORY BAND') }}</span>
|
||||
<output id="radio-tuner-value" for="radio-tuner-slider">{{ tuner?.value ?? t('DRAG TO TUNE') }}</output>
|
||||
</div>
|
||||
<div ref="dial" class="radio-tuner-dial">
|
||||
<div class="radio-tuner-scale" aria-hidden="true" :style="tape && { '--radio-tuner-tick-pitch': `${tape.pitchPx}px` }"><span v-for="(tick, index) in tape?.ticks ?? []" :key="index" class="radio-tuner-tick" :class="{ 'is-current': tick.current }" :style="{ left: `${tick.xPx}px` }" :data-station-index="tick.stationIndex">{{ tick.label }}</span></div>
|
||||
<div id="radio-tuner-needle" class="radio-tuner-needle" aria-hidden="true"></div>
|
||||
<input id="radio-tuner-slider" type="range" min="0" :max="tuner ? tuner.max : 0" step="1" value="0" v-range-value="tuner ? tuner.slot : 0"
|
||||
@pointerdown="act('tunerPointerDown', $event)" @pointermove="act('tunerPointerMove', $event)" @pointerup="act('tunerPointerUp', $event)" @pointercancel="act('tunerPointerCancel', $event)" @lostpointercapture="act('tunerLostPointerCapture', $event)"
|
||||
@keydown="act('tunerKeyDown', $event)" @keyup="act('tunerKeyUp', $event)" @input="act('tunerInput')" @change="act('tunerChange')" @blur="act('tunerBlur')"
|
||||
:aria-label="t('Tune available internet radio stations')" :aria-valuetext="tuner?.valuetext ?? t('No station available')" :disabled="tuner ? !tuner.available : true" />
|
||||
</div>
|
||||
<div class="radio-tuner-readout">
|
||||
<span id="radio-tuner-station">{{ tuner?.station ?? t('ALL · DRAG THE NEEDLE') }}</span>
|
||||
<span>{{ t('SNAPS TO AVAILABLE STATIONS') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,64 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed, onBeforeUnmount, onMounted, shallowRef, useTemplateRef } from 'vue';
|
||||
import { t, tn } from '../../../i18n/index.js';
|
||||
import { vStatusText } from '../../rail/statusText.js';
|
||||
import { useSceneSharingStore } from '../../stores/sceneSharing.js';
|
||||
|
||||
// One open scene sharing dialog, as src/ui/sceneSharing.js presents it. The
|
||||
// parent keys this by dialog, so each one opens as a fresh modal.
|
||||
const props = defineProps({ view: { type: Object, required: true } });
|
||||
const { controls } = storeToRefs(useSceneSharingStore());
|
||||
|
||||
const root = useTemplateRef('root');
|
||||
onMounted(() => root.value?.showModal?.());
|
||||
onBeforeUnmount(() => {
|
||||
if (root.value?.open) root.value.close();
|
||||
});
|
||||
|
||||
const bodyItems = computed(() => props.view.items.filter((item) => item.place === 'body'));
|
||||
const footerItems = computed(() => props.view.items.filter((item) => item.place === 'footer'));
|
||||
// Typing reaches the item before any republish, so a field is rewritten only
|
||||
// when the owner changes its value, focused or not, as the old code did.
|
||||
const statusText = computed(() => ({ text: props.view.status, seq: props.view.statusSeq }));
|
||||
|
||||
// The browser draws a file input's button and "no file" text in its own
|
||||
// language. The native input is stretched, transparent, over the whole row
|
||||
// (so click, focus and drops stay native) and translated text is drawn under.
|
||||
const focusedFile = shallowRef(null);
|
||||
const chosenText = (item) => {
|
||||
const count = item.files.length;
|
||||
// One file shows its name, like the browser's own picker did.
|
||||
return count === 1
|
||||
? item.files[0].name
|
||||
: count
|
||||
? tn(count, '{count} file selected', '{count} files selected')
|
||||
: t('No file chosen');
|
||||
};
|
||||
const onFiles = (item, event) => controls.value?.setFiles(item.id, event.target.files ?? []);
|
||||
|
||||
const dialogStyle = { background: '#08141e', color: '#e3faff', border: '1px solid #397080', borderRadius: '6px', padding: '20px', width: 'min(720px,calc(100vw - 32px))', boxSizing: 'border-box', position: 'fixed', inset: '0', margin: 'auto', maxHeight: 'calc(100vh - 32px)', overflow: 'auto', font: '14px/1.5 sans-serif' };
|
||||
const buttonStyle = { background: '#10242e', color: '#e3faff', border: '1px solid #397080', borderRadius: '3px', padding: '7px 11px', margin: '6px 6px 6px 0', cursor: 'pointer', font: 'inherit' };
|
||||
const fieldStyle = (multiline) => ({ display: 'block', boxSizing: 'border-box', width: '100%', padding: '7px', margin: '6px 0 14px', color: '#e3faff', background: '#10242e', border: '1px solid #397080', font: multiline ? '12px monospace' : 'inherit' });
|
||||
const fileInputStyle = { ...fieldStyle(false), position: 'absolute', inset: '0', width: '100%', height: '100%', margin: '0', padding: '0', border: '0', opacity: '0', cursor: 'pointer', zIndex: '1' };
|
||||
const fileRowStyle = { display: 'flex', alignItems: 'center', gap: '10px', margin: '6px 0 14px', padding: '7px', background: '#10242e', border: '1px solid #397080' };
|
||||
const chooserStyle = (focused) => ({ padding: '3px 9px', border: '1px solid #397080', borderRadius: '3px', background: '#08141e', cursor: 'pointer', outline: focused ? '2px solid #e3faff' : '' });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<dialog ref="root" data-director-dialog class="director-sharing-dialog" :aria-label="view.title" :style="dialogStyle" @cancel.prevent="controls?.cancel()">
|
||||
<h2 style="margin-bottom: 12px">{{ view.title }}</h2>
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
</dialog>
|
||||
</template>
|
||||
@@ -0,0 +1,50 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { useSceneInteractionsStore } from '../../stores/sceneInteractions.js';
|
||||
|
||||
// The active shot's Scene actions panel, inside the viewer's container, as
|
||||
// the scene interactions owner (src/scenes/interactions.js) presents it.
|
||||
const { panel, controls } = storeToRefs(useSceneInteractionsStore());
|
||||
|
||||
const panelStyle = {
|
||||
position: 'absolute',
|
||||
left: '12px',
|
||||
bottom: '80px',
|
||||
zIndex: '31',
|
||||
maxWidth: '300px',
|
||||
maxHeight: '40vh',
|
||||
overflowY: 'auto',
|
||||
background: '#08141eed',
|
||||
color: '#e3faff',
|
||||
border: '1px solid #2491a8',
|
||||
padding: '10px',
|
||||
font: '13px sans-serif',
|
||||
};
|
||||
const buttonStyle = {
|
||||
display: 'block',
|
||||
background: '#10242e',
|
||||
color: '#e3faff',
|
||||
border: '1px solid #397080',
|
||||
borderRadius: '3px',
|
||||
padding: '6px 10px',
|
||||
cursor: 'pointer',
|
||||
font: 'inherit',
|
||||
margin: '6px 0',
|
||||
maxWidth: '100%',
|
||||
whiteSpace: 'normal',
|
||||
};
|
||||
// Each button keeps the panel it was rendered for, so one left over from an
|
||||
// earlier panel cannot run the current actions.
|
||||
const onClick = (owner, id) => () => controls.value?.dispatch(id, owner);
|
||||
const outline = (id) => ({
|
||||
...buttonStyle,
|
||||
outline: panel.value.outlined.includes(id) ? '2px solid #6eeaff' : '',
|
||||
});
|
||||
</script>
|
||||
|
||||
<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>
|
||||
</Teleport>
|
||||
</template>
|
||||
@@ -0,0 +1,34 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useScreenAnnotationsStore } from '../../stores/screenAnnotations.js';
|
||||
|
||||
// The screen-space annotation board over the page, as the screen annotation
|
||||
// renderer (src/annotations/screenAnnotationRenderer.js) presents it.
|
||||
const { board, controls } = storeToRefs(useScreenAnnotationsStore());
|
||||
|
||||
// Each element goes to the renderer it was rendered for, which measures it.
|
||||
const vAnnoElement = {
|
||||
mounted(el, { value }) {
|
||||
controls.value?.attach(value.owner, value.key, value.kind, el);
|
||||
},
|
||||
beforeUnmount(el, { value }) {
|
||||
controls.value?.attach(value.owner, value.key, value.kind, null);
|
||||
},
|
||||
};
|
||||
// The draw-on stroke reads solid once its dashoffset transition ends.
|
||||
const onTransitionEnd = (owner, key) => (event) => {
|
||||
if (event.propertyName === 'stroke-dashoffset')
|
||||
controls.value?.drawn(owner, key);
|
||||
};
|
||||
const display = (value) => (value ? { display: value } : undefined);
|
||||
const drawStyle = (mark, child) =>
|
||||
mark.drawn && child.attrs.class?.includes('gev-draw')
|
||||
? { strokeDasharray: 'none', ...display(child.display) }
|
||||
: display(child.display);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport v-if="board" to="body">
|
||||
<div class="gev-screen-whiteboard"><svg class="gev-screen-whiteboard-svg" preserveAspectRatio="none" :viewBox="board.viewBox ?? undefined"><defs><filter id="gev-sketch" x="-20%" y="-20%" width="140%" height="140%"><feTurbulence type="fractalNoise" baseFrequency="0.014" numOctaves="2" seed="7" result="n" /><feDisplacementMap in="SourceGraphic" in2="n" scale="2.2" xChannelSelector="R" yChannelSelector="G" /></filter><marker v-for="marker in board.markers" :id="`gev-arrow-${marker.key}`" :key="marker.key" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M 0 0 L 10 5 L 0 10 z" :fill="marker.fill" /></marker></defs><g v-for="mark in board.marks" :key="mark.key" v-anno-element="{ owner: board.owner, key: mark.key, kind: 'group' }" :class="mark.className" :opacity="mark.opacity" :style="display(mark.display)" :onTransitionend="onTransitionEnd(board.owner, mark.key)"><template v-for="child in mark.children" :key="child.key"><polygon v-if="child.tag === 'polygon'" v-bind="child.attrs" :style="drawStyle(mark, child)" /><polyline v-else-if="child.tag === 'polyline'" v-bind="child.attrs" :style="drawStyle(mark, child)" /><path v-else-if="child.tag === 'path'" v-bind="child.attrs" :style="drawStyle(mark, child)" /><circle v-else-if="child.tag === 'circle'" v-bind="child.attrs" :style="display(child.display)" /><line v-else-if="child.tag === 'line'" v-bind="child.attrs" :style="display(child.display)" /><g v-else-if="child.tag === 'callout'" class="gev-anno-callout" :transform="child.transform ?? undefined"><rect rx="5" class="gev-anno-card" v-bind="child.card" /><rect class="gev-anno-accent" width="3" rx="1.5" :fill="child.fill" v-bind="child.accent" /><text v-anno-element="{ owner: board.owner, key: mark.key, kind: 'text' }" class="gev-anno-text" x="9" y="16">{{ child.text }}</text></g></template></g></svg></div>
|
||||
</Teleport>
|
||||
</template>
|
||||
@@ -0,0 +1,72 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { ref } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { R820T_GAIN_STEPS_DB } from '../../../sdr/gain.js';
|
||||
import { localSdrGainOptionLabel } from '../../localSdrPresentation.js';
|
||||
import { vClassToggle } from '../../rail/classToggle.js';
|
||||
import { vFieldValue } from '../../rail/fieldValue.js';
|
||||
import UiSlider from '../../kit/UiSlider.js';
|
||||
import { useRadioStore } from '../../stores/radio.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiSelect from '../../kit/UiSelect.js';
|
||||
|
||||
// The local RTL-SDR card in the Radio panel. LocalSdrControls presents it and
|
||||
// publishes it; until it does, the card shows its initial markup. Its
|
||||
// controls call LocalSdrControls through the store. The numeric gain
|
||||
// options read in the page language; their values stay numeric.
|
||||
const radio = useRadioStore();
|
||||
const { sdr } = storeToRefs(radio);
|
||||
const { act } = radio;
|
||||
const frequency = ref(null);
|
||||
const GAINS = R820T_GAIN_STEPS_DB.map((gain) => gain.toFixed(1));
|
||||
const tune = () => act('tuneSdr', frequency.value.value);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div id="sdr-radio-card" class="sdr-radio-card" role="group" :aria-label="t('Local RTL-SDR receiver')">
|
||||
<div class="sdr-radio-heading">
|
||||
<strong>{{ t('LOCAL RTL-SDR') }}</strong>
|
||||
<span id="sdr-connection-state" v-class-toggle="{ active: sdr?.connectionActive }">{{ sdr ? sdr.connectionLabel : 'NO USB' }}</span>
|
||||
</div>
|
||||
<p>{{ t('Chrome/Edge · WebUSB · one local tuner shared by FM and the Local ADS-B layer.') }}</p>
|
||||
<div class="sdr-radio-actions">
|
||||
<UiButton id="sdr-connect-btn" @click="act('toggleSdrConnection')" class="panel-layer-toggle" :pressed="sdr?.connectPressed ?? false" pressed-class="active" :disabled="sdr?.connectDisabled">{{ sdr ? sdr.connectLabel : t('CONNECT') }}</UiButton>
|
||||
<button id="sdr-locate-btn" type="button" @click="act('locateSdr')" v-class-toggle="{ active: sdr?.locateActive }" :title="t('Use your location for faster ADS-B position decoding')" :disabled="sdr?.locateDisabled">{{ sdr ? sdr.locateLabel : t('LOCATE') }}</button>
|
||||
<button id="sdr-change-device-btn" type="button" @click="act('changeSdrDevice')" :title="t('Choose a different RTL-SDR or receiver channel')" :disabled="sdr?.changeDeviceDisabled">{{ t('CHANGE DEVICE') }}</button>
|
||||
</div>
|
||||
<div class="sdr-mode-row" role="group" :aria-label="t('RTL-SDR receiver mode')">
|
||||
<UiButton id="sdr-mode-fm-btn" @click="act('setSdrMode', 'fm')" :pressed="sdr ? sdr.fmActive : true" pressed-class="active" :disabled="sdr?.modeDisabled" translate="no">FM</UiButton>
|
||||
<UiButton id="sdr-mode-adsb-btn" @click="act('setSdrMode', 'adsb')" :pressed="sdr?.adsbActive ?? false" pressed-class="active" :disabled="sdr?.modeDisabled" translate="no">ADS-B · 1090</UiButton>
|
||||
</div>
|
||||
<div class="sdr-gain-row">
|
||||
<label for="sdr-gain-select">{{ t('GAIN') }}</label>
|
||||
<UiSelect class="gev-field" id="sdr-gain-select" hold :model-value="sdr ? sdr.gain : 'auto'" @update:model-value="act('setSdrGain', $event)" :aria-label="t('RTL-SDR tuner gain for the current mode')" :disabled="sdr?.gainDisabled">
|
||||
<option value="auto">{{ t('AUTO') }}</option>
|
||||
<option v-for="gain in GAINS" :key="gain" :value="gain" translate="no">{{ localSdrGainOptionLabel(gain) }}</option>
|
||||
</UiSelect>
|
||||
</div>
|
||||
<div id="sdr-adsb-stats" class="sdr-adsb-stats" role="status" aria-live="off" :hidden="sdr ? sdr.statsHidden : true">
|
||||
<span><output id="sdr-stat-rate">{{ sdr ? sdr.stats.rate : '--' }}</output> <span>{{ t('MSG/S') }}</span></span>
|
||||
<span><output id="sdr-stat-heard">{{ sdr ? sdr.stats.heard : '0' }}</output> <span>{{ t('HEARD') }}</span></span>
|
||||
<span><output id="sdr-stat-positioned">{{ sdr ? sdr.stats.positioned : '0' }}</output> <span>{{ t('POSITIONED') }}</span></span>
|
||||
<span translate="no">IQ <output id="sdr-stat-iq">{{ sdr ? sdr.stats.iq : '--' }}</output></span>
|
||||
</div>
|
||||
<div class="sdr-frequency-row">
|
||||
<label for="sdr-frequency-input">{{ t('FM MHZ') }}</label>
|
||||
<input ref="frequency" class="gev-field" id="sdr-frequency-input" @keydown.enter.prevent="tune" type="number" min="87.5" max="108" step="0.1" value="98.5" inputmode="decimal" :disabled="sdr?.frequencyDisabled" v-field-value="sdr ? sdr.frequency : '98.5'" />
|
||||
<button id="sdr-tune-btn" type="button" @click="tune" :disabled="sdr?.tuneDisabled">{{ t('TUNE') }}</button>
|
||||
</div>
|
||||
<div class="sdr-seek-row" role="group" :aria-label="t('Seek broadcast FM stations')">
|
||||
<button id="sdr-seek-back-btn" type="button" @click="act('seekSdr', -1)" :disabled="sdr ? sdr.seekDisabled : true">{{ t('◀ SEEK') }}</button>
|
||||
<button id="sdr-seek-forward-btn" type="button" @click="act('seekSdr', 1)" :disabled="sdr ? sdr.seekDisabled : true">{{ t('SEEK ▶') }}</button>
|
||||
</div>
|
||||
<label class="radio-volume-row" for="sdr-volume">
|
||||
<span>{{ t('SDR VOL') }}</span>
|
||||
<UiSlider id="sdr-volume" hold @update:model-value="act('setSdrVolume', $event)" min="0" max="100" :aria-label="t('Local SDR volume')" :disabled="sdr?.volumeDisabled" :model-value="sdr ? sdr.volume : 80" />
|
||||
<output id="sdr-volume-value" class="gev-slider-value" for="sdr-volume">{{ sdr ? sdr.volumeText : '80%' }}</output>
|
||||
</label>
|
||||
<div id="sdr-status" class="radio-playback-state" :class="{ error: sdr?.statusError }" role="status" aria-live="polite">{{ sdr ? sdr.statusText : t('Connect an RTL-SDR to begin.') }}</div>
|
||||
<div id="sdr-feed-status" class="sdr-feed-status" role="status" aria-live="off" :hidden="sdr ? sdr.feedLine === null : true">{{ sdr?.feedLine ?? '' }}</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,177 @@
|
||||
<script setup>
|
||||
import { nextTick, onBeforeUnmount, ref, shallowRef, watch } from 'vue';
|
||||
import {
|
||||
FLAP_BLANK,
|
||||
FLAP_CHAR_MS,
|
||||
FLAP_SETTLE_SLACK_MS,
|
||||
SPLIT_FLAP_ENABLED,
|
||||
isOnScreen,
|
||||
planSplitFlap,
|
||||
prefersReducedMotion,
|
||||
visibleGlyphs,
|
||||
} from '../../../splitFlap.js';
|
||||
|
||||
// A status label that flips its changed characters into place, planned by
|
||||
// src/splitFlap.js (read its invariants first). The text is one long-lived
|
||||
// node whose data is the only thing a change writes; the aria-hidden cells
|
||||
// stand in for it while a cascade plays and carry their glyphs as generated
|
||||
// content, so textContent is the settled label at every instant.
|
||||
const props = defineProps({
|
||||
text: { type: String, default: '' },
|
||||
// Swap the text without a cascade: a completion, not another stage.
|
||||
immediate: { type: Boolean, default: false },
|
||||
// Rest at once and stay still: the label's owner is gone.
|
||||
stopped: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
// The label's one Text node. Vue would patch a lone `{{ text }}` child by
|
||||
// setting textContent, which swaps the node; this writes only its data.
|
||||
const vFlapText = {
|
||||
mounted(el, { value }) {
|
||||
el.append(el.ownerDocument.createTextNode(value));
|
||||
},
|
||||
updated(el, { value }) {
|
||||
if (el.firstChild.data !== value) el.firstChild.data = value;
|
||||
},
|
||||
};
|
||||
|
||||
const root = ref(null);
|
||||
// The cascade's columns; each cascade keys its own, so the flaps restart.
|
||||
const cells = shallowRef([]);
|
||||
const active = ref(false);
|
||||
// The width ease, `{width, totalMs}`, or null at the natural width.
|
||||
const sizing = shallowRef(null);
|
||||
// The cascade in flight: its plan, start and the one settle timer.
|
||||
let flap = null;
|
||||
// Bumped by every change; a stale continuation finds it moved on.
|
||||
let run = 0;
|
||||
|
||||
const now = () => globalThis.performance?.now?.() ?? Date.now();
|
||||
const measure = () => root.value?.getBoundingClientRect?.().width ?? 0;
|
||||
|
||||
function rest() {
|
||||
active.value = false;
|
||||
cells.value = [];
|
||||
}
|
||||
|
||||
function clearFlap() {
|
||||
if (flap) clearTimeout(flap.timer);
|
||||
flap = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ease between two measured widths. The start width lays out before the end
|
||||
* width renders, so the transition runs; it ends on transitionend, not a
|
||||
* timer. A growing label eases as its cells go in, a shrinking one once the
|
||||
* flaps have landed.
|
||||
*/
|
||||
async function easeWidth(from, to, totalMs, change) {
|
||||
if (!(from > 0.5) || Math.abs(to - from) <= 0.5) {
|
||||
sizing.value = null;
|
||||
return;
|
||||
}
|
||||
sizing.value = { width: from, totalMs };
|
||||
await nextTick();
|
||||
if (change !== run || !root.value) return;
|
||||
void root.value.offsetWidth;
|
||||
sizing.value = { width: to, totalMs };
|
||||
}
|
||||
|
||||
function endEase(event) {
|
||||
if (event.target !== root.value || event.propertyName !== 'width') return;
|
||||
sizing.value = null;
|
||||
}
|
||||
|
||||
/** Strip the cells once the cascade lands, then take up any width slack. */
|
||||
async function settle(change, easeMs) {
|
||||
flap = null;
|
||||
if (change !== run) return;
|
||||
const cascadeWidth = measure();
|
||||
sizing.value = null;
|
||||
rest();
|
||||
await nextTick();
|
||||
if (change !== run) return;
|
||||
void easeWidth(cascadeWidth, measure(), easeMs, change);
|
||||
}
|
||||
|
||||
// Runs before the label re-renders, while it still shows the old text: what
|
||||
// was on screen and its width are read here. Whether the label is on screen
|
||||
// is read once the change has rendered, after its chip shows or hides with it;
|
||||
// the cells then go in before the browser paints.
|
||||
watch(
|
||||
() => props.text,
|
||||
async (next, settled) => {
|
||||
const change = ++run;
|
||||
// What the viewer sees right now: mid-cascade, columns whose stagger has
|
||||
// not elapsed still show the previous label (invariant 3).
|
||||
const displayed = flap
|
||||
? visibleGlyphs(flap.plan, now() - flap.startedAt, {
|
||||
charMs: FLAP_CHAR_MS,
|
||||
})
|
||||
: settled;
|
||||
clearFlap();
|
||||
const beforeWidth = measure();
|
||||
sizing.value = null;
|
||||
rest();
|
||||
if (
|
||||
!SPLIT_FLAP_ENABLED ||
|
||||
props.immediate ||
|
||||
props.stopped ||
|
||||
prefersReducedMotion()
|
||||
)
|
||||
return;
|
||||
await nextTick();
|
||||
if (change !== run || !isOnScreen(root.value)) return;
|
||||
const plan = planSplitFlap(displayed, next);
|
||||
if (!plan.changedCount) return;
|
||||
// Every column holds its width and index for the whole cascade; one the
|
||||
// new string does not reach flaps to a blank (invariant 4).
|
||||
cells.value = plan.cells.map((cell) => ({
|
||||
key: `${change}:${cell.index}`,
|
||||
next: cell.to || FLAP_BLANK,
|
||||
prev: cell.changed ? cell.from || FLAP_BLANK : null,
|
||||
delay: cell.changed ? `${cell.delayMs}ms` : null,
|
||||
}));
|
||||
active.value = true;
|
||||
flap = {
|
||||
plan,
|
||||
startedAt: now(),
|
||||
timer: setTimeout(
|
||||
() => settle(change, plan.durationMs),
|
||||
plan.durationMs + FLAP_SETTLE_SLACK_MS,
|
||||
),
|
||||
};
|
||||
await nextTick();
|
||||
if (change !== run) return;
|
||||
void easeWidth(beforeWidth, measure(), plan.durationMs, change);
|
||||
},
|
||||
{ flush: 'pre' },
|
||||
);
|
||||
|
||||
function stop() {
|
||||
run += 1;
|
||||
clearFlap();
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.stopped,
|
||||
(stopped) => {
|
||||
if (!stopped) return;
|
||||
stop();
|
||||
sizing.value = null;
|
||||
rest();
|
||||
},
|
||||
);
|
||||
|
||||
onBeforeUnmount(stop);
|
||||
|
||||
const hostStyle = () => ({
|
||||
'--gev-flap-dur': active.value ? `${FLAP_CHAR_MS}ms` : null,
|
||||
'--gev-flap-total': sizing.value ? `${sizing.value.totalMs}ms` : null,
|
||||
width: sizing.value ? `${sizing.value.width}px` : null,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span ref="root" class="gev-flap-host" :class="{ 'gev-flap-active': active, 'gev-flap-sizing': !!sizing }" :style="hostStyle()" @transitionend="endEase" @transitioncancel="endEase"><span v-flap-text="text" class="gev-flap-text"></span><span class="gev-flap-cells" aria-hidden="true"><span v-for="cell in cells" :key="cell.key" class="gev-flap-cell" :class="{ 'is-flapping': cell.prev != null }" :data-flap-next="cell.next" :data-flap-prev="cell.prev ?? undefined" :style="cell.delay ? { '--gev-flap-delay': cell.delay } : undefined"></span></span></span>
|
||||
</template>
|
||||
@@ -0,0 +1,185 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed, shallowRef, watch } from 'vue';
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiSegmented from '../../kit/UiSegmented.vue';
|
||||
import RailPanel from '../../rail/RailPanel.vue';
|
||||
import RailChips from '../../rail/RailChips.vue';
|
||||
import { useStreetLevelStore } from '../../stores/streetLevel.js';
|
||||
import UiSlider from '../../kit/UiSlider.js';
|
||||
|
||||
// The Street Level panel, rendered from what StreetLevelControls presents.
|
||||
// Until it renders, the panel shows its initial markup. The viewer element
|
||||
// belongs to the layer and EXPAND to the controls.
|
||||
const store = useStreetLevelStore();
|
||||
const { view, expanded, expandAvailable } = storeToRefs(store);
|
||||
|
||||
const status = computed(
|
||||
() =>
|
||||
view.value?.status ?? {
|
||||
text: t('OFF'),
|
||||
tone: '',
|
||||
pressed: false,
|
||||
title: t('Turn Street Level on or off'),
|
||||
},
|
||||
);
|
||||
const viewer = computed(
|
||||
() =>
|
||||
view.value?.viewer ?? {
|
||||
open: false,
|
||||
loading: false,
|
||||
renderMode: 'letterbox',
|
||||
renderModes: true,
|
||||
},
|
||||
);
|
||||
const shows = computed(
|
||||
() => view.value?.filterControls ?? { pano: true, since: true },
|
||||
);
|
||||
const pano = computed(() => view.value?.filter.pano ?? 'all');
|
||||
|
||||
const renderModeOptions = computed(() => [
|
||||
{
|
||||
value: 'letterbox',
|
||||
label: t('FIT'),
|
||||
attrs: {
|
||||
'data-sl-render': 'letterbox',
|
||||
title: t('Fit: show the whole photo, with dark bars where its shape differs from the frame'),
|
||||
},
|
||||
},
|
||||
{
|
||||
value: 'fill',
|
||||
label: t('FILL'),
|
||||
attrs: {
|
||||
'data-sl-render': 'fill',
|
||||
title: t('Fill: fill the frame edge to edge, cropping the photo'),
|
||||
},
|
||||
},
|
||||
]);
|
||||
const panoOptions = computed(() => [
|
||||
{ value: 'all', label: t('ALL'), attrs: { 'data-sl-pano': 'all' } },
|
||||
{ value: 'pano', label: '360°', attrs: { 'data-sl-pano': 'pano' } },
|
||||
{ value: 'flat', label: t('FLAT'), attrs: { 'data-sl-pano': 'flat' } },
|
||||
]);
|
||||
|
||||
// The image line and OPEN keep what they last showed while hidden.
|
||||
const image = shallowRef({
|
||||
captionLeft: '',
|
||||
captionRight: '',
|
||||
link: null,
|
||||
href: '#',
|
||||
linkLabel: '',
|
||||
});
|
||||
// The page's placeholder, hidden until the controls name the providers.
|
||||
const nearest = shallowRef({
|
||||
label: 'OPEN STREET VIEW', // i18n-ignore: never shown before it is replaced
|
||||
title: '',
|
||||
disabled: false,
|
||||
});
|
||||
watch(
|
||||
view,
|
||||
(next) => {
|
||||
if (next?.viewer.open) {
|
||||
const { captionLeft, captionRight, link, linkLabel } = next.viewer;
|
||||
image.value = {
|
||||
captionLeft,
|
||||
captionRight,
|
||||
link,
|
||||
href: link || image.value.href,
|
||||
linkLabel: linkLabel || image.value.linkLabel,
|
||||
};
|
||||
}
|
||||
if (next?.nearest.visible) nearest.value = next.nearest;
|
||||
},
|
||||
{ flush: 'sync' },
|
||||
);
|
||||
|
||||
// SINCE: the readout follows the thumb; the window is recorded on release.
|
||||
const sinceLabel = shallowRef(t('ANY DATE'));
|
||||
const stop = (input) => Number(input.value) || 0;
|
||||
function onSinceInput(event) {
|
||||
// Without controls attached the readout stays as it is.
|
||||
sinceLabel.value =
|
||||
store.describeSinceStop(stop(event.target)) || sinceLabel.value;
|
||||
}
|
||||
function onSinceChange(event) {
|
||||
store.act('setSinceStop', stop(event.target));
|
||||
}
|
||||
/**
|
||||
* Each new presentation places the thumb, as the controls' renders did, but
|
||||
* never under the user's hand; the readout's own updates leave it alone.
|
||||
* Once the thumb is at the presented window, the readout shows it in full.
|
||||
*/
|
||||
const placeThumb = (el, { value: since, oldValue }) => {
|
||||
if (!since || since === oldValue) return;
|
||||
const index = String(since.index);
|
||||
if (el.ownerDocument.activeElement !== el && el.value !== index)
|
||||
el.value = index;
|
||||
if (el.value === index) sinceLabel.value = since.label;
|
||||
};
|
||||
// The thumb starts at the first stop: a value attribute on the slider would
|
||||
// be written again on each of its renders.
|
||||
const vThumb = {
|
||||
mounted(el, binding) {
|
||||
el.value = '0';
|
||||
placeThumb(el, binding);
|
||||
},
|
||||
updated: placeThumb,
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RailPanel id="street-level-panel" start-collapsed :data-sl-enabled="view ? String(view.enabled) : undefined" :title="t('STREET LEVEL')" sideways scroll rail-scroller>
|
||||
<template #actions><UiButton id="sl-status" :class="`sl-status${status.tone ? ` is-${status.tone}` : ''}`" :pressed="Boolean(status.pressed)" :title="status.title">{{ status.text }}</UiButton></template>
|
||||
<div id="sl-body" class="sl-body">
|
||||
<div id="sl-viewer-wrap" class="sl-viewer-wrap" :hidden="!viewer.open">
|
||||
<div class="sl-viewer-bar">
|
||||
<div class="sl-viewer-tools">
|
||||
<UiButton id="sl-viewer-expand" class="scene-btn" :hidden="!expandAvailable" :pressed="Boolean(expanded)" :aria-label="expanded === null ? undefined : expanded ? t('Shrink') : t('Expand')" :title="t('Show the street-level view full screen (Esc shrinks it)')"><span class="sl-btn-icon" aria-hidden="true">{{ expanded ? '⤡' : '⤢' }}</span><span class="sl-btn-text">{{ expanded ? t('SHRINK') : t('EXPAND') }}</span></UiButton>
|
||||
<UiSegmented class="sl-seg" item-class="sl-seg-btn" active-class="is-active" keyboard="radio" :hidden="!viewer.renderModes" :label="t('Image fit')" :options="renderModeOptions" :model-value="viewer.renderMode" @update:model-value="store.act('setRenderMode', $event)" />
|
||||
</div>
|
||||
<div class="sl-viewer-tools sl-viewer-tools-right">
|
||||
<button id="sl-viewer-close" class="sl-viewer-x" type="button" :title="t('Close the image and deselect it on the map')" :aria-label="t('Close the street-level image')">×</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sl-viewer-stage">
|
||||
<div id="sl-viewer-placeholder" class="sl-viewer-placeholder" :hidden="!viewer.loading"></div>
|
||||
<div id="sl-viewer" class="sl-viewer" :aria-label="t('Street-level viewer')"></div>
|
||||
</div>
|
||||
<div id="sl-image-meta" class="sl-image-meta">
|
||||
<span id="sl-image-by" class="sl-image-by">{{ image.captionLeft }}</span>
|
||||
<span class="sl-image-right">
|
||||
<span id="sl-image-when" class="sl-image-when">{{ image.captionRight }}</span>
|
||||
<a id="sl-image-link" class="sl-image-link" :href="image.href" target="_blank" rel="noopener noreferrer" :title="t('Open this image on the provider\'s site')" :hidden="!image.link">{{ image.linkLabel }}</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sl-providers" role="group" :aria-label="t('Imagery providers')">
|
||||
<span class="cctv-summary-label">{{ t('PROVIDERS') }}</span>
|
||||
<div id="sl-provider-chips" class="sl-chips"><RailChips :chips="view ? view.providers : []" /></div>
|
||||
</div>
|
||||
<div id="sl-error" class="sl-error" role="alert" :hidden="!view?.error"><span aria-hidden="true">⚠</span> <span id="sl-error-text">{{ view?.error || '' }}</span></div>
|
||||
<!-- A missing key gates the filters only: the chips above stay
|
||||
focusable so their tooltip can say how to add the key. -->
|
||||
<fieldset id="sl-controls" class="sl-controls" :disabled="Boolean(view?.controlsDisabled)" :hidden="!shows.pano && !shows.since">
|
||||
<div id="sl-pano-row" class="sl-filters" :hidden="!shows.pano" role="group" :aria-label="t('Imagery filters')">
|
||||
<span class="cctv-summary-label">{{ t('IMAGERY') }}</span>
|
||||
<UiSegmented class="sl-seg" item-class="sl-seg-btn" active-class="is-active" keyboard="radio" :disabled="Boolean(view?.controlsDisabled)" :label="t('Panorama filter')" :options="panoOptions" :model-value="pano" @update:model-value="store.act('setPano', $event)" />
|
||||
</div>
|
||||
<div id="sl-since-row" class="sl-since" :hidden="!shows.since">
|
||||
<label class="cctv-summary-label" for="sl-since">{{ t('SINCE') }}</label>
|
||||
<UiSlider id="sl-since" v-thumb="view?.since" class="sl-range" min="0" max="8" step="1" :aria-valuetext="sinceLabel" aria-describedby="sl-since-label sl-since-note" @input="onSinceInput" @change="onSinceChange" />
|
||||
<span class="sl-since-value">
|
||||
<output id="sl-since-label" class="sl-since-label" for="sl-since">{{ sinceLabel }}</output>
|
||||
<small id="sl-since-note" class="sl-since-note" :hidden="!view?.sinceNote">{{ view?.sinceNote || '' }}</small>
|
||||
</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
<!-- The hint says how to open imagery; the button does it without a pointer. -->
|
||||
<div class="sl-meta-row">
|
||||
<div id="sl-coverage-meta" class="sl-meta">{{ view?.meta ?? '' }}</div>
|
||||
<UiButton id="sl-nearest-btn" class="scene-btn sl-nearest-btn" type="button" :hidden="!view?.nearest.visible" :title="nearest.title || undefined" :disabled="nearest.disabled">{{ nearest.label }}</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
</RailPanel>
|
||||
</template>
|
||||
@@ -0,0 +1,36 @@
|
||||
<script setup>
|
||||
import { t } from '../../../i18n/index.js';
|
||||
import { ASSISTANT_NAME } from '../../../voice/control.js';
|
||||
import UiChip from '../../kit/UiChip.vue';
|
||||
|
||||
// Captions, plan and result, as VoiceCardControls (src/voice/voiceCard.js)
|
||||
// presents them. Captions update silently; the polite live region carries
|
||||
// final replies and result titles only.
|
||||
defineProps({ card: { type: Object, required: true } });
|
||||
const emit = defineEmits(['dismiss']);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section id="gev-voice-card" class="gev-voice-card ui-scroll" :hidden="!card.visible" :data-busy="card.busy == null ? undefined : String(card.busy)" :aria-label="t('Voice assistant')">
|
||||
<div class="gev-voice-card-header">
|
||||
<span class="gev-voice-card-kicker">{{ t('VOICE') }}</span>
|
||||
<span id="gev-voice-card-phase" class="gev-voice-card-phase">{{ card.phase }}</span>
|
||||
<button id="gev-voice-card-dismiss" class="gev-voice-card-dismiss" type="button" :aria-label="t('Dismiss voice card')" @click="emit('dismiss')">×</button>
|
||||
</div>
|
||||
<p id="gev-voice-card-user" class="gev-voice-card-caption" data-role="user" :hidden="!card.user.visible"><span id="gev-voice-card-user-who" class="gev-voice-card-who">{{ card.user.label }}</span><span id="gev-voice-card-user-text" class="gev-voice-card-text">{{ card.user.text }}</span></p>
|
||||
<p id="gev-voice-card-pointer" class="gev-voice-card-pointer" :hidden="!card.pointer.visible"><span id="gev-voice-card-pointer-kind" class="gev-voice-card-who">{{ card.pointer.kind }}</span><span class="gev-voice-card-sr">: </span><span id="gev-voice-card-pointer-text" class="gev-voice-card-pointer-label">{{ card.pointer.text }}</span></p>
|
||||
<p id="gev-voice-card-assistant" class="gev-voice-card-caption" data-role="assistant" :hidden="!card.assistant.visible"><span class="gev-voice-card-who">{{ ASSISTANT_NAME }}</span><span id="gev-voice-card-assistant-text" class="gev-voice-card-text">{{ card.assistant.text }}</span></p>
|
||||
<ol id="gev-voice-card-plan" class="gev-voice-card-plan" :aria-label="t('Plan')" :hidden="card.steps.length === 0"><li v-for="(step, index) in card.steps" :key="step.key ?? index" class="gev-voice-card-step" :data-status="step.status"><span class="gev-voice-card-step-label">{{ step.label }}</span><span class="gev-voice-card-sr">{{ step.statusText ? `, ${step.statusText}` : '' }}</span><span v-if="step.detail" class="gev-voice-card-step-detail">{{ step.detail }}</span></li></ol>
|
||||
<div id="gev-voice-card-result" class="gev-voice-card-result" :hidden="!card.result.visible">
|
||||
<div id="gev-voice-card-result-title" class="gev-voice-card-result-title">{{ card.result.title }}</div>
|
||||
<div id="gev-voice-card-chips" class="gev-voice-card-chips" :hidden="card.result.chips.length === 0"><UiChip v-for="(chip, index) in card.result.chips" :key="index" class="gev-voice-card-chip" :data-tone="chip">{{ chip }}</UiChip></div>
|
||||
<ul id="gev-voice-card-lines" class="gev-voice-card-lines"><li v-for="(line, index) in card.result.lines" :key="index">{{ line }}</li></ul>
|
||||
<ol id="gev-voice-card-referents" class="gev-voice-card-referents" :aria-label="t('Referenced items')" :hidden="card.result.referents.length === 0"><li v-for="(ref, index) in card.result.referents" :key="index" :value="ref.n">{{ ref.label }}</li></ol>
|
||||
<details id="gev-voice-card-notes" class="gev-voice-card-notes" :hidden="card.result.notes.length === 0">
|
||||
<summary>{{ t('NOTES & SOURCES') }}</summary>
|
||||
<ul id="gev-voice-card-note-list" class="gev-voice-card-lines"><li v-for="(note, index) in card.result.notes" :key="index">{{ note }}</li></ul>
|
||||
</details>
|
||||
</div>
|
||||
<div id="gev-voice-card-live" class="gev-voice-card-sr" aria-live="polite" aria-atomic="true">{{ card.announce }}</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -0,0 +1,136 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { formatNumber, t } from '../../../i18n/index.js';
|
||||
import { vClassToggle } from '../../rail/classToggle.js';
|
||||
import { useVoiceStore } from '../../stores/voice.js';
|
||||
import VoiceCard from './VoiceCard.vue';
|
||||
import VoiceVisualizer from './VoiceVisualizer.vue';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiSelect from '../../kit/UiSelect.js';
|
||||
|
||||
// The voice control in the command dock, as its presenter
|
||||
// (src/voice/control.js) holds it. The session owners write the presenter;
|
||||
// this renders it and reports what the person does.
|
||||
defineProps({ view: { type: Object, required: true } });
|
||||
const { controls } = storeToRefs(useVoiceStore());
|
||||
const emit = (name, ...args) => controls.value?.emit(name, ...args);
|
||||
|
||||
// A value the owner may restore after a refused change; written on every
|
||||
// render, as the owner's own writes were.
|
||||
const vChecked = {
|
||||
mounted(el, { value }) {
|
||||
el.checked = value;
|
||||
},
|
||||
updated(el, { value }) {
|
||||
if (el.checked !== value) el.checked = value;
|
||||
},
|
||||
};
|
||||
// The minutes field holds a draft until it changes: write it only when its
|
||||
// owner does, not on every render (the waveform renders each frame).
|
||||
const vOwnedValue = {
|
||||
mounted(el, { value }) {
|
||||
el.value = value.text;
|
||||
},
|
||||
updated(el, { value, oldValue }) {
|
||||
if (value.revision !== oldValue?.revision && el.value !== value.text)
|
||||
el.value = value.text;
|
||||
},
|
||||
};
|
||||
// "5 minutes" in the UI language, with the count's plural form ("15 دقيقة").
|
||||
const minutesLabel = (count) =>
|
||||
formatNumber(count, { style: 'unit', unit: 'minute', unitDisplay: 'long' });
|
||||
const optional = (value) => (value == null ? undefined : String(value));
|
||||
// The root's machine-state attributes, which the dock and theme CSS select on.
|
||||
const rootData = (root) => ({
|
||||
'data-status': root.status,
|
||||
'data-speaker': root.speaker,
|
||||
'data-provider': optional(root.provider),
|
||||
'data-provider-choice': optional(root.providerChoice),
|
||||
'data-push-to-talk': optional(root.pushToTalk),
|
||||
'data-microphone': optional(root.microphone),
|
||||
'data-row-grace': root.rowGrace ? 'true' : undefined,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div id="gev-voice-control" v-bind="rootData(view.root)" v-class-toggle="{ 'error-dismissed': view.root.errorDismissed }" @pointerleave="emit('pointerleave', $event)" @pointerenter="emit('pointerenter', $event)">
|
||||
<label id="gev-voice-provider-field" class="gev-voice-provider-field" :hidden="view.provider.hidden">
|
||||
<span>{{ t('Voice provider') }}</span>
|
||||
<UiSelect id="gev-voice-provider" class="gev-field" :aria-label="t('Voice provider')" :title="view.provider.title" :model-value="view.provider.value" @update:model-value="emit('provider-change', $event)"><option v-for="option in view.provider.options" :key="option.value" :value="option.value">{{ option.label }}</option></UiSelect>
|
||||
</label>
|
||||
<button v-if="view.panel" id="gev-voice-settings-button" class="gev-voice-settings-button" type="button" :aria-label="t('Voice Settings')" aria-controls="gev-voice-panel" :aria-expanded="String(view.voicePanel.settingsExpanded)" @click="emit('settings-button')"><span class="material-symbols-outlined gev-voice-settings-icon" aria-hidden="true">settings</span></button>
|
||||
<div class="gev-voice-heading">
|
||||
<div class="gev-voice-kicker">{{ t('AI AGENT') }}</div>
|
||||
<div id="gev-voice-status">{{ view.status.text }}</div>
|
||||
<span v-if="view.panel" id="gev-voice-cost-warning" class="gev-voice-cost-value gev-voice-cost-warning" :hidden="view.costWarning.hidden" :title="optional(view.costWarning.title)" :data-level="optional(view.costWarning.level)" role="status" aria-live="polite">{{ view.costWarning.text }}</span>
|
||||
<div v-else class="gev-voice-cost">
|
||||
<UiButton id="gev-voice-tier" class="gev-voice-tier-btn" :hidden="view.tier.hidden" :pressed="Boolean(view.tier.pressed)" :title="view.tier.title" @click="emit('tier')">{{ view.tier.text }}</UiButton>
|
||||
<span id="gev-voice-cost-value" class="gev-voice-cost-value" :hidden="view.cost.hidden" :data-level="view.cost.level" :title="view.cost.title">{{ view.cost.text }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<UiButton id="gev-voice-button" :aria-label="view.button.label" :pressed="view.button.pressed ?? undefined" aria-describedby="gev-voice-help" @click="emit('button')">
|
||||
<span class="gev-mic-orbit"><img src="/mic.svg" alt="" /></span>
|
||||
<span class="gev-mic-label">{{ view.mic.text }}</span>
|
||||
</UiButton>
|
||||
<VoiceVisualizer />
|
||||
<div class="gev-voice-readout">
|
||||
<div id="gev-voice-detail" :title="optional(view.detail.title)">{{ view.detail.text }}</div>
|
||||
</div>
|
||||
<div id="gev-voice-help" class="gev-voice-help-tray" role="tooltip">
|
||||
<span class="gev-voice-help-kicker">{{ t('VOICE CONTROL') }}</span>
|
||||
<span class="gev-voice-help-detail">{{ view.help.text }}</span>
|
||||
</div>
|
||||
<section v-if="view.panel" id="gev-voice-panel" class="gev-voice-panel" :hidden="view.voicePanel.hidden" :data-view="optional(view.voicePanel.view)" :aria-label="t('Voice Settings')" @keydown="emit('panel-keydown', $event)">
|
||||
<div class="gev-voice-panel-header">
|
||||
<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>
|
||||
</div>
|
||||
<button id="gev-voice-settings-close" type="button" :aria-label="t('Close voice panel')" @click="emit('settings-close')">×</button>
|
||||
</div>
|
||||
<div class="gev-voice-panel-body ui-scroll">
|
||||
<section id="gev-voice-preview-panel" role="tabpanel" aria-labelledby="gev-voice-preview-tab" :hidden="view.voicePanel.previewHidden">
|
||||
<p id="gev-voice-preview-empty" :hidden="view.previewEmpty.hidden">{{ view.previewEmpty.text }}</p>
|
||||
<VoiceCard :card="view.card" @dismiss="emit('card-dismiss')" />
|
||||
</section>
|
||||
<section id="gev-voice-settings-panel" role="tabpanel" aria-labelledby="gev-voice-settings-tab" :hidden="view.voicePanel.settingsHidden">
|
||||
<label class="gev-voice-preference gev-voice-preference-toggle"><input id="gev-voice-preview-enabled" type="checkbox" aria-describedby="gev-voice-preview-note" v-checked="view.preferences.previewChecked" @change="emit('preview-change', $event.target.checked)" /><span>{{ t('Show Voice Preview') }}</span></label>
|
||||
<p id="gev-voice-preview-note" class="gev-voice-settings-note">{{ view.preferences.previewNote }}</p>
|
||||
<div class="gev-voice-timeout-group">
|
||||
<label class="gev-voice-preference gev-voice-setting-title" for="gev-voice-timeout-select">{{ t('Voice inactivity timeout') }}</label>
|
||||
<div class="gev-voice-timeout-controls">
|
||||
<UiSelect id="gev-voice-timeout-select" class="gev-field" aria-describedby="gev-voice-timeout-note gev-voice-timeout-status" :model-value="view.preferences.timeoutChoice" @update:model-value="emit('timeout-select', $event)">
|
||||
<option value="3">{{ minutesLabel(3) }}</option><option value="5">{{ minutesLabel(5) }}</option><option value="10">{{ minutesLabel(10) }}</option><option value="15">{{ minutesLabel(15) }}</option>
|
||||
<option value="custom">{{ t('Custom') }}</option><option value="0">{{ t('None') }}</option>
|
||||
</UiSelect>
|
||||
<label class="gev-voice-timeout-unit" for="gev-voice-timeout-input">{{ t('Minutes') }}</label>
|
||||
<input id="gev-voice-timeout-input" type="number" min="1" max="60" step="1" aria-describedby="gev-voice-timeout-note" v-owned-value="{ text: view.preferences.timeoutMinutes, revision: view.preferences.revision }" :hidden="view.preferences.timeoutInputHidden" @change="emit('timeout-input', $event.target.value)" />
|
||||
</div>
|
||||
<p id="gev-voice-timeout-note" class="gev-voice-settings-note">{{ view.preferences.timeoutNote }}</p>
|
||||
<p id="gev-voice-timeout-status" class="gev-voice-settings-note" role="status" aria-live="polite">{{ view.preferences.timeoutStatus }}</p>
|
||||
</div>
|
||||
<div class="gev-voice-cost-settings">
|
||||
<div class="gev-voice-cost-setting-row">
|
||||
<span>{{ t('Voice model tier — applies next session') }}</span>
|
||||
<UiButton id="gev-voice-tier" class="gev-voice-tier-btn" :hidden="view.tier.hidden" :pressed="Boolean(view.tier.pressed)" :title="view.tier.title" @click="emit('tier')">{{ view.tier.text }}</UiButton>
|
||||
</div>
|
||||
<div class="gev-voice-cost-setting-row">
|
||||
<span>{{ t('Estimated session cost') }}</span>
|
||||
<span id="gev-voice-cost-value" class="gev-voice-cost-value" :hidden="view.cost.hidden" :data-level="view.cost.level" :title="view.cost.title">{{ view.cost.text }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
<VoiceCard v-else :card="view.card" @dismiss="emit('card-dismiss')" />
|
||||
<div class="gev-voice-error-tray" role="alert" aria-live="assertive">
|
||||
<div class="gev-voice-error-header">
|
||||
<span>{{ t('VOICE SYSTEM ERROR') }}</span>
|
||||
<button class="gev-voice-error-dismiss" type="button" @click="controls?.dismissError()">{{ t('DISMISS') }}</button>
|
||||
</div>
|
||||
<div id="gev-voice-error-detail">{{ view.error.text }}</div>
|
||||
<div class="gev-voice-error-hint">{{ t('Check microphone permission and network access, then try again.') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,22 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { VOICE_VISUALIZER_BARS } from '../../../voice/control.js';
|
||||
import { useVoiceStore } from '../../stores/voice.js';
|
||||
|
||||
// The dock waveform. Its bars change every animation frame while voice is
|
||||
// live, so they render here alone, not with the rest of the control.
|
||||
const { bars } = storeToRefs(useVoiceStore());
|
||||
const barStyle = (index) => ({
|
||||
'--bar': index,
|
||||
...(bars.value?.[index] && {
|
||||
'--audio-level': bars.value[index].level,
|
||||
'--audio-opacity': bars.value[index].opacity,
|
||||
}),
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="gev-voice-visualizer" aria-hidden="true">
|
||||
<span v-for="index in VOICE_VISUALIZER_BARS" :key="index" :style="barStyle(index - 1)"></span>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,17 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useWindInspectionStore } from '../../stores/windInspection.js';
|
||||
|
||||
// The inspected wind point, inside the container the wind layer renders in,
|
||||
// where the marker owner (src/layers/wind/inspectionMarker.js) places it.
|
||||
const { marker } = storeToRefs(useWindInspectionStore());
|
||||
|
||||
const markerStyle =
|
||||
'position:absolute;width:18px;height:18px;border:2px solid #fff;border-radius:50%;box-shadow:0 0 0 2px #153440,0 0 0 5px rgba(102,225,242,.35);transform:translate(-50%,-50%);pointer-events:none;z-index:150;';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport v-if="marker" :to="marker.container">
|
||||
<div class="gev-wind-inspection-marker" aria-hidden="true" :hidden="!marker.visible" :style="[markerStyle, { left: `${marker.left}px`, top: `${marker.top}px` }]"></div>
|
||||
</Teleport>
|
||||
</template>
|
||||
Reference in new issue
Block a user