From 2418e43545ac3005371be2ebbcff6c924f6d77b9 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 00:26:29 -0800 Subject: [PATCH 1/6] Vue kit: bare is for skins that set their own padding; pin the CCTV and Inspector close load order; changelog for #1840 Co-authored-by: Manjunath Paparaju --- changelog.d/1840-kit-close-button.md | 3 +++ docs/VUE-MIGRATION.md | 4 ++-- src/ui/kit/UiCloseButton.vue | 4 ++-- src/ui/kit/kitStyles.test.mjs | 2 ++ 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 changelog.d/1840-kit-close-button.md diff --git a/changelog.d/1840-kit-close-button.md b/changelog.d/1840-kit-close-button.md new file mode 100644 index 0000000000..0376fb405c --- /dev/null +++ b/changelog.d/1840-kit-close-button.md @@ -0,0 +1,3 @@ +- Every close, dismiss and clear button in the views is now one kit + component, `UiCloseButton`, with the same look and behaviour as before + (manjunath22466, samehkhamis, #1840). diff --git a/docs/VUE-MIGRATION.md b/docs/VUE-MIGRATION.md index c6969f4277..24b2e2c63a 100644 --- a/docs/VUE-MIGRATION.md +++ b/docs/VUE-MIGRATION.md @@ -53,7 +53,7 @@ never copied: | `UiButton` `variant="action"` | the action surface (`gev-action-button`); `tone="danger"` hovers red, `size="compact"` is the shot-row footprint (on this variant only) | `src/ui/styles/action-button.css` | | `UiButton` `variant="primary"` | the action surface with a group's main-action accent | `src/ui/styles/action-button.css` | | `UiButton` `variant="icon"` | the 22px square glyph button of a panel's collapse toggle | `src/ui/styles/controls.css` | -| `UiCloseButton` | a close, dismiss or clear button: a bare glyph (× with `glyph="times"`, the Material `close` symbol with `glyph="icon"`) with no padding, border or background of its own and a pointer; the site's feature class sets size, colour, hover and any surface, and `bare` leaves the look off for a skin that keeps the browser's padding | `src/ui/styles/close-button.css` | +| `UiCloseButton` | a close, dismiss or clear button: a bare glyph (× with `glyph="times"`, the Material `close` symbol with `glyph="icon"`) with no padding, border or background of its own and a pointer; the site's feature class sets size, colour, hover and any surface, and `bare` leaves the look off for a skin that sets its own padding and border | `src/ui/styles/close-button.css` | | `UiChip` | the read-only chip (a pill of uppercase mono text); `selected` takes the accent | `src/ui/styles/chip.css` | | `UiEmpty` | the one-line empty state (dim mono text), its hint on a line below | `src/ui/styles/empty-state.css` | | `UiBadge` | the read-only badge (`gev-status-badge`) | `src/ui/styles/status-badge.css` | @@ -105,7 +105,7 @@ no tip unless the site passes a `title`; attributes and classes pass through, so each site keeps its id, feature class and look. Every close, dismiss and clear button in the views is one (`src/ui/kit/closeButtons.test.mjs` pins it); Street Level's and the space mission's keep `bare`, since their skins -keep the browser's padding. The close buttons built in script (credits, the +set their own padding and border. The close buttons built in script (credits, the Quebec CCTV overlay, the guide) are not converted yet. `UiSlider` keeps the native range input rather than drawing a `role="slider"` track, so Core's keyboard, form behaviour and styling stay; diff --git a/src/ui/kit/UiCloseButton.vue b/src/ui/kit/UiCloseButton.vue index 56f9bbaa37..febe762d68 100644 --- a/src/ui/kit/UiCloseButton.vue +++ b/src/ui/kit/UiCloseButton.vue @@ -11,8 +11,8 @@ import UiIcon from './UiIcon.vue'; // Core's common look, a bare glyph: no padding, border or background of its // own, and a pointer. Its rule selects one class and loads before the // feature stylesheets, so a feature rule still sets the size, colour, hover -// and any surface. `bare` leaves the kit look off, for a button whose skin -// keeps the browser's own padding. +// and any surface. `bare` leaves the kit look off, for a button whose own +// skin sets its padding and border. const props = defineProps({ /** The accessible name (aria-label). */ label: { type: String, required: true }, diff --git a/src/ui/kit/kitStyles.test.mjs b/src/ui/kit/kitStyles.test.mjs index f1be902814..c210b964df 100644 --- a/src/ui/kit/kitStyles.test.mjs +++ b/src/ui/kit/kitStyles.test.mjs @@ -165,6 +165,8 @@ test('the kit’s skins load before the feature stylesheets that restyle them', ['.ui-close-button,', '.entity-card__close {'], ['.ui-close-button,', '.context-search__clear {'], ['.ui-close-button,', '.key-setup-close {'], + ['.ui-close-button,', '.cctv-popup__close {'], + ['.ui-close-button,', '.view-context__live-off {'], ['.ui-close-button,', '.gev-guide-close {'], ]) { assert.ok( From b3e6c265e8c662eeaa197fc5f3c20699252030dd Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 00:48:57 -0800 Subject: [PATCH 2/6] Add the changelog entry for #1841 Co-authored-by: Manjunath Paparaju --- changelog.d/1841-kit-search-field.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog.d/1841-kit-search-field.md diff --git a/changelog.d/1841-kit-search-field.md b/changelog.d/1841-kit-search-field.md new file mode 100644 index 0000000000..de72045c39 --- /dev/null +++ b/changelog.d/1841-kit-search-field.md @@ -0,0 +1,3 @@ +- The Context panel search and the Layer Finder search are now one kit + component, `UiSearchField`, with the same look and behaviour as before + (manjunath22466, samehkhamis, #1841). From d55f6965140a09147ced199d3d4073a744b1e2a1 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 01:32:05 -0800 Subject: [PATCH 3/6] Add the changelog entry for #1842 Co-authored-by: Manjunath Paparaju --- changelog.d/1842-kit-checkbox.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelog.d/1842-kit-checkbox.md diff --git a/changelog.d/1842-kit-checkbox.md b/changelog.d/1842-kit-checkbox.md new file mode 100644 index 0000000000..7ff6df0bf5 --- /dev/null +++ b/changelog.d/1842-kit-checkbox.md @@ -0,0 +1,4 @@ +- The Visual panel's toggles, the voice settings, the Data Library's + "available only" box and the welcome screen's "Don't show this again" are + now one kit component, `UiCheckbox`, with the same look and behaviour as + before (manjunath22466, samehkhamis, #1842). From 7c858d96ee03568bc6f0c3121c45e7a1840de188 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 01:54:17 -0800 Subject: [PATCH 4/6] Add the changelog entry for #1843 Co-authored-by: Manjunath Paparaju --- changelog.d/1843-kit-dialog.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog.d/1843-kit-dialog.md diff --git a/changelog.d/1843-kit-dialog.md b/changelog.d/1843-kit-dialog.md new file mode 100644 index 0000000000..215a35eb91 --- /dev/null +++ b/changelog.d/1843-kit-dialog.md @@ -0,0 +1,5 @@ +- The Data Library and scene sharing dialogs are now one kit component, + `UiDialog`. A scene sharing dialog the browser closes on its own now + cancels through its owner, so the next share is not blocked, and a late + close event no longer shuts a dialog opened again since (manjunath22466, + samehkhamis, #1843). From 0b06bc664598e11487d9865b6742402726a95982 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 01:39:13 -0800 Subject: [PATCH 5/6] Vue: the credits line and its Data attribution list are a single-file component mountCreditsView() keeps its signature and stays the owner: it computes the credits shown once each, keeps the list's open state and its focus, takes the expand and close clicks and Escape, and renders CreditsView synchronously (as the weather readout is rendered), so focus moves as soon as a change returns. The view teleports the line and the list to the end of the body, as the script appended them, so the page's rules that select them as children of the body still apply; CreditItem draws one credit (its logo or its text, only its linked words linked, links and logos kept only for a safe scheme). The ids, classes, roles, aria attributes and text are unchanged. The list's close button is a UiCloseButton with bare, keeping the browser's padding, so it only gains the kit's classes, which carry no rules. The expand button stays a plain button: its words are its content, which a UiButton slot would not word again when the owner renders a new locale. The list's items are keyed by credit, so a link that keeps its place keeps focus through a redraw; one that goes still hands focus to the close button. New tests: the line and list follow the locale, and they are the last of the body with the kit's close button. Co-authored-by: Manjunath Paparaju --- docs/VUE-MIGRATION.md | 20 +++- scripts/format-scope.json | 2 + scripts/package-boundaries.json | 2 + src/ui/credits/CreditItem.vue | 53 ++++++++++ src/ui/credits/CreditsView.vue | 82 +++++++++++++++ src/ui/creditsView.js | 177 ++++++++++---------------------- src/ui/creditsView.test.mjs | 57 +++++++++- 7 files changed, 267 insertions(+), 126 deletions(-) create mode 100644 src/ui/credits/CreditItem.vue create mode 100644 src/ui/credits/CreditsView.vue diff --git a/docs/VUE-MIGRATION.md b/docs/VUE-MIGRATION.md index 5d5f0c0b63..a085534fa2 100644 --- a/docs/VUE-MIGRATION.md +++ b/docs/VUE-MIGRATION.md @@ -108,8 +108,9 @@ no tip unless the site passes a `title`; attributes and classes pass through, so each site keeps its id, feature class and look. Every close, dismiss and clear button in the views is one (`src/ui/kit/closeButtons.test.mjs` pins it); Street Level's and the space mission's keep `bare`, since their skins -keep the browser's padding. The close buttons built in script (credits, the -Quebec CCTV overlay, the guide) are not converted yet. +keep the browser's padding, and so does the credits list's. The close +buttons built in script (the Quebec CCTV overlay, the guide) are not +converted yet. `UiSearchField` takes `v-model`, a required `label` (the input's accessible name), `placeholder` and `tag` (`div`, given `role="search"` by the site, or `label`); attributes and classes go to the frame, and @@ -177,6 +178,12 @@ page declares no dark `color-scheme`. Selects and number fields are and keeps native spinners dark; ranges are `.gev-quantitative-slider`, with a feature supplying only its accent. +`t()` is not reactive. Words a view passes to a kit component as a prop +(`UiCloseButton`'s `label`) follow a locale change on the view's next +render, but words in a kit component's slot do not: the compiled slot does +not render the child again. A view whose words must follow the locale at +once passes the locale itself as a prop or key, as the credits line does. + ## Phases 1. **Foundation.** Vue, Pinia and the Vite Vue plugin join the browser build @@ -368,7 +375,14 @@ a feature supplying only its accent. choices, DISMISS and "Don't show this again" call the launcher's controls; a refused save hands the tick back to the view to revert. The launcher still reads the rendered card for its hit test, keyboard trap, - focus and overflow measurement), then + focus and overflow measurement), the attribution line (for a renderer + without its own credit display, `mountCreditsView()` renders + `CreditsView` synchronously, as the weather readout is, and the view + teleports the line and its "Data attribution" list to the end of the + body, where the page's rules select them; the owner keeps the credits + shown, the list's open state and its focus, and words the view again + when the locale changes; the list's close button is a bare + `UiCloseButton`), then Cockpit (in progress: `CockpitBriefing` renders the briefing card's pages, cycle toggle, regional news and local conditions, and `CockpitContext` the Contact card's scope, navigation, counts, nearest diff --git a/scripts/format-scope.json b/scripts/format-scope.json index 76004da995..7dc54bc407 100644 --- a/scripts/format-scope.json +++ b/scripts/format-scope.json @@ -1585,6 +1585,8 @@ "src/ui/creditLineHeight.js", "src/ui/creditLineHeight.test.mjs", "src/ui/creditsView.test.mjs", + "src/ui/credits/CreditsView.vue", + "src/ui/credits/CreditItem.vue", "src/cockpitSubjectProviders.js", "src/cockpitSubjectProviders.test.mjs", "src/cockpitProgress.js", diff --git a/scripts/package-boundaries.json b/scripts/package-boundaries.json index caf06537ef..20e9c6de8f 100644 --- a/scripts/package-boundaries.json +++ b/scripts/package-boundaries.json @@ -5488,6 +5488,8 @@ "src/render/cesium/viewers.js", "src/ui/creditLineHeight.js", "src/ui/creditsView.js", + "src/ui/credits/CreditsView.vue", + "src/ui/credits/CreditItem.vue", "src/data/planespottersPhoto.js", "src/maps/keylessTerrain.js", "src/render/cesium/vectorBase.js", diff --git a/src/ui/credits/CreditItem.vue b/src/ui/credits/CreditItem.vue new file mode 100644 index 0000000000..fd3f95478c --- /dev/null +++ b/src/ui/credits/CreditItem.vue @@ -0,0 +1,53 @@ + + + diff --git a/src/ui/credits/CreditsView.vue b/src/ui/credits/CreditsView.vue new file mode 100644 index 0000000000..4181af2995 --- /dev/null +++ b/src/ui/credits/CreditsView.vue @@ -0,0 +1,82 @@ + + + diff --git a/src/ui/creditsView.js b/src/ui/creditsView.js index 03acd1358d..738d116161 100644 --- a/src/ui/creditsView.js +++ b/src/ui/creditsView.js @@ -6,16 +6,14 @@ * credits). Inline credits are shown on the line at the bottom left; the * rest are in the "Data attribution" list it opens. A credit is plain data * (`src/render/contract/credits.d.ts`): its text is set as text, and a link - * or logo is kept only for a safe scheme. + * or logo is kept only for a safe scheme. `CreditsView` renders the line and + * the list; this owner keeps the credits shown, the list's open state and + * its focus. */ +import { h, render as renderVue } from 'vue'; import { findCredits } from '../render/rendererOf.js'; -import { - LINK_SCHEMES, - LOGO_SCHEMES, - safeUrl, - splitLink, -} from '../render/creditMarkup.js'; -import { onLocaleChange, t } from '../i18n/index.js'; +import { getLocale, onLocaleChange } from '../i18n/index.js'; +import CreditsView from './credits/CreditsView.vue'; const PANEL_ID = 'gev-credits-panel'; @@ -30,42 +28,6 @@ function distinct(list) { }); } -/** One credit as DOM: its logo or its text, linked when it has a link. */ -function creditElement(doc, credit) { - const href = credit.href ? safeUrl(credit.href, LINK_SCHEMES) : null; - const logoUrl = credit.logoUrl ? safeUrl(credit.logoUrl, LOGO_SCHEMES) : null; - // Only the credit's linked words are the link, as the source wrote it. - if (href && !logoUrl && credit.linkText) { - const [before, words, after] = splitLink(credit); - const element = doc.createElement('span'); - element.className = 'gev-credit'; - const link = doc.createElement('a'); - link.href = href; - link.target = '_blank'; - link.rel = 'noopener noreferrer'; - link.textContent = words; - element.append(before, link, after); - return element; - } - const element = doc.createElement(href ? 'a' : 'span'); - element.className = 'gev-credit'; - if (href) { - element.href = href; - element.target = '_blank'; - element.rel = 'noopener noreferrer'; - } - // A logo is drawn in place of the text, which names it (its alt text). - const logo = credit.logoUrl ? safeUrl(credit.logoUrl, LOGO_SCHEMES) : null; - if (logo) { - const image = doc.createElement('img'); - image.className = 'gev-credit-logo'; - image.src = logo; - image.alt = credit.text; - element.append(image); - } else element.textContent = credit.text; - return element; -} - /** * Show `viewer`'s renderer credits at the bottom left of `root`'s page. * @param {object} viewer The scene object, bound to its renderer. @@ -76,106 +38,77 @@ export function mountCreditsView(viewer, { root = document.body } = {}) { const credits = findCredits(viewer); if (!credits || !root) return () => {}; const doc = root.ownerDocument; - const bar = doc.createElement('div'); - bar.id = 'gev-credits'; - bar.className = 'gev-credits'; - // Takes focus back from an emptied list when the line has no link. - bar.tabIndex = -1; - const line = doc.createElement('span'); - line.className = 'gev-credits-line'; - const expand = doc.createElement('button'); - expand.type = 'button'; - expand.className = 'gev-credits-expand'; - expand.setAttribute('aria-haspopup', 'dialog'); - expand.setAttribute('aria-controls', PANEL_ID); - expand.setAttribute('aria-expanded', 'false'); + // The view teleports the line and the list to the end of `root`; this + // host, never in the page, holds only its place. + const host = doc.createElement('div'); + const elements = {}; + let inline = []; + let listed = []; + let open = false; - const panel = doc.createElement('div'); - panel.id = PANEL_ID; - panel.className = 'gev-credits-panel'; - panel.setAttribute('role', 'dialog'); - panel.hidden = true; - const header = doc.createElement('div'); - header.className = 'gev-credits-header'; - const title = doc.createElement('span'); - title.className = 'gev-credits-title'; - title.id = `${PANEL_ID}-title`; - panel.setAttribute('aria-labelledby', title.id); - const close = doc.createElement('button'); - close.type = 'button'; - close.className = 'gev-credits-close'; - close.textContent = '×'; - header.append(title, close); - const list = doc.createElement('ul'); - list.className = 'gev-credits-list'; - panel.append(header, list); - bar.append(line, expand); - root.append(bar, panel); + // The view patches synchronously, so focus can move once it returns. + const paint = () => + renderVue( + h(CreditsView, { + to: root, + panelId: PANEL_ID, + inline, + listed, + open, + locale: getLocale(), + elements, + onExpand, + onClose, + onKeydown, + }), + host, + ); - const label = () => { - expand.textContent = t('Data attribution'); - title.textContent = t('Data provided by:'); - close.setAttribute('aria-label', t('Close data attribution')); - }; - - const setOpen = (open, { focus = false } = {}) => { - panel.hidden = !open; - expand.setAttribute('aria-expanded', String(open)); - if (open) close.focus(); - else if (focus) expand.focus(); + const setOpen = (next, { focus = false } = {}) => { + open = next; + paint(); + if (open) elements.close.focus(); + else if (focus) elements.expand.focus(); }; const render = (all) => { + const { bar, line, panel } = elements; const focused = panel.contains(doc.activeElement); const shown = distinct(Array.isArray(all) ? all : []); - const inline = shown.filter((credit) => credit.inline); - const listed = shown.filter((credit) => !credit.inline); - line.replaceChildren(); - inline.forEach((credit, i) => { - if (i) line.append(doc.createTextNode(' · ')); - line.append(creditElement(doc, credit)); - }); - if (inline.length && listed.length) line.append(doc.createTextNode(' · ')); - list.replaceChildren( - ...listed.map((credit) => { - const item = doc.createElement('li'); - item.append(creditElement(doc, credit)); - return item; - }), - ); - expand.hidden = listed.length === 0; - if (expand.hidden && !panel.hidden) { + inline = shown.filter((credit) => credit.inline); + listed = shown.filter((credit) => !credit.inline); + paint(); + if (listed.length === 0 && open) { // Focus in the list goes back to the line, not to the page. setOpen(false); if (focused) (line.querySelector('a') ?? bar).focus(); } else if (focused && !panel.contains(doc.activeElement)) { // A link that focus was on was redrawn: focus stays in the list. - close.focus(); + elements.close.focus(); } }; - const onExpand = () => setOpen(panel.hidden); - const onClose = () => setOpen(false, { focus: true }); + function onExpand() { + setOpen(!open); + } + function onClose() { + setOpen(false, { focus: true }); + } // Escape in the open list closes it (it takes focus as it opens). - const onKey = (event) => { - if (event.key !== 'Escape' || panel.hidden) return; + function onKeydown(event) { + if (event.key !== 'Escape' || !open) return; event.preventDefault(); setOpen(false, { focus: true }); - }; - expand.addEventListener('click', onExpand); - close.addEventListener('click', onClose); - panel.addEventListener('keydown', onKey); - label(); + } + + paint(); render(credits.list()); const offChange = credits.on('change', render); - const offLocale = onLocaleChange(label); + // The view words its text again in the new locale, as it renders. + const offLocale = onLocaleChange(paint); return () => { offChange(); offLocale(); - expand.removeEventListener('click', onExpand); - close.removeEventListener('click', onClose); - panel.removeEventListener('keydown', onKey); - bar.remove(); - panel.remove(); + renderVue(null, host); }; } diff --git a/src/ui/creditsView.test.mjs b/src/ui/creditsView.test.mjs index 17e443b52b..34a66b4255 100644 --- a/src/ui/creditsView.test.mjs +++ b/src/ui/creditsView.test.mjs @@ -4,6 +4,7 @@ import assert from 'node:assert/strict'; import { mountCreditsView } from './creditsView.js'; import { bindRenderer } from '../render/rendererOf.js'; import { createStubRenderer } from '../render/stub/index.js'; +import { setLocale } from '../i18n/index.js'; function scene() { document.body.replaceChildren(); @@ -118,10 +119,12 @@ test('focus in the list stays in it as it redraws, and goes to the line as it em const off = mountCreditsView(viewer); const panel = document.getElementById('gev-credits-panel'); document.querySelector('.gev-credits-expand').click(); - panel.querySelector('li a').focus(); + const link = panel.querySelector('li a'); + link.focus(); const removeOther = renderer.credits.addStatic({ text: 'NOAA' }); assert.equal(panel.hidden, false); assert.ok(panel.contains(document.activeElement), 'still in the list'); + assert.equal(document.activeElement, link, 'the focused link keeps it'); remove(); removeOther(); assert.equal(panel.hidden, true); @@ -152,3 +155,55 @@ test('a credit with linked words links only those words', () => { ); off(); }); + +test('the line and its list follow the locale', () => { + const { viewer, renderer } = scene(); + renderer.credits.addStatic({ text: 'NOAA' }); + const off = mountCreditsView(viewer); + const expand = document.querySelector('.gev-credits-expand'); + const close = document.querySelector('.gev-credits-close'); + try { + setLocale('fr'); + assert.equal(expand.textContent, 'Attribution des données'); + assert.equal( + document.getElementById('gev-credits-panel-title').textContent, + 'Données fournies par\u202f:', + ); + assert.equal( + close.getAttribute('aria-label'), + "Fermer l'attribution des données", + ); + } finally { + setLocale('en'); + } + assert.equal(expand.textContent, 'Data attribution'); + off(); +}); + +test('the line and its list are the last of the body, and its close button is the kit’s', () => { + const { viewer, renderer } = scene(); + document.body.append(document.createElement('main')); + renderer.credits.addStatic({ text: 'NOAA' }); + const off = mountCreditsView(viewer); + const children = [...document.body.children]; + assert.deepEqual( + children.slice(-2).map((element) => element.id), + ['gev-credits', 'gev-credits-panel'], + 'the page’s rules select them as children of the body', + ); + const close = document.querySelector('.gev-credits-close'); + assert.ok(close.classList.contains('ui-button'), 'a UiCloseButton'); + assert.equal(close.type, 'button'); + assert.equal(close.textContent, '×'); + assert.equal(close.hasAttribute('title'), false, 'no tip'); + assert.equal( + close.classList.contains('ui-close-button'), + false, + 'bare: it keeps the browser’s padding', + ); + off(); + assert.deepEqual( + [...document.body.children].map((element) => element.tagName), + ['MAIN'], + ); +}); From b5fcc39bc02e6a0ec52813a49fc7a1cc06d90ff7 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Thu, 19 Nov 2026 02:14:22 -0800 Subject: [PATCH 6/6] Add the changelog entry for #1844 Co-authored-by: Manjunath Paparaju --- changelog.d/1844-sfc-credits.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog.d/1844-sfc-credits.md diff --git a/changelog.d/1844-sfc-credits.md b/changelog.d/1844-sfc-credits.md new file mode 100644 index 0000000000..df9de4f430 --- /dev/null +++ b/changelog.d/1844-sfc-credits.md @@ -0,0 +1,3 @@ +- The data credits line and its list are now a single-file component. The + close button is the kit's, and a focused link keeps focus when the list + redraws (manjunath22466, samehkhamis, #1844).