mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-23 11:42:21 +00:00
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]>
138 lines
5.1 KiB
JavaScript
138 lines
5.1 KiB
JavaScript
// Right-to-left layout pins: chrome that mirrors in Arabic must mirror on
|
|
// both sides of a pair, or one half lands on the other or off the screen.
|
|
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import test from 'node:test';
|
|
|
|
const sheet = (name) =>
|
|
readFileSync(new URL(`./styles/${name}`, import.meta.url), 'utf8');
|
|
|
|
/** The declarations of the first rule whose selector is exactly `selector`. */
|
|
function ruleBody(css, selector) {
|
|
const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
const match = new RegExp(`(?:^|\\n)\\s*${escaped}\\s*\\{([^}]*)\\}`).exec(
|
|
css,
|
|
);
|
|
assert.ok(match, `no rule for ${selector}`);
|
|
return match[1];
|
|
}
|
|
|
|
test('the dock trays open from their own wing in right-to-left', () => {
|
|
const rtl = sheet('rtl.css');
|
|
const location = ruleBody(
|
|
rtl,
|
|
"html[dir='rtl'] #command-dock #location-bar .dock-popover-content",
|
|
);
|
|
assert.match(
|
|
location,
|
|
/right: calc\(\(var\(--dock-unified-width\) - var\(--dock-location-open\)\) \/ 2\);/,
|
|
);
|
|
assert.match(location, /left: auto;/);
|
|
assert.match(location, /transform-origin: bottom right;/);
|
|
const presets = ruleBody(
|
|
rtl,
|
|
"html[dir='rtl'] #command-dock #control-panel .dock-popover-content",
|
|
);
|
|
assert.match(
|
|
presets,
|
|
/left: calc\(\(var\(--dock-unified-width\) - var\(--dock-presets-open\)\) \/ 2\);/,
|
|
);
|
|
assert.match(presets, /right: auto;/);
|
|
assert.match(presets, /transform-origin: bottom left;/);
|
|
// The narrow band re-centres both trays on the mobile tray width.
|
|
const narrow = /@media \(max-width: 900px\) \{([\s\S]*?)\n\}/.exec(rtl);
|
|
assert.ok(narrow, 'no max-width:900px block in rtl.css');
|
|
assert.match(
|
|
narrow[1],
|
|
/#location-bar \.dock-popover-content \{\s*right: calc\(\s*\(var\(--dock-unified-width\) - var\(--dock-popover-mobile-width\)\) \/ 2\s*\);/,
|
|
);
|
|
assert.match(
|
|
narrow[1],
|
|
/#control-panel \.dock-popover-content \{\s*left: calc\(\s*\(var\(--dock-unified-width\) - var\(--dock-popover-mobile-width\)\) \/ 2\s*\);/,
|
|
);
|
|
});
|
|
|
|
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
|
|
// it over the panels once the stacks swap sides.
|
|
const left = ruleBody(layers, '.gev-panel-rail--left');
|
|
assert.match(
|
|
left,
|
|
/inset-inline-start: calc\(-1 \* var\(--panel-rail-clearance\)\);/,
|
|
);
|
|
assert.doesNotMatch(left, /(?:^|\s)(?:left|right):/);
|
|
const right = ruleBody(layers, '.gev-panel-rail--right');
|
|
assert.match(
|
|
right,
|
|
/inset-inline-end: calc\(-1 \* var\(--panel-rail-clearance\)\);/,
|
|
);
|
|
assert.doesNotMatch(right, /(?:^|\s)(?:left|right):/);
|
|
// Their tips open toward the middle of the screen.
|
|
const kit = sheet('kit.css');
|
|
assert.match(
|
|
ruleBody(kit, '.ui-tooltip__tip--right'),
|
|
/inset-inline-start: calc\(100% \+ 10px\);/,
|
|
);
|
|
assert.match(
|
|
ruleBody(kit, '.ui-tooltip__tip--left'),
|
|
/inset-inline-end: calc\(100% \+ 10px\);/,
|
|
);
|
|
});
|
|
|
|
test('phone top-bar actions mirror with the logo', () => {
|
|
const mobile = sheet('mobile-shell.css');
|
|
const actions = ruleBody(mobile, 'body.mobile-shell #top-center-actions');
|
|
assert.match(actions, /inset-inline-start: auto;/);
|
|
assert.match(actions, /inset-inline-end: 12px;/);
|
|
assert.doesNotMatch(actions, /(?:^|\s)right:/);
|
|
const corner = ruleBody(mobile, 'body.mobile-shell #corner-actions');
|
|
assert.match(corner, /inset-inline-end: 12px;/);
|
|
assert.doesNotMatch(corner, /(?:^|\s)right:/);
|
|
});
|
|
|
|
test('the Space Missions counter reads as a number pair in right-to-left', () => {
|
|
const counters =
|
|
/html\[dir='rtl'\]\s*:is\(([^)]*\[data-role='beat-index'\][^)]*)\)\s*\{([^}]*)\}/.exec(
|
|
sheet('rtl.css'),
|
|
);
|
|
assert.ok(counters, 'no left-to-right counter rule in rtl.css');
|
|
assert.match(counters[1], /\[data-mission-index\]/);
|
|
assert.match(counters[2], /direction: ltr;/);
|
|
});
|
|
|
|
test('select chevrons and legend ranges follow the field and the ramp in right-to-left', () => {
|
|
const field = sheet('form-field.css');
|
|
assert.match(
|
|
ruleBody(field, 'select.gev-field'),
|
|
/padding-inline-end: 22px;/,
|
|
);
|
|
assert.match(
|
|
ruleBody(field, 'select.gev-field--compact'),
|
|
/padding-inline-end: 18px;/,
|
|
);
|
|
// Selects that set their own padding keep the chevron's room at the end.
|
|
for (const [name, selector, inline] of [
|
|
['radio.css', '#radio-filter', '8px 24px'],
|
|
['radio.css', '.sdr-gain-row select', '7px 22px'],
|
|
['voice-card.css', '#gev-voice-timeout-select', '0.45rem 22px'],
|
|
]) {
|
|
const body = ruleBody(sheet(name), selector);
|
|
assert.match(body, new RegExp(`padding-inline: ${inline};`));
|
|
assert.doesNotMatch(body, /(?:^|\s)padding(?:-right)?:/);
|
|
}
|
|
const rtl = sheet('rtl.css');
|
|
assert.match(
|
|
ruleBody(rtl, "html[dir='rtl'] select.gev-field"),
|
|
/background-position: left 8px center;/,
|
|
);
|
|
assert.match(
|
|
ruleBody(rtl, "html[dir='rtl'] select.gev-field--compact"),
|
|
/background-position: left 6px center;/,
|
|
);
|
|
assert.match(
|
|
ruleBody(rtl, "html[dir='rtl'] .rail-card-scale"),
|
|
/direction: ltr;/,
|
|
);
|
|
});
|