Remove the Cyber HUD layout and keep its sonar as a visual style

Display > HUD > Sonar now turns the sonar sweep on over Tactical or
Minimal. It is off by default, ON reveals its five sliders, and it keeps
its guards: an OFF control, the sweep only while the HUD is visible and
outside Cockpit, no animation under reduced motion, and repaint timers
re-armed only after a drawn frame that still shows contacts.

The Cyber layout, its shell skin and its Cockpit lanes are removed. Share
links, scenes, saved views and set_hud that name Cyber open Tactical with
Sonar on; links and scene shots record Tactical with Sonar under the same
code, and a restored state that names another layout turns Sonar off.
set_cyber_sonar keeps its name and works under any layout. A newer Sonar
toggle or voice setting wins over a share-link restore that lands later.

From 1200px wide the command dock and World Timeline sit 74px above the
bottom edge, as in the Omnibar layout, leaving the bottom row to the map
attribution (left) and the Power Up corner row (right). The attribution
moves to the bottom right when the page runs right to left, where the
corner row sits at the bottom left, and a long credit line wraps upward
before reaching the corner row. The Tactical bottom-right readout sits
8px above Power Up and the coordinates start level with it. The World
Timeline is narrowed to sit between the corners. Toasts keep clear of
the raised dock and the chat and voice panel height budgets subtract its
rise. Below 1200px the layout is unchanged. The left rail treats the
centered World Timeline and voice control as obstacles only where they
reach a laid-out panel.

On top of the Omnibar: sonar.css replaces cyber.css after the Omnibar
imports, the Omnibar's HUD guide step now says Layout picks Tactical or
Minimal, and the Omnibar's Tactical bottom-right readout keeps the same
8px above Power Up.

Co-authored-by: Sameh Khamis <[email protected]>
This commit is contained in:
Manjunath PaparajuandSameh Khamis authored and Sameh Khamis committed 2026-11-18 15:47:27 -08:00
1 parent 35b87c75f2
commit d68adcea21
112 files changed
+1433 -5239

No files matched your search

+6 -7
View File
@@ -30,7 +30,7 @@ import { LocationNavigation } from './locationNavigation.js';
import { bindCameraOrientationControls } from './cameraOrientationControls.js';
import { createMapSourceControls } from './mapSource.js';
import { STYLES } from './effects.js';
import { isHudLayout } from '../hudLayouts.js';
import { isHudLayout, isLegacySonarHudLayout } from '../hudLayouts.js';
import {
getCyberSonarControlState,
setCyberSonarControls,
@@ -1390,17 +1390,18 @@ export class StyleManager extends ShellFacade {
}
/**
* Switches the HUD layout variant.
* Switches the HUD layout variant. The removed Cyber layout is accepted
* as an alias: it opens Tactical with the Sonar style on.
* @param {'tactical'|'minimal'|'cyber'} variantName - Layout variant.
* @returns {{ok: boolean, layout?: string, visible?: boolean, error?: string}}
*/
setHudLayout(variantName) {
const variant = String(variantName ?? '').toLowerCase();
if (!isHudLayout(variant)) {
if (!isHudLayout(variant) && !isLegacySonarHudLayout(variant)) {
return { ok: false, error: `Unknown HUD layout: ${variantName}` };
}
this.shareLinkManager?.claimRestoreLane?.('visual');
this._setHudVariant(variant, { applyVisualDefaults: true });
this._setHudVariant(variant);
return {
ok: true,
layout: this.hud.getVariant(),
@@ -1519,7 +1520,7 @@ export class StyleManager extends ShellFacade {
};
}
/** Apply Cyber-only sonar settings through the shared visual controls. */
/** Apply sonar visual-style settings through the shared visual controls. */
setCyberSonar(settings) {
return setCyberSonarControls(this, settings);
}
@@ -1655,8 +1656,6 @@ export class StyleManager extends ShellFacade {
* @param {string} styleName - Target style ('normal'|'retro'|'surveillance'|'thermal'|'anime'|'noir').
* @param {object} [options]
* @param {boolean} [options.applyPreset=true] - Whether to apply STYLE_PRESET_DEFAULTS for the new style.
* @param {boolean} [options.userInitiated=false] - Whether a direct user preset choice owns the Cyber exit style.
* @param {boolean} [options.preserveCyberRestore=false] - Whether an automatic style update keeps the Cyber entry snapshot.
* @returns {void}
*/
setStyle(
+4 -11
View File
@@ -1,5 +1,3 @@
import { displayPanelScroller } from './displayPanelScroll.js';
/**
* Show the existing Display groups in Cockpit's Display popover while Cockpit
* is on. The portal publishes the popover's slots; the Display panel
@@ -37,16 +35,13 @@ export class CockpitDisplayPortal {
this.slots = Object.freeze(
Object.fromEntries(this.records.map(({ name, slot }) => [name, slot])),
);
this.standardScrollTop =
displayPanelScroller(standardPanel)?.scrollTop || 0;
this.standardScrollTop = standardPanel?.scrollTop || 0;
this.cockpitScrollTop = cockpitPanel?.scrollTop || 0;
const options = { passive: true, signal: this.listeners.signal };
standardPanel?.addEventListener(
'scroll',
() => {
if (!this.active)
this.standardScrollTop =
displayPanelScroller(standardPanel).scrollTop;
if (!this.active) this.standardScrollTop = standardPanel.scrollTop;
},
{ ...options, capture: true },
);
@@ -98,8 +93,7 @@ export class CockpitDisplayPortal {
if (nextActive && this.cockpitPanel)
this.cockpitPanel.scrollTop = this.cockpitScrollTop;
if (!nextActive && this.standardPanel)
displayPanelScroller(this.standardPanel).scrollTop =
this.standardScrollTop;
this.standardPanel.scrollTop = this.standardScrollTop;
};
if (!settle) {
this.afterRender(() => {
@@ -146,8 +140,7 @@ export class CockpitDisplayPortal {
this.publish(null);
const { standardPanel, standardScrollTop } = this;
this.afterRender(() => {
if (standardPanel)
displayPanelScroller(standardPanel).scrollTop = standardScrollTop;
if (standardPanel) standardPanel.scrollTop = standardScrollTop;
});
this.records = [];
this.restoreOwner = null;
+3 -135
View File
@@ -2,7 +2,6 @@
import {
resolveCockpitUtilityAnchor,
resolveCockpitUtilityLayout,
resolveCyberCockpitPanelLane,
} from '../cockpitUtilityLayout.js';
import {
COCKPIT_UTILITY_REC_GAP_PX,
@@ -67,8 +66,6 @@ export function syncContextLayout() {
if (window.matchMedia('(max-width: 760px)').matches) {
this.context.dataset.layoutMode = 'compact-bottom';
this.context.style.removeProperty('--cockpit-context-left');
this.context.style.removeProperty('--cockpit-context-top');
this.context.style.removeProperty('--cockpit-context-max-height');
return;
}
@@ -78,56 +75,6 @@ export function syncContextLayout() {
'--cockpit-context-left',
`${desktopInset.toFixed(1)}px`,
);
if (document.documentElement.dataset.uiTheme !== 'cyber') {
this.context.style.removeProperty('--cockpit-context-top');
this.context.style.removeProperty('--cockpit-context-max-height');
return;
}
const defaultTop = Math.max(255, Math.min(300, window.innerHeight * 0.28));
// An open left panel Cockpit keeps (Data Layers or Utilities).
const dataPanel = document.querySelector(
'#left-panel-stack > :is(#data-panel, #utilities-panel):not(.collapsed)',
);
let desiredTop = defaultTop;
if (this.contextCollapsed && dataPanel) {
desiredTop = Math.max(
desiredTop,
dataPanel.getBoundingClientRect().bottom + 8,
);
}
const contextBounds = this.context.getBoundingClientRect();
let safeBottom = window.innerHeight - 24;
for (const selector of [
'#cesium-credits',
'#gev-credits',
'#command-dock',
'#view-switcher',
]) {
const obstacle = document.querySelector(selector);
if (!obstacle) continue;
const style = window.getComputedStyle(obstacle);
if (
style.display === 'none' ||
style.visibility === 'hidden' ||
Number(style.opacity) === 0
)
continue;
const bounds = obstacle.getBoundingClientRect();
const overlapsHorizontally =
bounds.right > contextBounds.left && bounds.left < contextBounds.right;
if (overlapsHorizontally && bounds.top > desiredTop) {
safeBottom = Math.min(safeBottom, bounds.top - 8);
}
}
const boundedTop = Math.max(
defaultTop,
Math.min(desiredTop, safeBottom - contextBounds.height),
);
this.context.style.setProperty(
'--cockpit-context-top',
`${boundedTop.toFixed(1)}px`,
);
this.context.style.removeProperty('--cockpit-context-max-height');
}
export function syncSignalLayout() {
@@ -138,8 +85,6 @@ export function syncSignalLayout() {
// The compact strip shows only an expanded control.
this.publishUtilityLayout(utilityLayoutView({ hideCollapsed: true }));
this.signalStream.style.removeProperty('--cockpit-signal-right');
this.signalStream.style.removeProperty('--cockpit-signal-top');
this.signalStream.style.removeProperty('--cockpit-signal-max-height');
return;
}
@@ -149,36 +94,6 @@ export function syncSignalLayout() {
'--cockpit-signal-right',
`${desktopInset.toFixed(1)}px`,
);
this.signalStream.style.removeProperty('--cockpit-signal-top');
this.signalStream.style.removeProperty('--cockpit-signal-max-height');
const cyber = document.documentElement.dataset.uiTheme === 'cyber';
const leftPanel = cyber
? document.querySelector('#left-panel-stack > #data-panel')
: null;
const alignedTop = isRenderedOnScreen(leftPanel)
? leftPanel.getBoundingClientRect().top
: null;
// Cyber's two rails share a top edge. Move the briefing below the collapsed
// strip rather than pulling the right rail upward to avoid it.
if (alignedTop !== null && utilityControls) {
const expanded = utilityControls.querySelector(
'.cockpit-utility-control.is-expanded',
);
if (!expanded) {
const signalTop = Math.max(
Math.max(255, Math.min(300, window.innerHeight * 0.28)),
alignedTop + utilityControls.getBoundingClientRect().height + 28,
);
this.signalStream.style.setProperty(
'--cockpit-signal-top',
`${signalTop.toFixed(1)}px`,
);
this.signalStream.style.setProperty(
'--cockpit-signal-max-height',
`${Math.max(44, window.innerHeight - signalTop - 80).toFixed(1)}px`,
);
}
}
const signalBounds = this.signalStream.getBoundingClientRect();
const utilityBounds = utilityControls?.getBoundingClientRect();
if (utilityBounds) {
@@ -203,42 +118,7 @@ export function syncSignalLayout() {
collapsedLauncher.scrollHeight,
)
: 0;
if (alignedTop !== null) {
const lane = resolveCyberCockpitPanelLane({
viewportHeight: window.innerHeight,
top: alignedTop,
launcherHeight: Math.max(
collapsedHeight,
collapsedLauncher?.getBoundingClientRect().height || 60,
),
signalHeight: this.signalCollapsed ? signalBounds.height : 44,
contactHeight:
this.contextCollapsed && this.context
? this.context.getBoundingClientRect().height
: 64,
});
document.body.style.setProperty(
'--cyber-cockpit-panel-height',
`${lane.panelHeight.toFixed(2)}px`,
);
this.publishUtilityLayout(
utilityLayoutView({
top: `${alignedTop.toFixed(2)}px`,
maxHeight: `${lane.utilityHeight.toFixed(2)}px`,
expandedMaxHeight: `${lane.panelHeight.toFixed(2)}px`,
}),
);
if (expandedControl) {
this.signalStream.style.setProperty(
'--cockpit-signal-top',
`${lane.signalTop.toFixed(2)}px`,
);
}
this.syncContextLayout();
return;
}
// Non-Cyber themes retain their independent REC/briefing corridor. Cyber
// uses the rendered Data Layers top after reserving briefing space above.
// The REC readout and the briefing card bound the utility corridor.
// The readout only anchors the strip while it is genuinely on screen:
// the Minimal variant drops it with `display:none`, but HUD Off hides the
// whole Intel HUD with `visibility`/`opacity`, which keeps its rect.
@@ -254,20 +134,8 @@ export function syncSignalLayout() {
collapsedHeight,
recGap: COCKPIT_UTILITY_REC_GAP_PX,
signalGap: COCKPIT_UTILITY_SIGNAL_GAP_PX,
minTopFloor: alignedTop ?? COCKPIT_UTILITY_MIN_TOP_PX,
minTopRatio: alignedTop !== null ? 0 : COCKPIT_UTILITY_MIN_TOP_RATIO,
signalCollapsed: this.signalCollapsed,
utilityExpanded: Boolean(expandedControl),
// Only Cyber relocates its collapsed briefing below the utility lane.
// Other themes keep the measured visible card as the lower boundary.
reserveViewportLane: document.documentElement.dataset.uiTheme === 'cyber',
// Cyber keeps the collapsed briefing reachable below the utility instead
// of hiding it. Reserve its actual height, including wrapped headings.
signalHeight:
document.documentElement.dataset.uiTheme === 'cyber' &&
this.signalCollapsed
? signalBounds.height
: 0,
minTopFloor: COCKPIT_UTILITY_MIN_TOP_PX,
minTopRatio: COCKPIT_UTILITY_MIN_TOP_RATIO,
});
const availableHeight = utilityAnchor.maxHeight;
const utilityLayout =
+3 -27
View File
@@ -379,7 +379,7 @@ test('the layout pass’s measured fit hides the collapsed control and marks the
app.unmount();
});
test('the real layout pass drives the mounted controls: compact hides the collapsed sibling, Cyber shows both', async (t) => {
test('the real layout pass drives the mounted controls: compact hides the collapsed sibling, desktop shows both', async (t) => {
document.body.replaceChildren();
const host = document.body.appendChild(document.createElement('div'));
const pinia = createPinia();
@@ -403,9 +403,6 @@ test('the real layout pass drives the mounted controls: compact hides the collap
window.matchMedia = (query) => ({ matches: compact, media: query });
t.after(() => {
window.matchMedia = originalMatchMedia;
delete document.documentElement.dataset.uiTheme;
document.body.style.removeProperty('opacity');
document.documentElement.style.removeProperty('opacity');
app.unmount();
});
const strip = document.getElementById('cockpit-utility-controls');
@@ -421,34 +418,13 @@ test('the real layout pass drives the mounted controls: compact hides the collap
assert.equal(cockpit.utilityLayout.top, null);
// Compact hides the sibling without marking the strip primary-only.
assert.equal(strip.classList.contains('layout-primary-only'), false);
// Cyber aligns the strip with the Data panel and keeps both controls.
// The desktop pass anchors the strip in its own corridor and keeps both.
compact = false;
document.documentElement.dataset.uiTheme = 'cyber';
const stack = document.body.appendChild(document.createElement('div'));
stack.id = 'left-panel-stack';
const dataPanel = stack.appendChild(document.createElement('section'));
dataPanel.id = 'data-panel';
for (const node of [
dataPanel,
stack,
document.body,
document.documentElement,
])
node.style.opacity = '1';
dataPanel.getBoundingClientRect = () => ({
top: 120,
bottom: 400,
left: 0,
right: 200,
width: 200,
height: 280,
});
syncSignalLayout.call(owner);
await nextTick();
assert.equal(display.getAttribute('aria-hidden'), 'false');
assert.equal(radioControl.getAttribute('aria-hidden'), 'false');
assert.equal(cockpit.utilityLayout.top, '120.00px');
assert.equal(strip.classList.contains('layout-primary-only'), false);
assert.match(cockpit.utilityLayout.top, /^\d+(\.\d+)?px$/);
});
test('the rail opens one panel at a time and reads as a disclosure', async (t) => {
+2 -3
View File
@@ -9,9 +9,8 @@ import { fileURLToPath } from 'node:url';
const HERE = path.dirname(fileURLToPath(import.meta.url));
const STYLES = path.join(HERE, 'styles');
const LOCALES = path.join(HERE, '..', 'i18n', 'locales');
// cyber.css carries decorative theme strings (LOC / GRID, SYS 06 // ...);
// street-level.css ' · ESC' is a key cap. Neither is UI copy.
const DECORATIVE = new Set(['cyber.css', 'street-level.css']);
// street-level.css ' · ESC' is a key cap, not UI copy.
const DECORATIVE = new Set(['street-level.css']);
test('no user-visible text in CSS content: outside decorative themes', () => {
const hits = [];
+4 -10
View File
@@ -38,7 +38,6 @@ export function getCyberSonarControlState(
intensityPct: settings.intensity,
opacityPct: settings.opacity,
sectorDeg: settings.sector,
cyberSelected: root?.dataset?.uiTheme === 'cyber',
mapSweepActive: isCyberSonarActive(options),
contactSweepActive:
root?.dataset?.cyberSonarGpu === 'supported' &&
@@ -59,10 +58,10 @@ export function setCyberSonarControls(
sonar: getCyberSonarControlState(doc, { hudActive: owner?.hud?.visible }),
});
if (!request || typeof request !== 'object' || Array.isArray(request)) {
return fail('Provide Cyber sonar settings as an object.');
return fail('Provide sonar settings as an object.');
}
const fields = Object.keys(request);
if (!fields.length) return fail('Provide at least one Cyber sonar setting.');
if (!fields.length) return fail('Provide at least one sonar setting.');
for (const field of fields) {
const value = request[field];
if (field === 'enabled') {
@@ -70,19 +69,14 @@ export function setCyberSonarControls(
continue;
}
if (!Object.hasOwn(SETTING_FIELDS, field)) {
return fail('Unknown Cyber sonar setting.');
return fail('Unknown sonar setting.');
}
const [, min, max] = SETTING_FIELDS[field];
if (!Number.isInteger(value) || value < min || value > max) {
return fail(`${field} must be an integer from ${min} to ${max}.`);
}
}
if (
owner.hud?.getVariant?.() !== 'cyber' ||
doc?.documentElement?.dataset?.uiTheme !== 'cyber'
) {
return fail('Cyber sonar controls require the Cyber HUD layout.');
}
owner.shareLinkManager?.claimRestoreLane?.('visual');
for (const [field, [setting]] of Object.entries(SETTING_FIELDS)) {
if (Object.hasOwn(request, field)) {
owner._setCyberSonarSetting(setting, request[field]);
+20 -9
View File
@@ -11,9 +11,9 @@ import { StyleManager } from './applicationShell.js';
import { VisualSettings } from './visualSettings.js';
import { readFileSync } from 'node:fs';
function fixture(theme = 'cyber') {
function fixture(layout = 'tactical') {
const root = {
dataset: { uiTheme: theme, cyberSonarGpu: 'supported' },
dataset: { cyberSonarGpu: 'supported' },
style: { setProperty() {} },
};
const flags = new Set();
@@ -27,7 +27,7 @@ function fixture(theme = 'cyber') {
};
const calls = [];
const owner = {
hud: { getVariant: () => theme },
hud: { getVariant: () => layout },
_setCyberSonarSetting(name, value) {
calls.push([name, value]);
const suffix = name[0].toUpperCase() + name.slice(1);
@@ -50,8 +50,15 @@ test('real runner and facade use visual settings, preserve visibility and return
visual.services = { governorRequestRender: (reason) => renders.push(reason) };
// No Display panel here: the controls' render is not under test.
visual._publishDisplay = () => {};
// The shell's share sync; a sonar change keeps the link current.
const shares = [];
visual._syncShareState = () => shares.push(true);
const owner = Object.create(StyleManager.prototype);
owner._visualSettings = visual;
const claims = [];
Object.defineProperty(owner, 'shareLinkManager', { value: {
claimRestoreLane: (lane) => claims.push({ lane, renders: renders.length }),
} });
Object.defineProperty(owner, 'hud', { value: f.owner.hud });
const viewer = {
camera: { moveEnd: { addEventListener() {} } },
@@ -65,19 +72,23 @@ test('real runner and facade use visual settings, preserve visibility and return
const runner = createGevActionRunner({ styleManager: owner, viewer, dataManager: {} });
const result = await runner('set_cyber_sonar', { enabled: false, intensityPct: 73, sectorDeg: 9 });
assert.equal(result.ok, true);
assert.deepEqual(claims, [{ lane: 'visual', renders: 0 }]);
assert.equal(result.sonar.intensityPct, 73);
assert.equal(result.sonar.sectorDeg, 9);
assert.equal(result.sonar.enabled, false);
assert.equal(f.root.dataset.uiTheme, 'cyber');
assert.equal(f.owner.hud.getVariant(), 'tactical');
assert.equal(f.hudFlags.has('active'), true);
assert.equal(renders.length, 3);
assert.equal(shares.length, 1);
const before = getCyberSonarControlState();
const invalid = await runner('set_cyber_sonar', { rings: 6, opacityPct: 0 });
assert.equal(invalid.ok, false);
assert.deepEqual(claims, [{ lane: 'visual', renders: 0 }], 'invalid requests claim no authority');
assert.deepEqual(getCyberSonarControlState(), before);
assert.equal(renders.length, 3);
const zero = await runner('set_cyber_sonar', { intensityPct: 0 });
assert.equal(zero.sonar.intensityPct, 0);
assert.deepEqual(claims.map(({ lane }) => lane), ['visual', 'visual']);
assert.equal(zero.sonar.enabled, false);
const unavailable = createGevActionRunner({ styleManager: {}, viewer, dataManager: {} });
assert.equal((await unavailable('set_cyber_sonar', { enabled: true })).ok, false);
@@ -136,11 +147,11 @@ test('rejects the whole invalid request before any mutation', () => {
}
});
test('requires Cyber and preserves off state and every omitted setting', () => {
for (const theme of ['tactical', 'minimal']) {
const f = fixture(theme);
assert.equal(setCyberSonarControls(f.owner, { enabled: true }, f.doc).ok, false);
assert.deepEqual(f.calls, []);
test('works under every HUD layout and preserves off state and every omitted setting', () => {
for (const layout of ['tactical', 'minimal']) {
const f = fixture(layout);
assert.equal(setCyberSonarControls(f.owner, { enabled: true }, f.doc).ok, true);
assert.deepEqual(f.calls, [['enabled', true]]);
}
const f = fixture();
f.root.dataset.cyberSonar = 'off';
-950
View File
@@ -1,950 +0,0 @@
import {
getScopeMaskFeather,
getScopeMaskOpacity,
isScopeMaskEnabled,
setScopeMaskEnabled,
setScopeMaskFeather,
setScopeMaskOpacity,
} from '../scopeMask.js';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import test from 'node:test';
import {
applyHudUiTheme,
CYBER_VISUAL_DEFAULTS,
cyberVisualDefaultsForHudTransition,
HUD_LAYOUTS,
normalizeHudLayout,
} from '../hudLayouts.js';
import { GEV_ACTION_SCHEMAS } from '../voice/actionSchemas.js';
import { createGevActionRunner } from '../voice/gevActions.js';
import { StyleManager } from './applicationShell.js';
import { createPinia } from 'pinia';
import { useDisplayStore } from './stores/display.js';
import { VisualSettings } from './visualSettings.js';
import { STYLES } from './visualPresets.js';
test('CCTV and Context keep their headers outside Cyber-only scroll bodies', () => {
for (const file of ['panels/CctvPanel.vue', 'ContextView.vue']) {
const markup = readFileSync(
new URL(`./views/${file}`, import.meta.url),
'utf8',
);
// The body wears the shared scrollbar skin where Cyber makes it scroll.
assert.match(
markup,
/class="cyber-panel-body ui-scroll" data-rail-scroller/,
);
assert.ok(
// The header is RailPanel's; the body is its first content.
markup.indexOf('<RailPanel ') > -1 &&
markup.indexOf('<RailPanel ') <
markup.indexOf('class="cyber-panel-body ui-scroll"'),
);
}
const shared = readFileSync(
new URL('./styles/controls.css', import.meta.url),
'utf8',
);
const cyber = readFileSync(
new URL('./styles/cyber.css', import.meta.url),
'utf8',
);
assert.match(shared, /\.cyber-panel-body\s*\{\s*display: contents;/);
assert.match(
cyber,
/:root\[data-ui-theme='cyber'\] \.cyber-panel-body\s*\{[^}]*overflow-y: auto;[^}]*overscroll-behavior: contain;/,
);
});
function styleOwner(t, initialVariant = 'cyber') {
const previous = { document: globalThis.document, window: globalThis.window };
const root = { dataset: {} };
globalThis.document = { documentElement: root, querySelectorAll: () => [] };
globalThis.window = { dispatchEvent() {} };
t.after(() => Object.assign(globalThis, previous));
let variant = initialVariant;
const calls = [];
const hud = {
getVariant: () => variant,
setVariant: (value) => {
// Normalize like the real HUD so retired layouts fall back.
variant = normalizeHudLayout(value);
applyHudUiTheme(root, variant);
},
setMode: (value) => calls.push(['mode', value]),
onStyleChange: (value) => calls.push(['style', value]),
};
hud.setVariant(initialVariant);
const owner = Object.create(VisualSettings.prototype);
Object.assign(owner, {
activeStyle: 'normal',
store: { publish() {} },
readHud: () => hud,
readShareLinks: () => ({ onStyleChange() {} }),
_visualEffects: {
stages: Object.fromEntries(
Object.entries(STYLES).map(([name, config]) => [
name,
{ uniforms: { ...config.uniforms, intensity: 0 } },
]),
),
},
services: { governorRequestRender() {}, setDetectionStyle() {} },
_setBloomEnabled: (value) => calls.push(['bloom', value]),
_setSharpenEnabled: (value) => calls.push(['sharpen', value]),
_applyDetectionPreset: (value) => calls.push(['detection', value]),
_syncShareState: () => calls.push(['share', variant]),
});
for (const name of [
'setCelestialRingEnabled',
'_startTransition',
'_publishActiveStyle',
'_updateSliderPanel',
'_updateHudButtonState',
'_syncIrBoost',
'_syncCockpitInheritedStyle',
'_syncCyberSonarControl',
'_scheduleAdaptivePanelLayout',
'_setDetectionFade',
// Intensities: the fixture has no post-process stages to drive.
'_setBloomIntensity',
'_setSharpenIntensity',
])
owner[name] = () => {};
return { owner, hud, root, calls };
}
test('visual styles retain Cyber through real preset application without dropping other defaults', (t) => {
const { owner, hud, root, calls } = styleOwner(t);
for (const style of [
'surveillance',
'normal',
'noir',
'anime',
'thermal',
'retro',
]) {
owner.setStyle(style);
assert.equal(owner.activeStyle, style);
assert.equal(hud.getVariant(), 'cyber');
assert.equal(root.dataset.uiTheme, 'cyber');
assert.deepEqual(calls.at(-1), ['share', 'cyber']);
}
assert.equal(owner.stages.thermal.uniforms.sensitivity, 0.85);
assert.equal(calls.filter(([name]) => name === 'detection').length, 3);
assert.equal(
calls.filter(([name, value]) => name === 'bloom' && value === false).length,
3,
);
assert.equal(
calls.filter(([name, value]) => name === 'sharpen' && value === true)
.length,
3,
);
});
test('non-Cyber style presets and explicit HUD choices remain authoritative', (t) => {
const { owner, hud, root } = styleOwner(t);
for (const variant of ['tactical', 'minimal']) {
owner._setHudVariant(variant);
assert.equal(hud.getVariant(), variant);
assert.equal(root.dataset.uiTheme, undefined);
owner.setStyle('normal');
owner.setStyle('surveillance');
assert.equal(hud.getVariant(), 'tactical');
}
});
test('leaving Cyber without a preset choice restores the prior visual preset', (t) => {
const { owner, hud } = styleOwner(t, 'tactical');
owner.setStyle('noir');
owner._setHudVariant('cyber', { applyVisualDefaults: true });
assert.equal(owner.activeStyle, 'thermal');
assert.equal(owner._preCyberStyle, 'noir');
assert.equal(owner._cyberStyleUserSelected, false);
owner._setHudVariant('minimal', { applyVisualDefaults: true });
assert.equal(hud.getVariant(), 'minimal');
assert.equal(owner.activeStyle, 'noir');
assert.equal(owner._preCyberStyle, null);
assert.equal(owner._cyberStyleUserSelected, false);
});
test('a preset explicitly selected in Cyber survives exit and resets for re-entry', (t) => {
const { owner, hud } = styleOwner(t, 'tactical');
owner.setStyle('noir');
owner._setHudVariant('cyber', { applyVisualDefaults: true });
owner.setStyle('anime', { userInitiated: true });
assert.equal(owner.activeStyle, 'anime');
assert.equal(owner._preCyberStyle, 'noir');
assert.equal(owner._cyberStyleUserSelected, true);
// Reselecting the active mode must not erase the user's preset intent.
owner._setHudVariant('cyber', { applyVisualDefaults: true });
assert.equal(owner._preCyberStyle, 'noir');
owner._setHudVariant('minimal', { applyVisualDefaults: true });
assert.equal(hud.getVariant(), 'minimal');
assert.equal(owner.activeStyle, 'anime');
assert.equal(owner._preCyberStyle, null);
assert.equal(owner._cyberStyleUserSelected, false);
// A later untouched Cyber round trip restores the new pre-Cyber preset.
owner._setHudVariant('cyber', { applyVisualDefaults: true });
assert.equal(owner.activeStyle, 'thermal');
assert.equal(owner._preCyberStyle, 'anime');
owner._setHudVariant('minimal', { applyVisualDefaults: true });
assert.equal(owner.activeStyle, 'anime');
});
test('an explicit same-value FLIR choice is preserved on Cyber exit', (t) => {
const { owner } = styleOwner(t, 'tactical');
owner.setStyle('noir');
owner._setHudVariant('cyber', { applyVisualDefaults: true });
owner.setStyle('thermal', { userInitiated: true });
assert.equal(owner.activeStyle, 'thermal');
assert.equal(owner._cyberStyleUserSelected, true);
owner._setHudVariant('minimal', { applyVisualDefaults: true });
assert.equal(owner.activeStyle, 'thermal');
});
test('an authoritative same-Cyber reset clears local preset ownership', (t) => {
const { owner } = styleOwner(t, 'tactical');
owner.setStyle('noir');
owner._setHudVariant('cyber', { applyVisualDefaults: true });
owner.setStyle('anime', { userInitiated: true });
assert.equal(owner._cyberStyleUserSelected, true);
owner._setHudVariant('cyber');
assert.equal(owner.activeStyle, 'anime');
assert.equal(owner._preCyberStyle, null);
assert.equal(owner._cyberStyleUserSelected, false);
owner._setHudVariant('minimal', { applyVisualDefaults: true });
assert.equal(owner.activeStyle, 'anime');
});
test('Display and voice HUD routes preserve explicit Cyber entry and exit authority', async (t) => {
const makeOwner = () => {
const { owner, hud } = styleOwner(t, 'tactical');
owner.setStyle('noir');
owner.setHudLayout = (...args) =>
StyleManager.prototype.setHudLayout.call(owner, ...args);
owner.getControlState = () => ({
hud: { layout: hud.getVariant(), visible: true },
});
return { owner, hud };
};
const display = makeOwner();
// The Display panel's layout select and the dock's style buttons call
// these actions through the display store.
const store = useDisplayStore(createPinia());
const token = store.connect({
setHudLayout: (value) => display.owner.setHudLayout(value),
setStyle: (value) => display.owner.setStyle(value, { userInitiated: true }),
});
store.act('setHudLayout', 'cyber');
assert.equal(display.hud.getVariant(), 'cyber');
assert.equal(display.owner.activeStyle, 'thermal');
store.act('setStyle', 'anime');
assert.equal(display.owner.activeStyle, 'anime');
store.act('setHudLayout', 'minimal');
assert.equal(display.hud.getVariant(), 'minimal');
assert.equal(display.owner.activeStyle, 'anime');
store.detach(token);
const voice = makeOwner();
const eventSource = { addEventListener() {}, removeEventListener() {} };
const viewer = {
camera: { moveEnd: { addEventListener() {} } },
clock: { onTick: { addEventListener: () => () => {} } },
canvas: eventSource,
scene: { canvas: eventSource },
};
const runVoiceAction = createGevActionRunner({
viewer,
styleManager: voice.owner,
dataManager: {},
});
const entered = await runVoiceAction('set_hud', { layout: 'cyber' });
assert.equal(entered.ok, true);
assert.equal(voice.hud.getVariant(), 'cyber');
assert.equal(voice.owner.activeStyle, 'thermal');
const selected = await runVoiceAction('set_visual_style', { style: 'anime' });
assert.equal(selected.ok, true);
assert.equal(voice.owner.activeStyle, 'anime');
const exited = await runVoiceAction('set_hud', { layout: 'minimal' });
assert.equal(exited.ok, true);
assert.equal(voice.hud.getVariant(), 'minimal');
assert.equal(voice.owner.activeStyle, 'anime');
});
test('scope choice and expanded feather survive every HUD layout and both restore paths', async (t) => {
const { owner } = styleOwner(t, 'tactical');
const previous = { enabled: isScopeMaskEnabled(), feather: getScopeMaskFeather() };
t.after(() => { setScopeMaskEnabled(previous.enabled); setScopeMaskFeather(previous.feather); });
Object.assign(owner.services, { setScopeMaskEnabled, setScopeMaskFeather });
let shown = null;
owner.store = { publish: (view) => (shown = view.scope) };
await owner.restoreShareState({ scopeEnabled: false, scopeFeatherPct: 200 });
assert.deepEqual(shown, { enabled: false, featherPct: 200, opacityPct: 100 });
for (const layout of ['minimal', 'cyber', 'tactical']) {
owner._setHudVariant(layout, { applyVisualDefaults: true });
assert.equal(isScopeMaskEnabled(), false, layout);
assert.equal(getScopeMaskFeather(), 2, layout);
assert.equal(shown.enabled, false, layout);
}
await owner.applyVisualState({ scope: { enabled: true, featherPct: 175 } });
assert.equal(isScopeMaskEnabled(), true);
assert.equal(getScopeMaskFeather(), 1.75);
assert.deepEqual(shown, { enabled: true, featherPct: 175, opacityPct: 100 });
await owner.applyVisualState({ scope: { featherPct: 500 } });
assert.equal(getScopeMaskFeather(), 2);
assert.deepEqual(shown, { enabled: true, featherPct: 200, opacityPct: 100 });
});
test('a shared scope opacity is restored and rides in the next share state', async (t) => {
const { owner } = styleOwner(t, 'tactical');
const previous = getScopeMaskOpacity();
t.after(() => setScopeMaskOpacity(previous));
Object.assign(owner.services, {
setScopeMaskEnabled() {},
setScopeMaskFeather() {},
setScopeMaskOpacity,
});
let shown = null;
owner.store = { publish: (view) => (shown = view.scope) };
await owner.restoreShareState({ scopeOpacityPct: 60 });
assert.equal(getScopeMaskOpacity(), 0.6);
assert.equal(shown.opacityPct, 60);
// A state without it leaves the opacity alone.
await owner.restoreShareState({ scopeFeatherPct: 80 });
assert.equal(getScopeMaskOpacity(), 0.6);
assert.equal(shown.opacityPct, 60);
Object.assign(owner.services, {
getDetectionTuning: () => ({ allocationStrategy: 'ELASTIC' }),
getDetectionMode: () => 'OFF',
isScopeMaskEnabled: () => true,
getScopeMaskFeather: () => 0.8,
getScopeMaskOpacity,
getScopeTerminusOverride: () => null,
});
owner.readCelestialRing = () => null;
assert.equal(owner._readShareState().options.scopeOpacityPct, 60);
// A link asking for less than the floor opens at the floor, and says so.
await owner.restoreShareState({ scopeOpacityPct: 20 });
assert.equal(getScopeMaskOpacity(), 0.5);
assert.equal(owner._readShareState().options.scopeOpacityPct, 50);
});
test('a scene shot saved with the retired Snow style plays on Normal', async (t) => {
const { owner } = styleOwner(t, 'tactical');
owner.setStyle('noir');
await owner.applyVisualState({ style: 'snow' });
assert.equal(owner.activeStyle, 'normal');
});
test('scene and share HUD transitions do not restore a local pre-Cyber preset', async (t) => {
const { owner, hud } = styleOwner(t, 'tactical');
owner.setStyle('noir');
owner._setHudVariant('cyber', { applyVisualDefaults: true });
owner.setStyle('anime', { userInitiated: true });
assert.equal(owner._cyberStyleUserSelected, true);
await owner.applyVisualState({ style: 'retro', hud: { variant: 'cyber' } });
assert.equal(hud.getVariant(), 'cyber');
assert.equal(owner.activeStyle, 'retro');
assert.equal(owner._preCyberStyle, null);
assert.equal(owner._cyberStyleUserSelected, false);
owner._setHudVariant('minimal', { applyVisualDefaults: true });
assert.equal(owner.activeStyle, 'retro');
owner.setStyle('surveillance');
owner._setHudVariant('cyber', { applyVisualDefaults: true });
assert.equal(owner._preCyberStyle, 'surveillance');
owner.setStyle('anime', { userInitiated: true });
await owner.restoreShareState({
style: 'thermal',
hudVariant: 'cyber',
});
assert.equal(hud.getVariant(), 'cyber');
assert.equal(owner.activeStyle, 'thermal');
assert.equal(owner._preCyberStyle, null);
assert.equal(owner._cyberStyleUserSelected, false);
owner._setHudVariant('tactical', { applyVisualDefaults: true });
assert.equal(owner.activeStyle, 'thermal');
assert.equal(owner._preCyberStyle, null);
});
test('scene and share restoration override Cyber and preserve restored Cyber parameters', async (t) => {
const { owner, hud } = styleOwner(t);
await owner.applyVisualState({ style: 'retro', hud: { variant: 'minimal' } });
assert.equal(hud.getVariant(), 'minimal');
owner._setHudVariant('cyber');
await owner.restoreShareState({
style: 'surveillance',
hudVariant: 'operator',
});
// A link saved with the retired Operator layout restores as Tactical.
assert.equal(hud.getVariant(), 'tactical');
await owner.restoreShareState({
style: 'thermal',
hudVariant: 'cyber',
styleParams: { palette: 0.73 },
});
assert.equal(hud.getVariant(), 'cyber');
assert.equal(owner.activeStyle, 'thermal');
assert.equal(owner.stages.thermal.uniforms.palette, 0.73);
owner._setHudVariant('cyber', { applyVisualDefaults: true });
assert.equal(owner.stages.thermal.uniforms.palette, 0.73);
owner._setHudVariant('tactical');
owner._setHudVariant('cyber', { applyVisualDefaults: true });
assert.equal(owner.stages.thermal.uniforms.palette, 0.42);
});
const read = (relative) =>
readFileSync(new URL(relative, import.meta.url), 'utf8');
test('Cyber setup uses a compact toolbar icon and highlights the north-up letter', () => {
const css = read('./styles/cyber.css');
assert.match(
css,
/#top-center-actions #key-setup-chip\s*\{[^}]*inset: auto;[^}]*width: 36px;/,
);
assert.match(css, /#key-setup-chip\[hidden\]\s*\{\s*display: none;/);
assert.match(
css,
/#north-up-view\[data-north-up='true'\]\s+\.camera-compass-n\s*\{[^}]*color: var\(--cyber-red-bright\)/,
);
});
const cyberStyles = read('./styles/cyber.css');
// Source guards supplement rendered popup/hit-target checks. Inspect one rule
// at a time so a safe declaration on a child cannot excuse a clipped ancestor.
function cssRuleBody(styles, selector) {
const match = styles.match(new RegExp(`${selector.source}\\s*\\{([^}]+)\\}`));
assert.ok(match, `Missing CSS rule: ${selector.source}`);
return match[1];
}
test('Cyber Voice clips its decoration without clipping descendant help and errors', () => {
const owner = cssRuleBody(
cyberStyles,
/:root\[data-ui-theme='cyber'\] #command-dock > #gev-voice-control/,
);
assert.match(owner, /isolation:\s*isolate;/);
assert.match(owner, /overflow:\s*visible;/);
assert.match(owner, /clip-path:\s*none;/);
const decoration = cssRuleBody(
cyberStyles,
/:root\[data-ui-theme='cyber'\] #command-dock > #gev-voice-control::before/,
);
assert.match(decoration, /clip-path:\s*polygon\(/);
assert.match(decoration, /pointer-events:\s*none;/);
assert.match(decoration, /inset:\s*0;/);
assert.match(decoration, /z-index:\s*-1;/);
});
test('Cyber dock pins escape the tray mask and its decoration overrides the legacy arrow geometry', () => {
const owner = cssRuleBody(
cyberStyles,
/:root\[data-ui-theme='cyber'\] #command-dock \.dock-popover-content/,
);
assert.match(owner, /clip-path:\s*none;/);
assert.match(owner, /isolation:\s*isolate;/);
// Including the tray owners beats #control-panel's more specific old
// ::after arrow positioning. Otherwise left:auto can collapse the frame.
const decoration = cssRuleBody(
cyberStyles,
/:root\[data-ui-theme='cyber'\]\s+#command-dock\s+:is\(#location-bar, #control-panel\)\s+\.dock-popover-content::after/,
);
assert.match(decoration, /inset:\s*0;/);
assert.match(decoration, /width:\s*auto;/);
assert.match(decoration, /height:\s*auto;/);
assert.match(decoration, /transform:\s*none;/);
assert.match(decoration, /clip-path:\s*var\(--cyber-panel-frame\);/);
assert.match(decoration, /pointer-events:\s*none;/);
});
test('Cyber lower-left telemetry tracks the credit anchor with clearance for its logo row', () => {
const telemetry = cssRuleBody(
cyberStyles,
/#intel-hud\[data-variant='cyber'\] \.hud-bottom-left/,
);
const offset = telemetry.match(/bottom:\s*calc\(2vh \+ ([\d.]+)rem \+ var\(--world-timeline-lift, 0px\)\);/);
assert.ok(offset, 'telemetry must retain the attribution viewport anchor');
const credits = read('./styles/command-dock-trays.css');
const creditOffsets = [
...credits.matchAll(
/#cesium-credits\s*\{[^}]*bottom:\s*calc\(2vh \+ ([\d.]+)rem \+ var\(--world-timeline-lift, 0px\)\);/g,
),
];
assert.ok(creditOffsets.length > 0);
for (const credit of creditOffsets) {
assert.ok(
Number(offset[1]) - Number(credit[1]) >= 2.75,
'reserve the 28px logo row, baseline descent and 12px clearance at the 16px root size',
);
}
assert.doesNotMatch(cyberStyles, /\.hud-bottom-left\s*\{\s*bottom:\s*60px;/);
});
test('shared panel hooks affect only opted-in rail surfaces without overriding disclosure and concealment', () => {
const styles = read('./styles/panel-surfaces.css');
const rail = cssRuleBody(
styles,
/:is\(#left-panel-stack, #right-context-rail\)\s+> \[data-panel-id\]:has\(> \[data-panel-surface\]\)/,
);
assert.match(rail, /pointer-events:\s*auto;/);
assert.doesNotMatch(rail, /(?:display|visibility):/);
assert.doesNotMatch(
styles,
/:is\(#left-panel-stack, #right-context-rail\)\s*> \[data-panel-id\]\s*\{/,
);
assert.match(
styles,
/\[data-panel-surface\]:not\(\[hidden\]\):not\(dialog:not\(\[open\]\)\)\s*\{\s*display: flex;/,
);
assert.match(
styles,
/dialog\[data-panel-surface\]:not\(\[open\]\)\s*\{\s*display: none !important;/,
);
assert.match(
styles,
/body:is\(\.ui-clean-view, \.recording-mode\)[^{]+\{[^}]*visibility: hidden !important;[^}]*pointer-events: none !important;/,
);
});
test('Cyber clipped expand controls retain an inset keyboard-focus outline in map and cockpit', () => {
assert.match(
cyberStyles,
/:root\[data-ui-theme='cyber'\]\s+:is\(\s*\.panel-collapse-btn,\s*body\.cockpit-mode \.cockpit-utility-glyph\s*\):focus-visible\s*\{[^}]*outline: 2px solid var\(--cyber-red-bright\) !important;[^}]*outline-offset: -3px;[^}]*box-shadow: none;/,
);
assert.match(
cyberStyles,
/:root\[data-ui-theme='cyber'\]\s+:is\(\.panel-collapse-btn, body\.cockpit-mode \.cockpit-utility-glyph\):is\(\s*:hover,\s*:focus-visible\s*\)\s*\{[^}]*border-color: var\(--cyber-red-bright\);/,
);
});
test('Cyber Radio retains upstream nested Context ownership', () => {
assert.doesNotMatch(cyberStyles, /#right-context-rail\s*>\s*#radio-panel/);
});
test('Cyber cockpit launchers share Data Layers frame and expand-control treatment', () => {
assert.match(
cyberStyles,
/:is\(\.panel-collapse-btn, body\.cockpit-mode \.cockpit-utility-glyph\)/,
);
assert.match(
cyberStyles,
/body\.cockpit-mode \.cockpit-utility-launcher \{[^}]*width: var\(--cyber-panel-width\);[^}]*min-height: 60px;[^}]*clip-path: var\(--cyber-panel-frame\);/,
);
assert.match(
cyberStyles,
/\.cockpit-utility-glyph::after \{\s*content: '\+';/,
);
assert.match(
cyberStyles,
/\.cockpit-utility-glyph\[aria-expanded='true'\]::after \{\s*content: '−';/,
);
assert.match(
cyberStyles,
/\.cockpit-utility-control\.is-expanded\s+\.cockpit-utility-launcher \{[^}]*width: 100%;[^}]*clip-path: none;/,
);
});
test('Cyber side panels share one width and one framed surface material', () => {
assert.match(cyberStyles, /--cyber-panel-width: 272px;/);
assert.match(cyberStyles, /--cyber-right-panel-width: 312px;/);
assert.match(cyberStyles, /--cyber-panel-collapsed-width: 200px;/);
assert.match(cyberStyles, /--cyber-panel-control-size: 30px;/);
assert.match(
cyberStyles,
/--cyber-panel-surface: rgba\(18, 24, 27, 0\.92\);/,
);
assert.match(
cyberStyles,
/\.cockpit-utility-control\.is-expanded \{[\s\S]*?width: var\(--cyber-right-panel-width\);[\s\S]*?background-color: var\(--cyber-panel-surface\);[\s\S]*?background-image: var\(--cyber-panel-surface-detail\);[\s\S]*?clip-path: var\(--cyber-panel-frame\);/,
);
assert.match(
cyberStyles,
/\.cockpit-utility-control\.is-expanded::after \{[\s\S]*?width: 36px;[\s\S]*?border-top: 1px solid rgba\(225, 102, 102, 0\.84\);/,
);
assert.match(
cyberStyles,
/#global-context-panel #radio-panel\.collapsed \{\s*width: 100%;/,
);
assert.match(
cyberStyles,
/#left-panel-stack\s*> :is\(#data-panel, #utilities-panel, #scene-panel\)\.collapsed \{\s*width: var\(--cyber-panel-collapsed-width\);/,
);
assert.match(
cyberStyles,
/:is\(#data-panel, #utilities-panel, #scene-panel\)\.collapsed\s+:is\(\.data-panel-inner, \.utilities-panel-inner, \.scene-panel-inner\) \{[\s\S]*?height: 50px;[\s\S]*?min-height: 50px;/,
);
assert.match(
cyberStyles,
/\.cockpit-utility-control:not\(\.is-expanded\)\s+\.cockpit-utility-launcher \{\s*width: var\(--cyber-panel-collapsed-width\);/,
);
assert.match(
cyberStyles,
/#pp-toggles\s*> \.pp-header-row\s+\.pp-collapse-btn \{[\s\S]*?width: var\(--cyber-panel-control-size\);[\s\S]*?height: var\(--cyber-panel-control-size\);/,
);
assert.match(
cyberStyles,
/#right-context-rail\s+:is\(\s*\.cctv-panel-inner,\s*\.weather-panel-inner,\s*\.recent-imagery-panel-inner,\s*\.street-level-panel-inner,\s*\.global-context-panel-inner\s*\) \{\s*padding-inline-end: 8px;/,
);
assert.match(
cyberStyles,
/#right-context-rail[\s\S]*?:is\(\s*#cctv-panel,\s*#weather-panel,\s*#recent-imagery-panel,\s*#street-level-panel,\s*#global-context-panel\s*\)\.collapsed[\s\S]*?> \.panel-header \{[\s\S]*?height: 48px;[\s\S]*?padding: 0 10px 0 14px;/,
);
assert.doesNotMatch(
cyberStyles,
/\.cockpit-utility-control\.is-expanded\s*\{[^}]*order:/,
'expanded Cockpit utilities must retain Display-then-Radio DOM order',
);
});
test('Cyber is a canonical HUD layout with a safe Tactical fallback', () => {
assert.deepEqual(HUD_LAYOUTS, ['tactical', 'minimal', 'cyber']);
assert.equal(normalizeHudLayout('CYBER'), 'cyber');
assert.equal(normalizeHudLayout('operator'), 'tactical');
assert.equal(normalizeHudLayout('unknown'), 'tactical');
});
test('the Cyber HUD owns the global shell skin and leaving it restores defaults', () => {
const root = { dataset: { unrelated: 'preserved' } };
assert.equal(applyHudUiTheme(root, 'cyber'), 'cyber');
assert.equal(root.dataset.uiTheme, 'cyber');
assert.equal(applyHudUiTheme(root, 'minimal'), null);
assert.equal(root.dataset.uiTheme, undefined);
assert.equal(root.dataset.unrelated, 'preserved');
});
test('an explicit transition into Cyber selects FLIR with Ironbow 0.42 once', () => {
assert.deepEqual(CYBER_VISUAL_DEFAULTS, {
style: 'thermal',
ironbow: 0.42,
});
assert.equal(
cyberVisualDefaultsForHudTransition('tactical', 'cyber', {
explicit: true,
}),
CYBER_VISUAL_DEFAULTS,
);
assert.equal(
cyberVisualDefaultsForHudTransition('cyber', 'cyber', {
explicit: true,
}),
null,
);
assert.equal(cyberVisualDefaultsForHudTransition('tactical', 'cyber'), null);
assert.equal(
cyberVisualDefaultsForHudTransition('cyber', 'minimal', {
explicit: true,
}),
null,
);
});
test('Cyber visual defaults update the style, thermal palette and render state', () => {
const calls = [];
const owner = {
stages: { thermal: { uniforms: { palette: 0 } } },
services: {
governorRequestRender: (reason) => calls.push(['render', reason]),
},
setStyle: (style, options) => calls.push(['style', style, options]),
_updateSliderPanel: (style, options) =>
calls.push(['sliders', style, options]),
};
VisualSettings.prototype._applyCyberVisualDefaults.call(
owner,
CYBER_VISUAL_DEFAULTS,
);
assert.equal(owner.stages.thermal.uniforms.palette, 0.42);
assert.deepEqual(calls, [
[
'style',
'thermal',
{
applyPreset: false,
revealParameters: false,
preserveCyberRestore: true,
},
],
['sliders', 'thermal', { reveal: false }],
['render', 'cyber-visual-defaults'],
]);
});
test('the Display selector, voice schema and final stylesheet expose Cyber', () => {
const display = read('./views/panels/DisplayPanel.vue');
const stylesheet = read('../../style.css');
const rightRail = read('./rightPanelRail.js');
const hud = read('../hud.js');
const hudView = read('./views/IntelHudView.vue');
const detection = read('../data/detection.js');
const aircraftModels = read('../data/aircraftModelLayer.js');
const setHud = GEV_ACTION_SCHEMAS.find((schema) => schema.name === 'set_hud');
assert.match(display, /<option value="cyber">\{\{ t\('Cyber'\) \}\}<\/option>/);
assert.match(display, /id="cyber-sonar-toggle"/);
assert.match(
display,
/id="cyber-sonar-opacity"[^>]*:model-value="sonar\?\.opacity \?\? 84" :aria-label="t\('Cyber contact and label opacity'\)"/,
);
assert.match(display, /id="cyber-sonar-sector"/);
assert.deepEqual(setHud.parameters.properties.layout.enum, HUD_LAYOUTS);
assert.match(stylesheet, /@import '\.\/src\/ui\/styles\/cyber\.css';\s*$/);
assert.match(cyberStyles, /:root\[data-ui-theme='cyber'\]/);
assert.match(cyberStyles, /\.material-symbols-outlined/);
assert.match(cyberStyles, /\.pp-label/);
assert.match(cyberStyles, /#intel-hud\[data-variant='cyber'\]/);
assert.match(cyberStyles, /#left-panel-stack/);
assert.match(cyberStyles, /#right-context-rail/);
assert.match(cyberStyles, /#command-dock/);
assert.match(cyberStyles, /--cyber-panel-frame: polygon/);
assert.match(cyberStyles, /\.data-panel-inner,/);
assert.match(cyberStyles, /#pp-toggles\.collapsed > \.pp-header-row/);
assert.match(
cyberStyles,
/\.panel-collapsible:not\(#location-bar\):not\(#control-panel\)::after/,
);
assert.match(cyberStyles, /clip-path: var\(--cyber-panel-frame\);/);
assert.match(hudView, /class="hud-sonar" aria-hidden="true"/);
assert.match(cyberStyles, /\.hud-sonar::before/);
assert.match(cyberStyles, /\.hud-sonar::after/);
assert.match(cyberStyles, /@keyframes cyber-sonar-sweep/);
assert.match(
cyberStyles,
/animation-delay:\s*var\(--cyber-sonar-phase-delay, 0ms\)/,
);
assert.doesNotMatch(cyberStyles, /--cyber-sonar-angle/);
assert.match(cyberStyles, /prefers-reduced-motion: reduce/);
assert.match(detection, /candidate\.sonarFactor \?\? 1/);
assert.match(detection, /sonarActive && !obj\.skipLabel/);
assert.match(detection, /const bracketAlpha = admissionAlpha \* sonarFactor/);
assert.match(detection, /sonarSampler\.label\(sonarFactor\)/);
assert.match(detection, /createCyberSonarSampler\(width, height, now\)/);
assert.match(cyberStyles, /data-cyber-sonar='off'/);
assert.match(detection, /governorRequestRender\('cyber-sonar-cadence'\)/);
assert.match(
detection,
/const animatingCount = countAnimatingRenderEntries\(renderEntries\);/,
);
assert.doesNotMatch(detection, /sonarActive \? 1 : 0/);
assert.match(
aircraftModels,
/alpha: state\._irBoost\s*\?\s*1\s*:\s*aircraftTreatmentAlpha\(/,
);
assert.match(
cyberStyles,
/#title-bar \.title-logo #globe \{[\s\S]*?fill: var\(--cyber-red\);[\s\S]*?stroke: var\(--cyber-red-bright\);/,
);
assert.match(cyberStyles, /#title-bar \.title-logo #globe_cage/);
assert.match(
cyberStyles,
/#top-center-actions button\s*\{[\s\S]*?border-radius:\s*0;[\s\S]*?clip-path:\s*polygon\(\s*29% 0,\s*71% 0,[\s\S]*?0 29%\s*\);/,
);
assert.match(cyberStyles, /#top-center-actions button::before/);
assert.match(cyberStyles, /\.hud-top-left/);
assert.match(cyberStyles, /transparent 0 min\(40vw, 52vh\)/);
assert.match(cyberStyles, /\.hud-bottom-bar \{\s*display: none;/);
assert.doesNotMatch(cyberStyles, /\.hud-top-bar/);
// Cyber shares the measured rail/credit keep-out rather than overriding it.
assert.doesNotMatch(
cyberStyles,
/#right-context-rail\s*\{[^}]*\b(?:top|bottom|height|max-height):/,
);
assert.match(cyberStyles, /--cyber-hud-card-top: max\(100px, 10\.25vh\);/);
assert.match(
cyberStyles,
/--cyber-left-rail-top: max\([\s\S]*?220px,[\s\S]*?calc\(var\(--cyber-hud-card-top\) \+ 120px\)/,
);
assert.match(
cyberStyles,
/\.hud-top-left \{[\s\S]*?top: var\(--cyber-hud-card-top\);/,
);
assert.match(
cyberStyles,
/#left-panel-stack \{[\s\S]*?top: var\(--cyber-left-rail-top\) !important;[\s\S]*?bottom: calc\(2vh \+ 13rem \+ var\(--world-timeline-lift, 0px\)\);/,
);
assert.match(
cyberStyles,
/\.hud-left-edge \{\s*top: calc\(var\(--cyber-left-rail-top\) - 18px\);\s*left: 14px;/,
);
assert.match(
rightRail,
/const leftStackTop = settledLeftRailTop\([\s\S]*?const alignedTop = Number\.isFinite\(leftStackTop\)[\s\S]*?baseTop: alignedTop,/,
);
assert.match(
cyberStyles,
/--right-display-collapsed-width: var\(--cyber-panel-collapsed-width\);/,
);
assert.match(
cyberStyles,
/clip-path: polygon\([\s\S]*?12px 0,[\s\S]*?0 12px/,
);
assert.match(cyberStyles, /\.hud-corner::before/);
assert.match(
cyberStyles,
/--cyber-telemetry-fill: rgba\(13, 20, 23, 0\.985\);/,
);
assert.match(cyberStyles, /var\(--cyber-telemetry-fill\)/);
assert.match(cyberStyles, />\s*\.panel-header\s+\.panel-title::before/);
assert.match(cyberStyles, /\.panel-collapsible\.collapsed::after/);
assert.match(cyberStyles, /\.panel-collapsible:not\(\.collapsed\)::after/);
assert.match(cyberStyles, /\.context-mode-standby:not\(\[hidden\]\)/);
// The base standby is borderless plain text, so the focus card must name its
// own frame width and centring rather than inherit them.
assert.match(
cyberStyles,
/\.context-mode-standby:not\(\[hidden\]\) \{[^}]*place-content: center;[^}]*border: 1px solid[^}]*text-align: center;/,
);
assert.match(
cyberStyles,
/:root\[data-ui-theme='cyber'\] \.global-context-modes \{[^}]*border: 0;/,
);
assert.match(cyberStyles, /mask-image: linear-gradient\(/);
assert.match(cyberStyles, /flex: 1 1 auto;/);
assert.match(cyberStyles, /#left-panel-stack:has/);
assert.match(
cyberStyles,
/inset-inline-start: calc\(54px \+ var\(--panel-rail-clearance\)\);/,
);
assert.match(cyberStyles, /right: calc\(51px \+ var\(--panel-rail-clearance\)\);/);
// Each side's edge line shows only beside an open panel.
assert.match(
cyberStyles,
/#left-panel-stack:has\(> \[data-panel-id\]:not\(\.collapsed, \[hidden\]\)\) \{\s*border-inline-start-color:/,
);
assert.match(
cyberStyles,
/#right-context-rail:has\(> \[data-panel-id\]:not\(\.collapsed, \[hidden\]\)\) \{\s*border-inline-end-color:/,
);
assert.match(cyberStyles, /bottom: calc\(2vh \+ 13rem \+ var\(--world-timeline-lift, 0px\)\);/);
assert.doesNotMatch(cyberStyles, /NAV 01 \/\/ COMMAND BUS \/\/ VIS 03/);
assert.match(cyberStyles, /data-layer-id='satellites'/);
assert.match(cyberStyles, /#search-toggle::before/);
assert.match(cyberStyles, /VISUAL MATRIX \/\/ 03/);
assert.match(cyberStyles, /body\.cockpit-mode #cockpit-hud/);
assert.match(cyberStyles, /TARGET SCANNING \/\/ LIVE VECTOR/);
assert.match(
cyberStyles,
/body\.cockpit-mode #global-loading-status \{[\s\S]*?top: 60px;[\s\S]*?z-index: 146;/,
);
assert.match(
cyberStyles,
/body\.cockpit-mode #global-loading-detail \{[\s\S]*?color: var\(--cockpit-accent\);/,
);
assert.match(cyberStyles, /body\.cockpit-mode \.cockpit-visor-shell::before/);
assert.match(cyberStyles, /body\.cockpit-mode \.cockpit-scan-array/);
assert.match(cyberStyles, /body\.cockpit-mode \.cockpit-target-side-arcs/);
assert.match(cyberStyles, /body\.cockpit-mode \.cockpit-target-ticks/);
assert.match(cyberStyles, /body\.cockpit-mode \.cockpit-target-core/);
assert.match(cyberStyles, /width: min\(48vw, 60vh\);/);
assert.match(cyberStyles, /body\.cockpit-mode \.cockpit-context-window/);
assert.match(cyberStyles, /body\.cockpit-mode \.cockpit-signal-window/);
assert.match(cyberStyles, /body\.cockpit-mode #intel-hud\.active/);
});
test('Cyber voice telemetry renders a live scan scope without replacing audio ownership', () => {
assert.match(
cyberStyles,
/#gev-voice-control\s*\{[\s\S]*?--cyber-voice-wave:/,
);
assert.match(cyberStyles, /\.gev-voice-visualizer::before/);
assert.match(cyberStyles, /\.gev-voice-visualizer::after/);
assert.match(cyberStyles, /@keyframes gev-cyber-voice-scan/);
assert.match(cyberStyles, /@keyframes gev-cyber-voice-lock/);
assert.match(cyberStyles, /\[data-speaker='user'\]/);
assert.match(cyberStyles, /\[data-speaker='ai'\]/);
assert.match(
cyberStyles,
/prefers-reduced-motion: reduce[\s\S]*?gev-voice-visualizer::after[\s\S]*?animation: none/,
);
});
test('Cyber Cockpit Display uses the released briefing lane instead of the legacy viewport cap', () => {
assert.match(
cyberStyles,
/body\.cockpit-mode\s+#cockpit-display-panel\s*\{[\s\S]*?max-height:\s*calc\(var\(--cockpit-utility-expanded-max-height, 72vh\) - 62px\)/,
);
assert.match(
cyberStyles,
/#cockpit-hud:has\(\.cockpit-utility-control\.is-expanded\)[\s\S]*?\.cockpit-signal-window\[data-collapsed='true'\][\s\S]*?bottom: 80px;[\s\S]*?visibility:\s*visible/,
);
});
test('Cyber Cockpit keeps Data Layers inside its bounded rail', () => {
assert.match(
cyberStyles,
/body:not\(\.cockpit-mode\)\s+#left-panel-stack:has\([\s\S]*?max-height:\s*none;/,
);
assert.match(
cyberStyles,
/body\.cockpit-mode\s+#left-panel-stack\s+> :is\(#data-panel, #utilities-panel\) \{[\s\S]*?max-height: min\(64vh, 610px\);/,
);
});
test('Cyber desktop cockpit collapsed utility frames match the 50px Data Layers frame', () => {
const desktop = cyberStyles.slice(
cyberStyles.indexOf('@media (min-width: 961px) and (min-height: 650px)'),
cyberStyles.indexOf('@media (max-width: 720px)'),
);
assert.match(
desktop,
/:root\[data-ui-theme='cyber'\]\s+body\.cockpit-mode\s+\.cockpit-utility-control:not\(\.is-expanded\)\s+\.cockpit-utility-launcher\s*\{\s*height: 50px;\s*min-height: 50px;\s*padding: 9px 18px 9px 24px;/,
);
assert.match(
desktop,
/\.cockpit-utility-control:not\(\.is-expanded\)\s+\.cockpit-utility-launcher::after\s*\{\s*bottom: 6px;/,
);
});
test('Cyber right panels preserve intrinsic sizing and the shared rail allocation', () => {
assert.doesNotMatch(
cyberStyles.slice(cyberStyles.indexOf(":root[data-ui-theme='cyber'] {")),
/#right-context-rail\s*>[^{}]+\{[^{}]*\b(?:flex|height|max-height):/,
);
});
test('Cyber panels retain clean edges without the added footer band', () => {
assert.doesNotMatch(cyberStyles, /--cyber-panel-foot-/);
assert.doesNotMatch(cyberStyles, /border-bottom: 24px solid transparent/);
});
test('Cyber keeps Sonar on/off without the removed CSS effect switch or dimmer', () => {
const template = readFileSync(
new URL('./views/panels/DisplayPanel.vue', import.meta.url),
'utf8',
);
assert.match(template, /id="cyber-sonar-toggle"/);
assert.doesNotMatch(template, /data-sonar-mode|cyber-sonar-mode-row/);
assert.doesNotMatch(cyberStyles, /cyber-scene-dimmer|data-cyber-sonar-mode/);
});
test('Cyber Display uses a red title without a panel-specific center tab', () => {
assert.match(
cyberStyles,
/#pp-toggles \.pp-header-label\s*\{\s*color: var\(--cyber-red-bright\);/,
);
assert.doesNotMatch(cyberStyles, /#pp-toggles[^,{]*::after\s*\{/);
assert.match(cyberStyles, /isolation: isolate;\s*clip-path: none;/);
assert.match(cyberStyles, /#pp-toggles:not\(\.collapsed\)::before/);
});
test('Cyber omits only the fictional classification and system header lines', () => {
assert.match(
cyberStyles,
/#intel-hud\[data-variant='cyber'\] \.hud-top-left \.hud-classification,\s*#intel-hud\[data-variant='cyber'\] \.hud-top-left \.hud-system\s*\{\s*display: none;\s*\}/,
);
});
+9 -7
View File
@@ -54,7 +54,7 @@ export class DisplayBindings {
documentRef: document,
searchInput: this._locationSearch,
actions: {
setStyle: (style) => this.setStyle(style, { userInitiated: true }),
setStyle: (style) => this.setStyle(style),
dismissSearch: () => this._closeLocationSearch?.({ ifOpen: true }),
toggleHud: () => {
this.shareLinkManager?.claimRestoreLane?.('visual');
@@ -82,7 +82,7 @@ export class DisplayBindings {
this._detachDisplayControls?.();
const store = this.displayStore ?? useDisplayStore(applicationPinia());
const token = store.connect({
setStyle: (style) => this.setStyle(style, { userInitiated: true }),
setStyle: (style) => this.setStyle(style),
toggleBloom: () => {
this.shareLinkManager?.claimRestoreLane?.('visual');
this._setBloomEnabled(!this.bloomEnabled);
@@ -116,7 +116,7 @@ export class DisplayBindings {
},
setHudLayout: (value) => {
this.shareLinkManager?.claimRestoreLane?.('visual');
this._setHudVariant(value, { applyVisualDefaults: true });
this._setHudVariant(value);
},
toggleCleanView: () => this.toggleCleanView(),
exitCleanView: () => this.toggleCleanView(false),
@@ -155,7 +155,10 @@ export class DisplayBindings {
this._updateHudButtonState();
this._syncShareState();
},
toggleSonar: () => this._setCyberSonarEnabled(),
toggleSonar: () => {
this.shareLinkManager?.claimRestoreLane?.('visual');
this._setCyberSonarEnabled();
},
setSonarRings: (value) => this._setCyberSonarSetting('rings', value),
setSonarRange: (value) => this._setCyberSonarSetting('range', value),
setSonarIntensity: (value) =>
@@ -178,9 +181,8 @@ export class DisplayBindings {
// feather and opacity, 3D aircraft on in Proximity.
resetVisual: () => {
this.shareLinkManager?.claimRestoreLane?.('visual');
this.setStyle('normal', { userInitiated: true });
// The HUD layout follows the Normal style, as choosing it does: the
// Cyber HUD stays Cyber.
this.setStyle('normal');
// The HUD layout and the Sonar style stay as the viewer set them.
this._applyGlobalPostDefaults({ keepHudVariant: true });
this._setDetectionAllocation('ELASTIC');
this._setScope({ enabled: true, featherPct: 100, opacityPct: 100 });
+24 -2
View File
@@ -238,20 +238,29 @@ test('the HUD and Sonar controls render what VisualSettings shows', async (t) =>
getVariant: () => variant,
});
owner._scheduleAdaptivePanelLayout = () => {};
assert.equal($('cyber-sonar-toggle').textContent, 'ON');
assert.equal($('cyber-sonar-toggle').getAttribute('aria-pressed'), 'true');
// Sonar is opt-in: OFF until the viewer turns it on.
assert.equal($('cyber-sonar-toggle').textContent, 'OFF');
assert.equal($('cyber-sonar-toggle').getAttribute('aria-pressed'), 'false');
assert.equal(
[...$('hud-layout-select').options].map((option) => option.value).join(),
'tactical,minimal',
);
owner._syncHudControls();
await nextTick();
assert.equal($('hud-toggle').classList.contains('active'), true);
assert.equal($('hud-layout-row').classList.contains('visible'), true);
assert.equal($('hud-layout-select').value, 'minimal');
// The toggle shows with the HUD; its sliders wait for Sonar ON.
assert.equal($('cyber-sonar-row').classList.contains('visible'), true);
assert.equal($('cyber-sonar-rings-row').classList.contains('visible'), false);
visible = false;
owner._updateHudButtonState();
await nextTick();
assert.equal($('hud-toggle').classList.contains('active'), false);
assert.equal($('hud-layout-row').classList.contains('visible'), false);
assert.equal($('cyber-sonar-row').classList.contains('visible'), false);
owner._sonarShown = {
enabled: false,
@@ -272,6 +281,19 @@ test('the HUD and Sonar controls render what VisualSettings shows', async (t) =>
assert.equal($('cyber-sonar-range-value').textContent, '90%');
assert.equal($('cyber-sonar-sector').value, '30');
assert.equal($('cyber-sonar-sector-value').textContent, '30°');
visible = true;
owner._updateHudButtonState();
owner._sonarShown = { ...owner._sonarShown, enabled: true };
owner._publishDisplay();
await nextTick();
assert.equal(toggle.textContent, 'ON');
for (const name of ['rings', 'range', 'intensity', 'opacity', 'sector'])
assert.equal(
$(`cyber-sonar-${name}-row`).classList.contains('visible'),
true,
name,
);
});
test('Scope and Celestial render what VisualSettings shows', async (t) => {
+1 -1
View File
@@ -321,7 +321,7 @@ test('DisplayBindings sets the scope opacity and resets Visual to its defaults',
document.querySelector('#pp-toggles .pp-reset-btn').click();
assert.deepEqual(calls, [
['claim', 'visual'],
['style', 'normal', { userInitiated: true }],
['style', 'normal', undefined],
['postDefaults', { keepHudVariant: true }],
['allocation', 'ELASTIC'],
['scope', { enabled: true, featherPct: 100, opacityPct: 100 }],
-6
View File
@@ -1,6 +0,0 @@
/** Cyber keeps the frame fixed; other layouts retain their existing scroller. */
export function displayPanelScroller(panel) {
return panel?.ownerDocument?.documentElement?.dataset.uiTheme === 'cyber'
? panel.querySelector('.pp-panel-body') || panel
: panel;
}
+666
View File
@@ -0,0 +1,666 @@
import {
getScopeMaskFeather,
getScopeMaskOpacity,
isScopeMaskEnabled,
setScopeMaskEnabled,
setScopeMaskFeather,
setScopeMaskOpacity,
} from '../scopeMask.js';
import assert from 'node:assert/strict';
import { readdirSync, readFileSync } from 'node:fs';
import test from 'node:test';
import {
HUD_LAYOUTS,
isLegacySonarHudLayout,
LEGACY_SONAR_HUD_LAYOUTS,
normalizeHudLayout,
} from '../hudLayouts.js';
import {
isCyberMapThemeActive,
isCyberSonarActive,
isCyberSonarEnabled,
setCyberSonarEnabled,
} from '../cyberSonar.js';
import { GEV_ACTION_SCHEMAS } from '../voice/actionSchemas.js';
import { createGevActionRunner } from '../voice/gevActions.js';
import { StyleManager } from './applicationShell.js';
import { setCyberSonarControls } from './cyberSonarControls.js';
import { createPinia } from 'pinia';
import { useDisplayStore } from './stores/display.js';
import { VisualSettings } from './visualSettings.js';
import { STYLES } from './visualPresets.js';
const read = (relative) =>
readFileSync(new URL(relative, import.meta.url), 'utf8');
function cssRuleBody(styles, selector) {
const match = styles.match(new RegExp(`${selector.source}\\s*\\{([^}]+)\\}`));
assert.ok(match, `Missing CSS rule: ${selector.source}`);
return match[1];
}
function styleOwner(t, initialVariant = 'tactical') {
const previous = { document: globalThis.document, window: globalThis.window };
const root = { dataset: {} };
globalThis.document = { documentElement: root, querySelectorAll: () => [] };
globalThis.window = { dispatchEvent() {} };
t.after(() => Object.assign(globalThis, previous));
let variant = initialVariant;
const calls = [];
const hud = {
getVariant: () => variant,
// Normalize like the real HUD so removed layouts fall back.
setVariant: (value) => (variant = normalizeHudLayout(value)),
setMode: (value) => calls.push(['mode', value]),
onStyleChange: (value) => calls.push(['style', value]),
visible: true,
};
hud.setVariant(initialVariant);
const owner = Object.create(VisualSettings.prototype);
Object.assign(owner, {
activeStyle: 'normal',
store: { publish() {} },
readHud: () => hud,
readShareLinks: () => ({ onStyleChange() {} }),
_visualEffects: {
stages: Object.fromEntries(
Object.entries(STYLES).map(([name, config]) => [
name,
{ uniforms: { ...config.uniforms, intensity: 0 } },
]),
),
},
services: {
governorRequestRender: (reason) => calls.push(['render', reason]),
setDetectionStyle() {},
},
_setBloomEnabled: (value) => calls.push(['bloom', value]),
_setSharpenEnabled: (value) => calls.push(['sharpen', value]),
_applyDetectionPreset: (value) => calls.push(['detection', value]),
_syncShareState: () => calls.push(['share', variant]),
});
for (const name of [
'setCelestialRingEnabled',
'_startTransition',
'_publishActiveStyle',
'_updateSliderPanel',
'_updateHudButtonState',
'_syncIrBoost',
'_syncCockpitInheritedStyle',
'_syncCyberSonarControl',
'_scheduleAdaptivePanelLayout',
'_setDetectionFade',
// Intensities: the fixture has no post-process stages to drive.
'_setBloomIntensity',
'_setSharpenIntensity',
])
owner[name] = () => {};
return { owner, hud, root, calls };
}
test('Tactical and Minimal are the HUD layouts; Cyber is only a Sonar alias', () => {
assert.deepEqual(HUD_LAYOUTS, ['tactical', 'minimal']);
assert.deepEqual(LEGACY_SONAR_HUD_LAYOUTS, ['cyber']);
assert.equal(normalizeHudLayout('cyber'), 'tactical');
assert.equal(normalizeHudLayout('CYBER'), 'tactical');
assert.equal(normalizeHudLayout('operator'), 'tactical');
assert.equal(normalizeHudLayout('Minimal'), 'minimal');
assert.equal(isLegacySonarHudLayout('Cyber'), true);
assert.equal(isLegacySonarHudLayout('operator'), false);
assert.equal(isLegacySonarHudLayout('tactical'), false);
});
test('a share link, scene or saved view naming Cyber opens Tactical with Sonar on', async (t) => {
const { owner, hud, root, calls } = styleOwner(t, 'minimal');
assert.equal(isCyberSonarEnabled(root), false);
await owner.restoreShareState({ hudVariant: 'cyber' });
assert.equal(hud.getVariant(), 'tactical');
assert.equal(root.dataset.cyberSonar, 'on');
assert.equal(root.dataset.uiTheme, undefined);
// Turning it on asks for a frame, so a parked map starts the sweep.
assert.ok(
calls.some(
([name, reason]) => name === 'render' && reason === 'cyber-sonar-toggle',
),
);
// The viewer's own layout choice afterwards leaves the Sonar style alone.
owner._setHudVariant('minimal');
assert.equal(hud.getVariant(), 'minimal');
assert.equal(isCyberSonarEnabled(root), true);
// A restored state is authoritative: one that does not name Cyber turns
// Sonar off, whether from a link or a scene shot.
await owner.restoreShareState({ hudVariant: 'tactical' });
assert.equal(isCyberSonarEnabled(root), false);
setCyberSonarEnabled(true, root);
await owner.applyVisualState({ hud: { variant: 'minimal' } });
assert.equal(hud.getVariant(), 'minimal');
assert.equal(isCyberSonarEnabled(root), false);
await owner.applyVisualState({ hud: { variant: 'cyber' } });
assert.equal(hud.getVariant(), 'tactical');
assert.equal(isCyberSonarEnabled(root), true);
});
test('links and scene shots record Tactical with Sonar as the Cyber code, and only that', (t) => {
const { owner, root } = styleOwner(t, 'tactical');
Object.assign(owner.services, {
getDetectionTuning: () => ({ allocationStrategy: 'ELASTIC' }),
getDetectionMode: () => 'OFF',
isScopeMaskEnabled: () => true,
getScopeMaskFeather: () => 1,
getScopeMaskOpacity: () => 1,
getScopeTerminusOverride: () => null,
});
owner.readCelestialRing = () => null;
const shared = () => owner._readShareState().options.hudVariant;
assert.equal(shared(), 'tactical');
owner._setCyberSonarEnabled(true);
assert.equal(shared(), 'cyber');
// Minimal has no code that carries Sonar; it stays local.
owner._setHudVariant('minimal');
assert.equal(shared(), 'minimal');
owner._setHudVariant('tactical');
assert.equal(shared(), 'cyber');
owner._setCyberSonarEnabled(false);
assert.equal(shared(), 'tactical');
assert.equal(isCyberSonarEnabled(root), false);
});
test('Sonar is opt-in and gated on its toggle, the HUD, Cockpit and motion, not a theme', () => {
const classes = new Set();
const root = { dataset: {} };
const body = { classList: { contains: (name) => classes.has(name) } };
const gate = (extra = {}) => ({
root,
body,
hudActive: true,
reducedMotion: false,
...extra,
});
assert.equal(isCyberSonarEnabled(root), false);
assert.equal(isCyberSonarActive(gate()), false);
assert.equal(isCyberMapThemeActive(gate()), false);
// The removed Cyber theme attribute no longer enables anything.
root.dataset.uiTheme = 'cyber';
assert.equal(isCyberSonarActive(gate()), false);
delete root.dataset.uiTheme;
assert.equal(setCyberSonarEnabled(true, root), true);
assert.equal(root.dataset.cyberSonar, 'on');
assert.equal(isCyberSonarActive(gate()), true);
assert.equal(isCyberMapThemeActive(gate()), true);
assert.equal(isCyberSonarActive(gate({ hudActive: false })), false);
assert.equal(isCyberMapThemeActive(gate({ hudActive: false })), false);
// Reduced motion keeps the static treatment and stops the sweep.
assert.equal(isCyberSonarActive(gate({ reducedMotion: true })), false);
assert.equal(isCyberMapThemeActive(gate({ reducedMotion: true })), true);
classes.add('cockpit-mode');
assert.equal(isCyberSonarActive(gate()), false);
assert.equal(isCyberMapThemeActive(gate()), false);
classes.delete('cockpit-mode');
assert.equal(setCyberSonarEnabled(false, root), false);
assert.equal(root.dataset.cyberSonar, 'off');
assert.equal(isCyberSonarActive(gate()), false);
assert.equal(isCyberMapThemeActive(gate()), false);
});
test('Sonar controls apply under Tactical and Minimal and still validate input', () => {
for (const layout of ['tactical', 'minimal']) {
const root = { dataset: {} };
const doc = {
documentElement: root,
body: { classList: { contains: () => false } },
getElementById: () => null,
};
const calls = [];
const owner = {
hud: { getVariant: () => layout, visible: true },
_setCyberSonarSetting: (name, value) => calls.push([name, value]),
_setCyberSonarEnabled: (value) => {
calls.push(['enabled', value]);
setCyberSonarEnabled(value, root);
},
};
const applied = setCyberSonarControls(
owner,
{ enabled: true, rings: 6, sectorDeg: 30 },
doc,
);
assert.equal(applied.ok, true, layout);
assert.equal(applied.sonar.enabled, true);
assert.equal('cyberSelected' in applied.sonar, false);
assert.deepEqual(calls, [
['rings', 6],
['sector', 30],
['enabled', true],
]);
assert.equal(
setCyberSonarControls(owner, { enabled: 'yes' }, doc).error,
'enabled must be a boolean.',
);
assert.equal(
setCyberSonarControls(owner, { pulse: 3 }, doc).error,
'Unknown sonar setting.',
);
assert.equal(
setCyberSonarControls(owner, { rings: 13 }, doc).error,
'rings must be an integer from 3 to 12.',
);
}
});
test('Display and voice HUD routes offer Tactical and Minimal, and Cyber turns Sonar on', async (t) => {
const makeOwner = () => {
const { owner, hud, root } = styleOwner(t, 'tactical');
owner.setStyle('noir');
owner.setHudLayout = (...args) =>
StyleManager.prototype.setHudLayout.call(owner, ...args);
owner.getControlState = () => ({
hud: { layout: hud.getVariant(), visible: true },
});
return { owner, hud, root };
};
const display = makeOwner();
const store = useDisplayStore(createPinia());
const token = store.connect({
setHudLayout: (value) => display.owner.setHudLayout(value),
setStyle: (value) => display.owner.setStyle(value),
});
store.act('setHudLayout', 'minimal');
assert.equal(display.hud.getVariant(), 'minimal');
// Switching layouts never changes the visual preset.
assert.equal(display.owner.activeStyle, 'noir');
store.act('setStyle', 'anime');
assert.equal(display.owner.activeStyle, 'anime');
store.detach(token);
const setHud = GEV_ACTION_SCHEMAS.find((tool) => tool.name === 'set_hud');
assert.deepEqual(setHud.parameters.properties.layout.enum, HUD_LAYOUTS);
const voice = makeOwner();
const eventSource = { addEventListener() {}, removeEventListener() {} };
const viewer = {
camera: { moveEnd: { addEventListener() {} } },
clock: { onTick: { addEventListener: () => () => {} } },
canvas: eventSource,
scene: { canvas: eventSource },
};
const runVoiceAction = createGevActionRunner({
viewer,
styleManager: voice.owner,
dataManager: {},
});
const minimal = await runVoiceAction('set_hud', { layout: 'minimal' });
assert.equal(minimal.ok, true);
assert.equal(voice.hud.getVariant(), 'minimal');
assert.equal(isCyberSonarEnabled(voice.root), false);
const legacy = await runVoiceAction('set_hud', { layout: 'cyber' });
assert.equal(legacy.ok, true);
assert.equal(legacy.layout, 'tactical');
assert.equal(voice.hud.getVariant(), 'tactical');
assert.equal(isCyberSonarEnabled(voice.root), true);
assert.equal(voice.owner.activeStyle, 'noir');
const unknown = await runVoiceAction('set_hud', { layout: 'operator' });
assert.equal(unknown.ok, false);
});
test('style presets keep their own HUD layout and never touch Sonar', (t) => {
const { owner, hud, root } = styleOwner(t);
setCyberSonarEnabled(true, root);
for (const variant of ['tactical', 'minimal']) {
owner._setHudVariant(variant);
assert.equal(hud.getVariant(), variant);
owner.setStyle('normal');
owner.setStyle('surveillance');
assert.equal(hud.getVariant(), 'tactical');
assert.equal(isCyberSonarEnabled(root), true);
}
});
test('the Display panel offers Sonar as an opt-in toggle under the HUD layout', () => {
const view = read('./views/panels/DisplayPanel.vue');
assert.doesNotMatch(view, /value="cyber"/);
assert.match(view, /<option value="tactical">/);
assert.match(view, /<option value="minimal">/);
assert.match(
view,
/const sonarOn = computed\(\(\) => sonar\.value\?\.enabled \?\? false\);/,
);
// The toggle shows with the HUD; its sliders only once Sonar is on.
assert.match(
view,
/cyber-sonar-toggle-row" :class="\{ visible: hud\?\.visible \}" id="cyber-sonar-row"/,
);
assert.equal(
view.match(
/cyber-sonar-setting" :class="\{ visible: hud\?\.visible && sonarOn \}"/g,
)?.length,
5,
);
assert.match(view, /:aria-label="t\('Sonar contact scanner'\)"/);
// Its renderer status speaks only for a Sonar the viewer turned on.
assert.match(
view,
/<output id="cyber-sonar-status"[^>]*:hidden="!\(hud\?\.visible && sonarOn\)"/,
);
assert.doesNotMatch(view, /t\('Cyber/);
});
test('stylesheets carry no Cyber theme and show the sweep only while Sonar is on', () => {
const entry = readFileSync(
new URL('../../style.css', import.meta.url),
'utf8',
);
assert.match(entry, /@import '\.\/src\/ui\/styles\/sonar\.css';/);
assert.doesNotMatch(entry, /cyber\.css/);
const dir = new URL('./styles/', import.meta.url);
for (const name of readdirSync(dir).filter((file) => file.endsWith('.css')))
assert.doesNotMatch(
readFileSync(new URL(name, dir), 'utf8'),
/data-ui-theme/,
name,
);
const sonar = read('./styles/sonar.css');
assert.match(cssRuleBody(sonar, /\n\.hud-sonar/), /display: none;/);
assert.match(
cssRuleBody(
sonar,
/\n:root\[data-cyber-sonar='on'\] #intel-hud \.hud-sonar/,
),
/display: block;/,
);
// Cockpit and a hidden HUD keep no sweep, not even an invisible one.
assert.match(
cssRuleBody(
sonar,
/:root\[data-cyber-sonar='on'\] body\.cockpit-mode #intel-hud \.hud-sonar,\s*:root\[data-cyber-sonar='on'\] #intel-hud:not\(\.active\) \.hud-sonar/,
),
/display: none;/,
);
assert.match(
sonar,
/@media \(prefers-reduced-motion: reduce\)\s*\{\s*:root\[data-cyber-sonar='on'\] #intel-hud \.hud-sonar::after\s*\{\s*display: none;\s*animation: none;/,
);
// The Vue bindings own the Sonar rows' visibility now.
const controls = read('./styles/controls.css');
assert.doesNotMatch(controls, /\.cyber-sonar-control\s*\{\s*display: none/);
assert.doesNotMatch(controls, /data-cyber-sonar='off'/);
});
test('the desktop bottom row: credits on the Power Up baseline, the dock lifted, the corners level', () => {
const rem = 16;
const lift = 'var\\(--world-timeline-lift, 0px\\)';
const value = (text, pattern) => {
const match = text.match(pattern);
assert.ok(match, pattern.source);
return Number(match[1]);
};
const block = (text, header) => {
const start = text.indexOf(header);
assert.ok(start >= 0, header);
let depth = 0;
for (let i = text.indexOf('{', start); i < text.length; i += 1) {
if (text[i] === '{') depth += 1;
else if (text[i] === '}' && --depth === 0)
return text.slice(start, i + 1);
}
assert.fail(`unclosed ${header}`);
};
// Measured constants: the Power Up / language row is 32px tall, 14px up
// and about 20rem wide in English; the attribution logo line is 28px; the
// single-row dock is 62px; the bottom-right readout is one 26px line
// taller than the coordinates.
const POWER_UP = { bottom: 14, height: 32 };
const CREDIT_HEIGHT = 28;
const DOCK_HEIGHT = 62;
const timeline = read('./styles/world-timeline.css');
const timelineLift = value(
timeline,
/body:has\(#world-timeline\) \{\s*--world-timeline-lift: (\d+)px;/,
);
// From 1200px the dock and the World Timeline leave the bottom 74px; below
// it they return to the bottom edge, where the dock spans the corners.
const dock = read('./styles/command-dock.css');
const dockFloor = value(
dock,
new RegExp(
`\\n#command-dock \\{[^}]*bottom: calc\\((\\d+)px \\+ ${lift}\\)`,
),
);
assert.match(
block(dock, '@media (max-width: 1199px)'),
new RegExp(`#command-dock \\{\\s*bottom: calc\\(2vh \\+ ${lift}\\);`),
);
assert.equal(
value(timeline, /\n#world-timeline \{[^}]*bottom: (\d+)px;/),
dockFloor,
);
assert.match(
block(timeline, '@media (max-width: 1199px)'),
/#world-timeline \{\s*bottom: 2vh;/,
);
assert.ok(dockFloor >= POWER_UP.bottom + POWER_UP.height + 8);
// Both credit renderers share Power Up's row, centred on it, below the
// dock, and stop short of the corner row instead of running under it:
// GEV's own line on its anchor, Cesium's on the absolutely placed box it
// draws inside its empty anchor.
const trays = read('./styles/command-dock-trays.css');
const trayWide = block(trays, '@media (min-width: 1200px)');
const caps = {
'gev-credits': trays.match(
/#gev-credits \{\s*right: auto;\s*bottom: ([\d.]+)rem;\s*left: 1\.5rem;\s*width: max-content !important;\s*max-width: calc\(100vw - 1\.5rem - ([\d.]+)rem\);\s*white-space: normal;/,
),
'cesium-credits': (() => {
const anchor = trays.match(
/#cesium-credits \{\s*right: auto;\s*bottom: ([\d.]+)rem;\s*left: 1\.5rem;/,
);
const box = trayWide.match(
/\n #cesium-credits \.cesium-widget-credits \{\s*width: max-content;\s*max-width: calc\(100vw - 1\.5rem - ([\d.]+)rem\);\s*white-space: normal;/,
);
return anchor && box && [null, anchor[1], box[1]];
})(),
};
for (const [id, match] of Object.entries(caps)) {
assert.ok(match, id);
const creditsBottom = Number(match[1]) * rem;
assert.equal(
creditsBottom + CREDIT_HEIGHT / 2,
POWER_UP.bottom + POWER_UP.height / 2,
);
assert.ok(creditsBottom + CREDIT_HEIGHT + 8 <= dockFloor);
assert.ok(Number(match[2]) >= 20 + 1.5, `${id} leaves the corner row room`);
}
// Below 1200px the row returns above the bottom-edge dock, on one line.
const narrow = block(trays, '@media (max-width: 1199px)');
for (const id of ['cesium-credits', 'gev-credits'])
assert.match(narrow, new RegExp(`#${id}[,\\s]`));
assert.match(
narrow,
new RegExp(
`\\{\\s*bottom: calc\\(2vh \\+ 5rem \\+ ${lift}\\);\\s*width: auto !important;\\s*max-width: calc\\(100vw - 3rem\\);\\s*white-space: nowrap;`,
),
);
// Right to left the corner row is at the bottom left, so the row moves right.
assert.match(
trayWide,
/html\[dir='rtl'\]\s*body:not\(\.context-docked\):not\(\.ui-clean-view\):not\(\.recording-mode\)\s*:is\(#cesium-credits, #gev-credits\) \{\s*right: 1\.5rem;\s*left: auto;/,
);
assert.match(
trayWide,
/#cesium-credits\s*\.cesium-widget-credits \{\s*right: 0;\s*left: auto;/,
);
const locale = read('./styles/locale-picker.css');
assert.match(locale, /#corner-actions \{[^}]*inset-inline-end: 0\.9rem;/);
// From 1200px the readout keeps 8px above Power Up and the coordinates
// start level with it. The World Timeline sits between the corners, so they
// do not move while it shows.
const split = read('./styles/rail-split.css');
const wide = block(split, '@media (min-width: 1200px)');
const readoutWide =
value(
wide,
/\n #intel-hud\[data-variant='tactical'\] \.hud-bottom-right \{\s*bottom: ([\d.]+)rem;/,
) * rem;
assert.equal(readoutWide, POWER_UP.bottom + POWER_UP.height + 8);
assert.equal(
value(wide, /\.hud-bottom-left \{\s*bottom: calc\(([\d.]+)rem \+ 26px\);/) *
rem,
readoutWide,
);
assert.doesNotMatch(
wide,
/hud-bottom-(left|right) \{[^}]*world-timeline-lift/,
);
// Corners: coordinates ~302px from 36px, readout ~292px to 36px from the
// right edge; the bar keeps 12px from each at every width from 1200px.
const gutter =
value(
wide,
/#world-timeline \{\s*width: min\(820px, calc\(100vw - ([\d.]+)rem\)\);/,
) * rem;
assert.ok(gutter / 2 >= 36 + 302 + 12);
assert.ok(timelineLift > 0);
// Toasts keep 12px above the raised dock.
assert.equal(
value(
wide,
new RegExp(`#toast \\{\\s*bottom: calc\\((\\d+)px \\+ ${lift}\\);`),
),
dockFloor + DOCK_HEIGHT + 12,
);
// The dock's panels lose the dock's rise from their height budgets.
assert.match(
wide,
/\.gev-voice-panel \{[^}]*calc\(100dvh - 12rem - 74px \+ 2vh - var\(--gev-provider-lift, 0px\)\)/,
);
assert.match(
block(read('./styles/ai-chat.css'), '@media (min-width: 1200px)'),
/#gev-chat-panel \{\s*max-height: min\(34rem, calc\(100dvh - 10rem - 74px \+ 2vh\)\);/,
);
// Below 1200px the corners keep the committed layout: the coordinates clear
// the raised credit row's logo line by 6px.
assert.ok(
value(
trays.slice(
trays.indexOf(
'/* The coordinate readout shares the bottom-left corner',
),
),
new RegExp(
`\\.hud-bottom-left \\{\\s*bottom: calc\\(2vh \\+ ([\\d.]+)rem \\+ ${lift}\\);`,
),
) *
rem >=
5 * rem + CREDIT_HEIGHT + 6,
);
// The desktop Omnibar layout outranks these rules; its readout keeps the
// same 8px above Power Up.
const omnibarReadout = value(
read('./styles/omnibar-dock.css'),
/#intel-hud\[data-variant='tactical'\] \.hud-bottom-right \{\s*bottom: ([\d.]+)rem;/,
);
assert.equal(omnibarReadout * rem, POWER_UP.bottom + POWER_UP.height + 8);
});
test('scope choice and expanded feather survive every HUD layout and both restore paths', async (t) => {
const { owner } = styleOwner(t, 'tactical');
const previous = {
enabled: isScopeMaskEnabled(),
feather: getScopeMaskFeather(),
};
t.after(() => {
setScopeMaskEnabled(previous.enabled);
setScopeMaskFeather(previous.feather);
});
Object.assign(owner.services, { setScopeMaskEnabled, setScopeMaskFeather });
let shown = null;
owner.store = { publish: (view) => (shown = view.scope) };
await owner.restoreShareState({ scopeEnabled: false, scopeFeatherPct: 200 });
assert.deepEqual(shown, { enabled: false, featherPct: 200, opacityPct: 100 });
for (const layout of ['minimal', 'cyber', 'tactical']) {
owner._setHudVariant(layout);
assert.equal(isScopeMaskEnabled(), false, layout);
assert.equal(getScopeMaskFeather(), 2, layout);
assert.equal(shown.enabled, false, layout);
}
await owner.applyVisualState({ scope: { enabled: true, featherPct: 175 } });
assert.equal(isScopeMaskEnabled(), true);
assert.equal(getScopeMaskFeather(), 1.75);
assert.deepEqual(shown, { enabled: true, featherPct: 175, opacityPct: 100 });
await owner.applyVisualState({ scope: { featherPct: 500 } });
assert.equal(getScopeMaskFeather(), 2);
assert.deepEqual(shown, { enabled: true, featherPct: 200, opacityPct: 100 });
});
test('a shared scope opacity is restored and rides in the next share state', async (t) => {
const { owner } = styleOwner(t, 'tactical');
const previous = getScopeMaskOpacity();
t.after(() => setScopeMaskOpacity(previous));
Object.assign(owner.services, {
setScopeMaskEnabled() {},
setScopeMaskFeather() {},
setScopeMaskOpacity,
});
let shown = null;
owner.store = { publish: (view) => (shown = view.scope) };
await owner.restoreShareState({ scopeOpacityPct: 60 });
assert.equal(getScopeMaskOpacity(), 0.6);
assert.equal(shown.opacityPct, 60);
// A state without it leaves the opacity alone.
await owner.restoreShareState({ scopeFeatherPct: 80 });
assert.equal(getScopeMaskOpacity(), 0.6);
assert.equal(shown.opacityPct, 60);
Object.assign(owner.services, {
getDetectionTuning: () => ({ allocationStrategy: 'ELASTIC' }),
getDetectionMode: () => 'OFF',
isScopeMaskEnabled: () => true,
getScopeMaskFeather: () => 0.8,
getScopeMaskOpacity,
getScopeTerminusOverride: () => null,
});
owner.readCelestialRing = () => null;
assert.equal(owner._readShareState().options.scopeOpacityPct, 60);
// A link asking for less than the floor opens at the floor, and says so.
await owner.restoreShareState({ scopeOpacityPct: 20 });
assert.equal(getScopeMaskOpacity(), 0.5);
assert.equal(owner._readShareState().options.scopeOpacityPct, 50);
});
test('a scene shot saved with the retired Snow style plays on Normal', async (t) => {
const { owner } = styleOwner(t, 'tactical');
owner.setStyle('noir');
await owner.applyVisualState({ style: 'snow' });
assert.equal(owner.activeStyle, 'normal');
});
test('shared panel hooks affect only opted-in rail surfaces without overriding disclosure and concealment', () => {
const styles = read('./styles/panel-surfaces.css');
const rail = cssRuleBody(
styles,
/:is\(#left-panel-stack, #right-context-rail\)\s+> \[data-panel-id\]:has\(> \[data-panel-surface\]\)/,
);
assert.match(rail, /pointer-events:\s*auto;/);
assert.doesNotMatch(rail, /(?:display|visibility):/);
assert.doesNotMatch(
styles,
/:is\(#left-panel-stack, #right-context-rail\)\s*> \[data-panel-id\]\s*\{/,
);
assert.match(
styles,
/\[data-panel-surface\]:not\(\[hidden\]\):not\(dialog:not\(\[open\]\)\)\s*\{\s*display: flex;/,
);
assert.match(
styles,
/dialog\[data-panel-surface\]:not\(\[open\]\)\s*\{\s*display: none !important;/,
);
assert.match(
styles,
/body:is\(\.ui-clean-view, \.recording-mode\)[^{]+\{[^}]*visibility: hidden !important;[^}]*pointer-events: none !important;/,
);
});
+1 -3
View File
@@ -279,9 +279,7 @@ export const FEATURE_GUIDES = Object.freeze({
prepare: () => $('#hud-toggle')?.scrollIntoView?.({ block: 'center' }),
targets: () => [$('#hud-toggle')],
text: () =>
t(
'Switch the HUD on or off here; Layout picks Tactical, Minimal or Cyber',
),
t('Switch the HUD on or off here; Layout picks Tactical or Minimal'),
},
],
scope: () => [
+1 -2
View File
@@ -2,7 +2,6 @@ import { UiLifetime } from './uiLifetime.js';
import { prefersCollapsed, readPanelState } from './rail/panelState.js';
import { usePanelChromeStore } from './stores/panelChrome.js';
import { applicationPinia } from './vueRuntime.js';
import { displayPanelScroller } from './displayPanelScroll.js';
import { PanelPositionControls } from './panelPositionControls.js';
import { PanelLayoutController } from './panelLayoutController.js';
import {
@@ -121,7 +120,7 @@ export class PanelChrome {
readDisplayScrollTop: () =>
this._displayPortalScrollRestoreOwner === 'standard'
? this._standardDisplayScrollTop
: displayPanelScroller(this._ppToggles)?.scrollTop || 0,
: this._ppToggles?.scrollTop || 0,
});
}
get hud() {
+9 -23
View File
@@ -1,5 +1,4 @@
import { readStylesheet } from '../testSupport/readStylesheet.mjs';
import { displayPanelScroller } from './displayPanelScroll.js';
import assert from 'node:assert/strict';
import test from 'node:test';
import {
@@ -9,21 +8,9 @@ import {
} from './panelRails.js';
import { applyPanelState, readPanelState } from './rail/panelState.js';
test('Display uses an inner scroll body only in Cyber', () => {
const body = { scrollTop: 95 };
const panel = {
ownerDocument: { documentElement: { dataset: { uiTheme: 'cyber' } } },
querySelector: () => body,
};
assert.equal(displayPanelScroller(panel), body);
panel.ownerDocument.documentElement.dataset.uiTheme = 'tactical';
assert.equal(displayPanelScroller(panel), panel);
assert.equal(displayPanelScroller(null), null);
});
for (const side of ['left', 'right']) {
test(`${side} desktop rail keeps one expanded owner in every HUD layout`, () => {
for (const variant of ['tactical', 'minimal', 'cyber']) {
for (const variant of ['tactical', 'minimal']) {
const f = fixture(side, { hud: { visible: true, variant } });
f.expand(f.first, 250);
f.expand(f.second, 250);
@@ -232,7 +219,7 @@ 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', () => {
test('a centered timeline only shortens the corridor when it reaches a laid-out panel', () => {
const f = fixture('left');
f.stack.rect.width = 360;
f.stack.rect.right = f.stack.rect.left + 360;
@@ -245,6 +232,11 @@ test('a centered timeline only shortens the corridor when it reaches the visible
f.run();
assert(clear > 85);
assert(Number(f.stack.dataset.safeBottomPct) < 73);
// Any other obstacle in the same gutter still bounds the corridor.
const blocker = element('blocker', { top: 650, left: 320 });
f.options.obstacles = [blocker];
f.run();
assert(Number(f.stack.dataset.safeBottomPct) < 73);
});
test('Data Layers extends to the HUD even if its list is currently short', () => {
@@ -413,12 +405,6 @@ test('left rail buttons hold still whether the open panel is short or tall', ()
assert.equal(f.stack.dataset.layoutMode, 'focus');
assert.notEqual(short.stack.dataset.layoutMode, 'focus');
assert.ok(Math.abs(railTop(f.stack) - railTop(short.stack)) < 0.2);
// A theme that pins the stack's top (Cyber) leaves nothing to offset.
f.stack.computed.getPropertyValue = (name) =>
name === '--panel-stack-top-pinned' ? ' 1' : '';
f.run();
assert.equal(f.stack.style.getPropertyValue('--panel-rail-offset'), '0.0px');
});
// The left rail's `top` animates after the right pass runs, and nothing
@@ -459,9 +445,9 @@ test('right rail falls back to the committed left target when the transition end
});
test('right rail follows a settled left rail whose CSS overrides the committed target', () => {
// Cyber pins the left rail with `top: ... !important`, so the committed
// A stylesheet that pins the left rail's `top` means the committed
// percentage is not where it renders and no `top` transition runs.
const f = fixture('right', { hud: { visible: true, variant: 'cyber' } });
const f = fixture('right', { hud: { visible: true, variant: 'minimal' } });
f.options.leftStack.rect.top = 220;
f.options.leftStack.dataset.safeTopPct = '26.00';
f.options.leftStack.getAnimations = () => [];
+2 -6
View File
@@ -329,18 +329,14 @@ test('while the OAuth check runs, the toggle is busy and repeat presses are igno
localStorage.removeItem(CLOUD_VOICE_AUTH_STORAGE_KEY);
});
test('Cyber moves the chip into the top toolbar and other themes return it to the corner', async (t) => {
test('the chip stays first in the corner row whatever the HUD layout', async (t) => {
const { $, toolbar } = await fixture(t);
const corner = $('#corner-actions');
assert.equal(corner.firstElementChild?.id, 'key-setup-chip');
// The removed Cyber skin no longer moves it into the top toolbar.
document.documentElement.dataset.uiTheme = 'cyber';
await wait();
await nextTick();
assert.equal(toolbar.lastElementChild?.id, 'key-setup-chip');
assert.equal(corner.querySelector('#key-setup-chip') === null, true);
document.documentElement.dataset.uiTheme = 'tactical';
await wait();
await nextTick();
assert.equal(corner.firstElementChild?.id, 'key-setup-chip');
assert.equal(toolbar.querySelector('#key-setup-chip') === null, true);
delete document.documentElement.dataset.uiTheme;
+1 -4
View File
@@ -91,10 +91,7 @@ export class RadioControls {
*/
async _revealRadioControlsAfterExplicitEnable(trigger) {
const contextPanel = document.getElementById('global-context-panel');
const scroller =
(document.documentElement?.dataset.uiTheme === 'cyber' &&
contextPanel?.querySelector('.cyber-panel-body')) ||
contextPanel?.querySelector('.global-context-panel-inner');
const scroller = contextPanel?.querySelector('.global-context-panel-inner');
const directory = this._radioPanel?.querySelector('.radio-directory-row');
const transport = this._radioPanel?.querySelector('.radio-transport');
if (
+1 -34
View File
@@ -140,7 +140,7 @@ test('a collapsed launcher drops its divider so English titles fit whole', () =>
);
});
test('the default theme geometry change leaves cyber gutters alone', () => {
test('the default theme geometry change leaves the base gutters alone', () => {
for (const surface of [
'.data-panel-inner',
'.utilities-panel-inner',
@@ -193,39 +193,6 @@ test('rail titles and dock labels share one set of label tokens', () => {
);
});
test('default theme overrides never reach the cyber theme', () => {
const notCyber = ":root:not([data-ui-theme='cyber'])";
const padding = rules.find(
({ selector, body }) =>
selector.endsWith(
':is(.data-panel-inner, .global-context-panel-inner)',
) && /padding-left:\s*14px/.test(body),
);
assert.ok(
padding?.selector.startsWith(notCyber),
'the 14px gutters must skip cyber',
);
const display = rules.find(
({ selector, body }) =>
selector.endsWith('#pp-toggles > .pp-header-row .pp-collapse-btn') &&
/font-size:\s*13px/.test(body),
);
assert.ok(
display?.selector.startsWith(notCyber),
"Display's 22px toggle must skip cyber",
);
// Cyber draws its title marker at left: -8px; a clip on the title would cut it.
for (const { selector, body } of rules) {
if (!/\.panel-title/.test(selector) || !/overflow:\s*hidden/.test(body))
continue;
if (!/#left-panel-stack|#right-context-rail/.test(selector)) continue;
assert.ok(
selector.startsWith(notCyber),
`${selector} clips the cyber title marker`,
);
}
});
test('launcher compaction and header colour stay on the rail panels themselves', () => {
// The divider, gap and toggle rules; the translated type rule is checked
// above.
+1 -2
View File
@@ -4,7 +4,6 @@ import {
} from '../panelStackLayout.js';
import { resolveHudRailLayout } from './panelRailGeometry.js';
import { displayPanelScroller } from './displayPanelScroll.js';
import { settleSideAccordion } from './panelAccordion.js';
const pendingCollapseRetries = new WeakSet();
@@ -356,7 +355,7 @@ export function layoutRightPanelRail({
stack.dataset.expandedCount = String(expandedPanels.length);
if (displayPanel && expandedPanels.includes(displayPanel)) {
const scroller = displayPanelScroller(displayPanel);
const scroller = displayPanel;
const maxScrollTop = Math.max(
0,
scroller.scrollHeight - scroller.clientHeight,
-17
View File
@@ -52,18 +52,6 @@ test('the dock trays open from their own wing in right-to-left', () => {
);
});
test('the Cyber cockpit keeps Data Layers on the left edge in every language', () => {
const body = ruleBody(
sheet('cyber.css'),
":root[data-ui-theme='cyber'] body.cockpit-mode #left-panel-stack",
);
// inset-inline-start would become right: 30px in Arabic and beat
// rtl.css's reset, landing the stack on the utility controls.
assert.doesNotMatch(body, /inset-inline-start/);
assert.match(body, /left: 30px;/);
assert.match(body, /right: auto;/);
});
test('the panel rails stay on the outer side of their stacks in right-to-left', () => {
const layers = sheet('layers.css');
// Each rail is placed by its screen-side edge; a physical side would put
@@ -90,11 +78,6 @@ test('the panel rails stay on the outer side of their stacks in right-to-left',
ruleBody(kit, '.ui-tooltip__tip--left'),
/inset-inline-end: calc\(100% \+ 10px\);/,
);
// Cyber's right stack keeps its rail clearance on the left edge.
assert.match(
sheet('rtl.css'),
/html\[dir='rtl'\]\[data-ui-theme='cyber'\] #right-context-rail \{\s*right: auto;\s*left: calc\(51px \+ var\(--panel-rail-clearance\)\);/,
);
});
test('phone top-bar actions mirror with the logo', () => {
+3 -3
View File
@@ -4,7 +4,7 @@ import { PanelChrome } from './panelChrome.js';
import { presentPanelLocally } from '../testSupport/panelState.mjs';
import { readPanelState } from './rail/panelState.js';
function fixture(theme = 'cyber') {
function fixture(theme = 'tactical') {
const nodes = new Map();
const node = (id, collapsed = true) => {
const classes = new Set(collapsed ? ['collapsed'] : []);
@@ -49,7 +49,7 @@ function fixture(theme = 'cyber') {
}
test('explicit opening collapses side peers and claims their restoration lanes in every theme', () => {
for (const theme of ['tactical', 'minimal', 'cyber']) {
for (const theme of ['tactical', 'minimal']) {
const f = fixture(theme), prior = globalThis.document;
globalThis.document = f.doc;
try {
@@ -86,7 +86,7 @@ test('opening already-expanded Radio reveals Context and closes Display', () =>
});
test('restored preferences keep every saved panel open for the layout to normalize', () => {
for (const theme of ['tactical', 'minimal', 'cyber']) {
for (const theme of ['tactical', 'minimal']) {
const f = fixture(theme), prior = globalThis.document;
globalThis.document = f.doc;
try {
+19 -15
View File
@@ -366,15 +366,12 @@
flex-basis: 1.25rem;
}
/* At this width main shows the wings' icons only (command-dock-trays.css);
centre them in the slim wings. Cyber keeps its labels. */
centre them in the slim wings. */
@media (max-width: 900px) {
:root:not([data-ui-theme='cyber'])
#command-dock
> :is(#location-bar, #control-panel)
.dock-tray-toggle {
:root #command-dock > :is(#location-bar, #control-panel) .dock-tray-toggle {
justify-content: center;
}
:root:not([data-ui-theme='cyber'])
:root
#command-dock
:is(#location-bar, #control-panel)
:is(.location-toolbar-label, .panel-title) {
@@ -382,7 +379,7 @@
min-width: 0;
justify-content: center;
}
:root:not([data-ui-theme='cyber']) #command-dock .dock-label-icon {
:root #command-dock .dock-label-icon {
width: 1.25rem;
height: 1.25rem;
flex-basis: 1.25rem;
@@ -1448,16 +1445,15 @@ body[data-assistant-docked='true'] #right-context-rail {
box-shadow: 0 0 0 1px currentColor;
}
/* Assistant panels share the left panels' glass surface (layers.css). Cyber
keeps its own surfaces. */
:root:not([data-ui-theme='cyber']) #gev-voice-control {
/* Assistant panels share the left panels' glass surface (layers.css). */
:root #gev-voice-control {
--assistant-glass: var(--glass-bg);
--assistant-glass-border: var(--glass-border);
--assistant-glass-shadow:
0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.03) inset,
0 1px 0 rgba(255, 255, 255, 0.06) inset;
}
:root:not([data-ui-theme='cyber'])
:root
#command-dock
#gev-voice-control
:is(
@@ -1472,14 +1468,14 @@ body[data-assistant-docked='true'] #right-context-rail {
}
/* The mini reply sits inside the chat panel, whose own blur makes it the
backdrop root: a blur on the reply could not reach the map. */
:root:not([data-ui-theme='cyber'])
:root
#command-dock
#gev-voice-control
:is(#gev-chat-panel, #gev-voice-panel, #gev-voice-panel[data-minimized]) {
-webkit-backdrop-filter: blur(24px) saturate(1.4);
backdrop-filter: blur(24px) saturate(1.4);
}
:root:not([data-ui-theme='cyber'])
:root
#command-dock
#gev-voice-control
#gev-chat-panel[data-minimized='true']:focus-within {
@@ -1488,12 +1484,12 @@ body[data-assistant-docked='true'] #right-context-rail {
/* A backdrop-filter on the voice control would stop the panels inside it
from blurring the map, so its own blur moves to a layer behind it. */
:root:not([data-ui-theme='cyber']) #command-dock > #gev-voice-control {
:root #command-dock > #gev-voice-control {
isolation: isolate;
-webkit-backdrop-filter: none;
backdrop-filter: none;
}
:root:not([data-ui-theme='cyber']) #command-dock > #gev-voice-control::before {
:root #command-dock > #gev-voice-control::before {
content: '';
position: absolute;
inset: 0;
@@ -1698,3 +1694,11 @@ body[data-assistant-docked='true'] #right-context-rail {
--dock-side-compact: 3.25rem;
}
}
/* From 1200px the dock sits 74px up (command-dock.css), 74px - 2vh higher
than the bottom-edge dock this height budget was written for. */
@media (min-width: 1200px) {
#gev-chat-panel {
max-height: min(34rem, calc(100dvh - 10rem - 74px + 2vh));
}
}
+41 -63
View File
@@ -123,7 +123,7 @@
}
/* Display / Radio: the closed launchers and the open panels match too. */
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-control.is-expanded {
border-color: rgba(255, 255, 255, 0.08);
@@ -139,14 +139,14 @@
person, Utilities has nothing to do there, and the cockpit's own Display
panel stands in for Visual), one panel opens beside it, and the collapsed
header strips the cockpit used instead are hidden. */
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
#left-panel-stack
> .gev-panel-rail--left {
display: block;
}
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
#left-panel-stack
> .gev-panel-rail--left
@@ -155,7 +155,7 @@
[data-rail-item='utilities-panel'],
[data-rail-item='pp-toggles']
),
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
#left-panel-stack
> .gev-panel-rail--left
@@ -171,7 +171,7 @@
/* With some icons hidden, the runs between them break up: with a panel
open, each icon left is its own island. */
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
#left-panel-stack
> .gev-panel-rail--left
@@ -184,7 +184,7 @@
/* Authoring, Utilities or Visual may still be open underneath; its hidden icon must
not split the rail into islands. */
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
#left-panel-stack
> .gev-panel-rail--left
@@ -196,7 +196,7 @@
)[aria-pressed='true']
)
> .ui-tooltip::before,
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
#left-panel-stack
> .gev-panel-rail--left
@@ -211,7 +211,7 @@
display: none;
}
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
#left-panel-stack
> .gev-panel-rail--left
@@ -229,11 +229,11 @@
-webkit-backdrop-filter: blur(20px);
}
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
#left-panel-stack
> [data-panel-id].collapsed,
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
#left-panel-stack
> :is(
@@ -247,9 +247,7 @@
/* Both rails start at one height, just under the top HUD text, so their top
edges line up; the cockpit layout pass places Display and Radio at the
same height (COCKPIT_UTILITY_MIN_TOP_PX / _RATIO in cockpitPresentation.js). */
:root:not([data-ui-theme='cyber'])
body.cockpit-mode:not(.mobile-shell)
#left-panel-stack {
:root body.cockpit-mode:not(.mobile-shell) #left-panel-stack {
top: max(206px, 22vh) !important;
}
@@ -415,14 +413,14 @@ body.cockpit-mode #intel-hud .hud-bottom-right {
}
/* ── Open Display / Radio panels: the main panels' header and size ───── */
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-control.is-expanded {
min-width: 295px;
box-sizing: border-box;
}
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-control.is-expanded
.cockpit-utility-launcher {
@@ -435,7 +433,7 @@ body.cockpit-mode #intel-hud .hud-bottom-right {
letter-spacing: 0.22em;
}
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-control.is-expanded
.cockpit-utility-divider {
@@ -448,16 +446,14 @@ body.cockpit-mode #intel-hud .hud-bottom-right {
/* The launcher's own toggle steps aside: the rail and "−" open and close
the panel instead. */
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-control.is-expanded
.cockpit-utility-glyph {
display: none;
}
:root:not([data-ui-theme='cyber'])
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-collapse {
:root body.cockpit-mode:not(.mobile-shell) .cockpit-utility-collapse {
display: grid;
flex: none;
place-items: center;
@@ -472,10 +468,8 @@ body.cockpit-mode #intel-hud .hud-bottom-right {
cursor: pointer;
}
:root:not([data-ui-theme='cyber'])
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-collapse:hover,
:root:not([data-ui-theme='cyber'])
:root body.cockpit-mode:not(.mobile-shell) .cockpit-utility-collapse:hover,
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-collapse:focus-visible {
border-color: rgba(0, 212, 255, 0.45);
@@ -486,9 +480,7 @@ body.cockpit-mode #intel-hud .hud-bottom-right {
/* ── Right rail as on the left: an icon column that stays, labels beside it
while nothing is open, and the open panel to its left. The launchers'
own strips give way to it. ─────────────────────────────────────────── */
:root:not([data-ui-theme='cyber'])
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-controls {
:root body.cockpit-mode:not(.mobile-shell) .cockpit-utility-controls {
display: grid;
grid-template-columns: auto auto;
align-items: start;
@@ -496,13 +488,13 @@ body.cockpit-mode #intel-hud .hud-bottom-right {
column-gap: 6px;
}
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-control:not(.is-expanded) {
display: none;
}
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-control.is-expanded {
grid-column: 1;
@@ -510,16 +502,14 @@ body.cockpit-mode #intel-hud .hud-bottom-right {
margin-top: 0 !important;
}
/* Cyber and the phone keep the launchers' own toggles, so the rail and "−"
are for the desktop look only. */
/* The phone keeps the launchers' own toggles, so the rail and "−" are for
the desktop look only. */
.cockpit-utility-rail,
.cockpit-utility-collapse {
display: none;
}
:root:not([data-ui-theme='cyber'])
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-rail {
:root body.cockpit-mode:not(.mobile-shell) .cockpit-utility-rail {
grid-column: 2;
grid-row: 1;
display: flex;
@@ -528,7 +518,7 @@ body.cockpit-mode #intel-hud .hud-bottom-right {
pointer-events: auto;
}
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
:is(.cockpit-utility-rail__labels, .cockpit-utility-rail__icons) {
display: flex;
@@ -545,15 +535,13 @@ body.cockpit-mode #intel-hud .hud-bottom-right {
-webkit-backdrop-filter: blur(20px);
}
:root:not([data-ui-theme='cyber'])
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-rail__labels {
:root body.cockpit-mode:not(.mobile-shell) .cockpit-utility-rail__labels {
box-sizing: border-box;
width: 170px;
padding-inline: 14px;
}
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-rail__labels
> span {
@@ -569,16 +557,14 @@ body.cockpit-mode #intel-hud .hud-bottom-right {
letter-spacing: 2.08px;
}
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-rail.is-open
.cockpit-utility-rail__labels {
display: none;
}
:root:not([data-ui-theme='cyber'])
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-rail__item {
:root body.cockpit-mode:not(.mobile-shell) .cockpit-utility-rail__item {
display: grid;
place-items: center;
width: 32px;
@@ -595,24 +581,20 @@ body.cockpit-mode #intel-hud .hud-bottom-right {
border-color var(--transition-fast, 120ms);
}
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-rail__item
.material-symbols-outlined {
font-size: 18px;
}
:root:not([data-ui-theme='cyber'])
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-rail__item:hover {
:root body.cockpit-mode:not(.mobile-shell) .cockpit-utility-rail__item:hover {
background: rgba(255, 255, 255, 0.05);
color: var(--text-primary, #fff);
}
:root:not([data-ui-theme='cyber'])
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-rail__item.is-on,
:root:not([data-ui-theme='cyber'])
:root body.cockpit-mode:not(.mobile-shell) .cockpit-utility-rail__item.is-on,
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-rail__item.is-on:hover {
border-color: rgba(0, 212, 255, 0.15);
@@ -621,7 +603,7 @@ body.cockpit-mode #intel-hud .hud-bottom-right {
}
/* With a panel open, each icon is its own island, as on the main rails. */
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-rail.is-open
.cockpit-utility-rail__icons {
@@ -632,14 +614,14 @@ body.cockpit-mode #intel-hud .hud-bottom-right {
-webkit-backdrop-filter: none;
}
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-rail.is-open
.cockpit-utility-rail__item {
position: relative;
}
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-rail.is-open
.cockpit-utility-rail__item::before {
@@ -657,12 +639,12 @@ body.cockpit-mode #intel-hud .hud-bottom-right {
}
/* Hovering an icon lights its label too, as on the left. */
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-rail:has(.cockpit-utility-rail__item:nth-child(1):hover)
.cockpit-utility-rail__labels
> span:nth-child(1),
:root:not([data-ui-theme='cyber'])
:root
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-rail:has(.cockpit-utility-rail__item:nth-child(2):hover)
.cockpit-utility-rail__labels
@@ -671,22 +653,18 @@ body.cockpit-mode #intel-hud .hud-bottom-right {
}
/* Mirror the left rail's 52px inset, clear of the HUD's vertical readouts. */
:root:not([data-ui-theme='cyber'])
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-controls {
:root body.cockpit-mode:not(.mobile-shell) .cockpit-utility-controls {
right: 52px;
}
/* Like the cockpit's other windows (rtl.css), the rail keeps its physical
side in a right-to-left language: icons at the screen edge, the open panel
inside them. Only the text reads right to left. */
html[dir='rtl']:not([data-ui-theme='cyber'])
body.cockpit-mode:not(.mobile-shell)
.cockpit-utility-controls {
html[dir='rtl'] body.cockpit-mode:not(.mobile-shell) .cockpit-utility-controls {
direction: ltr;
}
html[dir='rtl']:not([data-ui-theme='cyber'])
html[dir='rtl']
body.cockpit-mode:not(.mobile-shell)
:is(.cockpit-utility-control.is-expanded, .cockpit-utility-rail__labels) {
direction: rtl;
+2 -47
View File
@@ -15,13 +15,8 @@
var(--cockpit-radar-label-height) + 14px
);
}
:root[data-ui-theme='cyber'] #cockpit-hud[data-subject='vessel'] {
--cockpit-radar-right: 30px;
}
:root[data-ui-theme='cyber'] #cockpit-hud[data-subject='vessel']::before {
clip-path: none;
}
:root:not([data-ui-theme='cyber']) body.cockpit-bridge {
:root body.cockpit-bridge {
--panel-radius: 2px;
--btn-radius: 2px;
}
@@ -252,25 +247,6 @@ body.cockpit-bridge #view-switcher button {
border-radius: 2px;
transform: none;
}
/* Cyber anchors the card's top from the layout pass; bound its height. */
:root[data-ui-theme='cyber']
#cockpit-hud[data-subject='vessel']
.cockpit-signal-window {
bottom: auto;
max-height: max(
44px,
min(
30vh,
280px,
calc(
100vh - var(--cockpit-signal-top, clamp(255px, 28vh, 300px)) -
var(--cockpit-radar-clearance)
)
)
);
clip-path: none;
}
/* The radar console: CockpitRadar fills it, label row included. */
#cockpit-hud[data-subject='vessel'] .cockpit-radar-console {
position: absolute;
@@ -296,15 +272,6 @@ body.cockpit-bridge #view-switcher button {
.cockpit-radar-console:has(> .cockpit-radar[hidden]) {
display: none;
}
:root[data-ui-theme='cyber']
#cockpit-hud[data-subject='vessel']
.cockpit-radar-console {
border-color: rgba(105, 203, 209, 0.34);
border-top-color: rgba(196, 84, 84, 0.82);
background:
linear-gradient(135deg, rgba(105, 203, 209, 0.07), transparent 38%),
rgba(8, 23, 27, 0.78);
}
@media (min-width: 761px) {
/* The heading tape narrows to stay clear of the console. */
@@ -318,18 +285,6 @@ body.cockpit-bridge #view-switcher button {
)
);
}
:root[data-ui-theme='cyber']
#cockpit-hud[data-subject='vessel']
.cockpit-compass {
width: min(
650px,
56vw,
calc(
100vw - 2 *
(var(--cockpit-radar-right) + var(--cockpit-radar-size) + 24px)
)
);
}
}
@media (min-width: 761px) and (min-height: 601px) {
/* The console takes the intel HUD's bottom-right corner. */
+2 -4
View File
@@ -489,10 +489,8 @@
#cockpit-hud[data-subject='satellite'] .cockpit-topline > div:first-child {
visibility: hidden;
}
:root[data-ui-theme='cyber'] #cockpit-hud[data-subject='satellite']::before {
clip-path: none;
}
:root:not([data-ui-theme='cyber']) body.cockpit-orbit {
:root body.cockpit-orbit {
--panel-radius: 2px;
--btn-radius: 2px;
}
+73 -17
View File
@@ -448,14 +448,18 @@
letter-spacing: 0.035rem;
}
/* Keep the complete inline attribution row above the command dock. */
/* From 1200px the attribution row sits on the bottom edge, on the Power Up
baseline, below the raised command dock (command-dock.css). It stops 26rem
short of the right edge, clear of the corner row (Power Up and the language
picker), and wraps rather than running under it. Below 1200px the dock
keeps to the bottom edge and the row sits above it. */
body:not(.ui-clean-view):not(.recording-mode) #cesium-credits,
body:not(.ui-clean-view):not(.recording-mode):has(
#intel-hud[data-variant='minimal'].active
)
#cesium-credits {
right: auto;
bottom: calc(2vh + 5rem + var(--world-timeline-lift, 0px));
bottom: 1rem;
left: 1.5rem;
width: auto !important;
max-width: calc(100vw - 3rem);
@@ -468,10 +472,11 @@ body:not(.ui-clean-view):not(.recording-mode):has(
)
#gev-credits {
right: auto;
bottom: calc(2vh + 5rem + var(--world-timeline-lift, 0px));
bottom: 1rem;
left: 1.5rem;
width: auto !important;
max-width: calc(100vw - 3rem);
width: max-content !important;
max-width: calc(100vw - 1.5rem - 26rem);
white-space: normal;
text-align: left;
}
@@ -494,6 +499,64 @@ body:not(.ui-clean-view):not(.recording-mode):has(
bottom: calc(2vh + 9rem + var(--world-timeline-lift, 0px));
}
/* The coordinate readout shares the bottom-left corner with the attribution
row below 1200px: it sits clear of the row's 28px logo line, with a 6px gap
(from 1200px, rail-split.css). */
#intel-hud:is([data-variant='tactical'], [data-variant='minimal'])
.hud-bottom-left,
:root[data-scope-mask='off']
#intel-hud[data-variant='minimal']
.hud-bottom-left {
bottom: calc(2vh + 7.125rem + var(--world-timeline-lift, 0px));
}
@media (max-width: 1199px) {
body:not(.ui-clean-view):not(.recording-mode) #cesium-credits,
body:not(.ui-clean-view):not(.recording-mode):has(
#intel-hud[data-variant='minimal'].active
)
#cesium-credits,
body:not(.ui-clean-view):not(.recording-mode) #gev-credits,
body:not(.ui-clean-view):not(.recording-mode):has(
#intel-hud[data-variant='minimal'].active
)
#gev-credits {
bottom: calc(2vh + 5rem + var(--world-timeline-lift, 0px));
width: auto !important;
max-width: calc(100vw - 3rem);
white-space: nowrap;
}
}
@media (min-width: 1200px) {
/* Cesium draws the line in an absolutely placed box inside the empty
#cesium-credits anchor, so the cap and the wrapping go on that box. */
#cesium-credits .cesium-widget-credits {
width: max-content;
max-width: calc(100vw - 1.5rem - 26rem);
white-space: normal;
}
/* Right to left, the corner row sits at the bottom left
(locale-picker.css), so the attribution row takes the bottom right.
Expanded Context places it itself (context-dock.css). */
html[dir='rtl']
body:not(.context-docked):not(.ui-clean-view):not(.recording-mode)
:is(#cesium-credits, #gev-credits) {
right: 1.5rem;
left: auto;
text-align: right;
}
html[dir='rtl']
body:not(.context-docked):not(.ui-clean-view):not(.recording-mode)
#cesium-credits
.cesium-widget-credits {
right: 0;
left: auto;
}
}
@media (max-width: 900px) {
body:not(.ui-clean-view):not(.recording-mode) #cesium-credits,
body:not(.ui-clean-view):not(.recording-mode):has(
@@ -522,13 +585,9 @@ body:not(.ui-clean-view):not(.recording-mode):has(
/* The wings shrink to --dock-side-compact at this width, open or closed (an
open tray pops out above the dock), which is too narrow for the text
labels; they would spill over the voice control and take its taps. The
wings show only their icon; the toggles keep their aria-label. Cyber sets
a wider --dock-side-compact that fits its labels, so it keeps them. */
:root:not([data-ui-theme='cyber'])
#command-dock
:is(#location-bar, #control-panel)
.panel-title,
:root:not([data-ui-theme='cyber'])
wings show only their icon; the toggles keep their aria-label. */
:root #command-dock :is(#location-bar, #control-panel) .panel-title,
:root
#command-dock
:is(#location-bar, #control-panel)
.location-toolbar-label {
@@ -538,11 +597,8 @@ body:not(.ui-clean-view):not(.recording-mode):has(
gap: 0;
}
:root:not([data-ui-theme='cyber'])
#command-dock
:is(#location-bar, #control-panel)
.panel-title::after,
:root:not([data-ui-theme='cyber'])
:root #command-dock :is(#location-bar, #control-panel) .panel-title::after,
:root
#command-dock
:is(#location-bar, #control-panel)
.location-toolbar-label::after {
+11 -2
View File
@@ -2,8 +2,9 @@
#command-dock {
position: fixed;
right: auto;
/* Above the world timeline while it shows (world-timeline.css). */
bottom: calc(2vh + var(--world-timeline-lift, 0px));
/* 74px up from 1200px, leaving the bottom row to the map credits and
Power Up; above the world timeline while it shows (world-timeline.css). */
bottom: calc(74px + var(--world-timeline-lift, 0px));
left: 50%;
z-index: 145;
display: grid;
@@ -273,6 +274,14 @@ body.recording-mode #gev-credits {
bottom: calc(2vh + 11.5rem + var(--world-timeline-lift, 0px));
}
/* Below 1200px the dock reaches the bottom corners, so it keeps to the
bottom edge and the credits and coordinates sit above it. */
@media (max-width: 1199px) {
#command-dock {
bottom: calc(2vh + var(--world-timeline-lift, 0px));
}
}
@media (max-width: 980px) {
#command-dock {
grid-template-areas:
+15 -33
View File
@@ -97,7 +97,7 @@
/* A hovered panel sets --rail-label-hover on itself (see below); its own
header picks it up. Radio sits inside Context and keeps its own colour. */
:root:not([data-ui-theme='cyber'])
:root
:is(#left-panel-stack, #right-context-rail)
:is(
.panel-header > .panel-title,
@@ -112,9 +112,8 @@
}
/* A title never pushes its toggle out of the card: one that does not fit
ends in an ellipsis. Cyber draws a marker left of the title, which a clip
would cut, and keeps its own header layout. */
:root:not([data-ui-theme='cyber'])
ends in an ellipsis. */
:root
:is(#left-panel-stack, #right-context-rail)
:is(.panel-header > .panel-title, .pp-header-label) {
min-width: 0;
@@ -126,25 +125,25 @@
so the header drops it and packs closer. English titles such as Recent
Imagery then fit whole. Only the rail's own launchers: Radio, nested in
Context, keeps its divider. */
:root:not([data-ui-theme='cyber'])
:root
:is(#left-panel-stack, #right-context-rail)
> .panel-collapsible.collapsed
> [class$='-panel-inner']
> .panel-header,
:root:not([data-ui-theme='cyber'])
:root
:is(#left-panel-stack, #right-context-rail)
> #pp-toggles.collapsed
> .pp-header-row {
gap: 8px;
}
:root:not([data-ui-theme='cyber'])
:root
:is(#left-panel-stack, #right-context-rail)
> .panel-collapsible.collapsed
> [class$='-panel-inner']
> .panel-header
> .panel-divider,
:root:not([data-ui-theme='cyber'])
:root
:is(#left-panel-stack, #right-context-rail)
> #pp-toggles.collapsed
> .pp-header-row
@@ -152,13 +151,13 @@
display: none;
}
:root:not([data-ui-theme='cyber'])
:root
:is(#left-panel-stack, #right-context-rail)
> .panel-collapsible.collapsed
> [class$='-panel-inner']
> .panel-header
> .panel-collapse-btn,
:root:not([data-ui-theme='cyber'])
:root
:is(#left-panel-stack, #right-context-rail)
> #pp-toggles.collapsed
> .pp-header-row
@@ -216,7 +215,7 @@ html:not([lang='en']):not(:lang(zh)):not(:lang(ja))
brighter edge and an accent title and toggle. Touch screens have no hover,
so a tap must not leave a panel lit. */
@media (hover: hover) and (pointer: fine) {
:root:not([data-ui-theme='cyber'])
:root
:is(#left-panel-stack, #right-context-rail)
:where(
.data-panel-inner,
@@ -233,7 +232,7 @@ html:not([lang='en']):not(:lang(zh)):not(:lang(ja))
transition: border-color var(--transition-fast);
}
:root:not([data-ui-theme='cyber'])
:root
:is(#left-panel-stack, #right-context-rail)
:where(
.data-panel-inner,
@@ -560,14 +559,12 @@ html:not([lang='en']):not(:lang(zh)):not(:lang(ja))
}
/* Display's title and toggle sit where the other panels' do: 14px of panel
padding plus a 4px header inset. The cyber theme sets its own insets. */
:root:not([data-ui-theme='cyber']) #pp-toggles.collapsed > .pp-header-row {
padding plus a 4px header inset. */
:root #pp-toggles.collapsed > .pp-header-row {
padding: 8px 18px;
}
:root:not([data-ui-theme='cyber'])
#pp-toggles:not(.collapsed)
> .pp-header-row {
:root #pp-toggles:not(.collapsed) > .pp-header-row {
padding: 0 10px;
}
@@ -580,10 +577,7 @@ html:not([lang='en']):not(:lang(zh)):not(:lang(ja))
}
/* In the default theme Display's toggle matches the other panels' 22px. */
:root:not([data-ui-theme='cyber'])
#pp-toggles
> .pp-header-row
.pp-collapse-btn {
:root #pp-toggles > .pp-header-row .pp-collapse-btn {
width: 22px;
height: 22px;
font-size: 13px;
@@ -746,14 +740,6 @@ html:not([lang='en']) .pp-slider-row > .pp-slider-mini-label {
min-width: 200px;
}
.cyber-sonar-control {
display: none;
}
:root[data-ui-theme='cyber'] .cyber-sonar-control {
display: flex;
}
.cyber-sonar-toggle-row,
.cyber-sonar-setting {
min-width: 200px;
@@ -764,10 +750,6 @@ html:not([lang='en']) .pp-slider-row > .pp-slider-mini-label {
min-width: 48px;
}
:root[data-cyber-sonar='off'] .cyber-sonar-setting {
display: none;
}
/* Map Source tiles live with Visual Presets in the bottom command tray. */
.map-source-section {
display: grid;
File diff suppressed because it is too large. Load diff
+3 -5
View File
@@ -1020,10 +1020,8 @@ body.recording-mode .gev-panel-rail {
}
/* Data Layers and Context share the 14px side padding of the other default
theme panels, so every title and toggle sits 19px from its edge. Cyber
keeps its own gutters. */
:root:not([data-ui-theme='cyber'])
:is(.data-panel-inner, .global-context-panel-inner) {
theme panels, so every title and toggle sits 19px from its edge. */
:root :is(.data-panel-inner, .global-context-panel-inner) {
padding-right: 14px;
padding-left: 14px;
}
@@ -1328,7 +1326,7 @@ body.recording-mode #right-context-rail > [data-panel-id] {
}
/* Draw marks its on state with an accent edge, like an active DISPLAY
button; Cyber swaps in its red edge (cyber.css). */
button. */
#utilities-panel
.utilities-tools
.pp-toggle-btn:is([aria-pressed='true'], .active) {
+2 -25
View File
@@ -47,8 +47,8 @@
color: var(--text-primary);
-webkit-backdrop-filter: blur(22px) saturate(1.3);
backdrop-filter: blur(22px) saturate(1.3);
/* The blur follows the surface's shape (Cyber's cut corners). The dialog
has no outward popups for a clip to hide. */
/* The blur follows the surface's shape. The dialog has no outward popups
for a clip to hide. */
clip-path: var(--panel-surface-frame);
}
@@ -102,14 +102,6 @@
overflow-wrap: anywhere;
}
:root[data-ui-theme='cyber'] .data-library-stat {
border-radius: 0;
}
:root[data-ui-theme='cyber'] .data-library-stat-value {
font-family: var(--font-mono);
}
.data-library-intro {
margin: 0 0 10px;
color: rgba(232, 234, 237, 0.72);
@@ -321,21 +313,6 @@
font: 10px/1.5 var(--font-mono);
}
:root[data-ui-theme='cyber'] .data-library-dialog {
--glass-bg: rgba(18, 24, 27, 0.62);
width: min(600px, calc(100vw - 32px));
}
:root[data-ui-theme='cyber'] .data-library-item {
border-radius: 0;
}
:root[data-ui-theme='cyber']
:is(.data-library-icon, .data-library-badge--good) {
color: var(--cyber-red-bright);
border-color: var(--cyber-red-bright);
}
@media (max-width: 720px) {
.data-library-stats {
grid-template-columns: repeat(2, minmax(0, 1fr));
-5
View File
@@ -94,11 +94,6 @@
width: 100%;
}
}
:root[data-ui-theme='cyber'] .news-panel-inner {
border-radius: 0;
clip-path: var(--cyber-panel-frame);
box-shadow: var(--cyber-panel-shadow);
}
.news-readout {
display: flex;
+3 -1
View File
@@ -326,8 +326,10 @@ body:not(.mobile-shell):not(.cockpit-mode):not(.scene-playback-mode):not(
:is(#cesium-credits, #gev-credits) {
bottom: 1rem;
}
/* 8px above the bottom-right corner row (Power Up and the language picker:
32px tall, 14px up), as outside the Omnibar layout. */
#intel-hud[data-variant='tactical'] .hud-bottom-right {
bottom: calc(4.2rem - 26px);
bottom: 3.375rem;
}
#intel-hud:is([data-variant='tactical'], [data-variant='minimal'])
.hud-bottom-left {
+7 -15
View File
@@ -329,7 +329,7 @@
:root[data-scope-mask='off']
#intel-hud:is([data-variant='minimal'], [data-variant='tactical'])
.hud-readout,
:root[data-scope-mask='off']:not([data-ui-theme='cyber']) .scene-text-holdout {
:root[data-scope-mask='off'] .scene-text-holdout {
background: rgba(0, 0, 0, 0.7);
box-shadow: none;
border-radius: 2px;
@@ -357,9 +357,7 @@
#intel-hud:is([data-variant='minimal'], [data-variant='tactical'])
:is(.hud-top-right, .hud-bottom-right)
.hud-readout,
:root[data-scope-mask='off']:not([data-ui-theme='cyber'])
#style-indicator
.scene-text-holdout {
:root[data-scope-mask='off'] #style-indicator .scene-text-holdout {
margin-inline-start: auto;
}
@@ -399,9 +397,7 @@
text-overflow: ellipsis;
}
:root[data-scope-mask='off']:not([data-ui-theme='cyber'])
#title-bar
h1::before {
:root[data-scope-mask='off'] #title-bar h1::before {
content: '';
position: absolute;
inset: -0.12em -6px;
@@ -410,18 +406,16 @@
background: rgba(0, 0, 0, 0.7);
}
:root[data-scope-mask='off']:not([data-ui-theme='cyber'])
:root[data-scope-mask='off']
:is(#title-bar .subtitle, #style-indicator .indicator-label) {
color: var(--text-secondary);
}
:root[data-scope-mask='off']:not([data-ui-theme='cyber']) #title-bar .subtitle {
:root[data-scope-mask='off'] #title-bar .subtitle {
margin-top: 8px;
}
:root[data-scope-mask='off']:not([data-ui-theme='cyber'])
#style-indicator
.indicator-value {
:root[data-scope-mask='off'] #style-indicator .indicator-value {
margin-top: 4px;
}
@@ -431,8 +425,6 @@
display: none;
}
:root[data-scope-mask='off']:not([data-ui-theme='cyber'])
#title-bar
.frame-rate-readout {
:root[data-scope-mask='off'] #title-bar .frame-rate-readout {
margin-top: 6px;
}
-17
View File
@@ -42,23 +42,6 @@
--panel-surface-collapsed-width: var(--left-collapsed-width);
}
:root[data-ui-theme='cyber'] {
--panel-surface-font: var(--font-mono);
--panel-surface-detail: var(--cyber-panel-surface-detail);
--panel-surface-frame: var(--cyber-panel-frame);
--panel-surface-shadow: var(--cyber-panel-shadow);
--panel-surface-title: var(--cyber-red-bright);
--panel-surface-error: var(--cyber-red-bright);
--panel-surface-width: var(--cyber-panel-width);
--panel-surface-collapsed-width: var(--cyber-panel-collapsed-width);
}
:root[data-ui-theme='cyber']
#right-context-rail
> [data-panel-id]:has(> [data-panel-surface]) {
--panel-surface-width: var(--cyber-right-panel-width);
}
:is([data-panel-surface], [data-panel-popup]) {
isolation: isolate;
min-width: 0;
+37 -3
View File
@@ -104,8 +104,8 @@
/* In clean view the screen-edge gutters stay empty: the HUD's vertical edge
readouts (ONA / COLL on the left, BAND / BITS / LVL on the right) are not
shown. Cyber lays its HUD out differently and keeps them. */
:root:not([data-ui-theme='cyber']) body.ui-clean-view #intel-hud .hud-edge {
shown. */
:root body.ui-clean-view #intel-hud .hud-edge {
display: none !important;
}
@@ -116,9 +116,43 @@
bottom: calc(2vh + 6.5rem - 26px);
}
/* From 1200px the dock sits 74px up (command-dock.css) and clears both
corners, which are at most ~340px wide beside a ~500px dock. The readout
sits 8px above the bottom-right corner row (Power Up and the language
picker: 32px tall, 14px up) and the coordinates start level with it. The
World Timeline sits on the dock's floor between the corners (44rem
narrower than the screen), so the corners stay put while it shows. */
@media (min-width: 1200px) {
#intel-hud[data-variant='tactical'] .hud-bottom-right {
bottom: calc(4.2rem - 26px);
bottom: 3.375rem;
}
#intel-hud:is([data-variant='tactical'], [data-variant='minimal'])
.hud-bottom-left,
:root[data-scope-mask='off']
#intel-hud[data-variant='minimal']
.hud-bottom-left {
bottom: calc(3.375rem + 26px);
}
#world-timeline {
width: min(820px, calc(100vw - 44rem));
}
/* The raised dock is 74px - 2vh higher than the bottom-edge dock these
height budgets were written for. Toasts keep 12px above the 62px dock. */
#gev-voice-control .gev-voice-panel {
max-height: min(
28rem,
max(
7.5rem,
calc(100dvh - 12rem - 74px + 2vh - var(--gev-provider-lift, 0px))
)
);
}
body:not(.ui-clean-view):not(.recording-mode):not(.cockpit-mode) #toast {
bottom: calc(148px + var(--world-timeline-lift, 0px));
}
}
-6
View File
@@ -92,12 +92,6 @@ html:lang(he) :is(#intel-hud, #cockpit-hud) {
left: var(--right-rail-x);
}
}
@media (min-width: 961px) and (min-height: 650px) {
html[dir='rtl'][data-ui-theme='cyber'] #right-context-rail {
right: auto;
left: calc(51px + var(--panel-rail-clearance));
}
}
/* The dock's wings swap sides (Location on the right, Visual presets on the
left), so each slide-up tray is anchored from the wing's outer edge and
+1 -1
View File
@@ -220,7 +220,7 @@ html:not([lang='en']) #scene-panel .scene-controls .scene-btn {
}
/* One primary action per step: CAPTURE SHOT and PLAY. The panel id keeps
this above Cyber's shared button surface. */
this above the shared button surface. */
#scene-panel .scene-btn-primary:not(:disabled) {
color: var(--accent);
border-color: color-mix(in srgb, var(--accent) 55%, transparent);
+89
View File
@@ -0,0 +1,89 @@
/* Sonar is an opt-in visual style over any HUD layout (Display > HUD >
Sonar). Off by default; cockpit mode and reduced motion keep the map still. */
.hud-sonar {
display: none;
}
:root[data-cyber-sonar='on'] #intel-hud .hud-sonar {
position: fixed;
top: 50%;
left: 50%;
display: block;
width: min(
var(--cyber-sonar-size-vw, 80vw),
var(--cyber-sonar-size-vh, 104vh)
);
aspect-ratio: 1;
border: 1px solid rgba(226, 235, 236, 0.2);
border-radius: 50%;
opacity: var(--cyber-sonar-visual-intensity, 0.57);
overflow: hidden;
pointer-events: none;
transform: translate(-50%, -50%);
box-shadow:
0 0 0 1px rgba(196, 84, 84, 0.12),
inset 0 0 48px rgba(196, 84, 84, 0.035);
}
:root[data-cyber-sonar='on'] #intel-hud .hud-sonar::before,
:root[data-cyber-sonar='on'] #intel-hud .hud-sonar::after {
position: absolute;
inset: 0;
border-radius: inherit;
content: '';
}
:root[data-cyber-sonar='on'] #intel-hud .hud-sonar::before {
opacity: 0.52;
background: repeating-radial-gradient(
circle,
transparent 0 calc(var(--cyber-sonar-ring-step, 12.5%) - 1px),
rgba(226, 235, 236, 0.17) calc(var(--cyber-sonar-ring-step, 12.5%) - 1px)
var(--cyber-sonar-ring-step, 12.5%)
);
}
:root[data-cyber-sonar='on'] #intel-hud .hud-sonar::after {
background: conic-gradient(
from 0deg,
rgba(245, 250, 250, 0.3) 0deg,
rgba(235, 116, 116, 0.14) 0.55deg,
rgba(196, 84, 84, 0.075) var(--cyber-sonar-sector-quarter, 6deg),
rgba(150, 206, 215, 0.035) var(--cyber-sonar-sector-middle, 14.4deg),
transparent var(--cyber-sonar-sector-width, 24deg) 360deg
);
filter: drop-shadow(0 0 4px rgba(226, 235, 236, 0.1));
mask-image: radial-gradient(
circle,
#000 0 84%,
rgba(0, 0, 0, 0.65) 92%,
transparent 100%
);
transform-origin: 50% 50%;
will-change: transform;
animation: cyber-sonar-sweep 5.2s linear infinite;
animation-delay: var(--cyber-sonar-phase-delay, 0ms);
}
@keyframes cyber-sonar-sweep {
to {
transform: rotate(360deg);
}
}
#cyber-sonar-status:empty {
display: none;
}
:root[data-cyber-sonar='on'] body.cockpit-mode #intel-hud .hud-sonar,
:root[data-cyber-sonar='on'] #intel-hud:not(.active) .hud-sonar {
display: none;
}
@media (prefers-reduced-motion: reduce) {
:root[data-cyber-sonar='on'] #intel-hud .hud-sonar::after {
display: none;
animation: none;
}
}
+24 -68
View File
@@ -158,9 +158,8 @@ body.mobile-shell #pp-toggles .visual-presets {
margin-top: 0.2rem;
}
/* The card skin below is the default look; the Cyber HUD keeps its own red
skin for these controls (cyber.css), so the skin stands aside there. */
:root:not([data-ui-theme='cyber']) #pp-toggles .pp-toggle-group {
/* The Display panel's card skin. */
:root #pp-toggles .pp-toggle-group {
width: 100%;
overflow: hidden;
background: rgba(255, 255, 255, 0.03);
@@ -169,11 +168,8 @@ body.mobile-shell #pp-toggles .visual-presets {
}
/* The header row of a card, and the lone Clean UI button. */
:root:not([data-ui-theme='cyber'])
#pp-toggles
.pp-toggle-group
> .pp-toggle-btn,
:root:not([data-ui-theme='cyber']) #pp-toggles .pp-panel-body > .pp-toggle-btn {
:root #pp-toggles .pp-toggle-group > .pp-toggle-btn,
:root #pp-toggles .pp-panel-body > .pp-toggle-btn {
position: relative;
box-sizing: border-box;
width: 100%;
@@ -188,20 +184,20 @@ body.mobile-shell #pp-toggles .visual-presets {
-webkit-backdrop-filter: none;
}
:root:not([data-ui-theme='cyber']) #pp-toggles .pp-panel-body > .pp-toggle-btn {
:root #pp-toggles .pp-panel-body > .pp-toggle-btn {
background: rgba(255, 255, 255, 0.03) !important;
border: 1px solid rgba(255, 255, 255, 0.07) !important;
border-radius: 10px !important;
}
:root:not([data-ui-theme='cyber']) #pp-toggles .pp-toggle-btn .pp-icon {
:root #pp-toggles .pp-toggle-btn .pp-icon {
width: 18px;
font-size: 15px;
text-align: center;
color: rgba(199, 214, 222, 0.75);
}
:root:not([data-ui-theme='cyber']) #pp-toggles .pp-toggle-btn .pp-label {
:root #pp-toggles .pp-toggle-btn .pp-label {
color: rgba(236, 244, 248, 0.9);
font-family: var(--font-mono);
font-size: 0.62rem;
@@ -211,14 +207,8 @@ body.mobile-shell #pp-toggles .visual-presets {
/* An on/off pill at the right of every button header (Scope keeps its
checkbox, which already says it). */
:root:not([data-ui-theme='cyber'])
#pp-toggles
.pp-toggle-group
> button.pp-toggle-btn::after,
:root:not([data-ui-theme='cyber'])
#pp-toggles
.pp-panel-body
> button.pp-toggle-btn::after {
:root #pp-toggles .pp-toggle-group > button.pp-toggle-btn::after,
:root #pp-toggles .pp-panel-body > button.pp-toggle-btn::after {
/* The state is the button's own (aria-pressed); the pill only shows it. */
content: var(--pp-pill-off, 'OFF') / '';
margin-inline-start: auto;
@@ -231,68 +221,40 @@ body.mobile-shell #pp-toggles .visual-presets {
border-radius: 999px;
}
:root:not([data-ui-theme='cyber'])
#pp-toggles
.pp-toggle-group
> button.pp-toggle-btn.active::after,
:root:not([data-ui-theme='cyber'])
:root #pp-toggles .pp-toggle-group > button.pp-toggle-btn.active::after,
:root
#pp-toggles
.pp-toggle-group
> button.pp-toggle-btn[aria-pressed='true']::after,
:root:not([data-ui-theme='cyber'])
#pp-toggles
.pp-panel-body
> button.pp-toggle-btn.active::after {
:root #pp-toggles .pp-panel-body > button.pp-toggle-btn.active::after {
content: var(--pp-pill-on, 'ON') / '';
color: #7af0ff;
border-color: rgba(54, 220, 255, 0.5);
background: rgba(54, 220, 255, 0.1);
}
:root:not([data-ui-theme='cyber']) #pp-toggles .pp-toggle-btn.active .pp-icon,
:root:not([data-ui-theme='cyber'])
#pp-toggles
.pp-toggle-btn[aria-pressed='true']
.pp-icon,
:root:not([data-ui-theme='cyber']) #pp-toggles .pp-toggle-btn.active .pp-label,
:root:not([data-ui-theme='cyber'])
#pp-toggles
.pp-toggle-btn[aria-pressed='true']
.pp-label {
:root #pp-toggles .pp-toggle-btn.active .pp-icon,
:root #pp-toggles .pp-toggle-btn[aria-pressed='true'] .pp-icon,
:root #pp-toggles .pp-toggle-btn.active .pp-label,
:root #pp-toggles .pp-toggle-btn[aria-pressed='true'] .pp-label {
color: #7af0ff;
}
:root:not([data-ui-theme='cyber'])
#pp-toggles
.pp-toggle-group
> .pp-toggle-btn:hover,
:root:not([data-ui-theme='cyber'])
#pp-toggles
.pp-panel-body
> .pp-toggle-btn:hover {
:root #pp-toggles .pp-toggle-group > .pp-toggle-btn:hover,
:root #pp-toggles .pp-panel-body > .pp-toggle-btn:hover {
background: rgba(255, 255, 255, 0.04) !important;
}
:root:not([data-ui-theme='cyber'])
#pp-toggles
.pp-scope-toggle
input[type='checkbox'] {
:root #pp-toggles .pp-scope-toggle input[type='checkbox'] {
margin-inline-start: auto;
}
/* Settings inside a card: separated by hairlines, no boxes of their own. */
:root:not([data-ui-theme='cyber'])
:root #pp-toggles .pp-toggle-group .pp-slider-row.visible,
:root
#pp-toggles
.pp-toggle-group
.pp-slider-row.visible,
:root:not([data-ui-theme='cyber'])
#pp-toggles
.pp-toggle-group
.pp-slider-row:not([class*='cyber-sonar']):is(
.visible,
#scope-slider-row,
#scope-opacity-row
) {
.pp-slider-row:is(.visible, #scope-slider-row, #scope-opacity-row) {
margin: 0;
padding: 7px 12px;
background: transparent;
@@ -302,14 +264,8 @@ body.mobile-shell #pp-toggles .visual-presets {
}
/* The Dense button lights green elsewhere; in a card it uses the shared pill. */
:root:not([data-ui-theme='cyber'])
#pp-toggles
.pp-toggle-group
> .pp-toggle-btn.panoptic,
:root:not([data-ui-theme='cyber'])
#pp-toggles
.pp-toggle-group
> .pp-toggle-btn.active {
:root #pp-toggles .pp-toggle-group > .pp-toggle-btn.panoptic,
:root #pp-toggles .pp-toggle-group > .pp-toggle-btn.active {
color: inherit;
}
+1 -6
View File
@@ -418,12 +418,7 @@ body.recording-mode .gev-pointer-reticle {
text-align: start;
transform: translateX(-50%);
}
:root[data-ui-theme='cyber'] #gev-voice-control .gev-voice-panel {
background-color: var(--cyber-panel-surface);
background-image: var(--cyber-panel-surface-detail);
border-color: var(--glass-border);
box-shadow: var(--cyber-panel-shadow);
}
#gev-voice-control .gev-voice-panel[hidden],
#gev-voice-control .gev-voice-panel [hidden] {
display: none;
+1 -10
View File
@@ -319,16 +319,7 @@ html:not([lang='en'])
outline: 2px solid var(--voice-panel-accent, var(--accent));
outline-offset: 2px;
}
:root[data-ui-theme='cyber']
#gev-voice-control:has(> .gev-voice-settings-button) {
--voice-panel-accent: var(--cyber-red-bright);
}
:root[data-ui-theme='cyber']
#gev-voice-control:has(> .gev-voice-settings-button)
.gev-voice-provider-field {
background: var(--cyber-panel-surface);
border-color: var(--glass-border);
}
@media (pointer: coarse) {
#gev-voice-control .gev-voice-settings-button {
width: 44px;
+8 -2
View File
@@ -28,7 +28,8 @@ body.cockpit-mode #world-timeline {
#world-timeline {
direction: ltr;
position: fixed;
bottom: 2vh;
/* The dock's floor (command-dock.css); the dock rises above the bar. */
bottom: 74px;
left: 50%;
z-index: 146;
display: flex;
@@ -309,6 +310,12 @@ body.cockpit-mode #world-timeline {
outline-offset: 2px;
}
@media (max-width: 1199px) {
#world-timeline {
bottom: 2vh;
}
}
@media (max-width: 720px) {
#world-timeline {
bottom: 8px;
@@ -347,4 +354,3 @@ body.mobile-shell #world-timeline .world-timeline-speed {
order: 2;
height: 32px;
}
+2 -46
View File
@@ -126,10 +126,8 @@ const tickStyle = (tick) =>
<div v-if="generic && hud.veil" class="cockpit-veil" :class="{ streaks: hud.veil.streaks }" :style="veilStyle" aria-hidden="true"></div>
<!-- In orbit the picture keeps only the nadir reticle, readout and zoom. -->
<CockpitOrbital v-if="orbital" />
<!-- One optical coordinate system: every targeting mark shares this center.
Decorative only; telemetry and interactive panels remain separate.
A bridge looks out through straight window mullions instead: a header
beam, two pane posts and the sill either side of the console. -->
<!-- A bridge looks out through straight window mullions: a header beam,
two pane posts and the sill either side of the console. -->
<svg v-if="bridge" class="cockpit-frame-lines cockpit-bridge-frame" viewBox="0 0 1200 720" preserveAspectRatio="none" aria-hidden="true" focusable="false">
<g fill="none" stroke="currentColor">
<path d="M0 96H1200 M0 101H1200"/>
@@ -137,48 +135,6 @@ const tickStyle = (tick) =>
<path d="M0 600H324 M876 600H1200"/>
</g>
</svg>
<svg v-else-if="!orbital && !generic" class="cockpit-frame-lines" viewBox="0 0 1200 720" preserveAspectRatio="none" aria-hidden="true" focusable="false">
<g fill="none" stroke="currentColor">
<path d="M42 106H234L266 126H334 M866 126H934L966 106H1158 M42 114H226L258 136H318 M882 136H942L974 114H1158"/>
<path d="M42 616H226L254 598H320 M880 598H946L974 616H1158 M42 624H238L266 606H330 M870 606H934L962 624H1158"/>
<path d="M322 650H878L858 622H728L708 634H492L472 622H342Z M348 659H852"/>
<path d="M72 160H144L158 174V186 M1056 160H1128L1142 174V186 M72 562H144L158 548V536 M1056 562H1128L1142 548V536"/>
</g>
<path class="cockpit-frame-warning" d="M338 645H476L490 654H710L724 645H862" fill="none"/>
<path class="cockpit-frame-meter" d="M372 642H418 M782 642H828"/>
</svg>
<div v-if="!bridge && !orbital && !generic" class="cockpit-scan-array" aria-hidden="true">
<svg class="cockpit-target-geometry" viewBox="0 0 600 600" fill="none" focusable="false">
<g class="cockpit-target-hairline">
<circle cx="300" cy="300" r="276"/>
<circle class="cockpit-target-drift" cx="300" cy="300" r="250" stroke-dasharray="1 13"/>
<circle cx="300" cy="300" r="164"/>
<path d="M190 237V363 M410 237V363 M99 227H139 M461 227H501 M99 373H139 M461 373H501"/>
<path d="M86 113H118L134 129 M514 113H482L466 129 M86 487H118L134 471 M514 487H482L466 471"/>
</g>
<g class="cockpit-target-side-arcs">
<path d="M70 167A266 266 0 0 0 70 433 M530 167A266 266 0 0 1 530 433"/>
</g>
<g class="cockpit-target-ticks">
<path d="M166 125A220 220 0 0 1 434 125 M166 475A220 220 0 0 0 434 475"/>
</g>
<g class="cockpit-target-dots">
<path d="M180 130A208 208 0 0 1 420 130 M180 470A208 208 0 0 0 420 470"/>
</g>
<g class="cockpit-target-warning-dots">
<path d="M172 112A227 227 0 0 1 428 112 M172 488A227 227 0 0 0 428 488"/>
</g>
<g class="cockpit-target-core">
<!-- One outer ring and a spaced rotor leave the aiming center open. -->
<circle class="cockpit-target-orbit" cx="300" cy="300" r="132" stroke-dasharray="186 21"/>
<circle class="cockpit-target-rotor" cx="300" cy="300" r="104" stroke-dasharray="128 35" transform="rotate(9 300 300)"/>
<path class="cockpit-target-spokes" d="M206 206L250 250 M350 350L394 394 M394 206L350 250 M250 350L206 394"/>
<path d="M168 291H180V309H168 M432 291H420V309H432"/>
<circle cx="206" cy="206" r="3"/><circle cx="394" cy="206" r="3"/>
<circle cx="206" cy="394" r="3"/><circle cx="394" cy="394" r="3"/>
</g>
</svg>
</div>
<div v-if="!orbital" class="cockpit-visor-shell" aria-hidden="true">
<!-- A ship's bridge keeps no roll arc or pitch ladder. -->
<div v-if="!bridge && !generic" class="cockpit-roll-arc">
+5 -24
View File
@@ -1,6 +1,6 @@
<script setup>
import { storeToRefs } from 'pinia';
import { computed, onBeforeUnmount, onMounted, shallowRef } from 'vue';
import { computed } from 'vue';
import { t } from '../../i18n/index.js';
import { vClassToggle } from '../rail/classToggle.js';
import { vFieldValue } from '../rail/fieldValue.js';
@@ -18,23 +18,6 @@ const available = computed(() => view.value?.available !== false);
const chip = computed(() => view.value?.chip ?? null);
const dialog = computed(() => view.value?.dialog ?? { hidden: true, visible: false });
// Cyber puts the chip in the top toolbar; every other theme keeps it first in
// the corner row, beside the language picker.
const cyber = shallowRef(false);
let themeObserver = null;
onMounted(() => {
const theme = document.documentElement;
const sync = () => {
cyber.value =
theme.dataset.uiTheme === 'cyber' &&
Boolean(document.getElementById('top-center-actions'));
};
themeObserver = new MutationObserver(sync);
themeObserver.observe(theme, { attributes: true, attributeFilter: ['data-ui-theme'] });
sync();
});
onBeforeUnmount(() => themeObserver?.disconnect());
// The status line is a live region; vStatusText re-announces repeats.
const statusText = computed(() => ({
text:
@@ -55,12 +38,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">
<Teleport v-if="available" :to="cyber ? '#top-center-actions' : 'body'" :disabled="!cyber">
<button id="key-setup-chip" type="button" :hidden="!chip || chip.hidden" aria-haspopup="dialog" aria-controls="key-setup" :title="chip?.title" :aria-label="chip?.title" @click="controls?.open()">
<span class="material-symbols-outlined" aria-hidden="true">bolt</span>
<span data-key-setup-chip-label>{{ chip ? chip.label : t('POWER UP') }}</span>
</button>
</Teleport>
<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>
<span data-key-setup-chip-label>{{ chip ? chip.label : t('POWER UP') }}</span>
</button>
<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()">
+10 -11
View File
@@ -37,7 +37,7 @@ const pillWords = computed(() => ({
}));
const hud = computed(() => view.value?.hud ?? null);
const sonar = computed(() => view.value?.sonar ?? null);
const sonarOn = computed(() => sonar.value?.enabled ?? true);
const sonarOn = computed(() => sonar.value?.enabled ?? false);
const detection = computed(() => view.value?.detection ?? null);
const detectButton = computed(() => detection.value?.button ?? null);
const allocation = computed(() => detection.value?.allocation ?? 'ELASTIC');
@@ -93,35 +93,34 @@ const allocationOptions = computed(() => [
<UiSelect id="hud-layout-select" class="pp-select gev-field gev-field--compact" :model-value="hud?.variant ?? 'tactical'" @update:model-value="act('setHudLayout', $event)" :aria-label="t('HUD layout')">
<option value="tactical">{{ t('Tactical') }}</option>
<option value="minimal">{{ t('Minimal') }}</option>
<option value="cyber">{{ t('Cyber') }}</option>
</UiSelect>
</div>
<div class="pp-slider-row cyber-sonar-control cyber-sonar-toggle-row" id="cyber-sonar-row">
<div class="pp-slider-row cyber-sonar-control cyber-sonar-toggle-row" :class="{ visible: hud?.visible }" id="cyber-sonar-row">
<span class="pp-slider-mini-label">{{ t('Sonar') }}</span>
<UiButton class="pp-mode-btn" :pressed="sonarOn" pressed-class="active" id="cyber-sonar-toggle" @click="act('toggleSonar')" :title="t('Cyber sonar contact scanner')" :aria-label="t('Cyber sonar contact scanner')">{{ sonarOn ? t('ON') : t('OFF') }}</UiButton>
<UiButton class="pp-mode-btn" :pressed="sonarOn" pressed-class="active" id="cyber-sonar-toggle" @click="act('toggleSonar')" :title="t('Sonar contact scanner')" :aria-label="t('Sonar contact scanner')">{{ sonarOn ? t('ON') : t('OFF') }}</UiButton>
</div>
<output id="cyber-sonar-status" class="cyber-sonar-control" role="status"></output>
<div class="pp-slider-row cyber-sonar-control cyber-sonar-setting" id="cyber-sonar-rings-row">
<output id="cyber-sonar-status" class="cyber-sonar-control" role="status" :hidden="!(hud?.visible && sonarOn)"></output>
<div class="pp-slider-row cyber-sonar-control cyber-sonar-setting" :class="{ visible: hud?.visible && sonarOn }" id="cyber-sonar-rings-row">
<label class="pp-slider-mini-label" for="cyber-sonar-rings">{{ t('Rings') }}</label>
<UiSlider class="pp-slider" id="cyber-sonar-rings" @update:model-value="act('setSonarRings', $event)" min="3" max="12" step="1" :model-value="sonar?.rings ?? 8" :aria-label="t('Sonar ring count')" />
<span class="pp-slider-value" id="cyber-sonar-rings-value">{{ sonar?.rings ?? 8 }}</span>
</div>
<div class="pp-slider-row cyber-sonar-control cyber-sonar-setting" id="cyber-sonar-range-row">
<div class="pp-slider-row cyber-sonar-control cyber-sonar-setting" :class="{ visible: hud?.visible && sonarOn }" id="cyber-sonar-range-row">
<label class="pp-slider-mini-label" for="cyber-sonar-range">{{ t('Range') }}</label>
<UiSlider class="pp-slider" id="cyber-sonar-range" @update:model-value="act('setSonarRange', $event)" min="60" max="120" step="1" :model-value="sonar?.range ?? 100" :aria-label="t('Sonar ring range')" />
<span class="pp-slider-value" id="cyber-sonar-range-value">{{ pct(sonar?.range ?? 100) }}</span>
</div>
<div class="pp-slider-row cyber-sonar-control cyber-sonar-setting" id="cyber-sonar-intensity-row">
<div class="pp-slider-row cyber-sonar-control cyber-sonar-setting" :class="{ visible: hud?.visible && sonarOn }" id="cyber-sonar-intensity-row">
<label class="pp-slider-mini-label" for="cyber-sonar-intensity">{{ t('Power') }}</label>
<UiSlider class="pp-slider" id="cyber-sonar-intensity" @update:model-value="act('setSonarIntensity', $event)" min="0" max="100" step="1" :model-value="sonar?.intensity ?? 70" :aria-label="t('Sonar intensity')" />
<span class="pp-slider-value" id="cyber-sonar-intensity-value">{{ pct(sonar?.intensity ?? 70) }}</span>
</div>
<div class="pp-slider-row cyber-sonar-control cyber-sonar-setting" id="cyber-sonar-opacity-row">
<div class="pp-slider-row cyber-sonar-control cyber-sonar-setting" :class="{ visible: hud?.visible && sonarOn }" id="cyber-sonar-opacity-row">
<label class="pp-slider-mini-label" for="cyber-sonar-opacity">{{ t('Opacity') }}</label>
<UiSlider class="pp-slider" id="cyber-sonar-opacity" @update:model-value="act('setSonarOpacity', $event)" min="35" max="100" step="1" :model-value="sonar?.opacity ?? 84" :aria-label="t('Cyber contact and label opacity')" :title="t('Minimum opacity for map dots, icons, models, brackets, and labels between sonar passes')" />
<UiSlider class="pp-slider" id="cyber-sonar-opacity" @update:model-value="act('setSonarOpacity', $event)" min="35" max="100" step="1" :model-value="sonar?.opacity ?? 84" :aria-label="t('Sonar contact and label opacity')" :title="t('Minimum opacity for map dots, icons, models, brackets, and labels between sonar passes')" />
<span class="pp-slider-value" id="cyber-sonar-opacity-value">{{ pct(sonar?.opacity ?? 84) }}</span>
</div>
<div class="pp-slider-row cyber-sonar-control cyber-sonar-setting" id="cyber-sonar-sector-row">
<div class="pp-slider-row cyber-sonar-control cyber-sonar-setting" :class="{ visible: hud?.visible && sonarOn }" id="cyber-sonar-sector-row">
<label class="pp-slider-mini-label" for="cyber-sonar-sector">{{ t('Sector') }}</label>
<UiSlider class="pp-slider" id="cyber-sonar-sector" @update:model-value="act('setSonarSector', $event)" min="8" max="60" step="1" :model-value="sonar?.sector ?? 24" :aria-label="t('Sonar sector width')" />
<span class="pp-slider-value" id="cyber-sonar-sector-value">{{ `${sonar?.sector ?? 24}°` }}</span>
+1 -1
View File
@@ -13,7 +13,7 @@ const { mission: m, missionsLayer: layer } = storeToRefs(useContextStore());
const root = ref(null);
// Each newly presented selection returns the Context panel to the top.
const SCROLLER = ":root[data-ui-theme='cyber'] .cyber-panel-body, .global-context-panel-inner";
const SCROLLER = '.global-context-panel-inner';
watch(
() => m.value?.scrollRequest,
async (request) => {
+37 -76
View File
@@ -48,7 +48,10 @@ import {
readCyberSonarSettings,
setCyberSonarEnabled,
} from '../cyberSonar.js';
import { cyberVisualDefaultsForHudTransition } from '../hudLayouts.js';
import {
isLegacySonarHudLayout,
LEGACY_SONAR_HUD_LAYOUTS,
} from '../hudLayouts.js';
const DETECTION_ALLOCATION_STORAGE_KEY = 'gev:detection-allocation:v1';
/** Own visual preferences, detection overrides and display-control state. */
@@ -119,7 +122,7 @@ export class VisualSettings {
this._setSharpenIntensity(sharpenIntensity, { syncShare: false });
if (typeof bloom === 'boolean') this._setBloomEnabled(bloom);
if (typeof sharpen === 'boolean') this._setSharpenEnabled(sharpen);
if (hudVariant) this._setHudVariant(hudVariant);
if (hudVariant) this._setHudVariant(hudVariant, { restore: true });
if (typeof hudVisible === 'boolean') {
this.hud.setMode(hudVisible ? 'on' : 'off');
this._updateHudButtonState();
@@ -243,8 +246,6 @@ export class VisualSettings {
this._scopeOpacityShown = null;
this._celestialShown = null;
this.activeStyle = 'normal';
this._preCyberStyle = null;
this._cyberStyleUserSelected = false;
document.documentElement.dataset.gevStyle = this.activeStyle;
this._detectionUserOverridden = false;
this._cockpitVisionMode = 'optical';
@@ -716,64 +717,27 @@ export class VisualSettings {
this._syncShareState();
}
_setHudVariant(variantName, { applyVisualDefaults = false } = {}) {
/**
* @param {string} variantName Layout, or the removed `cyber` layout.
* @param {{restore?: boolean}} [options] A share link, scene or saved view
* is authoritative for Sonar too: it is on only when the state names
* Cyber. Other callers leave Sonar as the viewer set it.
*/
_setHudVariant(variantName, { restore = false } = {}) {
if (!variantName) return;
const previousVariant = this.hud.getVariant();
// Cyber was removed; its sonar became a visual style. A state that names
// Cyber opens in Tactical with Sonar on.
const sonar = isLegacySonarHudLayout(variantName);
if (sonar || (restore && isCyberSonarEnabled()))
this._setCyberSonarEnabled(sonar);
this.hud.setVariant(variantName);
const nextVariant = this.hud.getVariant();
const enteredCyber = previousVariant !== 'cyber' && nextVariant === 'cyber';
const leftCyber = previousVariant === 'cyber' && nextVariant !== 'cyber';
if (!applyVisualDefaults) {
// Scene/share/programmatic state is authoritative even when it reapplies
// the current Cyber variant. Do not let an older explicit entry restore
// stale local preset memory on the next user-selected exit.
this._preCyberStyle = null;
this._cyberStyleUserSelected = false;
} else if (enteredCyber) {
this._preCyberStyle = this.activeStyle;
this._cyberStyleUserSelected = false;
}
this._hudVariantShown = nextVariant;
this._hudVariantShown = this.hud.getVariant();
this._publishDisplay();
const visualDefaults = cyberVisualDefaultsForHudTransition(
previousVariant,
nextVariant,
{ explicit: applyVisualDefaults },
);
if (visualDefaults) this._applyCyberVisualDefaults(visualDefaults);
if (leftCyber) {
const restoreStyle =
applyVisualDefaults && !this._cyberStyleUserSelected
? this._preCyberStyle
: null;
this._preCyberStyle = null;
this._cyberStyleUserSelected = false;
if (restoreStyle && restoreStyle !== this.activeStyle) {
this.setStyle(restoreStyle, {
applyPreset: false,
revealParameters: false,
preserveCyberRestore: true,
});
}
}
this._syncCyberSonarControl();
this._syncShareState();
this._scheduleAdaptivePanelLayout({ settle: true });
}
_applyCyberVisualDefaults({ style, ironbow }) {
this.setStyle(style, {
applyPreset: false,
revealParameters: false,
preserveCyberRestore: true,
});
const thermalUniforms = this.stages?.thermal?.uniforms;
if (!thermalUniforms || thermalUniforms.palette === undefined) return;
thermalUniforms.palette = ironbow;
this._updateSliderPanel('thermal', { reveal: false });
this.services.governorRequestRender('cyber-visual-defaults');
}
_syncCyberSonarControl() {
const settings = applyCyberSonarSettings(readCyberSonarSettings());
this._sonarShown = {
@@ -791,9 +755,22 @@ export class VisualSettings {
const next = setCyberSonarEnabled(!!enabled);
this._syncCyberSonarControl();
this.services.governorRequestRender('cyber-sonar-toggle');
this._syncShareState();
return next;
}
/**
* The HUD layout a share link or scene shot records. Tactical with Sonar on
* is written as the retired Cyber code, which restores exactly that; Minimal
* has no such code, so its Sonar stays local.
*/
_sharedHudVariant() {
const variant = this.hud.getVariant();
return variant === 'tactical' && isCyberSonarEnabled()
? LEGACY_SONAR_HUD_LAYOUTS[0]
: variant;
}
_setCyberSonarSetting(name, value) {
const settings = readCyberSonarSettings();
if (!Object.hasOwn(settings, name)) return settings;
@@ -838,9 +815,7 @@ export class VisualSettings {
this._setSharpenEnabled(sharpenInput.enabled);
}
// Cyber is an explicit shell choice, independent of the imagery filter.
// Scene/share restoration still applies its own HUD through _setHudVariant.
if (preset.hudVariant && this.hud.getVariant() !== 'cyber') {
if (preset.hudVariant) {
this._setHudVariant(preset.hudVariant);
}
if (typeof preset.hudVisible === 'boolean') {
@@ -865,8 +840,8 @@ export class VisualSettings {
}
/**
* @param {{keepHudVariant?: boolean}} [options] `keepHudVariant` leaves the
* HUD layout to the style, as choosing a style does (Visual's reset).
* @param {{keepHudVariant?: boolean}} [options] `keepHudVariant` keeps the
* current HUD layout (Visual's reset).
*/
_applyGlobalPostDefaults({ keepHudVariant = false } = {}) {
const defaults = GLOBAL_POST_DEFAULTS;
@@ -943,7 +918,7 @@ export class VisualSettings {
bloomIntensity: this._getBloomIntensity(),
bloomVersion: BLOOM_SCALE_VERSION,
sharpenIntensity: this._sharpenPct,
hudVariant: this.hud.getVariant(),
hudVariant: this._sharedHudVariant(),
hudVisible: this.hud.visible,
detectionMode: detection.mode,
detectionDensity: detection.densityPct,
@@ -1261,7 +1236,7 @@ export class VisualSettings {
},
hud: {
visible: this.hud.visible,
variant: this.hud.getVariant(),
variant: this._sharedHudVariant(),
},
detection: {
mode: getDetectionMode(),
@@ -1309,7 +1284,7 @@ export class VisualSettings {
const hudState = state.hud || {};
if (hudState.variant) {
this._setHudVariant(hudState.variant);
this._setHudVariant(hudState.variant, { restore: true });
}
if (typeof hudState.visible === 'boolean') {
this.hud.setMode(hudState.visible ? 'on' : 'off');
@@ -1527,8 +1502,6 @@ export class VisualSettings {
applyPreset = true,
revealParameters = applyPreset,
restore = false,
userInitiated = false,
preserveCyberRestore = false,
} = {},
) {
if (
@@ -1538,18 +1511,6 @@ export class VisualSettings {
return;
const { setDetectionStyle } = this.services;
if (!restore) this.shareLinkManager?.claimRestoreLane?.('visual');
if (this.hud.getVariant() === 'cyber') {
if (userInitiated) {
// A direct preset choice owns the active style even when it selects the
// same value as Cyber's automatic FLIR default.
this._cyberStyleUserSelected = true;
} else if (!preserveCyberRestore) {
// Scene/share/reset state is authoritative and must not be overwritten
// by a remembered local Cyber entry when the user later exits.
this._preCyberStyle = null;
this._cyberStyleUserSelected = false;
}
}
if (styleName === this.activeStyle) {
if (revealParameters && styleName !== 'normal')
this._revealStyleParameters();