Add the Omnibar: one field above the footer for places, layers and commands

On desktop the dock becomes one search bar (Omnibar.vue) that shows the
rows the line-reading pipeline makes: places with nearby suggestions,
coordinates, map items, layers, commands, plans such as "go to Austin and
show flights", guided walks through the real controls, and Ask GEV for
questions. Enter runs only what the line asks for outright. The map
credits move below the bar onto the Power Up row, the voice waveform
shows in the bar while voice is on, and the dock's Location and Visual
trays are hidden in this layout. The phone layout is unchanged. Long
place names are kept out of automatic Ask GEV.

Co-authored-by: Sameh Khamis <[email protected]>
This commit is contained in:
Manjunath PaparajuandSameh Khamis authored and Sameh Khamis committed 2026-11-18 15:00:06 -08:00
1 parent 6e0baacd57
commit a3f4af91f8
36 files changed
+4741 -75

No files matched your search

+226 -33
View File
@@ -6,6 +6,12 @@ import test from 'node:test';
import { fileURLToPath } from 'node:url';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
// The Omnibar's desktop footer (src/ui/styles/omnibar-dock.css) is part of
// the cascade below like every other stylesheet; its rules carry the
// Omnibar scope, so they are modelled as a layout of their own.
const omnibarCss = readStylesheet(
path.join(ROOT, 'src/ui/styles/omnibar-dock.css'),
);
const css = readStylesheet(path.join(ROOT, 'style.css'));
/*
@@ -125,11 +131,56 @@ function specificity(selector) {
return [ids, classes, types];
}
/** Flatten style.css into rules carrying their raw media stack. */
/** Collapse whitespace and the padding inside brackets of a selector. */
const tidySelector = (part) =>
part
.replace(/\s+/g, ' ')
.trim()
.replace(/\(\s+/g, '(')
.replace(/\s+\)/g, ')');
/**
* A nested selector resolved against its parent rule's selectors, as CSS
* nesting does: `&` stands for the parent, and a selector without one is a
* descendant of it.
*/
function nestSelectors(parents, head) {
const own = splitTopLevel(head, ',').map(tidySelector).filter(Boolean);
if (!parents) return own;
return parents.flatMap((parent) =>
own.map((part) =>
part.includes('&') ? part.replaceAll('&', parent) : `${parent} ${part}`,
),
);
}
/**
* Flatten style.css into rules carrying their raw media stack. Nested style
* rules (CSS nesting) and media queries nested in a rule are resolved to
* full selectors, so a nested rule is modelled like any other.
*/
function flattenRules(source) {
const src = source.replace(/\/\*[\s\S]*?\*\//g, '');
const rules = [];
const mediaStack = [];
// Open blocks, innermost last: media queries and style rules.
const stack = [];
const mediaStack = () =>
stack.filter((frame) => frame.media).map((frame) => frame.media);
const parentRule = () =>
[...stack].reverse().find((frame) => frame.rule)?.rule || null;
const declare = (text) => {
const rule = parentRule();
const trimmed = text.trim();
if (!rule || !trimmed) return;
const colon = trimmed.indexOf(':');
if (colon < 0) return;
const value = trimmed.slice(colon + 1).trim();
rule.decls.push({
prop: trimmed.slice(0, colon).trim().toLowerCase(),
value: value.replace(/\s*!important$/i, '').trim(),
important: /!important\s*$/i.test(value),
});
};
let index = 0;
let prelude = '';
while (index < src.length) {
@@ -137,14 +188,13 @@ function flattenRules(source) {
if (char === '{') {
const head = prelude.replace(/\s+/g, ' ').trim();
prelude = '';
index += 1;
if (head.startsWith('@media')) {
mediaStack.push(head.slice('@media'.length).trim());
index += 1;
stack.push({ media: head.slice('@media'.length).trim() });
continue;
}
if (head.startsWith('@')) {
let level = 1;
index += 1;
while (index < src.length && level > 0) {
if (src[index] === '{') level += 1;
else if (src[index] === '}') level -= 1;
@@ -152,43 +202,34 @@ function flattenRules(source) {
}
continue;
}
const close = src.indexOf('}', index);
assert.ok(close > index, `unterminated rule block for "${head}"`);
const decls = [];
for (const raw of src.slice(index + 1, close).split(';')) {
const text = raw.trim();
if (!text) continue;
const colon = text.indexOf(':');
if (colon < 0) continue;
const value = text.slice(colon + 1).trim();
decls.push({
prop: text.slice(0, colon).trim().toLowerCase(),
value: value.replace(/\s*!important$/i, '').trim(),
important: /!important\s*$/i.test(value),
});
}
rules.push({
const rule = {
order: rules.length,
media: [...mediaStack],
parts: splitTopLevel(head, ',')
.map((part) =>
part.trim().replace(/\(\s+/g, '(').replace(/\s+\)/g, ')'),
)
.filter(Boolean),
decls,
});
index = close + 1;
media: mediaStack(),
parts: nestSelectors(parentRule()?.parts, head),
decls: [],
};
rules.push(rule);
stack.push({ rule });
continue;
}
if (char === ';') {
declare(prelude);
prelude = '';
index += 1;
continue;
}
if (char === '}') {
mediaStack.pop();
// The last declaration of a block may omit its semicolon.
declare(prelude);
prelude = '';
stack.pop();
index += 1;
continue;
}
prelude += char;
index += 1;
}
assert.equal(stack.length, 0, 'unbalanced braces in style.css');
return rules;
}
@@ -227,6 +268,29 @@ const RECOGNIZED = new Set([
]);
const DOCKED_RAIL = 'body.context-docked #right-context-rail';
// The desktop Omnibar layout: the scope its stylesheet nests every rule in.
// It applies on the desktop shell (above the 720px phone breakpoint) while
// the Omnibar and the voice control share the dock; outside it the legacy
// layout below governs.
const OMNIBAR_SCOPE =
'body:not(.mobile-shell):not(.cockpit-mode):not(.scene-playback-mode):not(.ui-clean-view):not(.recording-mode):where(:has(#gev-omnibar):has(#command-dock > #gev-voice-control))';
const OMNIBAR = Object.freeze({
dock: `${OMNIBAR_SCOPE} #command-dock`,
credit: `${OMNIBAR_SCOPE} :is(#cesium-credits, #gev-credits)`,
minimalCredit: `${OMNIBAR_SCOPE}:has(#intel-hud[data-variant='minimal'].active) :is(#cesium-credits, #gev-credits)`,
minimalRail: `${OMNIBAR_SCOPE}:not(.context-docked):has(#intel-hud[data-variant='minimal'].active) #right-context-rail`,
trays: `${OMNIBAR_SCOPE} #command-dock > :is(#location-bar, #control-panel)`,
});
// What each Omnibar-scope rule may set on a modelled box; the Omnibar
// clearance test resolves every one of them through the full cascade.
const OMNIBAR_RECOGNIZED = new Map([
[OMNIBAR.dock, new Set(['top', 'bottom', 'height', 'min-height'])],
[OMNIBAR.credit, new Set(['bottom'])],
[OMNIBAR.minimalCredit, new Set(['bottom'])],
[OMNIBAR.minimalRail, new Set(['max-height'])],
]);
const OMNIBAR_MIN_WIDTH = 721;
const ELEMENT_KEYS = [
'#cesium-credits',
'#command-dock',
@@ -300,8 +364,11 @@ function ownBoxEntries() {
// So is Stories, with GEV's chrome stepped aside; storiesCredit.test.mjs
// pins its attribution placement.
if (
/^body\.stories-mode:not\(#gs-a\):not\(#gs-b\) #(cesium|gev)-credits$/.test(part)
) continue;
/^body\.stories-mode:not\(#gs-a\):not\(#gs-b\) #(cesium|gev)-credits$/.test(
part,
)
)
continue;
entries.push({ rule, part });
}
}
@@ -521,6 +588,22 @@ test('the model refuses every cascade construct it cannot resolve', () => {
// Expanded Context covers the right edge top to bottom; the credit row
// stops short of it instead (the docked-Context test below).
if (part === DOCKED_RAIL) continue;
if (part.startsWith(OMNIBAR_SCOPE)) {
const allowed = OMNIBAR_RECOGNIZED.get(part);
for (const decl of guarded) {
if (!allowed?.has(decl.prop))
complaints.push(
`unrecognized Omnibar rule positions a modelled element: "${part}" (${decl.prop})`,
);
if (decl.important)
complaints.push(`!important on ${decl.prop} of "${part}"`);
}
if (rule.media.length)
complaints.push(
`media query on Omnibar rule "${part}": ${rule.media.join(' && ')}`,
);
continue;
}
if (!RECOGNIZED.has(part)) {
complaints.push(
`unrecognized selector positions a modelled element: "${part}" (${guarded.map((d) => d.prop).join(', ')})`,
@@ -771,6 +854,116 @@ test('right rail measurement cannot persist into a painted attribution layout',
// ── Clearance ───────────────────────────────────────────────────────────────
/** A custom property's value as the Omnibar scope declares it. */
function omnibarVar(name) {
const decls = RULES.filter((rule) => rule.parts.includes(OMNIBAR_SCOPE))
.flatMap((rule) => rule.decls)
.filter((decl) => decl.prop === name);
assert.equal(decls.length, 1, `${name} is declared once in the Omnibar scope`);
return decls[0].value;
}
/** A length in the Omnibar layout, with its scope's own custom properties. */
function omnibarPx(value, viewportHeight, where) {
const substituted = value.replace(
/var\((--omnibar-[\w-]+)\)/g,
(_, name) => omnibarVar(name),
);
return toPx(substituted, viewportHeight, where);
}
test('Omnibar reserves a non-overlapping desktop footer at native credit sizing', () => {
// The Omnibar layout resolves through the same cascade as the legacy one:
// every legacy rule that could still match competes with the scope's.
const trayOpen = [
'#command-dock:has(#location-bar:not(.collapsed))',
'#command-dock:has(#control-panel:not(.collapsed))',
];
assert.equal(
omnibarVar('--world-timeline-lift'),
'0px',
'the Omnibar layout holds the timeline lift at 0',
);
for (const width of WIDTHS.filter((w) => w >= OMNIBAR_MIN_WIDTH)) {
for (const height of HEIGHTS) {
for (const minimal of [false, true]) {
const dock = resolve(
['#command-dock', ...trayOpen, OMNIBAR.dock],
'bottom',
width,
'Omnibar dock',
);
assert.equal(dock.part, OMNIBAR.dock, `the Omnibar owns the dock at ${width}px`);
// Its top and height too: a legacy top or height winning here would
// move or stretch the dock the clearance below is measured from.
for (const [prop, value] of [
['top', 'auto'],
['height', '56px'],
]) {
const own = resolve(
['#command-dock', ...trayOpen, OMNIBAR.dock],
prop,
width,
`Omnibar dock ${prop}`,
);
assert.equal(own.part, OMNIBAR.dock, `the Omnibar owns the dock ${prop} at ${width}px`);
assert.equal(own.decl.value, value, `Omnibar dock ${prop} at ${width}px`);
}
const credit = resolve(
[
...CREDIT_SELECTORS,
OMNIBAR.credit,
...(minimal ? [MINIMAL_HUD_CREDIT, OMNIBAR.minimalCredit] : []),
],
'bottom',
width,
'Omnibar credit',
);
assert.ok(
credit.part.startsWith(OMNIBAR_SCOPE),
`the Omnibar owns the credit row at ${width}px`,
);
const dockBottom = omnibarPx(dock.decl.value, height, 'Omnibar dock bottom');
const creditTop =
omnibarPx(credit.decl.value, height, 'Omnibar credit bottom') +
CREDIT_HEIGHT_PX;
assert.ok(
dockBottom - creditTop >= MIN_CLEARANCE_PX,
`at ${width}x${height}${minimal ? ' (minimal HUD)' : ''} the Omnibar dock (${dockBottom}px) must clear the credit line (${creditTop}px)`,
);
}
}
}
// No legacy tray opens over the credit: both are hidden in this layout,
// and no rule elsewhere forces them back.
const trays = RULES.find((rule) => rule.parts.includes(OMNIBAR.trays));
assert.ok(trays, 'the Omnibar layout hides the legacy trays');
assert.equal(trays.decls.find((decl) => decl.prop === 'display')?.value, 'none');
for (const rule of RULES) {
for (const part of rule.parts) {
if (!/#(location-bar|control-panel)$/.test(lastCompound(part))) continue;
assert.ok(
!rule.decls.some((decl) => decl.prop === 'display' && decl.important),
`"${part}" forces a hidden tray back with !important`,
);
}
}
// The minimal-HUD rail cap only shortens the rail, which is anchored at
// its top, so it can only add room above the credit.
const rail = RULES.find((rule) => rule.parts.includes(OMNIBAR.minimalRail));
const cap = rail.decls.find((decl) => decl.prop === '--omnibar-minimal-rail-height');
assert.match(cap?.value || '', /^min\(\s*var\(--right-stack-max-height, 70vh\),/);
assert.equal(
rail.decls.find((decl) => decl.prop === 'max-height')?.value,
'var(--omnibar-minimal-rail-height)',
);
assert.doesNotMatch(
omnibarCss,
/\.cesium-widget-credits|\.cesium-credit-logoContainer|\.cesium-credit-textContainer/,
'the footer uses the original credit text and logo sizing',
);
});
test('every open dock tray clears the required credit at every modelled viewport', () => {
// Below 900px the tray widens to nearly the viewport and lands on the
// bottom-left corner where the credit lives. The clearance is NOT one fixed
+30 -1
View File
@@ -4675,5 +4675,34 @@
"other": "عرض {what} في {place} ({count} عنصر)"
},
"Go there": "انتقل إلى هناك",
"Open draw options": "فتح خيارات الرسم"
"Open draw options": "فتح خيارات الرسم",
"{what} in {place}: {count} items": {
"zero": "{what} في {place}: ‏{count} عنصر",
"one": "{what} في {place}: ‏{count} عنصر",
"two": "{what} في {place}: ‏{count} عنصران",
"few": "{what} في {place}: ‏{count} عناصر",
"many": "{what} في {place}: ‏{count} عنصرًا",
"other": "{what} في {place}: ‏{count} عنصر"
},
"{count} items in view": {
"zero": "{count} عنصر في العرض",
"one": "{count} عنصر في العرض",
"two": "{count} عنصران في العرض",
"few": "{count} عناصر في العرض",
"many": "{count} عنصرًا في العرض",
"other": "{count} عنصر في العرض"
},
"Selected · near {name}": "محدّد · قرب {name}",
"Near {name}": "بالقرب من {name}",
"Stop drawing": "إيقاف الرسم",
"{place} · landmarks": "{place} · معالم",
"In {place}": "داخل {place}",
"Near {place}": "بالقرب من {place}",
"Unable to complete this action: {reason}": "تعذر إكمال هذا الإجراء: ‏{reason}",
"Unable to complete this action. Please try again.": "تعذر إكمال هذا الإجراء. يرجى المحاولة مرة أخرى.",
"{layer} M{mag}+": "{layer} بقوة M{mag} فأكثر",
"Search places, layers and things on the map, or ask GEV": "ابحث عن أماكن وطبقات وعناصر على الخريطة، أو اسأل GEV",
"Search places, layers, flights… or ask GEV · > for commands": "ابحث عن أماكن وطبقات ورحلات جوية… أو اسأل GEV · > للأوامر",
"No matching command": "لا يوجد أمر مطابق",
"Looks private, so nothing is searched or sent": "يبدو خاصًا، لذا لا يُبحث عنه ولا يُرسل"
}
+22 -1
View File
@@ -4259,5 +4259,26 @@
"other": "{what} in der Region {place} anzeigen ({count} Elemente)"
},
"Go there": "Dorthin wechseln",
"Open draw options": "Zeichenoptionen öffnen"
"Open draw options": "Zeichenoptionen öffnen",
"{what} in {place}: {count} items": {
"one": "{what} in der Region {place}: {count} Element",
"other": "{what} in der Region {place}: {count} Elemente"
},
"{count} items in view": {
"one": "{count} Element im Blick",
"other": "{count} Elemente im Blick"
},
"Selected · near {name}": "Auswahl · nahe {name}",
"Near {name}": "Nahe {name}",
"Stop drawing": "Zeichnen beenden",
"{place} · landmarks": "{place} · Sehenswürdigkeiten",
"In {place}": "In der Region {place}",
"Near {place}": "Nahe {place}",
"Unable to complete this action: {reason}": "Diese Aktion konnte nicht abgeschlossen werden: {reason}",
"Unable to complete this action. Please try again.": "Diese Aktion konnte nicht abgeschlossen werden. Bitte versuche es erneut.",
"{layer} M{mag}+": "{layer} ab Magnitude {mag}",
"Search places, layers and things on the map, or ask GEV": "Suche Orte, Ebenen und Kartenelemente oder frage GEV",
"Search places, layers, flights… or ask GEV · > for commands": "Orte, Ebenen, Flüge suchen… oder GEV fragen · > für Befehle",
"No matching command": "Kein passender Befehl",
"Looks private, so nothing is searched or sent": "Sieht privat aus, daher wird nichts gesucht oder gesendet"
}
+24 -1
View File
@@ -4363,5 +4363,28 @@
"other": "Mostrar {what} en {place} ({count} elementos)"
},
"Go there": "Ir allí",
"Open draw options": "Abrir opciones de dibujo"
"Open draw options": "Abrir opciones de dibujo",
"{what} in {place}: {count} items": {
"one": "{what} en {place}: {count} elemento",
"many": "{what} en {place}: {count} de elementos",
"other": "{what} en {place}: {count} elementos"
},
"{count} items in view": {
"one": "{count} elemento a la vista",
"many": "{count} de elementos a la vista",
"other": "{count} elementos a la vista"
},
"Selected · near {name}": "Selección · cerca de {name}",
"Near {name}": "Cerca de {name}",
"Stop drawing": "Dejar de dibujar",
"{place} · landmarks": "{place} · lugares de interés",
"In {place}": "En {place}",
"Near {place}": "Cerca de {place}",
"Unable to complete this action: {reason}": "No se pudo completar esta acción: {reason}",
"Unable to complete this action. Please try again.": "No se pudo completar esta acción. Inténtalo de nuevo.",
"{layer} M{mag}+": "{layer} de M{mag} o más",
"Search places, layers and things on the map, or ask GEV": "Busca lugares, capas y elementos del mapa, o pregunta a GEV",
"Search places, layers, flights… or ask GEV · > for commands": "Busca lugares, capas, vuelos… o pregunta a GEV · > para comandos",
"No matching command": "Ningún comando coincide",
"Looks private, so nothing is searched or sent": "Parece privado, así que no se busca ni se envía nada"
}
+24 -1
View File
@@ -4363,5 +4363,28 @@
"other": "Afficher {what} dans la zone de {place} ({count} éléments)"
},
"Go there": "Y aller",
"Open draw options": "Ouvrir les options de dessin"
"Open draw options": "Ouvrir les options de dessin",
"{what} in {place}: {count} items": {
"one": "{what} dans la zone de {place} : {count} élément",
"many": "{what} dans la zone de {place} : {count} d’éléments",
"other": "{what} dans la zone de {place} : {count} éléments"
},
"{count} items in view": {
"one": "{count} élément visible",
"many": "{count} d’éléments visibles",
"other": "{count} éléments visibles"
},
"Selected · near {name}": "Sélection · près de {name}",
"Near {name}": "Près de {name}",
"Stop drawing": "Arrêter le dessin",
"{place} · landmarks": "{place} · points d’intérêt",
"In {place}": "Dans la zone de {place}",
"Near {place}": "Près de {place}",
"Unable to complete this action: {reason}": "Impossible de terminer cette action : {reason}",
"Unable to complete this action. Please try again.": "Impossible de terminer cette action. Veuillez réessayer.",
"{layer} M{mag}+": "{layer} de magnitude {mag} ou plus",
"Search places, layers and things on the map, or ask GEV": "Recherchez des lieux, des couches et des éléments sur la carte, ou interrogez GEV",
"Search places, layers, flights… or ask GEV · > for commands": "Recherchez des lieux, des couches, des vols… ou interrogez GEV · > pour les commandes",
"No matching command": "Aucune commande correspondante",
"Looks private, so nothing is searched or sent": "Semble privé, donc rien n’est recherché ni envoyé"
}
+24 -1
View File
@@ -4363,5 +4363,28 @@
"other": "הצגת {what} ב{place} ({count} פריטים)"
},
"Go there": "מעבר למקום",
"Open draw options": "פתיחת אפשרויות הציור"
"Open draw options": "פתיחת אפשרויות הציור",
"{what} in {place}: {count} items": {
"one": "{what} ב{place}: ‏{count} פריט",
"two": "{what} ב{place}: ‏{count} פריטים",
"other": "{what} ב{place}: ‏{count} פריטים"
},
"{count} items in view": {
"one": "{count} פריט בתצוגה",
"two": "{count} פריטים בתצוגה",
"other": "{count} פריטים בתצוגה"
},
"Selected · near {name}": "נבחר · ליד {name}",
"Near {name}": "ליד {name}",
"Stop drawing": "הפסקת הציור",
"{place} · landmarks": "{place} · אתרים בולטים",
"In {place}": "בתוך {place}",
"Near {place}": "בסביבת {place}",
"Unable to complete this action: {reason}": "לא ניתן להשלים את הפעולה: ‏{reason}",
"Unable to complete this action. Please try again.": "לא ניתן להשלים את הפעולה. נסו שוב.",
"{layer} M{mag}+": "{layer} בעוצמה M{mag} ומעלה",
"Search places, layers and things on the map, or ask GEV": "חפשו מקומות, שכבות ופריטים במפה, או שאלו את GEV",
"Search places, layers, flights… or ask GEV · > for commands": "חיפוש מקומות, שכבות וטיסות… או שאלה ל‑GEV · > לפקודות",
"No matching command": "אין פקודה תואמת",
"Looks private, so nothing is searched or sent": "נראה פרטי, ולכן שום דבר לא מחופש או נשלח"
}
+24 -1
View File
@@ -4363,5 +4363,28 @@
"other": "Mostra {what} a {place} ({count} elementi)"
},
"Go there": "Vai lì",
"Open draw options": "Apri le opzioni di disegno"
"Open draw options": "Apri le opzioni di disegno",
"{what} in {place}: {count} items": {
"one": "{what} a {place}: {count} elemento",
"many": "{what} a {place}: {count} di elementi",
"other": "{what} a {place}: {count} elementi"
},
"{count} items in view": {
"one": "{count} elemento in vista",
"many": "{count} di elementi in vista",
"other": "{count} elementi in vista"
},
"Selected · near {name}": "Selezione · vicino a {name}",
"Near {name}": "Vicino a {name}",
"Stop drawing": "Interrompi il disegno",
"{place} · landmarks": "{place} · punti di interesse",
"In {place}": "A {place}",
"Near {place}": "Vicino a {place}",
"Unable to complete this action: {reason}": "Impossibile completare questa azione: {reason}",
"Unable to complete this action. Please try again.": "Impossibile completare questa azione. Riprova.",
"{layer} M{mag}+": "{layer} di magnitudo {mag} o superiore",
"Search places, layers and things on the map, or ask GEV": "Cerca luoghi, livelli ed elementi sulla mappa oppure chiedi a GEV",
"Search places, layers, flights… or ask GEV · > for commands": "Cerca luoghi, livelli, voli… oppure chiedi a GEV · > per i comandi",
"No matching command": "Nessun comando corrispondente",
"Looks private, so nothing is searched or sent": "Sembra privato, quindi non viene cercato né inviato nulla"
}
+20 -1
View File
@@ -4155,5 +4155,24 @@
"other": "{place}の{what}を表示({count}件)"
},
"Go there": "その場所に移動",
"Open draw options": "描画オプションを開く"
"Open draw options": "描画オプションを開く",
"{what} in {place}: {count} items": {
"other": "{place}の{what}:{count}件"
},
"{count} items in view": {
"other": "{count}件表示中"
},
"Selected · near {name}": "選択中 · {name}の周辺",
"Near {name}": "{name}の周辺",
"Stop drawing": "描画を終了",
"{place} · landmarks": "{place} · 名所",
"In {place}": "{place}の範囲内",
"Near {place}": "{place}の周辺",
"Unable to complete this action: {reason}": "この操作を完了できませんでした:{reason}",
"Unable to complete this action. Please try again.": "この操作を完了できませんでした。もう一度お試しください。",
"{layer} M{mag}+": "{layer}(M{mag}以上)",
"Search places, layers and things on the map, or ask GEV": "場所、レイヤー、マップ上の対象を検索するか、GEVに質問",
"Search places, layers, flights… or ask GEV · > for commands": "場所、レイヤー、航空便を検索… またはGEVに質問 · > でコマンド",
"No matching command": "一致するコマンドがありません",
"Looks private, so nothing is searched or sent": "個人情報の可能性があるため、検索も送信もしません"
}
+24 -1
View File
@@ -4363,5 +4363,28 @@
"other": "Mostrar {what} em {place} ({count} itens)"
},
"Go there": "Ir até lá",
"Open draw options": "Abrir opções de desenho"
"Open draw options": "Abrir opções de desenho",
"{what} in {place}: {count} items": {
"one": "{what} em {place}: {count} item",
"many": "{what} em {place}: {count} de itens",
"other": "{what} em {place}: {count} itens"
},
"{count} items in view": {
"one": "{count} item à vista",
"many": "{count} de itens à vista",
"other": "{count} itens à vista"
},
"Selected · near {name}": "Seleção · perto de {name}",
"Near {name}": "Perto de {name}",
"Stop drawing": "Parar de desenhar",
"{place} · landmarks": "{place} · pontos de interesse",
"In {place}": "Em {place}",
"Near {place}": "Perto de {place}",
"Unable to complete this action: {reason}": "Não foi possível concluir esta ação: {reason}",
"Unable to complete this action. Please try again.": "Não foi possível concluir esta ação. Tente novamente.",
"{layer} M{mag}+": "{layer} de magnitude {mag} ou mais",
"Search places, layers and things on the map, or ask GEV": "Busque lugares, camadas e elementos no mapa ou pergunte ao GEV",
"Search places, layers, flights… or ask GEV · > for commands": "Busque lugares, camadas, voos… ou pergunte ao GEV · > para comandos",
"No matching command": "Nenhum comando correspondente",
"Looks private, so nothing is searched or sent": "Parece privado, por isso nada é pesquisado nem enviado"
}
+26 -1
View File
@@ -4467,5 +4467,30 @@
"other": "Показать {what} · {place} ({count} объекта)"
},
"Go there": "Перейти туда",
"Open draw options": "Открыть параметры рисования"
"Open draw options": "Открыть параметры рисования",
"{what} in {place}: {count} items": {
"one": "{what} · {place}: {count} объект",
"few": "{what} · {place}: {count} объекта",
"many": "{what} · {place}: {count} объектов",
"other": "{what} · {place}: {count} объекта"
},
"{count} items in view": {
"one": "{count} объект в поле зрения",
"few": "{count} объекта в поле зрения",
"many": "{count} объектов в поле зрения",
"other": "{count} объекта в поле зрения"
},
"Selected · near {name}": "Выбрано · рядом с {name}",
"Near {name}": "Рядом с {name}",
"Stop drawing": "Завершить рисование",
"{place} · landmarks": "{place} · достопримечательности",
"In {place}": "Места в {place}",
"Near {place}": "Рядом с {place}",
"Unable to complete this action: {reason}": "Не удалось выполнить действие: {reason}",
"Unable to complete this action. Please try again.": "Не удалось выполнить действие. Попробуйте ещё раз.",
"{layer} M{mag}+": "{layer} с магнитудой от {mag}",
"Search places, layers and things on the map, or ask GEV": "Ищите места, слои и объекты на карте или спросите GEV",
"Search places, layers, flights… or ask GEV · > for commands": "Ищите места, слои, рейсы… или спросите GEV · > для команд",
"No matching command": "Подходящая команда не найдена",
"Looks private, so nothing is searched or sent": "Похоже на личные данные, поэтому ничего не ищется и не отправляется"
}
+22 -1
View File
@@ -4259,5 +4259,26 @@
"other": "Visa {what} i {place} ({count} objekt)"
},
"Go there": "Gå dit",
"Open draw options": "Öppna ritalternativ"
"Open draw options": "Öppna ritalternativ",
"{what} in {place}: {count} items": {
"one": "{what} i {place}: {count} objekt",
"other": "{what} i {place}: {count} objekt"
},
"{count} items in view": {
"one": "{count} objekt i vyn",
"other": "{count} objekt i vyn"
},
"Selected · near {name}": "Valt objekt · nära {name}",
"Near {name}": "Nära {name}",
"Stop drawing": "Sluta rita",
"{place} · landmarks": "{place} · sevärdheter",
"In {place}": "I {place}",
"Near {place}": "Nära {place}",
"Unable to complete this action: {reason}": "Det gick inte att slutföra åtgärden: {reason}",
"Unable to complete this action. Please try again.": "Det gick inte att slutföra åtgärden. Försök igen.",
"{layer} M{mag}+": "{layer} med magnitud {mag} eller högre",
"Search places, layers and things on the map, or ask GEV": "Sök efter platser, lager och objekt på kartan eller fråga GEV",
"Search places, layers, flights… or ask GEV · > for commands": "Sök efter platser, lager, flyg… eller fråga GEV · > för kommandon",
"No matching command": "Inget matchande kommando",
"Looks private, so nothing is searched or sent": "Ser privat ut, så inget söks eller skickas"
}
+26 -1
View File
@@ -4467,5 +4467,30 @@
"other": "Показати {what} · {place} ({count} об’єкта)"
},
"Go there": "Перейти туди",
"Open draw options": "Відкрити параметри малювання"
"Open draw options": "Відкрити параметри малювання",
"{what} in {place}: {count} items": {
"one": "{what} · {place}: {count} об’єкт",
"few": "{what} · {place}: {count} об’єкти",
"many": "{what} · {place}: {count} об’єктів",
"other": "{what} · {place}: {count} об’єкта"
},
"{count} items in view": {
"one": "{count} об’єкт у полі зору",
"few": "{count} об’єкти у полі зору",
"many": "{count} об’єктів у полі зору",
"other": "{count} об’єкта у полі зору"
},
"Selected · near {name}": "Вибране · поблизу {name}",
"Near {name}": "Поблизу {name}",
"Stop drawing": "Припинити малювання",
"{place} · landmarks": "{place} · визначні місця",
"In {place}": "Місця в {place}",
"Near {place}": "Поблизу {place}",
"Unable to complete this action: {reason}": "Не вдалося виконати цю дію: {reason}",
"Unable to complete this action. Please try again.": "Не вдалося виконати цю дію. Спробуйте ще раз.",
"{layer} M{mag}+": "{layer} з магнітудою від {mag}",
"Search places, layers and things on the map, or ask GEV": "Шукайте місця, шари й об’єкти на карті або запитайте GEV",
"Search places, layers, flights… or ask GEV · > for commands": "Шукайте місця, шари, рейси… або запитайте GEV · > для команд",
"No matching command": "Відповідної команди не знайдено",
"Looks private, so nothing is searched or sent": "Схоже на особисті дані, тому нічого не шукається й не надсилається"
}
+20 -1
View File
@@ -4155,5 +4155,24 @@
"other": "显示{place}的{what}({count} 个)"
},
"Go there": "前往该地点",
"Open draw options": "打开绘制选项"
"Open draw options": "打开绘制选项",
"{what} in {place}: {count} items": {
"other": "{place}的{what}:{count} 个"
},
"{count} items in view": {
"other": "视野内 {count} 个"
},
"Selected · near {name}": "已选中 · {name}附近",
"Near {name}": "{name}附近",
"Stop drawing": "停止绘制",
"{place} · landmarks": "{place} · 地标",
"In {place}": "{place}境内",
"Near {place}": "{place}附近",
"Unable to complete this action: {reason}": "无法完成此操作:{reason}",
"Unable to complete this action. Please try again.": "无法完成此操作。请重试。",
"{layer} M{mag}+": "{layer}(震级 M{mag} 及以上)",
"Search places, layers and things on the map, or ask GEV": "搜索地点、图层和地图上的对象,或向 GEV 提问",
"Search places, layers, flights… or ask GEV · > for commands": "搜索地点、图层、航班… 或问 GEV · > 输入命令",
"No matching command": "没有匹配的命令",
"Looks private, so nothing is searched or sent": "疑似隐私信息,因此不会搜索或发送"
}
+20 -1
View File
@@ -4155,5 +4155,24 @@
"other": "顯示{place}的{what}({count} 個)"
},
"Go there": "前往該地點",
"Open draw options": "打開繪製選項"
"Open draw options": "打開繪製選項",
"{what} in {place}: {count} items": {
"other": "{place}的{what}:{count} 個"
},
"{count} items in view": {
"other": "視野內 {count} 個"
},
"Selected · near {name}": "已選中 · {name}附近",
"Near {name}": "{name}附近",
"Stop drawing": "停止繪製",
"{place} · landmarks": "{place} · 地標",
"In {place}": "{place}境內",
"Near {place}": "{place}附近",
"Unable to complete this action: {reason}": "無法完成此操作:{reason}",
"Unable to complete this action. Please try again.": "無法完成此操作。請重試。",
"{layer} M{mag}+": "{layer}(震級 M{mag} 及以上)",
"Search places, layers and things on the map, or ask GEV": "搜索地點、圖層和地圖上的對象,或向 GEV 提問",
"Search places, layers, flights… or ask GEV · > for commands": "搜索地點、圖層、航班… 或問 GEV · > 輸入命令",
"No matching command": "沒有匹配的命令",
"Looks private, so nothing is searched or sent": "疑似隱私信息,因此不會搜索或發送"
}
+14
View File
@@ -78,6 +78,12 @@ import { useCockpitStore } from './stores/cockpit.js';
import { useGlobeActionsStore } from './stores/globeActions.js';
import { useRecordingStore } from './stores/recording.js';
import { onPlacePacksLoadingChange } from '../data/placeBelow.js';
import {
hideOsmCredit,
registerDynamicCredit,
showOsmCredit,
WIKIDATA_PLACES_CREDIT,
} from '../data/dataCredits.js';
import { withPlacePacks } from './placePacksLoading.js';
import { preloadOwnerFlags } from './ownerFlag.js';
@@ -182,6 +188,14 @@ export class StyleManager extends ShellFacade {
layers: () => this._dataManager?.getAll?.() || [],
setLayer: (id, enabled) =>
this._dataManager?.setEnabled(id, enabled, { origin: 'user' }),
// The Omnibar shows names from the bundled Wikidata packs.
creditPlaces: () =>
registerDynamicCredit(this.viewer, WIKIDATA_PLACES_CREDIT),
// Photon's suggestions are OpenStreetMap data: credited while shown.
creditSuggestions: (shown) =>
shown
? showOsmCredit(this.viewer, 'omnibar')
: hideOsmCredit(this.viewer, 'omnibar'),
});
// Scrolling at a screen edge steps through that side's rail panels.
this._removeRailEdgeScroll = installRailEdgeScroll();
File diff suppressed because it is too large. Load diff
+10 -2
View File
@@ -62,7 +62,7 @@ export function installEntityContext({
const voice = useVoiceStore(pinia);
const cockpitStore = useCockpitStore(pinia);
const chrome = usePanelChromeStore(pinia);
/** Whether Context is open; a closed panel reads nothing. */
/** Whether Context is open. (readView also reads while the Omnibar is focused.) */
const isOpen = () =>
chrome.panels['global-context-panel']?.collapsed === false;
const doc = globalThis.document;
@@ -223,7 +223,8 @@ export function installEntityContext({
// the height. Read when the camera settles, not every frame.
const readView = () => {
const port = camera();
if (!port || !isOpen()) return;
if (!port || (!isOpen() && doc?.activeElement?.id !== 'gev-omnibar-input'))
return;
const pose = port.pose();
if (![pose.lat, pose.lon, pose.height].every(Number.isFinite)) return;
const middle = pickWorld?.(viewer, 0.5, 0.5);
@@ -272,6 +273,12 @@ export function installEntityContext({
listen();
readView();
}, 0);
// The Omnibar's nearby suggestions also need a fresh center even with
// Context closed. Its focus event requests one camera read.
const onSearchFocus = (event) => {
if (event.target?.id === 'gev-omnibar-input') readView();
};
doc?.addEventListener('focusin', onSearchFocus);
// Opening the panel describes the view as it is now.
let wasOpen = isOpen();
const offChrome = chrome.$subscribe(() => {
@@ -356,6 +363,7 @@ export function installEntityContext({
clearTimeout(trailing);
offFollow();
offChrome();
doc?.removeEventListener('focusin', onSearchFocus);
clearTimeout(followCheck);
globalThis.removeEventListener?.('gev:entity-selected', onSelected);
store.connect(null);
+25 -7
View File
@@ -115,8 +115,15 @@ export function layoutLeftPanelRail({
if (hiddenByAncestor) continue;
const rect = obstacle.getBoundingClientRect();
if (rect.width <= 0 || rect.height <= 0) continue;
const overlapsHorizontally =
rect.right > stackRect.left && rect.left < stackRect.right;
// The centered controls can enter the stack's transparent outer gutter.
// Only constrain the lane if they reach an expanded panel itself, whose
// actual bounds also include the edge-rail offset.
const lanes = ['world-timeline', 'gev-voice-control'].includes(obstacle.id)
? laidOutPanels.map((panel) => panel.getBoundingClientRect())
: [stackRect];
const overlapsHorizontally = lanes.some(
(lane) => rect.right > lane.left && rect.left < lane.right,
);
if (!overlapsHorizontally) continue;
if (rect.top < baseTop && rect.bottom <= viewportHeight * 0.5) {
@@ -220,11 +227,20 @@ export function layoutLeftPanelRail({
const tailLayoutBottom = tailLayoutTop + tailRequiredHeight;
const tailAvailableHeight = Math.max(0, obstacleSafeBottom - obstacleSafeTop);
const tailTolerance = wasTail ? stabilityBand : -stabilityBand;
// Data Layers has a scrollable list and a fixed footer. Give it the full
// desktop lane while short control panels keep their natural height.
const fillDataLayers =
exclusive &&
expandedPanels.length === 1 &&
expandedPanels[0].id === 'data-panel' &&
Boolean(documentRef?.getElementById?.('gev-omnibar'));
const shouldTail =
!fillDataLayers &&
expandedPanels.length > 0 &&
tailLayoutTop >= obstacleSafeTop - tailTolerance &&
tailLayoutBottom <= obstacleSafeBottom + tailTolerance;
const shouldFocus = exceedsCenteredCorridor && !shouldTail;
const shouldFocus =
fillDataLayers || (exceedsCenteredCorridor && !shouldTail);
// Focus mode owns the lane, so let every expanded panel share the full
// obstacle-safe corridor. Tail/normal layouts keep the balanced
// viewport centering used for compact accordion stacks.
@@ -250,10 +266,12 @@ export function layoutLeftPanelRail({
rowGap * Math.max(0, expandedPanels.length - 1),
)
: naturalExpandedHeight;
const allocatedExpandedHeights = allocatePanelStackHeights({
naturalHeights: naturalExpandedHeights,
availableHeight: expandedAvailableHeight,
});
const allocatedExpandedHeights = fillDataLayers
? [expandedAvailableHeight]
: allocatePanelStackHeights({
naturalHeights: naturalExpandedHeights,
availableHeight: expandedAvailableHeight,
});
const autoCollapseIndices = hud.visible
? panelStackAutoCollapseIndices({
naturalHeights: naturalExpandedHeights,
+35 -3
View File
@@ -46,6 +46,7 @@ export class LocationControls {
onCity,
onPoi,
onSearch,
onSearchEdit,
onReset,
publish,
doc,
@@ -74,6 +75,7 @@ export class LocationControls {
poi: t('Landmark: --'),
};
this.searchError = null;
this.searchOrigin = 'dock';
// The search field: whether it is open, and whether a lookup runs.
this.searchExpanded = Boolean(searchExpanded);
this.searching = false;
@@ -96,12 +98,16 @@ export class LocationControls {
onPoi(cityId, index);
});
this.bind(elements.search, 'keydown', (event) => {
if (event.key === 'Enter') void onSearch(elements.search.value);
if (event.key === 'Enter')
void this.search(elements.search.value, { origin: 'dock' });
});
// Typing corrects a failed query; closing the field (which empties it) drops its error.
this.bind(elements.search, 'input', () => onSearchEdit?.());
this.bind(elements.search, 'input', () => {
if (this.searchOrigin === 'dock') onSearchEdit?.();
});
this.bind(elements.search, 'blur', () => {
if (!elements.search.value) onSearchEdit?.();
if (this.searchOrigin === 'dock' && !elements.search.value)
onSearchEdit?.();
});
this.present();
}
@@ -138,9 +144,29 @@ export class LocationControls {
searchError: this.searchError,
searchExpanded: this.searchExpanded,
searching: this.searching,
searchOrigin: this.searchOrigin,
orbit: this.orbit && { ...this.orbit },
};
}
/** Search through the same lifecycle as the location field. */
search(query, { origin = 'omnibar' } = {}) {
if (this.destroyed || !String(query || '').trim()) return false;
this._requestedSearchOrigin = origin;
// Beginning navigation synchronously settles the previous lookup. That
// handoff must not clear or blur the draft just submitted by either field.
this._startingSearch = true;
try {
return this.onSearch(query);
} finally {
this._startingSearch = false;
this._requestedSearchOrigin = null;
}
}
/** Editing an external query clears its prior lookup error. */
editSearch() {
if (!this.destroyed && this.searchOrigin === 'omnibar')
this.onSearchEdit?.();
}
/** A city pill was clicked. */
chooseCity(id) {
if (!this.destroyed) this.onCity(id);
@@ -233,6 +259,8 @@ export class LocationControls {
/** Mark the search field while a lookup runs. */
setSearching(active) {
if (this.destroyed) return;
if (active && this._requestedSearchOrigin)
this.searchOrigin = this._requestedSearchOrigin;
this.searching = Boolean(active);
this.present();
}
@@ -243,6 +271,10 @@ export class LocationControls {
settleSearch({ keepQuery = false } = {}) {
if (this.destroyed) return;
this.searching = false;
if (this._startingSearch || this.searchOrigin === 'omnibar') {
this.present();
return;
}
if (!keepQuery) {
this.closeSearch();
return;
+1
View File
@@ -108,6 +108,7 @@ test('the tray presents its cities, empty status and no landmarks at first', ()
searchError: null,
searchExpanded: false,
searching: false,
searchOrigin: 'dock',
orbit: null,
});
f.controls.highlightCity('b');
+2
View File
@@ -101,6 +101,8 @@ export class LocationSearch {
destination: { ...destination },
};
this.channel.publish(change('found'));
// Found and still the current search: a plan may go on.
return current() && !controller.signal.aborted;
} else {
this.onMissing?.();
if (!current() || controller.signal.aborted) return;
+5 -6
View File
@@ -185,8 +185,8 @@ const AUX_FORM =
/**
* Whether a line is a real question, which Ask GEV may answer on Enter (a
* billed call):
* - one ending with "?" that has two words and two letters or more (or
* three Han, Kana or Hangul characters);
* - one ending with "?" that has a question form or two non-Latin words
* with a word of two letters or more, or five Han, Kana or Hangul characters;
* - without "?", only a question word's form ("what is here", "how far is
* paris") with a word about something after it, and not written as a
* name ("Where Is My Mind").
@@ -209,13 +209,12 @@ export function isRealQuestion(text) {
const words = line.replace(/\?+$/, '').split(/\s+/).filter(Boolean);
if (line.endsWith('?'))
// A name with "?" ("New York?", "Truth or Consequences?", "東京都?") is
// offered to GEV, not sent: a question's form, or four words or more
// (five Han, Kana or Hangul characters, written without spaces; two
// words in other non-Latin scripts).
// offered to GEV, not sent: a question's form, or five Han, Kana or
// Hangul characters written without spaces, or two words in other
// non-Latin scripts.
return (
((WH_FORM.test(line) ||
AUX_FORM.test(line) ||
words.length >= 4 ||
// Question words in other scripts are not read: two words do.
(words.length >= 2 && !/\p{Script=Latin}/u.test(line))) &&
words.some((word) => (word.match(/\p{L}/gu) || []).length >= 2)) ||
+1
View File
@@ -252,6 +252,7 @@ test('ar and he mark every Omnibar string alike with a right-to-left mark', asyn
// U+200F, so the punctuation stays with the right-to-left text before it.
const sources = await Promise.all(
[
'./views/panels/Omnibar.vue',
'./views/panels/VoiceVisualizer.vue',
'./omnibarIntent.js',
'./omnibarRows.js',
+4 -5
View File
@@ -148,16 +148,15 @@ const OUTCOMES = [
['remove island', 'nothing'],
['show noir and show cctv', 'style(noir) + layer(cctv,on)'],
// a name with "?" is offered to GEV,
// never sent; a question's form or four words are.
// never sent; a question's form is.
['New York?', 'nothing'],
['Truth or Consequences?', 'nothing'],
['Ho Chi Minh City?', 'nothing'],
['Santa Cruz de la Sierra?', 'nothing'],
['東京都?', 'nothing'],
['東京はどこ?', 'ask(東京はどこ?)'],
['is it far?', 'ask(is it far?)'],
[
'how about the weather in paris today?',
'ask(how about the weather in paris today?)',
],
['how about the weather in paris today?', 'nothing'],
['123–45–6789', 'nothing'],
['what is 4111–1111–1111–1111?', 'nothing'],
// a switch with its place after "in" asks;
+32
View File
@@ -232,6 +232,38 @@ test('left corridor respects a lower obstacle but ignores an obstacle hidden by
assert.equal(Number(f.stack.dataset.safeBottomPct), 65.47);
});
test('a centered timeline only shortens the corridor when it reaches the visible panel', () => {
const f = fixture('left');
f.stack.rect.width = 360;
f.stack.rect.right = f.stack.rect.left + 360;
f.expand(f.first, 850);
const timeline = element('world-timeline', { top: 650, left: 320 });
f.options.obstacles = [timeline];
f.run();
const clear = Number(f.stack.dataset.safeBottomPct);
timeline.rect.left = 280;
f.run();
assert(clear > 85);
assert(Number(f.stack.dataset.safeBottomPct) < 73);
});
test('Data Layers extends to the HUD even if its list is currently short', () => {
const f = fixture('left');
f.first.id = 'data-panel';
f.options.documentRef.getElementById = (id) =>
id === 'gev-omnibar' ? {} : null;
f.expand(f.first, 250);
f.options.obstacles = [element('hud', { top: 760, height: 45 })];
f.run();
assert.equal(f.stack.dataset.layoutMode, 'focus');
assert(Number(f.stack.dataset.safeBottomPct) > 80);
assert(
parseFloat(
f.first.style.getPropertyValue('--left-panel-allocated-height'),
) > 500,
);
});
for (const side of ['left', 'right']) {
test(`${side} mobile layout releases desktop height/position styles and labels`, () => {
const f = fixture(side, { mobile: true });
+6
View File
@@ -6,6 +6,7 @@ import {
describeEntity,
layerBreakdown,
nearbyByKind,
nearbyEntities,
layerMatches,
searchEntities,
viewSummary,
@@ -204,6 +205,10 @@ export const useEntityCardStore = defineStore('gev-entity-card', () => {
return nearbyByKind(shell.value?.dataManager?.(), { lat, lon }, options);
}
function nearbySelected() {
return nearbyEntities(dataManager(), card.value);
}
/** Whether a card's layer is known to the layer manager and switched off. */
function layerOff(layerId) {
const dm = dataManager();
@@ -333,6 +338,7 @@ export const useEntityCardStore = defineStore('gev-entity-card', () => {
following,
search,
nearbyGroups,
nearbySelected,
alertsAt,
liveLayers,
breakdown,
+3
View File
@@ -79,6 +79,8 @@ export const useGlobeActionsStore = defineStore('gev-globe-actions', () => {
}
const { act, owns } = owners;
/** Whether a connected owner answers this action at all. */
const answers = (name) => Boolean(owners.ownerOf(name));
return {
clearBusy,
@@ -91,5 +93,6 @@ export const useGlobeActionsStore = defineStore('gev-globe-actions', () => {
detach,
act,
owns,
answers,
};
});
+6 -3
View File
@@ -5,11 +5,14 @@ import { markRaw, shallowRef } from 'vue';
* The top-bar omnibar's link to the shell. The shell connects the actions
* the omnibar offers: `layers()` lists the data layers as `{id, name,
* enabled}`, and `setLayer(id, enabled)` turns one on or off as a user click
* would. Place search runs through the location controls and Ask GEV through
* the voice controls, so neither is repeated here.
* would. `creditPlaces()`, optional, credits the bundled Wikidata place
* packs once a name from them is shown, and `creditSuggestions(shown)`,
* optional, shows the OpenStreetMap credit while Photon's suggestions are. Place search runs through the
* location controls and Ask GEV through the voice controls, so neither is
* repeated here.
*/
export const useOmnibarStore = defineStore('gev-omnibar', () => {
/** `{layers(), setLayer(id, enabled)}`, or null while disconnected. */
/** `{layers(), setLayer(id, enabled), creditPlaces?()}`, or null while disconnected. */
const controls = shallowRef(null);
/** @param {?object} next The shell's omnibar actions, or null. */
+413
View File
@@ -0,0 +1,413 @@
/* ── "Show me how" guide ───────────────────────────────────────────────
A spotlight dims everything but the control to press and frames it with
tactical corner brackets; a second frame marks a part of it (a layer's
switch). A glass callout beside it, with an arrow to the target, says
what to do and how far along the walk is. Clicks pass through to the
app: the guide only points. */
.gev-guide {
--gev-guide-accent: #ff9f43;
--gev-guide-accent-soft: rgba(255, 159, 67, 0.5);
position: fixed;
z-index: 400;
inset: 0;
pointer-events: none;
}
/* ── Spotlight ── */
.gev-guide-ring {
position: fixed;
border: 1px solid rgba(255, 159, 67, 0.28);
border-radius: 8px;
box-shadow: 0 0 0 200vmax rgba(3, 8, 14, 0.55);
opacity: 0;
transition:
left 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
top 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
width 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
height 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
opacity 160ms ease;
}
/* Corner brackets, drawn as eight short gradient strokes. */
.gev-guide-ring::before {
position: absolute;
inset: -3px;
background:
linear-gradient(var(--gev-guide-accent) 0 0) top left / 12px 2px,
linear-gradient(var(--gev-guide-accent) 0 0) top left / 2px 12px,
linear-gradient(var(--gev-guide-accent) 0 0) top right / 12px 2px,
linear-gradient(var(--gev-guide-accent) 0 0) top right / 2px 12px,
linear-gradient(var(--gev-guide-accent) 0 0) bottom left / 12px 2px,
linear-gradient(var(--gev-guide-accent) 0 0) bottom left / 2px 12px,
linear-gradient(var(--gev-guide-accent) 0 0) bottom right / 12px 2px,
linear-gradient(var(--gev-guide-accent) 0 0) bottom right / 2px 12px;
background-repeat: no-repeat;
content: '';
filter: drop-shadow(0 0 4px rgba(255, 159, 67, 0.6));
}
/* A soft ping that grows out of the frame: "press here". */
.gev-guide-ring > i {
position: absolute;
inset: 0;
border: 1px solid var(--gev-guide-accent-soft);
border-radius: inherit;
animation: gev-guide-ping 1.8s cubic-bezier(0.2, 0.7, 0.3, 1) infinite;
}
/* A second frame inside the spotlight does not dim the screen again. */
.gev-guide-ring--sub {
border-color: rgba(255, 159, 67, 0.4);
border-radius: 6px;
box-shadow: none;
}
.gev-guide-ring--sub::before {
inset: -2px;
background-size:
8px 2px,
2px 8px,
8px 2px,
2px 8px,
8px 2px,
2px 8px,
8px 2px,
2px 8px;
}
/* ── Callout ── */
.gev-guide-callout {
position: fixed;
width: 280px;
padding: 0.7rem 0.8rem 0.65rem;
color: rgba(232, 238, 242, 0.95);
background: rgba(40, 44, 52, 0.9);
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 12px;
box-shadow:
0 16px 40px rgba(0, 0, 0, 0.55),
inset 0 1px 0 rgba(255, 255, 255, 0.06);
backdrop-filter: blur(22px) saturate(1.3);
-webkit-backdrop-filter: blur(22px) saturate(1.3);
opacity: 0;
transform: translateY(4px);
transition:
left 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
top 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
opacity 180ms ease,
transform 180ms ease;
pointer-events: auto;
}
.gev-guide.visible .gev-guide-callout {
opacity: 1;
transform: none;
}
/* A leader line from the callout to the target's frame, ending in a dot. */
.gev-guide-callout::before,
.gev-guide-callout::after {
position: absolute;
top: var(--gev-guide-arrow-y, 50%);
content: '';
transition: top 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.gev-guide-callout::before {
width: 18px;
height: 1px;
background: var(--gev-guide-accent);
box-shadow: 0 0 6px rgba(255, 159, 67, 0.7);
}
.gev-guide-callout::after {
width: 5px;
height: 5px;
margin-top: -2px;
background: var(--gev-guide-accent);
border-radius: 50%;
box-shadow: 0 0 6px rgba(255, 159, 67, 0.9);
}
.gev-guide-callout[data-side='right']::before {
right: 100%;
}
.gev-guide-callout[data-side='right']::after {
right: calc(100% + 15px);
}
.gev-guide-callout[data-side='left']::before {
left: 100%;
}
.gev-guide-callout[data-side='left']::after {
left: calc(100% + 15px);
}
.gev-guide-callout[data-side='none']::before,
.gev-guide-callout[data-side='none']::after {
display: none;
}
/* The edge the line leaves from picks up the accent. */
.gev-guide-callout[data-side='right'] {
border-left-color: rgba(255, 159, 67, 0.55);
}
.gev-guide-callout[data-side='left'] {
border-right-color: rgba(255, 159, 67, 0.55);
}
/* Header: what this walk is about, how far along, and a close. */
.gev-guide-head {
display: flex;
align-items: center;
gap: 0.5rem;
}
.gev-guide-title,
.gev-guide-count {
margin: 0;
font-family: var(--font-mono);
font-size: 0.56rem;
letter-spacing: 0.12rem;
text-transform: uppercase;
}
.gev-guide-title {
flex: 1;
min-width: 0;
overflow: hidden;
color: var(--gev-guide-accent);
text-overflow: ellipsis;
white-space: nowrap;
}
.gev-guide-count {
color: rgba(214, 220, 226, 0.55);
font-variant-numeric: tabular-nums;
letter-spacing: 0.06rem;
}
.gev-guide-close {
display: grid;
place-items: center;
width: 20px;
height: 20px;
margin: -2px -4px 0 0;
padding: 0;
color: rgba(214, 220, 226, 0.55);
font-size: 0.95rem;
line-height: 1;
background: none;
border: 0;
border-radius: 5px;
cursor: pointer;
}
.gev-guide-close:hover,
.gev-guide-close:focus-visible {
color: #fff;
background: rgba(255, 255, 255, 0.08);
}
/* Progress: one segment per step. */
.gev-guide-progress {
display: flex;
gap: 3px;
margin: 0.45rem 0 0.6rem;
padding: 0;
list-style: none;
}
.gev-guide-progress li {
flex: 1;
height: 2px;
background: rgba(214, 220, 226, 0.16);
border-radius: 2px;
transition: background 220ms ease;
}
.gev-guide-progress li.done {
background: rgba(255, 159, 67, 0.55);
}
.gev-guide-progress li.current {
background: var(--gev-guide-accent);
box-shadow: 0 0 6px rgba(255, 159, 67, 0.6);
}
.gev-guide-callout.swap .gev-guide-body {
animation: gev-guide-swap 260ms ease both;
}
.gev-guide-text {
margin: 0;
font-size: 0.84rem;
line-height: 1.45;
}
/* "Press the highlighted control", with a live dot. */
.gev-guide-hint {
display: flex;
align-items: center;
gap: 0.45rem;
margin: 0.4rem 0 0;
color: rgba(214, 220, 226, 0.6);
font-size: 0.68rem;
}
.gev-guide-hint[hidden] {
display: none;
}
.gev-guide-hint-dot {
width: 6px;
height: 6px;
flex: none;
background: var(--gev-guide-accent);
border-radius: 50%;
animation: gev-guide-blink 1.4s ease-in-out infinite;
}
/* Footer: the Esc hint on the left, the buttons on the right. */
.gev-guide-actions {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.4rem;
margin-top: 0.7rem;
padding-top: 0.55rem;
border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.gev-guide-actions > span {
display: flex;
gap: 0.4rem;
}
.gev-guide-keys {
display: flex;
align-items: center;
gap: 0.35rem;
margin: 0;
color: rgba(214, 220, 226, 0.45);
font-size: 0.62rem;
}
.gev-guide-keys[hidden] {
display: none;
}
/* With the Esc hint gone, the offer's buttons sit on the right. */
.gev-guide-actions > span:only-of-type {
margin-left: auto;
}
.gev-guide-keys kbd {
padding: 0.05rem 0.3rem;
font-family: var(--font-mono);
font-size: 0.54rem;
border: 1px solid rgba(214, 220, 226, 0.22);
border-radius: 4px;
}
.gev-guide-actions button {
padding: 0.28rem 0.6rem;
color: #1a1206;
font-family: var(--font-mono);
font-size: 0.58rem;
font-weight: 600;
letter-spacing: 0.1rem;
text-transform: uppercase;
white-space: nowrap;
background: var(--gev-guide-accent);
border: 1px solid var(--gev-guide-accent);
border-radius: 6px;
cursor: pointer;
transition:
background 140ms ease,
color 140ms ease,
border-color 140ms ease;
}
.gev-guide-actions button[hidden] {
display: none;
}
.gev-guide-actions button:hover,
.gev-guide-actions button:focus-visible {
background: #ffb36b;
border-color: #ffb36b;
}
/* Secondary buttons: skip a step that waits, or decline the offer. */
.gev-guide-actions button.quiet,
.gev-guide-actions .gev-guide-skip {
color: rgba(214, 220, 226, 0.75);
font-weight: 400;
background: none;
border-color: rgba(214, 220, 226, 0.2);
}
.gev-guide-actions button.quiet:hover,
.gev-guide-actions button.quiet:focus-visible,
.gev-guide-actions .gev-guide-skip:hover,
.gev-guide-actions .gev-guide-skip:focus-visible {
color: #fff;
background: rgba(255, 255, 255, 0.06);
border-color: rgba(255, 159, 67, 0.6);
}
@keyframes gev-guide-ping {
0% {
opacity: 0.9;
transform: scale(1);
}
100% {
opacity: 0;
transform: scale(1.12);
}
}
@keyframes gev-guide-blink {
50% {
opacity: 0.3;
}
}
@keyframes gev-guide-swap {
from {
opacity: 0;
transform: translateY(3px);
}
}
@media (prefers-reduced-motion: reduce) {
.gev-guide-ring,
.gev-guide-callout,
.gev-guide-callout::before {
transition: none;
}
.gev-guide-ring > i,
.gev-guide-hint-dot,
.gev-guide-callout.swap .gev-guide-body {
animation: none;
}
}
/* The guide's live status: read by screen readers, not shown. */
.gev-guide-status {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
border: 0;
}
+360
View File
@@ -0,0 +1,360 @@
/* Shared desktop command surface. Mobile and exclusive owners keep their layout. */
body:not(.mobile-shell):not(.cockpit-mode):not(.scene-playback-mode):not(
.ui-clean-view
):not(.recording-mode):where(
:has(#gev-omnibar):has(#command-dock > #gev-voice-control)
) {
--omnibar-dock-width: clamp(400px, 32vw, 460px);
--omnibar-dock-bottom: 74px;
--omnibar-coordinates-bottom: 4.25rem;
--world-timeline-lift: 0px;
#intel-hud:is([data-variant='tactical'], [data-variant='minimal'])
:is(.hud-top-left, .hud-top-right) {
top: clamp(92px, 10vh, 112px);
}
#intel-hud:is([data-variant='tactical'], [data-variant='minimal'])
.hud-top-left
.hud-readout:has(> #hud-mode) {
display: none;
}
#top-center-actions {
top: clamp(86px, 9.55vh, 108px);
}
#left-panel-stack.layout-focus {
bottom: var(--left-stack-safe-bottom, 4vh);
}
#world-timeline {
bottom: calc(var(--omnibar-dock-bottom) + 66px);
width: var(--omnibar-dock-width);
}
&:has(#gev-chat-panel:not([hidden]), #gev-voice-panel:not([hidden]))
#world-timeline,
&:has(#gev-omnibar.has-results):not(
:has(#gev-voice-control[data-assistant-mode='voice'])
)
#world-timeline {
visibility: hidden;
}
#command-dock {
--dock-voice-width: var(--omnibar-dock-width);
top: auto;
bottom: var(--omnibar-dock-bottom);
z-index: 149;
width: var(--omnibar-dock-width);
max-width: none;
height: 56px;
min-height: 0;
overflow: visible;
align-items: center;
padding: 0;
}
#command-dock > #gev-voice-control {
box-sizing: border-box;
flex: none;
width: 100%;
min-width: 0;
max-width: none;
height: 56px;
margin: 0;
padding: 0 8px;
gap: 0;
align-items: center;
justify-content: space-between;
border: 1px solid rgba(120, 220, 255, 0.16);
border-radius: 18px;
background: linear-gradient(
180deg,
rgba(16, 28, 36, 0.9),
rgba(6, 14, 20, 0.94)
);
box-shadow:
inset 0 1px 0 rgba(200, 245, 255, 0.07),
0 12px 32px rgba(0, 0, 0, 0.45);
backdrop-filter: none;
}
&:has(#gev-omnibar:focus-within) #command-dock > #gev-voice-control {
border-color: rgba(54, 220, 255, 0.5);
box-shadow:
0 12px 32px rgba(0, 0, 0, 0.45),
0 0 0 3px rgba(54, 220, 255, 0.1);
}
#command-dock > #gev-voice-control::before,
#command-dock > #gev-voice-control::after {
content: '';
position: absolute;
top: 16px;
bottom: 16px;
width: 1px;
height: auto;
transform: none;
background: rgba(120, 220, 255, 0.12);
pointer-events: none;
}
#command-dock > #gev-voice-control::before {
inset-inline-start: 54px;
inset-inline-end: auto;
}
#command-dock > #gev-voice-control::after {
inset-inline-start: auto;
inset-inline-end: 54px;
}
#gev-voice-control > :is(#gev-voice-button, #gev-chat-button):focus-visible {
outline: 2px solid #7bd3ef;
outline-offset: 2px;
}
#gev-voice-control > :is(#gev-voice-button, #gev-chat-button) {
display: grid;
place-items: center;
flex: none;
width: 40px;
height: 40px;
min-width: 0;
margin: 0;
padding: 0;
border: 1px solid rgba(120, 220, 255, 0.18);
border-radius: 50%;
background: rgba(5, 17, 24, 0.48);
box-shadow:
inset 0 2px 4px rgba(0, 0, 0, 0.58),
inset 0 -1px 0 rgba(169, 226, 245, 0.12),
0 1px 0 rgba(169, 226, 245, 0.1);
transform: none;
}
#gev-voice-control
> :is(#gev-voice-button, #gev-chat-button):is(
:hover,
[aria-pressed='true'],
[aria-expanded='true']
) {
background: rgba(54, 220, 255, 0.14);
border-color: rgba(54, 220, 255, 0.6);
}
#command-dock #gev-voice-control .gev-mic-orbit,
#command-dock #gev-chat-button > svg {
box-sizing: border-box;
width: 19px;
height: 19px;
padding: 0;
background: none;
border: 0;
box-shadow: none;
}
#gev-voice-button .gev-mic-orbit img {
width: 19px;
height: 19px;
filter: saturate(0.35) brightness(1.25);
}
#gev-voice-button .gev-mic-orbit::before,
#gev-voice-button .gev-mic-orbit::after {
display: none;
}
#gev-voice-control :is(.gev-mic-label, .gev-chat-label) {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
}
/* Status remains readable while live; idle meter is decorative. */
#command-dock
#gev-voice-control:not([data-assistant-mode='voice'])
> .gev-voice-visualizer,
#command-dock
#gev-voice-control:not([data-chat-busy='true'])
> .gev-chat-thinking {
display: none;
}
#command-dock #gev-voice-control[data-chat-busy='true'] > .gev-chat-thinking {
position: absolute;
top: 10px;
left: 50%;
height: 0;
transform: translateX(-50%);
pointer-events: none;
z-index: 151;
}
#gev-voice-control > .gev-voice-readout {
position: absolute;
inset-inline: 0;
top: auto;
bottom: calc(100% + 8px);
pointer-events: none;
}
#gev-voice-control[data-assistant-mode='idle'] > .gev-voice-readout {
visibility: hidden;
}
#gev-omnibar {
top: auto;
bottom: calc(var(--omnibar-dock-bottom) + 11px);
left: 50%;
width: calc(var(--omnibar-dock-width) - 120px);
transform: translateX(-50%);
}
#gev-omnibar .omnibar-field {
height: 34px;
padding-inline: 9px 6px;
border: 1px solid rgba(151, 213, 231, 0.27);
border-radius: 9px;
background: rgba(172, 219, 239, 0.07);
box-shadow: none;
backdrop-filter: none;
}
#gev-omnibar-input {
font-size: 0.86rem;
text-overflow: ellipsis;
}
#gev-omnibar-input::placeholder {
color: #b6cbd4;
}
#gev-omnibar .omnibar-field:focus-within {
border-color: rgba(95, 230, 255, 0.66);
background: rgba(109, 206, 232, 0.1);
}
#gev-omnibar .omnibar-search-icon {
color: #a9cfda;
}
#gev-omnibar :is(.omnibar-mic, .omnibar-edge) {
display: none;
}
#gev-omnibar .omnibar-results {
position: absolute;
inset-inline: -60px;
top: auto;
bottom: calc(100% + 11px);
max-height: min(
360px,
max(0px, calc(100dvh - var(--omnibar-dock-bottom) - 144px))
);
overflow: auto;
border-radius: 18px 18px 0 0;
border: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(50, 54, 62, 0.86);
backdrop-filter: blur(26px) saturate(1.2);
-webkit-backdrop-filter: blur(26px) saturate(1.2);
box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
}
&:has(#gev-omnibar.has-results):not(
:has(#gev-voice-control[data-assistant-mode='voice'])
)
#command-dock
> #gev-voice-control {
border-start-start-radius: 0;
border-start-end-radius: 0;
}
#command-dock
#gev-voice-control[data-assistant-mode='voice']
> .gev-voice-visualizer {
position: absolute;
display: block;
inset: auto 64px 10px;
width: auto;
height: 28px;
opacity: 1;
transform: none;
pointer-events: none;
}
#gev-voice-control > .gev-voice-visualizer > span {
display: none;
}
#gev-voice-control > .gev-voice-visualizer > .gev-voice-wave {
display: block;
width: 100%;
height: 100%;
overflow: visible;
mask-image: linear-gradient(
90deg,
transparent,
#000 16%,
#000 84%,
transparent
);
}
.gev-voice-wave path {
fill: none;
stroke-linecap: round;
stroke-linejoin: round;
}
.gev-voice-wave__main {
stroke: #5fe6ff;
stroke-width: 2;
filter: drop-shadow(0 0 4px rgba(54, 220, 255, 0.55));
}
.gev-voice-wave__echo {
stroke: #36dcff;
stroke-width: 1.2;
opacity: 0.35;
}
.gev-voice-wave__soft {
stroke: #9ff1ff;
stroke-width: 1;
opacity: 0.6;
}
&:has(#gev-voice-control[data-assistant-mode='voice']) #gev-omnibar {
.omnibar-field {
background: transparent;
}
:is(input, .omnibar-kbd, .omnibar-search-icon) {
visibility: hidden;
}
/* Suggestions give way to the waveform; an error stays in view. */
.omnibar-results:not(.has-feedback),
.omnibar-results .omnibar-list {
display: none;
}
}
@media (prefers-reduced-motion: no-preference) {
#command-dock #gev-voice-control[data-assistant-mode='voice'] {
animation: omnibar-listening 2.4s ease-in-out infinite;
}
}
/* Desktop uses Omnibar for search and the Visual rail for presets. */
#command-dock > :is(#location-bar, #control-panel) {
display: none;
}
/* Align the plain credits with Power Up. */
:is(#cesium-credits, #gev-credits),
&:has(#intel-hud[data-variant='minimal'].active)
:is(#cesium-credits, #gev-credits) {
bottom: 1rem;
}
#intel-hud[data-variant='tactical'] .hud-bottom-right {
bottom: calc(4.2rem - 26px);
}
#intel-hud:is([data-variant='tactical'], [data-variant='minimal'])
.hud-bottom-left {
bottom: var(--omnibar-coordinates-bottom);
}
&:not(.context-docked):has(#intel-hud[data-variant='minimal'].active)
#right-context-rail {
--omnibar-minimal-rail-height: min(
var(--right-stack-max-height, 70vh),
calc(
100dvh - var(--right-stack-safe-top, 26vh) -
var(--omnibar-coordinates-bottom) - 3.1rem - 1.2vh
)
);
max-height: var(--omnibar-minimal-rail-height);
> [data-panel-id]:not(.collapsed) {
max-height: var(--omnibar-minimal-rail-height);
}
}
}
@keyframes omnibar-listening {
0%,
100% {
border-color: rgba(54, 220, 255, 0.35);
}
50% {
border-color: rgba(54, 220, 255, 0.75);
}
}
+2 -2
View File
@@ -153,10 +153,10 @@ function selectMapSource(chip) {
<button id="search-toggle" class="search-toggle-btn" :title="t('Search any location')" @click="locationControls?.toggleSearch()">
<span>&#x1F50E;</span>
</button>
<input type="text" id="location-search" v-class-toggle="{ expanded: !!loc?.searchExpanded, searching: !!loc?.searching }" :placeholder="t('Search any location...')" autocomplete="off" spellcheck="false" :aria-label="t('Search location by name or coordinates')" :aria-invalid="loc?.searchError ? 'true' : null" :aria-describedby="loc?.searchError ? 'location-search-error' : null" />
<input type="text" id="location-search" v-class-toggle="{ expanded: !!loc?.searchExpanded, searching: !!loc?.searching }" :placeholder="t('Search any location...')" autocomplete="off" spellcheck="false" :aria-label="t('Search location by name or coordinates')" :aria-invalid="loc?.searchOrigin !== 'omnibar' && loc?.searchError ? 'true' : null" :aria-describedby="loc?.searchOrigin !== 'omnibar' && loc?.searchError ? 'location-search-error' : null" />
</div>
</div>
<p id="location-search-error" class="location-search-error" role="alert">{{ loc?.searchError }}</p>
<p id="location-search-error" class="location-search-error" role="alert">{{ loc?.searchOrigin === 'omnibar' ? '' : loc?.searchError }}</p>
</div>
</div>
</div>
+2
View File
@@ -19,6 +19,7 @@ import AwarenessDirection from './panels/AwarenessDirection.vue';
import UiButton from '../kit/UiButton.vue';
import GlobeActions from './panels/GlobeActions.vue';
import { useGlobeActionsStore } from '../stores/globeActions.js';
import Omnibar from './panels/Omnibar.vue';
import RenderFailure from './panels/RenderFailure.vue';
import WorldTimeline from './panels/WorldTimeline.vue';
@@ -90,6 +91,7 @@ const vToastText = {
<!-- Top-center camera and share actions -->
<GlobeActions />
<Omnibar />
<div id="global-loading-status" role="status" aria-live="polite" aria-atomic="true" :hidden="loading ? loading.hidden : true" :data-state="loading?.state ?? undefined">
<SplitFlapText id="global-loading-label" :text="loading ? loading.label : t('LOADING LIVE DATA')" :stopped="!!loading?.stopped" />
<span id="global-loading-detail">{{ loading ? loading.detail : '' }}</span>
File diff suppressed because it is too large. Load diff
+65 -1
View File
@@ -1,11 +1,12 @@
<script setup>
import { computed, onBeforeUnmount, ref, watch } from 'vue';
import { storeToRefs } from 'pinia';
import { VOICE_VISUALIZER_BARS } from '../../../voice/control.js';
import { useVoiceStore } from '../../stores/voice.js';
// The dock waveform. Its bars change every animation frame while voice is
// live, so they render here alone, not with the rest of the control.
const { bars } = storeToRefs(useVoiceStore());
const { bars, view } = storeToRefs(useVoiceStore());
const barStyle = (index) => ({
'--bar': index,
...(bars.value?.[index] && {
@@ -13,10 +14,73 @@ const barStyle = (index) => ({
'--audio-opacity': bars.value[index].opacity,
}),
});
// The same levels drawn as a wave: a smooth line through the bars, swinging
// above and below the middle by each bar's height, with two fainter traces
// at different amplitudes. Layouts that want bars hide it; the command bar
// shows the wave instead. While it is hidden (it then has no size) no path
// is computed, though the bars still change every frame.
const voiceMode = computed(() => view.value?.root?.assistantMode === 'voice');
const waveEl = ref(null);
const waveShown = ref(false);
let sizeObserver = null;
watch(waveEl, (element) => {
sizeObserver?.disconnect();
sizeObserver = null;
waveShown.value = false;
if (!element || typeof ResizeObserver !== 'function') return;
sizeObserver = new ResizeObserver(([entry]) => {
waveShown.value = entry.contentRect.width > 0 && entry.contentRect.height > 0;
});
sizeObserver.observe(element);
});
onBeforeUnmount(() => sizeObserver?.disconnect());
const W = 300;
const H = 40;
const MID = H / 2;
const levelPx = (index) => {
const raw = Number.parseFloat(bars.value?.[index]?.level);
return Number.isFinite(raw) ? raw : 5;
};
function wavePath(phase, amplitude = 1) {
const n = VOICE_VISUALIZER_BARS;
const step = W / (n + 1);
const points = [{ x: 0, y: MID }];
for (let i = 0; i < n; i++) {
// A 5px standby bar is a flat line; louder bars swing further.
const swing = Math.min(MID - 2, Math.max(0, levelPx(i) - 5) * 0.6 + 1.2);
const sign = (i + phase) % 2 === 0 ? -1 : 1;
points.push({ x: step * (i + 1), y: MID + sign * swing * amplitude });
}
points.push({ x: W, y: MID });
// Smooth through the points with quadratic curves via their midpoints.
let d = `M ${points[0].x} ${points[0].y}`;
for (let i = 1; i < points.length - 1; i++) {
const mx = (points[i].x + points[i + 1].x) / 2;
const my = (points[i].y + points[i + 1].y) / 2;
d += ` Q ${points[i].x.toFixed(1)} ${points[i].y.toFixed(1)} ${mx.toFixed(1)} ${my.toFixed(1)}`;
}
return `${d} L ${W} ${MID}`;
}
const FLAT = `M 0 ${MID} L ${W} ${MID}`;
const wave = computed(() =>
waveShown.value
? { main: wavePath(0), echo: wavePath(1), soft: wavePath(0, 0.45) }
: { main: FLAT, echo: FLAT, soft: FLAT },
);
</script>
<template>
<div class="gev-voice-visualizer" aria-hidden="true">
<span v-for="index in VOICE_VISUALIZER_BARS" :key="index" :style="barStyle(index - 1)"></span>
<svg v-if="voiceMode" ref="waveEl" class="gev-voice-wave" :viewBox="`0 0 ${W} ${H}`" preserveAspectRatio="none">
<path class="gev-voice-wave__soft" :d="wave.soft" />
<path class="gev-voice-wave__echo" :d="wave.echo" />
<path class="gev-voice-wave__main" :d="wave.main" />
</svg>
</div>
</template>
<style scoped>
.gev-voice-wave { display: none; }
</style>