diff --git a/changelog.d/1598-f-collapses-data-layers.md b/changelog.d/1598-f-collapses-data-layers.md new file mode 100644 index 0000000000..42bdc9d833 --- /dev/null +++ b/changelog.d/1598-f-collapses-data-layers.md @@ -0,0 +1,7 @@ +- `F` now collapses and reopens the Data Layers panel the way the panel's own + button does, and its rail entry stays. Before, `F` hid the panel together + with its rail entry, so only another `F` brought it back. When `F` or a + panel's collapse button hides a panel that holds the focus, including one + the opened panel folds away, the focus moves to that panel's rail entry; + in Cockpit, focus in the Contact card it folds moves to the card's expand + button (asturksever, #1598). diff --git a/changelog.d/1848-kit-sweep-welcome.md b/changelog.d/1848-kit-sweep-welcome.md new file mode 100644 index 0000000000..d3154e0195 --- /dev/null +++ b/changelog.d/1848-kit-sweep-welcome.md @@ -0,0 +1,2 @@ +- The welcome card's buttons and glyphs are now kit controls, with the same + look and behaviour (manjunath22466, samehkhamis, #1848). diff --git a/changelog.d/1849-kit-sweep-display.md b/changelog.d/1849-kit-sweep-display.md new file mode 100644 index 0000000000..cabf38e8d2 --- /dev/null +++ b/changelog.d/1849-kit-sweep-display.md @@ -0,0 +1,2 @@ +- The Visual panel's buttons and glyphs are now kit controls, with the same + look and behaviour (manjunath22466, samehkhamis, #1849). diff --git a/changelog.d/1850-kit-sweep-entity-card.md b/changelog.d/1850-kit-sweep-entity-card.md new file mode 100644 index 0000000000..06d464488e --- /dev/null +++ b/changelog.d/1850-kit-sweep-entity-card.md @@ -0,0 +1,2 @@ +- The entity card's buttons and glyphs are now kit controls, with the same + look and behaviour (manjunath22466, samehkhamis, #1850). diff --git a/changelog.d/1851-kit-sweep-layer-finder.md b/changelog.d/1851-kit-sweep-layer-finder.md new file mode 100644 index 0000000000..e5b573d22d --- /dev/null +++ b/changelog.d/1851-kit-sweep-layer-finder.md @@ -0,0 +1,2 @@ +- The Layer Finder's buttons and glyphs are now kit controls, with the same + look and behaviour (manjunath22466, samehkhamis, #1851). diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 809ceb47e0..51dd971fe0 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -3350,7 +3350,10 @@ Browser acceptance: `QA_BASE_URL=http://127.0.0.1:4173 node scripts/qa-segmented `ui/input` supplies the bubbling application shortcut listener and generated shader-parameter rows. Number/style keys, H/O/V/F/D/C actions, native form-control -typing and Escape behavior retain their existing mappings. A shortcut key held +typing and Escape behavior retain their existing mappings. `F` collapses and +reopens Data Layers the way the panel's own collapse button does, so its rail +entry stays; if focus was inside the panel, it moves to that rail entry. +A shortcut key held with Cmd, Ctrl or Alt runs no shortcut, so the browser's own chord (Cmd+C to copy, Cmd+F to find, Cmd+1 to switch tab) does not also toggle CCTV, the layers panel or a style; Shift does not count, and Escape dismisses search either way. diff --git a/docs/VUE-MIGRATION.md b/docs/VUE-MIGRATION.md index 967607291d..cd8c9078c9 100644 --- a/docs/VUE-MIGRATION.md +++ b/docs/VUE-MIGRATION.md @@ -83,12 +83,22 @@ 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 context view 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. +The welcome card's buttons (SKIP, the three start tiles, BROWSE STORIES, +BACK and the main NEXT / ENTER GOD MODE action) are ghost `UiButton`s: +the start tiles are pressed toggles, and all but SKIP keep `aria-disabled` +rather than `disabled`, so they stay focusable while the card is busy. Its +tile, tip, Stories and arrow glyphs are `UiIcon`s with `:size="null"`, so +first-run.css still sizes them (`src/ui/kit/welcomeControls.test.mjs` pins +it). God mode's preview globe and callouts stay inline SVG drawings, and +its outbound links stay links. Every button in the Stories views (the Stories entry and its popup and toast, Explore, the Story screen, its header, rail, timeline and context panel) is a ghost `UiButton`. Explore's topic chips and map pins, the @@ -109,6 +119,34 @@ 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. +The entity card's buttons are ghost `UiButton`s: its four preview buttons +(Photos, Route, 3D, Cockpit view) are pressed toggles with `active`, Follow +is one with `entity-card__action--on`, and the cockpit entry, Fly to and +Ask GEV are plain buttons; so are the camera preview's bigger-view and More +info buttons and the nearby lists' rows (`SpotConditions`, which the +context view shows too). Their glyphs are `UiIcon`s with `:size="null"`, +so entity-card.css and spot-conditions.css still size them +(`src/ui/kit/entityCardControls.test.mjs` pins it). Ask GEV's chat bubble +stays inline SVG, since no Material symbol the page loads draws it. +The Layer Finder's buttons (Search, Filter, the filter menu's Status and +Category options and the bar's two clear chips) are ghost `UiButton`s. +Search and the options are pressed toggles; the options' pressed class is +`active`, while Search keeps its own `active` binding, which also stays on +while a query is typed. The Filter button opens a disclosure and carries +`aria-expanded`, not `aria-pressed`. Every glyph its own template draws is +a `UiIcon` with `:size="null"`, so `layer-finder.css` still sizes them +(`src/ui/kit/layerFinderControls.test.mjs` pins it); the search field's +magnifier is `UiSearchField`'s own span. `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 diff --git a/scripts/format-scope.json b/scripts/format-scope.json index f8d11ed4d6..e86ae6c4ea 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -1343,6 +1343,10 @@ "src/ui/kit/UiDialog.vue", "src/ui/kit/UiDialog.test.mjs", "src/ui/kit/dialogs.test.mjs", + "src/ui/kit/layerFinderControls.test.mjs", + "src/ui/kit/entityCardControls.test.mjs", + "src/ui/kit/visualControls.test.mjs", + "src/ui/kit/welcomeControls.test.mjs", "src/ui/kit/omnibarControls.test.mjs", "src/ui/kit/storiesControls.test.mjs", "src/ui/styles/chip.css", diff --git a/scripts/qa-firstrun-mutations.mjs b/scripts/qa-firstrun-mutations.mjs index 7177daceee..9bce1d3fd6 100644 --- a/scripts/qa-firstrun-mutations.mjs +++ b/scripts/qa-firstrun-mutations.mjs @@ -444,14 +444,14 @@ const MUTATIONS = [ { defect: 'a mission tile is dropped from the menu', file: 'html', - from: ' +
`; + const panel = document.getElementById('data-panel'); + const item = document.querySelector('[data-rail-item="data-panel"]'); + panel.getClientRects = () => + panel.classList.contains('collapsed') ? [] : [{}]; + item.getClientRects = () => [{}]; + const store = usePanelChromeStore(createPinia()); + const chrome = panelChrome(store); + followPanelState(store, 'data-panel', panel); + chrome._disclosurePanelIds = new Set(['data-panel']); + const bindings = new DisplayBindings({ + viewer: null, + services: { isScopeMaskEnabled: () => false, cycleDetectionMode() {} }, + elements: { _locationSearch: document.createElement('input') }, + operations: { + _setScope() {}, + _togglePanel: (panelId) => chrome._togglePanel(panelId), + }, + readState: () => ({}), + claimDetection() {}, + displayStore: useDisplayStore(createPinia()), + }); + bindings._initUI(); + t.after(() => { + bindings.destroy(); + chrome.destroy(); + }); + const press = (init = {}) => + document.activeElement.dispatchEvent( + new KeyboardEvent('keydown', { key: 'f', bubbles: true, ...init }), + ); + + panel.querySelector('button').focus(); + press(); + assert.equal(store.panels['data-panel']?.collapsed, true); + assert.ok(document.activeElement === item, 'focus moves to the rail'); + assert.ok(panel.classList.contains('collapsed')); + // `active` is what shows Data Layers at all (layers.css). + assert.ok(panel.classList.contains('active')); + press({ metaKey: true }); + assert.equal(store.panels['data-panel'].collapsed, true, 'Cmd+F is not ours'); + press(); + assert.equal(store.panels['data-panel'].collapsed, false); + assert.ok(!panel.classList.contains('collapsed')); + assert.ok(panel.classList.contains('active')); +}); + +test('F that folds a focused peer hands the focus to a rail entry', (t) => { + document.body.innerHTML = ` + +
+ +
+
`; + const stack = document.getElementById('left-panel-stack'); + const store = usePanelChromeStore(createPinia()); + const chrome = new PanelChrome({ + elements: { _leftPanelStack: stack }, + operations: { _showToast() {}, _syncCctvPanelViewport() {} }, + readHud: () => ({ visible: false, getVariant: () => null }), + readCockpit: () => null, + readShareLinks: () => null, + readInitialShare: () => null, + readScrollRestoreOwner: () => null, + readDisplayScrollTop: () => 0, + store, + }); + for (const id of ['data-panel', 'pp-toggles']) { + const panel = document.getElementById(id); + panel.getClientRects = () => + panel.classList.contains('collapsed') ? [] : [{}]; + followPanelState(store, id, panel); + } + for (const item of document.querySelectorAll('[data-rail-item]')) + item.getClientRects = () => [{}]; + chrome._disclosurePanelIds = new Set(['data-panel', 'pp-toggles']); + const bindings = new DisplayBindings({ + viewer: null, + services: { isScopeMaskEnabled: () => false, cycleDetectionMode() {} }, + elements: { _locationSearch: document.createElement('input') }, + operations: { + _setScope() {}, + _togglePanel: (panelId) => chrome._togglePanel(panelId), + }, + readState: () => ({}), + claimDetection() {}, + displayStore: useDisplayStore(createPinia()), + }); + bindings._initUI(); + t.after(() => { + bindings.destroy(); + chrome.destroy(); + }); + + const crt2 = document.getElementById('crt2'); + crt2.focus(); + assert.equal(document.activeElement, crt2); + crt2.dispatchEvent(new KeyboardEvent('keydown', { key: 'f', bubbles: true })); + assert.equal( + store.panels['data-panel']?.collapsed, + false, + 'Data Layers opens', + ); + const visual = document.getElementById('pp-toggles'); + assert.ok( + visual.classList.contains('collapsed'), + 'the accordion folds Visual', + ); + assert.ok( + document.activeElement?.matches?.('.ui-rail [data-rail-item]'), + `focus lands on a rail entry, not inside the hidden peer (got ${document.activeElement?.id || document.activeElement?.tagName})`, + ); +}); + +test('opening Data Layers in Cockpit hands the focus from the folded Contact card to its toggle', (t) => { + document.body.innerHTML = ` +
+ +
+ `; + const store = usePanelChromeStore(createPinia()); + const cockpit = { + active: true, + contextCollapsed: false, + setContextCollapsed(collapsed) { + this.contextCollapsed = collapsed; + }, + setSignalCollapsed() {}, + scheduleContextLayout() {}, + }; + const chrome = new PanelChrome({ + elements: { _leftPanelStack: document.getElementById('left-panel-stack') }, + operations: { _showToast() {}, _syncCctvPanelViewport() {} }, + readHud: () => ({ visible: false, getVariant: () => null }), + readCockpit: () => cockpit, + readShareLinks: () => null, + readInitialShare: () => null, + readScrollRestoreOwner: () => null, + readDisplayScrollTop: () => 0, + store, + }); + t.after(() => chrome.destroy()); + followPanelState(store, 'data-panel', document.getElementById('data-panel')); + chrome._disclosurePanelIds = new Set(['data-panel']); + document.getElementById('cockpit-weather-toggle').focus(); + chrome._togglePanel('data-panel'); + assert.equal( + store.panels['data-panel']?.collapsed, + false, + 'Data Layers opens', + ); + assert.equal(cockpit.contextCollapsed, true, 'Contact folds for it'); + assert.equal(document.activeElement?.id, 'cockpit-context-toggle'); +}); diff --git a/src/ui/panelNavigation.js b/src/ui/panelNavigation.js index e6fed5d641..698381a1e8 100644 --- a/src/ui/panelNavigation.js +++ b/src/ui/panelNavigation.js @@ -1,5 +1,5 @@ import PanelRailView from './PanelRailView.vue'; -import { PANEL_RAIL_HOST_CLASS, PANEL_RAIL_ITEMS } from './panelRailCatalog.js'; +import { PANEL_RAIL_HOST_CLASS } from './panelRailCatalog.js'; import { usePanelStore } from './stores/panels.js'; /** @@ -71,7 +71,6 @@ export class PanelNavigation { ? [...stack.children] .filter((panel) => panel.matches('[data-panel-id]')) .map((panel) => { - const shownBy = PANEL_RAIL_ITEMS[panel.id]?.shownBy; return { id: panel.id, title: @@ -79,9 +78,7 @@ export class PanelNavigation { .querySelector('.panel-title, .pp-header-label') ?.textContent.trim() || panel.id, open: !panel.classList.contains('collapsed'), - available: - !panel.hidden && - (!shownBy || panel.classList.contains(shownBy)), + available: !panel.hidden, }; }) : []; diff --git a/src/ui/panelNavigation.test.mjs b/src/ui/panelNavigation.test.mjs index 2eb999d3cc..40b54060da 100644 --- a/src/ui/panelNavigation.test.mjs +++ b/src/ui/panelNavigation.test.mjs @@ -22,8 +22,6 @@ function panel(id, { collapsed = true, hidden = false, title = '' } = {}) { element.className = collapsed ? 'panel-collapsible collapsed' : 'panel-collapsible'; - // Data Layers shows only while `active` (the `f` shortcut toggles it). - if (id === 'data-panel') element.classList.add('active'); element.hidden = hidden; if (title) element.innerHTML = `${title}`; return element; @@ -132,8 +130,8 @@ test('the rails follow disclosure and availability changes', async () => { ['global-context-panel', 'false'], ['host-panel', 'false'], ]); - // `f` hides Data Layers outright, so the rail stops offering it. - document.getElementById('data-panel').classList.remove('active'); + // A hidden panel leaves its rail. + document.getElementById('data-panel').hidden = true; await new Promise((resolve) => setTimeout(resolve, 0)); await nextTick(); assert.deepEqual(railItems(left), [['scene-panel', 'true']]); diff --git a/src/ui/panelRailCatalog.js b/src/ui/panelRailCatalog.js index e0094940bc..ce9accead2 100644 --- a/src/ui/panelRailCatalog.js +++ b/src/ui/panelRailCatalog.js @@ -7,16 +7,11 @@ export const PANEL_RAIL_HOST_CLASS = 'gev-panel-rail'; export const PANEL_RAIL_FALLBACK_ICON = 'more_horiz'; /** - * How each side panel appears on its rail. Labels are the panels' own titles. - * `shownBy` names a class the panel needs to be shown at all (`f` toggles - * Data Layers' `active`). `context` is the label's translation context. + * How each side panel appears on its rail. Labels are the panels' own titles; + * `context` is the label's translation context. */ export const PANEL_RAIL_ITEMS = Object.freeze({ - 'data-panel': { - icon: 'layers', - label: msg('DATA LAYERS'), - shownBy: 'active', - }, + 'data-panel': { icon: 'layers', label: msg('DATA LAYERS') }, 'utilities-panel': { icon: 'handyman', label: msg('UTILITIES') }, 'scene-panel': { icon: 'movie', label: msg('AUTHORING') }, // `context` keeps the panel's name apart from the satellite class of the diff --git a/src/ui/views/WelcomeView.vue b/src/ui/views/WelcomeView.vue index 238592ce2d..174b48394c 100644 --- a/src/ui/views/WelcomeView.vue +++ b/src/ui/views/WelcomeView.vue @@ -3,7 +3,9 @@ import { storeToRefs } from 'pinia'; import { nextTick, ref, watch } from 'vue'; import { msg, t } from '../../i18n/index.js'; import { FIRST_RUN_LINKS, environmentalLabel } from '../../firstRunCopy.js'; +import UiButton from '../kit/UiButton.vue'; import UiCheckbox from '../kit/UiCheckbox.vue'; +import UiIcon from '../kit/UiIcon.vue'; import { useFirstRunStore } from '../stores/firstRun.js'; import { useStoriesStore } from '../stores/stories.js'; @@ -165,10 +167,10 @@ function onSuppress(event) { - +

{{ t(TITLES[step - 1]) }}

{{ t(TITLES[step - 1]) }}

@@ -207,22 +209,22 @@ function onSuppress(event) {

{{ t('Start with') }}

- - - +
@@ -230,17 +232,17 @@ function onSuppress(event) {
diff --git a/src/ui/views/panels/CctvPreview.vue b/src/ui/views/panels/CctvPreview.vue index 96e7ad2f33..3071710542 100644 --- a/src/ui/views/panels/CctvPreview.vue +++ b/src/ui/views/panels/CctvPreview.vue @@ -4,7 +4,9 @@ import { storeToRefs } from 'pinia'; import { t } from '../../../i18n/index.js'; import { useCctvStore } from '../../stores/cctv.js'; import { usePanelChromeStore } from '../../stores/panelChrome.js'; +import UiButton from '../../kit/UiButton.vue'; import UiCloseButton from '../../kit/UiCloseButton.vue'; +import UiIcon from '../../kit/UiIcon.vue'; // A selected camera's card: a thumbnail of its latest frame, a few facts, // and a button that opens the full CCTV panel. The frame and facts come from @@ -68,15 +70,15 @@ function openPanel() { {{ t('Acquiring frame…') }} {{ sourceBadge.label }} - + + + - + + {{ t('More info') }} + diff --git a/src/ui/views/panels/DisplayPanel.vue b/src/ui/views/panels/DisplayPanel.vue index 9b634febaf..a384714c16 100644 --- a/src/ui/views/panels/DisplayPanel.vue +++ b/src/ui/views/panels/DisplayPanel.vue @@ -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(() => [

{{ t('Overlay') }}

- +
{{ t('Layout') }} @@ -184,7 +185,7 @@ const allocationOptions = computed(() => [
- + {{ t('Scope') }}
@@ -198,21 +199,21 @@ const allocationOptions = computed(() => [ {{ pct(scopeOpacity) }}
- +

{{ t('Effects') }}

- + {{ t('Celestial') }}
- + {{ row.label }}
@@ -225,7 +226,7 @@ const allocationOptions = computed(() => [
- +
{{ pct(view?.bloom.intensity ?? 0) }}
- +
{{ pct(view?.sharpen.intensity ?? 49) }}
- + + {{ t('Reset to default') }} +
diff --git a/src/ui/views/panels/EntityCard.vue b/src/ui/views/panels/EntityCard.vue index 77ae67c486..fd787d97fc 100644 --- a/src/ui/views/panels/EntityCard.vue +++ b/src/ui/views/panels/EntityCard.vue @@ -10,7 +10,9 @@ import AltitudeGraph from './AltitudeGraph.vue'; import { contextNeedle, contextSearchText, matchesContextSearch } from '../../contextSearch.js'; import RouteGlobe from './RouteGlobe.vue'; import CctvPreview from './CctvPreview.vue'; +import UiButton from '../../kit/UiButton.vue'; import UiCloseButton from '../../kit/UiCloseButton.vue'; +import UiIcon from '../../kit/UiIcon.vue'; import { useCctvStore } from '../../stores/cctv.js'; import SpotConditions from './SpotConditions.vue'; import { shownLayerName } from '../../layerNames.js'; @@ -365,10 +367,10 @@ watch(
- - - - + + + {{ t('3D') }} +
@@ -379,7 +381,7 @@ watch(
- +
{{ factFigure(fact).number }}{{ factFigure(fact).unit }} @@ -391,7 +393,7 @@ watch(
- +
{{ kindLine }}

{{ shownTitle }}

@@ -406,14 +408,14 @@ watch(
{{ card.route.from }} {{ card.route.to }}
@@ -435,7 +437,7 @@ watch( class="entity-card__route-note" :title="t('The scheduled route for this flight number does not match where the plane is; it may be another leg of the same flight.')" > - {{ t('Scheduled · unverified: does not match where the plane is') }} + {{ t('Scheduled · unverified: does not match where the plane is') }}

@@ -462,20 +464,21 @@ watch(
- + + {{ card.layerId === 'satellites' ? t('Enter orbital view') : t('Enter Cockpit') }} +
- - + + {{ t('Fly to') }} + + + {{ store.isFollowing() ? t('Following') : t('Follow') }} +
- +
diff --git a/src/ui/views/panels/LayerFinder.vue b/src/ui/views/panels/LayerFinder.vue index fecc66983f..0d02b375d3 100644 --- a/src/ui/views/panels/LayerFinder.vue +++ b/src/ui/views/panels/LayerFinder.vue @@ -22,6 +22,8 @@ const finder = {