Merge branch 'main' into fix/shortcuts-modifier-keys

This commit is contained in:
German Khokhlov authored and GitHub committed 2026-11-19 16:22:00 +04:00
commit 39f8068f31
6 files changed
+92 -19

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
- The Visual panel's buttons and glyphs are now kit controls, with the same
look and behaviour (manjunath22466, samehkhamis, #1849).
+15 -3
View File
@@ -83,9 +83,11 @@ segmented group in Core is a `UiSegmented`; the old `segmentedControl.js`
adapter is gone.
`UiButton` adds `pressedClass`, Core's class on a pressed toggle (most use
`active`); its pressed classes toggle through `classList`, so a class other
code adds (a voice highlight) survives a press. Every pressed toggle in the
views is a `UiButton` except Bhote Koshi's cinematic button and the
tilt-map button, whose owners still write their state into the DOM. Core's
code adds (a voice highlight) survives a press. Not every pressed toggle in
the views is one yet: the entity card, the context view, the Layer Finder,
the Stories screens and a few panel buttons still hand-write theirs, and
Bhote Koshi's cinematic button and the tilt-map button have owners that
write their state into the DOM. Core's
pressable chips and pills (rail card chips, map sources, cities and places)
are `UiButton`s too; `UiChip` is a non-interactive label chip, used by
the voice card.
@@ -105,6 +107,16 @@ ghost `UiButton`s, and its search, row and chip glyphs are `UiIcon`s with
row's glyphs stay inline SVG, since no Material symbol the page loads
draws them, and its field is its own combobox rather than a
`UiSearchField`.
The Visual panel's buttons (its presets and map sources, HUD, Sonar,
Detection, 3D, Clean UI, Celestial, Bloom, Sharpen and Reset to default) are
ghost `UiButton`s. HUD, Sonar, 3D, Celestial, Bloom and Sharpen are
pressed toggles with `active` as their pressed class; Detection sets its own
`active` and `panoptic` classes, and Clean UI is not a pressed toggle (its
owner marks it `active`). The panel's Scope, Celestial,
sky, application-row and Reset glyphs are `UiIcon`s with `:size="null"`, so
the panel's rules still size them (`src/ui/kit/visualControls.test.mjs` pins
it). The toggles' other glyphs (◎ ▣ ✈ □ ✨ 🔍) and the presets' style glyphs
are text characters, not Material symbols, and stay plain spans.
`UiSelect` renders the bare native select (Core's labels sit outside it or
come as an `aria-label`) with `v-model`, `options` and `disabled`;
options that carry their own attributes come through the slot, a caller's
+1
View File
@@ -1343,6 +1343,7 @@
"src/ui/kit/UiDialog.vue",
"src/ui/kit/UiDialog.test.mjs",
"src/ui/kit/dialogs.test.mjs",
"src/ui/kit/visualControls.test.mjs",
"src/ui/kit/welcomeControls.test.mjs",
"src/ui/kit/omnibarControls.test.mjs",
"src/ui/styles/chip.css",
+5 -1
View File
@@ -72,7 +72,11 @@ function settings(store) {
test('before VisualSettings renders, the panel shows its initial markup', (t) => {
const { $ } = fixture(t);
assert.equal($('bloom-toggle').className, 'pp-toggle-btn');
// Beside the kit's ui-* classes, the toggle carries only its own.
assert.deepEqual(
[...$('bloom-toggle').classList].filter((name) => !name.startsWith('ui-')),
['pp-toggle-btn'],
);
assert.equal($('bloom-slider-row').className, 'pp-slider-row');
assert.equal($('bloom-intensity-slider').value, '0');
assert.equal($('bloom-intensity-value').textContent, '0%');
+53
View File
@@ -0,0 +1,53 @@
// The Visual panel's buttons and Material glyphs are the kit's: neither its
// template nor the presets it renders hand-writes a <button>, a Material
// Symbols span or an inline SVG. The toggles' text glyphs (◎ ▣ ✈ □ ✨ 🔍)
// and the presets' style glyphs are characters, not Material symbols, so
// they stay text the panel's rules size.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
/** A view's template block: everything outside script and style. */
function template(file) {
const source = readFileSync(
new URL(`../views/panels/${file}`, import.meta.url),
'utf8',
);
return source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
}
const panel = template('DisplayPanel.vue');
const presets = template('VisualPresets.vue');
test('the Visual panel hand-writes no button; each is a UiButton', () => {
for (const markup of [panel, presets])
assert.deepEqual(markup.match(/<button\b/gi) ?? [], []);
// HUD, Sonar, Detection, 3D, Clean UI, Celestial, Bloom, Sharpen and
// Reset to default.
assert.equal(panel.match(/<UiButton\b/g)?.length, 9);
// The style presets and the map source chips.
assert.equal(presets.match(/<UiButton\b/g)?.length, 2);
// Scope, the sky rows and the application's toggle rows.
assert.equal(panel.match(/<UiCheckbox\b/g)?.length, 3);
// 3D model coverage and detection label allocation.
assert.equal(panel.match(/<UiSegmented\b/g)?.length, 2);
});
test('the Visual panel hand-writes no Material glyph; each is a UiIcon', () => {
for (const markup of [panel, presets]) {
assert.deepEqual(markup.match(/material-symbols-outlined/g) ?? [], []);
assert.deepEqual(markup.match(/<svg\b/gi) ?? [], []);
}
const icons = panel.match(/<UiIcon\b[^>]*>/g) ?? [];
// Scope, Celestial, the sky rows, the application's rows and Reset.
assert.equal(icons.length, 5);
// Without it the kit writes an 18px size that beats the panel's own rules.
for (const icon of icons) assert.match(icon, /:size="null"/);
});
test('the toggles keep their text glyphs as plain spans', () => {
const glyphs = [...panel.matchAll(/<span class="pp-icon">([^<]*)<\/span>/g)];
assert.deepEqual(
glyphs.map((m) => m[1]),
['&#x25CE;', '&#x25A3;', '&#x2708;', '&#x25A1;', '&#x2728;', '&#x1F50D;'],
);
});
+16 -15
View File
@@ -12,6 +12,7 @@ import UiSlider from '../../kit/UiSlider.js';
import { useDisplayStore } from '../../stores/display.js';
import UiButton from '../../kit/UiButton.vue';
import UiCheckbox from '../../kit/UiCheckbox.vue';
import UiIcon from '../../kit/UiIcon.vue';
import UiSelect from '../../kit/UiSelect.js';
import { StyleParameterRows } from '../../styleParameters.js';
import VisualPresets from './VisualPresets.vue';
@@ -85,10 +86,10 @@ const allocationOptions = computed(() => [
<p class="pp-section-heading">{{ t('Overlay') }}</p>
<Teleport :to="cockpitPortal?.hud ?? 'body'" :disabled="!cockpitPortal?.hud">
<div class="pp-toggle-group">
<button class="pp-toggle-btn" :class="{ active: hud?.visible }" :aria-pressed="String(Boolean(hud?.visible))" id="hud-toggle" @click="act('toggleHud')" :title="t('Intelligence HUD (H)')">
<UiButton class="pp-toggle-btn" :pressed="Boolean(hud?.visible)" pressed-class="active" id="hud-toggle" @click="act('toggleHud')" :title="t('Intelligence HUD (H)')">
<span class="pp-icon">&#x25CE;</span>
<span class="pp-label" translate="no">HUD</span>
</button>
</UiButton>
<div class="pp-slider-row" :class="{ visible: hud?.visible }" id="hud-layout-row">
<span class="pp-slider-mini-label">{{ t('Layout') }}</span>
<UiSelect id="hud-layout-select" class="pp-select gev-field gev-field--compact" :model-value="hud?.variant ?? 'tactical'" @update:model-value="act('setHudLayout', $event)" :aria-label="t('HUD layout')">
@@ -184,7 +185,7 @@ const allocationOptions = computed(() => [
</Teleport>
<div class="pp-toggle-group">
<UiCheckbox class="pp-toggle-btn pp-scope-toggle" :title="t('Scope — the circular viewport mask')" input-id="scope-toggle" trailing :model-value="scopeOn" @update:model-value="act('setScopeEnabled', $event)">
<span class="pp-icon material-symbols-outlined" aria-hidden="true">adjust</span>
<UiIcon class="pp-icon" name="adjust" :size="null" />
<span class="pp-label">{{ t('Scope') }}</span>
</UiCheckbox>
<div class="pp-slider-row visible" id="scope-slider-row">
@@ -198,21 +199,21 @@ const allocationOptions = computed(() => [
<span class="pp-slider-value" id="scope-opacity-value">{{ pct(scopeOpacity) }}</span>
</div>
</div>
<button class="pp-toggle-btn" id="clean-view-toggle" @click="act('toggleCleanView')" :title="t('Hide UI chrome')">
<UiButton class="pp-toggle-btn" id="clean-view-toggle" @click="act('toggleCleanView')" :title="t('Hide UI chrome')">
<span class="pp-icon">&#x25A1;</span>
<span class="pp-label">{{ t('Clean UI') }}</span>
</button>
</UiButton>
<p class="pp-section-heading">{{ t('Effects') }}</p>
<div class="pp-toggle-group">
<UiButton class="pp-toggle-btn" :pressed="celestial?.active ?? false" pressed-class="active" id="celestial-toggle" @click="act('toggleCelestial')" :title="celestialTitle" :disabled="celestial ? !celestial.supported : undefined" :aria-disabled="celestial ? String(!celestial.supported) : undefined">
<span class="pp-icon material-symbols-outlined" aria-hidden="true">flare</span>
<UiIcon class="pp-icon" name="flare" :size="null" />
<span class="pp-label">{{ t('Celestial') }}</span>
</UiButton>
</div>
<!-- Sky: only where the renderer has a sky to set. -->
<div v-if="sky" class="pp-toggle-group" id="sky-group">
<UiCheckbox v-for="row in skyRows" :key="row.key" class="pp-toggle-btn pp-scope-toggle" :id="`sky-${row.key}-row`" :input-id="`sky-${row.key}-toggle`" trailing :model-value="sky.switches[row.key]" @update:model-value="act('setSkySwitch', row.key, $event)">
<span class="pp-icon material-symbols-outlined" aria-hidden="true">{{ row.icon }}</span>
<UiIcon class="pp-icon" :name="row.icon" :size="null" />
<span class="pp-label">{{ row.label }}</span>
</UiCheckbox>
<div class="pp-slider-row visible" id="sky-milkyway-row">
@@ -225,7 +226,7 @@ const allocationOptions = computed(() => [
<div v-for="group in groups" :key="group.id" class="pp-toggle-group" :id="`${group.id}-group`">
<template v-for="row in group.rows" :key="row.id">
<UiCheckbox v-if="row.kind === 'toggle'" class="pp-toggle-btn pp-scope-toggle" :title="row.title" :input-id="`${group.id}-${row.id}-toggle`" trailing :model-value="row.checked" @update:model-value="row.onChange?.($event)">
<span v-if="row.icon" class="pp-icon material-symbols-outlined" aria-hidden="true">{{ row.icon }}</span>
<UiIcon v-if="row.icon" class="pp-icon" :name="row.icon" :size="null" />
<span class="pp-label">{{ row.label }}</span>
</UiCheckbox>
<div v-else-if="row.kind === 'note'" class="pp-slider-row visible" :id="`${group.id}-${row.id}`">
@@ -239,28 +240,28 @@ const allocationOptions = computed(() => [
</template>
</div>
<div class="pp-toggle-group">
<button class="pp-toggle-btn" :class="{ active: view?.bloom.active }" :aria-pressed="String(Boolean(view?.bloom.active))" id="bloom-toggle" @click="act('toggleBloom')" :title="t('Bloom / Glow')">
<UiButton class="pp-toggle-btn" :pressed="Boolean(view?.bloom.active)" pressed-class="active" id="bloom-toggle" @click="act('toggleBloom')" :title="t('Bloom / Glow')">
<span class="pp-icon">&#x2728;</span>
<span class="pp-label">{{ t('Bloom') }}</span>
</button>
</UiButton>
<div class="pp-slider-row" :class="{ visible: view?.bloom.active }" id="bloom-slider-row">
<UiSlider class="pp-slider" id="bloom-intensity-slider" @update:model-value="act('setBloomIntensity', $event)" min="0" max="200" :model-value="view?.bloom.intensity ?? 0" :aria-label="t('Bloom intensity')" />
<span class="pp-slider-value" id="bloom-intensity-value">{{ pct(view?.bloom.intensity ?? 0) }}</span>
</div>
</div>
<div class="pp-toggle-group">
<button class="pp-toggle-btn" :class="{ active: view?.sharpen.active }" :aria-pressed="String(Boolean(view?.sharpen.active))" id="sharpen-toggle" @click="act('toggleSharpen')" :title="t('Sharpening')">
<UiButton class="pp-toggle-btn" :pressed="Boolean(view?.sharpen.active)" pressed-class="active" id="sharpen-toggle" @click="act('toggleSharpen')" :title="t('Sharpening')">
<span class="pp-icon">&#x1F50D;</span>
<span class="pp-label">{{ t('Sharpen') }}</span>
</button>
</UiButton>
<div class="pp-slider-row" :class="{ visible: view?.sharpen.active }" id="sharpen-slider-row">
<UiSlider class="pp-slider" id="sharpen-intensity-slider" @update:model-value="act('setSharpenIntensity', $event)" min="0" max="100" :model-value="view?.sharpen.intensity ?? 49" :aria-label="t('Sharpen intensity')" />
<span class="pp-slider-value" id="sharpen-intensity-value">{{ pct(view?.sharpen.intensity ?? 49) }}</span>
</div>
</div>
<button type="button" class="pp-reset-btn" :title="t('Reset Visual to its defaults: Normal look, HUD, scope, labels and effects')" @click="act('resetVisual')">
<span class="material-symbols-outlined" aria-hidden="true">restart_alt</span>{{ t('Reset to default') }}
</button>
<UiButton class="pp-reset-btn" :title="t('Reset Visual to its defaults: Normal look, HUD, scope, labels and effects')" @click="act('resetVisual')">
<UiIcon name="restart_alt" :size="null" />{{ t('Reset to default') }}
</UiButton>
</div>
</div>
</template>