Merge remote-tracking branch 'origin/main' into samehkhamis/kit-sweep-photo-globe

# Conflicts:
#	docs/VUE-MIGRATION.md
#	scripts/format-scope.json
This commit is contained in:
Sameh Khamis committed 2026-11-19 14:25:42 -08:00
commit 848d528316
33 files changed
+1169 -323

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
- The AI chat panel's and voice control's buttons and glyphs are now kit
controls (manjunath22466, samehkhamis, #1862).
+2
View File
@@ -0,0 +1,2 @@
- Draw's and Import's buttons and glyphs are now kit controls
(manjunath22466, samehkhamis, #1863).
@@ -0,0 +1,2 @@
- Space Missions', Contacts', Radio's, the RTL-SDR card's and key setup's
buttons and glyphs are now kit controls (manjunath22466, samehkhamis, #1864).
@@ -0,0 +1,3 @@
- The Bhote Koshi panel's buttons are kit controls, CINEMATIC's pressed
state is Vue state, and its media cards are a Vue view (manjunath22466,
samehkhamis, #1865).
+80 -7
View File
@@ -88,17 +88,24 @@ adapter is gone.
`active`); its pressed classes toggle through `classList`, so a class other
code adds (a voice highlight) survives a press. Every pressed toggle (a
control with `aria-pressed`) in the views is a `UiButton` with `pressed`
except two that keep their own `aria-pressed`: Bhote Koshi's cinematic
button, whose state the event layer writes into the attributes its panel
renders, and Explore's story cards, which are `role="button"` elements,
not buttons (`src/ui/kit/viewControls.test.mjs` pins it). Where the
except Explore's story cards, which keep their own `aria-pressed` since
they are `role="button"` elements, not buttons
(`src/ui/kit/viewControls.test.mjs` pins it). Where the
converted buttons draw Material symbols (the tilt-map button, the Context
header's search and expand, the imported files' row actions and the rail
chips' icons), the glyphs are `UiIcon`s with `:size="null"`, so the site
rules still size them. Core's pressable chips and pills (the rail cards'
chips and action chips, Recent Imagery's day chips, SWAP and ZOOM IN, map
sources, cities and places, and the view context's place and layer chips)
are `UiButton`s too; the key setup chip is still a plain button. `UiChip`
sources, cities and places, the view context's place and layer chips and
the key setup chip) are `UiButton`s too. `UiChip` is a non-interactive
label chip, used by the voice card.
header's search and expand, Draw, Import, the imported files' and drawn
shapes' row actions and the rail chips' icons), the glyphs are `UiIcon`s
with `:size="null"`, so the site rules still size them. Core's pressable
chips and pills (the rail cards' chips and action chips, Recent Imagery's
day chips, SWAP and ZOOM IN, map sources, cities and places, and the view
context's place and layer chips) are `UiButton`s too; the key setup chip
is still a plain button. `UiChip`
is a non-interactive label chip, used by the voice card.
The welcome card's buttons (SKIP, the three start tiles, BROWSE STORIES,
BACK and the main NEXT / ENTER GOD MODE action) are ghost `UiButton`s:
@@ -192,6 +199,51 @@ while a query is typed. The Filter button opens a disclosure and carries
a `UiIcon` with `:size="null"`, so `layer-finder.css` still sizes them
(`src/ui/kit/layerFinderControls.test.mjs` pins it); the search field's
magnifier is `UiSearchField`'s own span.
The Space Missions panel's buttons (a mission's roster row, FOCUS,
REPLAY ASCENT, the replay's pause, PREV, NEXT and SHOW ALL / DESELECT),
the Contacts panel's (PREV, FOCUS, NEXT and a contact's row), the Radio
panel's (Enable, PREV, PLAY, NEXT and STOP), the RTL-SDR card's (Connect,
Locate, Change device, FM, ADS-B, Tune and the two seeks) and the key
setup's (the POWER UP chip, a key's REMOVE, the voice auth toggle and
SAVE KEYS) are ghost `UiButton`s. Radio's Enable and the card's Connect,
FM and ADS-B are pressed toggles with `active`; PLAY and Locate keep
their own `active` class without `aria-pressed`, since their words say
what they will do or have done. The chip's bolt is a `UiIcon` with
`:size="null"`, so provider-settings.css still sizes it
(`src/ui/kit/missionsRadioControls.test.mjs` pins it). The card's FM
frequency stays a native number field, which the kit has no control for,
and the replay's pause, the roster's chevron and the compass arrows are
text characters, not Material symbols.
Utilities' Draw and Import are on the kit. Draw (a pressed toggle with
`active`), Clear and Import are ghost `UiButton`s, their glyphs `UiIcon`s
with `pp-icon` and `:size="null"`. Draw's five colour swatches, in the
toolbar and in a drawn shape's row, are ghost `UiButton`s with
`role="radio"`: they say they are chosen with `aria-checked` and their own
`active` class, never `aria-pressed`. A drawn shape's row (its swatch,
show/hide, the application's row actions and fly to, beside its remove
`UiCloseButton`) is on the kit too, its glyphs `UiIcon`s with
`:size="null"`, so `controls.css` still sizes them; show/hide says what it
does in its name (Show …, Hide …) rather than being pressed. The Street
Level panel's controls already were kit controls; its EXPAND ⤢ ⤡ and its
errors' ⚠ are text characters and stay text
(`src/ui/kit/drawControls.test.mjs` pins it).
The AI chat panel's and the voice control's buttons are ghost
`UiButton`s: the chat's Settings, quick prompts, attachment removes,
Attach layer, Attach a file, Expand conversation, command suggestions,
Expand chat, Add attachment and Send (a submit button that turns into
Stop reply), and the voice control's Open AI chat, Back to chat, Back to
voice, its Preview and Settings tabs and the error tray's DISMISS, beside
the tier button, the mic and the dock and minimize buttons, which already
were. The tier button and dock are pressed toggles; the mic is one only
while its owner has a state for it; the tabs keep `role="tab"` and
`aria-selected`. DISMISS is a text button, not a cross, so it is not a
`UiCloseButton`. The Settings and tab glyphs are `UiIcon`s with
`:size="null"`, so voice-cost.css and voice-card.css still size them
(`src/ui/kit/chatVoiceControls.test.mjs` pins it). The chat bubble,
globe, attach, send and stop, expand and Back glyphs stay inline SVG,
since no Material symbol the page loads draws them the same, and the
message box, file picker and inactivity minutes stay native fields, which
the kit has none of. The voice modules build no controls in script.
The small surfaces' buttons are ghost `UiButton`s: the locale picker's
button, the phone tab bar's tabs, the globe actions' Clear, Share, Reset
and north-up compass, the imagery divider's handle, the scene sharing
@@ -218,6 +270,26 @@ pins it). The notice the God's Eye View panel page shows when it loses its
3D graphics (`#status`, in `src/app/globePanelRuntime.js`) stays built in
script: that script is sent to the host as source text and runs in the
host's panel page before the app loads, so it can import nothing.
The Bhote Koshi reconstruction panel's buttons (previous and next beat,
Play, Play scene, Cinematic, Full story, Open original, Lower gorge, the
field reports and Open public map) are ghost `UiButton`s that keep their
`data-action` hooks. Cinematic is a pressed toggle with no pressed class,
since bhote-koshi.css reads its `aria-pressed`: the event layer presents
its state as the record's `pressed`, which the panel passes to the
button, instead of writing an `aria-pressed` attribute. The ‹ and ›
arrows are text characters. The event's embedded media cards (each
anchored witness clip's frame, leader line, title, status and original
link, and the hidden YouTube preload) are drawn by
`BhoteKoshiMediaCards`, which `src/data/bhoteKoshiEmbeddedMedia.js`
renders into its overlay root with `h()` and `render()` on every change,
words again on a locale change, and places after each frame; they hold
no control, and the original link stays a link. The script still builds
the provider SDKs' script and preconnect tags, the overlay root, and the
Facebook player node: that node is warmed hidden before its card exists
and carried, loaded, into the card's player, where the SDK replaces its
contents, so a template could only rebuild it and reload the player; the
X post is likewise built by its SDK inside the player
(`src/ui/kit/bhoteKoshiControls.test.mjs` pins it).
`UiSelect` renders the bare native select (Core's labels sit outside it or
come as an `aria-label`) with `v-model`, `options` and `disabled`;
options that carry their own attributes come through the slot, a caller's
@@ -513,7 +585,8 @@ slot whenever its view is drawn.
reconstruction panel (`BhoteKoshiPanel`, last in the context rail,
renders what the event layer publishes to the `gev-bhote-koshi-panel`
store: each control's text, hidden, disabled, value and attributes as
the layer writes them, unchanged frames sending nothing; the rail takes
the layer writes them, and the cinematic button's pressed state,
unchanged frames sending nothing; the rail takes
`bhote-event-active` while it shows), the full-globe celestial ring
(`CelestialRing` teleports into the globe container what `CelestialRing`
in `src/celestialRing.js` publishes to the `gev-celestial-ring` store and
+5
View File
@@ -1353,11 +1353,16 @@
"src/ui/kit/welcomeControls.test.mjs",
"src/ui/kit/omnibarControls.test.mjs",
"src/ui/kit/storiesControls.test.mjs",
"src/ui/kit/chatVoiceControls.test.mjs",
"src/ui/kit/cockpitControls.test.mjs",
"src/ui/kit/smallSurfacesControls.test.mjs",
"src/ui/kit/commandDockControls.test.mjs",
"src/ui/kit/streetLevelPhotoControls.test.mjs",
"src/ui/stores/streetLevelPhoto.js",
"src/ui/kit/bhoteKoshiControls.test.mjs",
"src/ui/bhoteKoshi/BhoteKoshiMediaCards.vue",
"src/ui/kit/missionsRadioControls.test.mjs",
"src/ui/kit/drawControls.test.mjs",
"src/ui/styles/chip.css",
"src/ui/styles/empty-state.css",
"src/ui/rail/RailChips.vue",
+2
View File
@@ -4185,6 +4185,7 @@
"src/render/cesium/heights.js",
"src/ui/imagerySplit.js",
"src/data/bhoteKoshiEmbeddedMedia.js",
"src/ui/bhoteKoshi/BhoteKoshiMediaCards.vue",
"src/data/bhoteKoshiLocator.js",
"src/data/bhoteKoshiIncidentPlaces.js",
"src/data/bhoteKoshiFloodPath.js",
@@ -5589,6 +5590,7 @@
"src/ui/imagerySplit.js",
"src/maps/imageryComparison.js",
"src/data/bhoteKoshiEmbeddedMedia.js",
"src/ui/bhoteKoshi/BhoteKoshiMediaCards.vue",
"src/data/bhoteKoshiLocator.js",
"src/render/cesium/camera.js",
"src/render/cesium/frame.js",
+173 -179
View File
@@ -6,6 +6,8 @@ import {
} from '../render/rendererOf.js';
import { dot, sub } from '../geo/vector.js';
import { t, msg, onLocaleChange } from '../i18n/index.js';
import { h, render as renderVue } from 'vue';
import BhoteKoshiMediaCards from '../ui/bhoteKoshi/BhoteKoshiMediaCards.vue';
const YOUTUBE_HOSTS = new Set([
'youtube.com',
@@ -98,6 +100,7 @@ export function bhoteEventText(value) {
let _xWidgetsPromise = null;
let _facebookSdkPromise = null;
let _facebookEmbedSequence = 0;
let _cardSequence = 0;
const youtubeApis = new WeakMap();
function loadYouTubeApi(documentRef, globalRef) {
@@ -682,32 +685,61 @@ export function createBhoteKoshiEmbeddedMedia({
let record = null;
let warmRecord = null;
let generation = 0;
// Text the cards show, kept as the calls that word it so a locale change
// words it again. A node is forgotten once it has left the page.
const worded = new Map();
function forgetDetached() {
for (const node of worded.keys())
if (!node.isConnected) worded.delete(node);
let destroyed = false;
// The cards in the root, in the order they were shown: the current one and
// any still leaving. Their text is kept as the calls that word it, so a
// locale change words it again.
const cards = [];
/** Render the cards and the YouTube preload into the root, synchronously. */
function render() {
if (destroyed) return;
const warmFrame = warmRecord?.frame;
renderVue(
h(BhoteKoshiMediaCards, {
warm: warmFrame
? {
key: warmRecord.key,
src: warmFrame.src,
title: warmFrame.title(),
}
: null,
cards: cards.map((current) => ({
id: current.id,
provider: current.source.provider,
portrait: current.portrait,
entering: current.entering,
leaving: current.leaving,
unavailable: current.unavailable,
label: current.label(),
title: current.title(),
status: current.status(),
url: current.source.url,
frame: current.frame && {
src: current.frame.src,
title: current.frame.title(),
onLoad: current.frame.onLoad,
},
bind: current.bind,
})),
}),
root,
);
}
function word(node, property, text) {
let properties = worded.get(node);
if (!properties) worded.set(node, (properties = new Map()));
properties.set(property, text);
writeWord(node, property, text());
}
function writeWord(node, property, value) {
if (property === 'textContent' || property === 'title')
node[property] = value;
else node.setAttribute(property, value);
}
const offLocale = onLocaleChange(() => {
forgetDetached();
for (const [node, properties] of worded)
for (const [property, text] of properties)
writeWord(node, property, text());
});
const offLocale = onLocaleChange(render);
const leavingRecords = new Set();
/** Word a card's status and draw it. */
function setStatus(current, text) {
current.status = text;
render();
}
/** Mark a card unavailable or not and draw it. */
function setUnavailable(current, unavailable) {
current.unavailable = unavailable;
render();
}
const prefersReducedMotion = () =>
globalRef.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches ===
true;
@@ -848,9 +880,10 @@ export function createBhoteKoshiEmbeddedMedia({
if (current.exitTimer != null) globalRef.clearTimeout?.(current.exitTimer);
destroyFacebookSession(current.facebookSession);
current.youtubeSession?.destroy();
current.card?.remove?.();
const at = cards.indexOf(current);
if (at !== -1) cards.splice(at, 1);
leavingRecords.delete(current);
forgetDetached();
render();
}
const position = () => {
@@ -866,7 +899,8 @@ export function createBhoteKoshiEmbeddedMedia({
current.enterFrame = scheduleFrame(() => {
current.enterFrame = null;
if (token !== generation || record !== current) return;
current.card.classList.add('is-entering');
current.entering = true;
render();
});
}
}
@@ -888,9 +922,10 @@ export function createBhoteKoshiEmbeddedMedia({
removeRecord(current);
return;
}
current.card.classList.remove('is-entering');
current.card.classList.add('is-leaving');
current.entering = false;
current.leaving = true;
leavingRecords.add(current);
render();
current.exitTimer =
globalRef.setTimeout?.(
() => removeRecord(current),
@@ -900,11 +935,10 @@ export function createBhoteKoshiEmbeddedMedia({
function clearWarm(key = null) {
if (!warmRecord || (key && warmRecord.key !== key)) return;
if (warmRecord.facebookSession)
destroyFacebookSession(warmRecord.facebookSession);
else warmRecord.iframe?.remove?.();
const facebookSession = warmRecord.facebookSession;
warmRecord = null;
forgetDetached();
if (facebookSession) destroyFacebookSession(facebookSession);
else render();
}
function takeWarmFacebook(key, host) {
@@ -944,29 +978,26 @@ export function createBhoteKoshiEmbeddedMedia({
warmRecord = { key, facebookSession };
return true;
}
const iframe = documentRef.createElement('iframe');
iframe.className = 'bhote-embedded-media-warmup';
iframe.src = embeddedMediaFrameUrl(source, {
autoplay: false,
startAtSec,
endAtSec,
});
word(iframe, 'title', () =>
t('Preloading {provider} media', {
provider: providerLabel(source.provider),
}),
);
iframe.tabIndex = -1;
iframe.setAttribute('aria-hidden', 'true');
iframe.loading = 'eager';
iframe.referrerPolicy = 'strict-origin-when-cross-origin';
root.append(iframe);
warmRecord = { key, iframe };
warmRecord = {
key,
frame: {
src: embeddedMediaFrameUrl(source, {
autoplay: false,
startAtSec,
endAtSec,
}),
title: () =>
t('Preloading {provider} media', {
provider: providerLabel(source.provider),
}),
},
};
render();
return true;
}
async function mountX(current, token) {
word(current.status, 'textContent', () => t('LOADING X POST…'));
setStatus(current, () => t('LOADING X POST…'));
try {
const api = await xLoader(documentRef, globalRef);
if (token !== generation || record !== current) return;
@@ -986,14 +1017,12 @@ export function createBhoteKoshiEmbeddedMedia({
throw new Error(
msg('The X post is unavailable or cannot be embedded.'),
);
word(current.status, 'textContent', () =>
t('X POST · PROVIDER CONTROLS'),
);
setStatus(current, () => t('X POST · PROVIDER CONTROLS'));
position();
} catch (error) {
if (token !== generation || record !== current) return;
current.card.classList.add('is-unavailable');
word(current.status, 'textContent', () =>
current.unavailable = true;
setStatus(current, () =>
t('{reason} OPEN ORIGINAL.', {
reason: t(String(error?.message || msg('X embed unavailable'))),
}),
@@ -1010,16 +1039,14 @@ export function createBhoteKoshiEmbeddedMedia({
session.shouldPlay = autoplay === true;
session.onReady = () => {
if (token !== generation || record !== current) return;
word(current.status, 'textContent', () =>
t('FACEBOOK · PROVIDER CONTROLS'),
);
current.card.classList.remove('is-unavailable');
current.status = () => t('FACEBOOK · PROVIDER CONTROLS');
setUnavailable(current, false);
position();
};
session.onError = (error) => {
if (token !== generation || record !== current) return;
current.card.classList.add('is-unavailable');
word(current.status, 'textContent', () =>
current.unavailable = true;
setStatus(current, () =>
t('{reason} OPEN ORIGINAL.', {
reason: t(
String(error?.message || msg('Facebook embed unavailable')),
@@ -1030,9 +1057,7 @@ export function createBhoteKoshiEmbeddedMedia({
};
session.onPlaybackBlocked = () => {
if (token !== generation || record !== current) return;
word(current.status, 'textContent', () =>
t('AUTOPLAY BLOCKED · USE PROVIDER CONTROLS'),
);
setStatus(current, () => t('AUTOPLAY BLOCKED · USE PROVIDER CONTROLS'));
};
if (session.ready) session.onReady();
else if (session.error) session.onError(session.error);
@@ -1078,104 +1103,69 @@ export function createBhoteKoshiEmbeddedMedia({
if (warmRecord && warmRecord.key !== warmKey) clearWarm();
hide({ preserveWarm: true });
const token = ++generation;
const card = documentRef.createElement('section');
const portraitClass = isPortraitMedia(media) ? ' is-portrait' : '';
card.className = `bhote-embedded-callout is-${source.provider}${portraitClass}`;
card.dataset.provider = source.provider;
word(card, 'aria-label', () =>
t('Embedded {provider} media for {source}', {
provider: providerLabel(source.provider),
source: observation?.title
? bhoteEventText(observation.title)
: t('witness source'),
}),
);
const leader = documentRef.createElementNS(
'http://www.w3.org/2000/svg',
'svg',
);
leader.classList.add('bhote-embedded-callout-leader');
leader.setAttribute('aria-hidden', 'true');
leader.innerHTML =
'<path pathLength="1" fill="none" stroke="rgba(147,213,228,.72)" stroke-width="1.5"/><circle r="4" fill="#6be8ff" stroke="#ffffff" stroke-width="1.5"/>';
const player = documentRef.createElement('div');
player.className = 'bhote-embedded-callout-player ui-scroll';
const footer = documentRef.createElement('footer');
const title = documentRef.createElement('strong');
word(title, 'textContent', () =>
bhoteEventText(
observation?.shortTitle || observation?.title || t('Witness source'),
).toUpperCase(),
);
const status = documentRef.createElement('small');
status.setAttribute('role', 'status');
word(status, 'textContent', () =>
t('{provider} · EMBEDDED SOURCE', {
provider: providerLabel(source.provider),
}),
);
const link = documentRef.createElement('a');
link.href = source.url;
link.target = '_blank';
link.rel = 'noopener noreferrer';
word(link, 'textContent', () => t('OPEN ORIGINAL ↗'));
footer.append(title, status, link);
const body = documentRef.createElement('div');
body.className = 'bhote-embedded-callout-body';
// The card takes taps (its container and leader do not); Stories keeps that.
body.setAttribute('data-overlay-input', '');
body.append(player, footer);
card.append(leader, body);
root.append(card);
record = {
const providerName = () => providerLabel(source.provider);
const sourceName = () =>
observation?.title
? bhoteEventText(observation.title)
: t('witness source');
const current = {
id: ++_cardSequence,
key,
source,
anchor,
card,
leader,
player,
status,
portrait: isPortraitMedia(media),
entering: false,
leaving: false,
unavailable: false,
label: () =>
t('Embedded {provider} media for {source}', {
provider: providerName(),
source: sourceName(),
}),
title: () =>
bhoteEventText(
observation?.shortTitle || observation?.title || t('Witness source'),
).toUpperCase(),
status: () =>
t('{provider} · EMBEDDED SOURCE', { provider: providerName() }),
frame: null,
frameElement: null,
card: null,
leader: null,
player: null,
entered: false,
};
if (source.provider === 'x') {
void mountX(record, token);
} else if (source.provider === 'facebook') {
bindFacebook(record, token, warmKey, autoplay);
} else {
const iframe = documentRef.createElement('iframe');
iframe.src = embeddedMediaFrameUrl(source, {
autoplay,
startAtSec,
endAtSec,
});
const controlled =
// The elements the card's view draws: placed after each frame, filled by
// the provider.
current.bind = (name, element) => {
if (element) current[name] = element;
};
let controlled = false;
if (source.provider === 'youtube') {
const url = new URL(
embeddedMediaFrameUrl(source, {
autoplay,
startAtSec,
endAtSec,
}),
);
controlled =
autoplay &&
Number.isFinite(Number(endAtSec)) &&
Number(endAtSec) > startAtSec;
if (controlled) {
const url = new URL(iframe.src);
url.searchParams.set('enablejsapi', '1');
if (globalRef.location?.origin)
url.searchParams.set('origin', globalRef.location.origin);
iframe.src = url.href;
}
word(iframe, 'title', () =>
t('{provider} media: {source}', {
provider: providerLabel(source.provider),
source: observation?.title
? bhoteEventText(observation.title)
: t('witness source'),
}),
);
iframe.allow =
'autoplay; encrypted-media; picture-in-picture; fullscreen';
iframe.allowFullscreen = true;
iframe.loading = 'eager';
iframe.referrerPolicy = 'strict-origin-when-cross-origin';
iframe.addEventListener?.(
'load',
() => {
current.frame = {
src: url.href,
title: () =>
t('{provider} media: {source}', {
provider: providerName(),
source: sourceName(),
}),
onLoad: () => {
if (token !== generation || record?.key !== key) return;
clearWarm(warmKey);
if (
@@ -1184,38 +1174,41 @@ export function createBhoteKoshiEmbeddedMedia({
record.youtubeSession.getState().phase,
)
) {
word(status, 'textContent', () =>
t('{provider} · PROVIDER CONTROLS', {
provider: providerLabel(source.provider),
}),
setStatus(current, () =>
t('{provider} · PROVIDER CONTROLS', { provider: providerName() }),
);
}
position();
},
{ once: true },
);
player.append(iframe);
if (controlled) {
const current = record;
current.youtubeSession = createTrimmedYouTubePlayback({
iframe,
endAtSec: Number(endAtSec),
startAtSec,
globalRef,
loadApi: () => youtubeLoader(documentRef, globalRef),
isCurrent: () => token === generation && record === current,
onStatus: (phase) => {
if (phase !== 'completed')
word(status, 'textContent', () =>
t('YOUTUBE {state} · OPEN ORIGINAL', {
state: YOUTUBE_PHASE_LABELS[phase]
? t(YOUTUBE_PHASE_LABELS[phase])
: phase.toUpperCase(),
}),
);
},
});
}
};
}
record = current;
cards.push(current);
render();
if (source.provider === 'x') {
void mountX(current, token);
} else if (source.provider === 'facebook') {
bindFacebook(current, token, warmKey, autoplay);
} else if (controlled) {
current.youtubeSession = createTrimmedYouTubePlayback({
iframe: current.frameElement,
endAtSec: Number(endAtSec),
startAtSec,
globalRef,
loadApi: () => youtubeLoader(documentRef, globalRef),
isCurrent: () => token === generation && record === current,
onStatus: (phase) => {
if (phase !== 'completed')
setStatus(current, () =>
t('YOUTUBE {state} · OPEN ORIGINAL', {
state: YOUTUBE_PHASE_LABELS[phase]
? t(YOUTUBE_PHASE_LABELS[phase])
: phase.toUpperCase(),
}),
);
},
});
}
position();
return true;
@@ -1223,11 +1216,12 @@ export function createBhoteKoshiEmbeddedMedia({
function destroy() {
offLocale();
worded.clear();
hide({ immediate: true });
for (const current of [...leavingRecords]) removeRecord(current);
clearWarm();
removePostRender?.();
destroyed = true;
renderVue(null, root);
root.remove();
}
+171 -68
View File
@@ -1,3 +1,4 @@
import '../testSupport/registerDom.mjs';
import test from 'node:test';
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
@@ -12,6 +13,31 @@ import {
} from './bhoteKoshiEmbeddedMedia.js';
import { bindRenderer } from '../render/rendererOf.js';
// The cards draw provider frames; the tests never load their pages, and the
// page's note that each one is not loaded is dropped.
window.happyDOM.settings.disableIframePageLoading = true;
const consoleError = console.error;
console.error = (error, ...rest) => {
if (!/Iframe page loading is disabled/.test(String(error?.message)))
consoleError(error, ...rest);
};
/**
* Embedded media in a fresh globe container of the page, and the overlay
* root it renders into.
*/
function domFixture(options = {}) {
document.body.replaceChildren();
const container = document.body.appendChild(document.createElement('div'));
const media = createBhoteKoshiEmbeddedMedia({
viewer: { container },
documentRef: document,
globalRef: {},
...options,
});
return { media, container, root: container.firstElementChild };
}
test('Pinokio fallback never creates provider DOM or loads SDKs', async () => {
const unexpected = () => { throw new Error('Provider resource allocated in Pinokio'); };
const media = createBhoteKoshiEmbeddedMedia({
@@ -186,31 +212,138 @@ test('trimmed YouTube teardown revokes pending SDK and player callbacks', async
});
test('pausing YouTube removes its frame and rejects a late load from the stopped generation', () => {
const nodes = [];
class Element extends EventTarget {
constructor(tag) { super(); this.tag = tag; this.children = []; this.dataset = {}; this.classList = { add() {}, remove() {} }; nodes.push(this); }
setAttribute() {}
append(...children) { for (const child of children) { child.parent = this; this.children.push(child); } }
remove() { if (this.parent) this.parent.children = this.parent.children.filter((child) => child !== this); this.parent = null; }
}
const documentRef = {
body: new Element('body'),
createElement: (tag) => new Element(tag),
createElementNS: (_, tag) => new Element(tag),
};
const media = createBhoteKoshiEmbeddedMedia({ viewer: {}, documentRef, globalRef: {} });
const { media, container, root } = domFixture();
const options = { observation: { title: 'Clip', media: { sourceUrl: 'https://youtu.be/DbqRexFxv3k' } }, anchor: {}, autoplay: true };
assert.equal(media.show(options), true);
const frame = nodes.find((node) => node.tag === 'iframe');
const card = nodes.find((node) => node.tag === 'section');
assert.ok(card.parent);
const card = root.querySelector('section');
const frame = card.querySelector('iframe');
assert.ok(card.isConnected);
assert.equal(media.pause(), true);
assert.equal(card.parent, null);
assert.equal(card.isConnected, false);
frame.dispatchEvent(new Event('load'));
assert.equal(card.parent, null);
assert.equal(root.querySelector('section'), null);
assert.equal(media.show(options), true, 'an explicit replay creates a fresh player');
assert.notEqual(root.querySelector('section iframe'), frame);
media.destroy();
assert.equal(container.children.length, 0);
});
test('a card draws its provider, source, status and original link, and words them again in a new locale', async () => {
const { setLocale } = await import('../i18n/index.js');
const { media, root } = domFixture();
assert.equal(media.show({
observation: { title: 'Flood footage', media: { sourceUrl: 'https://youtu.be/DbqRexFxv3k', orientation: 'portrait' } },
anchor: {},
}), true);
const card = root.querySelector('section');
assert.equal(card.className, 'bhote-embedded-callout is-youtube is-portrait');
assert.equal(card.dataset.provider, 'youtube');
assert.equal(card.getAttribute('aria-label'), 'Embedded YOUTUBE media for Flood footage');
const leader = card.firstElementChild;
assert.equal(leader.namespaceURI, 'http://www.w3.org/2000/svg');
assert.equal(leader.getAttribute('class'), 'bhote-embedded-callout-leader');
assert.equal(leader.getAttribute('aria-hidden'), 'true');
assert.equal(leader.querySelector('path').getAttribute('pathLength'), '1');
assert.equal(leader.querySelector('circle').getAttribute('r'), '4');
const body = card.querySelector('.bhote-embedded-callout-body');
assert.equal(body.getAttribute('data-overlay-input'), '');
const player = body.firstElementChild;
assert.equal(player.className, 'bhote-embedded-callout-player ui-scroll');
const frame = player.firstElementChild;
assert.equal(frame.tagName, 'IFRAME');
assert.equal(new URL(frame.src).pathname, '/embed/DbqRexFxv3k');
assert.equal(frame.title, 'YOUTUBE media: Flood footage');
assert.equal(frame.getAttribute('allow'), 'autoplay; encrypted-media; picture-in-picture; fullscreen');
assert.equal(frame.hasAttribute('allowfullscreen'), true);
assert.equal(frame.getAttribute('referrerpolicy'), 'strict-origin-when-cross-origin');
const [title, status, link] = body.querySelector('footer').children;
assert.equal(title.tagName, 'STRONG');
assert.equal(title.textContent, 'FLOOD FOOTAGE');
assert.equal(status.getAttribute('role'), 'status');
assert.equal(status.textContent, 'YOUTUBE · EMBEDDED SOURCE');
assert.equal(link.href, 'https://www.youtube.com/watch?v=DbqRexFxv3k');
assert.equal(link.target, '_blank');
assert.equal(link.rel, 'noopener noreferrer');
assert.equal(link.textContent, 'OPEN ORIGINAL ↗');
frame.dispatchEvent(new Event('load'));
assert.equal(status.textContent, 'YOUTUBE · PROVIDER CONTROLS');
try {
await setLocale('es');
assert.notEqual(link.textContent, 'OPEN ORIGINAL ↗', 'the link is worded again');
assert.notEqual(status.textContent, 'YOUTUBE · PROVIDER CONTROLS', 'the status is worded again');
assert.ok(root.querySelector('section') === card, 'in place');
} finally {
await setLocale('en');
}
media.destroy();
});
test('an X post is built by the provider inside the card and its failure marks the card', async () => {
let fail = false;
const { media, root } = domFixture({
xLoader: async () => ({ widgets: { createTweet: async (id, target) => {
if (fail) return null;
target.append(Object.assign(document.createElement('div'), { className: 'twitter-tweet', textContent: id }));
return {};
} } }),
});
const observation = { title: 'Clip', media: { sourceUrl: 'https://x.com/Indowatchosint/status/2092640554568007958' } };
assert.equal(media.show({ observation, anchor: {} }), true);
const card = root.querySelector('section');
const status = card.querySelector('[role="status"]');
assert.equal(status.textContent, 'LOADING X POST…');
await new Promise((resolve) => setTimeout(resolve));
assert.equal(card.querySelector('.bhote-embedded-callout-player .twitter-tweet').textContent, '2092640554568007958');
assert.equal(status.textContent, 'X POST · PROVIDER CONTROLS');
assert.equal(card.classList.contains('is-unavailable'), false);
media.hide({ immediate: true });
fail = true;
assert.equal(media.show({ observation, anchor: {} }), true);
await new Promise((resolve) => setTimeout(resolve));
const failed = root.querySelector('section');
assert.ok(failed.classList.contains('is-unavailable'));
assert.equal(failed.querySelector('[role="status"]').textContent, 'The X post is unavailable or cannot be embedded. OPEN ORIGINAL.');
media.destroy();
});
test('a warmed Facebook player moves into the card and stays through its redraws', async () => {
let ready;
const { media, root } = domFixture({
facebookLoader: async () => ({
Event: { subscribe(_name, callback) { ready = callback; }, unsubscribe() {} },
XFBML: { parse() {} },
}),
});
const observation = { title: 'Clip', media: { sourceUrl: 'https://www.facebook.com/reel/1571491657757829' } };
media.warm({ observation });
await Promise.resolve(); await Promise.resolve();
const host = root.querySelector('.bhote-embedded-media-warmup');
const embed = host.querySelector('.fb-video');
assert.equal(media.show({ observation, anchor: {} }), true);
const card = root.querySelector('section');
const player = card.querySelector('.bhote-embedded-callout-player');
assert.ok(host.parentNode === player, 'the warmed player is carried over, not rebuilt');
assert.equal(host.className, 'bhote-facebook-player-host');
assert.equal(host.hasAttribute('aria-hidden'), false);
ready({ type: 'video', id: embed.id, instance: { mute() {}, play() {}, pause() {} } });
assert.equal(card.querySelector('[role="status"]').textContent, 'FACEBOOK · PROVIDER CONTROLS');
assert.ok(host.parentNode === player, 'a redraw keeps the provider player');
media.destroy();
});
test('a leaving card animates out and is removed after its exit', () => {
const timers = [];
const { media, root } = domFixture({ globalRef: { setTimeout: (fn) => timers.push(fn), clearTimeout() {} } });
media.show({ observation: { media: { sourceUrl: 'https://youtu.be/DbqRexFxv3k' } }, anchor: {} });
const card = root.querySelector('section');
card.hidden = false;
media.hide();
assert.ok(card.isConnected);
assert.ok(card.classList.contains('is-leaving'));
assert.equal(card.classList.contains('is-entering'), false);
timers.forEach((fn) => fn());
assert.equal(card.isConnected, false);
media.destroy();
assert.equal(documentRef.body.children.length, 0);
});
test('resolves supported embedded callout providers from canonical public URLs', () => {
@@ -303,28 +436,8 @@ test('Mailung playback stops at source timestamp 0:07 without changing other cli
});
function preloadFixture(options = {}) {
class Element extends EventTarget {
constructor(tag) {
super(); this.tag = tag; this.children = []; this.dataset = {};
this.classList = { add() {}, remove() {}, contains() { return false; } };
}
setAttribute() {}
removeAttribute() {}
append(...children) {
for (const child of children) { child.remove(); child.parent = this; this.children.push(child); }
}
remove() {
if (this.parent) this.parent.children = this.parent.children.filter(child => child !== this);
this.parent = null;
}
}
const documentRef = {
body: new Element('body'),
createElement: tag => new Element(tag),
createElementNS: (_, tag) => new Element(tag),
};
const media = createBhoteKoshiEmbeddedMedia({ viewer: {}, documentRef, globalRef: {}, ...options });
return { media, root: documentRef.body.children[0] };
const { media, root } = domFixture(options);
return { media, root };
}
for (const operation of ['pause', 'hide', 'destroy']) {
@@ -343,16 +456,18 @@ test('camera updates retain a preload until the visible player loads', () => {
const observation = { media: { sourceUrl: 'https://youtu.be/DbqRexFxv3k' } };
media.warm({ observation });
const frame = root.children[0];
assert.equal(frame.className, 'bhote-embedded-media-warmup');
assert.equal(frame.getAttribute('aria-hidden'), 'true');
assert.equal(frame.tabIndex, -1);
assert.equal(frame.title, 'Preloading YOUTUBE media');
media.hide({ preserveWarm: true });
media.warm({ observation });
assert.equal(root.children[0], frame);
assert.ok(root.children[0] === frame);
assert.equal(media.show({ observation, anchor: {} }), true);
assert.equal(frame.parent, root, 'keep the preload while the visible player starts');
const card = root.children.find(node => node.tag === 'section');
const body = card.children.find(node => node.className === 'bhote-embedded-callout-body');
const player = body.children.find(node => node.className.split(' ').includes('bhote-embedded-callout-player'));
player.children.find(node => node.tag === 'iframe').dispatchEvent(new Event('load'));
assert.equal(frame.parent, null, 'visible player readiness releases the preload');
assert.ok(frame.parentNode === root, 'keep the preload while the visible player starts');
root.querySelector('section .bhote-embedded-callout-body > .bhote-embedded-callout-player > iframe')
.dispatchEvent(new Event('load'));
assert.equal(frame.isConnected, false, 'visible player readiness releases the preload');
media.destroy();
assert.equal(root.children.length, 0);
});
@@ -420,25 +535,9 @@ test('a media card stays between the panels when right-to-left swaps their sides
});
test('a shown card follows its anchor through the renderer ports', () => {
class Element extends EventTarget {
constructor(tag) {
super(); this.tag = tag; this.children = []; this.dataset = {}; this.style = {};
this.classList = { add() {}, remove() {}, contains() { return false; } };
}
setAttribute() {}
removeAttribute() {}
querySelector() { return null; }
getBoundingClientRect() { return { left: 0, top: 0, right: 1000, bottom: 800, width: 1000, height: 800 }; }
append(...children) { for (const child of children) { child.remove(); child.parent = this; this.children.push(child); } }
remove() { if (this.parent) this.parent.children = this.parent.children.filter((child) => child !== this); this.parent = null; }
}
const documentRef = {
body: new Element('body'),
createElement: (tag) => new Element(tag),
createElementNS: (_, tag) => new Element(tag),
};
const listeners = new Set();
const viewer = { canvas: { getBoundingClientRect: () => ({ left: 500, top: 500 }) } };
const container = document.body.appendChild(document.createElement('div'));
const viewer = { container, canvas: { getBoundingClientRect: () => ({ left: 500, top: 500 }) } };
let pose = { position: { x: 0, y: 0, z: 0 }, direction: { x: 1, y: 0, z: 0 } };
const projected = [];
// The renderer's canvas, not the viewer's, places the card.
@@ -454,14 +553,18 @@ test('a shown card follows its anchor through the renderer ports', () => {
},
},
});
const media = createBhoteKoshiEmbeddedMedia({ viewer, documentRef, globalRef: {} });
const media = createBhoteKoshiEmbeddedMedia({ viewer, documentRef: document, globalRef: {} });
const root = container.firstElementChild;
root.getBoundingClientRect = () => ({ left: 0, top: 0, right: 1000, bottom: 800, width: 1000, height: 800 });
assert.deepEqual([...listeners].map(([phase]) => phase), ['postRender']);
const anchor = { x: 10, y: 0, z: 0 };
assert.equal(media.show({ observation: { title: 'Clip', media: { sourceUrl: 'https://youtu.be/DbqRexFxv3k' } }, anchor }), true);
const card = documentRef.body.children[0].children.find((node) => node.tag === 'section');
const card = root.querySelector('section');
assert.equal(card.hidden, false);
assert.equal(projected.at(-1), anchor);
assert.equal(card.style.left, `${300 + 10 + 42}px`);
// The leader runs from the anchor to the card's near edge.
assert.equal(card.querySelector('path').getAttribute('d'), `M ${300 + 10 - 352} ${200 + 5 - parseFloat(card.style.top)} L 0 ${Math.max(16, Math.min(360 - 16, 200 + 5 - parseFloat(card.style.top)))}`);
// Behind the eye: hidden on the next drawn frame.
pose = { ...pose, direction: { x: -1, y: 0, z: 0 } };
for (const [, cb] of listeners) cb();
+3 -2
View File
@@ -989,9 +989,10 @@ function createPanelRecords(event) {
textContent: t('▶ PLAY SCENE'),
hidden: true,
}),
// `pressed` is the button's pressed state; the view renders it as one.
cinematicButton: panelRecord({
textContent: t('◉ CINEMATIC'),
attributes: { 'aria-pressed': 'false' },
pressed: false,
}),
storyReplayButton: panelRecord({ textContent: t('↺ FULL STORY') }),
corridorButton: panelRecord(),
@@ -2860,7 +2861,7 @@ export function createBhoteKoshiEventLayer({
'textContent',
_cinematicActive ? t('■ RELEASE CAMERA') : t('◉ CINEMATIC'),
);
setElementAttribute(button, 'aria-pressed', String(_cinematicActive));
setElementProperty(button, 'pressed', _cinematicActive);
return true;
}
+4
View File
@@ -101,6 +101,7 @@ function eventPanel() {
get textContent() { return record().textContent; },
get hidden() { return record().hidden; },
get disabled() { return record().disabled; },
get pressed() { return record().pressed; },
get value() { return typed ?? record().value; },
set value(value) { typed = value; },
getAttribute: (name) => record().attributes[name] ?? null,
@@ -2711,6 +2712,8 @@ test('Bhote Koshi replay restores cinematic ownership unless the operator releas
play.dispatch('click');
assert.equal(layer.getCinematicState().active, true);
assert.equal(layer.getPlaybackState().progress, 0);
const cinematicControl = panel.querySelector('[data-action="cinematic"]');
assert.equal(cinematicControl.pressed, true, 'the cinematic button is pressed while it owns the camera');
assert.equal(layer.getPlaybackState().playing, true);
assert.equal(
body.children.some((element) => element.id === 'bhote-koshi-story-strap'),
@@ -2720,6 +2723,7 @@ test('Bhote Koshi replay restores cinematic ownership unless the operator releas
panel.querySelector('[data-action="cinematic"]').dispatch('click');
assert.equal(layer.getCinematicState().active, false);
assert.equal(viewer._test.cameraTransforms.length, 2);
assert.equal(cinematicControl.pressed, false, 'releasing the camera unpresses the button');
animationCallbacks[1](91001);
assert.equal(play.textContent, '↺ REPLAY');
const cameraLookCount = viewer._test.cameraLooks.length;
+8 -1
View File
@@ -38,7 +38,7 @@ function presentation(patch = {}) {
playSceneButton: record({ textContent: '▶ PLAY SCENE', hidden: true }),
cinematicButton: record({
textContent: '◉ CINEMATIC',
attributes: { 'aria-pressed': 'false' },
pressed: false,
}),
storyReplayButton: record({ textContent: '↺ FULL STORY' }),
corridorButton: record(),
@@ -156,6 +156,10 @@ test('a later presentation updates the controls in place', async (t) => {
disabled: true,
attributes: { 'aria-label': 'Play Global context' },
});
next.refs.cinematicButton = record({
textContent: '■ RELEASE CAMERA',
pressed: true,
});
next.refs.progressInput = record({ value: '250', hidden: true });
next.refs.imagerySection = record({ hidden: true });
store.publish(next);
@@ -164,6 +168,9 @@ test('a later presentation updates the controls in place', async (t) => {
assert.equal(play.textContent, '▶ PLAY SHOT');
assert.equal(play.disabled, true);
assert.equal(play.getAttribute('aria-label'), 'Play Global context');
const cinematic = $('[data-action="cinematic"]');
assert.equal(cinematic.getAttribute('aria-pressed'), 'true');
assert.equal(cinematic.textContent, '■ RELEASE CAMERA');
assert.ok(
$('#bhote-koshi-event-panel').classList.contains('bhote-event-scene-beat'),
);
@@ -0,0 +1,98 @@
<script setup>
import { t } from '../../i18n/index.js';
// The Bhote Koshi event's embedded media cards and the hidden YouTube
// preload, as src/data/bhoteKoshiEmbeddedMedia.js presents them inside its
// overlay root. The owner renders synchronously on every change and places
// each card beside its map anchor after each frame (its position, its
// leader's line and whether it shows); a card's player is filled by the
// provider: the YouTube frame drawn here, or the Facebook player and X post
// the provider SDKs build inside it. The card's body takes taps (the root
// and the leader do not); Stories keeps that.
defineProps({
/** `{key, src, title}` of the hidden YouTube preload, or null. */
warm: { type: Object, default: null },
/**
* The cards in insertion order: `{id, provider, portrait, entering,
* leaving, unavailable, label, title, status, url, frame, bind}`; `frame`
* is `{src, title, onLoad}` for a YouTube card and null otherwise, and
* `bind(name, element)` hands the owner the elements it places and fills.
*/
cards: { type: Array, default: () => [] },
});
</script>
<template>
<iframe
v-if="warm"
:key="warm.key"
class="bhote-embedded-media-warmup"
:src="warm.src"
:title="warm.title"
tabindex="-1"
aria-hidden="true"
loading="eager"
referrerpolicy="strict-origin-when-cross-origin"
></iframe>
<section
v-for="card in cards"
:key="card.id"
:ref="(el) => card.bind('card', el)"
class="bhote-embedded-callout"
:class="[
`is-${card.provider}`,
{
'is-portrait': card.portrait,
'is-entering': card.entering,
'is-leaving': card.leaving,
'is-unavailable': card.unavailable,
},
]"
:data-provider="card.provider"
:aria-label="card.label"
>
<svg
:ref="(el) => card.bind('leader', el)"
class="bhote-embedded-callout-leader"
aria-hidden="true"
>
<path
pathLength="1"
fill="none"
stroke="rgba(147,213,228,.72)"
stroke-width="1.5"
/>
<circle r="4" fill="#6be8ff" stroke="#ffffff" stroke-width="1.5" />
</svg>
<div class="bhote-embedded-callout-body" data-overlay-input>
<div
v-if="card.frame"
:ref="(el) => card.bind('player', el)"
class="bhote-embedded-callout-player ui-scroll"
>
<iframe
:ref="(el) => card.bind('frameElement', el)"
:src="card.frame.src"
:title="card.frame.title"
allow="autoplay; encrypted-media; picture-in-picture; fullscreen"
allowfullscreen
loading="eager"
referrerpolicy="strict-origin-when-cross-origin"
@load.once="card.frame.onLoad"
></iframe>
</div>
<div
v-else
:ref="(el) => card.bind('player', el)"
class="bhote-embedded-callout-player ui-scroll"
></div>
<footer>
<strong>{{ card.title }}</strong>
<small role="status">{{ card.status }}</small>
<a :href="card.url" target="_blank" rel="noopener noreferrer">{{
t('OPEN ORIGINAL ↗')
}}</a>
</footer>
</div>
</section>
</template>
+119
View File
@@ -0,0 +1,119 @@
// The Bhote Koshi event's controls are the kit's: its reconstruction panel
// hand-writes no <button> and no Material Symbols span, its buttons are ghost
// UiButtons that keep their data-action hooks for bhote-koshi.css and the
// tests, and its cinematic button is a pressed toggle whose state the event
// layer presents as `pressed`, not as an `aria-pressed` it writes. The
// embedded media cards are an SFC rather than markup built in script; they
// hold no control (the original link stays a link), and the script builds
// only what the provider SDKs need: their script and preconnect tags, the
// overlay root, and the Facebook player node it warms and carries into a
// card.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const read = (file) =>
readFileSync(new URL(`../../${file}`, import.meta.url), 'utf8');
/** The template block: everything outside script, style and comments. */
const template = (file) =>
read(file)
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
// An opening tag's attributes, quoted values may hold `>` (`() => x`).
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tags = (markup, name) =>
markup.match(new RegExp(String.raw`<${name}\b${ATTRS}>`, 'g')) ?? [];
// An attribute's name, outside the quoted values.
const names = (attrs) => attrs.replace(/"[^"]*"|'[^']*'/g, '""');
const PANEL = 'ui/views/panels/BhoteKoshiPanel.vue';
const CARDS = 'ui/bhoteKoshi/BhoteKoshiMediaCards.vue';
// Per file: its UiButtons, UiCloseButtons, UiSliders and UiIcons.
const SURFACES = {
// Previous and next beat, Play, Play scene, Cinematic, Full story, Open
// original, Lower gorge, a field report (one tag, one per report) and Open
// public map; Close; the split and progress sliders.
[PANEL]: [10, 1, 2, 0],
// The media cards: a frame, a leader, a footer and the original link.
[CARDS]: [0, 0, 0, 0],
};
test('the Bhote Koshi views hand-write no button; each is a kit button', () => {
for (const [file, [buttons, closes, sliders]] of Object.entries(SURFACES)) {
const markup = template(file);
assert.deepEqual(markup.match(/<button\b/gi) ?? [], [], file);
assert.deepEqual(markup.match(/<(select|input)\b/gi) ?? [], [], file);
assert.equal(tags(markup, 'UiButton').length, buttons, file);
assert.equal(tags(markup, 'UiCloseButton').length, closes, file);
assert.equal(tags(markup, 'UiSlider').length, sliders, file);
}
});
test('the Bhote Koshi views hand-write no Material glyph', () => {
for (const [file, [, , , icons]] of Object.entries(SURFACES)) {
const markup = template(file);
assert.deepEqual(markup.match(/material-symbols/g) ?? [], [], file);
const found = tags(markup, 'UiIcon');
assert.equal(found.length, icons, file);
for (const icon of found) assert.match(icon, /\s:size="null"/, file);
}
});
test('the cinematic button takes the kit pressed state', () => {
for (const file of Object.keys(SURFACES))
for (const [tag, attrs] of template(file).matchAll(
new RegExp(String.raw`<[A-Za-z][\w-]*\b(${ATTRS})>`, 'g'),
)) {
assert.doesNotMatch(
names(attrs),
/(?:^|\s)(?::|v-bind:)?aria-pressed(?=[\s=/]|$)/,
tag,
);
assert.doesNotMatch(
attrs,
/(?:^|\s)(?:v-bind|:)=(?:"[^"]*aria-?pressed[^"]*"|'[^']*aria-?pressed[^']*')/i,
tag,
);
}
const pressed = tags(template(PANEL), 'UiButton').filter((tag) =>
/\s:pressed=/.test(tag),
);
assert.equal(pressed.length, 1);
assert.match(
pressed[0],
/^<UiButton data-action="cinematic" :pressed="Boolean\(panel\.refs\.cinematicButton\.pressed\)"/,
);
// bhote-koshi.css styles the pressed button by its aria-pressed.
assert.doesNotMatch(pressed[0], /pressed-class/);
// The layer presents the state; it writes no aria-pressed of its own.
const layer = read('data/bhoteKoshiEvent.js');
assert.doesNotMatch(layer, /aria-pressed/);
assert.match(
layer,
/setElementProperty\(button, 'pressed', _cinematicActive\)/,
);
});
test('the media cards are drawn by their view, not built in script', () => {
const source = read('data/bhoteKoshiEmbeddedMedia.js');
assert.doesNotMatch(source, /innerHTML|insertAdjacentHTML|createElementNS/);
// Provider scripts and preconnects, the overlay root, and the Facebook
// embed node and its warm host.
assert.deepEqual(
[...source.matchAll(/createElement\('(\w+)'\)/g)].map((m) => m[1]),
['script', 'script', 'script', 'link', 'div', 'div', 'div'],
);
assert.match(source, /renderVue\(\s*h\(BhoteKoshiMediaCards,/);
const cards = template(CARDS);
const opening = (name, attribute) =>
new RegExp(String.raw`<${name}\b${ATTRS}\s${attribute}${ATTRS}>`);
for (const part of [
opening('iframe', 'class="bhote-embedded-media-warmup"'),
opening('section', 'class="bhote-embedded-callout"'),
opening('svg', 'class="bhote-embedded-callout-leader"'),
opening('div', 'class="bhote-embedded-callout-body" data-overlay-input'),
opening('small', 'role="status"'),
opening('a', 'target="_blank" rel="noopener noreferrer"'),
])
assert.match(cards, part);
});
+150
View File
@@ -0,0 +1,150 @@
// The AI chat panel's and the voice control's buttons and Material glyphs
// are the kit's: neither their templates nor the voice card and panel
// layout buttons they render hand-write a <button> or a Material Symbols
// span. Their other glyphs (the chat bubble, the globe, attach, send and
// stop, expand and the two Back chevrons) are inline SVG drawn with their own
// strokes, which no Material symbol the page loads draws the same, so they
// stay SVG. The voice panel's Preview and Settings are tabs (`role="tab"`
// with `aria-selected`), not pressed toggles, and DISMISS is a text button,
// not a cross, so it is a UiButton rather than a UiCloseButton. The chat's
// message box, file picker and the minutes field stay native: the kit has
// no text area, file or number field. The voice modules build no controls
// in script.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync, readdirSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
/** A view's template block: everything outside script, style and comments. */
function template(file) {
const source = readFileSync(
new URL(`../views/panels/${file}`, import.meta.url),
'utf8',
);
return source
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
}
// A tag's attributes, read past quoted values so a handler's `=>` does not
// end the tag early.
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tag = (pattern, flags = '') =>
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
const tags = (markup, name) =>
markup.match(tag(String.raw`<${name}\bATTRS>`, 'g')) ?? [];
const views = {
// Settings, the quick prompts, an attachment's remove, Attach layer,
// Attach a file, Expand conversation, the command suggestions, Expand
// chat, Add attachment and Send / Stop reply.
'ChatPanel.vue': {
UiButton: 10,
UiCloseButton: 1,
UiIcon: 1,
UiSelect: 1,
svgs: 5,
},
// The tier button (dock and panel), the mic, Open AI chat, Back to chat,
// Back to voice, the Preview and Settings tabs and DISMISS.
'VoiceControl.vue': {
UiButton: 9,
UiCloseButton: 1,
UiIcon: 2,
UiSelect: 3,
UiCheckbox: 2,
svgs: 3,
},
'VoiceCard.vue': { UiButton: 0, UiCloseButton: 1, UiIcon: 0, svgs: 0 },
// Dock and minimize.
'PanelLayoutButtons.vue': { UiButton: 2, UiIcon: 0, svgs: 2 },
'VoiceVisualizer.vue': { UiButton: 0, UiIcon: 0, svgs: 1 },
};
const markup = Object.fromEntries(
Object.keys(views).map((file) => [file, template(file)]),
);
test('the chat and voice views hand-write no button; each is the kit', () => {
for (const [file, counts] of Object.entries(views)) {
assert.deepEqual(markup[file].match(/<button\b/gi) ?? [], [], file);
for (const name of ['UiButton', 'UiCloseButton', 'UiSelect', 'UiCheckbox'])
assert.equal(tags(markup[file], name).length, counts[name] ?? 0, file);
}
});
test('the pressed toggles take the kit pressed state', () => {
for (const [file, view] of Object.entries(markup))
assert.doesNotMatch(view, /aria-pressed/, file);
const voice = tags(markup['VoiceControl.vue'], 'UiButton');
const tiers = voice.filter((button) => /id="gev-voice-tier"/.test(button));
assert.equal(tiers.length, 2);
for (const tier of tiers)
assert.match(tier, /\s:pressed="Boolean\(view\.tier\.pressed\)"/);
// The mic writes no aria-pressed while its owner has no state for it.
assert.match(
markup['VoiceControl.vue'],
tag(
String.raw`<UiButton\s+id="gev-voice-button"ATTRS\s:pressed="view\.button\.pressed \?\? undefined"`,
),
);
assert.match(
markup['PanelLayoutButtons.vue'],
tag(
String.raw`<UiButton\s+data-layout-dockATTRS\s:pressed="props\.docked"`,
),
);
// The panel tabs are tabs: selected, never pressed.
const tabs = voice.filter((button) => /role="tab"/.test(button));
assert.equal(tabs.length, 2);
for (const button of tabs) {
assert.match(button, /\s:aria-selected="/);
assert.doesNotMatch(button, /\s:pressed=/);
}
});
test('the views hand-write no Material glyph; each is a UiIcon the site sizes', () => {
for (const [file, { UiIcon, svgs }] of Object.entries(views)) {
assert.deepEqual(markup[file].match(/material-symbols/g) ?? [], [], file);
const icons = tags(markup[file], 'UiIcon');
assert.equal(icons.length, UiIcon, file);
// Without it the kit writes an 18px size that beats voice-cost.css and
// voice-card.css.
for (const icon of icons) assert.match(icon, /\s:size="null"/, file);
assert.equal(markup[file].match(/<svg\b/g)?.length ?? 0, svgs, file);
}
assert.match(
markup['ChatPanel.vue'],
/<UiIcon name="settings" class="gev-voice-settings-icon" :size="null" \/>/,
);
assert.equal(
markup['VoiceControl.vue'].match(
/<UiIcon name="(?:visibility|settings)" class="gev-voice-panel-tab-icon" :size="null" \/>/g,
)?.length,
2,
);
});
test('the only native fields left are the message box, file picker and minutes', () => {
const inputs = Object.values(markup).flatMap((view) => tags(view, 'input'));
assert.equal(inputs.length, 2);
assert.match(inputs[0], /id="gev-chat-file" type="file"/);
assert.match(inputs[1], /id="gev-voice-timeout-input" type="number"/);
assert.equal(tags(markup['ChatPanel.vue'], 'textarea').length, 1);
for (const view of Object.values(markup)) {
assert.deepEqual(view.match(/<select\b/gi) ?? [], []);
assert.doesNotMatch(view, /type="(?:checkbox|range)"/);
}
});
test('the voice modules build no buttons or Material glyphs in script', () => {
const root = fileURLToPath(new URL('../../voice/', import.meta.url));
const modules = readdirSync(root, { recursive: true })
.filter((file) => file.endsWith('.js') && !/test|Harness/.test(file))
.map((file) => path.join(root, file));
assert.ok(modules.length > 50);
for (const file of modules) {
const source = readFileSync(file, 'utf8');
assert.doesNotMatch(source, /createElement\(\s*['"]button/, file);
assert.doesNotMatch(source, /<button\b|material-symbols/, file);
}
});
+126
View File
@@ -0,0 +1,126 @@
// UTILITIES ▸ Draw (its toggle, Clear, the colour swatches and the drawn
// shapes' rows), Import and the Street Level panel are on the kit: none of
// them hand-writes a <button>, a Material Symbols span, a select, a checkbox
// or a range. The Draw toggle is a pressed toggle with `active`. The colour
// swatches are `role="radio"` buttons: they say they are chosen with
// `aria-checked` and their own `active` class, never `aria-pressed`. A drawn
// shape's show/hide renames itself (Show …, Hide …) rather than being pressed.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const source = (file) =>
readFileSync(new URL(`../views/panels/${file}`, import.meta.url), 'utf8');
/** A view's template block: everything outside script, style and comments. */
const template = (file) =>
source(file)
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
// A tag's attributes, read past quoted values so a handler's `=>` does not
// end the tag early.
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tag = (pattern, flags = '') =>
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
const tags = (markup, name) =>
markup.match(tag(String.raw`<${name}\bATTRS>`, 'g')) ?? [];
const views = {
// Draw and Clear.
'DrawControls.vue': { buttons: 2, icons: 1, closes: 0 },
// The five colours, one v-for.
'DrawSwatches.vue': { buttons: 1, icons: 0, closes: 0 },
// A row's swatch, show/hide, the application's actions and fly to; remove
// is a UiCloseButton.
'DrawMarkList.vue': { buttons: 4, icons: 3, closes: 1 },
// Import and a file's row actions.
'GeoImport.vue': { buttons: 2, icons: 2, closes: 0 },
// The status toggle, EXPAND and the nearest-imagery button; the viewer's
// close. EXPAND's ⤢ ⤡ and the errors' ⚠ are text, not Material symbols.
'StreetLevelPanel.vue': { buttons: 3, icons: 0, closes: 1 },
};
const markup = Object.fromEntries(
Object.keys(views).map((file) => [file, template(file)]),
);
test('the Draw, Import and Street Level views hand-write no button', () => {
for (const [file, { buttons, closes }] of Object.entries(views)) {
const html = markup[file];
assert.deepEqual(html.match(/<button\b/gi) ?? [], [], file);
assert.deepEqual(html.match(/<component\b/gi) ?? [], [], file);
assert.equal(tags(html, 'UiButton').length, buttons, file);
assert.equal(tags(html, 'UiCloseButton').length, closes, file);
}
});
test('they hand-write no select, checkbox or range', () => {
for (const [file, html] of Object.entries(markup)) {
assert.deepEqual(html.match(/<select\b/gi) ?? [], [], file);
assert.doesNotMatch(
html,
tag(String.raw`<input\bATTRS\stype="(?:checkbox|range)"`),
file,
);
}
// SINCE is the kit's range.
assert.equal(tags(markup['StreetLevelPanel.vue'], 'UiSlider').length, 1);
});
test('they hand-write no Material glyph; each is a UiIcon sized by the site', () => {
for (const [file, { icons }] of Object.entries(views)) {
const html = markup[file];
assert.deepEqual(html.match(/material-symbols-outlined/g) ?? [], [], file);
const found = tags(html, 'UiIcon');
assert.equal(found.length, icons, file);
// Without it the kit writes an 18px size that beats the site rules.
for (const icon of found) assert.match(icon, /\s:size="null"/, file);
}
// Draw's and Import's glyphs keep pp-icon, which sizes them.
for (const file of ['DrawControls.vue', 'GeoImport.vue']) {
const [icon] = tags(markup[file], 'UiIcon');
assert.match(icon, /\sclass="pp-icon"/, file);
}
});
test('no tag hand-writes aria-pressed; Draw is a pressed toggle with active', () => {
for (const [file, html] of Object.entries(markup))
assert.doesNotMatch(
html,
tag(String.raw`<\w+\bATTRS\s:?aria-pressed`),
file,
);
const [draw] = tags(markup['DrawControls.vue'], 'UiButton').filter((b) =>
/\sid="draw-toggle"/.test(b),
);
assert.match(draw, /\s:pressed="draw\?\.active \?\? false"/);
assert.match(draw, /\spressed-class="active"/);
const [clear] = tags(markup['DrawControls.vue'], 'UiButton').filter((b) =>
/\sid="draw-clear"/.test(b),
);
assert.doesNotMatch(clear, /\s:pressed=/);
// A shape's show/hide says what it does in its name, not by being pressed.
for (const button of tags(markup['DrawMarkList.vue'], 'UiButton'))
assert.doesNotMatch(button, /\s:pressed=/);
});
test('the colour swatches are radios chosen by aria-checked, never pressed', () => {
const [swatch] = tags(markup['DrawSwatches.vue'], 'UiButton');
assert.match(swatch, /\srole="radio"/);
assert.match(
swatch,
/\s:aria-checked="String\(color === props\.modelValue\)"/,
);
assert.match(swatch, /\s:class="\{ active: color === props\.modelValue \}"/);
assert.doesNotMatch(swatch, /\s:pressed=|\spressed-class=/);
});
test('code that focuses a converted button reaches its element', () => {
// A template ref on a component holds the component, not the button.
assert.match(
source('DrawSwatches.vue'),
/:ref="\(swatch\) => \(buttons\[index\] = swatch\?\.\$el\)"/,
);
assert.match(
source('GeoImport.vue'),
/importButton\.value\?\.\$el\.focus\(\)/,
);
});
+142
View File
@@ -0,0 +1,142 @@
// The space missions, Contacts, Radio and provider settings controls are the
// kit's: none of their views hand-writes a <button>, a Material Symbols span,
// a select or a checkbox. Radio's Enable, the RTL-SDR card's Connect and its
// FM and ADS-B modes are pressed toggles with `active`; Radio's Play and the
// card's Locate keep their own `active` class, since their words change
// with their state rather than saying they are pressed. The RTL-SDR card's
// FM frequency stays a native number field (the kit has none), and the radio
// tuner's range stays native: its owner moves the handle back to the
// selected station on a drag's first input without changing the slot.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
/** A view's template block: everything outside script, style and comments. */
function template(file) {
const source = readFileSync(
new URL(`../views/${file}`, import.meta.url),
'utf8',
);
return source
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
.replace(/<!--[\s\S]*?-->/g, '');
}
// A tag's attributes, read past quoted values so a handler's `=>` does not
// end the tag early.
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
const tag = (pattern, flags = '') =>
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
const tags = (markup, name) =>
markup.match(tag(String.raw`<${name}\bATTRS>`, 'g')) ?? [];
const byId = (markup, name, id) => {
const found = tags(markup, name).filter((t) =>
new RegExp(String.raw`\sid="${id}"`).test(t),
);
assert.equal(found.length, 1, id);
return found[0];
};
// Each view's UiButtons, UiCloseButtons, UiIcons, UiSelects and UiSliders.
const VIEWS = {
// FOCUS, REPLAY ASCENT, the replay's pause, PREV, NEXT and SHOW ALL; the
// header's deselect and the replay's Cancel close.
'panels/MissionDetail.vue': [6, 2, 0, 0, 1],
// A mission's row.
'panels/MissionRoster.vue': [1, 0, 0, 0, 0],
'panels/MissionReplayOverlay.vue': [0, 0, 0, 0, 0],
'panels/SpaceMissionsPanel.vue': [0, 0, 0, 0, 0],
// PREV, FOCUS, NEXT and a contact's row.
'panels/AwarenessPanel.vue': [4, 0, 0, 0, 0],
'panels/AwarenessDirection.vue': [0, 0, 0, 0, 0],
'panels/AwarenessNames.vue': [0, 0, 0, 0, 0],
// Connect, Locate, Change device, FM, ADS-B, Tune and the two seeks.
'panels/SdrCard.vue': [8, 0, 0, 1, 1],
// Enable, PREV, PLAY, NEXT and STOP.
'panels/RadioPanel.vue': [5, 0, 0, 1, 1],
'panels/RadioTuner.vue': [0, 0, 0, 0, 0],
// The POWER UP chip and its bolt, a key's REMOVE, the voice auth toggle
// and SAVE KEYS; the dialog's close.
'ProviderSettingsView.vue': [4, 1, 1, 0, 0],
};
const views = Object.entries(VIEWS).map(([file, counts]) => ({
file,
markup: template(file),
counts,
}));
test('they hand-write no button; each is a UiButton or UiCloseButton', () => {
for (const { file, markup, counts } of views) {
assert.deepEqual(markup.match(/<button\b/gi) ?? [], [], file);
assert.deepEqual(markup.match(/<component\b/gi) ?? [], [], file);
assert.equal(tags(markup, 'UiButton').length, counts[0], file);
assert.equal(tags(markup, 'UiCloseButton').length, counts[1], file);
}
});
test('they hand-write no Material glyph; each is a UiIcon sized by its site', () => {
for (const { file, markup, counts } of views) {
assert.deepEqual(
markup.match(/material-symbols-outlined/g) ?? [],
[],
file,
);
const icons = tags(markup, 'UiIcon');
assert.equal(icons.length, counts[2], file);
// Without it the kit writes an 18px size that beats the site rules.
for (const icon of icons) assert.match(icon, /\s:size="null"/, file);
}
});
test('their selects and ranges are the kit’s, apart from the tuner', () => {
for (const { file, markup, counts } of views) {
assert.deepEqual(markup.match(/<select\b/gi) ?? [], [], file);
assert.doesNotMatch(markup, /type="checkbox"/, file);
assert.equal(tags(markup, 'UiSelect').length, counts[3], file);
assert.equal(tags(markup, 'UiSlider').length, counts[4], file);
const ranges = tags(markup, 'input').filter((i) =>
/\stype="range"/.test(i),
);
assert.equal(ranges.length, file === 'panels/RadioTuner.vue' ? 1 : 0, file);
}
});
test('no tag hand-writes aria-pressed; the pressed toggles take :pressed', () => {
const pressed = {
'panels/MissionDetail.vue': 1,
'panels/SdrCard.vue': 3,
'panels/RadioPanel.vue': 1,
};
for (const { file, markup } of views) {
assert.doesNotMatch(
markup,
tag(String.raw`<\w+\bATTRS\s(?:v-bind)?:?aria-pressed`),
file,
);
const toggles = tags(markup, 'UiButton').filter((b) =>
/\s:pressed=/.test(b),
);
assert.equal(toggles.length, pressed[file] ?? 0, file);
}
const sdr = views.find((v) => v.file === 'panels/SdrCard.vue').markup;
const radio = views.find((v) => v.file === 'panels/RadioPanel.vue').markup;
for (const [markup, id] of [
[sdr, 'sdr-connect-btn'],
[sdr, 'sdr-mode-fm-btn'],
[sdr, 'sdr-mode-adsb-btn'],
[radio, 'radio-enable-btn'],
])
assert.match(byId(markup, 'UiButton', id), /\spressed-class="active"/, id);
});
test('Play and Locate keep their own active class rather than pressed', () => {
const sdr = views.find((v) => v.file === 'panels/SdrCard.vue').markup;
const radio = views.find((v) => v.file === 'panels/RadioPanel.vue').markup;
for (const [markup, id] of [
[radio, 'radio-play-btn'],
[sdr, 'sdr-locate-btn'],
]) {
const button = byId(markup, 'UiButton', id);
assert.doesNotMatch(button, /\s:pressed=/, id);
assert.match(button, /\sv-class-toggle="\{ active: /, id);
}
});
-3
View File
@@ -18,9 +18,6 @@ const REPO_ROOT = path.resolve(SRC_ROOT, '..');
// The pressed toggles that still hand-write `aria-pressed`, by file: each
// pattern matches exactly one of the file's tags, and no other tag may.
const HAND_WRITTEN_PRESSED = {
// The cinematic button renders the attributes the Bhote Koshi layer
// writes for it, `aria-pressed` among them.
'src/ui/views/panels/BhoteKoshiPanel.vue': [/^<button\b[^]*\bcinematic/],
// Explore's story cards are `role="button"` elements, not buttons.
'src/ui/views/stories/ExploreScreen.vue': [
/^<div class="card" role="button"/,
+3 -3
View File
@@ -68,7 +68,7 @@ test('before RadioControls renders, the panel shows its initial markup', (t) =>
assert.equal($('radio-filter').options.length, 1);
assert.equal($('radio-filter').options[0].value, 'all');
assert.equal($('radio-filter').options[0].textContent, 'All');
assert.equal($('radio-play-btn').getAttribute('class'), null);
assert.equal(coreClasses($('radio-play-btn')), '');
assert.equal($('radio-play-btn').disabled, true);
assert.equal($('radio-volume').value, '80');
assert.equal($('radio-volume-value').textContent, '80%');
@@ -120,7 +120,7 @@ test('the panel renders the presented directory, station, transport and playback
assert.equal($('radio-station-homepage').getAttribute('href'), 'https://example.org/');
assert.equal($('radio-station-homepage').hidden, false);
const play = $('radio-play-btn');
assert.equal(play.className, 'active');
assert.equal(coreClasses(play), 'active');
assert.equal(play.textContent, 'PAUSE');
assert.equal(play.getAttribute('aria-label'), 'Pause selected radio station');
assert.equal($('radio-prev-btn').disabled, false);
@@ -128,7 +128,7 @@ test('the panel renders the presented directory, station, transport and playback
assert.equal($('radio-playback-state').textContent, 'Playing KJAZ');
await render({ audioState: 'error', filter: 'all' });
assert.equal(play.className, '');
assert.equal(coreClasses(play), '');
assert.equal($('radio-playback-state').className, 'radio-playback-state error');
assert.equal($('radio-station-homepage').hasAttribute('href'), false);
assert.equal($('radio-station-homepage').hidden, true);
+2 -1
View File
@@ -13,7 +13,8 @@ export const useBhoteKoshiPanelStore = defineStore(
/**
* `{owner, sceneBeat, refs, beforeDate, afterDate, reports}`, or null while
* the event layer is off. Each entry of `refs` holds one control's
* `textContent`, `hidden`, `disabled`, `value` and `attributes`.
* `textContent`, `hidden`, `disabled`, `value` and `attributes`; the
* cinematic button's also holds `pressed`.
*/
const panel = shallowRef(null);
+8 -6
View File
@@ -8,7 +8,9 @@ import { vStatusText } from '../rail/statusText.js';
import { useLocaleStore } from '../stores/locale.js';
import { useProviderSettingsStore } from '../stores/providerSettings.js';
import LocalePicker from './panels/LocalePicker.vue';
import UiButton from '../kit/UiButton.vue';
import UiCloseButton from '../kit/UiCloseButton.vue';
import UiIcon from '../kit/UiIcon.vue';
const { picker } = storeToRefs(useLocaleStore());
// The key setup owner (src/keySetup.js) presents the chip, the dialog and its
@@ -39,10 +41,10 @@ const removeTitle = (title) =>
<!-- Bottom-right HUD row: the POWER UP chip (while keys are missing) and
the language picker, once the shell publishes it. -->
<div id="corner-actions">
<button v-if="available" id="key-setup-chip" type="button" :hidden="!chip || chip.hidden" aria-haspopup="dialog" aria-controls="key-setup" :title="chip?.title" :aria-label="chip?.title" @click="controls?.open()">
<span class="material-symbols-outlined" aria-hidden="true">bolt</span>
<UiButton v-if="available" id="key-setup-chip" :hidden="!chip || chip.hidden" aria-haspopup="dialog" aria-controls="key-setup" :title="chip?.title" :aria-label="chip?.title" @click="controls?.open()">
<UiIcon name="bolt" :size="null" />
<span data-key-setup-chip-label>{{ chip ? chip.label : t('POWER UP') }}</span>
</button>
</UiButton>
<LocalePicker v-if="picker" :key="picker.current" :current="picker.current" :on-select="picker.onSelect" :focus="picker.focus" />
</div>
<aside v-if="available" id="key-setup" role="dialog" aria-labelledby="key-setup-title" aria-describedby="key-setup-description" :hidden="dialog.hidden" v-class-toggle="{ visible: dialog.visible }" :data-ready="view?.ready ? 'true' : undefined" @transitionend="controls?.transitionEnd()">
@@ -66,16 +68,16 @@ const removeTitle = (title) =>
<p class="key-setup-unlocks">{{ key.unlocks }}</p>
<div v-if="!key.external" class="key-setup-fields">
<input v-for="envVar in key.envVars" :key="envVar" type="password" autocomplete="off" spellcheck="false" :data-env-var="envVar" :aria-label="envVar" :placeholder="key.set ? t('{envVar} saved — paste to replace', { envVar }) : t('paste {envVar}', { envVar })" v-field-value="view.fields[envVar] ?? ''" @input="controls?.setField(envVar, $event.target.value)" />
<button v-if="key.managed === 'file'" type="button" class="key-setup-remove" :data-key-setup-remove="JSON.stringify(key.envVars)" :title="removeTitle(key.title)" @click="controls?.remove(key.envVars)">{{ t('REMOVE') }}</button>
<UiButton v-if="key.managed === 'file'" class="key-setup-remove" :data-key-setup-remove="JSON.stringify(key.envVars)" :title="removeTitle(key.title)" @click="controls?.remove(key.envVars)">{{ t('REMOVE') }}</UiButton>
</div>
<div v-if="key.id === 'openai'" class="key-setup-cloud-auth">
<span class="key-setup-cloud-auth-state">{{ view.auth.mode === 'oauth' ? t('VOICE AUTH · CHATGPT OAUTH') : t('VOICE AUTH · API KEY') }}</span>
<button type="button" class="key-setup-cloud-auth-toggle" data-cloud-voice-auth-toggle="true" :title="view.auth.mode === 'oauth' ? t('Use OPENAI_API_KEY for the next cloud voice session') : t('Use the signed-in local ChatGPT/Codex OAuth session for the next cloud voice session')" :aria-disabled="String(view.auth.busy)" @click="controls?.toggleAuth()">{{ view.auth.mode === 'oauth' ? t('USE API KEY') : t('USE CHATGPT OAUTH') }}</button>
<UiButton class="key-setup-cloud-auth-toggle" data-cloud-voice-auth-toggle="true" :title="view.auth.mode === 'oauth' ? t('Use OPENAI_API_KEY for the next cloud voice session') : t('Use the signed-in local ChatGPT/Codex OAuth session for the next cloud voice session')" :aria-disabled="String(view.auth.busy)" @click="controls?.toggleAuth()">{{ view.auth.mode === 'oauth' ? t('USE API KEY') : t('USE CHATGPT OAUTH') }}</UiButton>
</div>
</section>
</div>
<div class="key-setup-footer">
<button type="button" class="key-setup-apply" data-key-setup-apply :aria-disabled="view?.saving == null ? undefined : String(view.saving)" @click="controls?.apply()">{{ t('SAVE KEYS') }}</button>
<UiButton class="key-setup-apply" data-key-setup-apply :aria-disabled="view?.saving == null ? undefined : String(view.saving)" @click="controls?.apply()">{{ t('SAVE KEYS') }}</UiButton>
<span class="key-setup-hint">{{ t('ESC to close') }}</span>
</div>
<p class="key-setup-note" data-key-setup-status role="status" aria-live="polite" v-status-text="statusText"></p>
+5 -4
View File
@@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia';
import { onBeforeUpdate, onUpdated, ref } from 'vue';
import { t } from '../../../i18n/index.js';
import { useContextStore } from '../../stores/context.js';
import UiButton from '../../kit/UiButton.vue';
import AwarenessNames from './AwarenessNames.vue';
// The Contacts panel inside Context. The Contacts layer publishes its view
@@ -66,16 +67,16 @@ onUpdated(() => {
</a>
<AwarenessNames v-if="view.subjectNames" :names="view.subjectNames" />
<div class="military-awareness-controls" role="group" :aria-label="view.navigation.label">
<button type="button" data-awareness-action="previous" :title="view.navigation.previous.title" :disabled="view.navigation.previous.disabled" @click="layer?.navigatePrevious(user)">{{ view.navigation.previous.text }}</button>
<button type="button" data-awareness-action="focus" @click="layer?.focusCurrent(user)">{{ view.navigation.focus.text }}</button>
<button type="button" data-awareness-action="next" :title="view.navigation.next.title" :disabled="view.navigation.next.disabled" @click="layer?.navigateNext(user)">{{ view.navigation.next.text }}</button>
<UiButton data-awareness-action="previous" :title="view.navigation.previous.title" :disabled="view.navigation.previous.disabled" @click="layer?.navigatePrevious(user)">{{ view.navigation.previous.text }}</UiButton>
<UiButton data-awareness-action="focus" @click="layer?.focusCurrent(user)">{{ view.navigation.focus.text }}</UiButton>
<UiButton data-awareness-action="next" :title="view.navigation.next.title" :disabled="view.navigation.next.disabled" @click="layer?.navigateNext(user)">{{ view.navigation.next.text }}</UiButton>
</div>
<section v-for="row in view.rows" :key="row.id" :class="['military-awareness-row', row.relationship]">
<div><strong>{{ row.label }}</strong><b aria-live="polite">{{ row.count }}</b></div>
<small>{{ row.detail }}</small>
<ul v-if="row.nearest.length">
<li v-for="item in row.nearest" :key="item.key">
<button v-if="item.targetId" type="button" class="military-awareness-target" :data-awareness-layer="item.layer" :data-awareness-id="item.targetId" :aria-label="item.ariaLabel" @click="layer?.focusTarget(item.layer, item.targetId, user)">{{ item.label }} <span>{{ item.distance }}</span></button>
<UiButton v-if="item.targetId" class="military-awareness-target" :data-awareness-layer="item.layer" :data-awareness-id="item.targetId" :aria-label="item.ariaLabel" @click="layer?.focusTarget(item.layer, item.targetId, user)">{{ item.label }} <span>{{ item.distance }}</span></UiButton>
<span v-else class="military-awareness-target unavailable" :aria-label="item.ariaLabel">{{ item.label }} <span>{{ item.distance }}</span></span>
<AwarenessNames v-if="item.names" :names="item.names" />
</li>
+11 -10
View File
@@ -2,6 +2,7 @@
import { storeToRefs } from 'pinia';
import { t } from '../../../i18n/index.js';
import { useBhoteKoshiPanelStore } from '../../stores/bhoteKoshiPanel.js';
import UiButton from '../../kit/UiButton.vue';
import UiCloseButton from '../../kit/UiCloseButton.vue';
import UiSlider from '../../kit/UiSlider.js';
@@ -44,30 +45,30 @@ const sliderValue = (event, scale) => Number(event.target.value) / scale;
</div>
<UiSlider class="bhote-event-range flood" unstyled data-role="progress" min="0" max="1000" :model-value="panel.refs.progressInput.value" :hidden="panel.refs.progressInput.hidden" :disabled="panel.refs.progressInput.disabled" :aria-label="panel.refs.progressInput.attributes['aria-label']" @update:model-value="call('previewProgress', $event / 1000)" @change="call('commitProgress', sliderValue($event, 1000), { final: true })" />
<div class="bhote-event-story-nav" :aria-label="t('Story beat navigation')">
<button type="button" data-action="previous-beat" :title="t('Previous story beat')" :aria-label="panel.refs.previousButton.attributes['aria-label']" :disabled="panel.refs.previousButton.disabled" @click="call('previousBeat')">‹</button>
<UiButton data-action="previous-beat" :title="t('Previous story beat')" :aria-label="panel.refs.previousButton.attributes['aria-label']" :disabled="panel.refs.previousButton.disabled" @click="call('previousBeat')">‹</UiButton>
<div class="bhote-event-story-current">
<span data-role="beat-index">{{ panel.refs.beatIndex.textContent }}</span>
<strong data-role="beat-title" aria-live="polite">{{ panel.refs.beatTitle.textContent }}</strong>
<small data-role="beat-meta">{{ panel.refs.beatMeta.textContent }}</small>
</div>
<button type="button" data-action="next-beat" :title="t('Next story beat')" :aria-label="panel.refs.nextButton.attributes['aria-label']" :disabled="panel.refs.nextButton.disabled" @click="call('nextBeat')">›</button>
<UiButton data-action="next-beat" :title="t('Next story beat')" :aria-label="panel.refs.nextButton.attributes['aria-label']" :disabled="panel.refs.nextButton.disabled" @click="call('nextBeat')">›</UiButton>
</div>
<div class="bhote-event-actions">
<button type="button" data-action="play" :aria-label="panel.refs.playButton.attributes['aria-label']" :disabled="panel.refs.playButton.disabled" @click="call('play')">{{ panel.refs.playButton.textContent }}</button>
<button type="button" data-action="play-scene" :hidden="panel.refs.playSceneButton.hidden" :title="t('Play the next shot and continue through this scene')" :aria-label="panel.refs.playSceneButton.attributes['aria-label']" :disabled="panel.refs.playSceneButton.disabled" @click="call('playScene')">{{ panel.refs.playSceneButton.textContent }}</button>
<button type="button" data-action="cinematic" :aria-pressed="panel.refs.cinematicButton.attributes['aria-pressed']" :hidden="panel.refs.cinematicButton.hidden" :disabled="panel.refs.cinematicButton.disabled" @click="call('toggleCinematic')">{{ panel.refs.cinematicButton.textContent }}</button>
<button type="button" data-action="story-replay" :aria-label="panel.refs.storyReplayButton.attributes['aria-label']" :hidden="panel.refs.storyReplayButton.hidden" :disabled="panel.refs.storyReplayButton.disabled" @click="call('replayCinematic')">{{ panel.refs.storyReplayButton.textContent }}</button>
<button type="button" data-action="open-source" :hidden="panel.refs.openSourceButton.hidden" :disabled="panel.refs.openSourceButton.disabled" @click="call('openActiveSource')">{{ t('↗ OPEN ORIGINAL') }}</button>
<button type="button" data-action="corridor" :hidden="panel.refs.corridorButton.hidden" :disabled="panel.refs.corridorButton.disabled" @click="call('focusCorridor')">{{ t('⌖ LOWER GORGE') }}</button>
<UiButton data-action="play" :aria-label="panel.refs.playButton.attributes['aria-label']" :disabled="panel.refs.playButton.disabled" @click="call('play')">{{ panel.refs.playButton.textContent }}</UiButton>
<UiButton data-action="play-scene" :hidden="panel.refs.playSceneButton.hidden" :title="t('Play the next shot and continue through this scene')" :aria-label="panel.refs.playSceneButton.attributes['aria-label']" :disabled="panel.refs.playSceneButton.disabled" @click="call('playScene')">{{ panel.refs.playSceneButton.textContent }}</UiButton>
<UiButton data-action="cinematic" :pressed="Boolean(panel.refs.cinematicButton.pressed)" :hidden="panel.refs.cinematicButton.hidden" :disabled="panel.refs.cinematicButton.disabled" @click="call('toggleCinematic')">{{ panel.refs.cinematicButton.textContent }}</UiButton>
<UiButton data-action="story-replay" :aria-label="panel.refs.storyReplayButton.attributes['aria-label']" :hidden="panel.refs.storyReplayButton.hidden" :disabled="panel.refs.storyReplayButton.disabled" @click="call('replayCinematic')">{{ panel.refs.storyReplayButton.textContent }}</UiButton>
<UiButton data-action="open-source" :hidden="panel.refs.openSourceButton.hidden" :disabled="panel.refs.openSourceButton.disabled" @click="call('openActiveSource')">{{ t('↗ OPEN ORIGINAL') }}</UiButton>
<UiButton data-action="corridor" :hidden="panel.refs.corridorButton.hidden" :disabled="panel.refs.corridorButton.disabled" @click="call('focusCorridor')">{{ t('⌖ LOWER GORGE') }}</UiButton>
</div>
</section>
<details class="bhote-event-evidence">
<summary>{{ t('FIELD REPORTS · {count}', { count: panel.reports.length }) }}</summary>
<div class="bhote-event-report-list"><button v-for="(report, index) in panel.reports" :key="index" type="button" class="bhote-event-report" @click="call('openReport', index)"><span>{{ report.label }}</span><small>{{ report.status }}</small></button></div>
<div class="bhote-event-report-list"><UiButton v-for="(report, index) in panel.reports" :key="index" class="bhote-event-report" @click="call('openReport', index)"><span>{{ report.label }}</span><small>{{ report.status }}</small></UiButton></div>
</details>
<div class="bhote-event-credit">
<span>{{ t('GEOLOCATIONS · {credit}', { credit: 'GEO GEORGE SHADRACH' }) }}</span>
<button type="button" data-action="geolocation-map" @click="call('openGeolocationMap')">{{ t('↗ OPEN PUBLIC MAP') }}</button>
<UiButton data-action="geolocation-map" @click="call('openGeolocationMap')">{{ t('↗ OPEN PUBLIC MAP') }}</UiButton>
</div>
<p class="bhote-event-caveat"><span data-role="caveat">{{ panel.refs.caveat.textContent }}</span><span data-role="imagery-cloud-note" :hidden="panel.refs.imageryCloudNote.hidden">{{ t(' Clouds are preserved from the source imagery.') }}</span></p>
</aside>
+12 -10
View File
@@ -5,6 +5,8 @@ import { t } from '../../../i18n/index.js';
import { useVoiceStore } from '../../stores/voice.js';
import { ASSISTANT_NAME } from '../../../voice/control.js';
import PanelLayoutButtons from './PanelLayoutButtons.vue';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
import UiCloseButton from '../../kit/UiCloseButton.vue';
import UiSelect from '../../kit/UiSelect.js';
@@ -67,7 +69,7 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
<div><strong>{{ t('GEV CHAT') }}</strong><p>{{ t('Ask about the map. Tell it where to go.') }}</p></div>
<div id="gev-chat-header-actions">
<PanelLayoutButtons :docked="props.view.layout.docked" :minimized="props.view.chat.minimized" @dock="emit('layout-dock')" @minimize="emit('chat-minimize')" />
<button v-if="props.view.panel" id="gev-voice-settings-button" class="gev-voice-settings-button" type="button" :aria-label="t('Settings')" :title="t('Settings')" aria-controls="gev-voice-panel" :aria-expanded="String(props.view.voicePanel.settingsExpanded)" @click="emit('settings-button')"><span class="material-symbols-outlined gev-voice-settings-icon" aria-hidden="true">settings</span></button>
<UiButton v-if="props.view.panel" id="gev-voice-settings-button" class="gev-voice-settings-button" :aria-label="t('Settings')" :title="t('Settings')" aria-controls="gev-voice-panel" :aria-expanded="String(props.view.voicePanel.settingsExpanded)" @click="emit('settings-button')"><UiIcon name="settings" class="gev-voice-settings-icon" :size="null" /></UiButton>
<UiCloseButton id="gev-chat-close" :label="t('Close chat')" @click="emit('chat-close')" />
</div>
</header>
@@ -76,7 +78,7 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
<svg viewBox="0 0 24 24" width="32" height="32" fill="none" stroke="currentColor" stroke-width="1" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><ellipse cx="12" cy="12" rx="4" ry="10"></ellipse><path d="M2 12h20"></path></svg>
<h3>{{ t('Explore with a question') }}</h3>
<p>{{ t('Find a place, explore live data, or change your view.') }}</p>
<button v-for="prompt in quickPrompts()" :key="prompt" type="button" :hidden="!props.view.chat.quickChecked" @click="emit('chat-prompt', prompt)">{{ prompt }}</button>
<UiButton v-for="prompt in quickPrompts()" :key="prompt" :hidden="!props.view.chat.quickChecked" @click="emit('chat-prompt', prompt)">{{ prompt }}</UiButton>
</div>
<div v-for="message in messages" :key="message.id" class="gev-chat-message" :data-role="message.role">
<small>{{ message.role === 'user' ? t('YOU') : ASSISTANT_NAME }}</small><span>{{ message.text }}</span>
@@ -86,7 +88,7 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
<!-- Stays under the status for the whole conversation. -->
<p v-if="props.view.chat.authNote" id="gev-chat-auth-note">{{ props.view.chat.authNote }}</p>
<div id="gev-chat-attachments" :aria-label="t('Attachments')" :hidden="!props.view.chat.attachments.length">
<button v-for="item in props.view.chat.attachments" :key="item.key" type="button" :disabled="props.view.chat.locked" :aria-label="`${t('Remove attachment')}: ${item.name}`" @click="emit('chat-attachment-remove', item.key)">{{ item.name }} ×</button>
<UiButton v-for="item in props.view.chat.attachments" :key="item.key" :disabled="props.view.chat.locked" :aria-label="`${t('Remove attachment')}: ${item.name}`" @click="emit('chat-attachment-remove', item.key)">{{ item.name }} ×</UiButton>
</div>
<div id="gev-chat-attach-menu" :hidden="!props.view.chat.attachMenuOpen" @keydown="emit('chat-attach-keydown', $event)">
<label for="gev-chat-layer">{{ t('Attach a map layer') }}</label>
@@ -95,27 +97,27 @@ const quickPrompts = () => [t('Fly to Tokyo'), t('Show live flights')];
<option value="">{{ t('Choose a layer…') }}</option>
<option v-for="layer in props.view.chat.layers" :key="layer.value" :value="layer.value">{{ layer.label }}</option>
</UiSelect>
<button id="gev-chat-layer-attach" type="button" :disabled="props.view.chat.locked || !layerChoice" @click="attachLayer()">{{ t('Attach layer') }}</button>
<UiButton id="gev-chat-layer-attach" :disabled="props.view.chat.locked || !layerChoice" @click="attachLayer()">{{ t('Attach layer') }}</UiButton>
</div>
<button id="gev-chat-file-button" type="button" :disabled="props.view.chat.locked" @click="emit('chat-file-button')">{{ t('Attach a file') }}</button>
<UiButton id="gev-chat-file-button" :disabled="props.view.chat.locked" @click="emit('chat-file-button')">{{ t('Attach a file') }}</UiButton>
<p>{{ t('TXT, Markdown, CSV, JSON or GeoJSON · up to 10 KB in total. Attachments are sent to your AI provider with your message.') }}</p>
<input id="gev-chat-file" type="file" accept=".txt,.md,.csv,.json,.geojson" multiple hidden @change="emit('chat-files', $event.target)" />
</div>
<aside id="gev-chat-mini-reply" :hidden="!props.view.chat.miniReply" :aria-label="t('Latest AI response')">
<header><span translate="no">{{ ASSISTANT_NAME }}</span><button id="gev-chat-expand-reply" type="button" :aria-label="t('Expand conversation')" :title="t('Expand conversation')" @click="emit('chat-restore')"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M14 4h6v6m0-6-7 7M10 20H4v-6m0 6 7-7"></path></svg></button></header>
<header><span translate="no">{{ ASSISTANT_NAME }}</span><UiButton id="gev-chat-expand-reply" :aria-label="t('Expand conversation')" :title="t('Expand conversation')" @click="emit('chat-restore')"><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M14 4h6v6m0-6-7 7M10 20H4v-6m0 6 7-7"></path></svg></UiButton></header>
<p id="gev-chat-mini-text" aria-live="polite">{{ props.view.chat.miniReply }}</p>
</aside>
<div id="gev-chat-suggestions" :aria-label="t('Command suggestions')" :hidden="!props.view.chat.suggestions.length">
<div v-for="group in props.view.chat.suggestions" :key="group.label">
<small>{{ group.label }}</small>
<button v-for="command in group.items" :key="command" type="button" :title="command" @click="emit('chat-suggestion', command)">{{ command }}</button>
<UiButton v-for="command in group.items" :key="command" :title="command" @click="emit('chat-suggestion', command)">{{ command }}</UiButton>
</div>
</div>
<form id="gev-chat-form" @submit.prevent="emit('chat-submit')">
<button id="gev-chat-restore" type="button" :aria-label="t('Expand chat')" :title="t('Expand chat')" @click="emit('chat-restore')"><svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M5 4h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-6 4V6a2 2 0 0 1 2-2Z"></path></svg></button>
<button id="gev-chat-attach" type="button" :disabled="props.view.chat.busy" :aria-label="t('Add attachment')" :aria-expanded="String(props.view.chat.attachMenuOpen)" aria-controls="gev-chat-attach-menu" @click="emit('chat-attach-toggle')" @keydown="emit('chat-attach-keydown', $event)"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m8 12 6-6a3 3 0 0 1 4 4l-8 8a5 5 0 0 1-7-7l9-9"></path></svg></button>
<UiButton id="gev-chat-restore" :aria-label="t('Expand chat')" :title="t('Expand chat')" @click="emit('chat-restore')"><svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M5 4h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-6 4V6a2 2 0 0 1 2-2Z"></path></svg></UiButton>
<UiButton id="gev-chat-attach" :disabled="props.view.chat.busy" :aria-label="t('Add attachment')" :aria-expanded="String(props.view.chat.attachMenuOpen)" aria-controls="gev-chat-attach-menu" @click="emit('chat-attach-toggle')" @keydown="emit('chat-attach-keydown', $event)"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m8 12 6-6a3 3 0 0 1 4 4l-8 8a5 5 0 0 1-7-7l9-9"></path></svg></UiButton>
<textarea id="gev-chat-input" v-owned-draft="{ text: props.view.chat.draft, revision: props.view.chat.draftRevision }" :rows="props.view.chat.rows" maxlength="4000" :aria-label="t('Message GEV')" :placeholder="t('Ask GEV anything about the map…')" @input="emit('chat-input', $event.target.value)" @keydown="emit('chat-keydown', $event)"></textarea>
<button id="gev-chat-send" :type="props.view.chat.busy ? 'button' : 'submit'" :disabled="props.view.chat.sendDisabled" :data-busy="String(props.view.chat.busy)" :aria-label="props.view.chat.busy ? t('Stop reply') : t('Send message')" :title="props.view.chat.busy ? t('Stop reply') : t('Send message')" @click="props.view.chat.busy && emit('chat-stop')"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path class="gev-chat-enter-icon" d="M19 5v8H5m5-5-5 5 5 5"></path><rect class="gev-chat-stop-icon" x="6" y="6" width="12" height="12" rx="1.5" fill="currentColor" stroke="none"></rect></svg></button>
<UiButton id="gev-chat-send" :type="props.view.chat.busy ? 'button' : 'submit'" :disabled="props.view.chat.sendDisabled" :data-busy="String(props.view.chat.busy)" :aria-label="props.view.chat.busy ? t('Stop reply') : t('Send message')" :title="props.view.chat.busy ? t('Stop reply') : t('Send message')" @click="props.view.chat.busy && emit('chat-stop')"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path class="gev-chat-enter-icon" d="M19 5v8H5m5-5-5 5 5 5"></path><rect class="gev-chat-stop-icon" x="6" y="6" width="12" height="12" rx="1.5" fill="currentColor" stroke="none"></rect></svg></UiButton>
</form>
</section>
</template>
+3 -2
View File
@@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia';
import { computed } from 'vue';
import { t } from '../../../i18n/index.js';
import UiButton from '../../kit/UiButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
import UiSegmented from '../../kit/UiSegmented.vue';
import { useDisplayStore } from '../../stores/display.js';
import DrawMarkList from './DrawMarkList.vue';
@@ -27,7 +28,7 @@ const shapeOptions = computed(() => [
<template>
<div class="pp-toggle-group" id="draw-group">
<UiButton class="pp-toggle-btn" :pressed="draw?.active ?? false" pressed-class="active" id="draw-toggle" @click="act('toggleDraw')" :title="t('Draw on the world — click vertices, double-click or Enter to finish, Esc to cancel')">
<span class="pp-icon material-symbols-outlined" aria-hidden="true">draw</span>
<UiIcon class="pp-icon" name="draw" :size="null" />
<span class="pp-label">{{ t('Draw') }}</span>
</UiButton>
<div class="pp-slider-row" :class="{ visible: draw?.active }" id="draw-mode-row">
@@ -36,7 +37,7 @@ const shapeOptions = computed(() => [
</div>
<div class="pp-slider-row" :class="{ visible: draw?.active }" id="draw-label-row">
<span class="draw-hint" id="draw-hint" aria-live="polite">{{ draw?.hint ?? '' }}</span>
<button class="pp-mode-btn draw-clear-btn" id="draw-clear" type="button" @click="act('clearDraw')" :title="t('Remove every mark from the board')">{{ t('Clear') }}</button>
<UiButton class="pp-mode-btn draw-clear-btn" id="draw-clear" @click="act('clearDraw')" :title="t('Remove every mark from the board')">{{ t('Clear') }}</UiButton>
</div>
<DrawMarkList />
</div>
+3 -1
View File
@@ -6,7 +6,9 @@ import { DRAW_COLOR_CSS } from '../../../annotations/drawMarks.js';
import { vFieldValue } from '../../rail/fieldValue.js';
import { vFocusSafeChildren } from '../../rail/focusSafeChildren.js';
import DrawSwatches from './DrawSwatches.vue';
import UiButton from '../../kit/UiButton.vue';
import UiCloseButton from '../../kit/UiCloseButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
import { useDisplayStore } from '../../stores/display.js';
// UTILITIES ▸ Draw's shapes, one row each like Import's files: the colour
@@ -100,5 +102,5 @@ function leave() {
</script>
<template>
<ul class="geo-import-list draw-mark-list" :class="{ visible: listed }" id="draw-mark-list" v-focus-safe-children="leave" :aria-label="t('Drawn shapes')"><li v-for="row in rows" :key="row.id" class="geo-import-row draw-mark-row" :class="{ 'hidden-mark': row.hidden }" :data-mark-id="row.id" @keydown="onRowKey(row, $event)"><button type="button" class="geo-import-swatch draw-mark-swatch" data-control="swatch" :style="{ background: DRAW_COLOR_CSS[row.color] }" :title="row.labels.swatch" :aria-label="row.labels.swatch" :aria-expanded="String(picking === row.id)" :aria-controls="`draw-mark-colors-${row.id}`" @click="picking = picking === row.id ? null : row.id"></button><DrawSwatches v-if="picking === row.id" :id="`draw-mark-colors-${row.id}`" class="draw-mark-colors" data-control="picker" autofocus :label="row.labels.colors" :model-value="row.color" @update:model-value="recolor(row, $event)" @choose="closePicker(row.id)" /><input type="text" class="geo-import-name draw-mark-name" data-control="name" maxlength="120" autocomplete="off" spellcheck="false" v-field-value="row.name" :placeholder="row.placeholder" :aria-label="row.labels.name" @keydown="onNameKey(row, $event)" @focusout="commit(row, $event.currentTarget)"><button type="button" class="geo-import-action" data-control="toggle" :title="row.labels.toggle" :aria-label="row.labels.toggle" @click="display.act('toggleDrawMark', row.id)"><span class="material-symbols-outlined" aria-hidden="true">{{ row.hidden ? 'visibility_off' : 'visibility' }}</span></button><button v-for="action in row.actions" :key="action.id" type="button" class="geo-import-action draw-mark-action" :data-control="`action-${action.id}`" :data-action="action.id" :title="action.label" :aria-label="action.label" :aria-disabled="String(row.busy)" @click="display.act('runDrawMarkAction', row.id, action.id)"><span class="material-symbols-outlined" aria-hidden="true">{{ action.icon }}</span></button><button type="button" class="geo-import-action" data-control="fly" :title="row.labels.fly" :aria-label="row.labels.fly" @click="display.act('flyToDrawMark', row.id)"><span class="material-symbols-outlined" aria-hidden="true">my_location</span></button><UiCloseButton class="geo-import-action" glyph="icon" data-control="remove" :title="row.labels.remove" :label="row.labels.remove" @click="display.act('removeDrawMark', row.id)" /><span v-if="row.actions.length" class="draw-mark-note" role="status" :aria-busy="String(row.busy)">{{ row.busy ? '…' : row.note }}</span></li></ul>
<ul class="geo-import-list draw-mark-list" :class="{ visible: listed }" id="draw-mark-list" v-focus-safe-children="leave" :aria-label="t('Drawn shapes')"><li v-for="row in rows" :key="row.id" class="geo-import-row draw-mark-row" :class="{ 'hidden-mark': row.hidden }" :data-mark-id="row.id" @keydown="onRowKey(row, $event)"><UiButton class="geo-import-swatch draw-mark-swatch" data-control="swatch" :style="{ background: DRAW_COLOR_CSS[row.color] }" :label="row.labels.swatch" :aria-expanded="String(picking === row.id)" :aria-controls="`draw-mark-colors-${row.id}`" @click="picking = picking === row.id ? null : row.id" /><DrawSwatches v-if="picking === row.id" :id="`draw-mark-colors-${row.id}`" class="draw-mark-colors" data-control="picker" autofocus :label="row.labels.colors" :model-value="row.color" @update:model-value="recolor(row, $event)" @choose="closePicker(row.id)" /><input type="text" class="geo-import-name draw-mark-name" data-control="name" maxlength="120" autocomplete="off" spellcheck="false" v-field-value="row.name" :placeholder="row.placeholder" :aria-label="row.labels.name" @keydown="onNameKey(row, $event)" @focusout="commit(row, $event.currentTarget)"><UiButton class="geo-import-action" data-control="toggle" :label="row.labels.toggle" @click="display.act('toggleDrawMark', row.id)"><UiIcon :name="row.hidden ? 'visibility_off' : 'visibility'" :size="null" /></UiButton><UiButton v-for="action in row.actions" :key="action.id" class="geo-import-action draw-mark-action" :data-control="`action-${action.id}`" :data-action="action.id" :label="action.label" :aria-disabled="String(row.busy)" @click="display.act('runDrawMarkAction', row.id, action.id)"><UiIcon :name="action.icon" :size="null" /></UiButton><UiButton class="geo-import-action" data-control="fly" :label="row.labels.fly" @click="display.act('flyToDrawMark', row.id)"><UiIcon name="my_location" :size="null" /></UiButton><UiCloseButton class="geo-import-action" glyph="icon" data-control="remove" :title="row.labels.remove" :label="row.labels.remove" @click="display.act('removeDrawMark', row.id)" /><span v-if="row.actions.length" class="draw-mark-note" role="status" :aria-busy="String(row.busy)">{{ row.busy ? '…' : row.note }}</span></li></ul>
</template>
+5 -1
View File
@@ -6,11 +6,15 @@ import {
DRAW_COLOR_CSS,
DRAW_COLOR_NAMES,
} from '../../../annotations/drawMarks.js';
import UiButton from '../../kit/UiButton.vue';
// Draw's five colours as one radio group: the next shape's colour and a
// drawn shape's picker. Only the checked colour is a tab stop; the arrows,
// Home and End move to and choose another, as a radio group's do. Each swatch
// shows its colour from DRAW_COLOR_CSS, the same value the shape is drawn in.
// The swatches are ghost UiButtons with role="radio": they say they are
// chosen with aria-checked and their own `active` class, never aria-pressed,
// and `buttons` keeps their elements for the arrows.
// The template is one line: templates keep whitespace.
const props = defineProps({
modelValue: { type: String, default: 'primary' },
@@ -44,5 +48,5 @@ onMounted(() => {
</script>
<template>
<div class="draw-colors" role="radiogroup" :aria-label="props.label" @keydown="onKey"><button v-for="(color, index) in DRAW_COLORS" :key="color" :ref="(el) => (buttons[index] = el)" type="button" class="draw-color" :class="{ active: color === props.modelValue }" role="radio" :data-color="color" :data-control="`color-${color}`" :aria-checked="String(color === props.modelValue)" :tabindex="color === props.modelValue ? 0 : -1" :style="{ background: DRAW_COLOR_CSS[color] }" :title="t(DRAW_COLOR_NAMES[color])" :aria-label="t(DRAW_COLOR_NAMES[color])" @click="emit('update:modelValue', color), emit('choose', color)"></button></div>
<div class="draw-colors" role="radiogroup" :aria-label="props.label" @keydown="onKey"><UiButton v-for="(color, index) in DRAW_COLORS" :key="color" :ref="(swatch) => (buttons[index] = swatch?.$el)" class="draw-color" :class="{ active: color === props.modelValue }" role="radio" :data-color="color" :data-control="`color-${color}`" :aria-checked="String(color === props.modelValue)" :tabindex="color === props.modelValue ? 0 : -1" :style="{ background: DRAW_COLOR_CSS[color] }" :label="t(DRAW_COLOR_NAMES[color])" @click="emit('update:modelValue', color), emit('choose', color)" /></div>
</template>
+4 -4
View File
@@ -56,16 +56,16 @@ function leave() {
other.querySelector('button');
if (target) return target.focus();
}
importButton.value?.focus();
importButton.value?.$el.focus();
}
</script>
<template>
<div class="pp-toggle-group" id="geo-import-group">
<button ref="importButton" class="pp-toggle-btn" id="geo-import-button" type="button" @click="openPicker" :title="t('Show your own GeoJSON, KML, KMZ or GPX files on the globe (or drop them onto it). File bytes stay on this device; overlays can appear in map screenshots shared with voice.')">
<span class="pp-icon material-symbols-outlined" aria-hidden="true">upload_file</span>
<UiButton ref="importButton" class="pp-toggle-btn" id="geo-import-button" @click="openPicker" :title="t('Show your own GeoJSON, KML, KMZ or GPX files on the globe (or drop them onto it). File bytes stay on this device; overlays can appear in map screenshots shared with voice.')">
<UiIcon class="pp-icon" name="upload_file" :size="null" />
<span class="pp-label">{{ t('Import') }}</span>
</button>
</UiButton>
<input ref="picker" type="file" id="geo-import-input" accept=".geojson,.json,.kml,.kmz,.gpx" multiple hidden @change="pick" :aria-label="t('Choose GeoJSON, KML, KMZ or GPX files')">
<ul class="geo-import-list" :class="{ visible: listed }" id="geo-import-list" v-focus-safe-children="leave" :aria-label="t('Imported files')"><li v-for="row in rows" :key="row.id" class="geo-import-row" :data-import-id="row.id"><span :class="['geo-import-swatch', { 'own-styles': row.ownStyles }]" :style="row.ownStyles ? null : { background: row.color }"></span><span class="geo-import-name" :title="row.title">{{ row.name }}</span><UiButton v-for="item in row.actions" :key="item.action" class="geo-import-action" :data-action="item.action" :label="item.label" :pressed="item.pressed" @click="display.act(ROW_ACTIONS[item.action], row.id)"><UiIcon :name="item.icon" :size="null" /></UiButton></li></ul>
<span class="draw-hint geo-import-hint" id="geo-import-hint" aria-live="polite">{{ geoImport?.hint ?? '' }}</span>
+5 -5
View File
@@ -68,18 +68,18 @@ watch(
<div class="mission-replay-speed-scale" aria-hidden="true"><span>0.25×</span><span>1×</span><span>4×</span></div>
</div>
<div class="mission-action-row">
<button type="button" class="mission-focus-button" data-mission-focus @click="layer?.focusSelectedLaunchSite()">{{ t('FOCUS') }}</button>
<UiButton class="mission-focus-button" data-mission-focus @click="layer?.focusSelectedLaunchSite()">{{ t('FOCUS') }}</UiButton>
<UiButton class="mission-replay-button" data-mission-replay :pressed="m?.replay.active ?? false" :title="t('Replay the estimated ascent with a following camera')" :hidden="m && (m.replay.active || !m.replay.available)" :disabled="m && !m.replay.available" @click="layer?.startSelectedReplay()">{{ t('REPLAY ASCENT') }}</UiButton>
<div class="mission-replay-transport" :class="{ 'is-paused': m?.replay.paused }" data-mission-replay-transport :hidden="!m?.replay.active" :aria-label="m?.replay.transportLabel">
<button type="button" data-mission-replay-toggle :title="m ? m.replay.toggleLabel : t('Pause replay')" :aria-label="m ? m.replay.toggleLabel : t('Pause replay')" :disabled="m && !m.replay.active" @click="layer?.toggleReplayPause()">{{ m ? m.replay.toggleText : 'Ⅱ' }}</button>
<UiButton data-mission-replay-toggle :title="m ? m.replay.toggleLabel : t('Pause replay')" :aria-label="m ? m.replay.toggleLabel : t('Pause replay')" :disabled="m && !m.replay.active" @click="layer?.toggleReplayPause()">{{ m ? m.replay.toggleText : 'Ⅱ' }}</UiButton>
<UiCloseButton class="cancel" data-mission-replay-cancel bare :title="t('Cancel replay')" :label="t('Cancel replay')" @click="layer?.cancelReplay()" />
</div>
</div>
<div class="space-mission-nav">
<button type="button" class="mission-nav-button" data-mission-prev :title="t('Previous mission')" :disabled="m?.previousDisabled" @click="layer?.selectPreviousMission()"><span aria-hidden="true">‹</span> {{ t('PREV') }}</button>
<UiButton class="mission-nav-button" data-mission-prev :title="t('Previous mission')" :disabled="m?.previousDisabled" @click="layer?.selectPreviousMission()"><span aria-hidden="true">‹</span> {{ t('PREV') }}</UiButton>
<span class="mission-nav-index" data-mission-index>{{ m ? m.index : '—' }}</span>
<button type="button" class="mission-nav-button" data-mission-next :title="t('Next mission')" :disabled="m?.nextDisabled" @click="layer?.selectNextMission()">{{ t('NEXT') }} <span aria-hidden="true">›</span></button>
<UiButton class="mission-nav-button" data-mission-next :title="t('Next mission')" :disabled="m?.nextDisabled" @click="layer?.selectNextMission()">{{ t('NEXT') }} <span aria-hidden="true">›</span></UiButton>
</div>
<button type="button" class="panel-layer-toggle" data-mission-show-all @click="layer?.deselectMission()">{{ t('SHOW ALL / DESELECT') }}</button>
<UiButton class="panel-layer-toggle" data-mission-show-all @click="layer?.deselectMission()">{{ t('SHOW ALL / DESELECT') }}</UiButton>
</aside>
</template>
+2 -1
View File
@@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia';
import { onBeforeUpdate, onUpdated, ref } from 'vue';
import { t } from '../../../i18n/index.js';
import { useSpaceMissionsStore } from '../../stores/spaceMissions.js';
import UiButton from '../../kit/UiButton.vue';
import UiEmpty from '../../kit/UiEmpty.vue';
// The Space Missions roster. The launches layer presents it; until it does,
@@ -72,7 +73,7 @@ onUpdated(() => {
<div class="space-mission-roster-list ui-scroll" data-mission-roster-list>
<UiEmpty v-if="!roster" class="space-mission-roster-empty" :title="t('LOADING 30-DAY MISSION INDEX')" />
<UiEmpty v-else-if="!roster.entries.length" class="space-mission-roster-empty" :title="roster.empty" />
<button v-for="entry in roster?.entries" v-else :key="entry.id" type="button" class="space-mission-roster-item" :data-mission-roster-index="entry.index" :data-mission-roster-id="entry.id" :aria-label="entry.ariaLabel" @click="layer?.selectMissionAt(entry.index)" @mouseenter="enter(entry.index)" @mousemove="move(entry.index)" @mouseleave="layer?.rosterPointerLeave()" @focus="layer?.rosterFocus(entry.index)" @blur="blur"><span class="space-mission-roster-marker" :style="{ '--mission-roster-color': entry.color }" aria-hidden="true"></span><span class="space-mission-roster-copy"><strong>{{ entry.label }}</strong><small>{{ entry.provider }} · {{ entry.date }}</small></span><span class="space-mission-roster-chevron" aria-hidden="true">›</span></button>
<UiButton v-for="entry in roster?.entries" v-else :key="entry.id" class="space-mission-roster-item" :data-mission-roster-index="entry.index" :data-mission-roster-id="entry.id" :aria-label="entry.ariaLabel" @click="layer?.selectMissionAt(entry.index)" @mouseenter="enter(entry.index)" @mousemove="move(entry.index)" @mouseleave="layer?.rosterPointerLeave()" @focus="layer?.rosterFocus(entry.index)" @blur="blur"><span class="space-mission-roster-marker" :style="{ '--mission-roster-color': entry.color }" aria-hidden="true"></span><span class="space-mission-roster-copy"><strong>{{ entry.label }}</strong><small>{{ entry.provider }} · {{ entry.date }}</small></span><span class="space-mission-roster-chevron" aria-hidden="true">›</span></UiButton>
</div>
<p class="space-mission-roster-focus-continuation" tabindex="-1" data-mission-roster-focus-continuation>{{ t('TAB PREVIEWS · ENTER / SPACE SELECTS') }}</p>
</div>
+4 -4
View File
@@ -52,10 +52,10 @@ const radioWords = computed(() => ({
</div>
<RadioTuner />
<div class="radio-transport" role="group" :aria-label="t('Radio playback')">
<button id="radio-prev-btn" @click="act('cycleRadio', -1)" type="button" :aria-label="t('Previous filtered station')" :disabled="radio ? radio.transport.stepDisabled : true">{{ t('PREV') }}</button>
<button id="radio-play-btn" @click="act('toggleRadioPlayback')" type="button" v-class-toggle="{ active: radio?.transport.play.active }" :aria-label="radio ? radio.transport.play.label : t('Play selected station')" :disabled="radio ? radio.transport.play.disabled : true">{{ radio ? radio.transport.play.text : t('PLAY') }}</button>
<button id="radio-next-btn" @click="act('cycleRadio', 1)" type="button" :aria-label="t('Next filtered station')" :disabled="radio ? radio.transport.stepDisabled : true">{{ t('NEXT') }}</button>
<button id="radio-stop-btn" @click="act('stopRadio')" type="button" :aria-label="t('Stop radio playback')" :disabled="radio ? radio.transport.stopDisabled : true">{{ t('STOP') }}</button>
<UiButton id="radio-prev-btn" @click="act('cycleRadio', -1)" :aria-label="t('Previous filtered station')" :disabled="radio ? radio.transport.stepDisabled : true">{{ t('PREV') }}</UiButton>
<UiButton id="radio-play-btn" @click="act('toggleRadioPlayback')" v-class-toggle="{ active: radio?.transport.play.active }" :aria-label="radio ? radio.transport.play.label : t('Play selected station')" :disabled="radio ? radio.transport.play.disabled : true">{{ radio ? radio.transport.play.text : t('PLAY') }}</UiButton>
<UiButton id="radio-next-btn" @click="act('cycleRadio', 1)" :aria-label="t('Next filtered station')" :disabled="radio ? radio.transport.stepDisabled : true">{{ t('NEXT') }}</UiButton>
<UiButton id="radio-stop-btn" @click="act('stopRadio')" :aria-label="t('Stop radio playback')" :disabled="radio ? radio.transport.stopDisabled : true">{{ t('STOP') }}</UiButton>
</div>
<label class="radio-volume-row" for="radio-volume">
<span>{{ t('VOLUME') }}</span>
+5 -5
View File
@@ -32,8 +32,8 @@ const tune = () => act('tuneSdr', frequency.value.value);
<p>{{ t('Chrome/Edge · WebUSB · one local tuner shared by FM and the Local ADS-B layer.') }}</p>
<div class="sdr-radio-actions">
<UiButton id="sdr-connect-btn" @click="act('toggleSdrConnection')" class="panel-layer-toggle" :pressed="sdr?.connectPressed ?? false" pressed-class="active" :disabled="sdr?.connectDisabled">{{ sdr ? sdr.connectLabel : t('CONNECT') }}</UiButton>
<button id="sdr-locate-btn" type="button" @click="act('locateSdr')" v-class-toggle="{ active: sdr?.locateActive }" :title="t('Use your location for faster ADS-B position decoding')" :disabled="sdr?.locateDisabled">{{ sdr ? sdr.locateLabel : t('LOCATE') }}</button>
<button id="sdr-change-device-btn" type="button" @click="act('changeSdrDevice')" :title="t('Choose a different RTL-SDR or receiver channel')" :disabled="sdr?.changeDeviceDisabled">{{ t('CHANGE DEVICE') }}</button>
<UiButton id="sdr-locate-btn" @click="act('locateSdr')" v-class-toggle="{ active: sdr?.locateActive }" :title="t('Use your location for faster ADS-B position decoding')" :disabled="sdr?.locateDisabled">{{ sdr ? sdr.locateLabel : t('LOCATE') }}</UiButton>
<UiButton id="sdr-change-device-btn" @click="act('changeSdrDevice')" :title="t('Choose a different RTL-SDR or receiver channel')" :disabled="sdr?.changeDeviceDisabled">{{ t('CHANGE DEVICE') }}</UiButton>
</div>
<div class="sdr-mode-row" role="group" :aria-label="t('RTL-SDR receiver mode')">
<UiButton id="sdr-mode-fm-btn" @click="act('setSdrMode', 'fm')" :pressed="sdr ? sdr.fmActive : true" pressed-class="active" :disabled="sdr?.modeDisabled" translate="no">FM</UiButton>
@@ -55,11 +55,11 @@ const tune = () => act('tuneSdr', frequency.value.value);
<div class="sdr-frequency-row">
<label for="sdr-frequency-input">{{ t('FM MHZ') }}</label>
<input ref="frequency" class="gev-field" id="sdr-frequency-input" @keydown.enter.prevent="tune" type="number" min="87.5" max="108" step="0.1" value="98.5" inputmode="decimal" :disabled="sdr?.frequencyDisabled" v-field-value="sdr ? sdr.frequency : '98.5'" />
<button id="sdr-tune-btn" type="button" @click="tune" :disabled="sdr?.tuneDisabled">{{ t('TUNE') }}</button>
<UiButton id="sdr-tune-btn" @click="tune" :disabled="sdr?.tuneDisabled">{{ t('TUNE') }}</UiButton>
</div>
<div class="sdr-seek-row" role="group" :aria-label="t('Seek broadcast FM stations')">
<button id="sdr-seek-back-btn" type="button" @click="act('seekSdr', -1)" :disabled="sdr ? sdr.seekDisabled : true">{{ t('◀ SEEK') }}</button>
<button id="sdr-seek-forward-btn" type="button" @click="act('seekSdr', 1)" :disabled="sdr ? sdr.seekDisabled : true">{{ t('SEEK ▶') }}</button>
<UiButton id="sdr-seek-back-btn" @click="act('seekSdr', -1)" :disabled="sdr ? sdr.seekDisabled : true">{{ t('◀ SEEK') }}</UiButton>
<UiButton id="sdr-seek-forward-btn" @click="act('seekSdr', 1)" :disabled="sdr ? sdr.seekDisabled : true">{{ t('SEEK ▶') }}</UiButton>
</div>
<label class="radio-volume-row" for="sdr-volume">
<span>{{ t('SDR VOL') }}</span>
+7 -6
View File
@@ -11,6 +11,7 @@ import PanelLayoutButtons from './PanelLayoutButtons.vue';
import UiButton from '../../kit/UiButton.vue';
import UiCheckbox from '../../kit/UiCheckbox.vue';
import UiCloseButton from '../../kit/UiCloseButton.vue';
import UiIcon from '../../kit/UiIcon.vue';
import UiSelect from '../../kit/UiSelect.js';
// The voice control in the command dock, as its presenter
@@ -79,7 +80,7 @@ const frameStyle = (panel) => ({
<span class="gev-mic-orbit"><img src="/mic.svg" alt="" /></span>
<span class="gev-mic-label">{{ view.mic.text }}</span>
</UiButton>
<button v-if="view.panel" id="gev-chat-button" type="button" :aria-label="t('Open AI chat')" aria-controls="gev-chat-panel" :aria-expanded="String(view.chat.open && !view.chat.minimized)" @click="emit('chat-button')"><svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M5 4h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-6 4V6a2 2 0 0 1 2-2Z"></path></svg><span class="gev-chat-label">{{ t('CHAT') }}</span></button>
<UiButton v-if="view.panel" id="gev-chat-button" :aria-label="t('Open AI chat')" aria-controls="gev-chat-panel" :aria-expanded="String(view.chat.open && !view.chat.minimized)" @click="emit('chat-button')"><svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M5 4h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-6 4V6a2 2 0 0 1 2-2Z"></path></svg><span class="gev-chat-label">{{ t('CHAT') }}</span></UiButton>
<ChatPanel v-if="view.panel" :view="view" />
<VoiceVisualizer />
<div class="gev-chat-thinking" aria-hidden="true"><span></span><span></span><span></span></div>
@@ -94,12 +95,12 @@ const frameStyle = (panel) => ({
</div>
<section v-if="view.panel" id="gev-voice-panel" class="gev-voice-panel" :hidden="view.voicePanel.hidden" :data-view="optional(view.voicePanel.view)" :data-minimized="view.voicePanel.minimized ? 'true' : undefined" :data-context="optional(view.voicePanel.context)" :style="frameStyle(view.voicePanel)" :aria-label="t('Voice Settings')" @keydown="emit('panel-keydown', $event)">
<div class="gev-voice-panel-header">
<button id="gev-chat-back" type="button" :hidden="!view.chat.backVisible" @click="emit('chat-back')"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path d="M15 5l-7 7 7 7"></path></svg><span>{{ t('Back to chat') }}</span></button>
<button id="gev-voice-back" type="button" @click="emit('voice-back')"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path d="M15 5l-7 7 7 7"></path></svg><span>{{ t('Back to voice') }}</span></button>
<UiButton id="gev-chat-back" :hidden="!view.chat.backVisible" @click="emit('chat-back')"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path d="M15 5l-7 7 7 7"></path></svg><span>{{ t('Back to chat') }}</span></UiButton>
<UiButton id="gev-voice-back" @click="emit('voice-back')"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path d="M15 5l-7 7 7 7"></path></svg><span>{{ t('Back to voice') }}</span></UiButton>
<span class="gev-voice-panel-title">{{ t('VOICE') }}</span>
<div class="gev-voice-panel-tabs" role="tablist" :aria-label="t('Voice Settings')">
<button id="gev-voice-preview-tab" class="gev-voice-panel-tab" type="button" role="tab" :aria-label="t('Preview')" :title="t('Preview')" :aria-selected="String(view.voicePanel.selected === 'preview')" :tabindex="view.voicePanel.selected === 'preview' ? 0 : -1" aria-controls="gev-voice-preview-panel" @click="emit('tab', 0)" @keydown="emit('tab-keydown', 0, $event)"><span class="material-symbols-outlined gev-voice-panel-tab-icon" aria-hidden="true">visibility</span></button>
<button id="gev-voice-settings-tab" class="gev-voice-panel-tab" type="button" role="tab" :aria-label="t('Settings')" :title="t('Settings')" :aria-selected="String(view.voicePanel.selected === 'settings')" :tabindex="view.voicePanel.selected === 'settings' ? 0 : -1" aria-controls="gev-voice-settings-panel" @click="emit('tab', 1)" @keydown="emit('tab-keydown', 1, $event)"><span class="material-symbols-outlined gev-voice-panel-tab-icon" aria-hidden="true">settings</span></button>
<UiButton id="gev-voice-preview-tab" class="gev-voice-panel-tab" role="tab" :aria-label="t('Preview')" :title="t('Preview')" :aria-selected="String(view.voicePanel.selected === 'preview')" :tabindex="view.voicePanel.selected === 'preview' ? 0 : -1" aria-controls="gev-voice-preview-panel" @click="emit('tab', 0)" @keydown="emit('tab-keydown', 0, $event)"><UiIcon name="visibility" class="gev-voice-panel-tab-icon" :size="null" /></UiButton>
<UiButton id="gev-voice-settings-tab" class="gev-voice-panel-tab" role="tab" :aria-label="t('Settings')" :title="t('Settings')" :aria-selected="String(view.voicePanel.selected === 'settings')" :tabindex="view.voicePanel.selected === 'settings' ? 0 : -1" aria-controls="gev-voice-settings-panel" @click="emit('tab', 1)" @keydown="emit('tab-keydown', 1, $event)"><UiIcon name="settings" class="gev-voice-panel-tab-icon" :size="null" /></UiButton>
</div>
<PanelLayoutButtons :docked="view.layout.docked" :minimized="view.voicePanel.minimized" @dock="emit('layout-dock')" @minimize="emit('voice-minimize')" />
<UiCloseButton id="gev-voice-settings-close" :label="t('Close voice panel')" @click="emit('settings-close')" />
@@ -158,7 +159,7 @@ const frameStyle = (panel) => ({
<div class="gev-voice-error-tray" role="alert" aria-live="assertive">
<div class="gev-voice-error-header">
<span>{{ view.error.typed ? `${t('Chat')} · ${t('ERROR', { context: 'voice' })}` : t('VOICE SYSTEM ERROR') }}</span>
<button class="gev-voice-error-dismiss" type="button" @click="controls?.dismissError()">{{ t('DISMISS') }}</button>
<UiButton class="gev-voice-error-dismiss" @click="controls?.dismissError()">{{ t('DISMISS') }}</UiButton>
</div>
<div id="gev-voice-error-detail">{{ view.error.text }}</div>
<div class="gev-voice-error-hint" :hidden="view.error.typed || view.error.hint === false">{{ t('Check microphone permission and network access, then try again.') }}</div>